@font-face {
  font-family: 'Sora';
  src: url('./fonts/Sora-VF.subset.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'Figtree';
  src: url('./fonts/Figtree-VF.subset.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --navy: #26224d;
  --deep: #1b1838;
  --cream: #fffaf0;
  --red: #e8574a;
  --yellow: #ffd35c;
  --amber: #ffb020;
  --green: #3f9a57;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overflow: hidden; background: #1b1838; }
body { font-family: 'Figtree', system-ui, sans-serif; color: var(--navy); }
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#ui { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#ui button { pointer-events: auto; }

.hidden { display: none !important; }

/* ---------- buttons & cards ---------- */
.btn {
  font-family: 'Sora', sans-serif; font-weight: 700; font-size: 19px;
  color: var(--navy); background: var(--cream);
  border: 3px solid var(--navy); border-radius: 16px;
  padding: 13px 22px; min-width: 240px; cursor: pointer;
  box-shadow: 0 4px 0 var(--navy);
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--navy); }
.btn.primary { background: linear-gradient(180deg, var(--yellow), var(--amber)); font-size: 22px; }
.card {
  background: var(--cream); border: 3px solid var(--navy); border-radius: 22px;
  box-shadow: 0 6px 0 rgba(27, 24, 56, 0.9);
  padding: 22px 26px; text-align: center;
}
.overlay {
  position: fixed; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px;
  pointer-events: auto; padding: 20px;
}

/* ---------- menu ---------- */
#menu { justify-content: flex-start; padding-top: 9vh; }
.logo { width: 92px; height: 74px; filter: drop-shadow(0 3px 0 rgba(27,24,56,.55)); }
#menu h1 {
  font-family: 'Sora', sans-serif; font-weight: 800; font-size: 44px; line-height: 0.98;
  color: #ffffff; text-align: center; letter-spacing: -0.5px;
  -webkit-text-stroke: 2px var(--navy);
  text-shadow: 0 4px 0 var(--navy);
}
#menu h1 .isles { display: block; color: var(--yellow); font-size: 58px; }
.tagline {
  background: var(--deep); color: #fff; font-weight: 600; font-size: 16.5px;
  border-radius: 14px; padding: 12px 18px; max-width: 330px; text-align: center;
  box-shadow: 0 4px 0 rgba(27,24,56,.6); margin: 6px 0 10px;
}
.menu-btns { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.credits {
  position: fixed; bottom: 8px; left: 0; right: 0; text-align: center;
  color: rgba(255,255,255,.92); font-size: 11.5px; font-weight: 500;
  text-shadow: 0 1px 3px rgba(0,0,0,.8); pointer-events: none; line-height: 1.5;
}

/* ---------- HUD ---------- */
#hud { position: fixed; top: calc(8px + env(safe-area-inset-top)); left: 10px; right: 10px;
  display: flex; align-items: flex-start; gap: 8px; }
.hole-chip {
  background: linear-gradient(180deg, #ff7a5c, var(--red));
  border: 3px solid var(--navy); border-radius: 16px; color: #fff;
  padding: 4px 12px 6px; text-align: center; box-shadow: 0 3px 0 var(--navy);
  font-family: 'Sora', sans-serif;
}
.hole-chip .lbl { font-size: 10px; font-weight: 700; letter-spacing: 2px; }
.hole-chip .num { font-size: 30px; font-weight: 800; line-height: 1; }
.strokes-pill {
  flex: 1; max-width: 250px; background: var(--cream); border: 3px solid var(--navy);
  border-radius: 999px; padding: 7px 16px; display: flex; align-items: center; gap: 9px;
  box-shadow: 0 3px 0 var(--navy); font-family: 'Sora', sans-serif;
}
.strokes-pill .lbl { font-size: 12px; font-weight: 700; letter-spacing: 1.5px; color: #6a6790; }
.strokes-pill .num {
  font-size: 20px; font-weight: 800; border: 2.5px solid var(--navy); border-radius: 50%;
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
}
.strokes-pill .dots { display: flex; gap: 4px; margin-left: auto; }
.strokes-pill .dot { width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--navy); }
.strokes-pill .dot.on { background: var(--green); }
.total-pill {
  position: absolute; top: 64px; left: 118px;
  background: var(--deep); color: #fff; border-radius: 999px; padding: 4px 14px;
  font-family: 'Sora', sans-serif; font-weight: 700; font-size: 14px;
  box-shadow: 0 3px 0 rgba(27,24,56,.55);
}
.total-pill b { color: var(--yellow); }
#btn-pause {
  margin-left: auto; width: 48px; height: 48px; border-radius: 14px;
  background: var(--cream); border: 3px solid var(--navy); box-shadow: 0 3px 0 var(--navy);
  font-size: 17px; color: var(--navy); cursor: pointer; font-weight: 800;
}

/* ---------- intro card ---------- */
#intro { background: transparent; pointer-events: none; }
#intro .card { min-width: 272px; max-width: 320px; }
.chip {
  display: inline-block; background: var(--red); color: #fff; font-family: 'Sora', sans-serif;
  font-weight: 700; font-size: 13px; letter-spacing: 1.5px; padding: 4px 14px;
  border-radius: 999px; border: 2.5px solid var(--navy); margin-bottom: 8px;
}
#intro .name { font-family: 'Sora', sans-serif; font-weight: 800; font-size: 33px; line-height: 1.05; }
#intro .par { color: var(--green); font-family: 'Sora', sans-serif; font-weight: 800; font-size: 19px; margin-top: 4px; }
#intro .tip { color: #6a6790; font-size: 15.5px; margin-top: 6px; font-weight: 500; }

/* ---------- scorecard ---------- */
#card-wrap { background: rgba(27, 24, 56, 0.45); }
.score-name { font-family: 'Sora', sans-serif; font-weight: 800; font-size: 30px; margin-bottom: 2px; }
.score-sub { color: #6a6790; font-weight: 600; margin-bottom: 12px; }
table.score { border-collapse: collapse; margin: 0 auto 16px; font-family: 'Sora', sans-serif; }
table.score th, table.score td {
  border: 2.5px solid var(--navy); padding: 6px 13px; font-size: 16px; min-width: 44px;
}
table.score th { background: var(--deep); color: #fff; font-size: 12px; letter-spacing: 1px; }
table.score td.par-row { color: #6a6790; font-weight: 600; }
table.score td.total { font-weight: 800; background: #fff1cf; }

/* ---------- orbit knob / power / toast ---------- */
#knob {
  position: fixed; left: 18px; bottom: calc(20px + env(safe-area-inset-bottom));
  width: 104px; height: 104px; border-radius: 50%;
  border: 3px solid var(--navy); background: rgba(255, 250, 240, 0.88);
  box-shadow: 0 4px 0 rgba(27,24,56,.8); pointer-events: auto; touch-action: none;
}
#knob-inner {
  position: absolute; left: 50%; top: 50%; width: 48px; height: 48px; margin: -24px 0 0 -24px;
  border-radius: 50%; border: 3px solid var(--navy); background: var(--cream);
  display: flex; align-items: center; justify-content: center;
}
#knob-inner svg { width: 26px; height: 26px; }
#power {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(24px + env(safe-area-inset-bottom));
  background: var(--deep); color: #fff; border-radius: 999px; padding: 7px 16px;
  font-family: 'Sora', sans-serif; font-weight: 700; font-size: 14px; letter-spacing: 1px;
  display: flex; align-items: center; gap: 10px;
}
#power .bar { width: 110px; height: 10px; border-radius: 5px; background: rgba(255,255,255,.25); overflow: hidden; }
#power .fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--yellow), var(--red)); }
#toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 15vh;
  background: var(--deep); color: #fff; padding: 10px 20px; border-radius: 999px;
  font-weight: 600; font-size: 15.5px; box-shadow: 0 4px 0 rgba(27,24,56,.6);
  opacity: 0; transition: opacity .25s; pointer-events: none; white-space: nowrap;
}
#toast.show { opacity: 1; }

.text-page { max-width: 330px; text-align: left; line-height: 1.55; font-size: 15.5px; }
.text-page h2 { font-family: 'Sora', sans-serif; font-size: 22px; margin-bottom: 8px; text-align: center; }
.text-page p { margin-bottom: 8px; }
