:root {
  color-scheme: dark;
  --field: #10141c;
  --field-2: #181d29;
  --ink: #f4f1ea;
  --muted: #d4cec3;
  --line: rgba(244, 241, 234, 0.16);
  --ticket: #ffe14a;
  --ticket-ink: #17140c;
  --danger: #ffb4c0;
  --shadow: 0 16px 36px rgba(0, 0, 0, 0.32);
  font-family: "Arial Hebrew", "Noto Sans Hebrew", "David", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--field);
  color: var(--ink);
}

body {
  font-size: 18px;
  line-height: 1.4;
}

::selection {
  background: var(--ticket);
  color: var(--ticket-ink);
}

:focus-visible {
  outline: 3px solid var(--ticket);
  outline-offset: 3px;
}

button, input, select { font: inherit; color: inherit; }

button { cursor: pointer; }

.app {
  width: min(440px, 100%);
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  padding:
    calc(22px + env(safe-area-inset-top))
    18px
    calc(28px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 22px;
}

h1, h2 {
  margin: 0;
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: -0.03em;
}

h1 { font-size: 3.25rem; }
h2 { font-size: 1.8rem; }

.lede {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 1.15rem;
  max-width: 36ch;
}

.game-name { font-size: 2rem; line-height: 1.15; }

.stack { display: flex; flex-direction: column; gap: 12px; }

.primary, .secondary, .choice {
  min-height: 54px;
  border-radius: 14px;
  border: 0;
  padding: 0 16px;
}

.primary {
  background: var(--ticket);
  color: var(--ticket-ink);
  font-weight: 800;
  box-shadow: var(--shadow);
}

.primary:disabled, .choice:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.field, .select {
  width: 100%;
  min-height: 54px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--field-2);
  padding: 0 14px;
  caret-color: var(--ticket);
}

.select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%),
    linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: left 18px top 24px, left 12px top 24px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

label.block { display: flex; flex-direction: column; gap: 8px; font-weight: 700; }

.hint, .error, .meta { margin: 0; }

.hint, .meta { color: var(--muted); }

.error {
  color: var(--danger);
  min-height: 1.3em;
}

.code {
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  margin: 0;
}

.link-row { display: flex; gap: 8px; }

.link-row input { flex: 1; min-width: 0; }

.rows { display: flex; flex-direction: column; }

.line {
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--line);
}

.player {
  flex: 1;
  display: flex;
  align-items: center;
  min-height: 64px;
  padding: 8px 0;
  background: transparent;
  border: 0;
  text-align: right;
}

.player b { font-size: 1.2rem; }

.sub { display: block; color: var(--muted); font-size: 0.95rem; font-weight: 500; }

.textish {
  background: transparent;
  border: 0;
  color: var(--ticket);
  min-height: 44px;
  padding: 0;
  font-weight: 700;
}

.stepper, .segment {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stepper { justify-content: space-between; }

.step {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--field-2);
  font-size: 1.5rem;
}

.count { font-size: 1.6rem; font-weight: 800; min-width: 2ch; text-align: center; }

.segment { display: grid; grid-template-columns: repeat(3, 1fr); }

.choice {
  background: var(--field-2);
  border: 1px solid var(--line);
  font-weight: 700;
}

.choice[aria-pressed="true"] {
  background: var(--ticket);
  color: var(--ticket-ink);
  border-color: transparent;
}

.icons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.icon {
  aspect-ratio: 1;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--field-2);
  font-size: 1.85rem;
  line-height: 1;
  display: grid;
  place-items: center;
  padding: 0;
}

.icon[aria-pressed="true"] {
  background: var(--ticket);
  color: var(--ticket-ink);
  border-color: transparent;
}

.icon.shake { animation: shake 320ms cubic-bezier(0.16, 1, 0.3, 1); }

.ticket {
  background: var(--ticket);
  color: var(--ticket-ink);
  border-radius: 16px;
  min-height: 280px;
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  box-shadow: var(--shadow);
  animation: rise 240ms cubic-bezier(0.16, 1, 0.3, 1);
}

.ticket .who { margin: 0; font-size: 1.1rem; font-weight: 700; }

.ticket .secret {
  margin: 0;
  font-size: clamp(2.4rem, 12vw, 3.4rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.banner {
  padding: 8px 0 4px;
}

.banner p { margin: 8px 0 0; color: var(--muted); }

.clock {
  margin: 0;
  font-size: 4.5rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  line-height: 0.9;
}

.scoreline, .voteline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.delta { font-variant-numeric: tabular-nums; font-weight: 800; }

@media (prefers-reduced-motion: reduce) {
  .ticket, .icon.shake { animation: none; }
}

@keyframes rise {
  from { transform: translateY(10px); opacity: 0.4; }
  to { transform: none; opacity: 1; }
}

@keyframes shake {
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
}
