/* Challenge mode: HUD, result screen, level menu, level editor.
   Colours, surfaces and motion come from src/ui/ui.css. */
.hidden { display: none !important; }
body.playing .panel, body.playing .fps { display: none; }

/* ---- HUD ---- */
.ghud { position: fixed; inset: 0; z-index: 6; pointer-events: none; user-select: none; color: var(--ink); font-variant-numeric: tabular-nums; }
.gh-top { position: absolute; left: 50%; top: 16px; transform: translateX(-50%); display: flex; align-items: stretch; gap: 0; max-width: calc(100vw - 660px); min-width: 480px; border-radius: 30px; overflow: hidden; }
.gh-top > div { padding: 8px 18px; display: flex; flex-direction: column; justify-content: center; border-right: 1px solid var(--line); }
.gh-top > div:last-child { border-right: 0; }
.gh-title { flex-direction: row !important; align-items: center; gap: 10px; padding-left: 12px !important; }
.gh-icon { font-size: 17px; width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--sea-soft); color: var(--sea); }
.gh-name { display: block; font-size: 14px; font-weight: 600; white-space: nowrap; }
.gh-diff { display: block; font: 600 10px/13px var(--font); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); white-space: nowrap; }
.gh-obj { flex: 1; min-width: 170px; }
.gh-objtext { font-size: 13px; color: var(--ink-2); line-height: 1.25; }
.gh-prog { font-size: 15px; font-weight: 700; color: var(--ink); margin-top: 1px; }
.gh-clock { align-items: flex-end; min-width: 112px; }
.gh-time { font-size: 24px; font-weight: 600; line-height: 1; white-space: nowrap; letter-spacing: -.01em; }
.gh-time.late { color: var(--warn); }
.gh-target { font-size: 11px; font-weight: 600; color: var(--sun-ink); margin-top: 4px; white-space: nowrap; }
.gh-stats { font-size: 11.5px; color: var(--ink-2); gap: 2px; min-width: 70px; padding-right: 22px !important; }
.gh-stats b { color: var(--ink); font-weight: 600; }
.gh-stats span:nth-child(2):not(.pen) { display: none; }            /* gybes: no level counts them */
.gh-stats .pen, .gh-stats .pen b { color: var(--bad); font-weight: 600; }
.gh-msg { position: absolute; left: 50%; top: 96px; transform: translate(-50%, -8px); padding: 9px 20px; border-radius: var(--r-pill); font-size: 15px; font-weight: 600; opacity: 0; transition: opacity .25s, transform .3s var(--e-swell); white-space: nowrap; }
.gh-msg.show { opacity: 1; transform: translate(-50%, 0); }
.gh-msg.good::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--good); margin-right: 9px; vertical-align: 1px; }
.gh-msg.bad { background: #b92f25; border-color: rgba(255, 255, 255, .35); color: #fff; }
/* the tip sits between the instrument strip (left) and the navigation card (right), not on the screen centre */
.gh-tip { position: absolute; left: calc(50% + 92px); bottom: var(--gutter); transform: translate(-50%, 10px); width: max-content; max-width: min(640px, calc(100vw - 792px)); padding: 13px 22px; border-radius: var(--r-3); font-size: 16px; line-height: 1.4; text-align: center; opacity: 0; transition: opacity .35s, transform .42s var(--e-swell); box-sizing: border-box; }
.gh-tip.show { opacity: 1; transform: translate(-50%, 0); }
.gh-tip span { display: inline-block; margin-right: 10px; padding: 3px 9px; border-radius: var(--r-pill); background: var(--sun); color: var(--navy); font-size: 10.5px; font-weight: 700; letter-spacing: .12em; vertical-align: 2px; }
.gh-side { position: absolute; right: 20px; top: 20px; width: 220px; display: flex; flex-direction: column; gap: 10px; }
.gh-nav { border-radius: var(--r-3); padding: 12px 14px 12px; display: flex; flex-direction: column; align-items: center; }
.gh-compass { width: 140px; height: 140px; }
.gh-compass > circle { fill: var(--well); stroke: var(--line); }
.gh-compass .c-ring line { stroke: var(--ink-2); }
.gh-compass .c-ring text { fill: var(--ink); }
.gh-compass .c-ring text[fill="#ff6b5a"] { fill: var(--bad); }
.gh-compass .c-wind path:first-child { fill: var(--nogo); }
.gh-compass .c-wind path:last-child { stroke: var(--wind-true); }
.gh-compass .c-course path { stroke: var(--wind-app); } .gh-compass .c-course circle { fill: var(--wind-app); }
.gh-compass .c-target path { fill: var(--good); stroke: #fff; }
.gh-compass > path { fill: var(--ink); stroke: #fff; }
:root[data-scene="dark"] .gh-compass .c-target path, :root[data-scene="dark"] .gh-compass > path { stroke: #06101a; }
.gh-navtext { width: 100%; margin-top: 6px; font-size: 13px; line-height: 1.5; color: var(--ink); }
.gh-navtext small { display: inline-block; width: 62px; font: 600 9.5px/13px var(--font); letter-spacing: .12em; color: var(--ink-2); }
.gh-navtext i { font-style: normal; color: var(--ink-2); font-size: 12px; }
.gh-navtext .big { font-size: 15px; font-weight: 700; color: var(--ink); }
.gh-navtext .big i { font-weight: 500; }
.gh-navtext .steer { color: var(--warn); font-weight: 600; }
.gh-navtext .steer.tack { color: var(--navy); background: var(--sun); border-radius: 6px; padding: 1px 6px; margin: 2px -6px; }
.gh-navtext .steer.tack small { color: var(--navy); font-weight: 700; }
.gh-navtext .steer.tack i { color: var(--navy); }
.gh-map { width: 220px; height: 220px; border-radius: var(--r-2); background: var(--chart); border: 1px solid var(--edge); box-shadow: var(--shadow-1); box-sizing: border-box; }
.gh-keys { position: absolute; right: 20px; bottom: 16px; height: 30px; padding: 0 12px; display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink); }

/* ---- pause and result ---- */
.goverlay, .eddialog { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: var(--haze); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); color: var(--ink); }
.gbox2 { width: min(500px, 92vw); max-height: 92vh; overflow: auto; padding: 28px 32px 26px; border-radius: var(--r-3); text-align: center; box-sizing: border-box; animation: swell var(--d-3) var(--e-swell) backwards; }
.gbox2.small { width: min(360px, 92vw); }
.gbox2 h2 { margin: 6px 0 4px; font-size: 34px; line-height: 40px; letter-spacing: -.015em; } .gbox2 h2.fail { color: var(--bad); font-size: 24px; line-height: 30px; } .gbox2 h3 { margin: 0; font-size: 18px; font-weight: 600; color: var(--ink); }
.gkicker { margin: 0 0 4px; font: 600 11px/14px var(--font); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.gstars i { font-style: normal; color: transparent; -webkit-text-stroke: 1px var(--ink-3); } .gstars i.on { color: var(--sun); -webkit-text-stroke: 1px var(--sun-ink); }
.bigstars { font-size: 56px; line-height: 1; margin-top: 12px; letter-spacing: 8px; } .bigstars i { display: inline-block; -webkit-text-stroke-width: 1.5px !important; } .bigstars i.on { animation: gpop .38s var(--e-swell) backwards; } .bigstars i.on:nth-child(2) { animation-delay: .25s; } .bigstars i.on:nth-child(3) { animation-delay: .5s; }
@keyframes gpop { from { transform: scale(.6); opacity: 0; } }
.gtimes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 16px 0 6px; } .gtimes div { background: var(--well); border-radius: var(--r-2); padding: 10px 4px; } .gtimes small { display: block; font: 600 10px/13px var(--font); letter-spacing: .12em; color: var(--ink-3); } .gtimes b { font-size: 18px; line-height: 24px; font-weight: 600; font-variant-numeric: tabular-nums; }
.gscore { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 13.5px; text-align: left; color: var(--ink-2); } .gscore td { padding: 4px 2px; border-bottom: 1px solid var(--line); } .gscore td:last-child { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink); } .gscore .sum td { border-bottom: 0; font-weight: 700; font-size: 16px; color: var(--ink); }
.ggoals { list-style: none; margin: 8px 0; padding: 0; text-align: left; font-size: 13px; color: var(--ink-2); } .ggoals li { padding: 2px 0; } .ggoals i { font-style: normal; margin-right: 8px; color: transparent; -webkit-text-stroke: 1px var(--ink-3); } .ggoals li.ok { color: var(--ink); } .ggoals li.ok i { color: var(--sun); -webkit-text-stroke: 1px var(--sun-ink); }
.greward { margin: 14px 0 4px; padding: 12px; border-radius: var(--r-2); background: var(--sun-soft); font-size: 13px; color: var(--ink); } .greward b { font-size: 18px; color: var(--sun-ink); margin-right: 12px; } .greward.muted { background: var(--well); color: var(--ink-2); }
.gbtnrow { display: flex; gap: 8px; justify-content: center; margin-top: 18px; flex-wrap: wrap; } .gbtnrow.col { flex-direction: column; } .gbtnrow .btn { flex: 1; } .gbtnrow.col .btn { flex: none; }
.gbtnrow .btn.big { height: 48px; padding: 0 16px; font-size: 15px; line-height: 1.15; }

/* ---- level menu ---- */
.lvmenu { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; background: var(--haze); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); color: var(--ink); }
.lvbox { width: min(1320px, 97vw); height: min(880px, 95vh); }
.lvheadbar { grid-template-columns: auto auto 1fr auto; }
.lvtabs { justify-self: start; }
.lvbody { grid-template-columns: 1fr 400px; }
.lvleft { overflow: auto; padding: 14px 18px; }
.lvgrid { display: grid; grid-template-columns: 168px repeat(5, 1fr); gap: 7px; align-items: stretch; }
.lvhead { font: 600 10.5px/14px var(--font); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); text-align: center; padding: 2px 0 4px; }
.lvtype { display: flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 600; } .lvtype span { width: 28px; height: 28px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--sea-soft); color: var(--sea); font-size: 15px; }
.lvtile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 56px; padding: 6px 6px; border-radius: var(--r-2); border: 1px solid var(--line); background: var(--foam); color: var(--ink); font: inherit; cursor: pointer; transition: transform .18s var(--e-swell), box-shadow .18s, border-color .12s; }
:root[data-scene="dark"] .lvtile { background: var(--well); }
.lvtile:hover { transform: translateY(-1px); box-shadow: var(--shadow-1); }
.lvtile.focus { border-color: var(--sea); box-shadow: 0 0 0 2px var(--sea) inset; }
.lvtile.played { background: var(--good-soft); }
.lvtile.locked { background: transparent; color: var(--ink-3); border-style: dashed; }
.lvname { font-size: 12.5px; font-weight: 500; line-height: 1.15; text-align: center; } .lvtile .gstars { font-size: 14px; letter-spacing: 1px; } .lvlock { font-size: 10.5px; color: var(--ink-3); }
.lvown { display: flex; flex-direction: column; gap: 8px; } .lvownrow { display: grid; grid-template-columns: 240px 1fr; gap: 14px; align-items: center; }
.lvdrawer h2 { margin: 0; font-size: 24px; line-height: 30px; letter-spacing: -.01em; } .lvblurb { margin: 0; font-size: 14px; color: var(--ink-2); line-height: 1.45; }
.lvmap { width: 100%; aspect-ratio: 16 / 10; border-radius: var(--r-2); background: var(--chart); border: 1px solid var(--line); box-sizing: border-box; }
.lvfacts { display: flex; flex-direction: column; gap: 5px; font-size: 13px; line-height: 1.35; } .lvfacts small { display: inline-block; width: 82px; font: 600 10px/13px var(--font); letter-spacing: .12em; color: var(--ink-3); vertical-align: 1px; }
.lvdrawer .ggoals { margin: 0; }

