:root {
  --background: #EFECE5;
  --card: #FDFCFA;
  --border: #DCD8CE;
  --text: #15170F;
  --secondary: #4A4E42;
  --primary: #2E7D4F;
  --primary-dark: #1D5133;
  --gold: #E4D6B4;
  --amber: #C98A17;
  --eagle: #D9990F;
  --birdie: #C73333;
  --par: #15170F;
  --bogey: #4066A6;
  --double-bogey: #2E3F63;
  --radius: 16px;
  --shadow: 0 3px 0 var(--primary-dark);
  --font-display: "Bricolage Grotesque", sans-serif;
  --font-body: "Manrope", sans-serif;
  --font-label: "IBM Plex Mono", monospace;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
  font: inherit;
}

a {
  color: var(--primary-dark);
  text-underline-offset: 0.2em;
}

img,
svg {
  display: block;
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 3px;
}

.container {
  width: min(100% - 32px, 980px);
  margin-inline: auto;
}

.site-header {
  padding-block: 20px 12px;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 4px solid var(--primary);
  border-radius: 50%;
  background: transparent;
}

.brand-mark::after {
  position: absolute;
  top: 1px;
  right: -7px;
  width: 9px;
  height: 9px;
  border: 2px solid var(--background);
  border-radius: 50%;
  background: #FFFFFF;
  content: "";
}

.brand-copy {
  display: grid;
  gap: 1px;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.brand-tagline {
  color: var(--secondary);
  font-size: 0.75rem;
  line-height: 1.3;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--primary-dark);
  font-family: var(--font-label);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  line-height: 1.3;
  text-transform: uppercase;
}

.hero {
  padding-block: 52px 42px;
}

.hero h1,
.score-hero h1,
.prose-card h1,
.app-promo h2,
.state-card h1,
.editor-card h2,
.totals-card h2,
.hole-strip-card h2,
.readonly-card h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.05;
}

.hero h1 {
  max-width: 720px;
  font-size: clamp(2.65rem, 12vw, 5.7rem);
}

.hero-text {
  max-width: 630px;
  margin: 22px 0 28px;
  color: var(--secondary);
  font-size: 1.08rem;
}

.button {
  display: inline-flex;
  min-height: 54px;
  align-items: center;
  justify-content: center;
  padding: 13px 20px;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  transition: transform 120ms ease, opacity 120ms ease;
}

.button:active:not(:disabled) {
  transform: translateY(2px);
}

.button-primary {
  background: var(--primary);
  box-shadow: var(--shadow);
  color: #FFFFFF;
}

.button-secondary {
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: 0 2px 0 #C8C4B9;
  color: var(--text);
}

.button-large {
  min-height: 60px;
  padding-inline: 24px;
}

.button-full {
  width: 100%;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
  box-shadow: none;
}

.feature-grid {
  display: grid;
  gap: 14px;
  padding-block: 8px 64px;
}

.card,
.feature-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
}

.feature-card {
  min-height: 210px;
  padding: 24px;
}

.feature-number {
  display: inline-flex;
  width: 44px;
  height: 30px;
  align-items: center;
  justify-content: center;
  margin-bottom: 28px;
  border-radius: 999px;
  background: var(--gold);
  color: var(--text);
  font-family: var(--font-label);
  font-size: 0.72rem;
  font-weight: 600;
}

.feature-card h2 {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: 1.35rem;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.feature-card p {
  margin: 0;
  color: var(--secondary);
  font-size: 0.94rem;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding-block: 26px 34px;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 12px;
  color: var(--secondary);
  font-size: 0.84rem;
}

.footer-inner p {
  margin: 0;
}

.prose-page {
  padding-block: 42px 72px;
}

.prose-card {
  padding: 28px 22px;
}

.prose-card h1 {
  font-size: clamp(2.2rem, 10vw, 4rem);
}

.prose-intro {
  margin: 18px 0 34px;
  color: var(--secondary);
  font-size: 1.05rem;
}

.prose-card section {
  padding-block: 24px;
  border-top: 1px solid var(--border);
}

.prose-card section h2 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 1.2rem;
  letter-spacing: -0.025em;
}

.prose-card section p {
  margin: 0;
  color: var(--secondary);
}

.prose-meta {
  display: grid;
  gap: 10px;
  margin-top: 10px;
  padding: 20px;
  border-radius: 12px;
  background: var(--background);
}

.prose-meta p {
  display: grid;
  gap: 2px;
  margin: 0;
}

