:root {
  color-scheme: light;
  --bg: #f7f7f7;
  --panel: #ffffff;
  --text: #111111;
  --muted: #555555;
  --line: #d8d8d8;
  --button: #111111;
  --button-text: #ffffff;
  font-family: Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: var(--bg);
}

button,
input {
  font: inherit;
}

button {
  border: 1px solid var(--button);
  border-radius: 4px;
  padding: 12px 14px;
  color: var(--button-text);
  background: var(--button);
  cursor: pointer;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 10px;
  color: var(--text);
  background: var(--panel);
}

.app {
  width: min(1100px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 16px;
  display: grid;
  grid-template-columns: 260px 1fr;
  grid-template-areas:
    "setup stage"
    "scores scores";
  gap: 16px;
}

.setup,
.scores,
.stage {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
}

.setup,
.scores {
  align-self: start;
  padding: 16px;
}

.setup {
  grid-area: setup;
}

.scores {
  grid-area: scores;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.1;
}

h1 {
  font-size: 2rem;
}

h2 {
  font-size: 1.2rem;
}

.field {
  display: grid;
  gap: 8px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
}

.name-row {
  display: grid;
  grid-template-columns: 1fr 48px;
  gap: 8px;
}

.players {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.player-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 8px;
  background: var(--bg);
}

.player-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-chip button {
  min-width: 28px;
  min-height: 28px;
  padding: 0;
}

.stage {
  grid-area: stage;
  min-height: calc(100vh - 160px);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 16px;
  padding: 16px;
  cursor: pointer;
}

.turn-label {
  min-height: 28px;
  margin: 0;
  color: var(--muted);
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
}

.tap-button {
  width: 100%;
  min-height: 520px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  border: 2px solid var(--button);
  color: var(--text);
  background: var(--panel);
  touch-action: manipulation;
  user-select: none;
}

.tap-button strong {
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: clamp(2.2rem, 8vw, 5.5rem);
  line-height: 1;
  font-weight: 800;
}

.tap-button span {
  font-size: clamp(3rem, 10vw, 6rem);
  line-height: 1;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.tap-button small {
  font-size: 1.1rem;
  font-weight: 700;
  text-transform: uppercase;
}

.controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.controls button:last-child {
  color: var(--text);
  background: var(--panel);
}

.score-list {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.score-list.empty {
  color: var(--muted);
}

.score-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg);
}

.score-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score-row small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.score-row.winner {
  border-color: var(--button);
}

@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-areas:
      "stage"
      "setup"
      "scores";
  }

  .stage {
    min-height: 68vh;
  }
}

@media (max-width: 520px) {
  .app {
    padding: 8px;
    gap: 8px;
  }

  .setup,
  .scores,
  .stage {
    padding: 12px;
  }

  .tap-button {
    min-height: 360px;
  }
}
