:root {
  /* Google Sans is proprietary and not served by Google Fonts, so it is used
     when it happens to be installed locally and DM Sans (its closest freely
     licensed match) is loaded as the fallback. */
  --font-sans:
    "Google Sans", "Google Sans Text", "Product Sans", "DM Sans", system-ui, -apple-system,
    "Segoe UI", Roboto, sans-serif;
  --bg: #fbf6ee;
  --bg-deep: #f3e9db;
  --surface: #ffffff;
  --ink: #10263a;
  --ink-soft: #5e7386;
  --line: #e7dfd2;

  --teal: #17765c;
  --teal-dark: #0e5b46;
  --teal-soft: #e2f0ea;
  --amber: #efaf3c;
  --amber-dark: #d2932a;
  --amber-soft: #fdf2dc;
  --amber-text: #85631a;
  --violet: #6d5ce7;
  --violet-soft: #edeaff;
  --danger: #c0334d;

  --navy: #0e1b2b;
  --navy-soft: #17293d;

  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 18px 40px -24px rgb(16 38 58 / 40%);
  --shadow-soft: 0 10px 30px -26px rgb(16 38 58 / 35%);
}

* {
  box-sizing: border-box;
}

/* The screens set display themselves (flex, grid), which would otherwise beat
   the hidden attribute's default display: none and leave every screen on the
   page at once. */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--bg);
  transition: background 0.4s ease;
}

/* Soft decorative shapes, the pastel blobs from the design. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(420px 380px at 12% 18%, rgb(23 118 92 / 12%), transparent 70%),
    radial-gradient(360px 320px at 88% 12%, rgb(239 175 60 / 18%), transparent 70%),
    radial-gradient(420px 400px at 82% 88%, rgb(109 92 231 / 12%), transparent 70%),
    var(--bg-deep);
  opacity: 0.9;
  transition: opacity 0.4s ease;
}

body.is-dark {
  color: #eef3f8;
  background: var(--navy);
}

body.is-dark::before {
  opacity: 0;
}

.app {
  min-height: 100vh;
}

.screen--center {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 40px 20px;
}

/* ============================== brand =============================== */

.logo {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 56px;
}

.logo__card {
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, var(--navy) 0%, #24384f 100%);
  border-radius: 8px;
  transform: rotate(-8deg);
}

.logo__bolt {
  position: absolute;
  top: 12px;
  right: -6px;
  width: 20px;
  height: 32px;
  background: var(--amber);
  clip-path: polygon(55% 0, 0 58%, 42% 58%, 28% 100%, 100% 38%, 52% 38%);
}

.logo--small {
  width: 26px;
  height: 32px;
}

.logo--small .logo__bolt {
  top: 6px;
  right: -4px;
  width: 12px;
  height: 20px;
}

/* =============================== home =============================== */

.home {
  width: 100%;
  max-width: 720px;
  text-align: center;
}

.home__brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.home__title {
  margin: 10px 0 0;
  font-size: clamp(34px, 8vw, 52px);
  font-weight: 700;
  letter-spacing: -0.035em;
  color: var(--navy);
}

.home__title span {
  color: var(--teal);
}

.home__tagline {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
}

.home__note {
  margin: 0;
  font-size: 13px;
  color: var(--ink-soft);
}

.choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin: 34px 0 18px;
}

.choice {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 26px 24px 62px;
  font: inherit;
  text-align: left;
  color: #ffffff;
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.choice:hover {
  transform: translateY(-3px);
  box-shadow: 0 26px 50px -26px rgb(16 38 58 / 50%);
}

.choice:focus-visible {
  outline: 3px solid var(--violet);
  outline-offset: 3px;
}

.choice--create {
  background: linear-gradient(165deg, #1c8468 0%, var(--teal-dark) 100%);
}

.choice--join {
  background: linear-gradient(165deg, #f6bf58 0%, var(--amber-dark) 100%);
  color: #3b2a06;
}

.choice__icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  font-size: 20px;
  font-weight: 700;
  background: rgb(255 255 255 / 25%);
  border-radius: 12px;
}

.choice__title {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.choice__text {
  font-size: 13px;
  line-height: 1.5;
  opacity: 0.9;
}

.choice__go {
  position: absolute;
  bottom: 22px;
  left: 24px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  font-size: 15px;
  background: rgb(255 255 255 / 28%);
  border-radius: 50%;
}

.home__footnote {
  margin: 0;
  font-size: 12px;
  color: var(--ink-soft);
}

.deck-list__heading {
  margin: 30px 0 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: left;
  color: var(--ink-soft);
}

.deck-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}

.deck-list__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-soft);
}

