:root {
  color-scheme: dark;
  --ink: #fffaf2;
  --muted: #d9c7d2;
  --bg: #1a0924;
  --panel: #35123d;
  --panel-2: #491541;
  --pink: #ff4f78;
  --orange: #ff8b3d;
  --yellow: #ffe15d;
  --mint: #7af5ca;
  --blue: #7dc8ff;
  --line: rgba(255,255,255,.14);
  --shadow: 0 24px 70px rgba(11,2,20,.46);
  font-family: ui-rounded, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { min-width: 320px; min-height: 100%; margin: 0; background: #100416; }
body { color: var(--ink); overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }
button, input { font: inherit; }
button { touch-action: manipulation; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }
[hidden] { display: none !important; }

.app-shell {
  position: relative; width: 100%; min-height: 100dvh; overflow: hidden;
  background:
    radial-gradient(circle at 95% 3%, rgba(255,125,53,.29), transparent 30%),
    radial-gradient(circle at 3% 83%, rgba(255,63,115,.22), transparent 33%),
    linear-gradient(150deg, #2f0d3d 0%, #1b0828 52%, #28091d 100%);
}
.screen { display: none; min-height: 100dvh; padding: max(17px, env(safe-area-inset-top)) 16px max(19px, env(safe-area-inset-bottom)); }
.screen--active { display: flex; flex-direction: column; animation: screen-in .22s ease-out both; }
@keyframes screen-in { from { opacity: 0; transform: translateY(6px); } }

.home { position: relative; justify-content: center; align-items: center; padding-inline: 22px; text-align: center; }
.confetti { position: absolute; width: 190px; height: 190px; border-radius: 50%; pointer-events: none; opacity: .45; }
.confetti::before, .confetti::after { content: ""; position: absolute; width: 12px; height: 42px; border-radius: 8px; background: var(--yellow); transform: rotate(38deg); }
.confetti::before { top: 12px; left: 34px; box-shadow: 92px 36px 0 var(--mint), 125px 116px 0 var(--pink), 22px 141px 0 var(--orange); }
.confetti::after { top: 70px; left: 0; height: 13px; background: var(--blue); box-shadow: 152px -51px 0 var(--pink), 176px 59px 0 var(--yellow); }
.confetti--one { top: -48px; right: -58px; transform: rotate(11deg); }
.confetti--two { bottom: -75px; left: -69px; transform: rotate(195deg); }
.brand-mark { position: relative; display: grid; place-items: center; width: 96px; height: 96px; margin-bottom: 19px; border: 2px solid rgba(255,255,255,.3); border-radius: 30px; background: linear-gradient(145deg, var(--orange), var(--pink)); box-shadow: 0 18px 45px rgba(255,58,111,.29), inset 0 1px rgba(255,255,255,.5); transform: rotate(-7deg); }
.brand-mark::before { content: ""; position: absolute; inset: 7px; border: 1px solid rgba(255,255,255,.23); border-radius: 23px; }
.brand-mark span { position: relative; font-size: 3.8rem; font-weight: 950; line-height: 1; letter-spacing: -.1em; }
.brand-mark i { position: absolute; top: -13px; right: -11px; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; color: #29101e; background: var(--yellow); font: 950 1.5rem/1 system-ui; box-shadow: 0 7px 18px rgba(0,0,0,.25); }
.eyebrow { margin: 0; color: #ffc1d0; font-size: .67rem; font-weight: 900; letter-spacing: .17em; text-transform: uppercase; }
.home h1 { margin: 7px 0 10px; font-size: clamp(3.5rem, 17vw, 6.4rem); font-weight: 950; line-height: .79; letter-spacing: -.085em; }
.home h1 em { color: var(--yellow); font-style: normal; }
.lead { max-width: 435px; margin: 0; color: var(--muted); font-size: .92rem; line-height: 1.52; }
.home-actions { display: grid; width: min(100%, 430px); gap: 8px; margin-top: 24px; }
.feature-pills { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 18px; }
.feature-pills span { padding: 6px 9px; border: 1px solid var(--line); border-radius: 999px; color: #c3aebe; background: rgba(255,255,255,.035); font-size: .59rem; font-weight: 800; }

.btn { min-height: 49px; border: 0; border-radius: 17px; padding: 0 17px; color: var(--ink); font-weight: 900; cursor: pointer; transition: transform .12s ease, opacity .12s ease, background .12s ease; }
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .42; cursor: not-allowed; }
.btn--xl { min-height: 59px; }
.btn--primary { color: #2d111e; background: linear-gradient(135deg, var(--yellow), #ffad4e); box-shadow: 0 13px 32px rgba(255,185,61,.17); }
.btn--glass { border: 1px solid var(--line); background: rgba(255,255,255,.07); }
.btn--outline { width: 100%; border: 1px dashed rgba(255,191,211,.42); color: #ffc1d0; background: rgba(255,77,120,.065); }
.text-button { min-height: 42px; border: 0; padding: 8px 10px; color: #ffc1d0; background: transparent; font-size: .76rem; font-weight: 800; cursor: pointer; }
.text-button--danger { color: #ff9aad; }
.text-button--skip { margin-top: 3px; color: #c8afc4; text-decoration: underline; text-decoration-color: rgba(255,255,255,.18); text-underline-offset: 4px; }

.topbar, .game-header { display: grid; grid-template-columns: 46px minmax(0,1fr) 46px; align-items: center; gap: 9px; flex: 0 0 auto; }
.topbar h2 { margin: 3px 0 0; font-size: 1.22rem; font-weight: 950; line-height: 1.08; letter-spacing: -.04em; }
.icon-button { display: grid; place-items: center; width: 43px; height: 43px; border: 1px solid var(--line); border-radius: 15px; color: var(--ink); background: rgba(255,255,255,.06); font-size: 1.45rem; font-weight: 900; cursor: pointer; }
.icon-button--dots { font-size: .86rem; letter-spacing: .06em; }
.icon-button--ghost { opacity: 0; pointer-events: none; }
.scroll-content { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 20px 0 114px; scrollbar-width: thin; }
.player-fields { display: grid; gap: 8px; }
.player-field { display: grid; grid-template-columns: 36px minmax(0,1fr) 36px; gap: 9px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.05); }
.player-number { display: grid; place-items: center; width: 33px; height: 33px; border-radius: 11px; color: #36111d; background: var(--yellow); font-weight: 950; }
.player-field input { width: 100%; min-width: 0; height: 42px; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 1rem; font-weight: 800; }
.player-field input::placeholder { color: #9a7f95; font-weight: 600; }
.remove-player { width: 34px; height: 34px; border: 0; border-radius: 11px; color: #c6adbf; background: transparent; font-size: 1.3rem; cursor: pointer; }
.remove-player:disabled { opacity: .2; }
.player-fields + .btn { margin-top: 9px; }
.settings-card { margin: 17px 0 0; padding: 14px; border: 1px solid var(--line); border-radius: 21px; background: rgba(255,255,255,.04); }
.settings-card legend { padding: 0 6px; color: #ffc1d0; font-size: .7rem; font-weight: 900; letter-spacing: .13em; text-transform: uppercase; }
.setting-help { margin: -2px 0 11px; color: #bba4b6; font-size: .69rem; line-height: 1.4; }
.segments { display: grid; grid-template-columns: repeat(3,1fr); gap: 5px; padding: 4px; border-radius: 14px; background: rgba(0,0,0,.22); }
.segments button { min-height: 40px; border: 0; border-radius: 11px; color: #c2abbc; background: transparent; font-size: .68rem; font-weight: 900; cursor: pointer; }
.segments button.is-active { color: #32101c; background: var(--yellow); }
.category-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.category-grid button { display: flex; align-items: center; gap: 8px; min-height: 48px; border: 1px solid var(--line); border-radius: 14px; padding: 0 11px; color: var(--muted); background: rgba(0,0,0,.13); font-size: .73rem; font-weight: 850; cursor: pointer; }
.category-grid button span { font-size: 1.15rem; }
.category-grid button[aria-pressed="true"] { border-color: rgba(255,225,93,.65); color: #2b101c; background: var(--yellow); }
.sticky-footer { position: absolute; z-index: 4; right: 0; bottom: 0; left: 0; padding: 15px 16px max(15px, env(safe-area-inset-bottom)); background: linear-gradient(transparent, #1c0829 29%); }
.sticky-footer .btn { width: 100%; }
.form-error { min-height: 17px; margin: 0 0 3px; color: #ff9fb1; text-align: center; font-size: .69rem; }

.game-screen { background: radial-gradient(circle at 50% 4%, rgba(255,88,111,.18), transparent 32%); }
.round-pill { justify-self: center; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; color: #ffd1dc; background: rgba(255,255,255,.05); font-size: .65rem; font-weight: 900; letter-spacing: .12em; }
.card-stage { display: flex; flex-direction: column; justify-content: center; flex: 1 1 auto; width: min(100%, 535px); margin: auto; padding: 14px 0 7px; }
.active-rule-strip { max-height: 82px; overflow-y: auto; margin-bottom: 8px; padding: 9px 11px; border: 1px solid rgba(122,245,202,.28); border-radius: 13px; color: #c9f8e8; background: rgba(71,180,143,.1); font-size: .63rem; line-height: 1.4; }
.active-rule-strip b { color: var(--mint); }
.rumoer-card { position: relative; padding: 23px 19px 20px; border: 1px solid rgba(255,255,255,.18); border-radius: 27px; overflow: hidden; background: linear-gradient(148deg, #5c194c, #35123d 60%, #28102f); box-shadow: var(--shadow); }
.rumoer-card::before { content: ""; position: absolute; top: -85px; right: -70px; width: 190px; height: 190px; border-radius: 50%; background: rgba(255,225,93,.09); }
.rumoer-card[data-kind="vote"] { background: linear-gradient(148deg, #173f5b, #1b2948 60%, #141b32); }
.rumoer-card[data-kind="duel"] { background: linear-gradient(148deg, #5a211e, #391617 60%, #271011); }
.rumoer-card[data-kind="quick"] { background: linear-gradient(148deg, #5c4410, #3e2a0b 60%, #241907); }
.rumoer-card[data-kind="chain"] { background: linear-gradient(148deg, #174b42, #15382f 60%, #0d2721); }
.rumoer-card[data-kind="group"] { background: linear-gradient(148deg, #3e2565, #2b1b4a 60%, #201436); }
.card-topline { position: relative; display: flex; align-items: center; gap: 9px; }
.card-emoji { display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid rgba(255,255,255,.14); border-radius: 14px; background: rgba(255,255,255,.09); font-size: 1.35rem; }
.card-label { color: #ffe1e9; font-size: .65rem; font-weight: 950; letter-spacing: .14em; }
.turn-cue { position: relative; margin: 23px 0 5px; color: #d6bdce; font-size: .68rem; font-weight: 750; }
.rumoer-card h2 { position: relative; margin: 0; font-size: clamp(1.65rem, 8vw, 2.5rem); font-weight: 950; line-height: 1.03; letter-spacing: -.055em; }
.card-copy { position: relative; margin: 15px 0 0; color: #fff9fb; font-size: clamp(.98rem, 4.5vw, 1.15rem); font-weight: 750; line-height: 1.46; }
.card-note { position: relative; margin: 13px 0 18px; padding: 11px 12px; border-radius: 14px; color: #e6d2de; background: rgba(0,0,0,.2); font-size: .72rem; line-height: 1.45; }
.resolve-area { position: relative; display: grid; gap: 8px; }
.resolve-area .btn { width: 100%; }
.binary-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.binary-actions .btn { min-height: 57px; }
.btn--success { color: #10291f; background: var(--mint); }
.btn--fail { color: #39131a; background: #ff91a7; }
.player-pick { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; max-height: 31dvh; overflow-y: auto; }
.player-pick button { display: grid; grid-template-columns: 30px minmax(0,1fr); align-items: center; gap: 7px; min-height: 48px; border: 1px solid var(--line); border-radius: 14px; padding: 6px 9px; color: var(--ink); background: rgba(255,255,255,.07); text-align: left; font-size: .72rem; font-weight: 850; cursor: pointer; }
.player-pick button span:first-child { font-size: 1.15rem; }
.player-pick button span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.result-wrap { display: grid; place-items: center; align-content: center; flex: 1 1 auto; width: min(100%, 500px); margin: auto; text-align: center; }
.result-burst { display: grid; place-items: center; width: 92px; height: 92px; margin-bottom: 20px; border-radius: 31px; color: #35101b; background: linear-gradient(145deg, var(--yellow), var(--orange)); box-shadow: 0 17px 45px rgba(255,144,50,.23); font-size: 3rem; transform: rotate(7deg); }
.result-wrap h2 { margin: 7px 0; font-size: clamp(2rem, 10vw, 3rem); font-weight: 950; line-height: 1; letter-spacing: -.06em; }
.result-wrap > p:not(.eyebrow) { max-width: 390px; margin: 5px 0 24px; color: var(--muted); font-size: .86rem; line-height: 1.5; }
.result-actions { display: grid; width: min(100%, 430px); gap: 8px; }

.score-list, .history-list { display: grid; gap: 8px; }
.score-row { display: grid; grid-template-columns: 25px 42px minmax(0,1fr) auto; gap: 9px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 17px; background: rgba(255,255,255,.045); }
.score-row:first-child { border-color: rgba(255,225,93,.43); background: rgba(255,225,93,.075); }
.score-rank { color: #bba5b6; text-align: center; font-size: .72rem; font-weight: 900; }
.score-avatar { display: grid; place-items: center; width: 39px; height: 39px; border-radius: 13px; background: rgba(255,255,255,.08); font-size: 1.25rem; }
.score-copy { min-width: 0; }
.score-copy strong, .score-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score-copy strong { font-size: .83rem; }
.score-copy span { margin-top: 3px; color: #bba6b6; font-size: .58rem; }
.score-value { color: var(--yellow); font-size: 1.2rem; font-weight: 950; }
.stat-totals { display: grid; grid-template-columns: repeat(3,1fr); margin: 14px 0; padding: 14px 6px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.03); text-align: center; }
.stat-totals div + div { border-left: 1px solid var(--line); }
.stat-totals strong, .stat-totals span { display: block; }
.stat-totals strong { font-size: 1.25rem; }
.stat-totals span { margin-top: 3px; color: #bba5b6; font-size: .58rem; }
.scroll-content > .btn { width: 100%; }
.history-row { display: grid; grid-template-columns: 43px minmax(0,1fr); gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 17px; background: rgba(255,255,255,.04); }
.history-number { display: grid; place-items: center; align-self: start; width: 40px; height: 40px; border-radius: 13px; color: #35101b; background: var(--yellow); font-size: .71rem; font-weight: 950; }
.history-copy { min-width: 0; }
.history-copy b, .history-copy span, .history-copy small { display: block; }
.history-copy b { font-size: .77rem; }
.history-copy span { margin-top: 4px; color: #e8d7e2; font-size: .7rem; line-height: 1.35; }
.history-copy small { margin-top: 6px; color: #ad94a8; font-size: .59rem; }
.empty-state { padding: 28px 18px; border: 1px dashed var(--line); border-radius: 19px; color: #bba5b6; text-align: center; font-size: .76rem; line-height: 1.5; }

.dialog { width: 100%; max-width: none; height: 100%; max-height: none; margin: 0; padding: max(17px, env(safe-area-inset-top)) 16px max(17px, env(safe-area-inset-bottom)); border: 0; color: var(--ink); background: rgba(12,2,17,.78); backdrop-filter: blur(14px); }
.dialog[open] { display: grid; place-items: center; animation: fade .17s ease-out; }
@keyframes fade { from { opacity: 0; } }
.dialog::backdrop { background: transparent; }
.dialog-card { position: relative; display: grid; gap: 8px; width: min(100%, 445px); padding: 24px; border: 1px solid var(--line); border-radius: 26px; background: #35123d; box-shadow: var(--shadow); text-align: center; }
.dialog-card h2 { margin: 4px 0; font-size: 1.8rem; font-weight: 950; line-height: 1.05; letter-spacing: -.05em; }
.dialog-card > p:not(.eyebrow) { margin: 0 0 10px; color: var(--muted); font-size: .76rem; line-height: 1.48; }
.dialog-card--help { text-align: left; }
.dialog-card--help ol { display: grid; gap: 11px; margin: 10px 0 0; padding-left: 20px; color: var(--muted); font-size: .75rem; line-height: 1.48; }
.dialog-card--help li::marker { color: var(--yellow); font-weight: 950; }
.dialog-card--help b { color: var(--ink); }
.dialog-close { position: absolute; top: 12px; right: 12px; display: grid; place-items: center; width: 39px; height: 39px; border: 0; border-radius: 13px; color: var(--ink); background: rgba(255,255,255,.07); font-size: 1.35rem; cursor: pointer; }
.toast { position: fixed; z-index: 30; right: 16px; bottom: max(18px, env(safe-area-inset-bottom)); left: 16px; max-width: 450px; margin: auto; padding: 12px; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); background: #4a1744; box-shadow: var(--shadow); opacity: 0; transform: translateY(17px); pointer-events: none; transition: .2s ease; text-align: center; font-size: .72rem; }
.toast--visible { opacity: 1; transform: translateY(0); }

@media (max-width: 350px) {
  .screen { padding-inline: 13px; }
  .home { padding-inline: 18px; }
  .home h1 { font-size: 3.25rem; }
  .rumoer-card { padding: 19px 15px 17px; }
  .category-grid, .player-pick { gap: 5px; }
  .category-grid button { padding-inline: 8px; }
}
@media (max-height: 700px) {
  .brand-mark { width: 76px; height: 76px; margin-bottom: 12px; border-radius: 24px; }
  .brand-mark span { font-size: 3rem; }
  .brand-mark i { width: 31px; height: 31px; font-size: 1.2rem; }
  .home h1 { font-size: 3.5rem; }
  .home-actions { margin-top: 18px; }
  .feature-pills { margin-top: 12px; }
  .rumoer-card { padding-block: 18px; }
  .turn-cue { margin-top: 16px; }
  .card-copy { margin-top: 10px; }
  .card-note { margin: 10px 0 12px; }
}
@media (min-width: 720px) {
  body { display: grid; place-items: center; }
  .app-shell { width: 700px; min-height: min(940px,100dvh); max-height: 100dvh; border-inline: 1px solid rgba(255,255,255,.07); box-shadow: 0 0 90px rgba(0,0,0,.4); }
  .screen { min-height: min(940px,100dvh); padding-inline: 34px; }
  .sticky-footer { padding-inline: 34px; }
  .rumoer-card { padding: 31px 29px 27px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
