/* ============================================================
   GENSHIN CUP · 原神角色世界杯
   深色 · 游戏主题 · 活力紫金品牌色
   ============================================================ */

@font-face {
  font-family: "Anton";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/anton-400.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #0a0e1a;
  --panel: rgba(255, 255, 255, .045);
  --panel-2: rgba(255, 255, 255, .08);
  --line: rgba(255, 255, 255, .1);
  --line-soft: rgba(255, 255, 255, .06);
  --txt: #f0f2f8;
  --dim: rgba(235, 235, 245, .58);
  --dim2: rgba(235, 235, 245, .34);
  --acc1: #4a9afd;
  --acc2: #f7d44a;
  --acc1-soft: rgba(74, 154, 253, .34);
  --acc2-soft: rgba(247, 212, 74, .26);
  --gold: #f7d44a;
  --purple: #b57cf2;
  --grad-main: linear-gradient(135deg, #4a9afd, #6c5ce7);
  --grad-gold: linear-gradient(135deg, #f7d44a, #f5a623);
  --r-lg: 26px;
  --r-md: 18px;
  --r-sm: 12px;
  --font-cn: -apple-system, "PingFang SC", "Noto Sans SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-en: "Space Grotesk", "SF Pro Display", -apple-system, sans-serif;
  --font-display: "Anton", "Space Grotesk", "Arial Narrow", sans-serif;
  --shadow-card: 0 18px 50px -18px rgba(0, 0, 0, .65);
  --topbar-h: 58px;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { color-scheme: dark; }
body {
  background: var(--bg);
  color: var(--txt);
  font-family: var(--font-cn);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
svg { display: block; }
::selection { background: var(--acc1-soft); }

/* ---------- Ambient background ---------- */
.ambient { position: fixed; inset: 0; z-index: -2; overflow: hidden; }
.blob {
  position: absolute;
  width: 72vmax; height: 72vmax;
  border-radius: 50%;
  filter: blur(70px);
  opacity: .35;
}
.b1 {
  top: -32vmax; left: -18vmax;
  background: radial-gradient(circle at 35% 35%, var(--acc1-soft), transparent 62%);
  animation: drift1 26s ease-in-out infinite alternate;
}
.b2 {
  bottom: -36vmax; right: -20vmax;
  background: radial-gradient(circle at 60% 60%, var(--acc2-soft), transparent 62%);
  animation: drift2 32s ease-in-out infinite alternate;
}
@keyframes drift1 { to { transform: translate(9vmax, 7vmax) rotate(24deg); } }
@keyframes drift2 { to { transform: translate(-8vmax, -6vmax) rotate(-18deg); } }

.grain {
  position: fixed; inset: 0; z-index: 90;
  pointer-events: none; opacity: .04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.6'/%3E%3C/svg%3E");
}

/* ---------- Language switch ---------- */
.lang-switch {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 14px);
  left: max(16px, calc(50% - 280px));
  z-index: 50;
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; letter-spacing: .04em;
  color: var(--dim2);
  transition: transform .15s;
  cursor: pointer;
  user-select: none;
}
.lang-switch svg { width: 15px; height: 15px; }
.lang-switch:active { transform: scale(.92); }

/* ---------- Top bar ---------- */
.topbar[hidden] { display: none; }
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40;
  height: calc(var(--topbar-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 10px 0;
  display: flex; align-items: center; gap: 4px;
  background: rgba(10, 14, 26, .68);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border-bottom: 1px solid var(--line-soft);
}
.tb-btn {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: var(--dim);
  transition: color .2s, background .2s, transform .15s;
}
.tb-btn svg { width: 21px; height: 21px; }
.tb-btn:active { transform: scale(.9); background: var(--panel-2); color: var(--txt); }
.tb-mid { flex: 1; min-width: 0; text-align: center; line-height: 1.25; }
.tb-artist { display: block; font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-phase { display: block; font-size: 11px; color: var(--dim); letter-spacing: .04em; }
.tb-prog { position: absolute; left: 0; right: 0; bottom: -2px; height: 2px; background: rgba(255,255,255,.06); }
.tb-prog i { display: block; height: 100%; background: var(--grad-main); border-radius: 2px; transition: width .5s cubic-bezier(.2, .8, .2, 1); box-shadow: 0 0 12px var(--acc1-soft); }

/* ---------- Layout ---------- */
#app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.screen {
  width: 100%; max-width: 560px;
  margin: 0 auto;
  padding: 20px 20px calc(40px + env(safe-area-inset-bottom));
  flex: 1; display: flex; flex-direction: column;
  animation: screenFade .4s ease both;
}
.screen.with-topbar { padding-top: calc(var(--topbar-h) + env(safe-area-inset-top) + 18px); }
.screen.with-cta { padding-bottom: calc(120px + env(safe-area-inset-bottom)); }
@keyframes screenFade { from { opacity: 0; } }

/* ---------- Home ---------- */
.home { gap: 24px; min-height: 100vh; min-height: 100dvh; }
.home > .hero { margin-top: auto; }
.home > .home-foot { margin-bottom: auto; }

.hero { text-align: center; padding-top: 20px; }

.logo-lockup {
  position: relative;
  display: inline-block;
  margin: 0 auto;
  transform: skewX(-6deg);
  font-family: var(--font-display);
  text-transform: uppercase;
  line-height: 1;
  filter: drop-shadow(0 28px 70px var(--acc1-soft));
}
.logo-genshin {
  font-size: clamp(28px, 7vw, 36px);
  color: var(--txt);
  letter-spacing: .08em;
}
.logo-genshin-cup-accent {
  background: var(--grad-main);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  margin-left: 8px;
}
.logo-badge {
  position: absolute; top: -10px; right: -40px;
  font-size: 44px;
  transform: skewX(6deg) rotate(18deg);
  filter: drop-shadow(0 12px 26px rgba(0,0,0,.55));
  animation: badgeFloat 5s ease-in-out infinite;
}
@keyframes badgeFloat {
  0%, 100% { transform: skewX(6deg) rotate(18deg); }
  50% { transform: skewX(6deg) rotate(10deg) translateY(-6px); }
}

.slogan {
  margin-top: 20px;
  font-size: clamp(18px, 5vw, 22px);
  font-weight: 900;
  letter-spacing: .18em;
}
.tagline { margin-top: 8px; color: var(--dim); font-size: 14px; }

.mode-pick { display: flex; justify-content: center; align-items: center; gap: 22px; }
.mode-btn {
  padding: 3px 2px; border: 0; background: none;
  color: var(--dim2); font-size: 14px; cursor: pointer;
  transition: color .18s;
}
.mode-btn.on { color: var(--txt); font-weight: 700; }
.mode-btn.on::before { content: "✦ "; color: var(--gold); }

.start-btn-wrap { text-align: center; margin: 8px 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 54px;
  padding: 0 28px;
  border-radius: 999px;
  font-size: 17px; font-weight: 700;
  transition: transform .16s, box-shadow .25s;
  user-select: none;
}
.btn svg { width: 20px; height: 20px; }
.btn:active { transform: scale(.96); }
.btn.primary {
  background: var(--grad-main);
  color: #fff;
  box-shadow: 0 10px 32px -10px var(--acc1-soft), inset 0 1px 0 rgba(255,255,255,.25);
}
.btn.primary:disabled {
  opacity: .38; filter: saturate(.4);
  pointer-events: none;
  box-shadow: none;
}
.btn.ghost {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--txt);
  backdrop-filter: blur(10px);
}
.btn.sm { min-height: 44px; padding: 0 20px; font-size: 15px; }
.btn.big { min-height: 62px; padding: 0 40px; font-size: 19px; }

/* ---------- CTA bar ---------- */
.cta-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  padding: 14px 20px calc(16px + env(safe-area-inset-bottom));
  display: flex; justify-content: center; gap: 12px;
  background: linear-gradient(to top, rgba(10, 14, 26, .96) 55%, transparent);
}
.cta-bar .btn { flex: 1; max-width: 480px; }

/* ---------- Components ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 13px;
  border-radius: 999px;
  font-size: 12px; font-weight: 700; letter-spacing: .12em;
  color: var(--txt);
  background: var(--panel-2);
  border: 1px solid var(--line);
}
.pill.grad {
  background: var(--grad-main);
  border: 0;
  box-shadow: 0 4px 18px -6px var(--acc1-soft);
}

/* ---------- Phase head ---------- */
.phase-head { text-align: center; margin-bottom: 20px; }
.phase-head h2 { font-size: 22px; margin-top: 8px; }
.phase-head p { color: var(--dim); font-size: 14px; margin-top: 4px; }

/* ---------- Group draw ---------- */
.groups-wrap { display: flex; flex-direction: column; gap: 16px; flex: 1; overflow-y: auto; }
.group-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 14px;
}
.group-label {
  font-size: 13px; font-weight: 700; color: var(--gold);
  margin-bottom: 10px;
  letter-spacing: .1em;
}
.group-chars { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.group-char { text-align: center; }
.gc-avatar {
  width: 64px; height: 64px; margin: 0 auto 6px;
  border-radius: 50%; overflow: hidden;
  border: 2px solid var(--line);
  transition: transform .2s;
}
.gc-avatar.r5 { border-color: var(--gold); box-shadow: 0 0 12px rgba(247,212,74,.2); }
.gc-avatar.r4 { border-color: var(--purple); box-shadow: 0 0 8px rgba(180,124,242,.15); }
.gc-avatar img { width: 100%; height: 100%; object-fit: cover; }
.gc-avatar.fallback { background: linear-gradient(135deg, var(--acc1), var(--acc2)); }
.gc-name { font-size: 13px; font-weight: 600; }
.gc-meta { font-size: 11px; color: var(--dim); }

/* ---------- Pick Grid (Group / Wildcard) ---------- */
.pick-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 12px;
  flex: 1;
  align-content: start;
}

/* ---------- Duel Card ---------- */
.dcard {
  position: relative;
  border-radius: var(--r-md);
  overflow: hidden;
  cursor: pointer;
  border: 2px solid var(--line);
  transition: transform .15s, border-color .2s, box-shadow .2s;
  user-select: none;
}
.dcard:active { transform: scale(.97); }
.dcard.picked {
  border-color: var(--gold);
  box-shadow: 0 0 20px rgba(247,212,74,.2);
}
.dcard.winner {
  border-color: var(--gold);
  box-shadow: 0 0 30px rgba(247,212,74,.35);
  animation: winFlash .45s cubic-bezier(.2,.8,.2,1);
}
.ko-match:has(.winner) .dcard:not(.winner) {
  opacity: .5;
  filter: grayscale(.6);
  transition: opacity .4s, filter .4s;
}
@keyframes winFlash {
  0% { transform: scale(1); }
  30% { transform: scale(1.06); box-shadow: 0 0 60px rgba(247,212,74,.5); }
  100% { transform: scale(1); }
}

.dcard-bg {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  background: var(--bg);
}
.dcard-bg img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .3s;
}
.dcard:hover .dcard-bg img { transform: scale(1.05); }
.dcard-bg.fallback { background: linear-gradient(135deg, var(--acc1), #6c5ce7); }

.dcard-info {
  padding: 8px 10px;
  background: linear-gradient(to top, rgba(0,0,0,.85), transparent);
  position: absolute; bottom: 0; left: 0; right: 0;
}
.dcard-name { font-weight: 700; font-size: 14px; }
.dcard-meta { font-size: 11px; color: var(--dim); }
.dcard-check {
  position: absolute; top: 8px; right: 8px;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--gold);
  color: #000;
  display: grid; place-items: center;
  font-weight: 900; font-size: 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,.4);
}
.dcard-crown {
  position: absolute; top: 4px; right: 4px;
  font-size: 28px;
  filter: drop-shadow(0 0 6px var(--gold));
}

