/* Mini Golf Mountain: sunny alpine glass UI. Type scales from phones to 4K TVs; focus rings are always visible. */
:root {
  --ink: #f6fbff; --muted: #b8cfe2; --gold: #ffd25a; --gold-2: #ffe28f; --mint: #6fe38a; --coral: #ff7a59; --sky: #8fd3ff;
  --glass: rgba(12, 30, 46, .58); --glass-2: rgba(255, 255, 255, .1); --line: rgba(255, 255, 255, .22); --panel: rgba(10, 26, 40, .82);
  --font: "Trebuchet MS", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px); --safe-r: env(safe-area-inset-right, 0px); --safe-b: env(safe-area-inset-bottom, 0px); --safe-l: env(safe-area-inset-left, 0px);
}
* { box-sizing: border-box; }
html { font-size: clamp(13px, 0.55vw + 9px, 30px); }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0d2236; color: var(--ink); font-family: var(--font); -webkit-font-smoothing: antialiased; overscroll-behavior: none; }
#game-container { position: fixed; inset: 0; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
#viewport { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; cursor: crosshair; }
.startup-warning, #startup-warning { position: absolute; left: 50%; top: 40%; transform: translateX(-50%); max-width: 32rem; padding: 1.2rem 1.4rem; border-radius: 1rem; background: rgba(120, 20, 20, .92); color: #fff; z-index: 50; text-align: center; line-height: 1.4; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid #fff; outline-offset: 3px; box-shadow: 0 0 0 6px rgba(255, 210, 90, .65); }
kbd { font: inherit; font-size: .8em; padding: .08rem .38rem; margin: 0 .1rem; border-radius: .35rem; background: rgba(255, 255, 255, .16); border: 1px solid var(--line); border-bottom-width: 2px; }

