:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ink: #000000;
  --muted: #000000;
  --paper: #ffffff;
  --line: #000000;
  --mint: #ffffff;
  --leaf: #000000;
  --peach: #ffffff;
  --butter: #ffffff;
  --blue: #ffffff;
  --rose: #ffffff;
  --shadow: none;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #ffffff;
  overscroll-behavior: none;
}

body {
  min-height: 100dvh;
  margin: 0;
  color: var(--ink);
  background: #ffffff;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

body.is-playing {
  touch-action: none;
}

button {
  border: 0;
  border-radius: 8px;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

input {
  border-radius: 8px;
  font: inherit;
}

button:focus-visible {
  outline: 3px solid #000000;
  outline-offset: 2px;
}

input:focus-visible {
  outline: 3px solid #000000;
  outline-offset: 2px;
}

.page {
  width: min(1180px, 100%);
  min-height: 100dvh;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  grid-template-columns: minmax(240px, 0.82fr) minmax(320px, 1.55fr);
  gap: 22px;
  align-items: center;
}

.brand-copy {
  padding: clamp(8px, 3vw, 28px);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--leaf);
  font-size: 13px;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 8em;
  margin-bottom: 16px;
  font-size: clamp(48px, 8vw, 104px);
  line-height: 0.92;
  letter-spacing: 0;
}

.brand-copy p:not(.eyebrow) {
  max-width: 440px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: clamp(16px, 2vw, 19px);
  line-height: 1.7;
  word-break: keep-all;
}

.game-shell {
  width: 100%;
  padding: 16px;
  border: 3px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.scoreboard {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.scoreboard div {
  min-height: 70px;
  padding: 12px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.scoreboard span,
.fullness-row span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.scoreboard strong {
  display: block;
  font-size: clamp(24px, 4vw, 34px);
  line-height: 1;
}

.fullness-row {
  display: grid;
  grid-template-columns: 62px 1fr 48px;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.fullness-row span {
  margin: 0;
}

.fullness-track {
  height: 18px;
  overflow: hidden;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
}

#fullnessBar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: #000000;
  transition: width 150ms ease;
}

#fullnessValue {
  text-align: right;
}

.canvas-wrap {
  position: relative;
  overflow: hidden;
  border: 3px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  touch-action: none;
  user-select: none;
}

canvas {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  touch-action: none;
  user-select: none;
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  padding: 24px;
  background: #ffffff;
  text-align: center;
}

.overlay img {
  width: min(220px, 48vw);
  max-height: 170px;
  object-fit: contain;
  filter: none;
}

.overlay h2 {
  max-width: 520px;
  margin: 0;
  font-size: clamp(28px, 5vw, 52px);
  line-height: 1.02;
  letter-spacing: 0;
}

.overlay p:not(.eyebrow) {
  max-width: 440px;
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  word-break: keep-all;
}

.player-field {
  width: min(260px, 100%);
  display: grid;
  gap: 5px;
  text-align: left;
}

.player-field span {
  font-size: 12px;
  font-weight: 950;
}

.player-field input {
  width: 100%;
  min-height: 42px;
  border: 2px solid var(--line);
  padding: 0 12px;
  color: var(--ink);
  background: #ffffff;
  font-weight: 900;
}

.overlay button,
.control-row button {
  min-height: 52px;
  border: 2px solid var(--line);
  color: var(--ink);
  background: var(--butter);
  box-shadow: 0 6px 0 var(--line);
}

.overlay button {
  min-width: 150px;
  margin-top: 6px;
  padding: 0 22px;
}

.control-row {
  display: grid;
  grid-template-columns: 82px 1fr 82px;
  gap: 10px;
  margin-top: 12px;
  touch-action: none;
  user-select: none;
}

.control-row button {
  background: #ffffff;
}

#pauseButton {
  background: #ffffff;
}

.status-copy {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.45;
  text-align: center;
  word-break: keep-all;
}

.result-rank {
  min-width: min(320px, 100%);
  border: 2px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  background: #ffffff;
  font-weight: 950;
}

.rank-panel {
  margin-top: 14px;
  border: 2px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
}

.rank-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
  margin-bottom: 10px;
}

.rank-head h2 {
  margin: 0;
  font-size: 24px;
}

.rank-head span {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 950;
}

.leaderboard-list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.leaderboard-list li {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  border-top: 1px solid var(--line);
  padding-top: 7px;
}

.leaderboard-list li:first-child {
  border-top: 0;
  padding-top: 0;
}

.rank-number,
.rank-score {
  font-weight: 950;
}

.rank-name {
  min-width: 0;
  overflow: hidden;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-meta {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 800;
}

.is-hidden {
  display: none;
}

@media (max-width: 880px) {
  .page {
    grid-template-columns: 1fr;
    gap: 10px;
    align-items: start;
    padding: 14px;
  }

  .brand-copy {
    padding: 8px 2px 0;
  }

  h1 {
    max-width: none;
    margin-bottom: 8px;
    font-size: clamp(42px, 13vw, 70px);
  }

  .brand-copy p:not(.eyebrow) {
    max-width: none;
    font-size: 15px;
    line-height: 1.55;
  }
}

@media (max-width: 520px) {
  .page {
    min-height: 100svh;
    padding: 10px;
  }

  .eyebrow {
    margin-bottom: 4px;
    font-size: 11px;
  }

  h1 {
    margin-bottom: 6px;
    font-size: clamp(34px, 11vw, 48px);
  }

  .brand-copy p:not(.eyebrow) {
    font-size: 13px;
    line-height: 1.42;
  }

  .game-shell {
    padding: 8px;
    border-width: 2px;
  }

  .scoreboard {
    gap: 6px;
    margin-bottom: 8px;
  }

  .scoreboard div {
    min-height: 50px;
    padding: 7px;
    border-width: 2px;
  }

  .scoreboard span {
    margin-bottom: 4px;
    font-size: 10px;
  }

  .scoreboard strong {
    font-size: 22px;
  }

  .fullness-row {
    grid-template-columns: 54px 1fr 42px;
    gap: 7px;
    margin-bottom: 8px;
  }

  .fullness-track {
    height: 15px;
  }

  .canvas-wrap {
    border-width: 2px;
  }

  canvas {
    aspect-ratio: 4 / 3;
  }

  .control-row {
    grid-template-columns: 72px 1fr 72px;
    gap: 8px;
    margin-top: 8px;
  }

  .control-row button,
  .overlay button {
    min-height: 42px;
    box-shadow: 0 4px 0 var(--line);
  }

  .overlay {
    gap: 4px;
    padding: 6px;
  }

  .overlay img {
    max-height: 48px;
  }

  .overlay h2 {
    font-size: clamp(20px, 7vw, 26px);
    line-height: 1.04;
  }

  .overlay p:not(.eyebrow) {
    display: none;
  }

  .player-field {
    width: min(220px, 100%);
    gap: 3px;
  }

  .player-field span {
    font-size: 10px;
  }

  .player-field input {
    min-height: 36px;
    padding-inline: 10px;
  }

  .overlay button {
    margin-top: 0;
    min-width: 128px;
    padding: 0 16px;
  }

  .status-copy {
    margin-top: 8px;
    font-size: 12px;
    line-height: 1.35;
  }

  .rank-panel {
    margin-top: 10px;
    padding: 9px;
  }

  .rank-head {
    margin-bottom: 8px;
  }

  .rank-head h2 {
    font-size: 20px;
  }

  .leaderboard-list li {
    grid-template-columns: 32px 1fr auto;
    gap: 7px;
    min-height: 38px;
  }

  .rank-score {
    font-size: 13px;
  }
}
