:root {
  color-scheme: dark;
  --ink: #f4fbfa;
  --muted: #9cb3b4;
  --bg: #071820;
  --panel: #0d2832;
  --panel-2: #123641;
  --line: rgba(255,255,255,.11);
  --mint: #71f4cb;
  --mint-dark: #173b35;
  --orange: #ff9f43;
  --coral: #ff6f6f;
  --blue: #67c7ff;
  --shadow: 0 24px 70px rgba(0,0,0,.4);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; background: #030c11; }
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(--orange); outline-offset: 3px; }
[hidden] { display: none !important; }

.app-shell {
  position: relative; width: 100%; min-height: 100dvh; overflow: hidden;
  background:
    radial-gradient(circle at 80% 0%, rgba(24,180,153,.18), transparent 32%),
    radial-gradient(circle at 0% 92%, rgba(255,155,59,.12), transparent 29%),
    linear-gradient(155deg, #0a222b, #06151c 56%, #0b1d24);
}
.screen { display: none; min-height: 100dvh; padding: max(18px, env(safe-area-inset-top)) 18px max(22px, env(safe-area-inset-bottom)); }
.screen--active { display: flex; flex-direction: column; animation: screen-in .24s ease-out both; }
@keyframes screen-in { from { opacity: 0; transform: translateY(7px); } }

.home { position: relative; justify-content: center; align-items: center; padding-inline: 24px; text-align: center; }
.home-glow { position: absolute; top: 4%; left: 50%; width: 350px; height: 350px; translate: -50% 0; border-radius: 50%; background: rgba(54,226,191,.12); filter: blur(75px); pointer-events: none; }
.deal-mark { position: relative; display: flex; align-items: center; justify-content: center; gap: 12px; width: 112px; height: 103px; margin-bottom: 23px; border: 1px solid rgba(255,255,255,.17); border-radius: 34px; background: linear-gradient(145deg, #20d0ac, #0a806f 65%, #075348); box-shadow: 0 22px 58px rgba(0,120,104,.4), inset 0 1px rgba(255,255,255,.35); transform: rotate(3deg); }
.deal-mark span { position: relative; z-index: 1; color: #05261f; font-size: 1.85rem; transform: rotate(45deg); }
.deal-mark i { position: absolute; bottom: 20px; width: 55px; height: 12px; border-bottom: 5px solid var(--orange); border-radius: 50%; }
.eyebrow { margin: 0; color: var(--mint); font-size: .68rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.home h1 { margin: 8px 0 10px; font: 800 clamp(3.3rem, 17.5vw, 5.8rem)/.91 Manrope, sans-serif; letter-spacing: -.085em; }
.home h1 span { display: block; color: var(--orange); }
.lead { max-width: 430px; margin: 0; color: var(--muted); font-size: .97rem; line-height: 1.55; }
.deal-demo { display: flex; align-items: center; justify-content: center; margin: 25px 0 22px; }
.deal-demo span { min-width: 87px; padding: 11px; border-radius: 15px; font-size: .66rem; font-weight: 800; letter-spacing: .1em; box-shadow: 0 10px 28px rgba(0,0,0,.25); }
.deal-demo__yes { color: #08261f; background: var(--mint); transform: rotate(-7deg) translateX(7px); }
.deal-demo__no { color: #351313; background: var(--coral); transform: rotate(7deg) translateX(-7px); }
.deal-demo b { position: relative; z-index: 2; display: grid; place-items: center; width: 45px; height: 45px; border-radius: 50%; color: #25180a; background: var(--orange); box-shadow: 0 8px 22px rgba(0,0,0,.28); font-size: 1.3rem; }
.home-actions { display: grid; width: min(100%, 430px); gap: 9px; }
.feature-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; margin-top: 23px; }
.feature-row span { padding: 7px 9px; border: 1px solid var(--line); border-radius: 999px; color: #769496; font-size: .61rem; font-weight: 700; }

.btn { min-height: 50px; border: 0; border-radius: 17px; padding: 0 18px; color: var(--ink); font-weight: 800; cursor: pointer; transition: transform .12s, opacity .12s; }
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .42; cursor: not-allowed; }
.btn--xl { min-height: 59px; }
.btn--primary { color: #08271f; background: linear-gradient(135deg, var(--mint), #b1ffd6); box-shadow: 0 12px 30px rgba(74,235,196,.13); }
.btn--soft { border: 1px solid var(--line); background: rgba(255,255,255,.055); }
.btn--outline { width: 100%; border: 1px dashed rgba(113,244,203,.35); background: rgba(113,244,203,.055); color: var(--mint); }
.text-button { border: 0; padding: 11px; color: var(--mint); background: transparent; font-size: .78rem; font-weight: 700; cursor: pointer; }
.text-button--danger { color: #ff9292; }

.topbar, .game-header { display: grid; grid-template-columns: 48px minmax(0,1fr) 48px; align-items: center; gap: 10px; flex: 0 0 auto; }
.topbar h2 { margin: 3px 0 0; font: 800 1.25rem/1.1 Manrope, sans-serif; letter-spacing: -.035em; }
.icon-button { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 15px; color: var(--ink); background: rgba(255,255,255,.045); font-size: 1.45rem; font-weight: 700; cursor: pointer; }
.icon-button--small { font-size: 1rem; }
.icon-button--empty { opacity: 0; pointer-events: none; }
.scroll-content { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 22px 0 118px; scrollbar-width: thin; }
.intro-card { display: grid; gap: 6px; margin-bottom: 16px; padding: 17px; border: 1px solid rgba(113,244,203,.2); border-radius: 20px; background: linear-gradient(145deg, rgba(113,244,203,.1), rgba(255,255,255,.03)); }
.intro-card strong { font-size: .9rem; }
.intro-card span { color: var(--muted); font-size: .73rem; line-height: 1.45; }
.player-fields { display: grid; gap: 9px; }
.player-field { display: grid; grid-template-columns: 38px minmax(0,1fr) 38px; gap: 10px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.04); }
.player-number { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 12px; color: #09241d; background: var(--mint); font-weight: 800; }
.player-field input { width: 100%; min-width: 0; height: 43px; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 1rem; font-weight: 700; }
.player-field input::placeholder { color: #5e7a7c; font-weight: 500; }
.remove-player { width: 35px; height: 35px; border: 0; border-radius: 11px; color: #8ca7a8; background: transparent; font-size: 1.35rem; cursor: pointer; }
.remove-player:disabled { opacity: .2; }
.player-fields + .btn { margin-top: 10px; }
.settings-card { margin: 20px 0 0; padding: 15px; border: 1px solid var(--line); border-radius: 22px; background: rgba(255,255,255,.035); }
.settings-card legend { padding: 0 4px; color: var(--mint); font-size: .68rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.settings-card > p { margin: 11px 2px 0; color: var(--muted); font-size: .66rem; line-height: 1.4; }
.segments { display: grid; grid-template-columns: repeat(4,1fr); gap: 5px; padding: 4px; border-radius: 14px; background: rgba(0,0,0,.2); }
.segments button { min-height: 39px; border: 0; border-radius: 11px; color: var(--muted); background: transparent; font-size: .67rem; font-weight: 800; cursor: pointer; }
.segments button.is-active { color: #09241d; background: var(--mint); }
.sticky-footer { position: absolute; z-index: 4; right: 0; bottom: 0; left: 0; padding: 16px 18px max(16px, env(safe-area-inset-bottom)); background: linear-gradient(transparent, #071820 27%); }
.sticky-footer .btn { width: 100%; }
.form-error { min-height: 18px; margin: 0 0 4px; color: #ff9797; text-align: center; font-size: .72rem; }

.game-screen { background: radial-gradient(circle at 50% -5%, rgba(62,220,190,.12), transparent 34%); }
.round-pill, .agenda-progress { justify-self: center; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--mint); background: rgba(255,255,255,.04); font-size: .66rem; font-weight: 800; letter-spacing: .1em; }
.agenda-progress { justify-self: end; letter-spacing: .02em; }
.center-content { display: grid; place-items: center; flex: 1 1 auto; padding: 20px 0 12px; }
.privacy-card, .agenda-card, .vote-card { width: min(100%, 500px); padding: 24px 20px; border: 1px solid var(--line); border-radius: 27px; text-align: center; background: linear-gradient(145deg, rgba(255,255,255,.075), rgba(255,255,255,.035)); box-shadow: var(--shadow); }
.privacy-card h2, .agenda-card h2, .vote-card h2 { margin: 9px 0 9px; font: 800 clamp(1.55rem, 7vw, 2.2rem)/1.09 Manrope, sans-serif; letter-spacing: -.05em; }
.privacy-card p:not(.eyebrow), .agenda-card > p:not(.eyebrow), .vote-card > p:not(.eyebrow) { margin: 0 auto 23px; max-width: 390px; color: var(--muted); font-size: .78rem; line-height: 1.5; }
.privacy-card .btn, .agenda-card .btn { width: 100%; }
.avatar { display: grid; place-items: center; width: 48px; height: 48px; border: 1px solid var(--line); border-radius: 17px; background: rgba(255,255,255,.065); font-size: 1.5rem; }
.avatar--large { width: 82px; height: 82px; margin: 0 auto 20px; border-radius: 27px; font-size: 2.5rem; box-shadow: 0 12px 35px rgba(0,0,0,.25); }
.agenda-seal { display: grid; place-items: center; width: 72px; height: 72px; margin: 18px auto; border: 2px solid var(--orange); border-radius: 50%; color: #2c1d0c; background: var(--orange); box-shadow: 0 12px 30px rgba(255,159,67,.18), inset 0 0 0 5px #0d2832; font-size: 1.55rem; transform: rotate(-7deg); }
.agenda-card h2 { font-size: clamp(1.45rem, 6.6vw, 2rem); }
.agenda-card > p b { color: var(--orange); }

.proposal-content { flex: 1 1 auto; min-height: 0; width: min(100%, 550px); margin: auto; padding: 14px 0 8px; overflow-y: auto; }
.deal-card { padding: 18px; border: 1px solid rgba(113,244,203,.18); border-radius: 22px; background: linear-gradient(145deg, rgba(113,244,203,.1), rgba(255,255,255,.035)); }
.deal-card h2 { margin: 7px 0; font: 800 clamp(1.45rem, 6vw, 2rem)/1.1 Manrope, sans-serif; letter-spacing: -.045em; }
.deal-card > p:last-of-type { margin: 0; color: var(--muted); font-size: .72rem; line-height: 1.45; }
.dealer-pill { display: inline-flex; align-items: center; gap: 7px; margin-top: 13px; padding: 7px 10px; border-radius: 12px; color: #c6d9d8; background: rgba(0,0,0,.18); font-size: .65rem; }
.dealer-pill span { font-size: 1rem; }
.proposal-status { display: grid; grid-template-columns: 1fr 1fr; margin: 11px 0; border: 1px solid var(--line); border-radius: 17px; background: rgba(255,255,255,.03); }
.proposal-status > div { padding: 11px 13px; }
.proposal-status > div + div { border-left: 1px solid var(--line); }
.proposal-status span, .proposal-status strong { display: block; }
.proposal-status span { color: var(--muted); font-size: .56rem; font-weight: 800; letter-spacing: .09em; }
.proposal-status strong { margin-top: 2px; color: var(--orange); font: 800 1.5rem Manrope, sans-serif; }
.proposal-status strong.is-done { color: var(--mint); }
.proposal-status .is-done strong { color: var(--coral); }
.allocation-list { display: grid; gap: 7px; }
.allocation-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 10px; align-items: center; padding: 7px 8px; border: 1px solid var(--line); border-radius: 17px; background: rgba(255,255,255,.035); }
.allocation-person { display: flex; align-items: center; min-width: 0; gap: 10px; }
.allocation-person strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .82rem; }
.allocation-person .avatar { flex: 0 0 auto; width: 39px; height: 39px; border-radius: 13px; font-size: 1.25rem; }
.stepper { display: grid; grid-template-columns: 39px 34px 39px; align-items: center; }
.stepper button { width: 39px; height: 39px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: rgba(255,255,255,.055); font-size: 1.2rem; cursor: pointer; }
.stepper button:disabled { opacity: .25; }
.stepper strong { text-align: center; font: 800 1.1rem Manrope, sans-serif; }
.proposal-note { margin: 10px 3px; color: #7f9b9c; font-size: .63rem; line-height: 1.4; }
.proposal-content > .btn { width: 100%; }

.vote-card > .eyebrow b { color: var(--orange); font-size: .9rem; }
.agenda-reminder { margin: 19px 0; padding: 14px; border: 1px solid rgba(255,159,67,.25); border-radius: 16px; text-align: left; background: rgba(255,159,67,.07); }
.agenda-reminder span, .agenda-reminder strong { display: block; }
.agenda-reminder span { color: var(--orange); font-size: .59rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.agenda-reminder strong { margin-top: 5px; font-size: .77rem; line-height: 1.4; }
.vote-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.vote-button { min-height: 105px; border: 0; border-radius: 21px; cursor: pointer; }
.vote-button b, .vote-button span { display: block; }
.vote-button b { font-size: 2.1rem; }
.vote-button span { margin-top: 4px; font-size: .85rem; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; }
.vote-button--yes { color: #09261f; background: var(--mint); }
.vote-button--no { color: #321010; background: var(--coral); }
.privacy-note { margin: 12px 0 0 !important; font-size: .62rem !important; }

.result-content { display: flex; flex-direction: column; justify-content: center; flex: 1 1 auto; width: min(100%, 530px); margin: auto; padding: 18px 0 8px; text-align: center; }
.result-stamp { align-self: center; margin-bottom: 14px; padding: 11px 17px; border-radius: 14px; font: 800 1rem Manrope, sans-serif; letter-spacing: .12em; transform: rotate(-3deg); }
.result-stamp--yes { color: #09261f; background: var(--mint); }
.result-stamp--no { color: #311010; background: var(--coral); }
.result-content h2 { margin: 0; font: 800 clamp(1.7rem, 7.5vw, 2.4rem)/1.08 Manrope, sans-serif; letter-spacing: -.05em; }
.result-content > p { margin: 10px auto 14px; max-width: 430px; color: var(--muted); font-size: .76rem; line-height: 1.45; }
.vote-meter { height: 11px; overflow: hidden; border-radius: 999px; background: var(--coral); }
.vote-meter span { display: block; width: 50%; height: 100%; background: var(--mint); transition: width .7s ease-out; }
.vote-counts { display: flex; justify-content: space-between; margin: 6px 2px 13px; color: var(--muted); font-size: .65rem; }
.vote-counts span:first-child b { color: var(--mint); }
.vote-counts span:last-child b { color: var(--coral); }
.result-list { display: grid; gap: 6px; max-height: 36dvh; margin-bottom: 14px; overflow-y: auto; }
.result-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 9px; align-items: center; padding: 10px 11px; border: 1px solid var(--line); border-radius: 15px; text-align: left; background: rgba(255,255,255,.035); }
.result-row div { min-width: 0; }
.result-row strong, .result-row span { display: block; }
.result-row strong { font-size: .75rem; }
.result-row span { margin-top: 3px; overflow: hidden; color: var(--muted); font-size: .58rem; text-overflow: ellipsis; white-space: nowrap; }
.result-row > b { color: var(--orange); font: 800 1.2rem Manrope, sans-serif; }
.result-row--bonus { border-color: rgba(113,244,203,.26); background: rgba(113,244,203,.055); }
.result-row--bonus > b { color: var(--mint); }
.result-actions { display: grid; gap: 8px; }

.score-list { display: grid; gap: 9px; }
.score-row { display: grid; grid-template-columns: 28px 48px minmax(0,1fr) auto; gap: 10px; align-items: center; padding: 11px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.04); }
.score-row:first-child { border-color: rgba(255,159,67,.34); background: rgba(255,159,67,.055); }
.score-rank { color: var(--muted); text-align: center; font-weight: 800; }
.score-row div { min-width: 0; }
.score-row div strong, .score-row div span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score-row div strong { font-size: .86rem; }
.score-row div span { margin-top: 3px; color: var(--muted); font-size: .62rem; }
.score-row > b { color: var(--orange); font: 800 1.5rem Manrope, sans-serif; }
.stats-card { display: grid; grid-template-columns: repeat(3,1fr); margin-top: 16px; padding: 16px; border: 1px solid var(--line); border-radius: 20px; background: rgba(255,255,255,.025); text-align: center; }
.stats-card div + div { border-left: 1px solid var(--line); }
.stats-card strong, .stats-card span { display: block; }
.stats-card strong { font: 800 1.35rem Manrope, sans-serif; }
.stats-card span { margin-top: 3px; color: var(--muted); font-size: .61rem; }

.dialog { width: 100%; max-width: none; height: 100%; max-height: none; margin: 0; padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom)); border: 0; color: var(--ink); background: rgba(2,9,12,.78); backdrop-filter: blur(14px); }
.dialog[open] { display: grid; place-items: center; animation: fade-in .18s ease-out; }
@keyframes fade-in { from { opacity: 0; } }
.dialog::backdrop { background: transparent; }
.dialog-card { position: relative; display: grid; gap: 9px; width: min(100%, 450px); padding: 25px; border: 1px solid var(--line); border-radius: 27px; background: #0d2832; box-shadow: var(--shadow); text-align: center; }
.dialog-card h2 { margin: 3px 0; font: 800 1.85rem Manrope, sans-serif; letter-spacing: -.05em; }
.dialog-card > p:not(.eyebrow):not(.safe-note) { margin: 0 0 10px; color: var(--muted); font-size: .77rem; line-height: 1.5; }
.dialog-close { position: absolute; top: 13px; right: 13px; width: 40px; height: 40px; border: 0; border-radius: 13px; color: var(--ink); background: rgba(255,255,255,.06); font-size: 1.4rem; cursor: pointer; }
.dialog-card--help { text-align: left; }
.dialog-card--help ol { display: grid; gap: 12px; margin: 11px 0; padding-left: 20px; color: var(--muted); font-size: .76rem; line-height: 1.48; }
.dialog-card--help li::marker { color: var(--orange); font-weight: 800; }
.dialog-card--help b { color: var(--ink); }
.safe-note { margin: 4px 0 0; padding: 12px; border-radius: 14px; color: #bdebd9; background: rgba(113,244,203,.08); font-size: .71rem; line-height: 1.45; }
.toast { position: fixed; z-index: 20; right: 18px; bottom: max(20px, env(safe-area-inset-bottom)); left: 18px; max-width: 460px; margin: auto; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); background: #123641; box-shadow: var(--shadow); opacity: 0; transform: translateY(18px); pointer-events: none; transition: .2s ease; text-align: center; font-size: .73rem; }
.toast--visible { opacity: 1; transform: translateY(0); }

@media (max-height: 720px) {
  .deal-mark { width: 84px; height: 78px; margin-bottom: 14px; border-radius: 27px; }
  .deal-mark span { font-size: 1.4rem; }
  .deal-mark i { bottom: 15px; width: 43px; }
  .home h1 { font-size: 3.25rem; }
  .deal-demo { margin: 17px 0 15px; }
  .privacy-card, .agenda-card, .vote-card { padding-block: 18px; }
  .avatar--large { width: 65px; height: 65px; margin-bottom: 14px; border-radius: 22px; font-size: 2rem; }
  .agenda-seal { width: 56px; height: 56px; margin-block: 12px; }
  .deal-card { padding: 14px; }
  .allocation-row { padding-block: 5px; }
}

@media (min-width: 700px) {
  body { display: grid; place-items: center; }
  .app-shell { width: 680px; min-height: min(930px, 100dvh); max-height: 100dvh; border-inline: 1px solid rgba(255,255,255,.06); box-shadow: 0 0 80px rgba(0,0,0,.35); }
  .screen { min-height: min(930px, 100dvh); }
}

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