:root { --ink: #173B2C; --cream: #FFFBEF; --flag: #E8453C; --sun: #FFC531; --disp: "Rammetto One", "Arial Black", sans-serif; --body: "Figtree", system-ui, sans-serif; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { background: linear-gradient(180deg, #8FD3F4 0%, #C5ECFA 45%, #E9F8E0 100%); color: var(--ink); font-family: var(--body); font-weight: 700; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
body[data-theme="tide"] { background: linear-gradient(180deg, #7CC8E8 0%, #BDE8F3 45%, #FBEFD4 100%); }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
svg { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
button { font: inherit; color: inherit; cursor: pointer; }
#stage { position: fixed; inset: 0; }
#stage canvas { display: block; }

.top { position: fixed; z-index: 5; top: 0; left: 0; right: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left)); pointer-events: none; }
.top > * { pointer-events: auto; }
.sign { padding: 6px 12px; border-radius: 999px; background: var(--ink); color: var(--cream); font-size: 13px; text-decoration: none; }
.hole { padding: 5px 14px 6px; border-radius: 16px; background: var(--cream); box-shadow: 0 4px 0 rgba(23,59,44,.25); }
.hole small { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .12em; opacity: .65; }
.hole div { display: flex; align-items: center; gap: 7px; }
.hole svg { width: 18px; height: 18px; color: var(--flag); stroke-width: 2.4; }
.hole b { font-family: var(--disp); font-weight: 400; font-size: 20px; line-height: 1.1; }
.hole span { font-size: 15px; white-space: nowrap; }
.score { display: flex; gap: 6px; }
.score span { display: flex; flex-direction: column; align-items: center; min-width: 58px; padding: 4px 10px; border-radius: 14px; background: rgba(255,251,239,.9); box-shadow: 0 4px 0 rgba(23,59,44,.2); }
.score small { font-size: 10px; text-transform: uppercase; letter-spacing: .12em; opacity: .65; }
.score b { font-family: var(--disp); font-weight: 400; font-size: 20px; line-height: 1.1; }
.tools { margin-left: auto; display: flex; gap: 8px; }
.ib { width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 14px; background: var(--cream); color: var(--ink); box-shadow: 0 4px 0 rgba(23,59,44,.25); }
.ib svg { width: 21px; height: 21px; }
.ib:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(23,59,44,.25); }
.mute .offi { display: none; } .mute.off .on { display: none; } .mute.off .offi { display: block; }
.hint { position: fixed; z-index: 5; left: 50%; bottom: max(12px, env(safe-area-inset-bottom)); transform: translateX(-50%); margin: 0; padding: 6px 14px; border-radius: 999px; background: rgba(23,59,44,.75); color: var(--cream); font-size: 13.5px; font-weight: 600; white-space: nowrap; pointer-events: none; }
.powerbox { position: fixed; z-index: 6; left: 50%; bottom: max(48px, calc(env(safe-area-inset-bottom) + 40px)); transform: translateX(-50%); width: min(60vw, 260px); height: 14px; border-radius: 999px; background: rgba(23,59,44,.35); overflow: hidden; pointer-events: none; }
.powerbox i { display: block; height: 100%; background: linear-gradient(90deg, #4CD964, var(--sun), var(--flag)); transform-origin: left; transform: scaleX(0); }
.toast { position: fixed; z-index: 7; left: 50%; top: 26%; transform: translateX(-50%); margin: 0; padding: 8px 20px; border-radius: 999px; background: var(--cream); color: var(--ink); font-family: var(--disp); font-size: 20px; pointer-events: none; box-shadow: 0 5px 0 rgba(23,59,44,.25); animation: tin .35s cubic-bezier(.3,1.6,.5,1); white-space: nowrap; }
.toast.big { font-size: 34px; background: var(--sun); padding: 12px 28px; }
@keyframes tin { from { opacity: 0; transform: translate(-50%, 10px) scale(.8); } }

.card { position: fixed; z-index: 9; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(88vw, 360px); padding: 24px 22px 20px; text-align: center; border-radius: 26px; background: var(--cream); box-shadow: 0 8px 0 rgba(23,59,44,.22), 0 30px 70px rgba(23,59,44,.3); animation: in .4s cubic-bezier(.3,1.5,.5,1); }
@keyframes in { from { transform: translate(-50%, -42%) scale(.92); opacity: 0; } }
.card h2 { margin: 0 0 8px; font-family: var(--disp); font-weight: 400; font-size: 28px; line-height: 1.1; }
.card p { margin: 0 0 16px; font-weight: 500; line-height: 1.4; }
.card .kicker { margin: 0 0 4px; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: #5D7B6B; }
.btn { display: block; width: 100%; margin-top: 8px; padding: 13px; border: 0; border-radius: 16px; background: var(--flag); color: #fff; font-family: var(--disp); font-size: 19px; box-shadow: 0 4px 0 #A42B24; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #A42B24; }
.btn.ghost { background: #E7EFE0; color: var(--ink); box-shadow: 0 4px 0 #C4D3BA; font-family: var(--body); font-weight: 800; font-size: 16px; }
.btn:focus-visible, .ib:focus-visible, .sign:focus-visible, .node:focus-visible, .course:focus-visible { outline: 3px dashed var(--flag); outline-offset: 3px; }
.card.menu { width: min(92vw, 420px); }
.logo { margin: 0; font-family: var(--disp); font-weight: 400; font-size: 44px; line-height: .95; color: var(--flag); transform: rotate(-3deg); }
.logo span { display: block; color: var(--ink); font-size: 38px; }
.tag { margin: 12px 0 14px !important; }
#courses { display: grid; gap: 10px; }
.course { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 14px 16px; border: 0; border-radius: 18px; text-align: left; color: #fff; box-shadow: 0 5px 0 rgba(0,0,0,.2); }
.course.c0 { background: linear-gradient(135deg, #58B947, #2E8B45); }
.course.c1 { background: linear-gradient(135deg, #36B3C9, #1C7C9C); }
.course b { font-family: var(--disp); font-weight: 400; font-size: 21px; }
.course span { font-weight: 600; font-size: 14px; opacity: .92; }
.course em { font-style: normal; font-size: 13px; padding: 2px 9px; margin-top: 4px; border-radius: 999px; background: rgba(0,0,0,.2); }
.course:disabled { filter: grayscale(.8); opacity: .55; cursor: default; }
.card.wide { width: min(94vw, 520px); }
.cardwrap { overflow-x: auto; margin: 4px 0 12px; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
td { padding: 6px 4px; text-align: center; font-size: 15px; border-bottom: 1px solid #E3E9DA; }
tr.head td { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #5D7B6B; }
tr td:first-child { text-align: left; font-weight: 800; }
tr.par td { color: #5D7B6B; }
tr.me td { font-family: var(--disp); font-weight: 400; font-size: 16px; }
td.under { color: #fff; background: #3FA34D; border-radius: 50%; }
td.over { color: var(--flag); }
.card.map { width: min(94vw, 460px); max-height: 86vh; overflow: auto; text-align: left; }
.card.map h2 { text-align: center; }
.card.map h3 { margin: 12px 0 6px; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: #5D7B6B; }
.card .x { position: absolute; right: 12px; top: 12px; width: 36px; height: 36px; display: grid; place-items: center; border: 0; background: none; }
.card .small { margin: 12px 0 0; font-size: 13px; color: #5D7B6B; text-align: center; }
.mrow { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 5px; }
.node { aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 0; border: 0; border-radius: 50%; background: #E7EFE0; font-family: var(--disp); font-size: 14px; }
.node em { display: flex; gap: 1px; } .node em i { width: 6px; height: 6px; clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); background: #C4D3BA; }
.node em i.on { background: #E0A100; }
.node.cur { background: var(--flag); color: #fff; }
.node:disabled { opacity: .35; cursor: default; }

.ogmark { display: none; }
body.og #stage { left: 40%; }
body.og .ogmark { display: block; position: fixed; z-index: 8; left: 5%; top: 50%; transform: translateY(-50%) rotate(-3deg); }
body.og .ogmark h1 { margin: 0; font-family: var(--disp); font-weight: 400; font-size: 100px; line-height: .95; color: var(--flag); text-shadow: 0 6px 0 rgba(23,59,44,.18); }
body.og .ogmark p { margin: 16px 0 0; font-size: 28px; }
body.demo .top, body.demo .hint, body.demo .card, body.demo .toast, body.demo .powerbox { display: none !important; }
@media (max-width: 620px) {
  .sign { display: none; }
  .hole span { display: none; }
  .score span { min-width: 48px; padding: 3px 7px; }
  .ib { width: 40px; height: 40px; }
  .tools { gap: 6px; }
}
@media (prefers-reduced-motion: reduce) { .card, .toast { animation: none; } }
