:root {
  color-scheme: dark;
  --bg: #07140f;
  --panel: rgba(10, 28, 23, 0.9);
  --panel-strong: rgba(13, 37, 30, 0.96);
  --line: rgba(255, 215, 148, 0.2);
  --text: #fff8e8;
  --muted: #b9c9b6;
  --accent: #ffb347;
  --accent-2: #77d68a;
  --danger: #ff7043;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 82% 8%, rgba(244, 212, 124, 0.2), transparent 17rem),
    radial-gradient(circle at 88% 82%, rgba(255, 112, 67, 0.18), transparent 22rem),
    radial-gradient(circle at 16% 16%, rgba(42, 105, 73, 0.3), transparent 30rem),
    linear-gradient(180deg, #030913 0%, var(--bg) 52%, #020b08 100%);
}

button,
canvas {
  font: inherit;
}

.page-shell {
  width: min(980px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 36px;
}

.hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-2);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 8px;
  font-size: clamp(2rem, 6vw, 4.4rem);
  line-height: 0.95;
  letter-spacing: -0.05em;
  text-shadow: 0 8px 30px rgba(0, 0, 0, 0.5), 0 0 28px rgba(255, 179, 71, 0.16);
}

h2 {
  margin-bottom: 0;
  font-size: 1rem;
  letter-spacing: 0.02em;
}

.tagline,
#status {
  color: var(--muted);
}

.tagline {
  margin-bottom: 0;
}

.button {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  color: #241505;
  background: linear-gradient(135deg, #ffe0a0, var(--accent));
  box-shadow: 0 10px 24px rgba(255, 179, 71, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.65);
  font-weight: 850;
  cursor: pointer;
  white-space: nowrap;
}

.button:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

.score-panel,
.game-card,
.instructions {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(14px);
}

.score-panel {
  padding: 16px;
  margin-bottom: 16px;
}

.score-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

#status {
  margin-bottom: 0;
  text-align: right;
}

.scoreboard {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(2, 12, 9, 0.55);
}

.frame {
  min-width: 0;
  border-right: 1px solid var(--line);
}

.frame:last-child {
  border-right: 0;
}

.frame-head {
  padding: 5px 7px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.68rem;
  font-weight: 800;
  text-align: center;
}

.rolls {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  min-height: 30px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.frame.tenth .rolls {
  grid-template-columns: repeat(3, 1fr);
}

.roll {
  display: grid;
  place-items: center;
  border-right: 1px solid var(--line);
  color: #ffe0a0;
  font-size: 0.9rem;
  font-weight: 900;
}

.roll:last-child {
  border-right: 0;
}

.frame-score {
  display: grid;
  min-height: 34px;
  place-items: center;
  color: var(--accent-2);
  font-weight: 900;
}

.game-card {
  overflow: hidden;
  padding: 10px;
  background: var(--panel-strong);
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 18px;
  background: #030913;
  cursor: crosshair;
  touch-action: none;
}

.instructions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  overflow: hidden;
  margin-top: 16px;
  background: var(--line);
}

.instructions > div {
  padding: 14px 16px;
  background: rgba(9, 27, 21, 0.94);
}

.instructions strong,
.instructions span {
  display: block;
}

.instructions strong {
  margin-bottom: 4px;
  color: var(--accent);
}

.instructions span {
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100% - 18px, 980px);
    padding-top: 16px;
  }

  .hero,
  .score-heading {
    align-items: start;
    flex-direction: column;
  }

  #status {
    text-align: left;
  }

  .scoreboard {
    grid-template-columns: repeat(5, 1fr);
  }

  .frame:nth-child(5n) {
    border-right: 0;
  }

  .frame:nth-child(n + 6) {
    border-top: 1px solid var(--line);
  }

  .instructions {
    grid-template-columns: 1fr;
  }
}
