/* ===========================================================================
   Game Hub — "Modern Arcade" theme
   Dark base + neon accent + light glass. Theming qua CSS custom properties.
   =========================================================================== */

:root {
  --bg:            #0E0F13;
  --bg-elev:       #15171E;
  --bg-elev-2:     #1C1F29;
  --line:          #262a36;
  --text:          #EDEFF5;
  --text-dim:      #a6adbd;
  --text-mute:     #8b93a4;

  --accent:        #7C5CFF;
  --accent-2:      #16C7FF;
  --accent-warm:   #FF7A45;
  --grad-accent:   linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);

  --good:          #34d399;
  --warn:          #fbbf24;
  --bad:           #f87171;

  --radius:        14px;
  --radius-sm:     10px;
  --shadow:        0 6px 24px rgba(0,0,0,.35);
  --shadow-lg:     0 16px 48px rgba(0,0,0,.5);

  --header-h:      60px;
  --maxw:          1280px;
  --ease:          cubic-bezier(.22,.61,.36,1);
}

:root[data-theme="light"] {
  --bg:            #F4F5F8;
  --bg-elev:       #FFFFFF;
  --bg-elev-2:     #FFFFFF;
  --line:          #E4E7EE;
  --text:          #14161C;
  --text-dim:      #565d6d;
  --text-mute:     #8a93a3;
  --shadow:        0 6px 20px rgba(20,22,28,.08);
  --shadow-lg:     0 18px 44px rgba(20,22,28,.16);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

/* Accessibility: focus ring rõ cho người dùng bàn phím (không hiện với chuột). */
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; border-radius: 6px; }
.card:focus-visible { outline-offset: 4px; }
:focus:not(:focus-visible) { outline: none; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", "Segoe UI", Roboto, system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  letter-spacing: -0.011em;
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font: inherit; cursor: pointer; }

.skip-link {
  position: fixed; left: 8px; top: -60px; z-index: 100;
  background: var(--accent); color: #fff; padding: 10px 14px; border-radius: 8px;
  transition: top .2s;
}
.skip-link:focus { top: 8px; }

/* ------------------------------------------------------------------ header */
.app-header {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 16px;
  height: var(--header-h);
  padding: 0 clamp(12px, 3vw, 28px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.brand__name { font-size: 20px; font-weight: 700; letter-spacing: .3px; }
.brand__name b { background: var(--grad-accent); -webkit-background-clip: text; background-clip: text; color: transparent; }

.search { position: relative; flex: 1 1 auto; max-width: 520px; }
.search__icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; fill: var(--text-mute); pointer-events: none; }
.search input {
  width: 100%; height: 40px; padding: 0 14px 0 38px;
  background: var(--bg-elev); color: var(--text);
  border: 1px solid var(--line); border-radius: 999px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }

.header-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.icon-btn {
  width: 40px; height: 40px; display: grid; place-items: center;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: 10px;
  color: var(--text); font-size: 18px; transition: background .15s, transform .1s;
}
.icon-btn:hover { background: var(--bg-elev-2); }
.icon-btn:active { transform: scale(.94); }
.icon-btn--text { font-size: 13px; font-weight: 700; letter-spacing: .5px; }

/* --------------------------------------------------------------------- view */
.view { max-width: var(--maxw); margin: 0 auto; padding: 20px clamp(12px, 3vw, 28px) 96px; outline: none; }

/* -------------------------------------------------------------------- hero */
.hero {
  position: relative; overflow: hidden;
  border-radius: 20px; padding: clamp(22px, 5vw, 44px);
  background: radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--accent) 45%, transparent), transparent 60%), var(--bg-elev);
  border: 1px solid var(--line); margin-bottom: 28px;
}
.hero::after { content:""; position:absolute; inset:0; background: radial-gradient(80% 120% at 0% 100%, color-mix(in srgb, var(--accent-2) 30%, transparent), transparent 55%); pointer-events:none; }
.hero__eyebrow { font-size: 13px; font-weight: 600; letter-spacing: 1.5px; text-transform: uppercase; color: var(--accent-2); }
.hero__title { font-size: clamp(26px, 5vw, 44px); font-weight: 800; margin: 8px 0 6px; line-height: 1.05; }
.hero__sub { color: var(--text-dim); max-width: 46ch; margin: 0 0 20px; }
.hero__actions { display: flex; gap: 12px; flex-wrap: wrap; position: relative; z-index: 1; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 20px; border-radius: 999px; font-weight: 600; border: 1px solid transparent;
  transition: transform .1s, filter .15s, background .15s;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn--primary { background: var(--grad-accent); color: #fff; box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 40%, transparent); }
.btn--primary:hover { filter: brightness(1.08); }
.btn--ghost { background: var(--bg-elev-2); color: var(--text); border-color: var(--line); }
.btn--ghost:hover { background: var(--bg-elev); }

/* -------------------------------------------------------------------- rails */
.rail { margin-bottom: 30px; }
.rail__head { display: flex; align-items: baseline; justify-content: space-between; margin: 0 2px 12px; }
.rail__title { font-size: 19px; font-weight: 700; margin: 0; }
.rail__more { font-size: 13px; color: var(--text-dim); }
.rail__more:hover { color: var(--accent-2); }
.rail__track {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(190px, 1fr);
  gap: 14px; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x proximity;
  padding: 4px 2px 12px; scrollbar-width: thin;
}
.rail__track > * { scroll-snap-align: start; }
.rail__track::-webkit-scrollbar { height: 8px; }
.rail__track::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; }

/* ------------------------------------------------------------- grid layout */
.grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}
.section-title { font-size: 24px; font-weight: 800; margin: 6px 2px 18px; }

