/* Steady Hand: a quiet HUD over a warm study. Smoked glass, cream ink, brass for what matters;
   Libre Baskerville for names, Geist with tabular figures for numbers. */
:root {
  --ink: #f6eee2;
  --dim: rgba(246, 238, 226, 0.62);
  --line: rgba(255, 236, 205, 0.16);
  --glass: rgba(22, 15, 10, 0.46);
  --brass: #d6a24e;
  --brass-hi: #f3cf8a;
  --red: #ff6b54;
  --ui: var(--kit-grotesk);
  --serif: var(--kit-serif);
  color-scheme: dark;
}

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

html, body {
  margin: 0;
  height: 100%;
  background: #120c08;
  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%; }

.num { font-family: var(--ui); font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; letter-spacing: 0.01em; }

/* HUD */
.hud { position: absolute; inset: 0; pointer-events: none; font-size: clamp(11px, 0.92vw, 16px); }
.glass {
  position: absolute;
  padding: 0.8em 1.1em 0.85em;
  border-radius: 0.9em;
  background: var(--glass);
  backdrop-filter: blur(16px) saturate(1.25);
  -webkit-backdrop-filter: blur(16px) saturate(1.25);
  box-shadow: inset 0 0 0 1px var(--line), 0 0.7em 2em rgba(0, 0, 0, 0.32);
}
.label { font-size: 0.74em; font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase; color: var(--dim); }
.label .num { letter-spacing: 0.06em; color: var(--brass-hi); }

.board-card { top: 2.4vh; left: 1.8vw; display: grid; gap: 0.2em; min-width: 12.5em; }
.board-card .name { font-family: var(--serif); font-size: 1.55em; line-height: 1.15; color: var(--ink); }

.time-card { top: 2.4vh; left: 50%; transform: translateX(-50%); display: grid; justify-items: center; gap: 0.1em; padding: 0.6em 1.5em 0.7em; }
.time-card .big { font-size: 2.1em; font-weight: 500; line-height: 1.05; color: var(--ink); }

.holes-card { top: 2.4vh; right: 1.8vw; display: grid; gap: 0.5em; min-width: 13em; }
.holes-card .row { display: flex; align-items: center; justify-content: space-between; gap: 1.4em; }
.holes-card .row .num { font-size: 1.25em; color: var(--ink); }
.balls { display: flex; gap: 0.42em; }
.balls i {
  width: 1.05em; height: 1.05em; border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #ffffff 0 8%, #d9dde2 18%, #7c8189 52%, #2b2e33 78%, #8a8f96 100%);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  transition: opacity 0.3s, transform 0.3s;
}
.balls i.gone { opacity: 0.18; transform: scale(0.72); filter: grayscale(1); }
.balls i.pop { animation: pop 0.6s ease-out; }
@keyframes pop { 0% { transform: scale(1.6); } 100% { transform: scale(1); } }
.bar { height: 0.32em; border-radius: 1em; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, #a8742c, var(--brass), var(--brass-hi)); box-shadow: 0 0 0.6em rgba(214, 162, 78, 0.6); }

.level-card { left: 1.8vw; bottom: 3vh; display: flex; align-items: center; gap: 0.8em; padding: 0.6em 1em 0.6em 0.6em; }
.vial { position: relative; width: 3.6em; height: 3.6em; border-radius: 50%; background: radial-gradient(circle at 50% 45%, rgba(214, 236, 160, 0.42), rgba(120, 150, 70, 0.28) 70%, rgba(40, 50, 20, 0.5)); box-shadow: inset 0 0 0 1.5px rgba(243, 207, 138, 0.75), inset 0 0.3em 0.8em rgba(0, 0, 0, 0.4); overflow: hidden; }
.vial .cross { position: absolute; inset: 0; background: linear-gradient(var(--line), var(--line)) 50% 0 / 1px 100% no-repeat, linear-gradient(var(--line), var(--line)) 0 50% / 100% 1px no-repeat; }
.vial .ring { position: absolute; left: 50%; top: 50%; width: 1.5em; height: 1.5em; margin: -0.75em 0 0 -0.75em; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(30, 20, 10, 0.75); }
.vial .bubble { position: absolute; left: 50%; top: 50%; width: 1.15em; height: 1.15em; margin: -0.575em 0 0 -0.575em; border-radius: 50%; background: radial-gradient(circle at 38% 34%, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.35) 45%, rgba(255, 255, 255, 0.12) 70%); box-shadow: 0 0 0.3em rgba(255, 255, 240, 0.5); will-change: transform; }