.deck-list__info {
  min-width: 0;
}

.deck-list__title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.deck-list__meta {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--ink-soft);
}

.deck-list__actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* ============================== panels ============================== */

.panel {
  position: relative;
  width: 100%;
  max-width: 460px;
  padding: 34px 30px 30px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.panel__back {
  position: absolute;
  top: 18px;
  left: 18px;
}

.panel__icon {
  display: inline-grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin-bottom: 12px;
  font-size: 24px;
  font-weight: 700;
  border-radius: 16px;
}

.panel__icon--teal {
  color: var(--teal-dark);
  background: var(--teal-soft);
}

.panel__icon--amber {
  color: var(--amber-dark);
  background: var(--amber-soft);
}

.panel__title {
  margin: 0 0 4px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.panel__hint {
  margin: 0 0 22px;
  font-size: 14px;
  color: var(--ink-soft);
}

.notice {
  margin: 20px 0 0;
  padding: 14px 16px;
  font-size: 13px;
  line-height: 1.5;
  text-align: left;
  color: var(--teal-dark);
  background: var(--teal-soft);
  border-radius: var(--radius-sm);
}

.notice--muted {
  color: var(--ink-soft);
  background: #f4f1ea;
}

.reveal {
  margin: 0 0 14px;
  padding: 14px 16px;
  text-align: left;
  background: #f7f4ee;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.reveal--warn {
  background: var(--amber-soft);
  border-color: #efdcb4;
}

.reveal__label {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.reveal__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.reveal__value {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.reveal__hint {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--amber-text);
}

.reveal__hint--plain {
  color: var(--ink-soft);
}

/* ============================== forms =============================== */

form {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.field__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

label {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
}

input,
textarea {
  padding: 12px 14px;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  background: #fbf9f5;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  resize: vertical;
}

input:focus,
textarea:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-soft);
}

.counter-chip {
  font-size: 11px;
  color: var(--ink-soft);
}

.form-message {
  margin: 0 0 12px;
  min-height: 18px;
  font-size: 13px;
  color: var(--teal-dark);
}

/* ============================= buttons ============================== */

.btn {
  padding: 11px 18px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition:
    transform 0.15s ease,
    background 0.15s ease,
    border-color 0.15s ease,
    opacity 0.15s ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn:focus-visible {
  outline: 3px solid var(--violet);
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn--block {
  width: 100%;
}

.btn--teal {
  color: #ffffff;
  background: var(--teal);
  border-color: var(--teal);
}

.btn--teal:hover:not(:disabled) {
  background: var(--teal-dark);
}

.btn--amber {
  color: #3b2a06;
  background: var(--amber);
  border-color: var(--amber);
}

.btn--amber:hover:not(:disabled) {
  background: var(--amber-dark);
}

.btn--violet {
  color: #ffffff;
  background: var(--violet);
  border-color: var(--violet);
}

.btn--violet:hover:not(:disabled) {
  background: #5b4bd6;
}

.btn--ghost {
  background: transparent;
}

.btn--ghost:hover:not(:disabled) {
  border-color: var(--teal);
}

.btn--danger {
  color: var(--danger);
  background: transparent;
  border-color: transparent;
}

.btn--danger:hover:not(:disabled) {
  background: #fdf0f2;
  border-color: #f2ccd4;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  font: inherit;
  font-size: 14px;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  transition:
    color 0.15s ease,
    border-color 0.15s ease,
    background 0.15s ease;
}

.icon-btn:hover:not(:disabled) {
  color: var(--ink);
  border-color: var(--teal);
}

.icon-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.icon-btn:focus-visible {
  outline: 3px solid var(--violet);
  outline-offset: 2px;
}

.icon-btn--row {
  width: 30px;
  height: 30px;
  font-size: 13px;
}

.icon-btn--danger:hover:not(:disabled) {
  color: var(--danger);
  border-color: #f2ccd4;
  background: #fdf0f2;
}

.link-btn {
  padding: 0;
  margin-top: 8px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--teal);
  background: none;
  border: none;
  text-decoration: underline;
  cursor: pointer;
}

/* ============================ dashboard ============================= */

.screen--dash {
  min-height: 100vh;
}

.dash {
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: 22px 28px 48px;
  overflow-x: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 18px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px;
  font: inherit;
  color: var(--navy);
  background: none;
  border: none;
  cursor: pointer;
}

.topbar__name {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.topbar__brand:hover .topbar__name {
  color: var(--teal);
}

.topbar__brand:focus-visible {
  outline: 3px solid var(--violet);
  outline-offset: 3px;
  border-radius: 10px;
}

.dash__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.dash__heading {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.dash__title {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.025em;
  overflow-wrap: anywhere;
}

.rename-input {
  font-size: 22px;
  font-weight: 700;
}

.dash__actions {
  display: flex;
  gap: 10px;
}

.dash__status {
  margin: 10px 0 0;
  min-height: 18px;
  font-size: 13px;
  color: var(--teal-dark);
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin: 18px 0 26px;
}

.info {
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-soft);
}

.info__label {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.info__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.info__value {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.info__hint {
  margin: 8px 0 0;
  font-size: 11px;
  line-height: 1.5;
  color: var(--ink-soft);
}

.info--qr {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.qr {
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  padding: 2px;
  font-size: 10px;
  line-height: 1.4;
  text-align: center;
  color: var(--ink-soft);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.qr svg {
  display: block;
  width: 100%;
  height: 100%;
}

.qr__placeholder {
  padding: 6px;
}

/* ============================== share =============================== */

.share {
  margin: 0 0 26px;
  padding: 20px 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.share__title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}

.share__hint {
  margin: 4px 0 14px;
  max-width: 62ch;
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-soft);
}

.share__row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.share__link {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-family: var(--font-sans);
  color: var(--ink-soft);
  text-overflow: ellipsis;
}

.share__note:empty {
  display: none;
}

.share__note {
  margin: 10px 0 0;
  max-width: 62ch;
  font-size: 12px;
  line-height: 1.55;
  /* Deliberately darker than --amber-dark: this is small text on white and has
     to clear WCAG AA, which the brand amber does not. */
  color: var(--amber-text);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.cards__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.cards__title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.card-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-soft);
}

.card-row.is-editing {
  border-color: var(--violet);
  box-shadow: 0 0 0 3px var(--violet-soft);
}

.card-row__index {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  font-size: 12px;
  font-weight: 700;
  color: var(--amber-text);
  background: var(--amber-soft);
  border-radius: 8px;
}

.card-row__text {
  min-width: 0;
}

.card-row__q {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.card-row__a {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--ink-soft);
  overflow-wrap: anywhere;
}

.card-row__actions {
  display: flex;
  gap: 6px;
}

.cards__empty {
  margin: 0;
  padding: 26px;
  font-size: 14px;
  text-align: center;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
}

.editor {
  margin-top: 24px;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.editor__header {
  margin-bottom: 16px;
}

.editor__title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.editor__hint {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--ink-soft);
}

.editor__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.gate {
  max-width: 460px;
  margin: 60px auto;
  padding: 26px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.gate__title {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 700;
}

.gate__text {
  margin: 0 0 18px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-soft);
}

/* ============================== study =============================== */

.screen--study {
  display: grid;
  align-content: center;
  min-height: 100vh;
  padding: 26px 20px 40px;
}

.study {
  max-width: 620px;
  margin: 0 auto;
}

.study__bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 26px;
}

.pill {
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 600;
  color: #eaf1f8;
  background: rgb(255 255 255 / 10%);
  border-radius: 999px;
  white-space: nowrap;
}

.pill--muted {
  color: #9fb2c4;
}

.study__deck {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: #9fb2c4;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.study__foot {
  margin: 24px 0 0;
  font-size: 12px;
  text-align: center;
  color: #7e93a8;
}

.btn--quiet {
  color: #e7eef5;
  background: rgb(255 255 255 / 8%);
  border-color: rgb(255 255 255 / 14%);
}

.btn--quiet:hover:not(:disabled) {
  background: rgb(255 255 255 / 16%);
}

.btn--round {
  width: 46px;
  height: 46px;
  padding: 0;
  font-size: 18px;
  border-radius: 50%;
  color: #22201a;
  background: var(--amber);
  border-color: var(--amber);
}

/* 3D stage: the deck owns the perspective so the card and the stacked
   layers behind it all live in the same 3D space. */
.deck {
  position: relative;
  min-height: 300px;
  perspective: 1400px;
  perspective-origin: 50% 40%;
  transform-style: preserve-3d;
  animation: deck-float 7s ease-in-out infinite;
}

.deck__layer {
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, #ffffff 0%, #e7e3f6 100%);
  border-radius: var(--radius);
  box-shadow: 0 14px 30px -18px rgb(0 0 0 / 55%);
  transition:
    opacity 0.4s ease,
    transform 0.5s cubic-bezier(0.4, 0.1, 0.2, 1);
}

.deck__layer--near {
  transform: translate3d(0, 12px, -34px) rotateZ(-2.6deg);
}

.deck__layer--far {
  transform: translate3d(0, 24px, -70px) rotateZ(3.8deg);
  opacity: 0.72;
}

/* Only show the stack when there is actually more than one card behind it. */
.deck:not(.has-stack) .deck__layer {
  opacity: 0;
  transform: translate3d(0, 0, -10px);
}

.card {
  position: absolute;
  inset: 0;
  cursor: pointer;
  border-radius: var(--radius);
  transform-style: preserve-3d;
}

.card:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 4px;
}

/* Tilt lives on its own layer so it can never fight the flip transform. */
.card__tilt {
  position: absolute;
  inset: 0;
  transform: rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg));
  transition: transform 0.4s ease;
  transform-style: preserve-3d;
}

.deck.is-tilting .card__tilt {
  transition: transform 0.08s linear;
}

.card__inner {
  position: absolute;
  inset: 0;
  transition: transform 0.55s cubic-bezier(0.4, 0.1, 0.2, 1);
  transform-style: preserve-3d;
}

.card__inner.is-flipped {
  transform: rotateY(180deg);
}

.card__face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 32px 28px;
  text-align: center;
  color: var(--ink);
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 26px 50px -28px rgb(0 0 0 / 70%);
  backface-visibility: hidden;
}

.card__face--back {
  background: linear-gradient(160deg, #ffffff 0%, var(--violet-soft) 100%);
  transform: rotateY(180deg);
}

/* Light glare that follows the cursor, which is what actually sells the tilt. */
.card__face::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    50% 45% at var(--glare-x, 50%) var(--glare-y, 0%),
    rgb(255 255 255 / 85%),
    rgb(255 255 255 / 0%) 70%
  );
  opacity: var(--glare-opacity, 0);
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.card__label {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--violet);
}

