/* KØS SEJL — css/style.css : tokens, shell, buttons, screens (SPAN-style glass UI) */
:root {
  --primary: #ffb547;
  --primary-2: #ff7a3d;
  --primary-hi: #ffc65c;
  --blue: #49c6f2;
  --good: #3ee08f;
  --bad: #ff4d5e;
  --star: #ffd25e;
  --port: #e8323c;
  --stbd: #18a957;
  --sea-deep: #2b6cb0;
  --sea-shallow: #7fc4f0;
  --land: #fff4b8;
  --navy: #0b1120;
  --ink: #0f1729;
  --text: #f4f6fb;
  --text-dim: rgba(236, 241, 255, .66);
  --glass: rgba(13, 19, 33, .7);
  --glass-2: rgba(255, 255, 255, .08);
  --glass-border: rgba(255, 255, 255, .12);
  --radius: 16px;
  --radius-lg: 22px;
  --shadow: 0 10px 30px rgba(5, 10, 25, .35);
  --font: ui-rounded, "SF Pro Rounded", "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, 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);
  --gutter: 16px;
  --ease-pop: cubic-bezier(.34, 1.56, .64, 1);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--navy); color: var(--text);
  font-family: var(--font); font-size: 16px; line-height: 1.35;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none; touch-action: manipulation;
  -webkit-user-select: none; user-select: none;
}
input, textarea { -webkit-user-select: text; user-select: text; }
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; }
:focus { outline: none; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
.ico { width: 1.25em; height: 1.25em; flex: none; display: inline-block; vertical-align: middle; }
[hidden] { display: none !important; }

/* ------------------------------------------------------------------ menu background */
#menu-bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
#menu-bg svg { width: 100%; height: 100%; display: block; }
/* painted ComfyUI backgrounds (assets/bg) over the SVG fallback scene, chosen per screen */
.mbg-photo {
  position: absolute; inset: -2%; background: url("../assets/bg/title-port.jpg") center bottom / cover no-repeat;
  transition: background-image .6s ease; animation: kenBurns 40s ease-in-out infinite alternate;
}
@media (orientation: landscape) { .mbg-photo { background-image: url("../assets/bg/title-land.jpg"); background-position: center 70%; } }
body[data-screen="hub"] .mbg-photo, body[data-screen="area"] .mbg-photo { background-image: url("../assets/bg/hub-port.jpg"); }
@media (orientation: landscape) { body[data-screen="hub"] .mbg-photo, body[data-screen="area"] .mbg-photo { background-image: url("../assets/bg/hub-land.jpg"); background-position: center; } }
body[data-area="club"] .mbg-photo, body[data-screen="garage"] .mbg-photo, body[data-screen="profile"] .mbg-photo { background-image: url("../assets/bg/club.jpg") !important; background-position: center !important; }
body[data-area="race"] .mbg-photo, body[data-area="rules"] .mbg-photo { background-image: url("../assets/bg/race.jpg") !important; background-position: center !important; }
body[data-screen="results"] .mbg-photo { background-image: url("../assets/bg/results.jpg") !important; background-position: center !important; }
body[data-screen="settings"] .mbg-photo, body[data-screen="credits"] .mbg-photo { background-image: url("../assets/bg/winter.jpg") !important; background-position: center !important; }
@keyframes kenBurns { from { transform: scale(1); } to { transform: scale(1.06) translate(-1%, -1%); } }
body:not([data-screen="title"]) .mbg-vignette { background: linear-gradient(180deg, rgba(8, 12, 30, .62), rgba(8, 12, 30, .38) 40%, rgba(8, 12, 30, .55)); }
.mbg-vignette { position: absolute; inset: 0; background:
  radial-gradient(120% 80% at 50% 40%, transparent 35%, rgba(8, 12, 30, .5) 100%),
  linear-gradient(180deg, rgba(34, 26, 74, .45), rgba(52, 36, 92, .2) 40%, rgba(20, 24, 60, .26) 65%, rgba(8, 14, 30, .68)); }
.mbg-waves.w1 { animation: mbgWave 9s linear infinite; }
.mbg-waves.w2 { animation: mbgWave 6s linear infinite reverse; }
@keyframes mbgWave { from { transform: translateX(0); } to { transform: translateX(-120px); } }
.mbg-boat.b1 { animation: mbgSail1 70s linear infinite; }
.mbg-boat.b2 { animation: mbgSail2 95s linear infinite; }
@keyframes mbgSail1 { from { transform: translate(-80px, 600px); } to { transform: translate(1700px, 600px); } }
@keyframes mbgSail2 { from { transform: translate(1700px, 580px) scaleX(-1); } to { transform: translate(-80px, 580px) scaleX(-1); } }
.mbg-gull.g1 { animation: mbgGull 26s linear infinite; }
.mbg-gull.g2 { animation: mbgGull 34s linear infinite; animation-delay: -12s; }
@keyframes mbgGull {
  0% { transform: translate(-60px, 300px); } 25% { transform: translate(400px, 270px); }
  50% { transform: translate(800px, 320px); } 75% { transform: translate(1200px, 280px); } 100% { transform: translate(1680px, 300px); }
}
.mbg-clouds { animation: mbgClouds 60s ease-in-out infinite alternate; }
@keyframes mbgClouds { to { transform: translateX(60px); } }
.mbg-sunglow { animation: sunPulse 6s ease-in-out infinite alternate; transform-origin: 620px 520px; }
@keyframes sunPulse { to { transform: scale(1.08); opacity: .85; } }
body.mode-sea[data-screen="play"] #menu-bg, body.results-over-sea #menu-bg { display: none; }

/* ------------------------------------------------------------------ app + screens */
#app { position: fixed; inset: 0; z-index: 2; }
.screen {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  padding: calc(var(--safe-t) + 12px) calc(var(--safe-r) + var(--gutter)) calc(var(--safe-b) + 12px) calc(var(--safe-l) + var(--gutter));
}
.screen.enter { animation: screenIn .38s var(--ease-pop) both; }
@keyframes screenIn { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }
.scroll {
  flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch;
  margin: 0 calc(-1 * var(--gutter)); padding: 4px var(--gutter) 24px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.2) transparent;
}
.scroll.center { display: flex; flex-direction: column; align-items: center; justify-content: safe center; }