/* ---- level editor: a chart table. No scene behind it, so it always uses the day tokens. ---- */
.leveled { position: fixed; inset: 0; z-index: 35; display: flex; flex-direction: column; background: #f4f9fc; color: #0b2a45;
  --ink: #0b2a45; --ink-2: #35546e; --ink-3: #4f6b84; --line: rgba(11, 42, 69, .12); --well: rgba(11, 42, 69, .06); --foam: #ffffff; --sea: #0a67a6; --sea-soft: rgba(10, 103, 166, .12); --sea-line: rgba(10, 103, 166, .28);
  --sheet: rgba(246, 251, 254, .96); --edge: rgba(255, 255, 255, .75); --haze: rgba(235, 245, 252, .45); --bad: #b92f25; --warn: #9a4f00; --good: #0a7350; --sun-soft: rgba(242, 161, 0, .16); --sun-ink: #8a5a00;
  --shadow-1: 0 2px 10px rgba(10, 60, 110, .10); --shadow-2: 0 12px 36px rgba(10, 60, 110, .16); --shadow-3: 0 24px 64px rgba(10, 60, 110, .22); --inset: inset 0 1px 0 rgba(255, 255, 255, .85); }
.leveled .gtitle img { content: url(../../assets/supasail-logo.svg); }
.edbar { display: flex; align-items: center; gap: 16px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.edbar .edopen { max-width: 260px; height: 32px; font-size: 13px; }
.edbtns { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.edmain { flex: 1; min-height: 0; display: grid; grid-template-columns: 136px 1fr 320px; }
.edtools { display: flex; flex-direction: column; gap: 2px; padding: 8px; border-right: 1px solid var(--line); overflow: auto; }
.edtools button { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border-radius: var(--r-1); border: 0; background: transparent; color: var(--ink); font: inherit; font-size: 12.5px; cursor: pointer; text-align: left; }
.edtools button i { font-style: normal; width: 18px; text-align: center; font-size: 14px; color: var(--sea); }
.edtools button:hover { background: var(--well); } .edtools button.on { background: var(--sea-soft); color: var(--sea); font-weight: 600; }
.edstage { position: relative; min-width: 0; min-height: 0; background: #0a1622; } .edstage canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.edhint { position: absolute; left: 12px; bottom: 10px; right: 140px; font-size: 12px; color: rgba(255,255,255,.7); pointer-events: none; } .edhint.flash { color: #ffd166; font-weight: 600; }
.edscale { position: absolute; right: 14px; bottom: 10px; font-size: 11px; color: rgba(255,255,255,.75); display: flex; align-items: center; gap: 6px; pointer-events: none; } .edscale i { display: block; height: 5px; border: 1px solid rgba(255,255,255,.75); border-top: 0; }
.edprops { border-left: 1px solid var(--line); padding: 4px 16px 16px; overflow: auto; font-size: 12.5px; }
.edprops .sec { margin: 14px 0 6px; }
.edf { display: flex; flex-direction: column; gap: 3px; margin: 5px 0; font-size: 11.5px; color: var(--ink-2); flex: 1; min-width: 0; }
.edf input[type=text], .edf input[type=number], .edf select { height: 32px; font-size: 13px; padding: 0 8px; width: 100%; }
.edf.chk { flex-direction: row; align-items: center; gap: 6px; padding-top: 18px; color: var(--ink); font-size: 12.5px; }
.edf.chk input { accent-color: var(--sea); }
.edrow { display: flex; gap: 8px; }
.edstat { display: flex; justify-content: space-between; padding: 3px 0; border-bottom: 1px solid var(--line); } .edstat span { color: var(--ink-2); } .edstat b { font-variant-numeric: tabular-nums; }
.ederr { margin: 4px 0 8px; padding: 8px 10px; border-radius: var(--r-1); background: rgba(185, 47, 37, .10); color: var(--bad); } .ednote { margin: 6px 0; padding: 7px 10px; border-radius: var(--r-1); background: var(--sun-soft); color: var(--sun-ink); line-height: 1.35; }
.eddialog { z-index: 45; } .eddialog textarea { width: 100%; height: 220px; margin-top: 8px; box-sizing: border-box; border-radius: var(--r-1); border: 1px solid var(--line); background: var(--foam); color: var(--navy); font: 12px/1.4 var(--mono); padding: 10px; }

/* 1280 x 720 and smaller */
@media (max-width: 1340px), (max-height: 800px) {
  .gh-navtext { font-size: 12.5px; } .gh-navtext .big { font-size: 13.5px; } .gh-navtext small { width: 56px; } .gh-nav { padding: 10px 12px; }
  .lvmap { aspect-ratio: 16 / 8; } .lvdrawer h2 { font-size: 20px; line-height: 26px; }
  .gh-side { width: 196px; } .gh-compass { width: 124px; height: 124px; } .gh-map { width: 196px; height: 196px; }
  .gh-top { max-width: calc(100vw - 560px); min-width: 440px; } .gh-top > div { padding: 7px 14px; }
  .gh-tip { left: calc(50% + 68px); max-width: min(560px, calc(100vw - 696px)); font-size: 15px; }
  .gbox2 { padding: 22px 26px 20px; } .gbox2 h2 { font-size: 28px; line-height: 34px; } .bigstars { font-size: 46px; }
  .lvtile { min-height: 44px; padding: 4px 6px; } .lvgrid { gap: 5px; } .lvleft { padding: 10px 14px; }
}
