:root {
  font-family: system-ui, sans-serif;
  color: #282c26;
  background: #f6f2e8;
  --paper: #f6f2e8;
  --ink: #282c26;
  --muted: #585a51;
  --line: #ccc7ba;
}

* { box-sizing: border-box; }
body { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid #2e6651; outline-offset: 3px; }

.shell {
  --gutter: clamp(12px, 4vw, 24px);
  width: min(100%, 520px);
  min-height: 100vh;
  min-height: 100dvh;
  margin-inline: auto;
  padding: max(12px, env(safe-area-inset-top))
           max(var(--gutter), env(safe-area-inset-right))
           max(16px, env(safe-area-inset-bottom))
           max(var(--gutter), env(safe-area-inset-left));
}

h1, h2, p { margin: 0; overflow-wrap: anywhere; }
h1 { font-size: clamp(26px, 7vw, 38px); line-height: 1.12; }
h2 { font-size: 19px; line-height: 1.2; }
section:not(.play) { padding-block-start: clamp(8px, 3vh, 24px); }
.hero h1 { font-size: clamp(38px, 11vw, 58px); letter-spacing: -.035em; }
.hero p { margin-block: 14px 24px; }
.muted { color: var(--muted); line-height: 1.5; }

button { min-height: 48px; padding: 10px 14px; border: 1px solid transparent; border-radius: 7px; }
.primary, .secondary { width: 100%; font-weight: 650; }
.primary, .up { background: var(--ink); color: #fff; }
.secondary, .down { background: transparent; border-color: var(--line); }
.secondary { margin-top: 8px; }
.link, .header-btn { background: transparent; color: var(--muted); }
.link { display: block; margin: 4px auto 0; }
header { display: flex; justify-content: flex-end; }

label { display: block; font-weight: 600; margin: 16px 0 6px; }
input, textarea, select {
  width: 100%;
  min-height: 48px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffcf6;
  font-size: 16px;
}
textarea { min-height: 106px; resize: vertical; }
.error { color: #942e20; margin-block: 12px; }
.error:empty { margin: 0; }
.error + .primary { margin-top: 16px; }

.team-list, .scores { margin-block: 16px; }
.team-row, .scores > div, .team-choice { border-bottom: 1px solid var(--line); padding-block: 10px; }
.team-row p, .next-box p, .winner p { color: var(--muted); margin-top: 4px; }
.next-box, .winner { border-top: 1px solid var(--line); margin-block: 16px; padding-top: 10px; }
.next-box h2, .winner h2 { margin-block: 5px; }
.scores > div { display: flex; justify-content: space-between; align-items: center; gap: 12px; overflow-wrap: anywhere; }
.scores b { font-size: 21px; font-variant-numeric: tabular-nums; }

.game-shell { display: flex; flex-direction: column; }
.play { flex: 1; display: flex; flex-direction: column; gap: clamp(8px, 2vh, 14px); }
.play-meta { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; color: var(--muted); }
.play-meta span:first-child { min-width: 0; overflow-wrap: anywhere; }
.play-meta span:last-child { flex-shrink: 0; font-variant-numeric: tabular-nums; }
.timer { text-align: center; font-size: clamp(32px, 7vh, 54px); line-height: 1; font-weight: 750; font-variant-numeric: tabular-nums; }
.timer.expired { font-size: 16px; color: #942e20; }
.card {
  flex: 1 0 auto;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 8px;
  min-height: clamp(108px, 25vh, 180px);
  padding: clamp(10px, 4vw, 24px);
  border: 1px solid #a7af80;
  border-radius: 8px;
  background: #e6ebcc;
  text-align: center;
  touch-action: none;
  user-select: none;
}
.card.common { background: #f5dfd1; border-color: #c6a994; }
.card-label { font-size: 14px; color: #734239; }
.word { max-width: 100%; overflow-wrap: anywhere; font-size: clamp(26px, 8vw, 48px); line-height: 1.1; font-weight: 750; }
.actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.action { min-height: 54px; padding-inline: 5px; font-weight: 650; overflow-wrap: anywhere; }
.action b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.selector h2 { margin-bottom: 4px; }
.team-choice { width: 100%; border-radius: 0; background: transparent; text-align: left; display: flex; justify-content: space-between; gap: 8px; overflow-wrap: anywhere; }
.team-choice span { flex-shrink: 0; }

@media (max-height: 500px) {
  .play { gap: 6px; }
  .timer { font-size: 28px; }
  .card { min-height: 80px; }
}
.paused .timer { margin-block: 18px; }
