/* Boot splash (pure CSS, shown until main.js mounts the hub) */
.boot { grid-area: 1 / 1; display: grid; place-content: center; justify-items: center; gap: 18px; }
.boot-mark { font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.boot-mark b { color: var(--c-selgee); }
.boot-dots { display: flex; gap: 8px; }
.boot-dots i { width: 10px; height: 10px; border-radius: 50%; animation: boot-bob 1s var(--ease-in-out) infinite; }
.boot-dots i:nth-child(1) { background: var(--c-selgee); }
.boot-dots i:nth-child(2) { background: var(--c-darkhan); animation-delay: .1s; }
.boot-dots i:nth-child(3) { background: var(--c-evluuleg); animation-delay: .2s; }
.boot-dots i:nth-child(4) { background: var(--c-talbai); animation-delay: .3s; }
.boot-dots i:nth-child(5) { background: var(--c-helhee); animation-delay: .4s; }
@keyframes boot-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

.hub .scroll { display: flex; flex-direction: column; gap: 18px; padding-top: 6px; }

.hub-top { display: flex; align-items: center; justify-content: space-between; padding-top: 8px; }
.wordmark { font-size: 26px; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.wm-word { color: var(--ink); }
.wm-combo { margin-left: 6px; background: linear-gradient(90deg, var(--c-selgee), var(--c-darkhan) 30%, var(--c-evluuleg) 55%, var(--c-talbai) 78%, var(--c-helhee));
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.hub-actions { display: flex; align-items: center; gap: 4px; }
.streak { color: var(--ink-3); }
.streak .flame { display: inline-grid; width: 18px; height: 18px; }
.streak .flame svg { width: 18px; height: 18px; }
.streak.on { color: var(--ink); }
.streak.on .flame { color: #ff7a1a; animation: flicker 2.4s ease-in-out infinite; transform-origin: 50% 90%; }
@keyframes flicker { 0%, 100% { transform: scale(1) rotate(0); } 30% { transform: scale(1.08, .95) rotate(-3deg); } 60% { transform: scale(.96, 1.06) rotate(2deg); } }

/* Theme card */
.theme-card {
  --hue: 30;
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 132px;
  padding: 20px;
  border-radius: var(--r-lg);
  background: linear-gradient(135deg, hsl(var(--hue) 85% 90%), hsl(calc(var(--hue) + 35) 80% 84%));
  color: var(--ink);
  overflow: hidden;
}
:root[data-theme='dark'] .theme-card { background: linear-gradient(135deg, hsl(var(--hue) 35% 22%), hsl(calc(var(--hue) + 35) 40% 16%)); color: var(--ink); }
.theme-card::after {
  content: '';
  position: absolute;
  right: -40px;
  top: -40px;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .28);
}
:root[data-theme='dark'] .theme-card::after { background: rgba(255, 255, 255, .05); }
.theme-card .eyebrow { color: inherit; opacity: .65; }
.theme-emoji { flex: none; font-size: 54px; line-height: 1; z-index: 1; animation: float 4s var(--ease-in-out) infinite; }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-6px) rotate(3deg); } }
.theme-text { z-index: 1; min-width: 0; }
.theme-title { font-size: 26px; font-weight: 800; line-height: 1.12; letter-spacing: -.01em; margin: 2px 0 4px; overflow-wrap: anywhere; }
.theme-date { font-size: 14px; font-weight: 600; opacity: .7; }
.theme-card.loading { background: var(--surface-2); }
.theme-skeleton { width: 100%; height: 72px; border-radius: var(--r-md);
  background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.theme-error { flex: 1; color: var(--ink-2); font-weight: 600; }

/* Combo track */
.track { list-style: none; margin: 0; padding: 4px 0 0; display: grid; grid-template-columns: repeat(5, 1fr); position: relative; }
.track::before { content: ''; position: absolute; left: 10%; right: 10%; top: 29px; height: 3px; border-radius: 2px; background: var(--surface-3); }
.track-node { position: relative; display: grid; justify-items: center; gap: 6px; text-align: center; }
.node-dot {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: var(--surface);
  color: color-mix(in srgb, var(--node) var(--text-mix), var(--ink));
  box-shadow: var(--shadow-1);
  transition: transform .3s var(--ease-spring);
}
.node-dot svg { width: 24px; height: 24px; }
.track-node.done .node-dot { background: var(--node); color: var(--on-accent); }
.track-node.next .node-dot { color: var(--node); box-shadow: 0 0 0 3px var(--node), var(--shadow-2); animation: nudge 1.8s var(--ease-in-out) infinite; }
@keyframes nudge { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
.node-check {
  position: absolute;
  right: -5px;
  bottom: -5px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--good);
  color: #fff;
  border: 2px solid var(--bg);
}
.node-check svg { width: 12px; height: 12px; }
/* Names never break mid-word ("Эвлүүл / эг" at 320px): one line, and the type shrinks with the
   screen so the longest name (Эвлүүлэг, 57px at 12px) fits its fifth of the track down to 320px. */
.node-name { font-size: clamp(10.5px, 3.33vw, 12px); font-weight: 800; color: var(--ink-2); line-height: 1.15; white-space: nowrap; }

/* Call to action */
.cta { min-height: 58px; font-size: 18px; box-shadow: var(--shadow-2); }
.cta.accent { --accent: var(--brand); --accent-ink: var(--on-brand); }
.cta-icon { display: inline-grid; }
.cta-icon svg { width: 18px; height: 18px; }
.combo-done {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--r-md);
  background: var(--good-soft);
}
.combo-done strong { display: block; font-size: 17px; font-weight: 800; }
.combo-done p { font-size: 14px; color: var(--ink-2); font-weight: 600; }
.countdown { font-variant-numeric: tabular-nums; font-weight: 800; color: var(--ink); }
.done-badge { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--good); color: #fff; }
.done-badge svg { width: 20px; height: 20px; }

