/* Domino Mate - premium dark UI */
:root {
  --bg: #08080b;
  --bg-2: #0c0c11;
  --surface: rgba(255, 255, 255, .045);
  --surface-2: rgba(255, 255, 255, .075);
  --surface-3: rgba(255, 255, 255, .11);
  --line: rgba(255, 255, 255, .085);
  --line-2: rgba(255, 255, 255, .16);
  --text: #f3eee5;
  --muted: #9b95a6;
  --muted-2: #736e80;
  --gold: #eac481;
  --gold-2: #c99a4b;
  --gold-soft: rgba(234, 196, 129, .13);
  --ivory: #f6f0e3;
  --ink: #101017;
  --green: #66d9a8;
  --red: #f2796d;
  --r-xl: 26px;
  --r-lg: 20px;
  --r-md: 15px;
  --r-sm: 11px;
  --font: "SF Arabic", "Geeza Pro", "Noto Naskh Arabic", "Noto Sans Arabic", -apple-system, "Segoe UI", system-ui, sans-serif;
  --shadow-1: 0 18px 40px -26px rgba(0, 0, 0, .9);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
html { background: var(--bg); }
body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(820px 460px at 88% -8%, rgba(234, 196, 129, .13), transparent 62%),
    radial-gradient(760px 520px at -14% 4%, rgba(108, 106, 214, .12), transparent 60%),
    radial-gradient(900px 700px at 50% 118%, rgba(234, 196, 129, .05), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
body.locked { overflow: hidden; }
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .5;
  z-index: 0;
  background-image: radial-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px);
  background-size: 3px 3px;
  mix-blend-mode: overlay;
}

button, input { font-family: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
input { -webkit-appearance: none; appearance: none; }
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; }

.app {
  position: relative;
  z-index: 1;
  max-width: 480px;
  margin: 0 auto;
  padding: 0 18px calc(24px + var(--safe-b));
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 0 10px;
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(180deg, rgba(8, 8, 11, .96) 40%, rgba(8, 8, 11, 0));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  margin: 0 -18px;
  padding-inline: 18px;
}
.brand { display: flex; align-items: center; gap: 10px; text-align: start; }
.brand-mark { display: inline-flex; color: var(--ivory); filter: drop-shadow(0 4px 12px rgba(234, 196, 129, .28)); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-size: 15px; font-weight: 700; letter-spacing: .01em; }
.brand-sub { font-size: 10.5px; color: var(--muted-2); letter-spacing: .04em; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  transition: background .18s, transform .12s;
}
.icon-btn:active { transform: scale(.94); background: var(--surface-2); }
.lang-btn { font-size: 12px; font-weight: 700; color: var(--gold); letter-spacing: .02em; }

.view { flex: 1; display: flex; flex-direction: column; }