/* HUD */
#hud { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .35s; }
#game-container.playing #hud { opacity: 1; }
.hud-top { position: absolute; top: calc(var(--safe-t) + .65rem); left: calc(var(--safe-l) + .75rem); right: calc(var(--safe-r) + .75rem); display: flex; flex-wrap: wrap; gap: .5rem; align-items: stretch; }
.pill { pointer-events: none; display: flex; flex-direction: column; justify-content: center; padding: .35rem .8rem; min-height: 2.75rem; border-radius: .9rem; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(10px) saturate(130%); -webkit-backdrop-filter: blur(10px) saturate(130%); box-shadow: 0 .4rem 1.2rem rgba(0, 0, 0, .25); }
.pill .label, .label { font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.pill strong { font-size: 1.12rem; line-height: 1.15; }
.stat-pill strong { font-size: 1.3rem; text-align: center; }
.hud-actions { margin-left: auto; display: flex; gap: .4rem; pointer-events: auto; }
.icon-btn { width: 2.75rem; height: 2.75rem; min-width: 44px; min-height: 44px; display: grid; place-items: center; border-radius: .9rem; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); padding: 0; transition: background .15s, transform .12s; }
.icon-btn:hover { background: rgba(255, 255, 255, .22); }
.icon-btn:active { transform: scale(.94); }
.icon-btn svg { width: 1.35rem; height: 1.35rem; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn .mute { display: none; stroke: var(--coral); }
.icon-btn[aria-pressed="false"] .mute { display: block; }
.icon-btn[aria-pressed="false"] .wave { display: none; }
#btn-view[aria-pressed="true"] { background: rgba(255, 210, 90, .3); border-color: var(--gold); }
#btn-view[aria-pressed="false"] .mute { display: none; }



/* Swing dock: aim buttons either side of the swing meter */
#swing-dock { position: absolute; left: 50%; bottom: calc(var(--safe-b) + 1rem); transform: translate(-50%, 1.2rem); width: min(44rem, calc(100% - 1.2rem)); display: flex; align-items: center; gap: .7rem; opacity: 0; pointer-events: none; transition: opacity .2s, transform .25s; }
#swing-dock.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.aim-btn { flex: none; width: 3.6rem; height: 3.6rem; min-width: 52px; min-height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); padding: 0; touch-action: none; transition: background .12s, transform .1s; }
.aim-btn:active { background: rgba(255, 210, 90, .35); transform: scale(.94); }
.aim-btn svg { width: 1.7rem; height: 1.7rem; fill: none; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
#swing { flex: 1; min-width: 0; padding: .55rem .9rem .6rem; border-radius: 1.1rem; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); cursor: pointer; user-select: none; box-shadow: 0 .5rem 1.6rem rgba(0, 0, 0, .3); transition: border-color .15s, box-shadow .15s; }
#swing.snap { border-color: var(--mint); box-shadow: 0 0 0 .25rem rgba(111, 227, 138, .45), 0 .5rem 1.6rem rgba(0, 0, 0, .35); }
#swing[data-step="power"], #swing[data-step="accuracy"] { border-color: var(--gold); box-shadow: 0 0 0 .2rem rgba(255, 210, 90, .3), 0 .5rem 1.6rem rgba(0, 0, 0, .35); }
.swing-top { margin-bottom: .55rem; }
#swing-label { font-weight: 800; font-size: 1.05rem; }
#swing-dist { color: var(--muted); font-size: .8rem; font-weight: 700; white-space: nowrap; }
.swing-bar { position: relative; height: 1.15rem; border-radius: 1rem; background: rgba(255, 255, 255, .14); border: 1px solid var(--line); overflow: visible; }
#swing-late { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 1rem 0 0 1rem; background: repeating-linear-gradient(135deg, rgba(255, 90, 74, .55) 0 4px, rgba(255, 90, 74, .25) 4px 8px); }
#swing-fill { position: absolute; top: 0; bottom: 0; border-radius: 1rem; background: linear-gradient(90deg, #6fe38a, #ffd25a 60%, #ff5a4a); background-size: 100% 100%; min-width: 0; }
#swing-zero { position: absolute; top: -.2rem; bottom: -.2rem; width: .22rem; margin-left: -.11rem; border-radius: 1px; background: #fff; box-shadow: 0 0 .4rem rgba(255, 255, 255, .8); }
#swing:not(.pro) #swing-zero { display: none; }
#swing-mark { position: absolute; top: -.62rem; width: 0; height: 0; }
#swing-mark i { position: absolute; left: -.45rem; top: 0; width: .9rem; height: .9rem; background: var(--gold); clip-path: polygon(0 0, 100% 0, 50% 100%); filter: drop-shadow(0 0 .25rem rgba(0, 0, 0, .6)); }
#swing-cursor { position: absolute; top: -.35rem; bottom: -.35rem; width: .32rem; margin-left: -.16rem; border-radius: 2px; background: #fff; box-shadow: 0 0 .6rem #fff, 0 0 0 1px rgba(0, 0, 0, .4); }
.swing-foot { margin-top: .3rem; display: flex; justify-content: space-between; gap: .6rem; font-size: .78rem; color: var(--muted); font-weight: 700; }
#hint { bottom: calc(var(--safe-b) + 6.4rem); }
#hint { position: absolute; left: 50%; bottom: calc(var(--safe-b) + 1.1rem); transform: translate(-50%, 1rem); max-width: min(34rem, 92vw); text-align: center; padding: .7rem 1.2rem; border-radius: 1rem; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); opacity: 0; transition: opacity .3s, transform .3s; line-height: 1.35; font-weight: 600; }
#hint small { color: var(--muted); font-weight: 500; }
#hint.show { opacity: 1; transform: translate(-50%, 0); }
#toast { position: absolute; left: 50%; top: calc(var(--safe-t) + 5.2rem); transform: translate(-50%, -.6rem); padding: .55rem 1.1rem; border-radius: 999px; background: rgba(10, 26, 40, .9); border: 1px solid var(--gold); font-weight: 700; opacity: 0; transition: opacity .25s, transform .25s; white-space: nowrap; max-width: 92vw; overflow: hidden; text-overflow: ellipsis; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

.banner { position: absolute; left: 50%; top: 34%; transform: translate(-50%, -50%) scale(.96); text-align: center; opacity: 0; transition: opacity .35s, transform .45s cubic-bezier(.2, .8, .2, 1); pointer-events: none; text-shadow: 0 .15rem 1.2rem rgba(0, 0, 0, .6); width: min(40rem, 94vw); }
.banner.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.banner .b0 { font-size: 1rem; letter-spacing: .3em; text-transform: uppercase; color: var(--gold); font-weight: 800; }
.banner .b1 { font-size: clamp(2.2rem, 7vw, 4.4rem); font-weight: 900; line-height: 1.05; letter-spacing: -.01em; }
.banner .b2 { font-size: 1.25rem; font-weight: 700; color: var(--sky); margin-top: .2rem; }
.banner .b3 { margin-top: .7rem; font-size: 1rem; color: #e3f0fa; font-weight: 500; }
.banner:not(.intro) .b0 { font-size: clamp(2.2rem, 7vw, 4.2rem); letter-spacing: -.01em; text-transform: none; color: #fff; font-weight: 900; }
.banner.good:not(.intro) .b0 { color: var(--gold-2); }
.banner:not(.intro) .b1 { font-size: 1.2rem; color: var(--sky); font-weight: 700; }

/* Panels and modals */
.modal-layer { position: absolute; inset: 0; display: grid; place-items: center; padding: calc(var(--safe-t) + 1rem) calc(var(--safe-r) + 1rem) calc(var(--safe-b) + 1rem) calc(var(--safe-l) + 1rem); background: radial-gradient(120% 120% at 50% 40%, rgba(5, 15, 25, .25), rgba(5, 15, 25, .72)); z-index: 20; overflow: auto; }
.menu-layer { background: linear-gradient(90deg, rgba(6, 18, 30, .86) 0%, rgba(6, 18, 30, .55) 38%, rgba(6, 18, 30, 0) 70%); place-items: center start; padding-left: max(5vw, calc(var(--safe-l) + 1rem)); }
.side-layer { place-items: end center; background: none; pointer-events: none; }
.side-layer .panel { pointer-events: auto; }
.panel { width: min(34rem, 100%); padding: 1.6rem 1.7rem; border-radius: 1.4rem; background: var(--panel); border: 1px solid var(--line); backdrop-filter: blur(16px) saturate(140%); -webkit-backdrop-filter: blur(16px) saturate(140%); box-shadow: 0 1.5rem 4rem rgba(0, 0, 0, .5); }
.small-panel { width: min(26rem, 100%); text-align: center; }
.wide-panel { width: min(46rem, 100%); }
.eyebrow { font-size: .72rem; letter-spacing: .2em; text-transform: uppercase; color: var(--gold); font-weight: 800; }
.version { color: var(--muted); letter-spacing: .08em; margin-left: .4rem; }
.game-title { margin: .4rem 0 .5rem; font-size: clamp(2.6rem, 6.4vw, 4.6rem); line-height: .95; font-weight: 900; letter-spacing: -.02em; text-shadow: 0 .2rem 1rem rgba(0, 0, 0, .4); }
.game-title span { display: block; color: var(--gold); }
.game-tagline { color: #dbeaf6; line-height: 1.45; margin: 0 0 1.2rem; }
h2 { margin: 0 0 .7rem; font-size: 1.7rem; line-height: 1.1; }
.btn-stack { display: grid; gap: .6rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: center; margin-top: 1rem; }
.btn { min-height: 2.9rem; padding: .6rem 1.2rem; border-radius: .95rem; border: 1px solid var(--line); background: rgba(255, 255, 255, .13); font-weight: 800; letter-spacing: .01em; transition: background .15s, transform .12s, box-shadow .15s; }
.btn:hover { background: rgba(255, 255, 255, .24); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn-lg { min-height: 3.4rem; font-size: 1.15rem; }
.btn-primary { background: linear-gradient(180deg, #ffe28f, #ffc93f); color: #2a1d00; border-color: rgba(255, 255, 255, .5); box-shadow: 0 .5rem 1.4rem rgba(255, 190, 60, .35); }
.btn-primary:hover { background: linear-gradient(180deg, #fff0b8, #ffd25a); }
.menu-best { margin: .9rem 0 .2rem; color: var(--muted); font-weight: 600; font-size: .92rem; }
.settings { margin-top: .9rem; display: grid; gap: .5rem; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: .8rem; color: var(--muted); font-weight: 600; font-size: .92rem; }
.seg { display: inline-flex; border-radius: .8rem; overflow: hidden; border: 1px solid var(--line); }
.seg button { border: 0; background: rgba(255, 255, 255, .08); padding: .42rem .8rem; min-height: 2.2rem; font-weight: 700; font-size: .88rem; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--gold); color: #2a1d00; }
.menu-help { margin-top: 1rem; display: grid; gap: .35rem; font-size: .88rem; color: var(--muted); line-height: 1.4; }
.menu-help b { color: #fff; }

.holes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: .6rem; }
.hole-btn { display: grid; grid-template-columns: auto 1fr; grid-template-areas: "n name" "n par"; gap: 0 .7rem; align-items: center; text-align: left; padding: .6rem .8rem; border-radius: 1rem; background: rgba(255, 255, 255, .1); border: 1px solid var(--line); min-height: 3.6rem; }
.hole-btn:hover { background: rgba(255, 255, 255, .22); }
.hole-btn .hn { grid-area: n; width: 2.1rem; height: 2.1rem; border-radius: 50%; display: grid; place-items: center; background: var(--gold); color: #2a1d00; font-weight: 900; }
.hole-btn .hname { grid-area: name; font-weight: 800; }
.hole-btn .hpar { grid-area: par; color: var(--muted); font-size: .8rem; }

#hd-detail { color: #dbeaf6; line-height: 1.5; margin: 0; font-size: 1.05rem; }
.stars { font-size: 2rem; color: var(--gold); letter-spacing: .15em; margin: -.2rem 0 .2rem; }
.card-best { color: var(--sky); font-weight: 700; margin-bottom: .8rem; }
.table-wrap { overflow: auto; max-height: min(54vh, 30rem); border-radius: .9rem; border: 1px solid var(--line); }
.scorecard { width: 100%; border-collapse: collapse; font-size: .95rem; }
.scorecard th, .scorecard td { padding: .42rem .7rem; text-align: left; border-bottom: 1px solid rgba(255, 255, 255, .1); }
.scorecard thead th { position: sticky; top: 0; background: #12304a; color: var(--muted); font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; }
.scorecard td:nth-child(3), .scorecard td:nth-child(4), .scorecard thead th:nth-child(3), .scorecard thead th:nth-child(4) { text-align: center; }
.scorecard tr.under td:nth-child(4), .scorecard tr.under td:nth-child(5) { color: var(--mint); font-weight: 800; }
.scorecard tr.over td:nth-child(4), .scorecard tr.over td:nth-child(5) { color: #ffb3a1; }
.scorecard tfoot td { font-weight: 900; background: #1c4468; text-align: center; position: sticky; bottom: 0; }
.scorecard tfoot td:nth-child(2) { text-align: left; }
.card-panel { text-align: center; }

#game-container[data-phase="finished"] #hud { opacity: 0; }
/* Phones in portrait: stack the HUD and give the menu a bottom sheet */
@media (max-width: 620px) {
  .hud-top { gap: .35rem; }
  .hole-pill { flex: 1 1 100%; flex-direction: row; align-items: baseline; gap: .6rem; min-height: 0; padding: .3rem .8rem; }
  .stat-pill { min-height: 2.5rem; padding: .25rem .7rem; }
  .hud-actions { gap: .3rem; }
  .icon-btn { width: 2.55rem; height: 2.55rem; }
  .aim-btn { width: 3.3rem; height: 3.3rem; }
  #swing { padding: .45rem .7rem .5rem; }
  #swing-label { font-size: .95rem; }
  #toast { top: calc(var(--safe-t) + 7rem); }
  .menu-layer { place-items: end center; padding-left: calc(var(--safe-l) + .6rem); background: linear-gradient(0deg, rgba(6, 18, 30, .9) 0%, rgba(6, 18, 30, .5) 55%, rgba(6, 18, 30, 0) 100%); }
  .panel { padding: 1.2rem 1.15rem; border-radius: 1.2rem; }
  .menu-help { display: none; }
  .game-tagline { font-size: .95rem; }
}
/* Landscape phones: shrink vertical chrome */
@media (max-height: 460px) {
  .hud-top { top: calc(var(--safe-t) + .35rem); }
  .pill { min-height: 2.3rem; padding: .15rem .6rem; }
  .pill strong { font-size: 1rem; }
  #swing-dock { bottom: calc(var(--safe-b) + .4rem); }
  .aim-btn { width: 3rem; height: 3rem; min-width: 48px; min-height: 48px; }
  #hint { bottom: calc(var(--safe-b) + 5rem); }
  .menu-help, .game-tagline { display: none; }
  .game-title { font-size: 2.2rem; margin-bottom: .6rem; }
  .menu-layer { padding-top: .5rem; padding-bottom: .5rem; }
  .menu-panel { padding: .9rem 1.2rem; }
  .btn-lg { min-height: 2.8rem; }
  .settings { margin-top: .5rem; }
  .banner { top: 40%; }
}
/* TVs and 4K: bigger targets, thicker focus ring */
@media (min-width: 1700px) {
  :focus-visible { outline-width: 4px; outline-offset: 4px; }
  .panel { width: min(38rem, 100%); }
  .wide-panel { width: min(52rem, 100%); }
}
@media (prefers-reduced-motion: reduce) { * { transition-duration: .01ms !important; animation: none !important; } }
