/* ============================================================================
   Curio · Kérdések — "the drawn card"
   A single question at a time, presented like a card drawn from a deck: a soft
   spotlit surface, the question set in an optical serif, the whole scene quietly
   tinted by the current category's own hue. Bilingual (HU/EN), category-filtered.
   No build step, no framework — HTML, CSS and vanilla JS.
   ========================================================================== */

/* the live category hue — a registered <number> so it TWEENS between categories */
@property --h { syntax: '<number>'; inherits: true; initial-value: 262; }

:root {
  --h: 262;

  --bg:      #0c0d12;
  --bg-deep: #08090d;
  --bg-2:    #101119;
  --surface: #14151f;
  --surface-2: #191b26;

  --ink:    #ecebf2;
  --ink-2:  #c4c2cf;
  --muted:  #8b8898;
  --faint:  #5b5866;
  --hairline: rgba(236, 235, 242, 0.10);
  --hairline-2: rgba(236, 235, 242, 0.16);

  --heart:  #e5556b;

  /* everything accent-y derives from the single hue --h */
  --accent:      hsl(var(--h) 68% 70%);
  --accent-2:    hsl(var(--h) 55% 62%);
  --accent-deep: hsl(var(--h) 60% 46%);
  --accent-dim:  hsl(var(--h) 40% 40%);
  --glow:        hsl(var(--h) 80% 60% / 0.28);
  --glow-soft:   hsl(var(--h) 75% 60% / 0.14);
  --wash:        hsl(var(--h) 60% 55% / 0.07);

  --ease-soft: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out:  cubic-bezier(0.4, 0, 0.2, 1);
  --ease-press: cubic-bezier(0.34, 1.4, 0.64, 1);

  --font-serif: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-sans:  "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  /* the category hue (--h) is tweened in JS, not via a CSS transition:
     a CSS transition on a registered <number> property gets pinned to its
     initial-value in Chromium and never settles. */
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  height: 100svh; height: 100dvh;
  display: flex; flex-direction: column;
  overflow: hidden;                     /* fixed viewport — the page never scrolls */
  font-family: var(--font-sans);
  color: var(--ink);
  background:
    radial-gradient(130% 100% at 50% -10%, #14151d 0%, var(--bg) 46%, var(--bg-deep) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  opacity: 0;
  transition: opacity 800ms ease;
}
body.is-ready { opacity: 1; }

/* ---- slow ambient aurora, tinted by --accent ------------------------------ */
.aurora {
  position: fixed; inset: -20% -10% 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(38% 42% at 22% 28%, hsl(var(--h) 70% 55% / 0.22), transparent 70%),
    radial-gradient(34% 40% at 82% 72%, hsl(calc(var(--h) + 40) 65% 55% / 0.16), transparent 70%),
    radial-gradient(30% 34% at 65% 12%, hsl(calc(var(--h) - 35) 60% 55% / 0.12), transparent 70%);
  filter: blur(24px) saturate(1.05);
  opacity: 0.9;
  animation: aurora-drift 42s ease-in-out infinite;
  will-change: transform;
}
@keyframes aurora-drift {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  33%      { transform: translate3d(2.4vw, -1.6vh, 0) scale(1.06); }
  66%      { transform: translate3d(-1.8vw, 1.8vh, 0) scale(1.03); }
}

/* ---- fine paper grain ----------------------------------------------------- */
.grain {
  position: fixed; inset: 0; z-index: 2; pointer-events: none;
  opacity: 0.045; mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---- giant ? glyph, bleeding off the corner ------------------------------- */
.glyph {
  position: fixed; right: -0.06em; bottom: -0.22em; z-index: 1; pointer-events: none;
  font-family: var(--font-serif); font-weight: 500; font-style: italic;
  font-size: 62vh; line-height: 0.8;
  color: hsl(var(--h) 40% 70% / 0.05);
  user-select: none; will-change: transform;
  animation: glyph-drift 50s ease-in-out infinite;
}
@keyframes glyph-drift {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  50%      { transform: translate(-1.4vmax, -1vmax) rotate(-2deg); }
}

/* ---- topbar --------------------------------------------------------------- */
.topbar {
  position: relative; z-index: 40; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px;
  padding: 15px clamp(16px, 4vw, 44px);
}
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; }
.brand-mark {
  display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 10px;
  font-family: var(--font-serif); font-style: italic; font-weight: 600; font-size: 20px;
  color: var(--accent);
  background: linear-gradient(160deg, hsl(var(--h) 45% 22% / 0.6), hsl(var(--h) 45% 14% / 0.35));
  border: 1px solid hsl(var(--h) 50% 60% / 0.28);
  box-shadow: 0 0 22px -6px var(--glow), inset 0 1px 0 rgba(255,255,255,0.08);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-name { font-family: var(--font-serif); font-weight: 600; font-size: 18px; letter-spacing: 0.01em; color: var(--ink); }
.brand-tag  { font-family: var(--font-sans); font-weight: 400; font-size: 10.5px; letter-spacing: 0.12em; color: var(--muted); text-transform: uppercase; }

.topbar-right { display: flex; align-items: center; gap: clamp(8px, 1.4vw, 14px); }

/* language toggle */
.lang {
  display: inline-flex; align-items: center; gap: 2px;
  border: 1px solid var(--hairline); border-radius: 999px; padding: 3px;
  background: rgba(236, 235, 242, 0.02);
}
.lang-btn {
  appearance: none; cursor: pointer; border: 0; background: transparent;
  color: var(--muted); font-family: var(--font-sans); font-weight: 600; font-size: 11px; letter-spacing: 0.08em;
  padding: 5px 10px; border-radius: 999px; line-height: 1;
  transition: color 200ms, background 240ms var(--ease-out);
}
.lang-btn:hover { color: var(--ink-2); }
.lang-btn.is-active { color: #14151f; background: var(--accent); box-shadow: 0 0 16px -4px var(--glow); }
.lang-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lang-sep { width: 1px; height: 12px; background: var(--hairline); }

/* topbar pills (categories + saved) */
.pill {
  appearance: none; cursor: pointer; display: inline-flex; align-items: center; gap: 7px;
  background: rgba(236, 235, 242, 0.02); border: 1px solid var(--hairline); border-radius: 999px;
  padding: 6px 12px; color: var(--muted);
  font-family: var(--font-sans); font-weight: 500; font-size: 11px; letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  transition: color 200ms, border-color 200ms, background 200ms, transform 130ms var(--ease-out);
}
.pill svg { fill: currentColor; opacity: 0.9; }
.pill:hover { color: var(--ink-2); border-color: var(--hairline-2); }
.pill:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cats-open.is-filtered { color: var(--ink); border-color: hsl(var(--h) 50% 60% / 0.4); }
.cats-open.is-filtered svg { fill: var(--accent); opacity: 1; }
.saved-open svg { fill: none; stroke: currentColor; stroke-width: 1.6; }
.saved-open.has-saved svg { fill: var(--heart); stroke: var(--heart); }
.saved-open.has-saved { color: var(--ink-2); }

/* ---- stage ---------------------------------------------------------------- */
.stage {
  position: relative; z-index: 10; flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column;
  padding: 4px clamp(18px, 5vw, 56px) 14px;
}
.scene-wrap { flex: 1 1 auto; min-height: 0; display: grid; place-items: center; overflow: hidden; }

.scene {
  width: 100%; max-width: 720px;
  transform-origin: center center;      /* JS scales this so it always fits */
  transition: opacity 260ms var(--ease-out);
}
.scene.is-out { opacity: 0; }

/* the card */
.card {
  position: relative;
  padding: clamp(26px, 4vw, 44px) clamp(24px, 4vw, 46px) clamp(22px, 3vw, 34px);
  border-radius: 20px;
  background:
    linear-gradient(180deg, hsl(var(--h) 30% 12% / 0.35), rgba(20, 21, 31, 0.5)),
    var(--surface);
  border: 1px solid var(--hairline-2);
  box-shadow:
    0 40px 80px -32px rgba(0, 0, 0, 0.8),
    0 0 60px -18px var(--glow-soft),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  overflow: hidden;
}
/* top accent hairline */
.card::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.7;
}
/* soft interior top-light */
.card::after {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 55%; pointer-events: none;
  background: radial-gradient(80% 100% at 50% 0%, var(--wash), transparent 72%);
}

.card-top {
  position: relative; z-index: 1;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  margin-bottom: clamp(18px, 2.6vw, 26px);
}

.chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 11px 5px 9px; border-radius: 999px;
  background: hsl(var(--h) 45% 30% / 0.18);
  border: 1px solid hsl(var(--h) 55% 62% / 0.32);
  color: var(--accent);
  font-family: var(--font-sans); font-weight: 600; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
}
.chip-emoji { font-size: 13px; line-height: 1; filter: saturate(1.05); }

.folio {
  font-family: var(--font-sans); font-weight: 500; font-size: 10.5px; letter-spacing: 0.14em;
  color: var(--faint); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.folio .num { color: var(--accent-2); }

.question {
  position: relative; z-index: 1; margin: 0;
  font-family: var(--font-serif); font-weight: 500; color: var(--ink);
  line-height: 1.34; letter-spacing: -0.005em;
  text-wrap: pretty; overflow-wrap: break-word;
  --qs: clamp(1.5rem, 1.05rem + 1.9vw, 2.35rem);
  font-size: var(--qs);
}
.question[data-len="short"] { --qs: clamp(1.9rem, 1.2rem + 3vw, 3.05rem); line-height: 1.22; font-weight: 600; }
.question[data-len="mid"]   { --qs: clamp(1.6rem, 1.05rem + 2.2vw, 2.5rem); }
.question[data-len="long"]  { --qs: clamp(1.28rem, 1rem + 1.2vw, 1.75rem); line-height: 1.44; }

/* typewriter caret while the question types itself in */
.question.is-typing::after {
  content: ""; display: inline-block; width: 2px; height: 0.82em; margin-left: 4px;
  vertical-align: -0.04em; background: var(--accent); border-radius: 2px;
  box-shadow: 0 0 12px var(--glow);
  animation: caret 850ms steps(1, end) infinite;
}
@keyframes caret { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }

.card-foot {
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: 10px;
  margin-top: clamp(20px, 3vw, 30px);
}
.ask-mark {
  font-family: var(--font-serif); font-style: italic; font-weight: 600; font-size: 20px; line-height: 1;
  color: var(--accent); opacity: 0.85;
}
.foot-hint {
  font-family: var(--font-sans); font-weight: 500; font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--faint);
}

/* staged reveal: the meta waits (".pre") until its beat */
.card-top, .card-foot { transition: opacity 620ms var(--ease-soft), filter 620ms var(--ease-soft); }
.card-top.pre, .card-foot.pre { opacity: 0; filter: blur(4px); }

/* empty state */
.empty { display: none; flex-direction: column; align-items: center; gap: 16px; text-align: center; padding: 20px; }
.empty:not([hidden]) { display: flex; }
.empty-glyph { font-family: var(--font-serif); font-size: 3rem; color: var(--faint); }
.empty-text { max-width: 30ch; margin: 0; color: var(--muted); font-size: 15px; line-height: 1.5; }

/* ---- controls ------------------------------------------------------------- */
.controls { flex: 0 0 auto; display: flex; justify-content: center; align-items: center; gap: 11px; padding-top: 10px; }

.icon-btn {
  appearance: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  width: 46px; height: 46px; padding: 0; border-radius: 12px;
  background: rgba(236, 235, 242, 0.015); border: 1px solid var(--hairline); color: var(--muted);
  transition: color 200ms, border-color 200ms, background 200ms, transform 130ms var(--ease-out);
}
.icon-btn svg { fill: none; stroke: currentColor; stroke-width: 1.6; }
.icon-btn:hover { color: var(--ink-2); border-color: var(--hairline-2); }
.icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon-btn[aria-pressed="true"] { color: var(--heart); border-color: color-mix(in srgb, var(--heart) 45%, transparent); background: color-mix(in srgb, var(--heart) 9%, transparent); }
.icon-btn[aria-pressed="true"] svg { fill: var(--heart); stroke: var(--heart); }

.btn {
  appearance: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  height: 46px; padding: 0 24px; border-radius: 12px;
  font-family: var(--font-sans); font-weight: 600; font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); background: rgba(236, 235, 242, 0.015); border: 1px solid var(--hairline);
  transition: color 200ms, border-color 200ms, background 200ms, box-shadow 240ms, transform 130ms var(--ease-out);
}
.btn:hover { color: var(--ink); border-color: var(--hairline-2); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn--primary {
  color: #14151f;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  border-color: transparent;
  box-shadow: 0 10px 30px -12px var(--glow), inset 0 1px 0 rgba(255,255,255,0.25);
}
.btn--primary:hover { color: #0f1017; box-shadow: 0 14px 38px -12px var(--glow), inset 0 1px 0 rgba(255,255,255,0.3); }

.btn.is-copied { color: var(--ink); border-color: hsl(var(--h) 50% 60% / 0.5); background: var(--wash); }

/* one unified press for every button */
.icon-btn:active, .btn:active, .pill:active, .lang-btn:active,
.overlay-close:active, .mini-btn:active, .fav-card__rm:active { transform: scale(0.94); }

/* keyboard hints */
.hints { flex: 0 0 auto; display: flex; justify-content: center; flex-wrap: wrap; gap: 16px; margin: 12px 0 2px; }
.hint { display: inline-flex; align-items: center; gap: 6px; font-size: 10.5px; letter-spacing: 0.06em; color: var(--faint); text-transform: uppercase; }
kbd {
  font-family: var(--font-sans); font-size: 9.5px; font-weight: 600; letter-spacing: 0.04em;
  padding: 2px 6px; border-radius: 5px; color: var(--muted);
  background: rgba(236, 235, 242, 0.04); border: 1px solid var(--hairline); border-bottom-width: 2px;
}

/* ---- overlays (shared shell) --------------------------------------------- */
.overlay {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(6, 7, 11, 0.7);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  opacity: 0; transition: opacity 360ms var(--ease-out);
}
.overlay[hidden] { display: none; }
.overlay.is-open { opacity: 1; }
.overlay-panel {
  display: flex; flex-direction: column;
  width: min(940px, 100%); margin: 0 auto; height: 100%;
  padding: clamp(18px, 5vh, 48px) clamp(18px, 5vw, 56px) clamp(16px, 4vh, 36px);
  transform: translateY(18px); opacity: 0;
  transition: transform 460ms var(--ease-soft), opacity 460ms var(--ease-soft);
}
.overlay.is-open .overlay-panel { transform: none; opacity: 1; }

.overlay-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding-bottom: 16px; border-bottom: 1px solid var(--hairline); }
.overlay-title { margin: 0; font-family: var(--font-serif); font-weight: 600; font-size: clamp(22px, 3.2vw, 30px); color: var(--ink); letter-spacing: 0.01em; }
.overlay-title-count { color: var(--muted); font-family: var(--font-sans); font-weight: 500; font-size: 0.5em; letter-spacing: 0.1em; margin-left: 6px; }
.overlay-head-actions { display: flex; align-items: center; gap: 8px; }
.overlay-close {
  appearance: none; cursor: pointer; background: transparent; border: 1px solid var(--hairline);
  color: var(--muted); width: 38px; height: 38px; border-radius: 10px; font-size: 14px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  transition: color 200ms, border-color 200ms, transform 130ms var(--ease-out);
}
.overlay-close:hover { color: var(--ink); border-color: var(--hairline-2); }
.overlay-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.mini-btn {
  appearance: none; cursor: pointer; background: rgba(236, 235, 242, 0.02); border: 1px solid var(--hairline);
  color: var(--muted); height: 32px; padding: 0 12px; border-radius: 8px;
  font-family: var(--font-sans); font-weight: 600; font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase;
  transition: color 200ms, border-color 200ms, background 200ms, transform 130ms var(--ease-out);
}
.mini-btn:hover { color: var(--ink); border-color: var(--hairline-2); }
.mini-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.overlay-sub { margin: 14px 2px 4px; color: var(--muted); font-size: 12px; letter-spacing: 0.04em; font-variant-numeric: tabular-nums; }

/* ---- category grid -------------------------------------------------------- */
.cat-grid {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; margin-top: 14px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; align-content: start;
  scrollbar-width: thin; scrollbar-color: var(--hairline-2) transparent;
}
.cat-grid::-webkit-scrollbar { width: 8px; }
.cat-grid::-webkit-scrollbar-thumb { background: var(--hairline-2); border-radius: 8px; }

.cat-cell {
  --ch: 262;
  position: relative; cursor: pointer; text-align: left; appearance: none; font: inherit; color: var(--ink-2);
  display: flex; align-items: center; gap: 11px; min-width: 0;
  padding: 12px 13px; border-radius: 12px;
  background: rgba(236, 235, 242, 0.02);
  border: 1px solid var(--hairline);
  transition: border-color 200ms, background 200ms, color 200ms, opacity 200ms, transform 130ms var(--ease-out);
}
.cat-cell:hover { border-color: var(--hairline-2); background: rgba(236, 235, 242, 0.04); }
.cat-cell:focus-visible { outline: 2px solid hsl(var(--ch) 65% 62%); outline-offset: 2px; }
.cat-cell__emoji {
  flex: 0 0 auto; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; font-size: 17px;
  background: hsl(var(--ch) 45% 30% / 0.16); border: 1px solid hsl(var(--ch) 55% 60% / 0.24);
}
.cat-cell__body { min-width: 0; flex: 1 1 auto; display: flex; flex-direction: column; gap: 1px; }
.cat-cell__name { font-family: var(--font-sans); font-weight: 600; font-size: 13.5px; color: inherit; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-cell__count { font-family: var(--font-sans); font-weight: 500; font-size: 10.5px; letter-spacing: 0.04em; color: var(--faint); font-variant-numeric: tabular-nums; }
.cat-cell__check {
  flex: 0 0 auto; width: 20px; height: 20px; border-radius: 6px;
  border: 1.5px solid var(--hairline-2); display: grid; place-items: center;
  color: transparent; transition: background 180ms, border-color 180ms, color 180ms;
}
.cat-cell.is-on { color: var(--ink); border-color: hsl(var(--ch) 55% 60% / 0.5); background: hsl(var(--ch) 50% 40% / 0.1); }
.cat-cell.is-on .cat-cell__check { background: hsl(var(--ch) 62% 58%); border-color: hsl(var(--ch) 62% 58%); color: #14151f; }
.cat-cell.is-off { opacity: 0.5; }
.cat-cell.is-off .cat-cell__emoji { filter: grayscale(0.5); }

/* ---- favorites list ------------------------------------------------------- */
.fav-empty { color: var(--muted); font-family: var(--font-serif); font-size: 16px; margin: 40px 2px; }
.fav-list {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; margin-top: 18px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); gap: 11px; align-content: start;
  scrollbar-width: thin; scrollbar-color: var(--hairline-2) transparent;
}
.fav-list::-webkit-scrollbar { width: 8px; }
.fav-list::-webkit-scrollbar-thumb { background: var(--hairline-2); border-radius: 8px; }

.fav-card {
  --ch: 262;
  position: relative; cursor: pointer; text-align: left; appearance: none; font: inherit; color: inherit;
  display: flex; flex-direction: column; gap: 10px; min-width: 0; overflow: hidden;
  min-height: 112px;
  background: rgba(236, 235, 242, 0.02); border: 1px solid var(--hairline); border-radius: 12px; padding: 15px 16px;
  transition: border-color 220ms, background 220ms, transform 130ms var(--ease-out);
}
.fav-card:hover { border-color: hsl(var(--ch) 50% 60% / 0.45); background: hsl(var(--ch) 50% 40% / 0.07); }
.fav-card:focus-visible { outline: 2px solid hsl(var(--ch) 65% 62%); outline-offset: 2px; }
.fav-card.removing { opacity: 0; transform: scale(0.94); filter: blur(2px); pointer-events: none;
  transition: opacity 540ms var(--ease-out), transform 540ms var(--ease-out), filter 540ms var(--ease-out); }
.fav-card__q {
  font-family: var(--font-serif); font-size: 15.5px; line-height: 1.4; color: var(--ink-2); padding-right: 26px;
  overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.fav-card__meta { margin-top: auto; display: inline-flex; align-items: center; gap: 7px; font-family: var(--font-sans); font-size: 10px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: hsl(var(--ch) 55% 68%); }
.fav-card__meta .em { font-size: 12px; }
.fav-card__rm {
  position: absolute; top: 10px; right: 10px; width: 26px; height: 26px; border-radius: 7px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(8, 9, 13, 0.55); border: 1px solid var(--hairline); color: var(--muted); cursor: pointer; font-size: 12px; line-height: 1;
  transition: color 180ms, border-color 180ms, background 180ms, transform 130ms var(--ease-out);
}
.fav-card__rm:hover, .fav-card__rm:focus-visible { color: var(--heart); border-color: color-mix(in srgb, var(--heart) 45%, transparent); background: rgba(8, 9, 13, 0.85); }

/* ---- loader --------------------------------------------------------------- */
.loader {
  position: fixed; inset: 0; z-index: 90; display: grid; place-items: center;
  background: var(--bg-deep); transition: opacity 600ms ease;
}
body.is-ready .loader { opacity: 0; pointer-events: none; }
.loader-mark { font-family: var(--font-serif); font-style: italic; font-weight: 600; font-size: 46px; color: var(--accent); opacity: 0.5; animation: breathe 2.4s ease-in-out infinite; }
body.is-ready .loader-mark { animation: none; }
@keyframes breathe { 0%, 100% { opacity: 0.24; } 50% { opacity: 0.6; } }

/* ===========================================================================
   Responsive
   =========================================================================== */
@media (max-width: 760px) {
  .brand-tag { display: none; }
  .stage { padding: 2px 16px 12px; }
  .card { padding: 24px 22px 20px; border-radius: 16px; }
  .hints { display: none; }               /* keyboard hints are pointless on phones */
  .cat-grid { grid-template-columns: 1fr 1fr; }
  .fav-list { grid-template-columns: 1fr; }
  .question[data-len="short"] { --qs: clamp(1.7rem, 1.1rem + 3.4vw, 2.4rem); }
  .question[data-len="mid"]   { --qs: clamp(1.45rem, 1rem + 2.6vw, 2rem); }
  .question[data-len="long"]  { --qs: clamp(1.2rem, 0.95rem + 1.8vw, 1.5rem); }
}
@media (max-width: 460px) {
  .brand-name { font-size: 16px; }
  .lang-btn { padding: 5px 8px; }
  .pill { padding: 6px 10px; }
  .cat-grid { grid-template-columns: 1fr; }
}

/* phones: the control row spans the full content width — heart stays a fixed
   square, the two text buttons share the rest (the primary "Draw" gets 2×) */
@media (max-width: 540px) {
  .controls { width: 100%; gap: 8px; }
  .controls .icon-btn { flex: 0 0 auto; }
  .controls .btn { flex: 1 1 0; min-width: 0; padding: 0 8px; letter-spacing: 0.02em; white-space: nowrap; }
  .controls .btn--primary { flex: 2 1 0; }
}
@media (max-height: 560px) {
  .brand-tag, .hints, .card-foot { display: none; }
}

/* touch devices (phones + tablets) have no physical keyboard → drop the shortcut hints */
@media (hover: none) and (pointer: coarse) {
  .hints { display: none; }
}

/* ===========================================================================
   Reduced motion — collapse to a single quiet crossfade
   =========================================================================== */
@media (prefers-reduced-motion: reduce) {
  :root { transition: none; }
  .aurora, .glyph, .loader-mark { animation: none !important; }
  .scene, .card-top, .card-foot { transition: opacity 220ms ease !important; }
  .card-top.pre, .card-foot.pre { filter: none; }
  .question.is-typing::after { display: none; }
  .overlay-panel { transform: none !important; transition: opacity 200ms ease !important; }
}