/* ---------- hero ---------- */
.hero {
  position: relative; padding: 22px 0 30px; text-align: center;
  flex: 1;
  display: flex; flex-direction: column; align-items: center;
  padding-top: clamp(18px, 6vh, 54px);
  animation: rise .5s cubic-bezier(.2,.75,.3,1) both;
}
.hero > * { width: 100%; }
.feature-row { display: flex; gap: 8px; margin-top: 24px; }
.feature {
  flex: 1; padding: 12px 8px; border-radius: var(--r-md);
  background: rgba(255, 255, 255, .03); border: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 4px; align-items: center;
}
.feature .f-ico { font-size: 15px; color: var(--gold); line-height: 1; }
.feature .f-txt { font-size: 10.5px; color: var(--muted); letter-spacing: .01em; }
.hero-glow {
  position: absolute; top: -30px; left: 50%; transform: translateX(-50%);
  width: 300px; height: 300px; border-radius: 50%;
  background: radial-gradient(circle, rgba(234, 196, 129, .22), transparent 66%);
  filter: blur(14px); pointer-events: none;
}
.hero-tile { position: relative; display: flex; justify-content: center; margin-bottom: 18px; }
.hero-domino { color: var(--ivory); filter: drop-shadow(0 22px 34px rgba(0, 0, 0, .65)) drop-shadow(0 0 26px rgba(234, 196, 129, .22)); animation: float 6s ease-in-out infinite; }
.hero-title { font-size: clamp(28px, 8vw, 34px); margin: 0 0 8px; letter-spacing: -.01em; font-weight: 800; }
.hero-tag { margin: 0 auto 4px; font-size: 15px; color: #ded7ca; max-width: 320px; line-height: 1.5; }
.hero-tag.dim { color: var(--muted); font-size: 13px; }
.hero-actions { margin-top: 26px; display: flex; flex-direction: column; gap: 10px; }
.hero-foot { margin: auto 0 0; padding-top: 18px; font-size: 11.5px; color: var(--muted-2); letter-spacing: .02em; }

.saved-card {
  margin-top: 22px; padding: 14px; border-radius: var(--r-lg);
  background: linear-gradient(180deg, rgba(234, 196, 129, .1), rgba(255, 255, 255, .03));
  border: 1px solid rgba(234, 196, 129, .28);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; text-align: start;
}
.saved-copy { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.saved-title { font-size: 13px; color: var(--gold); font-weight: 600; }
.saved-meta { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.saved-card .btn { padding: 10px 14px; font-size: 13.5px; white-space: nowrap; }

.mini-stats { display: flex; gap: 8px; margin-top: 26px; }
.mini-stat {
  flex: 1; padding: 12px 8px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 3px; align-items: center;
}
.mini-stat .ms-value { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.mini-stat .ms-label { font-size: 10.5px; color: var(--muted); }
.mini-stat.link .ms-value { color: var(--gold); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 18px; border-radius: var(--r-md);
  font-size: 15px; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--text);
  transition: transform .12s, background .18s, box-shadow .2s, opacity .2s;
}
.btn:active { transform: scale(.975); }
.btn-primary {
  background: linear-gradient(180deg, #f4d49b, #d5a55a);
  color: #221806; border-color: rgba(255, 255, 255, .18);
  box-shadow: 0 14px 30px -16px rgba(234, 196, 129, .8), inset 0 1px 0 rgba(255, 255, 255, .5);
}
.btn-primary:active { box-shadow: 0 8px 18px -14px rgba(234, 196, 129, .8); }
.btn-ghost { background: transparent; border-color: var(--line-2); color: var(--text); }
.btn-danger { background: rgba(242, 121, 109, .12); border-color: rgba(242, 121, 109, .38); color: #ffb4ab; }
.btn-lg { width: 100%; padding: 17px; font-size: 16.5px; border-radius: 18px; }
.btn:disabled { opacity: .4; pointer-events: none; }
.text-btn { font-size: 13px; color: var(--gold); padding: 6px 2px; font-weight: 600; }
.text-btn:disabled { color: var(--muted-2); pointer-events: none; }
.back-btn {
  width: 34px; height: 34px; border-radius: 11px; border: 1px solid var(--line);
  background: var(--surface); display: inline-flex; align-items: center; justify-content: center;
}
[dir="rtl"] .back-btn svg { transform: scaleX(-1); }

/* ---------- screens ---------- */
.screen { animation: screenIn .35s ease both; padding-bottom: 8px; }
.screen-head { display: flex; align-items: center; gap: 12px; margin: 8px 0 18px; }
.screen-title { font-size: 22px; margin: 0; font-weight: 800; letter-spacing: -.01em; }
.screen-sub { margin: -12px 0 18px; color: var(--muted); font-size: 13px; }
.screen-head + .screen-sub { margin-top: -8px; }
.screen-head .screen-title { flex: 1; }

/* setup */
.steps { display: flex; align-items: center; gap: 8px; margin: 6px 0 16px; }
.step {
  width: 26px; height: 26px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: var(--muted);
  border: 1px solid var(--line-2);
}
.step.on { background: var(--gold-soft); border-color: var(--gold); color: var(--gold); }
.step.done { background: rgba(102, 217, 168, .14); border-color: rgba(102, 217, 168, .5); color: var(--green); }
.step-line { flex: 1; height: 1px; background: var(--line); }
.setup .screen-title { margin-bottom: 4px; }

.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 16px; margin-bottom: 12px;
}
.panel-label { font-size: 12.5px; color: var(--muted); margin-bottom: 10px; letter-spacing: .02em; }
.hint { margin: 10px 0 0; font-size: 11.5px; color: var(--muted-2); }
.warn { margin: 0 0 12px; font-size: 12.5px; color: #ffb4ab; }

.seg { display: flex; gap: 4px; background: rgba(0, 0, 0, .3); border: 1px solid var(--line); border-radius: 13px; padding: 4px; }
.seg button {
  flex: 1; padding: 10px 6px; border-radius: 10px; font-size: 14px; color: var(--muted);
  transition: background .2s, color .2s;
}
.seg button.on { background: var(--surface-3); color: var(--text); box-shadow: 0 4px 12px -8px #000; }
.seg.small button { font-size: 13px; padding: 8px 6px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-width: 50px; padding: 11px 14px; border-radius: 13px;
  background: rgba(0, 0, 0, .25); border: 1px solid var(--line);
  font-size: 15px; font-weight: 600; color: var(--text);
  transition: border-color .18s, background .18s, color .18s, transform .12s;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.chip:active { transform: scale(.96); }
.chip.on { background: var(--gold-soft); border-color: rgba(234, 196, 129, .6); color: var(--gold); }

.inline-field { margin-top: 10px; }
input[type=text], input[type=number] {
  width: 100%; padding: 13px 14px; border-radius: 13px;
  background: rgba(0, 0, 0, .28); border: 1px solid var(--line);
  font-size: 16px; color: var(--text);
  transition: border-color .18s, box-shadow .18s;
}
input::placeholder { color: var(--muted-2); }
input:focus { outline: none; border-color: rgba(234, 196, 129, .55); box-shadow: 0 0 0 3px rgba(234, 196, 129, .12); }

.name-row, .player-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.name-row:last-child, .player-row:last-child { margin-bottom: 0; }
.player-row { flex-wrap: wrap; }
.player-row input { flex: 1; min-width: 120px; }
.team-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.team-0 { background: var(--gold); }
.team-1 { background: #7fb2ff; }
.team-2 { background: #6fe3b0; }
.team-3 { background: #ff9e7a; }
.team-4 { background: #c79bff; }
.team-5 { background: #8fe0ea; }
.team-picks { display: flex; gap: 6px; flex-basis: 100%; padding-inline-start: 2px; }
.tpick {
  flex: 1; padding: 8px 6px; border-radius: 10px; font-size: 11.5px;
  border: 1px solid var(--line); color: var(--muted); background: rgba(0, 0, 0, .2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tpick.on { border-color: rgba(234, 196, 129, .6); color: var(--gold); background: var(--gold-soft); }
.setup-actions { display: flex; gap: 10px; margin-top: 16px; }
.setup-actions .btn { flex: 1; }
.setup { padding-bottom: 100px; }
.setup-actions.fixed {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 30;
  max-width: 480px; margin: 0 auto;
  padding: 14px 18px calc(14px + var(--safe-b));
  background: linear-gradient(180deg, rgba(8, 8, 11, 0), rgba(8, 8, 11, .94) 40%, #08080b);
}

/* ---------- game ---------- */
.game { padding-bottom: 134px; }
.leader-pill {
  display: inline-block; margin-inline-start: 6px; padding: 1px 7px; border-radius: 999px;
  font-size: 9.5px; letter-spacing: .06em; color: var(--gold);
  background: var(--gold-soft); border: 1px solid rgba(234, 196, 129, .3);
}
.game-head { margin: 6px 0 16px; }
.chip-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.status-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 11px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  border: 1px solid var(--line-2); background: var(--surface);
}
.status-chip i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.status-chip.live { color: var(--green); border-color: rgba(102, 217, 168, .35); background: rgba(102, 217, 168, .09); }
.status-chip.live i { background: var(--green); box-shadow: 0 0 0 3px rgba(102, 217, 168, .16); animation: pulse 2s infinite; }
.status-chip.paused { color: var(--gold); border-color: rgba(234, 196, 129, .35); background: var(--gold-soft); }
.status-chip.paused i { background: var(--gold); }
.status-chip.done { color: var(--muted); }
.pill { padding: 6px 11px; border-radius: 999px; font-size: 11.5px; color: var(--muted); border: 1px solid var(--line); background: rgba(0, 0, 0, .2); font-variant-numeric: tabular-nums; }
.notice { margin: 0 0 14px; padding: 12px 14px; border-radius: var(--r-md); font-size: 13px; color: var(--gold); background: var(--gold-soft); border: 1px solid rgba(234, 196, 129, .25); }

.result-banner {
  margin: 0 0 16px; padding: 20px; border-radius: var(--r-xl); text-align: center;
  background: radial-gradient(120% 120% at 50% 0%, rgba(234, 196, 129, .22), rgba(255, 255, 255, .03) 70%);
  border: 1px solid rgba(234, 196, 129, .35);
  box-shadow: 0 20px 50px -30px rgba(234, 196, 129, .7);
}
.rb-label { font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); }
.rb-name { font-size: 26px; font-weight: 800; margin: 6px 0 4px; }
.rb-meta { font-size: 12px; color: var(--muted); }

.standings { display: flex; flex-direction: column; gap: 10px; }
.score-card {
  display: grid; grid-template-columns: auto auto 1fr auto; align-items: center; gap: 12px;
  padding: 14px 16px; border-radius: var(--r-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, .025));
  border: 1px solid var(--line);
  box-shadow: var(--shadow-1);
  animation: rise .42s cubic-bezier(.2,.75,.3,1) both;
  animation-delay: calc(var(--i) * 45ms);
  position: relative; overflow: hidden;
}
.score-card::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(120deg, rgba(255, 255, 255, .06), transparent 42%);
}
.score-card.is-leader {
  border-color: rgba(234, 196, 129, .42);
  background: linear-gradient(180deg, rgba(234, 196, 129, .13), rgba(255, 255, 255, .025));
  box-shadow: 0 20px 44px -30px rgba(234, 196, 129, .85), inset 0 1px 0 rgba(255, 255, 255, .09);
}
.rank-badge {
  width: 24px; height: 24px; border-radius: 8px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11.5px; font-weight: 700; color: var(--muted);
  background: rgba(0, 0, 0, .3); border: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
.rank-badge.r1 { color: #241a06; background: linear-gradient(180deg, #f4d49b, #d5a55a); border-color: transparent; }
.avatar { display: inline-flex; color: var(--ivory); flex: none; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .5)); }
.score-main { min-width: 0; }
.score-name { font-size: 16px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.score-meta { font-size: 11.5px; color: var(--muted); margin-top: 2px; font-variant-numeric: tabular-nums; }
.score-right { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.score-total {
  font-size: clamp(30px, 9.4vw, 40px); font-weight: 800; line-height: 1;
  letter-spacing: -.035em; font-variant-numeric: tabular-nums;
}
.is-leader .score-total { color: var(--gold); }
.gap-chip { font-size: 10.5px; color: var(--muted-2); font-variant-numeric: tabular-nums; }
.gap-chip.lead { color: var(--gold); letter-spacing: .04em; }

/* history */
.history-block { margin-top: 26px; }
.block-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.block-head h3 { margin: 0; font-size: 14px; font-weight: 650; color: var(--text); letter-spacing: .01em; }
.round-list { display: flex; flex-direction: column; gap: 8px; }
.round-row {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px;
  padding: 11px 12px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--line);
}
.rr-num {
  width: 24px; height: 24px; border-radius: 8px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: var(--muted);
  background: rgba(0, 0, 0, .3); border: 1px solid var(--line);
}
.rr-scores { display: flex; flex-wrap: wrap; gap: 4px 12px; min-width: 0; }
.rr-item { display: inline-flex; align-items: baseline; gap: 5px; font-size: 11.5px; color: var(--muted); }
.rr-item b { font-weight: 600; color: #cfc8bb; max-width: 68px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rr-item i { font-style: normal; color: var(--gold); font-variant-numeric: tabular-nums; }
.rr-item em { font-style: normal; color: var(--muted-2); font-size: 10.5px; font-variant-numeric: tabular-nums; }
.rr-item em::before { content: "· "; }
.rr-actions { display: flex; gap: 4px; }
.mini-btn {
  width: 30px; height: 30px; border-radius: 9px; font-size: 13px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, .25); border: 1px solid var(--line); color: var(--muted);
}
.mini-btn.danger { color: #d99a92; }
.mini-btn:active { background: var(--surface-2); }

.empty { padding: 26px 18px; text-align: center; border-radius: var(--r-lg); border: 1px dashed var(--line-2); background: rgba(255, 255, 255, .015); }
.empty-title { font-size: 14px; font-weight: 600; }
.empty-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

.action-bar {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 30;
  max-width: 480px; margin: 0 auto;
  padding: 14px 18px calc(14px + var(--safe-b));
  background: linear-gradient(180deg, rgba(8, 8, 11, 0), rgba(8, 8, 11, .92) 34%, rgba(8, 8, 11, .99));
  display: flex; gap: 10px;
}
.add-round { letter-spacing: .01em; }
.add-round .plus { font-size: 20px; font-weight: 700; margin-top: -2px; }

/* ---------- sheets ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(3, 3, 6, .62);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  animation: fade .22s ease both;
}
.sheet {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 51;
  max-width: 480px; margin: 0 auto;
  background: linear-gradient(180deg, #15151c, #0e0e13);
  border: 1px solid var(--line-2); border-bottom: 0;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: 8px 18px calc(18px + var(--safe-b));
  max-height: 88dvh; overflow-y: auto;
  animation: sheetUp .34s cubic-bezier(.2,.8,.2,1) both;
  box-shadow: 0 -24px 60px -30px #000;
}
.sheet-grip { width: 38px; height: 4px; border-radius: 999px; background: rgba(255, 255, 255, .16); margin: 4px auto 12px; }
.sheet-head h3 { margin: 0; font-size: 17px; font-weight: 700; }
.sheet-sub { margin: 6px 0 0; font-size: 12px; color: var(--muted); line-height: 1.5; }
.sheet-actions { display: flex; gap: 10px; margin-top: 16px; }
.sheet-actions .btn { flex: 1; }

.entry-list { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.entry-row { padding: 12px 14px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); }
.entry-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.entry-name { display: inline-flex; align-items: center; gap: 10px; font-size: 14.5px; min-width: 0; }
.entry-name b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 130px; }
input.entry-input {
  width: 92px; padding: 8px 10px; border-radius: 12px;
  text-align: center; font-size: 26px; font-weight: 800; letter-spacing: -.02em;
  background: rgba(0, 0, 0, .35); border: 1px solid var(--line-2); color: var(--text);
  font-variant-numeric: tabular-nums;
}
.entry-input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(234, 196, 129, .16); }
.entry-bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; }
.quick { display: flex; gap: 6px; flex-wrap: wrap; }
.qbtn {
  min-width: 38px; padding: 7px 9px; border-radius: 9px;
  font-size: 12.5px; font-weight: 600; color: var(--muted);
  background: rgba(0, 0, 0, .25); border: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
.qbtn:active { background: var(--gold-soft); color: var(--gold); border-color: rgba(234, 196, 129, .45); }
.entry-proj {
  font-size: 12.5px; font-weight: 700; color: var(--gold);
  font-variant-numeric: tabular-nums; padding-inline-start: 8px;
}
.entry-proj::before { content: ""; }

.menu-sheet { padding-bottom: calc(18px + var(--safe-b)); }
.menu-seg { margin: 14px 0 12px; }
.menu-item {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: 14px 14px; border-radius: var(--r-md); margin-bottom: 6px;
  background: var(--surface); border: 1px solid var(--line);
  font-size: 14.5px; text-align: start;
}
.menu-item:active { background: var(--surface-2); }
.menu-item.danger { color: #ffb4ab; border-color: rgba(242, 121, 109, .28); background: rgba(242, 121, 109, .07); }
.mi-icon { color: var(--muted-2); font-size: 13px; }
.menu-close { width: 100%; margin-top: 8px; }

/* ---------- celebration ---------- */
.celebrate { position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center; padding: 24px; overflow: hidden; background: radial-gradient(120% 90% at 50% 0%, #1a1509 0%, #08080b 62%); animation: fade .3s ease both; }
.celebrate-glow { position: absolute; top: -10%; left: 50%; transform: translateX(-50%); width: 460px; height: 460px; border-radius: 50%; background: radial-gradient(circle, rgba(234, 196, 129, .3), transparent 62%); filter: blur(18px); }
.falling { position: absolute; inset: 0; pointer-events: none; }
.fall-tile { position: absolute; top: -60px; color: rgba(246, 240, 227, .9); opacity: 0; animation-name: fall; animation-timing-function: cubic-bezier(.4,.1,.6,1); animation-iteration-count: 1; animation-fill-mode: forwards; }
.celebrate-body { position: relative; z-index: 2; width: 100%; max-width: 360px; text-align: center; animation: pop .5s cubic-bezier(.2,.9,.3,1.1) both; }
.celebrate-tile { display: flex; justify-content: center; margin-bottom: 14px; color: var(--ivory); filter: drop-shadow(0 0 30px rgba(234, 196, 129, .55)); }
.celebrate-kicker { font-size: 11.5px; letter-spacing: .2em; text-transform: uppercase; color: var(--gold); }
.celebrate-name { font-size: clamp(30px, 9vw, 40px); margin: 8px 0 6px; font-weight: 800; letter-spacing: -.02em; }
.celebrate-meta { margin: 0 0 20px; font-size: 13px; color: var(--muted); }
.final-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.final-row { display: flex; justify-content: space-between; padding: 11px 14px; border-radius: 12px; background: rgba(255, 255, 255, .05); border: 1px solid var(--line); font-size: 14px; }
.final-row b { color: var(--gold); font-variant-numeric: tabular-nums; }
.celebrate-note { font-size: 11.5px; color: var(--muted-2); margin: 0 0 16px; }
.celebrate-actions { display: flex; flex-direction: column; gap: 8px; }

/* ---------- stats ---------- */
.stat-grid { display: flex; gap: 10px; margin-bottom: 14px; }
.stat-card { flex: 1; padding: 16px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.stat-value { font-size: 28px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat-label { font-size: 11.5px; color: var(--muted); }
.stat-table { display: flex; flex-direction: column; gap: 2px; }
.stat-row { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center; padding: 9px 0; border-bottom: 1px solid rgba(255, 255, 255, .05); font-size: 13.5px; }
.stat-row:last-child { border-bottom: 0; }
.sr-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-wins { color: var(--muted); font-size: 12px; }
.sr-rate { color: var(--gold); font-weight: 700; font-variant-numeric: tabular-nums; min-width: 40px; text-align: end; }
.result-list { display: flex; flex-direction: column; gap: 8px; }
.result-row { padding: 11px 12px; border-radius: var(--r-md); background: rgba(0, 0, 0, .22); border: 1px solid var(--line); }
.result-main { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.result-main b { font-size: 13.5px; }
.result-main span { font-size: 10.5px; color: var(--muted-2); white-space: nowrap; }
.result-scores { font-size: 11.5px; color: var(--muted); margin-top: 4px; font-variant-numeric: tabular-nums; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(104px + var(--safe-b)); z-index: 65;
  padding: 10px 16px; border-radius: 999px;
  background: #1d1d25; border: 1px solid var(--line-2);
  font-size: 13px; box-shadow: 0 16px 34px -20px #000;
  animation: toastIn .26s cubic-bezier(.2,.8,.3,1) both;
  max-width: 86vw; text-align: center;
}

/* ---------- animations ---------- */
@keyframes screenIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes pop { from { opacity: 0; transform: scale(.92) translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-9px) rotate(2deg); } }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 3px rgba(102, 217, 168, .16); } 50% { box-shadow: 0 0 0 6px rgba(102, 217, 168, .04); } }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes fall {
  0% { opacity: 0; transform: translateY(0) rotate(0deg); }
  10% { opacity: 1; }
  100% { opacity: .9; transform: translateY(112vh) rotate(var(--rot)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

@media (min-width: 520px) {
  .app { padding-bottom: 30px; }
  .score-total { font-size: 38px; }
}