.prose-meta span {
  color: var(--secondary);
  font-family: var(--font-label);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.prose-meta strong {
  font-size: 0.92rem;
}

.score-shell {
  padding-block: 28px 72px;
}

.state-card {
  padding: 40px 24px;
  text-align: center;
}

.state-card h1 {
  margin-top: 18px;
  font-size: clamp(1.8rem, 8vw, 2.7rem);
}

.state-card p {
  max-width: 520px;
  margin: 14px auto 24px;
  color: var(--secondary);
}

.loader {
  display: inline-block;
  width: 42px;
  height: 42px;
  border: 4px solid var(--gold);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 850ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.score-hero {
  padding: 28px 22px;
}

.score-hero h1 {
  font-size: clamp(2.3rem, 11vw, 4.7rem);
}

.score-player {
  margin: 14px 0 0;
  font-size: 1.08rem;
  font-weight: 700;
}

.score-meta {
  display: grid;
  gap: 4px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  color: var(--secondary);
  font-size: 0.9rem;
}

.score-meta p {
  margin: 0;
}

.notice {
  margin-top: 14px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-weight: 700;
}

.notice p {
  margin: 0;
}

.notice .button {
  width: 100%;
  margin-top: 16px;
}

.notice-success {
  border-color: #9BC5A8;
  background: #E6F2E8;
  color: #174D2E;
}

.notice-neutral {
  background: var(--gold);
  color: var(--text);
}

.editor-card,
.hole-strip-card,
.readonly-card,
.totals-card,
.app-promo {
  margin-top: 14px;
  padding: 22px;
}

.hole-heading,
.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.hole-heading {
  align-items: center;
}

.hole-heading .eyebrow {
  margin-bottom: 5px;
  font-size: 0.85rem;
}

.hole-details {
  display: flex;
  gap: 14px;
  margin: 0;
  color: var(--secondary);
  font-family: var(--font-label);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.hole-details strong {
  color: var(--text);
  font-size: 0.84rem;
}

.save-status {
  max-width: 145px;
  color: var(--secondary);
  font-size: 0.72rem;
  line-height: 1.35;
  text-align: right;
}

.save-status-saving {
  color: var(--amber);
}

.save-status-saved {
  color: var(--primary-dark);
}

.save-status-error {
  color: var(--birdie);
}

.score-stepper {
  display: grid;
  grid-template-columns: 72px minmax(70px, 1fr) 72px;
  gap: 9px;
  align-items: stretch;
  margin-block: 28px 10px;
}

.score-button {
  min-width: 64px;
  min-height: 88px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--background);
  box-shadow: 0 2px 0 #C8C4B9;
  color: var(--text);
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1;
  touch-action: manipulation;
}

.score-button:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: none;
}

.score-button:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.score-value {
  display: flex;
  min-height: 88px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 14px;
  font-family: var(--font-display);
  font-size: clamp(4.3rem, 22vw, 6.6rem);
  font-weight: 700;
  letter-spacing: -0.07em;
  line-height: 0.9;
}

.score-ghost {
  color: #A5A79F;
}

.editor-actions {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.editor-actions p {
  margin: 0;
  color: var(--secondary);
  font-size: 0.72rem;
  text-align: right;
}

.text-button,
.text-link {
  border: 0;
  background: transparent;
  color: var(--primary-dark);
  cursor: pointer;
  font-weight: 800;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.text-button {
  min-height: 44px;
  padding: 8px 0;
}

.text-button:disabled,
.text-link[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.45;
  text-decoration: none;
}

.hole-navigation {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 10px;
  margin-top: 12px;
}

.hole-navigation .button:disabled {
  box-shadow: none;
  opacity: 0.38;
}

.hole-strip-card h2,
.readonly-card h2,
.totals-card h2 {
  font-size: 1.35rem;
}

.section-heading > p {
  margin: 2px 0 0;
  color: var(--secondary);
  font-size: 0.7rem;
  text-align: right;
}

.hole-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 7px;
  margin-top: 18px;
}

.hole-chip {
  display: grid;
  min-width: 0;
  min-height: 62px;
  place-items: center;
  gap: 3px;
  padding: 6px 2px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--background);
  color: var(--text);
  cursor: pointer;
  font-size: 0.75rem;
  line-height: 1;
  touch-action: manipulation;
}

.hole-chip.is-current {
  outline: 2px solid var(--text);
  outline-offset: 1px;
}

.hole-chip.score-eagle,
.hole-chip.score-birdie,
.hole-chip.score-par,
.hole-chip.score-bogey,
.hole-chip.score-double {
  border-color: var(--score-color);
  background: var(--card);
}

.hole-number {
  font-family: var(--font-label);
  font-size: 0.58rem;
  font-weight: 600;
}

.hole-score {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
}

.score-marker {
  display: block;
  width: 9px;
  height: 9px;
  background: var(--score-color, var(--secondary));
}

.shape-circle {
  border-radius: 50%;
}

.shape-square {
  border-radius: 1px;
}

.score-eagle {
  --score-color: var(--eagle);
}

.score-birdie {
  --score-color: var(--birdie);
}

.score-par {
  --score-color: var(--par);
}

.score-bogey {
  --score-color: var(--bogey);
}

.score-double {
  --score-color: var(--double-bogey);
}

.readonly-holes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 18px;
}

