/* Summer Garden Golf: a clubhouse scorecard laid over the evening garden. Cream card stock, bottle
   green ink, a brass accent from the low sun; Libre Baskerville for numbers that matter, Geist for
   the small print. */
:root {
  --card: rgba(248, 242, 228, 0.92);
  --ink: #1f3b2a;
  --ink-2: #4c6352;
  --rule: rgba(31, 59, 42, 0.16);
  --brass: #b98a3c;
  --sun: #ffcf7a;
  --red: #c63a2b;
  --serif: "Libre Baskerville", var(--kit-serif);
  --ui: var(--kit-grotesk);
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: #2a2418;
  color: var(--ink);
  font: 500 15px/1.35 var(--ui);
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}

#app { position: relative; width: 100vw; height: 100vh; height: 100dvh; }
#game { position: absolute; inset: 0; }
#game canvas { display: block; width: 100%; height: 100%; cursor: crosshair; }
.is-capturing #game canvas { cursor: none; }

.hud { position: absolute; inset: 0; pointer-events: none; font-size: clamp(11px, 0.92vw, 16px); }
.card {
  position: absolute;
  background: var(--card);
  border-radius: 0.7em;
  box-shadow: 0 0.1em 0 rgba(255, 255, 255, 0.6) inset, 0 0.9em 2.4em rgba(40, 24, 6, 0.28), 0 0 0 1px rgba(31, 59, 42, 0.12);
  backdrop-filter: blur(10px) saturate(1.1);
}

.holecard { top: 2.4vh; left: 1.8vw; display: flex; align-items: stretch; padding: 0.55em 1.2em 0.6em 0.55em; gap: 0.9em; }
.holeno {
  display: grid; place-items: center; align-content: center; min-width: 3.5em; padding: 0.3em 0.55em 0.35em;
  background: var(--ink); color: #f6efdc; border-radius: 0.45em;
}
.holeno .lbl { font-size: 0.68em; letter-spacing: 0.2em; text-transform: uppercase; color: #d8c48f; font-weight: 600; }
.holeno .no { font-family: var(--serif); font-size: 2.3em; line-height: 1; margin-top: 0.05em; }
.holemeta { display: flex; flex-direction: column; justify-content: center; gap: 0.25em; }
.holemeta .name { font-family: var(--serif); font-style: italic; font-size: 1.32em; color: var(--ink); white-space: nowrap; }
.holemeta .line { font-size: 0.92em; color: var(--ink-2); letter-spacing: 0.02em; white-space: nowrap; }
.holemeta .line b { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.holemeta .line i { font-style: normal; margin: 0 0.45em; color: var(--brass); }

.scorecard { top: 2.4vh; right: 1.8vw; padding: 0.55em 0.75em; }
table { border-collapse: collapse; font-variant-numeric: tabular-nums; }
.scorecard th, .scorecard td { padding: 0.24em 0.62em; text-align: center; font-size: 0.95em; }
.scorecard th { text-align: left; font-weight: 600; font-size: 0.72em; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-2); }
.scorecard tr + tr { border-top: 1px solid var(--rule); }
.scorecard tr.head td { font-weight: 700; color: var(--ink); }
.scorecard tr > :last-child { border-left: 1px solid var(--rule); text-align: center; color: var(--ink); font-size: 0.95em; letter-spacing: 0; text-transform: none; font-weight: 700; }
.scorecard tr.head > :last-child { font-size: 0.72em; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-2); font-weight: 600; }
.scorecard tr.par td { color: var(--ink-2); }
.you td span, .bigcard .you td span { display: inline-grid; place-items: center; min-width: 1.55em; height: 1.55em; font-family: var(--serif); font-weight: 700; color: var(--ink); }
.you td span[data-score="under"] { border: 1.5px solid var(--red); border-radius: 50%; color: var(--red); }
.you td span[data-score="ace"] { border: 1.5px solid var(--red); border-radius: 50%; color: #fff; background: var(--red); }
.you td span[data-score="over"] { border: 1.5px solid var(--ink-2); border-radius: 0.15em; }
.you td span[data-now] { background: rgba(185, 138, 60, 0.18); border-radius: 0.3em; }

.power {
  position: absolute; left: 50%; bottom: 3.2vh; transform: translateX(-50%); display: flex; align-items: center; gap: 0.8em;
  padding: 0.55em 1.1em; border-radius: 999px; background: rgba(31, 59, 42, 0.72); color: #f6efdc; backdrop-filter: blur(8px);
  opacity: 0; transition: opacity 0.25s ease;
}
.power[data-on="1"] { opacity: 1; }
.power .lbl { font-size: 0.72em; letter-spacing: 0.2em; text-transform: uppercase; color: #d8c48f; font-weight: 600; }
.power .bar { position: relative; width: 14em; height: 0.5em; border-radius: 1em; background: rgba(255, 255, 255, 0.18); overflow: hidden; }
.power .bar i { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 1em; background: linear-gradient(90deg, #f3e7c4, #ffc061 60%, #ff7a4d); }

.toast {
  position: absolute; top: 20%; left: 50%; transform: translate(-50%, 0); display: grid; justify-items: center; gap: 0.2em;
  color: #fffaf0; white-space: nowrap; opacity: 0; pointer-events: none; text-align: center;
  text-shadow: 0 0 1.2em rgba(255, 190, 90, 0.75), 0 2px 12px rgba(40, 20, 0, 0.45);
}
.toast span { font-family: var(--serif); font-size: clamp(30px, 3.6vw, 64px); line-height: 1.05; }
.toast small { font-size: clamp(13px, 1.05vw, 18px); letter-spacing: 0.22em; text-transform: uppercase; font-weight: 600; color: #ffe2a8; }
.toast small:empty { display: none; }
.toast.warn { text-shadow: 0 0 1.2em rgba(90, 160, 220, 0.75), 0 2px 12px rgba(0, 20, 40, 0.5); }
.toast.on { animation: toast 2s ease-out; }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, 14px) scale(0.9); } 10% { opacity: 1; transform: translate(-50%, 0) scale(1.05); } 18% { transform: translate(-50%, 0) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -14px); } }

.screen { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 1.3vh; padding: 24px; text-align: center; }
.screen p { margin: 0; }
.screen-title { color: #fffaf0; text-shadow: 0 2px 22px rgba(50, 26, 4, 0.55); background: radial-gradient(ellipse 70% 62% at 50% 46%, rgba(40, 22, 6, 0.46), rgba(40, 22, 6, 0.1) 70%, rgba(40, 22, 6, 0) 100%); }
.kicker { font-size: clamp(12px, 1vw, 17px); letter-spacing: 0.34em; text-transform: uppercase; color: var(--sun); font-weight: 600; }
.screen-title h1 { margin: 0 0 0.4vh; font-family: var(--serif); font-size: clamp(50px, 6.8vw, 120px); line-height: 1.08; font-weight: 400; letter-spacing: -0.02em; }
.tagline { font-size: clamp(15px, 1.3vw, 22px); color: rgba(255, 250, 240, 0.9); max-width: 34em; }
.keys { color: rgba(255, 250, 240, 0.78); font-size: clamp(12px, 0.9vw, 15px); max-width: 60em; }
.meta { color: var(--sun); font-size: clamp(12px, 0.85vw, 14px); letter-spacing: 0.12em; text-transform: uppercase; }
.meta span + span::before { content: "· "; color: rgba(255, 255, 255, 0.5); }
.meta span:empty, .meta span:empty + span::before { display: none; }
.loading { font-size: 16px; letter-spacing: 0.2em; text-transform: uppercase; color: #e9dcc0; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.4; } }

#app > .panel {
  inset: auto; top: 50%; left: 50%; transform: translate(-50%, -50%);
  min-width: min(480px, 88vw); padding: 34px 46px 30px; border-radius: 18px;
  background: var(--card); color: var(--ink);
  box-shadow: 0 30px 80px rgba(30, 16, 2, 0.5), 0 0 0 1px rgba(31, 59, 42, 0.14);
}
.panel h2 { margin: 0 0 6px; font-family: var(--serif); font-size: clamp(30px, 3vw, 48px); font-weight: 400; }
.panel .keys { color: var(--ink-2); }
.bigcard { margin: 8px 0 4px; font-size: clamp(15px, 1.25vw, 20px); }
.bigcard th, .bigcard td { padding: 0.4em 0.9em; text-align: center; }
.bigcard th { font-size: 0.7em; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-2); text-align: left; }
.bigcard tr + tr { border-top: 1px solid var(--rule); }
.bigcard tr > :last-child { border-left: 1px solid var(--rule); font-family: var(--serif); font-size: 1.1em; letter-spacing: 0; text-transform: none; color: var(--ink); text-align: center; }
.bigcard tr.head > :last-child { font-family: var(--ui); font-size: 0.7em; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-2); }
.verdict { font-size: clamp(14px, 1.1vw, 18px); color: var(--ink-2); letter-spacing: 0.08em; text-transform: uppercase; }
.verdict b { font-family: var(--serif); font-size: 1.9em; color: var(--ink); text-transform: none; margin-left: 0.3em; letter-spacing: 0; }
.best { color: var(--brass); font-weight: 600; letter-spacing: 0.06em; }

