:root {
  --bg: #05080d;
  --bg-soft: #090e16;
  --panel: rgba(12, 19, 30, 0.93);
  --panel-strong: #0e1723;
  --line: rgba(255, 255, 255, 0.10);
  --text: #f6f8fb;
  --muted: #a8b3c2;
  --muted-2: #718096;
  --blue: #138cff;
  --blue-strong: #0075ff;
  --blue-soft: rgba(19, 140, 255, 0.16);
  --red: #ff3d4f;
  --red-strong: #ff243c;
  --red-soft: rgba(255, 61, 79, 0.16);
  --success: #31d7a1;
  --danger: #ff6b78;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.48);
  --radius: 24px;
  --radius-sm: 16px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 14%, rgba(0, 116, 255, 0.18), transparent 34%),
    radial-gradient(circle at 88% 20%, rgba(255, 36, 60, 0.16), transparent 32%),
    linear-gradient(160deg, #05080d 0%, #080d15 48%, #05080d 100%);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.16;
  background-image:
    linear-gradient(30deg, rgba(255,255,255,.08) 12%, transparent 12.5%, transparent 87%, rgba(255,255,255,.08) 87.5%, rgba(255,255,255,.08)),
    linear-gradient(150deg, rgba(255,255,255,.08) 12%, transparent 12.5%, transparent 87%, rgba(255,255,255,.08) 87.5%, rgba(255,255,255,.08)),
    linear-gradient(30deg, rgba(255,255,255,.08) 12%, transparent 12.5%, transparent 87%, rgba(255,255,255,.08) 87.5%, rgba(255,255,255,.08)),
    linear-gradient(150deg, rgba(255,255,255,.08) 12%, transparent 12.5%, transparent 87%, rgba(255,255,255,.08) 87.5%, rgba(255,255,255,.08)),
    linear-gradient(60deg, rgba(255,255,255,.055) 25%, transparent 25.5%, transparent 75%, rgba(255,255,255,.055) 75%, rgba(255,255,255,.055));
  background-size: 34px 60px;
  background-position: 0 0, 0 0, 17px 30px, 17px 30px, 0 0;
  mask-image: linear-gradient(to bottom, #000 0%, transparent 80%);
}

button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, a:focus-visible {
  outline: 3px solid rgba(255,255,255,.9);
  outline-offset: 3px;
}
a { color: inherit; }

.ambient {
  position: fixed;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  filter: blur(85px);
  opacity: .18;
  pointer-events: none;
  z-index: -1;
}
.ambient-blue { left: -130px; bottom: 12%; background: var(--blue); }
.ambient-red { right: -140px; top: 18%; background: var(--red); }

.app-shell {
  width: min(100%, 620px);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: calc(18px + var(--safe-top)) 18px calc(18px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
}

.screen {
  min-height: calc(100vh - 36px - var(--safe-top) - var(--safe-bottom));
  min-height: calc(100dvh - 36px - var(--safe-top) - var(--safe-bottom));
  display: flex;
  flex-direction: column;
  animation: screen-in .22s ease both;
}
@keyframes screen-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.topbar {
  min-height: 52px;
  display: grid;
  grid-template-columns: 52px 1fr 52px;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
}
.topbar-title {
  text-align: center;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .13em;
  color: var(--muted);
  text-transform: uppercase;
}
.icon-button {
  width: 48px;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 15px;
  display: inline-grid;
  place-items: center;
  color: var(--text);
  background: rgba(10, 16, 25, .76);
  cursor: pointer;
}
.icon-button:hover { background: rgba(19, 28, 42, .9); }
.icon-button.ghost { border-color: transparent; background: transparent; }
.icon-button svg { width: 22px; height: 22px; }

.brand {
  margin: auto 0 10px;
  text-align: center;
}
.brand.compact { margin: 2px 0 12px; }
.brand-logo {
  display: block;
  width: min(92%, 390px);
  height: auto;
  margin: 0 auto;
  object-fit: contain;
  filter: drop-shadow(0 0 18px rgba(15, 126, 218, .18)) drop-shadow(0 0 18px rgba(232, 41, 117, .13));
}
.brand.compact .brand-logo { width: min(68vw, 232px); }
.brand-sub {
  margin-top: 8px;
  color: #f4f7fa;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .40em;
  text-transform: uppercase;
  padding-left: .40em;
}
.brand.compact .brand-sub { display: none; }

.hero-copy { text-align: center; margin: 12px auto 24px; max-width: 440px; }
.eyebrow {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .13em;
  color: var(--muted);
  text-transform: uppercase;
}
h1, h2, h3, p { margin-top: 0; }
h1 {
  margin-bottom: 12px;
  font-size: clamp(30px, 8vw, 46px);
  line-height: 1.03;
  letter-spacing: -.035em;
}
h2 {
  margin-bottom: 8px;
  font-size: clamp(25px, 7vw, 34px);
  line-height: 1.08;
  letter-spacing: -.025em;
}
.lead { color: var(--muted); font-size: 16px; line-height: 1.55; }
.small-note { color: var(--muted); font-size: 13px; line-height: 1.5; }

.content { flex: 1; display: flex; flex-direction: column; }
.content.centered { justify-content: center; }

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(17, 26, 39, .95), rgba(8, 13, 21, .96));
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.language-grid, .mode-grid, .action-grid { display: grid; gap: 14px; }
.language-grid { margin: 10px 0 20px; }
.language-button, .mode-card {
  width: 100%;
  min-height: 88px;
  border-radius: 20px;
  border: 1px solid var(--line);
  padding: 18px;
  display: grid;
  grid-template-columns: 52px 1fr 24px;
  gap: 14px;
  align-items: center;
  color: var(--text);
  background: rgba(12, 20, 31, .92);
  text-align: left;
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.language-button:hover, .mode-card:hover { transform: translateY(-2px); }
.language-button.blue, .mode-card.blue {
  border-color: rgba(19, 140, 255, .62);
  box-shadow: inset 0 0 28px rgba(19, 140, 255, .06), 0 0 24px rgba(19, 140, 255, .09);
}
.language-button.red, .mode-card.red {
  border-color: rgba(255, 61, 79, .58);
  box-shadow: inset 0 0 28px rgba(255, 61, 79, .06), 0 0 24px rgba(255, 61, 79, .08);
}
.card-icon {
  width: 52px;
  height: 52px;
  border-radius: 17px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--line);
}
.blue .card-icon { color: var(--blue); background: var(--blue-soft); border-color: rgba(19,140,255,.35); }
.red .card-icon { color: var(--red); background: var(--red-soft); border-color: rgba(255,61,79,.32); }
.card-icon svg { width: 27px; height: 27px; }
.card-title { display: block; font-size: 18px; font-weight: 800; }
.card-copy { display: block; margin-top: 3px; color: var(--muted); font-size: 13px; line-height: 1.4; }
.card-chevron { color: var(--muted-2); }
.card-chevron svg { width: 20px; }

.info-strip {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(7, 12, 19, .72);
  color: var(--muted);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  line-height: 1.5;
}
.info-strip svg { flex: 0 0 auto; width: 19px; height: 19px; color: #c9d2df; margin-top: 1px; }

.stepper-panel {
  padding: 28px 20px 22px;
  text-align: center;
}
.counter {
  margin: 18px auto 12px;
  display: grid;
  grid-template-columns: 64px minmax(130px, 1fr) 64px;
  gap: 14px;
  align-items: center;
  max-width: 380px;
}
.counter-button {
  width: 64px;
  height: 64px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--text);
  background: rgba(255,255,255,.045);
  font-size: 30px;
  cursor: pointer;
}
.counter-button.minus { color: #70b9ff; border-color: rgba(19, 140, 255, .38); }
.counter-button.plus { color: #ff7886; border-color: rgba(255, 61, 79, .38); }
.counter-box {
  min-height: 142px;
  display: grid;
  place-items: center;
  padding: 8px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.035);
}
.counter-input {
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  text-align: center;
  font-size: 72px;
  line-height: 1;
  font-weight: 900;
  -moz-appearance: textfield;
}
.counter-input::-webkit-inner-spin-button, .counter-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.counter-label { color: var(--muted); font-size: 13px; }
.balance-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: rgba(0,0,0,.18);
  font-size: 13px;
}
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.blue { background: var(--blue); box-shadow: 0 0 10px var(--blue); }
.dot.red { background: var(--red); box-shadow: 0 0 10px var(--red); }

.primary-button, .secondary-button, .danger-button {
  width: 100%;
  min-height: 58px;
  border-radius: 18px;
  border: 1px solid transparent;
  padding: 15px 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: white;
  font-weight: 850;
  font-size: 16px;
  cursor: pointer;
  text-decoration: none;
}
.primary-button {
  background: linear-gradient(100deg, #087df4 0%, #575ce9 48%, #f02f4b 100%);
  box-shadow: 0 12px 30px rgba(26, 103, 231, .22), 0 0 22px rgba(255, 61, 79, .09);
}
.primary-button:hover { filter: brightness(1.08); }
.primary-button:disabled { opacity: .42; cursor: not-allowed; filter: grayscale(.4); box-shadow: none; }
.secondary-button {
  border-color: var(--line);
  background: rgba(255,255,255,.045);
  color: var(--text);
}
.secondary-button.blue { border-color: rgba(19, 140, 255, .36); color: #bfe1ff; }
.secondary-button.red { border-color: rgba(255, 61, 79, .34); color: #ffc1c7; }
.danger-button { border-color: rgba(255,107,120,.32); background: rgba(255,107,120,.10); color: #ffc0c6; }
.primary-button svg, .secondary-button svg, .danger-button svg { width: 22px; height: 22px; }
.button-stack { display: grid; gap: 12px; margin-top: 20px; }
.push-bottom { margin-top: auto; }

.progress {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 2px 0 20px;
}
.progress span { height: 4px; border-radius: 999px; background: rgba(255,255,255,.11); }
.progress span.done-blue { background: var(--blue); box-shadow: 0 0 12px rgba(19,140,255,.7); }
.progress span.done-red { background: var(--red); box-shadow: 0 0 12px rgba(255,61,79,.65); }

.reveal-wrap { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.person-counter { text-align: center; color: var(--muted); font-size: 17px; margin-bottom: 20px; }
.person-counter strong { color: var(--text); font-size: 24px; }
.tap-card {
  width: min(100%, 390px);
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.14);
  background:
    radial-gradient(circle at 48% 46%, rgba(255,255,255,.08), transparent 32%),
    conic-gradient(from 220deg, rgba(19,140,255,.75), rgba(19,140,255,.06), rgba(255,61,79,.06), rgba(255,61,79,.75), rgba(19,140,255,.75));
  padding: 3px;
  box-shadow: 0 0 42px rgba(19,140,255,.15), 0 0 46px rgba(255,61,79,.12);
  cursor: pointer;
}
.tap-card-inner {
  width: 100%; height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, #172538 0%, #0c1420 54%, #070c13 100%);
  display: grid;
  place-content: center;
  gap: 14px;
  text-align: center;
  padding: 36px;
}
.tap-card svg { width: 72px; height: 72px; margin: auto; color: #fff; filter: drop-shadow(0 0 16px rgba(19,140,255,.55)); }
.tap-title { font-size: 23px; font-weight: 900; }
.tap-copy { color: var(--muted); line-height: 1.45; }

.team-reveal {
  width: min(100%, 420px);
  min-height: 360px;
  margin: 0 auto;
  border-radius: 30px;
  display: grid;
  place-content: center;
  gap: 14px;
  text-align: center;
  border: 1px solid;
  position: relative;
  overflow: hidden;
}
.team-reveal::before {
  content: "";
  position: absolute;
  inset: -30%;
  opacity: .42;
  background: repeating-conic-gradient(from 0deg, transparent 0 8deg, currentColor 8deg 9deg, transparent 9deg 18deg);
  mask-image: radial-gradient(circle, #000 0, transparent 68%);
  animation: spin 18s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.team-reveal.blue { color: var(--blue); border-color: rgba(19,140,255,.82); background: radial-gradient(circle at 50% 42%, rgba(19,140,255,.28), rgba(6,13,22,.98) 62%); box-shadow: 0 0 42px rgba(19,140,255,.28), inset 0 0 44px rgba(19,140,255,.12); }
.team-reveal.red { color: var(--red); border-color: rgba(255,61,79,.78); background: radial-gradient(circle at 50% 42%, rgba(255,61,79,.25), rgba(6,13,22,.98) 62%); box-shadow: 0 0 42px rgba(255,61,79,.25), inset 0 0 44px rgba(255,61,79,.10); }
.team-reveal > * { position: relative; z-index: 1; }
.team-reveal svg { width: 74px; height: 74px; margin: auto; }
.team-reveal-label { color: white; font-size: 22px; font-weight: 800; text-transform: uppercase; }
.team-reveal-name { font-family: Impact, "Arial Black", sans-serif; font-size: clamp(56px, 17vw, 88px); line-height: .95; letter-spacing: .02em; text-transform: uppercase; }

.summary-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 20px 0;
}
.summary-team {
  min-height: 150px;
  border-radius: 22px;
  display: grid;
  place-content: center;
  text-align: center;
  border: 1px solid;
}
.summary-team.blue { border-color: rgba(19,140,255,.48); background: var(--blue-soft); color: #8dccff; }
.summary-team.red { border-color: rgba(255,61,79,.46); background: var(--red-soft); color: #ff9aa5; }
.summary-number { font-size: 54px; line-height: 1; font-weight: 950; color: white; }
.summary-label { margin-top: 8px; font-size: 14px; font-weight: 800; text-transform: uppercase; }

.name-form {
  display: grid;
  grid-template-columns: 1fr 58px;
  gap: 10px;
  margin: 6px 0 12px;
}
.name-input {
  min-width: 0;
  height: 58px;
  border-radius: 17px;
  border: 1px solid var(--line);
  padding: 0 17px;
  color: var(--text);
  background: rgba(255,255,255,.05);
  font-size: 16px;
}
.add-button {
  width: 58px;
  height: 58px;
  border-radius: 17px;
  border: 1px solid rgba(19,140,255,.38);
  background: var(--blue-soft);
  color: #9bd1ff;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.add-button svg { width: 26px; height: 26px; }
.name-meta { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 12px; margin-bottom: 14px; }
.name-list { display: grid; gap: 9px; max-height: min(42vh, 420px); overflow: auto; padding: 2px 3px 2px 0; }
.name-row {
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255,255,255,.035);
  display: grid;
  grid-template-columns: 34px 1fr 46px;
  align-items: center;
  gap: 8px;
  padding-left: 10px;
}
.name-number { color: var(--muted-2); font-size: 12px; font-weight: 800; }
.name-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.remove-name {
  width: 42px; height: 42px; border: 0; background: transparent; color: #ff8792; cursor: pointer;
  display: grid; place-items: center;
}
.remove-name svg { width: 20px; height: 20px; }
.empty-state {
  padding: 28px 18px;
  border-radius: 18px;
  border: 1px dashed rgba(255,255,255,.16);
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
}

.team-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 12px 0 18px;
}
.team-panel {
  min-width: 0;
  border-radius: 21px;
  border: 1px solid;
  padding: 14px 10px 12px;
  overflow: hidden;
}
.team-panel.blue { border-color: rgba(19,140,255,.48); background: linear-gradient(180deg, rgba(19,140,255,.16), rgba(8,14,23,.82)); }
.team-panel.red { border-color: rgba(255,61,79,.46); background: linear-gradient(180deg, rgba(255,61,79,.14), rgba(8,14,23,.82)); }
.team-heading { display: flex; align-items: center; justify-content: center; gap: 7px; margin: 2px 0 12px; font-size: 14px; font-weight: 900; text-transform: uppercase; }
.team-panel.blue .team-heading { color: #72bbff; }
.team-panel.red .team-heading { color: #ff8490; }
.team-count { color: var(--muted); font-size: 11px; }
.player-list { display: grid; gap: 7px; }
.player-chip {
  min-width: 0;
  width: 100%;
  min-height: 43px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.08);
  padding: 8px 9px;
  color: var(--text);
  background: rgba(0,0,0,.20);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
  font-weight: 700;
  font-size: 14px;
}
button.player-chip { cursor: pointer; }
.team-panel.blue .player-chip.selected { border-color: var(--blue); background: rgba(19,140,255,.24); box-shadow: 0 0 18px rgba(19,140,255,.18); }
.team-panel.red .player-chip.selected { border-color: var(--red); background: rgba(255,61,79,.22); box-shadow: 0 0 18px rgba(255,61,79,.16); }

.action-grid { grid-template-columns: 1fr 1fr; }
.action-card {
  min-height: 96px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 12px;
  background: rgba(255,255,255,.035);
  color: var(--text);
  display: grid;
  gap: 7px;
  justify-items: start;
  text-align: left;
  cursor: pointer;
}
.action-card svg { width: 24px; height: 24px; color: var(--muted); }
.action-card.blue { border-color: rgba(19,140,255,.28); }
.action-card.blue svg { color: #75bdff; }
.action-card.red { border-color: rgba(255,61,79,.27); }
.action-card.red svg { color: #ff8994; }
.action-label { font-size: 14px; line-height: 1.25; font-weight: 800; }

.footer {
  margin-top: 24px;
  padding: 16px 0 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 14px;
  color: var(--muted-2);
  font-size: 11px;
}
.footer a, .footer button {
  border: 0;
  padding: 5px 0;
  color: inherit;
  background: transparent;
  text-decoration: none;
  cursor: pointer;
}
.footer a:hover, .footer button:hover { color: var(--text); }
.footer-separator { opacity: .5; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  padding: calc(18px + var(--safe-top)) 18px calc(18px + var(--safe-bottom));
  display: grid;
  place-items: center;
  background: rgba(0,0,0,.72);
  backdrop-filter: blur(9px);
  animation: fade .16s ease both;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: min(100%, 520px);
  max-height: calc(100dvh - 36px - var(--safe-top) - var(--safe-bottom));
  overflow: auto;
  border-radius: 24px;
  border: 1px solid var(--line);
  padding: 22px;
  background: #0c131e;
  box-shadow: 0 34px 90px rgba(0,0,0,.65);
}
.modal-head { display: grid; grid-template-columns: 1fr 44px; align-items: start; gap: 12px; }
.modal h2 { font-size: 24px; margin: 4px 0 14px; }
.modal p, .modal li { color: var(--muted); line-height: 1.58; font-size: 14px; }
.modal ul { padding-left: 19px; }
.modal-actions { display: grid; gap: 10px; margin-top: 20px; }

.toast {
  position: fixed;
  z-index: 150;
  left: 50%;
  bottom: calc(20px + var(--safe-bottom));
  width: max-content;
  max-width: calc(100vw - 36px);
  padding: 12px 16px;
  border-radius: 14px;
  color: var(--text);
  background: #172231;
  border: 1px solid rgba(255,255,255,.14);
  box-shadow: 0 14px 40px rgba(0,0,0,.46);
  transform: translate(-50%, 18px);
  opacity: 0;
  pointer-events: none;
  transition: .2s ease;
  font-size: 13px;
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.noscript { margin: 20px; padding: 16px; background: #31121a; color: white; border-radius: 12px; }
.hidden { display: none !important; }

@media (max-width: 390px) {
  .app-shell { padding-left: 14px; padding-right: 14px; }
  .team-columns { gap: 8px; }
  .team-panel { padding-left: 7px; padding-right: 7px; }
  .player-chip { font-size: 13px; padding-left: 7px; padding-right: 7px; }
  .action-card { min-height: 90px; }
}

@media (min-width: 700px) {
  .app-shell { padding-top: calc(28px + var(--safe-top)); }
  .mode-grid { grid-template-columns: 1fr 1fr; }
  .screen { min-height: calc(100vh - 56px - var(--safe-top) - var(--safe-bottom)); }
}

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