.card__text {
  margin: 0;
  /* Short lines on purpose: a single long line runs into the tilted edge of the
     card, where the glare makes the last few characters hard to read. */
  max-width: 26ch;
  font-size: clamp(20px, 4vw, 26px);
  font-weight: 700;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.card__hint {
  margin: 0;
  font-size: 12px;
  color: var(--ink-soft);
}

/* 3D motion: idle float, navigation slides, shuffle riffle, new-card drop */
@keyframes deck-float {
  0%,
  100% {
    transform: translateY(0) rotateX(0deg);
  }
  50% {
    transform: translateY(-6px) rotateX(1.2deg);
  }
}

@keyframes card-enter-right {
  from {
    transform: translate3d(55%, 0, -220px) rotateY(-38deg);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

@keyframes card-enter-left {
  from {
    transform: translate3d(-55%, 0, -220px) rotateY(38deg);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

@keyframes card-drop-in {
  from {
    transform: translate3d(0, -60px, 260px) rotateX(24deg);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

@keyframes card-riffle {
  0% {
    transform: none;
  }
  30% {
    transform: translate3d(-16%, -10px, -90px) rotateZ(-9deg) rotateY(14deg);
  }
  62% {
    transform: translate3d(14%, 6px, -50px) rotateZ(7deg) rotateY(-11deg);
  }
  100% {
    transform: none;
  }
}

@keyframes layer-riffle-near {
  0% {
    transform: translate3d(0, 12px, -34px) rotateZ(-2.6deg);
  }
  35% {
    transform: translate3d(22%, 2px, -74px) rotateZ(13deg);
  }
  70% {
    transform: translate3d(-12%, 14px, -48px) rotateZ(-8deg);
  }
  100% {
    transform: translate3d(0, 12px, -34px) rotateZ(-2.6deg);
  }
}

@keyframes layer-riffle-far {
  0% {
    transform: translate3d(0, 24px, -70px) rotateZ(3.8deg);
  }
  40% {
    transform: translate3d(-24%, 10px, -110px) rotateZ(-15deg);
  }
  75% {
    transform: translate3d(16%, 28px, -84px) rotateZ(9deg);
  }
  100% {
    transform: translate3d(0, 24px, -70px) rotateZ(3.8deg);
  }
}

@keyframes screen-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.994);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes row-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.card.is-entering-right {
  animation: card-enter-right 0.45s cubic-bezier(0.2, 0.7, 0.3, 1);
}

.card.is-entering-left {
  animation: card-enter-left 0.45s cubic-bezier(0.2, 0.7, 0.3, 1);
}

.card.is-dropping-in {
  animation: card-drop-in 0.55s cubic-bezier(0.2, 0.8, 0.3, 1);
}

.deck.is-shuffling .card {
  animation: card-riffle 0.7s cubic-bezier(0.4, 0.1, 0.2, 1);
}

.deck.is-shuffling .deck__layer--near {
  animation: layer-riffle-near 0.7s cubic-bezier(0.4, 0.1, 0.2, 1);
}

.deck.is-shuffling .deck__layer--far {
  animation: layer-riffle-far 0.7s cubic-bezier(0.4, 0.1, 0.2, 1);
}

.deck.is-empty {
  min-height: 0;
  animation: none;
}

.screen:not([hidden]) {
  animation: screen-in 0.35s cubic-bezier(0.2, 0.7, 0.3, 1);
}

/* A short stagger so a long deck lands as a list rather than a slab. It is
   capped: past a handful of rows the delay stops growing. */
.card-row {
  animation: row-in 0.3s ease backwards;
}

.card-row:nth-child(1) {
  animation-delay: 0.02s;
}

.card-row:nth-child(2) {
  animation-delay: 0.04s;
}

.card-row:nth-child(3) {
  animation-delay: 0.06s;
}

.card-row:nth-child(4) {
  animation-delay: 0.08s;
}

.card-row:nth-child(n + 5) {
  animation-delay: 0.1s;
}

/* Glass over the pastel background, where the browser can do it cheaply. The
   solid rule above stays as the fallback. */
@supports (backdrop-filter: blur(2px)) {
  .panel,
  .gate,
  .info,
  .share,
  .editor,
  .deck-list__item {
    background: rgb(255 255 255 / 74%);
    backdrop-filter: blur(18px) saturate(120%);
  }

  .card-row {
    background: rgb(255 255 255 / 82%);
    backdrop-filter: blur(10px);
  }
}

.empty {
  margin: 0;
  padding: 56px 28px;
  font-size: 14px;
  text-align: center;
  color: #9fb2c4;
  background: rgb(255 255 255 / 6%);
  border: 1px dashed rgb(255 255 255 / 18%);
  border-radius: var(--radius);
}

.controls,
.actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 22px;
}

.actions {
  margin-top: 12px;
}

/* =============================== toast =============================== */

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 20;
  max-width: min(520px, calc(100vw - 32px));
  padding: 12px 18px;
  font-size: 13px;
  font-weight: 500;
  color: #f4f8fb;
  background: rgb(14 27 43 / 96%);
  border-radius: 999px;
  box-shadow: var(--shadow);
  transform: translate(-50%, 14px);
  opacity: 0;
  transition:
    opacity 0.25s ease,
    transform 0.25s ease;
}

.toast.is-visible {
  transform: translate(-50%, 0);
  opacity: 1;
}

/* ============================ responsive ============================ */

@media (max-width: 860px) {
  .dash {
    padding: 18px 16px 40px;
  }
}

@media (max-width: 560px) {
  .choices {
    grid-template-columns: minmax(0, 1fr);
  }

  .deck {
    min-height: 260px;
    perspective: 900px;
  }

  .deck-list__item,
  .card-row {
    flex-wrap: wrap;
  }

  .dash__actions,
  .cards__header {
    width: 100%;
  }

  .study__deck {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .card__inner,
  .card__tilt,
  .deck__layer,
  .card__face::after,
  .btn,
  .toast {
    transition: none;
  }

  .deck,
  .deck.is-shuffling .card,
  .deck.is-shuffling .deck__layer--near,
  .deck.is-shuffling .deck__layer--far,
  .card.is-entering-right,
  .card.is-entering-left,
  .card.is-dropping-in,
  .screen:not([hidden]),
  .card-row {
    animation: none;
  }

  /* The flip still needs to communicate the state change, just instantly. */
  .card__tilt {
    transform: none;
  }
}