.cta {
  margin-top: 1.4vh; font: inherit; font-size: clamp(14px, 1.1vw, 19px); font-weight: 600; letter-spacing: 0.04em;
  color: #f6efdc; background: var(--ink); border: 0; border-radius: 999px; padding: 0.85em 2.1em;
  cursor: pointer; text-shadow: none; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.25) inset, 0 0.6em 2em rgba(20, 40, 20, 0.35);
}
.screen-title .cta { background: linear-gradient(#ffe2a8, #ffc061); color: #2a1606; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35) inset, 0 0.6em 2em rgba(255, 170, 70, 0.4); }
.cta:focus-visible { outline: 3px solid #fff; outline-offset: 5px; }

.status {
  position: absolute; left: 50%; bottom: 2.6vh; transform: translateX(-50%); margin: 0; padding: 0.5em 1.2em;
  max-width: calc(100% - 24px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-radius: 999px;
  font-size: clamp(12px, 0.9vw, 15px); background: rgba(248, 242, 228, 0.82); color: var(--ink); backdrop-filter: blur(10px); pointer-events: none;
}
.is-capturing .status, .status:empty, .status[data-hide="1"] { display: none; }

.flash { position: absolute; inset: 0; pointer-events: none; opacity: 0; background: radial-gradient(ellipse at center, rgba(255, 220, 150, 0) 40%, rgba(255, 220, 150, 0.35)); }
.flash.on { animation: flash 0.7s ease-out; }
@keyframes flash { from { opacity: 1; } to { opacity: 0; } }

.touch-pause { position: absolute; right: 18px; bottom: 18px; width: 46px; height: 46px; border: 0; border-radius: 50%; background: rgba(248, 242, 228, 0.8); color: var(--ink); font: 600 14px var(--ui); }

@media (prefers-reduced-motion: reduce) { .loading { animation: none; } }
