:root {
  /* Светлая «снежная» тема: белый фон, чёрные и золотые акценты */
  --bg-top: #ffffff;
  --bg-bottom: #edf1f7;
  --text: #1d1e22;
  --muted: #7d818c;
  --gold: #b98a2e;
  --gold-soft: rgba(230, 179, 79, .2);
  --surface: #ffffff;
  --surface-strong: #ffffff;
  --line: rgba(20, 30, 60, .09);
  --shadow: 0 2px 10px rgba(30, 45, 90, .07);
  --danger: #ff6b4a;
  --sq-light: #ede7da;
  --sq-dark: #2a2b30;
  --board: min(94vw, calc(100vh - 300px), 620px);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --font: 'Manrope', system-ui, sans-serif;
  --font-display: 'Unbounded', 'Manrope', sans-serif;
}
@supports (height: 100dvh) {
  :root { --board: min(94vw, calc(100dvh - 300px), 620px); }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  background: radial-gradient(130% 90% at 50% 0%, var(--bg-top), var(--bg-bottom) 70%) fixed, var(--bg-bottom);
  color: var(--text);
  font-family: var(--font);
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- Экраны ---------- */
#app { position: fixed; inset: 0; }
.screen {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  opacity: 0; pointer-events: none;
  transform: scale(.98) translateY(8px);
  transition: opacity .4s var(--ease), transform .4s var(--ease);
}
.screen.active { opacity: 1; pointer-events: auto; transform: none; }

/* ---------- Меню ---------- */
.hero { text-align: center; margin-bottom: 30px; }
.logo-mark { position: relative; width: 112px; height: 84px; margin: 0 auto 18px; }
.logo-mark .disc { position: absolute; width: 64px; height: 64px; border-radius: 50%; }
.logo-mark .disc.w { left: 0; top: 0; }
.logo-mark .disc.b { right: 0; bottom: 0; }
.logo {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(40px, 11vw, 64px); letter-spacing: .06em; margin: 0;
  color: var(--text);
}
.logo span { color: var(--gold); }
.tagline { margin: 6px 0 0; color: var(--muted); letter-spacing: .35em; text-transform: uppercase; font-size: 12px; font-weight: 700; }

.profile-card {
  display: flex; align-items: center; gap: 12px;
  width: min(380px, 100%); padding: 12px 14px; margin-bottom: 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
}
.profile-name { font-weight: 800; }
.profile-stats { color: var(--muted); font-size: 13px; }
.profile-stats span:first-child { color: var(--gold); font-weight: 800; }

.menu { display: flex; flex-direction: column; gap: 12px; width: min(380px, 100%); }
.menu-row { display: flex; gap: 12px; }
.menu-row .btn { flex: 1; }
.btn {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 56px; padding: 0 20px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
  font-weight: 800; font-size: 16px;
  transition: transform .18s var(--ease), border-color .2s, background .2s;
}
.btn:hover { border-color: rgba(20, 30, 60, .18); background: #fbfcfe; }
.btn:active { transform: scale(.97); }
.btn-primary {
  background: linear-gradient(180deg, #f2c66a, #d9a03c);
  border-color: transparent; color: #1b1406;
  box-shadow: 0 10px 28px rgba(230, 179, 79, .28), inset 0 1px 0 rgba(255, 255, 255, .5);
  overflow: hidden;
}
.btn-primary:hover { background: linear-gradient(180deg, #f6cf7c, #e0a945); border-color: transparent; }
.btn-primary::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(110deg, transparent 35%, rgba(255, 255, 255, .45) 50%, transparent 65%);
  transform: translateX(-100%); animation: shine 4s ease-in-out infinite;
}
@keyframes shine { 55%, 100% { transform: translateX(100%); } }
.btn-small { min-height: 50px; font-size: 15px; padding: 0 14px; }
.btn-ghost { background: transparent; }
.badge {
  font-size: 10px; text-transform: uppercase; letter-spacing: .1em;
  padding: 3px 7px; border-radius: 99px; background: var(--gold-soft); color: var(--gold);
}
.version { position: absolute; bottom: max(14px, env(safe-area-inset-bottom)); color: rgba(155, 151, 142, .55); font-size: 12px; margin: 0; }
.muted { color: var(--muted); }

/* ---------- Аватары ---------- */
.avatar {
  --h: 220;
  width: 44px; height: 44px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-weight: 800; font-size: 18px; color: #fff;
  background: linear-gradient(145deg, hsl(var(--h) 35% 52%), hsl(var(--h) 35% 30%));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25);
}
.avatar.me { background: linear-gradient(145deg, #f2c66a, #b9832a); color: #1b1406; }

/* ---------- Шашки (общий вид фигур) ---------- */
.disc.w, .piece.light .orb {
  background: radial-gradient(circle at 36% 30%, #ffffff 0%, #f6f2ea 38%, #ddd6c6 78%, #c4bba8 100%);
  box-shadow: 0 2px 0 #a99f8b, 0 3px 0 #8d8471, 0 8px 14px rgba(0, 0, 0, .45), inset 0 1px 1px rgba(255, 255, 255, .9);
}
.disc.b, .piece.dark .orb {
  background: radial-gradient(circle at 36% 30%, #6b6d74 0%, #2c2d32 34%, #141518 72%, #08080a 100%);
  box-shadow: 0 2px 0 #000, 0 3px 0 #000, 0 8px 14px rgba(0, 0, 0, .6), inset 0 1px 1px rgba(255, 255, 255, .28), inset 0 0 0 1px rgba(255, 255, 255, .06);
}

/* ---------- Уровни ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; width: min(420px, 100%); margin-bottom: 18px; }
.topbar h2 { font-size: 20px; margin: 0; }
.topbar span { width: 44px; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.levels { display: grid; gap: 12px; width: min(420px, 100%); }
.level {
  display: flex; align-items: center; gap: 16px; text-align: left;
  padding: 14px 16px; border-radius: 18px;
  background: var(--surface); border: 1px solid var(--line);
  transition: transform .2s var(--ease), border-color .2s, background .2s;
}
.level:hover { border-color: rgba(230, 179, 79, .45); background: #fbfcfe; transform: translateY(-2px); }
.level:active { transform: scale(.98); }
.level b { display: block; font-size: 17px; }
.level small { color: var(--muted); font-size: 13px; }
.stack { position: relative; width: 52px; height: 52px; flex: none; }
.stack i {
  position: absolute; left: 6px; width: 40px; height: 14px; border-radius: 50%;
  background: linear-gradient(180deg, #f6f2ea, #cfc7b4);
  box-shadow: 0 3px 0 #9d937e, 0 4px 6px rgba(0, 0, 0, .4);
}
.stack i:nth-child(1) { bottom: 6px; } .stack i:nth-child(2) { bottom: 14px; }
.stack i:nth-child(3) { bottom: 22px; } .stack i:nth-child(4) { bottom: 30px; }
.stack.top-gold i:last-child { background: linear-gradient(180deg, #f6d48a, #c99434); box-shadow: 0 3px 0 #8e6420, 0 4px 6px rgba(0, 0, 0, .4); }

.side-pick { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 22px; color: var(--muted); font-size: 14px; }
.segmented { display: flex; padding: 4px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.segmented button { padding: 9px 14px; border-radius: 10px; font-weight: 700; font-size: 14px; color: var(--muted); transition: background .2s, color .2s; }
.segmented button.on { background: #1d1e22; color: #fff; }

/* ---------- Поиск ---------- */
.radar { position: relative; width: 220px; height: 220px; margin-bottom: 26px; }
.radar-ring { position: absolute; border-radius: 50%; border: 1px solid rgba(230, 179, 79, .22); }
.r1 { inset: 0; } .r2 { inset: 22%; } .r3 { inset: 42%; }
.radar-sweep {
  position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(230, 179, 79, .35), transparent 25%);
  animation: spin 2.2s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.radar-dot { position: absolute; width: 8px; height: 8px; border-radius: 50%; background: var(--text); animation: blip 2.2s infinite; opacity: 0; }
.d1 { left: 70%; top: 22%; } .d2 { left: 20%; top: 64%; animation-delay: .8s; } .d3 { left: 76%; top: 72%; animation-delay: 1.5s; }
@keyframes blip { 10% { opacity: 1; } 60% { opacity: 0; } }
.radar-me { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); }
#screen-search h2 { margin: 0 0 6px; }
.found-card {
  display: flex; align-items: center; gap: 12px; margin: 16px 0 6px; padding: 12px 18px;
  border-radius: 18px; background: var(--surface); border: 1px solid rgba(230, 179, 79, .4);
  opacity: 0; transform: translateY(10px) scale(.95); transition: all .4s var(--ease);
}
.found-card.show { opacity: 1; transform: none; }
.found-card b { display: block; }
.found-card small { color: var(--gold); font-weight: 800; }

/* ---------- Игровой экран ---------- */
#screen-game { justify-content: space-evenly; gap: 8px; padding-bottom: calc(112px + env(safe-area-inset-bottom)); }
.player-card {
  display: flex; align-items: center; gap: 10px;
  width: var(--board); padding: 8px 12px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
  transition: border-color .3s, background .3s;
}
.player-card.turn { border-color: rgba(230, 179, 79, .6); background: rgba(230, 179, 79, .07); }
.player-card .avatar { width: 38px; height: 38px; font-size: 15px; }
.pc-info { flex: 1; min-width: 0; }
.pc-name { font-weight: 800; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-sub { color: var(--muted); font-size: 12px; }
.pc-captured { display: flex; align-items: center; gap: 5px; font-weight: 800; font-size: 14px; color: var(--muted); }
.pc-captured i { width: 14px; height: 14px; border-radius: 50%; display: inline-block; }
.pc-captured i.light { background: radial-gradient(circle at 36% 30%, #fff, #ddd6c6); box-shadow: 0 1px 0 #8d8471; }
.pc-captured i.dark { background: radial-gradient(circle at 36% 30%, #6b6d74, #141518); box-shadow: 0 1px 0 #000, inset 0 0 0 1px rgba(255, 255, 255, .15); }
.clock {
  font-variant-numeric: tabular-nums; font-weight: 800; font-size: 17px;
  padding: 6px 10px; border-radius: 10px; background: #eef1f6; min-width: 64px; text-align: center;
}
.clock.hidden { display: none; }
.clock.low { color: var(--danger); animation: pulse 1s infinite; }
.player-card.turn .clock { background: #1d1e22; color: #fff; }
.player-card.turn .clock.low { background: var(--danger); color: #fff; }
@keyframes pulse { 50% { opacity: .6; } }

.status { height: 22px; font-size: 14px; font-weight: 700; color: var(--muted); transition: color .3s; }
.status.must { color: var(--danger); }
.status.mine { color: var(--gold); }
.status .dots::after { content: ''; animation: dots 1.2s steps(4) infinite; }
@keyframes dots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }

/* Доска: классика, белые и чёрные поля, тёмная рамка с тонкой золотой линией */
.board-shell {
  position: relative; padding: 10px; border-radius: 18px;
  background: linear-gradient(160deg, #34353b, #18191c 60%, #111214);
  box-shadow: 0 24px 50px rgba(20, 25, 45, .3), inset 0 1px 0 rgba(255, 255, 255, .08);
}
.board-shell::before {
  content: ''; position: absolute; inset: 6px; border-radius: 14px;
  border: 1px solid rgba(230, 179, 79, .35);
  pointer-events: none;
}
.board-shell.shake { animation: shake .3s; }
@keyframes shake {
  25% { transform: translate(-2px, 1px); } 50% { transform: translate(2px, -1px); } 75% { transform: translate(-1px, 0); }
}

.board { position: relative; width: calc(var(--board) - 20px); height: calc(var(--board) - 20px); border-radius: 8px; touch-action: none; }
.cells { position: absolute; inset: 0; display: grid; grid-template: repeat(8, 1fr) / repeat(8, 1fr); border-radius: 8px; overflow: hidden; }
.cell { position: relative; }
.cell.light { background: linear-gradient(145deg, #f4efe4, var(--sq-light)); }
.cell.dark { background: linear-gradient(145deg, #34353b, var(--sq-dark) 60%, #232428); }
.cell .coord { position: absolute; font-size: 10px; font-weight: 800; pointer-events: none; }
.cell.light .coord { color: rgba(42, 43, 48, .55); }
.cell.dark .coord { color: rgba(237, 231, 218, .45); }
.cell .coord.file { right: 4px; bottom: 2px; }
.cell .coord.rank { left: 4px; top: 2px; }
.cell.last::after { content: ''; position: absolute; inset: 0; background: rgba(230, 179, 79, .2); box-shadow: inset 0 0 0 2px rgba(230, 179, 79, .35); }
.cell.hint::after { content: ''; position: absolute; inset: 0; box-shadow: inset 0 0 0 3px var(--gold), inset 0 0 22px rgba(230, 179, 79, .55); }
.cell.path::before {
  content: ''; position: absolute; inset: 40%; border-radius: 50%; background: var(--danger); box-shadow: 0 0 10px var(--danger);
}
.target {
  --tc: 230, 179, 79;
  position: absolute; inset: 33%; border-radius: 50%; z-index: 1;
  background: rgba(var(--tc), .9);
  box-shadow: 0 0 12px rgba(var(--tc), .7);
  animation: portal 1.2s ease-in-out infinite;
  pointer-events: none;
}
.target.cap { --tc: 255, 107, 74; inset: 8%; background: transparent; border: 3px solid rgba(var(--tc), .9); box-shadow: 0 0 14px rgba(var(--tc), .6), inset 0 0 10px rgba(var(--tc), .4); }
@keyframes portal { 50% { transform: scale(.82); opacity: .8; } }

.pieces { position: absolute; inset: 0; pointer-events: none; }
.piece {
  position: absolute; left: 0; top: 0; width: 12.5%; height: 12.5%;
  display: grid; place-items: center; will-change: transform;
}
.orb {
  position: relative; width: 80%; height: 80%; margin-top: -4%; border-radius: 50%;
  transition: transform .22s var(--ease), filter .22s, box-shadow .22s;
}
/* Концентрические бороздки, как у настоящей шашки */
.orb::before {
  content: ''; position: absolute; inset: 16%; border-radius: 50%;
  box-shadow: 0 0 0 1.5px rgba(0, 0, 0, .1), inset 0 0 0 1.5px rgba(0, 0, 0, .06), 0 0 0 4px rgba(255, 255, 255, .0);
}
.piece.light .orb::before { box-shadow: 0 0 0 1.5px rgba(120, 108, 85, .28), inset 0 1px 2px rgba(120, 108, 85, .25); }
.piece.dark .orb::before { box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .13), inset 0 1px 2px rgba(0, 0, 0, .6); }
/* Дамка — золотая корона */
.piece.king .orb::after {
  content: ''; position: absolute; left: 27%; right: 27%; top: 30%; bottom: 32%;
  background: linear-gradient(180deg, #ffe39a, #e6b34f 55%, #a8741f);
  clip-path: polygon(0 100%, 0 28%, 25% 58%, 50% 8%, 75% 58%, 100% 28%, 100% 100%);
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .35));
}
.piece.selected .orb { transform: translateY(-5px) scale(1.08); }
.piece.light.selected .orb { box-shadow: 0 2px 0 #a99f8b, 0 3px 0 #8d8471, 0 16px 20px rgba(0, 0, 0, .5), 0 0 0 3px var(--gold), 0 0 18px rgba(230, 179, 79, .6), inset 0 1px 1px rgba(255, 255, 255, .9); }
.piece.dark.selected .orb { box-shadow: 0 2px 0 #000, 0 3px 0 #000, 0 16px 20px rgba(0, 0, 0, .6), 0 0 0 3px var(--gold), 0 0 18px rgba(230, 179, 79, .6), inset 0 1px 1px rgba(255, 255, 255, .28); }
.piece.must::after {
  content: ''; position: absolute; inset: 3%; border-radius: 50%;
  border: 2px solid rgba(255, 107, 74, .9); animation: must 1s ease-in-out infinite; pointer-events: none;
}
@keyframes must { 50% { transform: scale(1.06); opacity: .55; } }
.piece.hit .orb { animation: hit .2s ease-in-out infinite alternate; }
@keyframes hit { to { transform: scale(.92); filter: brightness(1.3); } }
.piece.vanish { animation: vanish .4s var(--ease) forwards; }
.piece.vanish .orb { transform: scale(.5); transition: transform .4s var(--ease); }
@keyframes vanish { to { opacity: 0; } }
.piece.spawn .orb { animation: spawn .45s var(--ease) both; }
@keyframes spawn { from { transform: translateY(-14px) scale(.6); opacity: 0; } }

/* Перетаскивание и полёт */
.board { cursor: pointer; }
.piece.dragging { z-index: 10; }
.piece.dragging .orb { transform: scale(1.14); transition: transform .12s var(--ease); }
.piece.light.dragging .orb, .piece.light.flying .orb { box-shadow: 0 2px 0 #a99f8b, 0 3px 0 #8d8471, 0 22px 26px rgba(0, 0, 0, .45), inset 0 1px 1px rgba(255, 255, 255, .9); }
.piece.dark.dragging .orb, .piece.dark.flying .orb { box-shadow: 0 2px 0 #000, 0 3px 0 #000, 0 22px 26px rgba(0, 0, 0, .6), inset 0 1px 1px rgba(255, 255, 255, .28); }
.cell.drop-hover::after { content: ''; position: absolute; inset: 0; background: rgba(230, 179, 79, .28); box-shadow: inset 0 0 0 3px var(--gold); }
.piece.fly-out { position: fixed; z-index: 50; pointer-events: none; }

/* Корона появляется с золотым бликом */
.piece.crowned .orb::after { animation: crown-in .6s var(--ease) both; }
.piece.crowned .orb { box-shadow: 0 0 0 3px rgba(230, 179, 79, .9), 0 0 26px rgba(230, 179, 79, .8), 0 8px 14px rgba(0, 0, 0, .5); }
@keyframes crown-in { from { transform: scale(0) translateY(30%); opacity: 0; } 60% { transform: scale(1.25); } }

#fx { position: absolute; left: -10%; top: -10%; width: 120%; height: 120%; pointer-events: none; }

/* ---------- Нижняя панель партии ---------- */
.game-dock {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 3;
  display: flex; justify-content: center; gap: clamp(6px, 3vw, 22px);
  padding: 12px 14px max(12px, env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .96); border-radius: 26px 26px 0 0;
  box-shadow: 0 -10px 34px rgba(30, 45, 90, .1), inset 0 1px 0 rgba(230, 179, 79, .35);
}
.game-dock::before {
  content: ""; position: absolute; top: 0; left: 50%; width: 46px; height: 3px; margin-left: -23px;
  border-radius: 0 0 3px 3px; background: linear-gradient(90deg, #f2c66a, #d9a03c);
}
.dock-btn {
  flex: 1; max-width: 92px; display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; color: var(--muted); transition: opacity .2s, color .2s;
}
.dock-ico {
  width: 54px; height: 54px; display: grid; place-items: center; border-radius: 18px;
  background: linear-gradient(180deg, #ffffff, #eef1f6); color: #1d1e22;
  box-shadow: 0 4px 12px rgba(30, 45, 90, .1), inset 0 0 0 1px rgba(20, 30, 60, .07);
  transition: transform .15s var(--ease), box-shadow .2s, background .2s;
}
.dock-ico svg { width: 24px; height: 24px; stroke-width: 2; }
.dock-btn:hover .dock-ico { box-shadow: 0 6px 16px rgba(30, 45, 90, .16), inset 0 0 0 1px rgba(230, 179, 79, .5); }
.dock-btn:active .dock-ico { transform: scale(.9); }
.dock-btn.primary { color: var(--gold); }
.dock-btn.primary .dock-ico {
  background: linear-gradient(180deg, #f6d27e, #d9a03c); color: #1b1406;
  box-shadow: 0 8px 20px rgba(217, 160, 60, .45), inset 0 1px 0 rgba(255, 255, 255, .55);
}
.dock-btn[disabled] { opacity: .35; pointer-events: none; }
.dock-btn.hidden { display: none; }
.dock-btn .sound-off { opacity: 0; }
.dock-btn.off .sound-wave { opacity: 0; }
.dock-btn.off .sound-off { opacity: 1; }
.dock-btn.off .dock-ico { color: var(--muted); }
.btn.off .sound-wave { opacity: 0; }

/* ---------- Модальные окна ---------- */
.modal {
  position: fixed; inset: 0; display: grid; place-items: center; padding: 16px;
  background: rgba(20, 25, 40, .35); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  opacity: 0; pointer-events: none; transition: opacity .35s;
  z-index: 20;
}
.modal.show { opacity: 1; pointer-events: auto; }
.modal-card {
  position: relative; overflow: hidden; width: min(360px, 100%); padding: 28px 22px 22px; text-align: center;
  border-radius: 24px; background: var(--surface-strong); border: 1px solid var(--line);
  box-shadow: 0 30px 80px rgba(20, 30, 60, .22);
  transform: scale(.92) translateY(16px); transition: transform .45s var(--ease);
}
.modal.show .modal-card { transform: none; }
.modal-card h2 { font-family: var(--font-display); font-weight: 700; font-size: 28px; margin: 0 0 8px; position: relative; }
.modal-card p { color: var(--muted); margin: 0 0 14px; position: relative; }
.modal-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; position: relative; }
.result-glow { position: absolute; inset: -40% -20% auto; height: 220px; background: radial-gradient(circle, rgba(255, 255, 255, .12), transparent 65%); }
.win .result-glow { background: radial-gradient(circle, rgba(230, 179, 79, .45), transparent 65%); }
.win h2 { color: var(--gold); }
.lose .result-glow { background: radial-gradient(circle, rgba(255, 107, 74, .25), transparent 65%); }
.result-delta { font-size: 20px; font-weight: 800; position: relative; min-height: 4px; }
.result-delta.up { color: #1f9d57; }
.result-delta.down { color: var(--danger); }

/* ---------- Экран итогов партии ---------- */
.result {
  position: fixed; inset: 0; z-index: 25;
  display: grid; place-items: center; padding: 16px; overflow: hidden;
  background: radial-gradient(120% 80% at 50% 30%, rgba(255, 255, 255, .98), rgba(237, 241, 247, .99));
  opacity: 0; pointer-events: none; transition: opacity .45s var(--ease);
}
.result.show { opacity: 1; pointer-events: auto; }
.result-rays {
  position: absolute; left: 50%; top: 30%; width: 1400px; height: 1400px; margin: -700px 0 0 -700px;
  background: repeating-conic-gradient(from 0deg, rgba(230, 179, 79, .06) 0 8deg, transparent 8deg 22deg);
  -webkit-mask: radial-gradient(circle, #000 0, transparent 45%); mask: radial-gradient(circle, #000 0, transparent 45%);
  animation: spin 40s linear infinite; opacity: 0; transition: opacity 1s;
}
.result.win .result-rays { opacity: 1; }
#confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }
.result-inner { position: relative; width: min(380px, 100%); text-align: center; }
.result-emblem { height: 120px; display: grid; place-items: center; margin-bottom: 10px; }
.result.show .result-emblem > * { animation: emblem-in .8s cubic-bezier(.2, 1.4, .4, 1) both .1s; }
@keyframes emblem-in { from { transform: scale(.2) rotate(-25deg); opacity: 0; } }
.result-emblem .crown { width: 130px; height: 108px; filter: drop-shadow(0 10px 24px rgba(230, 179, 79, .5)); }
.result-emblem .crown .shine { animation: crown-shine 2.6s ease-in-out infinite 1s; }
@keyframes crown-shine { 0% { transform: translateX(-140px); } 45%, 100% { transform: translateX(160px); } }
.emblem-discs { position: relative; width: 120px; height: 96px; }
.emblem-discs .disc { position: absolute; width: 78px; height: 78px; border-radius: 50%; }
.emblem-discs .disc:first-child { left: 0; top: 0; }
.emblem-discs .disc:last-child { right: 0; bottom: 0; }
.emblem-disc { position: relative; width: 96px; height: 96px; }
.emblem-disc .disc { position: absolute; inset: 0; border-radius: 50%; }
.result.lose .emblem-disc { transform: rotate(-12deg); filter: saturate(.6) brightness(.8); }
.emblem-disc .mini-crown {
  position: absolute; left: 26%; right: 26%; top: 28%; bottom: 30%;
  background: linear-gradient(180deg, #ffe39a, #e6b34f 55%, #a8741f);
  clip-path: polygon(0 100%, 0 28%, 25% 58%, 50% 8%, 75% 58%, 100% 28%, 100% 100%);
}
.result-title {
  font-family: var(--font-display); font-weight: 700; font-size: clamp(34px, 10vw, 48px);
  margin: 0; letter-spacing: .04em;
}
.result-title span { display: inline-block; }
.result.show .result-title span { animation: letter-in .5s var(--ease) both; }
@keyframes letter-in { from { transform: translateY(24px) scale(.6); opacity: 0; } }
.result.win .result-title { color: var(--gold); text-shadow: 0 0 30px rgba(230, 179, 79, .45); }
.result.lose .result-title { color: var(--text); }
.result-sub { color: var(--muted); margin: 8px 0 20px; font-weight: 600; }
.result.show .result-sub, .result.show .result-stats, .result.show .result-rating, .result.show .result-actions { animation: rise .5s var(--ease) both; }
.result.show .result-sub { animation-delay: .35s; }
.result.show .result-stats { animation-delay: .45s; }
.result.show .result-rating { animation-delay: .55s; }
.result.show .result-actions { animation-delay: .65s; }
@keyframes rise { from { transform: translateY(16px); opacity: 0; } }
.result-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.stat { padding: 10px 4px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.stat b { display: block; font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat small { color: var(--muted); font-size: 11px; font-weight: 700; }
.result-rating {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 12px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); margin-bottom: 18px;
}
.result-rating.hidden { display: none; }
.rr-label { color: var(--muted); font-weight: 700; font-size: 14px; }
.rr-value { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; }
.rr-delta { font-weight: 800; padding: 3px 9px; border-radius: 99px; font-size: 14px; }
.rr-delta.up { color: #1f9d57; background: rgba(31, 157, 87, .12); }
.rr-delta.down { color: #d94a2b; background: rgba(255, 107, 74, .12); }
.rr-delta:empty { display: none; }
.result-actions { display: flex; flex-direction: column; gap: 10px; }
.result-row { display: flex; gap: 10px; }
.result-row .btn { flex: 1; }
.status .link { color: var(--gold); text-decoration: underline; font-weight: 800; padding: 0 2px; }

.toast {
  position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); z-index: 30;
  transform: translate(-50%, 20px); opacity: 0;
  padding: 12px 18px; border-radius: 14px; font-weight: 700; font-size: 14px;
  background: var(--surface-strong); border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(20, 30, 60, .16);
  transition: opacity .3s, transform .3s var(--ease); pointer-events: none;
  width: max-content; max-width: calc(100vw - 32px); text-align: center; line-height: 1.35;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-height: 640px) {
  .player-card { padding: 5px 10px; }
  .dock-ico { width: 46px; height: 46px; border-radius: 15px; }
}
@media (prefers-reduced-motion: reduce) {
  .btn-primary::after { animation: none; }
}