/* --------------------------------------------------------------------- card */
.card {
  position: relative; display: flex; flex-direction: column;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; transition: transform .16s var(--ease), box-shadow .16s, border-color .16s;
  will-change: transform;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.card__thumb { position: relative; aspect-ratio: 16 / 9; background: var(--bg-elev-2); }
.card__thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.card__fallback { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 800; font-size: 22px; color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,.4); }
.card__badges { position: absolute; top: 8px; left: 8px; display: flex; gap: 6px; }
.badge { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: rgba(0,0,0,.55); color: #fff; backdrop-filter: blur(4px); }
.badge--new { background: var(--accent-warm); color: #14161c; } /* dark text: đủ tương phản a11y */
.badge--hot { background: var(--bad); color: #14161c; }
.card__fav {
  position: absolute; top: 6px; right: 6px; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; background: rgba(0,0,0,.5); border: none; color: #fff;
  opacity: 0; transform: scale(.85); transition: opacity .15s, transform .15s, color .15s;
}
.card:hover .card__fav, .card__fav.is-fav { opacity: 1; transform: scale(1); }
.card__fav.is-fav { color: var(--accent-warm); }
.card__fav svg { width: 18px; height: 18px; fill: currentColor; }
.card__body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 3px; }
.card__title { font-size: 14.5px; font-weight: 700; line-height: 1.25; }
.card__meta { font-size: 12px; color: var(--text-mute); display: flex; gap: 6px; align-items: center; }
.card__hs { font-size: 11.5px; color: var(--accent-2); font-weight: 600; }
.card__progress { height: 4px; background: var(--line); border-radius: 4px; margin-top: 6px; overflow: hidden; }
.card__progress > i { display: block; height: 100%; background: var(--grad-accent); }
.card__resume { margin-top: 6px; font-size: 11.5px; font-weight: 700; color: var(--accent-2);
  display: inline-flex; align-items: center; gap: 3px; }

/* ------------------------------------------------------------ chips / filter */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.chip {
  padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: var(--bg-elev); border: 1px solid var(--line); color: var(--text-dim);
  transition: all .15s;
}
.chip:hover { color: var(--text); }
.chip.is-active { background: var(--grad-accent); color: #fff; border-color: transparent; }

/* ------------------------------------------------------------ empty / skel */
.empty { text-align: center; padding: 60px 20px; color: var(--text-dim); }
.empty__emoji { font-size: 48px; margin-bottom: 12px; }
.skeleton { background: linear-gradient(90deg, var(--bg-elev) 25%, var(--bg-elev-2) 37%, var(--bg-elev) 63%); background-size: 400% 100%; animation: shimmer 1.3s infinite; border-radius: var(--radius); }
.skeleton--card { aspect-ratio: 16/9; height: auto; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* ---------------------------------------------------------------- game view */
.game-view { display: flex; flex-direction: column; height: calc(100vh - var(--header-h) - 20px); }
.game-view__bar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex: 0 0 auto; }
.game-view__title { font-size: 18px; font-weight: 700; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.game-view__spacer { flex: 1; }
.seg--diff { padding: 2px; flex: 0 0 auto; }
.seg--diff .seg__opt { padding: 5px 11px; font-size: 12.5px; }
@media (max-width: 560px) { .game-view__bar { gap: 8px; } .seg--diff .seg__opt { padding: 5px 8px; font-size: 12px; } }
.game-view__stat { font-size: 13px; color: var(--text-dim); }
.game-view__stat b { color: var(--accent-2); }
.game-frame-wrap {
  position: relative; flex: 1 1 auto; min-height: 0;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.game-frame-wrap iframe { width: 100%; height: 100%; border: 0; display: block; }
.game-loading { position: absolute; inset: 0; display: grid; place-items: center; gap: 14px; background: var(--bg-elev); transition: opacity .3s; }
.game-loading.is-hidden { opacity: 0; pointer-events: none; }
.spinner { width: 42px; height: 42px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }

.game-error { position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 24px; text-align: center; background: var(--bg-elev); }
.game-error.show { display: flex; }
.game-error__icon { font-size: 40px; line-height: 1; }
.game-error__title { margin: 0; font-size: 18px; font-weight: 800; }
.game-error__msg { margin: 0; color: var(--text-dim); max-width: 340px; font-size: 14px; }
.game-error__actions { display: flex; gap: 10px; margin-top: 6px; flex-wrap: wrap; justify-content: center; }

.age-gate { flex: 1 1 auto; min-height: 0; display: grid; place-items: center; padding: 24px; }
.age-gate__card { max-width: 420px; text-align: center; background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 28px 24px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.age-gate__icon { font-size: 44px; line-height: 1; }
.age-gate__title { margin: 0; font-size: 20px; font-weight: 800; }
.age-gate__msg { margin: 0; color: var(--text-dim); font-size: 14px; line-height: 1.55; }
.age-gate__actions { display: flex; gap: 10px; margin-top: 8px; flex-wrap: wrap; justify-content: center; }

/* ------------------------------------------------------------ bottom nav */
.bottom-nav { display: none; }
@media (max-width: 720px) {
  .bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
    display: grid; grid-template-columns: repeat(4, 1fr);
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: blur(14px); border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 0; color: var(--text-mute); font-size: 11px; }
  .bottom-nav a svg { width: 22px; height: 22px; fill: currentColor; }
  .bottom-nav a.is-active { color: var(--accent-2); }
  .brand__name { display: none; }
  .game-view { height: calc(100vh - var(--header-h) - 80px); }
}

/* ----------------------------------------------------------------- toasts */
.toast-root { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 10px; align-items: center; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 12px 18px;
  background: var(--bg-elev-2); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow-lg); font-size: 14px; font-weight: 600;
  animation: toast-in .3s var(--ease); max-width: 90vw;
}
.toast__emoji { font-size: 20px; }
.toast--gold { border-color: var(--warn); }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px); } }
@media (max-width: 720px) { .toast-root { bottom: 84px; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
:root[data-motion="off"] *, :root[data-motion="off"] *::before, :root[data-motion="off"] *::after {
  animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important;
}

/* ===================================================================
   PHASE 2 — Daily hero, progression, profile, achievements, settings
   =================================================================== */

/* -- daily hero extras -- */
.hero__badge {
  display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: 1px;
  padding: 2px 8px; border-radius: 6px; background: var(--accent-warm); color: #fff; vertical-align: middle;
}
.hero__streak { margin: 2px 0 18px; font-weight: 700; color: var(--accent-warm); position: relative; z-index: 1; }
.hero__done { display: inline-flex; align-items: center; padding: 11px 4px; font-weight: 700; color: var(--good); }

/* -- header level chip -- */
.profile-btn { text-decoration: none; width: auto; min-width: 40px; padding: 0 11px;
  display: inline-flex; align-items: center; justify-content: center; gap: 5px; white-space: nowrap; line-height: 1; }
.profile-btn .pb-av { font-size: 16px; } .profile-btn .pb-lv { font-size: 13px; font-weight: 700; letter-spacing: .3px; }
.profile-btn:hover { background: var(--bg-elev-2); }

/* -- profile header -- */
.profile-head {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  background: radial-gradient(120% 160% at 100% 0%, color-mix(in srgb, var(--accent) 35%, transparent), transparent 60%), var(--bg-elev);
  border: 1px solid var(--line); border-radius: 18px; padding: 20px 22px; margin-bottom: 18px;
}
.profile-avatar {
  width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; font-size: 34px;
  background: var(--grad-accent); box-shadow: var(--shadow); flex: 0 0 auto;
}
.profile-id { flex: 1 1 220px; min-width: 200px; }
.profile-level { font-size: 22px; font-weight: 800; margin-bottom: 8px; }
.xpbar { height: 10px; background: var(--bg-elev-2); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.xpbar > i { display: block; height: 100%; background: var(--grad-accent); transition: width .4s var(--ease); }
.profile-xp { font-size: 12px; color: var(--text-dim); margin-top: 5px; }
.profile-streak { text-align: center; flex: 0 0 auto; }
.profile-streak__big { font-size: 20px; font-weight: 800; color: var(--accent-warm); }
.profile-streak__best { font-size: 12px; color: var(--text-mute); }

/* -- stats grid -- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 8px; }
.stat-tile { background: var(--bg-elev); border: 1px solid var(--line); border-radius: 14px; padding: 16px 12px; text-align: center; }
.stat-tile__val { font-size: 24px; font-weight: 800; }
.stat-tile__lbl { font-size: 12px; color: var(--text-dim); margin-top: 4px; }
@media (max-width: 560px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }

/* -- sections -- */
.profile-section { margin-top: 26px; }
.profile-section__title { font-size: 19px; font-weight: 700; margin: 0 2px 12px; }
.profile-subhead { font-size: 13px; font-weight: 700; color: var(--text-dim); margin: 16px 2px 8px; }

/* -- rewards (theme + avatar unlocks) -- */
.reward-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.reward-chip { display: flex; align-items: center; gap: 9px; text-align: left; background: var(--bg-elev);
  border: 1px solid var(--line); border-radius: 12px; padding: 9px 11px; cursor: pointer; font: inherit; color: var(--text);
  transition: border-color .15s, transform .06s; }
.reward-chip:not(:disabled):active { transform: scale(.97); }
.reward-chip.is-on { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent); }
.reward-chip.is-locked { cursor: default; opacity: .72; }
.reward-chip__swatch { width: 26px; height: 26px; border-radius: 8px; flex: 0 0 auto; }
.reward-chip__emoji { width: 26px; height: 26px; display: grid; place-items: center; font-size: 20px; flex: 0 0 auto; }
.reward-chip__lock { width: 26px; height: 26px; display: grid; place-items: center; font-size: 16px; flex: 0 0 auto; opacity: .6; }
.reward-chip__name { font-size: 12.5px; font-weight: 600; line-height: 1.2; }
.reward-chip.is-locked .reward-chip__name { color: var(--text-mute); }
.profile-share { margin-top: 8px; align-self: flex-start; padding: 7px 14px; font-size: 13px; }

/* -- leaderboard -- */
.lb-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.lb-select { font: inherit; font-weight: 600; padding: 8px 12px; border-radius: 10px; background: var(--bg-elev); color: var(--text); border: 1px solid var(--line); }
.lb-list { display: flex; flex-direction: column; gap: 6px; }
.lb-loading { display: grid; place-items: center; padding: 40px; }
.lb-row { display: flex; align-items: center; gap: 12px; background: var(--bg-elev); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
.lb-row--me { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--bg-elev)); }
.lb-row--sep { margin-top: 8px; }
.lb-rank { font-weight: 800; color: var(--text-mute); min-width: 42px; }
.lb-rank--top { color: var(--accent-2); }
.lb-av { font-size: 20px; }
.lb-name { flex: 1; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-score { font-weight: 800; color: var(--accent-2); }
.lb-setname { margin-top: 10px; align-self: flex-start; }

/* -- sync / account -- */
.sync-status { color: var(--text-dim); font-size: 13.5px; line-height: 1.5; margin: 0 0 6px; }
.sync-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sync-input { font: inherit; padding: 8px 12px; border-radius: 10px; background: var(--bg-elev-2); color: var(--text); border: 1px solid var(--line); min-width: 120px; }
.sync-code { font-weight: 800; letter-spacing: 2px; color: var(--accent-2); font-size: 18px; }
.sync-google { margin: 8px 0; display: inline-flex; }

/* -- privacy / prose + footer -- */
.prose { max-width: 640px; color: var(--text); line-height: 1.65; }
.prose p { margin: 0 0 12px; } .prose ul { margin: 0 0 12px; padding-left: 20px; } .prose li { margin: 4px 0; color: var(--text-dim); }
.profile-foot { margin-top: 20px; text-align: center; }
.profile-foot__link { color: var(--text-mute); font-size: 12.5px; }

/* -- admin -- */
.admin-login { max-width: 420px; }
.admin-actions { display: flex; gap: 8px; margin-bottom: 14px; }
.admin-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 6px; }
.admin-row { display: flex; justify-content: space-between; gap: 12px; background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 12px; font-size: 13.5px; }
.admin-row__k { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-row__v { font-weight: 800; color: var(--accent-2); flex: 0 0 auto; }
.admin-chart { display: flex; align-items: flex-end; gap: 6px; height: 120px; padding: 8px 2px; margin-bottom: 8px; }
.admin-bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; min-width: 0; }
.admin-bar > i { display: block; width: 70%; min-height: 2px; background: var(--grad-accent); border-radius: 4px 4px 0 0; }
.admin-bar__d { font-size: 10px; color: var(--text-mute); white-space: nowrap; }

/* -- achievements grid -- */
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.ach { display: flex; align-items: center; gap: 12px; background: var(--bg-elev); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
/* Locked: KHÔNG mờ cả thẻ (chữ mờ sẽ tụt tương phản a11y) — chỉ mờ icon 🔒 */
.ach--off .ach__icon { opacity: .5; }
.ach--off .ach__title, .ach--off .ach__desc { color: var(--text-mute); }
.ach--on { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }
.ach__icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font-size: 20px; background: var(--bg-elev-2); flex: 0 0 auto; }
.ach--on .ach__icon { background: color-mix(in srgb, var(--warn) 22%, var(--bg-elev-2)); }
.ach__title { font-weight: 700; font-size: 14px; }
.ach__desc { font-size: 12px; color: var(--text-mute); }

/* -- settings -- */
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 2px; border-bottom: 1px solid var(--line); }
.setting-row__label { font-weight: 600; }
.seg { display: inline-flex; background: var(--bg-elev-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px; gap: 2px; }
.seg__opt { border: 0; background: transparent; color: var(--text-dim); padding: 6px 16px; border-radius: 999px; font-weight: 600; }
.seg__opt.is-on { background: var(--grad-accent); color: #fff; }
.range { accent-color: var(--accent); width: 160px; max-width: 46vw; }
.switch { width: 20px; height: 20px; accent-color: var(--accent); }
.btn-danger { margin-top: 18px; background: color-mix(in srgb, var(--bad) 16%, var(--bg-elev)); color: var(--bad); border: 1px solid color-mix(in srgb, var(--bad) 40%, transparent); padding: 11px 18px; border-radius: 10px; font-weight: 700; }
.btn-danger:hover { background: color-mix(in srgb, var(--bad) 26%, var(--bg-elev)); }

/* -- onboarding modal -- */
.onboard { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 20px;
  background: rgba(6,7,10,.72); backdrop-filter: blur(6px); animation: toast-in .3s var(--ease); }
.onboard__card { background: var(--bg-elev); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-lg);
  padding: 30px 26px; max-width: 420px; width: 100%; text-align: center; }
.onboard__logo { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 18px; display: grid; place-items: center; font-size: 34px; background: var(--grad-accent); }
.onboard__title { margin: 0 0 16px; font-size: 24px; font-weight: 800; }
.onboard__list { list-style: none; padding: 0; margin: 0 0 22px; text-align: left; display: flex; flex-direction: column; gap: 12px; }
.onboard__list li { font-size: 15px; color: var(--text-dim); }
.onboard__card .btn { width: 100%; justify-content: center; }

/* ===================================================================
   PHASE 2.5 — Polish: route transition, card play overlay, aurora hero
   =================================================================== */

/* route transition (fade + rise) */
.route-in { animation: route-in .32s var(--ease); }
@keyframes route-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* card: thumbnail zoom + play overlay */
.card__thumb img { transition: transform .3s var(--ease); }
.card:hover .card__thumb img { transform: scale(1.07); }
.card__play {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: linear-gradient(to top, rgba(8,9,12,.55), transparent 55%);
  opacity: 0; transition: opacity .18s; pointer-events: none;
}
.card:hover .card__play { opacity: 1; }
.card__play-btn {
  width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  background: var(--grad-accent); color: #fff; font-size: 16px; padding-left: 3px;
  box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 55%, transparent);
  transform: scale(.7); transition: transform .2s var(--ease);
}
.card:hover .card__play-btn { transform: scale(1); }

/* animated aurora on hero */
.hero { isolation: isolate; }
.hero::before {
  content: ""; position: absolute; inset: -40%; z-index: 0; pointer-events: none;
  background:
    radial-gradient(35% 45% at 20% 30%, color-mix(in srgb, var(--accent) 55%, transparent), transparent 70%),
    radial-gradient(30% 40% at 80% 20%, color-mix(in srgb, var(--accent-2) 50%, transparent), transparent 70%),
    radial-gradient(35% 45% at 60% 90%, color-mix(in srgb, var(--accent-warm) 32%, transparent), transparent 70%);
  filter: blur(20px); opacity: .6; animation: aurora 14s ease-in-out infinite alternate;
}
.hero > * { position: relative; z-index: 1; }
@keyframes aurora {
  0%   { transform: translate3d(-4%, -2%, 0) rotate(0deg) scale(1.05); }
  100% { transform: translate3d(4%, 3%, 0) rotate(8deg) scale(1.15); }
}

/* button press feedback (delight) */
.btn, .icon-btn, .chip, .seg__opt { transition: transform .1s var(--ease), background .15s, filter .15s, box-shadow .15s; }
.btn:active { transform: translateY(1px) scale(.98); }

/* how-to-play overlay (Phase 2.6) — Hub render từ manifest.howto */
.howto {
  position: absolute; inset: 0; z-index: 6; display: none; place-items: center; padding: 20px;
  background: rgba(8,9,12,.72); backdrop-filter: blur(8px);
}
.howto.show { display: grid; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; } }
.howto__card {
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-lg);
  padding: 24px 24px 22px; max-width: 380px; width: 100%; max-height: 100%; overflow-y: auto;
  animation: howto-in .3s var(--ease);
}
@keyframes howto-in { from { opacity: 0; transform: translateY(12px) scale(.97); } }
.howto__eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--accent-2); }
.howto__title { margin: 4px 0 16px; font-size: 22px; font-weight: 800; }
.howto__row { margin-bottom: 14px; }
.howto__row > b { display: block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--text-mute); margin-bottom: 4px; }
.howto__goal { margin: 0; color: var(--text-dim); }
.howto__list { margin: 0; padding-left: 18px; color: var(--text-dim); display: flex; flex-direction: column; gap: 4px; }
.howto__card .btn { width: 100%; justify-content: center; margin-top: 4px; }