/* Sizes */
.dcard.lg .dcard-bg { aspect-ratio: 3/4; }
.dcard.lg { border-radius: var(--r-lg); border-width: 2px; }
.dcard.lg .dcard-name { font-size: 20px; }
.dcard.lg .dcard-meta { font-size: 13px; }
.dcard.lg .dcard-info { padding: 14px 14px; }
.dcard.lg:hover { border-color: rgba(255,255,255,.25); }
.dcard.lg .dcard-bg img { transition: transform .45s cubic-bezier(.2,.8,.2,1); }
.dcard.lg:hover .dcard-bg img { transform: scale(1.08); }

/* Element glow on hover for knockouts */
.dcard.lg.elem-pyro:hover { box-shadow: 0 0 40px rgba(239,87,51,.25); }
.dcard.lg.elem-hydro:hover { box-shadow: 0 0 40px rgba(76,194,242,.25); }
.dcard.lg.elem-anemo:hover { box-shadow: 0 0 40px rgba(142,215,230,.25); }
.dcard.lg.elem-electro:hover { box-shadow: 0 0 40px rgba(181,124,242,.25); }
.dcard.lg.elem-dendro:hover { box-shadow: 0 0 40px rgba(127,207,99,.25); }
.dcard.lg.elem-cryo:hover { box-shadow: 0 0 40px rgba(168,216,234,.25); }
.dcard.lg.elem-geo:hover { box-shadow: 0 0 40px rgba(212,180,115,.25); }