/* Practice list */
.section-head h2 { font-size: 20px; font-weight: 800; }
.section-head p { font-size: 14px; color: var(--ink-3); font-weight: 600; margin-top: 2px; }
.games { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.row-btn {
  appearance: none;
  width: 100%;
  min-height: 64px;
  border: 0;
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
  transition: transform .18s var(--ease-out);
}
.row-btn:active { transform: scale(.98); }
.row-icon { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) var(--tint-mix), var(--surface)); color: color-mix(in srgb, var(--accent) var(--text-mix), var(--ink)); }
.row-icon svg { width: 22px; height: 22px; }
.row-main { flex: 1; min-width: 0; display: grid; }
.row-main strong { font-size: 16px; font-weight: 800; }
.row-sub { font-size: 13px; color: var(--ink-3); font-weight: 600; }
.row-level { font-weight: 800; font-size: 14px; color: color-mix(in srgb, var(--accent) var(--text-mix), var(--ink)); font-variant-numeric: tabular-nums; }
.row-chevron { display: inline-grid; color: var(--ink-3); }
.row-chevron svg { width: 20px; height: 20px; }
.row-btn.locked .row-icon { background: var(--surface-3); color: var(--ink-3); }
.row-btn.locked .row-level { color: var(--ink-3); }

/* Records card */
.records-card {
  appearance: none;
  border: 0;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-radius: var(--r-lg);
  background: linear-gradient(135deg, #f1ecff, #ffeef3);
  color: var(--ink);
  box-shadow: var(--shadow-1);
  text-align: left;
  cursor: pointer;
  transition: transform .18s var(--ease-out);
}
.records-card:active { transform: scale(.98); }
.records-card .eyebrow { color: var(--ink-3); }
:root[data-theme='dark'] .records-card { background: linear-gradient(135deg, #2b2640, #36263a); }
.records-icon { flex: none; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--surface); color: var(--gold); box-shadow: var(--shadow-1); }
:root[data-theme='dark'] .records-icon { background: rgba(255, 255, 255, .08); box-shadow: none; }
.records-icon svg { width: 26px; height: 26px; }
.records-main { flex: 1; min-width: 0; display: grid; }
.total-value { font-size: 32px; font-weight: 800; line-height: 1.05; font-variant-numeric: tabular-nums; }
.records-hint { font-size: 12px; color: var(--ink-3); font-weight: 600; }
.records-cta { flex: none; font-weight: 800; font-size: 14px; padding: 8px 12px; border-radius: var(--r-pill); background: rgba(255, 255, 255, .75); }
:root[data-theme='dark'] .records-cta { background: rgba(255, 255, 255, .1); }

.fatal, .stage-error { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 14px; padding: 24px; text-align: center; color: var(--ink-2); font-weight: 600; }

.combo-done { flex-wrap: wrap; }
.combo-done-text { flex: 1; min-width: 0; }
.done-rank {
  appearance: none; border: 0; cursor: pointer; flex-basis: 100%;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; border-radius: var(--r-pill); background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 800; font-size: 15px; box-shadow: var(--shadow-1);
  transition: transform .18s var(--ease-out);
}
.done-rank:active { transform: scale(.97); }
.done-rank span:first-child { display: inline-grid; color: var(--gold); }
.done-rank svg { width: 18px; height: 18px; }

/* Today's challenge: the hero of the hub — a glowing, slowly spinning frame in the five game
   colours, a countdown, the theme, the combo track, one big call to action and a social line. */
@property --spin { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
.challenge {
  --hue: 30;
  position: relative;
  display: grid;
  gap: 14px;
  padding: 16px 16px 14px;
  border: 3px solid transparent;
  border-radius: 26px;
  background:
    linear-gradient(160deg, hsl(var(--hue) 90% 94%), hsl(calc(var(--hue) + 40) 85% 88%)) padding-box,
    conic-gradient(from var(--spin), var(--c-selgee), var(--c-darkhan), var(--c-evluuleg), var(--c-talbai), var(--c-helhee), var(--c-selgee)) border-box;
  box-shadow: 0 18px 40px -22px hsl(var(--hue) 70% 40% / .55);
  animation: challenge-spin 6s linear infinite;
}
:root[data-theme='dark'] .challenge {
  background:
    linear-gradient(160deg, hsl(var(--hue) 35% 20%), hsl(calc(var(--hue) + 40) 35% 14%)) padding-box,
    conic-gradient(from var(--spin), var(--c-selgee), var(--c-darkhan), var(--c-evluuleg), var(--c-talbai), var(--c-helhee), var(--c-selgee)) border-box;
}
@keyframes challenge-spin { to { --spin: 360deg; } }
.challenge.loading { min-height: 300px; animation: none; background: var(--surface-2); border-color: var(--surface-2); }
.challenge.done { animation: none; background: linear-gradient(160deg, var(--good-soft), var(--surface)) padding-box, linear-gradient(var(--good), var(--good)) border-box; }
.challenge-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.challenge-eyebrow { font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--ink); }
.challenge-eyebrow::before { content: ''; display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: var(--brand); vertical-align: 1px; animation: live-dot 1.4s ease-in-out infinite; }
.challenge.done .challenge-eyebrow::before { background: var(--good); animation: none; }
@keyframes live-dot { 50% { opacity: .25; transform: scale(.7); } }
.challenge-timer { flex: none; display: inline-flex; gap: 4px; align-items: baseline; padding: 6px 10px; border-radius: var(--r-pill); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); font-size: 12px; font-weight: 700; }
.challenge-timer strong { font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; }
.challenge-theme { display: flex; align-items: center; gap: 14px; color: var(--ink); }
:root[data-theme='dark'] .challenge-theme { color: var(--ink); }
.challenge-theme .theme-emoji { font-size: 50px; }
.challenge-theme .theme-title { font-size: 26px; margin: 0 0 2px; }
.challenge .track::before { top: 27px; }
.challenge .node-dot { width: 48px; height: 48px; border-radius: 15px; }
/* One line down to 320px: "Сорилтыг эхлүүлэх" is 187px at 19px, so type and side padding shrink
   with the screen (17.9px / 16px at 320px); a longer label ellipsizes instead of wrapping. */
.challenge .cta { min-height: 60px; font-size: clamp(17px, 5.6vw, 19px); padding-inline: clamp(16px, 5vw, 22px); animation: cta-pulse 2.4s var(--ease-in-out) infinite; }
.cta > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@keyframes cta-pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand) 40%, transparent), var(--shadow-2); } 50% { box-shadow: 0 0 0 10px color-mix(in srgb, var(--brand) 0%, transparent), var(--shadow-2); } }
.challenge .combo-done { background: var(--surface); }
.challenge-social { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 14px; font-weight: 800; color: var(--ink-2); text-align: center; }
.social-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); }
.challenge-social.hot .social-dot { background: #ff7a1a; box-shadow: 0 0 0 4px rgba(255, 122, 26, .2); }
.my-finish { font-weight: 800 !important; color: var(--ink) !important; font-variant-numeric: tabular-nums; }
.my-finish:empty { display: none; }
.total-line { display: flex; align-items: baseline; gap: 10px; }
.iq-pill { font-size: 13px; font-weight: 800; padding: 3px 9px; border-radius: var(--r-pill); background: var(--surface); color: #5b45c9; }
:root[data-theme='dark'] .iq-pill { background: rgba(255, 255, 255, .1); color: #cfc4ff; }
@media (prefers-reduced-motion: reduce) { .challenge, .challenge .cta, .challenge-eyebrow::before { animation: none !important; } }