.readonly-hole {
  display: grid;
  min-height: 78px;
  grid-template-columns: 1fr auto;
  align-content: center;
  gap: 5px 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--background);
}

.readonly-title {
  grid-column: 1 / -1;
  color: var(--secondary);
  font-family: var(--font-label);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.readonly-score {
  font-size: 0.9rem;
}

.readonly-hole:not(.score-empty) {
  border-color: var(--score-color);
}

.readonly-hole:not(.score-empty) .readonly-score {
  color: var(--score-color);
}

.totals-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}

.totals-grid > div {
  min-height: 112px;
  padding: 16px;
  border-radius: 12px;
  background: var(--background);
}

.totals-grid span {
  display: block;
  color: var(--secondary);
  font-family: var(--font-label);
  font-size: 0.63rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.totals-grid strong {
  display: block;
  margin-top: 8px;
  font-family: var(--font-display);
  font-size: 2.4rem;
  letter-spacing: -0.05em;
  line-height: 1;
}

.submit-card {
  margin-top: 18px;
  text-align: center;
}

.submit-card p {
  margin: 14px 0 0;
  color: var(--secondary);
  font-size: 0.75rem;
}

.app-promo {
  background: #F5F0E4;
}

.app-promo h2 {
  max-width: 580px;
  font-size: clamp(1.7rem, 7vw, 2.6rem);
}

.app-promo > p:not(.eyebrow, .app-promo-note) {
  max-width: 620px;
  margin: 14px 0 20px;
  color: var(--secondary);
}

.app-promo-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
}

.app-promo-actions .text-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  font-size: 0.88rem;
}

.app-promo-note {
  margin: 20px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  color: var(--secondary);
  font-size: 0.76rem;
}

.app-promo-fallback {
  margin-top: 0;
}

.toast {
  position: fixed;
  z-index: 20;
  right: 16px;
  bottom: max(16px, env(safe-area-inset-bottom));
  left: 16px;
  max-width: 520px;
  margin-inline: auto;
  padding: 15px 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--text);
  box-shadow: 0 8px 30px rgb(21 23 15 / 20%);
  color: #FFFFFF;
  font-size: 0.88rem;
  font-weight: 700;
}

.toast-success {
  background: var(--primary-dark);
}

@media (min-width: 640px) {
  .container {
    width: min(100% - 48px, 980px);
  }

  .feature-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .feature-card {
    min-height: 250px;
  }

  .footer-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .prose-card {
    padding: 44px;
  }

  .score-hero,
  .editor-card,
  .hole-strip-card,
  .readonly-card,
  .totals-card,
  .app-promo {
    padding: 30px;
  }

  .score-stepper {
    grid-template-columns: 96px minmax(130px, 1fr) 96px;
    gap: 14px;
  }

  .score-button,
  .score-value {
    min-height: 112px;
  }

  .score-value {
    font-size: 6.2rem;
  }

  .hole-strip {
    grid-template-columns: repeat(9, minmax(0, 1fr));
  }

  .readonly-holes {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .app-promo-actions {
    flex-direction: row;
    align-items: center;
    gap: 24px;
  }
}

@media (min-width: 900px) {
  .site-header {
    padding-block: 28px 16px;
  }

  .brand-tagline {
    font-size: 0.82rem;
  }

  .hero {
    padding-block: 84px 62px;
  }

  .feature-grid {
    gap: 18px;
  }

  .score-shell {
    max-width: 820px;
    padding-top: 48px;
  }

  .score-hero {
    padding: 38px;
  }

  .score-meta {
    grid-template-columns: 1fr 1fr;
    gap: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