.toast {
  position: absolute; top: 19%; left: 50%; transform: translate(-50%, 0);
  font: 400 clamp(20px, 2.1vw, 36px)/1.2 var(--serif); color: #fff; white-space: nowrap;
  text-shadow: 0 0 1.2em rgba(214, 162, 78, 0.85), 0 2px 12px rgba(0, 0, 0, 0.7);
  opacity: 0; pointer-events: none;
}
.toast.warn { text-shadow: 0 0 1.2em rgba(255, 107, 84, 0.85), 0 2px 12px rgba(0, 0, 0, 0.7); }
.toast.on { animation: toast 1.6s ease-out; }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, 12px) scale(0.94); } 12% { opacity: 1; transform: translate(-50%, 0) scale(1.03); } 78% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -16px) scale(1); } }

/* Screens */
.screen { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 1.3vh; padding: 24px; text-align: center; text-shadow: 0 2px 18px rgba(0, 0, 0, 0.75); }
.screen p { margin: 0; }
.screen-title { background: radial-gradient(ellipse 66% 58% at 50% 48%, rgba(14, 9, 6, 0.62), rgba(14, 9, 6, 0.22) 70%, rgba(14, 9, 6, 0) 100%); }
.kicker { font-size: clamp(12px, 1vw, 17px); letter-spacing: 0.32em; text-transform: uppercase; color: var(--brass-hi); font-weight: 600; }
.screen-title h1 { margin: 0.1em 0 0.15em; font: 400 clamp(56px, 7.6vw, 132px)/1.12 var(--serif); letter-spacing: -0.02em; color: #fff; }
.tagline { font-size: clamp(15px, 1.3vw, 22px); color: rgba(255, 248, 236, 0.88); max-width: 32em; }
.keys { color: rgba(255, 248, 236, 0.7); font-size: clamp(12px, 0.9vw, 15px); }
.meta { color: var(--brass-hi); 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: var(--dim); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.4; } }

#app > .card {
  inset: auto; top: 50%; left: 50%; transform: translate(-50%, -50%);
  min-width: min(480px, 88vw); padding: 34px 46px 30px; border-radius: 22px;
  background: rgba(20, 13, 9, 0.8); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  box-shadow: inset 0 0 0 1px var(--line), 0 30px 80px rgba(0, 0, 0, 0.6);
}
.card h2 { margin: 0 0 6px; font: 400 clamp(30px, 3.1vw, 52px)/1.15 var(--serif); }
.big { font-size: clamp(20px, 1.9vw, 30px); color: var(--brass-hi); font-variant-numeric: tabular-nums; }

.cta {
  margin-top: 1.6vh; font: inherit; font-size: clamp(14px, 1.1vw, 19px); font-weight: 600; letter-spacing: 0.04em;
  color: #1c1208; background: linear-gradient(#f3cf8a, #c99140); 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.35) inset, 0 0.6em 2em rgba(214, 162, 78, 0.35);
}
.cta:focus-visible { outline: 3px solid #fff; outline-offset: 5px; }

.status {
  position: absolute; left: 50%; bottom: 3vh; 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: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: inset 0 0 0 1px var(--line); pointer-events: none;
}
.is-capturing .status, .status:empty { display: none; }

.flash { position: absolute; inset: 0; pointer-events: none; opacity: 0; background: radial-gradient(ellipse at center, rgba(255, 107, 84, 0) 45%, rgba(255, 90, 60, 0.42)); }
.flash.gold { background: radial-gradient(ellipse at center, rgba(255, 210, 120, 0.2), rgba(214, 162, 78, 0.35)); }
.flash.on { animation: flash 0.6s ease-out; }
@keyframes flash { from { opacity: 1; } to { opacity: 0; } }

.touch-pause { position: absolute; right: 20px; bottom: 20px; width: 46px; height: 46px; border: 0; border-radius: 50%; font: inherit; font-size: 14px; color: #111; background: rgba(255, 255, 255, 0.6); }