.glass {
  background: var(--glass); border: 1px solid var(--glass-border); border-radius: var(--radius);
  -webkit-backdrop-filter: blur(14px) saturate(1.2); backdrop-filter: blur(14px) saturate(1.2);
  box-shadow: var(--shadow);
}

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .55em;
  min-height: 48px; padding: 10px 20px; border-radius: var(--radius); border: 1px solid transparent;
  font-weight: 800; font-size: 1.05rem; letter-spacing: .01em; white-space: nowrap;
  transition: transform .15s var(--ease-pop), filter .15s, box-shadow .15s, background .15s;
}
.btn:hover:not(:disabled) { filter: brightness(1.06); transform: translateY(-1px); }
.btn:active:not(:disabled), .btn.pressed:not(:disabled) { transform: translateY(1px) scale(.97); }
.btn:disabled { opacity: .45; filter: grayscale(.6); }
.btn-primary {
  background: linear-gradient(180deg, var(--primary-hi), var(--primary-2)); color: #1a0f05;
  border-color: rgba(255, 240, 210, .55);
  box-shadow: 0 6px 0 #c4541f, 0 12px 26px rgba(255, 122, 61, .45), inset 0 2px 0 rgba(255, 255, 255, .45);
}
.btn-primary:active:not(:disabled), .btn-primary.pressed { box-shadow: 0 2px 0 #c4541f, 0 6px 14px rgba(255, 122, 61, .4), inset 0 2px 0 rgba(255,255,255,.4); transform: translateY(4px); }
.btn-glass { background: rgba(255, 255, 255, .1); border-color: var(--glass-border); color: var(--text); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.btn-glass:hover:not(:disabled) { background: rgba(255, 255, 255, .16); }
.btn-danger { background: rgba(255, 77, 94, .16); border-color: rgba(255, 77, 94, .5); color: #ffb3bb; }
.btn-wide { width: 100%; }
.btn-big { min-height: 60px; font-size: 1.2rem; }
.btn-sm { min-height: 44px; padding: 8px 14px; font-size: .95rem; }
.icon-btn {
  width: 52px; height: 52px; flex: none; display: inline-grid; place-items: center; border-radius: var(--radius);
  background: rgba(13, 19, 33, .42); border: 1px solid var(--glass-border); color: #fff;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); transition: transform .15s var(--ease-pop), background .15s;
}
.icon-btn .ico { width: 26px; height: 26px; }
.icon-btn:hover { background: rgba(13, 19, 33, .6); }
.icon-btn:active, .icon-btn.pressed { transform: scale(.92); }
.avatar-btn { padding: 3px; overflow: hidden; }
.avatar-btn .avatar-svg { width: 100%; height: 100%; }
.link-btn { background: none; border: 0; color: var(--text-dim); text-decoration: underline; text-underline-offset: 3px; min-height: 44px; padding: 0 10px; font-weight: 700; }
.link-btn:hover { color: #fff; }

.menu-btn {
  width: 100%; min-height: 72px; display: flex; align-items: center; gap: 16px; padding: 12px 20px; text-align: left;
  background: rgba(13, 19, 33, .55); border: 1px solid rgba(255, 255, 255, .18); border-radius: var(--radius-lg);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); transition: transform .15s var(--ease-pop), background .15s;
  box-shadow: 0 8px 24px rgba(10, 10, 40, .25);
}
.menu-btn:hover:not(:disabled) { background: rgba(13, 19, 33, .68); transform: translateY(-1px); }
.menu-btn:active:not(:disabled), .menu-btn.pressed { transform: scale(.98); }
.menu-btn:disabled { opacity: .6; } .menu-btn:disabled .mb-ico { filter: grayscale(1); }
.mb-ico { width: 44px; height: 44px; display: grid; place-items: center; flex: none; }
.mb-ico .ico { width: 34px; height: 34px; }
.c-orange { color: var(--primary); } .c-blue { color: var(--blue); } .c-green { color: var(--good); }
.mb-txt { display: flex; flex-direction: column; min-width: 0; }
.mb-txt b { font-size: 1.25rem; font-weight: 800; }
.mb-txt small { color: var(--text-dim); font-size: .92rem; font-weight: 600; }

/* ------------------------------------------------------------------ pills / topbar */
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex: none; }
.topbar-left, .topbar-right { display: flex; gap: 8px; align-items: center; min-width: 0; }
.pill {
  height: 52px; display: inline-flex; align-items: center; gap: 8px; padding: 0 16px; border-radius: 999px;
  background: rgba(13, 19, 33, .62); border: 1px solid var(--glass-border); font-weight: 800; font-size: 1.15rem;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); white-space: nowrap;
}
.pill-ico { display: inline-grid; } .pill-ico .ico { width: 24px; height: 24px; }
.star-ico { color: var(--star); filter: drop-shadow(0 1px 0 #b9791b); }
.pill-dim { color: var(--text-dim); font-weight: 600; font-size: .95em; }
.pill-xp { padding: 0 14px 0 6px; }
.lvl {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-weight: 900; font-size: 1.15rem; color: #0b2a17;
  background: linear-gradient(180deg, #8ff0b8, #2fc77a); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .18), inset 0 2px 0 rgba(255,255,255,.5);
}
.pill-xp-txt { display: flex; flex-direction: column; gap: 4px; }
.pill-xp-txt b { font-size: .85rem; line-height: 1; }
.xpbar { display: block; width: 92px; height: 7px; background: rgba(255, 255, 255, .14); border-radius: 9px; overflow: hidden; }
.xpbar i { display: block; height: 100%; background: linear-gradient(90deg, #3ee08f, #8ff0b8); border-radius: inherit; }
.xpbar.big { width: 100%; height: 10px; }

#app > #screen-hub.hub-fallback { padding: calc(var(--safe-t) + 12px) calc(var(--safe-r) + var(--gutter)) calc(var(--safe-b) + 12px) calc(var(--safe-l) + var(--gutter)); }

/* ------------------------------------------------------------------ title */
#screen-title { align-items: stretch; }
.title-main { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: clamp(12px, 3vh, 32px); width: 100%; max-width: 560px; margin: 0 auto; }
.title-logo { width: 100%; display: flex; flex-direction: column; align-items: center; }
.logo-boat { width: min(78%, 360px); height: auto; margin-bottom: -4%; overflow: visible; }
.logo-text { width: 100%; max-width: 560px; height: auto; filter: drop-shadow(0 6px 18px rgba(80, 30, 10, .35)); animation: logoIn .8s var(--ease-pop) both .1s; }
@keyframes logoIn { from { opacity: 0; transform: scale(.7) translateY(20px); } to { opacity: 1; transform: none; } }
.lb-bob { animation: bob 3.2s ease-in-out infinite; transform-origin: 165px 110px; }
.lb-heel { animation: heel 5s ease-in-out infinite; transform-origin: 165px 112px; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(5px); } }
@keyframes heel { 0%, 100% { transform: rotate(4deg); } 50% { transform: rotate(9deg); } }
.lb-main { animation: sailFill 2.6s ease-in-out infinite; transform-origin: 163px 100px; }
@keyframes sailFill { 0%, 100% { transform: scaleX(1); } 50% { transform: scaleX(1.04); } }
.lb-wave.w-front { animation: waveSlide 2.4s linear infinite; }
.lb-wave.w-back { animation: waveSlide 3.6s linear infinite reverse; }
@keyframes waveSlide { from { transform: translateX(0); } to { transform: translateX(-80px); } }
.lb-spray { animation: spray 1.6s ease-out infinite; }
@keyframes spray { 0% { opacity: 0; transform: translate(6px, 6px); } 30% { opacity: 1; } 100% { opacity: 0; transform: translate(-10px, -10px); } }
.lb-sun { animation: sunPulse 4s ease-in-out infinite alternate; transform-origin: 246px 44px; }
.tagline { margin-top: 6px; font-size: clamp(1.15rem, 4.6vw, 1.6rem); font-weight: 800; text-align: center; text-shadow: 0 2px 10px rgba(20, 10, 40, .45); animation: fadeUp .6s ease both .35s; }
.tagline span { color: var(--primary); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.title-menu { width: 100%; display: flex; flex-direction: column; gap: 14px; animation: fadeUp .6s ease both .5s; }
.hello { text-align: center; font-weight: 700; color: #fff; text-shadow: 0 1px 8px rgba(0,0,0,.4); }
.btn-play { min-height: 76px; font-size: 1.7rem; border-radius: 26px; }
.btn-play .ico { width: 34px; height: 34px; }
.btn-play { animation: playPulse 2.4s ease-in-out infinite 1.2s; }
@keyframes playPulse { 0%, 100% { box-shadow: 0 6px 0 #c4541f, 0 12px 26px rgba(255,122,61,.45), inset 0 2px 0 rgba(255,255,255,.45); } 50% { box-shadow: 0 6px 0 #c4541f, 0 12px 40px rgba(255,160,80,.75), inset 0 2px 0 rgba(255,255,255,.45); } }
.title-foot { flex: none; display: flex; justify-content: center; align-items: center; gap: 8px; flex-wrap: wrap; text-align: center; color: rgba(255,255,255,.82); font-weight: 600; font-size: .95rem; text-shadow: 0 1px 6px rgba(0,0,0,.5); }

/* ------------------------------------------------------------------ screen header */
.screen-head { flex: none; display: flex; align-items: center; gap: 12px; margin: 0 auto 14px; width: 100%; max-width: 1180px; }
.head-title { flex: 1; min-width: 0; }
.head-title h1 { font-size: clamp(1.35rem, 5vw, 2rem); font-weight: 900; line-height: 1.1; text-shadow: 0 3px 0 rgba(90, 40, 20, .45), 0 4px 16px rgba(0,0,0,.35); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.head-sub { color: rgba(255,255,255,.82); font-weight: 600; font-size: .95rem; text-shadow: 0 1px 6px rgba(0,0,0,.5); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.head-right { display: flex; gap: 8px; align-items: center; }

/* ------------------------------------------------------------------ grids and cards */
.grid { display: grid; gap: 14px; width: 100%; max-width: 1100px; margin: 0 auto; }
.area-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.act-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); }
.card {
  position: relative; text-align: left; border-radius: var(--radius-lg); border: 1px solid var(--glass-border);
  background: var(--glass); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: var(--shadow);
  padding: 16px; transition: transform .18s var(--ease-pop), border-color .18s, background .18s;
  animation: cardIn .45s var(--ease-pop) both; animation-delay: calc(var(--i, 0) * 45ms);
}
@keyframes cardIn { from { opacity: 0; transform: translateY(16px) scale(.97); } to { opacity: 1; transform: none; } }
.card:hover { transform: translateY(-2px); border-color: rgba(255, 198, 92, .5); }
.card:active, .card.pressed { transform: scale(.98); }
.card.shake, .shake { animation: shake .4s ease both !important; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

.area-card { display: flex; align-items: center; gap: 14px; min-height: 96px; }
.ac-ico { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; flex: none; background: linear-gradient(160deg, var(--primary-hi), var(--primary-2)); color: #2a1206; box-shadow: inset 0 -3px 0 rgba(0,0,0,.15); }
.ac-ico .ico { width: 32px; height: 32px; }
.a-school .ac-ico, .a-bay .ac-ico { background: linear-gradient(160deg, #8fe3ff, #2b8fd0); color: #062033; }
.a-race .ac-ico { background: linear-gradient(160deg, #ffe58a, #f2b01e); }
.a-rules .ac-ico { background: linear-gradient(160deg, #8ff0b8, #18a957); color: #052a17; }
.a-nav .ac-ico { background: linear-gradient(160deg, #c3b5ff, #6f55e8); color: #160b40; }
.a-pier .ac-ico { background: linear-gradient(160deg, #dfe6f2, #8a9ab5); color: #18233a; }
.ac-txt { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ac-txt b { font-size: 1.2rem; font-weight: 800; }
.ac-txt small { color: var(--text-dim); font-weight: 600; font-size: .9rem; }
.ac-meta { position: absolute; top: 10px; right: 12px; }
.ac-txt b { padding-right: 64px; }
.mini-star { display: inline-flex; align-items: center; gap: 4px; font-weight: 800; font-size: .9rem; color: var(--star); }
.mini-star .ico { width: 16px; height: 16px; }
.soon { font-size: .75rem; color: var(--text-dim); font-weight: 700; }

.act-card { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; min-height: 104px; padding-left: 18px; }
.act-num { position: absolute; top: 8px; left: 10px; font-size: .72rem; font-weight: 900; color: var(--text-dim); }
.act-ico { width: 58px; height: 58px; border-radius: 18px; display: grid; place-items: center; background: linear-gradient(160deg, #8fe3ff, #2b8fd0); color: #062033; box-shadow: inset 0 -3px 0 rgba(0,0,0,.18); }
.act-ico .ico { width: 32px; height: 32px; }
.act-txt { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.act-txt b { font-size: 1.12rem; font-weight: 800; }
.act-txt small { color: var(--text-dim); font-weight: 600; font-size: .88rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.act-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin-top: 2px; }
.meta-chip { display: inline-flex; align-items: center; gap: 4px; font-size: .78rem; font-weight: 700; color: var(--text-dim); }
.meta-chip .ico { width: 14px; height: 14px; }
.diff { display: inline-flex; gap: 3px; }
.diff i { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.18); }
.diff i.on { background: var(--primary); box-shadow: 0 0 6px rgba(255,181,71,.6); }
.act-side { align-self: center; }
.act-card.locked { background: rgba(13, 19, 33, .5); }
.act-card.locked .act-ico { background: rgba(255,255,255,.1); color: var(--text-dim); box-shadow: none; }
.act-card.locked .act-txt b, .act-card.locked .act-txt small { opacity: .6; }
.act-card.perfect { border-color: rgba(255, 210, 94, .55); box-shadow: var(--shadow), 0 0 0 1px rgba(255, 210, 94, .25), 0 0 26px rgba(255, 210, 94, .18); }
.lock-tag { display: inline-flex; align-items: center; gap: 4px; font-weight: 800; color: var(--text-dim); font-size: .9rem; background: rgba(255,255,255,.08); padding: 6px 10px; border-radius: 999px; }
.lock-tag .ico { width: 16px; height: 16px; }
.empty { padding: 32px; text-align: center; grid-column: 1 / -1; color: var(--text-dim); font-weight: 700; }
.empty-ico .ico { width: 48px; height: 48px; color: var(--blue); margin-bottom: 8px; }

/* stars */
.stars { display: inline-flex; gap: 2px; }
.stars .star svg { width: 26px; height: 26px; display: block; }
.stars .star.on svg { filter: drop-shadow(0 2px 4px rgba(255, 190, 60, .45)); }

/* ------------------------------------------------------------------ panels / forms */
.panel-col { width: 100%; max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.panel { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.panel h2 { font-size: 1.1rem; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.panel h2 .ico { color: var(--primary); }
.set-row { display: flex; align-items: center; gap: 12px; min-height: 48px; }
.set-ico { color: var(--text-dim); display: grid; }
.set-label { flex: 1; font-weight: 700; }
.set-help { color: var(--text-dim); font-size: .9rem; font-weight: 600; }
.seg { display: flex; gap: 4px; padding: 4px; background: rgba(0, 0, 0, .28); border-radius: 14px; border: 1px solid var(--glass-border); }
.seg button {
  flex: 1; min-height: 44px; border: 0; border-radius: 11px; background: transparent; color: var(--text-dim); font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 6px 8px; transition: background .18s, color .18s;
}
.seg button .ico { width: 18px; height: 18px; }
.seg button.on { background: linear-gradient(180deg, var(--primary-hi), var(--primary-2)); color: #1a0f05; box-shadow: 0 3px 10px rgba(255,122,61,.35); }
.switch { position: relative; width: 72px; height: 44px; flex: none; border-radius: 999px; border: 1px solid var(--glass-border); background: rgba(255,255,255,.14); padding: 0; transition: background .2s; }
.switch i { position: absolute; top: 4px; left: 4px; width: 36px; height: 36px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.35); transition: transform .25s var(--ease-pop); }
.switch.on { background: var(--good); }
.switch.on i { transform: translateX(28px); }
.switch.static { display: inline-block; }
.range { -webkit-appearance: none; appearance: none; width: min(46%, 220px); height: 44px; background: transparent; --v: 80%; }
.range::-webkit-slider-runnable-track { height: 10px; border-radius: 9px; background: linear-gradient(90deg, var(--primary) var(--v), rgba(255,255,255,.16) var(--v)); }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 28px; height: 28px; margin-top: -9px; border-radius: 50%; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.4); border: 3px solid var(--primary-2); }
.range::-moz-range-track { height: 10px; border-radius: 9px; background: rgba(255,255,255,.16); }
.range::-moz-range-progress { height: 10px; border-radius: 9px; background: var(--primary); }
.range::-moz-range-thumb { width: 24px; height: 24px; border-radius: 50%; background: #fff; border: 3px solid var(--primary-2); }
.hold-btn { position: relative; overflow: hidden; touch-action: none; }
.hold-btn > :not(.hold-fill) { position: relative; }
.hold-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: linear-gradient(90deg, rgba(62,224,143,.35), rgba(62,224,143,.7)); }
.hold-btn.holding { border-color: var(--good); }
.version { text-align: center; color: var(--text-dim); font-size: .8rem; font-weight: 600; }

.field { display: flex; flex-direction: column; gap: 8px; }
.field > span:first-child { font-weight: 800; font-size: .9rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: .05em; }
.input {
  width: 100%; min-height: 50px; padding: 10px 14px; border-radius: 14px; border: 1px solid var(--glass-border);
  background: rgba(0, 0, 0, .3); color: #fff; font: inherit; font-size: 1.15rem; font-weight: 700;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(255,181,71,.25); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 44px; padding: 8px 16px; border-radius: 999px; border: 1px solid var(--glass-border); background: rgba(255,255,255,.08); font-weight: 800; transition: transform .15s var(--ease-pop); }
.chip.on { background: linear-gradient(180deg, var(--primary-hi), var(--primary-2)); color: #1a0f05; border-color: transparent; }
.chip.pressed { transform: scale(.94); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 44px; height: 44px; border-radius: 50%; border: 3px solid rgba(255,255,255,.25); background: var(--c); box-shadow: inset 0 -4px 0 rgba(0,0,0,.15); transition: transform .15s var(--ease-pop); }
.swatch.on { border-color: #fff; transform: scale(1.12); box-shadow: 0 0 0 3px var(--primary-2), inset 0 -4px 0 rgba(0,0,0,.15); }
.sailno-input { display: flex; align-items: center; gap: 8px; }
.sailno-input b { font-size: 1.15rem; font-weight: 900; padding: 0 4px; }
.sailno-input .input { max-width: 160px; letter-spacing: .1em; }

/* ------------------------------------------------------------------ profile */
.profile-wrap { width: 100%; max-width: 980px; margin: 0 auto; display: grid; gap: 14px; grid-template-columns: 1fr; }
.profile-preview { padding: 16px; display: grid; grid-template-columns: auto auto; grid-template-areas: "av boat" "name boat" "sail boat" "rnd boat"; justify-content: center; align-items: center; gap: 6px 22px; }
.pp-avatar { grid-area: av; width: 132px; height: 132px; filter: drop-shadow(0 6px 14px rgba(0,0,0,.35)); }
.pp-avatar.wiggle { animation: wiggle .4s var(--ease-pop); }
@keyframes wiggle { 30% { transform: rotate(-6deg) scale(1.05); } 60% { transform: rotate(5deg); } }
.pp-avatar svg { width: 100%; height: 100%; }
.pp-boat { grid-area: boat; width: 76px; height: 126px; animation: bob 3s ease-in-out infinite; }
.pp-boat svg { width: 100%; height: 100%; filter: drop-shadow(0 6px 10px rgba(0,0,0,.35)); }
.pp-name { grid-area: name; font-size: 1.35rem; font-weight: 900; text-align: center; }
.pp-sail { grid-area: sail; text-align: center; color: var(--primary); font-weight: 800; letter-spacing: .08em; }
.profile-preview .btn { grid-area: rnd; }
.profile-form { display: flex; flex-direction: column; gap: 14px; }

/* ------------------------------------------------------------------ garage / Sejlerpas */
.garage-wrap { width: 100%; max-width: 1100px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.passport {
  position: relative; display: flex; gap: 18px; align-items: center; padding: 18px; overflow: hidden;
  background: linear-gradient(135deg, rgba(43, 108, 176, .55), rgba(13, 19, 33, .78) 60%), var(--glass);
}
.passport::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(135deg, transparent 0 18px, rgba(255,255,255,.025) 18px 19px); pointer-events: none; }
.pass-avatar { width: 108px; height: 108px; flex: none; border-radius: 22px; overflow: hidden; border: 3px solid rgba(255,255,255,.8); background: #1c2a47; transform: rotate(-3deg); box-shadow: 0 6px 16px rgba(0,0,0,.4); }
.pass-avatar svg { width: 100%; height: 100%; }
.pass-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; z-index: 1; }
.pass-label { font-size: .7rem; font-weight: 900; letter-spacing: .14em; color: var(--blue); }
.pass-name { font-size: 1.6rem; font-weight: 900; line-height: 1.1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pass-sail { font-weight: 800; color: var(--primary); letter-spacing: .08em; }
.pass-rank { display: flex; align-items: center; gap: 10px; margin: 4px 0; }
.pass-rank .lvl { width: 34px; height: 34px; font-size: 1rem; }
.pass-next { color: var(--text-dim); font-weight: 600; }
.pass-stamp { position: absolute; right: 14px; top: 10px; width: 78px; height: 78px; border-radius: 50%; border: 3px dashed rgba(255,122,61,.55); color: rgba(255,122,61,.7); display: grid; place-items: center; transform: rotate(14deg); font-weight: 900; font-size: .8rem; z-index: 0; }
.pass-stamp .ico { width: 26px; height: 26px; margin-top: 10px; }
.pass-stamp span { margin-top: -18px; }
.sec-title { display: flex; align-items: center; gap: 8px; font-size: 1.2rem; font-weight: 900; margin-top: 6px; text-shadow: 0 2px 8px rgba(0,0,0,.4); }
.sec-title .ico { color: var(--primary); }
.boat-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.boat-card { display: flex; flex-direction: column; gap: 6px; align-items: stretch; padding: 12px; }
.bc-art { height: 110px; display: grid; place-items: center; border-radius: 14px; background: radial-gradient(120% 90% at 50% 100%, rgba(73,198,242,.35), rgba(73,198,242,.05) 70%); overflow: hidden; }
.bc-art svg { width: 100%; height: 100%; }
.bc-name { font-weight: 900; font-size: 1.15rem; display: flex; align-items: center; gap: 6px; }
.fav-tag { color: var(--bad); display: inline-grid; } .fav-tag .ico { width: 18px; height: 18px; fill: currentColor; }
.bc-meta { color: var(--text-dim); font-weight: 700; font-size: .85rem; display: flex; align-items: center; gap: 4px; }
.bc-meta .ico { width: 15px; height: 15px; }
.bc-ok { color: var(--good); font-weight: 800; font-size: .85rem; display: flex; align-items: center; gap: 4px; }
.bc-ok .ico { width: 16px; height: 16px; }
.bc-lock { display: flex; align-items: center; gap: 5px; font-weight: 800; color: var(--text-dim); font-size: .9rem; }
.bc-lock .ico { width: 16px; height: 16px; } .tiny-star { color: var(--star); }
.bc-bar { height: 6px; border-radius: 9px; background: rgba(255,255,255,.12); overflow: hidden; }
.bc-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--primary-2)); }
.boat-card.locked .bc-art { filter: grayscale(1) brightness(.55); }
.boat-card.fav { border-color: rgba(255, 198, 92, .6); }
.badge-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
.badge { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 6px; background: none; border: 0; border-radius: 16px; animation: cardIn .45s var(--ease-pop) both; animation-delay: calc(var(--i, 0) * 35ms); }
.badge:hover { background: rgba(255,255,255,.06); }
.badge-medal { width: 68px; height: 68px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.08); border: 2px dashed rgba(255,255,255,.22); color: var(--text-dim); }
.badge-medal .ico { width: 30px; height: 30px; }
.badge.has .badge-medal { background: radial-gradient(circle at 35% 30%, #fff1c0, var(--star) 45%, #e39a1c); border: 3px solid #fff3d0; color: #6b3a00; box-shadow: 0 4px 0 #b06a10, 0 8px 18px rgba(255, 190, 60, .35); }
.badge-name { font-size: .8rem; font-weight: 800; text-align: center; color: var(--text-dim); line-height: 1.15; }
.badge.has .badge-name { color: #fff; }
.boat-dialog-art { height: 150px; margin: -4px 0 6px; border-radius: 14px; background: radial-gradient(120% 90% at 50% 100%, rgba(73,198,242,.35), transparent 70%); display: grid; place-items: center; }
.boat-dialog-art svg { width: 100%; height: 100%; }
.stats { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.stat-row { display: grid; grid-template-columns: 96px 1fr; align-items: center; gap: 10px; font-weight: 700; font-size: .9rem; }
.stat-bar { height: 10px; background: rgba(255,255,255,.12); border-radius: 9px; overflow: hidden; }
.stat-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--blue), #8fe3ff); border-radius: inherit; }
.dim { color: var(--text-dim); } .lock-txt { color: var(--primary); font-weight: 800; } .good-txt { color: var(--good); font-weight: 800; margin-top: 8px; }

/* ------------------------------------------------------------------ credits */
.credits-logo { display: flex; flex-direction: column; align-items: center; max-width: 380px; margin: 0 auto; }
.credits .lead { font-size: 1.1rem; font-weight: 700; }
.credit-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.credit-list li { display: flex; flex-direction: column; }
.credit-list b { color: var(--primary); font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; }
.credit-list span { font-weight: 700; }
.results-locknote { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 10px 0 0; color: var(--text-dim); font-size: .9rem; font-weight: 700; text-align: center; }
.results-locknote svg { width: 16px; height: 16px; flex: none; }
.credit-link { color: inherit; text-decoration: underline; text-decoration-color: var(--primary); text-underline-offset: 3px; }
.safety { border-color: rgba(255, 122, 61, .45); }
.coach-inline { display: flex; align-items: center; gap: 14px; justify-content: center; font-weight: 800; font-size: 1.1rem; }
.coach-inline svg { width: 72px; height: 72px; animation: bob 3s ease-in-out infinite; }

/* ------------------------------------------------------------------ toasts */
#toasts { position: fixed; z-index: 60; left: 50%; top: calc(var(--safe-t) + 12px); transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; width: min(92vw, 460px); pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 14px; min-height: 52px; max-width: 100%;
  background: rgba(13, 19, 33, .9); border: 1px solid var(--glass-border); border-radius: 16px; box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); font-weight: 700;
  opacity: 0; transform: translateY(-16px) scale(.96); transition: opacity .25s, transform .3s var(--ease-pop);
}
.toast.in { opacity: 1; transform: none; }
.toast.out { opacity: 0; transform: translateY(-10px) scale(.96); }
.toast-ico { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex: none; background: rgba(73,198,242,.2); color: var(--blue); }
.toast-ico .ico { width: 20px; height: 20px; }
.toast-good .toast-ico { background: rgba(62,224,143,.2); color: var(--good); }
.toast-bad .toast-ico { background: rgba(255,77,94,.2); color: var(--bad); }
.toast-warn .toast-ico { background: rgba(255,181,71,.2); color: var(--primary); }
.toast-star .toast-ico { background: rgba(255,210,94,.22); color: var(--star); }
.toast-text { flex: 1; }
.toast-btn { min-height: 40px; padding: 6px 14px; border-radius: 12px; border: 0; font-weight: 900; color: #1a0f05; background: linear-gradient(180deg, var(--primary-hi), var(--primary-2)); }

/* ------------------------------------------------------------------ dialogs */
#dialogs { position: fixed; inset: 0; z-index: 70; pointer-events: none; }
.dialog-wrap {
  position: absolute; inset: 0; pointer-events: auto; display: grid; place-items: center;
  padding: calc(var(--safe-t) + 16px) calc(var(--safe-r) + 16px) calc(var(--safe-b) + 16px) calc(var(--safe-l) + 16px);
  background: rgba(5, 9, 20, .55); opacity: 0; transition: opacity .2s;
}
.dialog-wrap.in { opacity: 1; }
.dialog-wrap.out { opacity: 0; }
.dialog { width: min(100%, 440px); max-height: 100%; overflow: auto; padding: 22px; text-align: center; transform: scale(.9) translateY(10px); transition: transform .3s var(--ease-pop); background: rgba(16, 24, 42, .92); }
.dialog-wrap.in .dialog { transform: none; }
.dialog-icon { width: 64px; height: 64px; margin: -4px auto 10px; border-radius: 20px; display: grid; place-items: center; background: linear-gradient(160deg, var(--primary-hi), var(--primary-2)); color: #2a1206; box-shadow: inset 0 -3px 0 rgba(0,0,0,.15); }
.dialog-icon .ico { width: 34px; height: 34px; }
.dialog-title { font-size: 1.45rem; font-weight: 900; margin-bottom: 8px; }
.dialog-body { color: rgba(240,244,255,.85); font-weight: 600; text-align: left; }
.dialog-body p + p { margin-top: 8px; }
/* first-run welcome (Coach Søs → first school lesson) */
.onboard-dialog { width: min(100%, 460px); }
.onboard-dialog .dialog-title { margin-top: 2px; }
.ob-coach { width: 104px; height: 104px; margin: -8px auto 4px; animation: bob 3s ease-in-out infinite; }
.ob-coach svg { width: 100%; height: 100%; }
.ob-lead { text-align: center; font-size: 1.02rem; }
.ob-steps { list-style: none; margin: 12px 0 2px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ob-steps li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px; background: rgba(255,255,255,.06); font-weight: 800; color: #fff; animation: cardIn .45s var(--ease-pop) both; }
.ob-steps li:nth-child(2) { animation-delay: .12s; } .ob-steps li:nth-child(3) { animation-delay: .24s; }
.ob-steps .ico { width: 22px; height: 22px; color: var(--primary); flex: none; }
.ob-n { width: 24px; height: 24px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: .8rem; font-weight: 900; background: linear-gradient(180deg, #ffc65c, #ff7a3d); color: #1b2335; }
@media (max-height: 520px) { .ob-coach { display: none; } .ob-steps { margin-top: 6px; } .ob-steps li { padding: 5px 10px; } }
.dialog-buttons { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.dialog-buttons .btn { flex: 1 1 140px; }

/* ------------------------------------------------------------------ responsive */
.hide-sm { }
@media (max-width: 420px) {
  :root { --gutter: 12px; }
  .hide-sm { display: none; }
  .pill { height: 46px; padding: 0 12px; font-size: 1.05rem; }
  .icon-btn { width: 46px; height: 46px; }
  .pill-xp-txt b { font-size: .78rem; }
  .xpbar { width: 64px; }
  .act-grid, .area-grid { grid-template-columns: 1fr; }
  .act-card { grid-template-columns: auto 1fr; }
  .act-side { grid-column: 2; justify-self: start; margin-top: -6px; }
  .stars .star svg { width: 22px; height: 22px; }
  .passport { flex-direction: column; text-align: center; }
  .pass-rank { justify-content: center; }
  .boat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .bc-art { height: 86px; }
}
@media (min-width: 900px) {
  .profile-wrap { grid-template-columns: 300px 1fr; align-items: start; }
  .profile-preview { position: sticky; top: 0; grid-template-columns: 1fr; grid-template-areas: "av" "boat" "name" "sail" "rnd"; justify-items: center; }
  .pp-avatar { width: 180px; height: 180px; }
  .pp-boat { width: 90px; height: 150px; }
}
/* phone landscape: logo left, menu right */
@media (orientation: landscape) and (max-height: 540px) {
  .screen { padding-top: calc(var(--safe-t) + 8px); padding-bottom: calc(var(--safe-b) + 6px); }
  .title-main { flex-direction: row; max-width: 980px; gap: 28px; }
  .title-logo { flex: 1.1; }
  .title-menu { flex: 1; gap: 10px; }
  .logo-boat { width: 52%; }
  .btn-play { min-height: 60px; font-size: 1.4rem; }
  .menu-btn { min-height: 56px; padding: 8px 16px; }
  .mb-txt b { font-size: 1.05rem; } .mb-txt small { font-size: .82rem; }
  .title-foot .hint { display: none; }
  .screen-head { margin-bottom: 8px; }
  .head-sub { -webkit-line-clamp: 1; }
  .profile-wrap { grid-template-columns: 240px 1fr; align-items: start; }
  .profile-preview { position: sticky; top: 0; grid-template-columns: 1fr 1fr; grid-template-areas: "av av" "name name" "sail sail" "rnd boat"; }
  .pp-avatar { width: 110px; height: 110px; justify-self: center; }
  .pp-boat { width: 50px; height: 84px; }
  .passport { padding: 12px; }
  .pass-avatar { width: 76px; height: 76px; }
  .pass-stamp { display: none; }
  .pass-name { font-size: 1.3rem; }
}
@media (min-width: 700px) and (min-height: 1000px) {
  .title-main { max-width: 700px; }
  .logo-text { max-width: 700px; }
  .logo-boat { width: min(70%, 440px); }
  .btn-play { min-height: 88px; font-size: 2rem; }
  .menu-btn { min-height: 84px; }
  .tagline { font-size: 1.9rem; }
}
@media (min-width: 1200px) and (min-height: 800px) {
  .title-main { max-width: 620px; }
}

/* reduced motion */
.reduce-motion *, .reduce-motion *::before, .reduce-motion *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* results: in landscape the badge / boat-unlock toasts go below the card (under the stars on phones) instead of over the score */
body[data-screen="results"] .toast { pointer-events: none; }
@media (orientation: landscape) { body[data-screen="results"] #toasts { top: auto; bottom: calc(var(--safe-b) + 14px); flex-direction: column-reverse; } }
@media (orientation: landscape) and (max-height: 540px) {
  body[data-screen="results"] #toasts { left: 26%; width: min(44vw, 380px); bottom: calc(var(--safe-b) + 10px); }
  body[data-screen="results"] .toast { padding-top: 6px; padding-bottom: 6px; }
}

/* screen-reader only text, and no focus ring on programmatically focused headings */
.sr-only { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
h1[tabindex="-1"]:focus, h2[tabindex="-1"]:focus { outline: none; }

/* God mode (testing only: localStorage kos.godmode = "1" or #god=1) */
.god-pill { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 999px; font-weight: 800; font-size: 12px; letter-spacing: .12em; color: #2b1300; background: linear-gradient(180deg, #ffe27a, #ffb547); box-shadow: 0 0 14px rgba(255, 200, 80, .55); align-self: center; }
.god-row { justify-content: center; gap: 8px; }