.dcard.sm .dcard-bg { aspect-ratio: 1; }
.dcard.xs .dcard-bg { aspect-ratio: 1; width: 60px; border-radius: 50%; margin: 4px auto; }
.dcard.xs { display: flex; align-items: center; gap: 8px; padding: 4px; }
.dcard.xs .dcard-name { font-size: 12px; }

/* ---------- Knockout view ---------- */
.ko-view { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.ko-match {
  display: grid; grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  align-items: center;
}
.ko-vs {
  font-family: var(--font-display);
  font-size: 24px;
  background: var(--grad-main);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.ko-hint { text-align: center; color: var(--dim); font-size: 13px; margin-top: 20px; }

/* ---------- Element particle effects ---------- */
.ko-match.preview .dcard { pointer-events: none; }
.ko-match .dcard .elem-particles {
  position: absolute; inset: 0; z-index: 2;
  pointer-events: none;
  overflow: hidden;
}
.ko-match .dcard .elem-particles i {
  position: absolute;
  width: 6px; height: 6px;
  border-radius: 50%;
  opacity: 0;
  animation: particleFloat 2.4s ease-out forwards;
}
.ko-match .dcard .elem-particles i:nth-child(1) { left: 10%; animation-delay: .0s; }
.ko-match .dcard .elem-particles i:nth-child(2) { left: 30%; animation-delay: .3s; width: 4px; height: 4px; }
.ko-match .dcard .elem-particles i:nth-child(3) { left: 50%; animation-delay: .6s; width: 8px; height: 8px; }
.ko-match .dcard .elem-particles i:nth-child(4) { left: 70%; animation-delay: .15s; }
.ko-match .dcard .elem-particles i:nth-child(5) { left: 90%; animation-delay: .45s; width: 5px; height: 5px; }
.ko-match .dcard .elem-particles i:nth-child(6) { left: 20%; animation-delay: .8s; }
.ko-match .dcard .elem-particles i:nth-child(7) { left: 60%; animation-delay: .1s; width: 7px; height: 7px; }
.ko-match .dcard .elem-particles i:nth-child(8) { left: 80%; animation-delay: .55s; }

@keyframes particleFloat {
  0% { opacity: 0; transform: translateY(100%) scale(0); }
  20% { opacity: .9; }
  100% { opacity: 0; transform: translateY(-60px) scale(1.2); }
}

/* Element colors for particles */
.elem-pyro .elem-particles i { background: #ef5733; box-shadow: 0 0 6px #ef5733; }
.elem-hydro .elem-particles i { background: #4cc2f2; box-shadow: 0 0 6px #4cc2f2; }
.elem-anemo .elem-particles i { background: #8ed7e6; box-shadow: 0 0 6px #8ed7e6; }
.elem-electro .elem-particles i { background: #b57cf2; box-shadow: 0 0 6px #b57cf2; }
.elem-dendro .elem-particles i { background: #7fcf63; box-shadow: 0 0 6px #7fcf63; }
.elem-cryo .elem-particles i { background: #a8d8ea; box-shadow: 0 0 6px #a8d8ea; box-shadow: 0 0 8px #a8d8ea, 0 0 16px rgba(168,216,234,.3); }
.elem-geo .elem-particles i { background: #d4b473; box-shadow: 0 0 6px #d4b473; }

/* Card glow during preview */
.ko-match.preview .dcard .dcard-bg::after {
  content: '';
  position: absolute; inset: 0;
  opacity: 0;
  animation: glowPulse 1.8s ease-in-out infinite;
}
.elem-pyro .dcard-bg::after { background: radial-gradient(circle at 50% 50%, rgba(239,87,51,.3), transparent 70%); }
.elem-hydro .dcard-bg::after { background: radial-gradient(circle at 50% 50%, rgba(76,194,242,.3), transparent 70%); }
.elem-anemo .dcard-bg::after { background: radial-gradient(circle at 50% 50%, rgba(142,215,230,.25), transparent 70%); }
.elem-electro .dcard-bg::after { background: radial-gradient(circle at 50% 50%, rgba(181,124,242,.3), transparent 70%); }
.elem-dendro .dcard-bg::after { background: radial-gradient(circle at 50% 50%, rgba(127,207,99,.25), transparent 70%); }
.elem-cryo .dcard-bg::after { background: radial-gradient(circle at 50% 50%, rgba(168,216,234,.25), transparent 70%); }
.elem-geo .dcard-bg::after { background: radial-gradient(circle at 50% 50%, rgba(212,180,115,.25), transparent 70%); }

@keyframes glowPulse {
  0%, 100% { opacity: 0; }
  50% { opacity: 1; }
}

/* Match preview overlay */
.ko-preview-overlay {
  position: fixed; inset: 0; z-index: 25;
  display: grid; place-items: center;
  background: rgba(10,14,26,.92);
  backdrop-filter: blur(12px);
  animation: modalFade .4s ease both;
}
.ko-preview-overlay.stage-1 { background: rgba(10,14,26,.90); }
.ko-preview-overlay.stage-2 { background: rgba(10,14,26,.88); }
.ko-preview-overlay.stage-3 { background: rgba(10,14,26,.85); }

.ko-preview-badge {
  display: inline-block;
  padding: 4px 16px;
  border-radius: 999px;
  font-size: 13px; font-weight: 700; letter-spacing: .12em;
  margin-bottom: 18px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--gold);
}
.stage-2 .ko-preview-badge { background: linear-gradient(135deg, rgba(247,212,74,.15), transparent); border-color: rgba(247,212,74,.3); }
.stage-3 .ko-preview-badge { background: linear-gradient(135deg, rgba(247,212,74,.25), rgba(255,107,53,.1)); border-color: var(--gold); box-shadow: 0 0 20px rgba(247,212,74,.15); }

.ko-preview-inner {
  text-align: center;
  animation: popIn .5s cubic-bezier(.2, .9, .3, 1.15) both;
}
.ko-preview-chars {
  display: flex; align-items: center; justify-content: center; gap: 24px;
  margin-bottom: 24px;
}
.ko-preview-chars .preview-char {
  width: 160px; height: 160px;
  border-radius: 50%; overflow: hidden;
  position: relative;
  transition: transform .3s;
}
.ko-preview-chars .preview-char:hover { transform: scale(1.05); }
.ko-preview-chars .preview-char img { width: 100%; height: 100%; object-fit: cover; }
.ko-preview-chars .preview-char.r5 { border: 3px solid var(--gold); box-shadow: 0 0 40px rgba(247,212,74,.3); }
.ko-preview-chars .preview-char.r4 { border: 3px solid var(--purple); box-shadow: 0 0 30px rgba(180,124,242,.25); }
.stage-2 .preview-char.r5 { box-shadow: 0 0 60px rgba(247,212,74,.4); }
.stage-3 .preview-char.r5 { box-shadow: 0 0 80px rgba(247,212,74,.5); }
.stage-3 .preview-char { animation: previewEntrance .5s cubic-bezier(.2,.9,.3,1.15) both; }
.stage-3 .preview-char:last-child { animation-delay: .15s; }

@keyframes previewEntrance {
  from { opacity: 0; transform: scale(.7) translateY(30px); }
}

.ko-preview-chars .elem-particles i {
  position: absolute;
  width: 6px; height: 6px;
  border-radius: 50%;
  opacity: 0;
  animation: particleFloat 2.4s ease-out forwards;
}
.stage-2 .elem-particles i { width: 8px; height: 8px; animation-duration: 2.8s; }
.stage-3 .elem-particles i { width: 10px; height: 10px; animation-duration: 3.2s; }

.ko-preview-vs {
  position: relative;
  font-family: var(--font-display);
  font-size: 36px;
  margin: 0 12px;
}
.ko-preview-vs .vs-text {
  background: var(--grad-main);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  text-shadow: 0 0 30px rgba(74,154,253,.4);
}
.stage-3 .ko-preview-vs .vs-text {
  filter: drop-shadow(0 0 20px rgba(247,212,74,.3));
}

.vs-flare {
  position: absolute;
  top: 50%; left: 50%;
  width: 80px; height: 80px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(247,212,74,.2), transparent 70%);
  animation: vsFlare 1.5s ease-in-out infinite;
  pointer-events: none;
}
@keyframes vsFlare {
  0%, 100% { transform: translate(-50%, -50%) scale(0.8); opacity: .3; }
  50% { transform: translate(-50%, -50%) scale(1.3); opacity: .7; }
}

.ko-preview-name {
  font-size: 18px; font-weight: 700; margin-top: 6px;
  color: var(--txt);
}
.ko-preview-hint {
  color: var(--dim); font-size: 14px;
  animation: fadePulse 1.6s ease-in-out infinite;
}
@keyframes fadePulse {
  0%, 100% { opacity: .4; }
  50% { opacity: 1; }
}

/* ---------- Done / Champion ---------- */
.done-screen { gap: 24px; align-items: center; }
.champ-section { text-align: center; margin-top: 20px; }
.champ-art-wrap {
  width: 260px; height: 260px;
  margin: 0 auto 16px;
  border-radius: var(--r-lg);
  overflow: hidden;
  position: relative;
  animation: champEntrance .8s cubic-bezier(.2, .9, .3, 1.15) both;
}
.champ-art-wrap::after {
  content: '👑';
  position: absolute;
  top: -20px; right: -20px;
  font-size: 60px;
  transform: rotate(18deg);
  filter: drop-shadow(0 8px 20px rgba(0,0,0,.6));
  animation: crownDrop .6s cubic-bezier(.2,.9,.3,1.15) .6s both;
}
@keyframes champEntrance {
  from { opacity: 0; transform: scale(.6) rotate(-6deg); }
}
@keyframes crownDrop {
  from { transform: rotate(-30deg) translateY(-60px) scale(0); opacity: 0; }
}
.champ-art-wrap.r5 { box-shadow: 0 0 80px rgba(247,212,74,.35); }
.champ-art-wrap img { width: 100%; height: 100%; object-fit: cover; }
.champ-name {
  font-size: 36px; font-weight: 900; margin: 12px 0 4px;
  animation: champFadeIn .6s ease .3s both;
}
.champ-meta {
  color: var(--dim); font-size: 14px;
  animation: champFadeIn .6s ease .45s both;
}
@keyframes champFadeIn { from { opacity: 0; transform: translateY(10px); } }
.runner-up { margin-top: 12px; display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--dim); font-size: 14px; }

.done-actions { display: flex; gap: 12px; margin-top: 12px; }
.done-actions .btn { flex: 1; }

.store-promo { text-align: center; margin-top: 8px; }
.store-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 24px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--txt);
  text-decoration: none;
  font-size: 14px; font-weight: 600;
  transition: transform .15s, border-color .2s;
}
.store-btn:active { transform: scale(.96); }
.store-btn:hover { border-color: var(--acc1); }
.store-link { color: var(--dim2); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }

/* ---------- Lineup grid ---------- */
.lineup-grid { display: flex; flex-direction: column; gap: 4px; flex: 1; overflow-y: auto; }

/* ---------- Modal ---------- */
.modal {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  background: rgba(0, 0, 0, .6);
  backdrop-filter: blur(4px);
  animation: modalFade .2s ease both;
}
@keyframes modalFade { from { opacity: 0; } }
.confirm-box {
  width: min(88vw, 360px);
  background: rgba(19, 19, 30, .98);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 24px 22px 22px;
  box-shadow: var(--shadow-card);
  animation: popIn .3s cubic-bezier(.2, .9, .3, 1.15) both;
}
@keyframes popIn { from { opacity: 0; transform: scale(.92); } }
.confirm-box h4 { font-size: 18px; margin-bottom: 8px; }
.confirm-box p { color: var(--dim); font-size: 14px; margin-bottom: 18px; }
.confirm-box .row { display: flex; gap: 10px; }
.confirm-box .row .btn { flex: 1; }

.lang-box { width: min(88vw, 320px); }
.lang-list { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 16px; max-height: 60vh; overflow-y: auto; }
.lang-item {
  min-height: 46px;
  padding: 0 10px;
  border-radius: 13px;
  background: var(--panel);
  border: 1px solid var(--line);
  font-size: 14px; font-weight: 600;
  color: var(--dim);
  transition: transform .15s, border-color .2s;
}
.lang-item:active { transform: scale(.95); }
.lang-item.on { color: var(--txt); border-color: transparent; background: linear-gradient(var(--panel-2), var(--panel-2)) padding-box, var(--grad-main) border-box; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%); z-index: 200;
  padding: 10px 22px;
  border-radius: 999px;
  background: rgba(19, 19, 30, .95);
  border: 1px solid var(--line);
  font-size: 14px;
  color: var(--txt);
  white-space: nowrap;
  transition: opacity .35s, transform .35s;
  opacity: 0;
  pointer-events: none;
}
.toast.show { opacity: 1; }
.ldr {
  display: inline-block;
  width: 20px; height: 20px;
  border: 2px solid var(--line);
  border-top-color: var(--acc1);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.ldr.lg { width: 40px; height: 40px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }
.loader-wrap { flex: 1; display: grid; place-items: center; }

/* ---------- Responsive ---------- */
@media (max-width: 400px) {
  .pick-grid { gap: 8px; }
  .dcard-name { font-size: 12px; }
  .dcard.lg .dcard-name { font-size: 16px; }
  .champ-art-wrap { width: 180px; height: 180px; }
  .ko-preview-chars .preview-char { width: 120px; height: 120px; }
  .ko-preview-vs { font-size: 28px; }
}
