:root {
  --bg: #f2f0e9;
  --panel: #ffffff;
  --ink: #111111;
  --muted: #656565;
  --line: #d8d5cc;
  --soft: #ece9e0;
  --accent: #111111;
  --radius: 20px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
}
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.app-shell {
  width: min(980px, 100%);
  margin: 0 auto;
  padding: 28px 16px 48px;
}

.hero {
  padding: 18px 4px 26px;
}
.eyebrow, .label {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .16em;
}
h1 {
  margin: 0;
  font-size: clamp(38px, 9vw, 72px);
  line-height: .96;
  letter-spacing: -.04em;
}
.lead {
  max-width: 640px;
  margin: 18px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.score-card, .input-panel, .notes {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(0,0,0,.04);
}

.score-card { overflow: hidden; }
.score-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--line);
}
.total-score {
  font-size: 42px;
  line-height: 1;
  font-weight: 900;
}
.reset-button, .secondary-button {
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  border-radius: 999px;
  padding: 11px 16px;
  font-weight: 800;
  cursor: pointer;
}
.reset-button:active, .secondary-button:active { transform: translateY(1px); }
.secondary-button:disabled { opacity: .35; cursor: not-allowed; }

.frames {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.frame {
  min-width: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.frame:nth-child(5n) { border-right: 0; }
.frame:nth-last-child(-n+5) { border-bottom: 0; }
.frame.active { background: #f8f7f2; box-shadow: inset 0 0 0 2px var(--ink); }
.frame-number {
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  font-weight: 900;
  text-align: center;
  letter-spacing: .08em;
}
.shots {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  min-height: 42px;
}
.frame.tenth .shots { grid-template-columns: repeat(3, 1fr); }
.shot {
  display: grid;
  place-items: center;
  min-height: 42px;
  border-right: 1px solid var(--line);
  font-weight: 900;
}
.shot:last-child { border-right: 0; }
.frame-score {
  min-height: 50px;
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 900;
}

.input-panel {
  margin-top: 16px;
  padding: 20px;
}
.input-title-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}
.input-title-row h2 { margin: 0; font-size: 28px; }
.shot-label { margin: 0 0 2px; font-weight: 900; }
.input-help { margin: 12px 0 16px; color: var(--muted); line-height: 1.6; }
.number-pad {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}
.score-button {
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--soft);
  color: var(--ink);
  font-size: 20px;
  font-weight: 900;
  cursor: pointer;
}
.score-button:hover { border-color: var(--ink); }
.score-button:active { transform: scale(.98); }
.score-button.special {
  background: var(--ink);
  color: white;
  grid-column: span 2;
}
.action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.notes {
  margin-top: 16px;
  padding: 22px;
}
.notes h2 { margin: 0 0 10px; font-size: 20px; }
.notes p { margin: 8px 0; line-height: 1.75; color: #333; }
.notes .small { font-size: 13px; color: var(--muted); }
.footer { text-align: center; padding: 24px 0 0; }
.footer a { color: var(--ink); font-weight: 800; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

@media (min-width: 760px) {
  .frames { grid-template-columns: repeat(10, minmax(0, 1fr)); }
  .frame { border-bottom: 0; }
  .frame:nth-child(5n) { border-right: 1px solid var(--line); }
  .frame:last-child { border-right: 0; }
  .number-pad { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .score-button.special { grid-column: span 1; }
}
