/* Horn of the High Seas — UI styles */
:root {
  --ink: #06121d;
  --panel: rgba(8, 21, 33, 0.76);
  --panel-solid: #0b1d2d;
  --panel-2: rgba(255, 255, 255, 0.045);
  --line: rgba(232, 196, 120, 0.3);
  --line-soft: rgba(255, 255, 255, 0.08);
  --gold: #e8c478;
  --gold-2: #f8e2a6;
  --gold-3: #b98a36;
  --teal: #3fd0c9;
  --green: #7dffb0;
  --red: #ff5a48;
  --amber: #ffb547;
  --blue: #6fb7ff;
  --text: #eef3f6;
  --muted: #9ab0c0;
  --serif: Georgia, "Palatino Linotype", "Book Antiqua", Palatino, serif;
  --sans: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --r: 12px;
  --gut: clamp(10px, 1.4vw, 18px);
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--ink); color: var(--text); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
kbd {
  display: inline-flex; align-items: center; justify-content: center; min-width: 1.7em; height: 1.7em; padding: 0 .45em;
  border-radius: 6px; border: 1px solid rgba(255, 255, 255, .28); border-bottom-width: 2px; background: rgba(255, 255, 255, .08);
  font: 700 .74em/1 var(--sans); letter-spacing: .02em; color: var(--text); white-space: nowrap;
}
.ico { width: 1.1em; height: 1.1em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.18em; flex: none; }
.muted { color: var(--muted); }
.small { font-size: .85em; }
.spacer { flex: 1; }

/* ---------- game layers ---------- */
#game { position: fixed; inset: 0; isolation: isolate; cursor: crosshair; background: #061827; }
#game canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#cv-light { mix-blend-mode: multiply; pointer-events: none; image-rendering: auto; }
#vignette { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 55%, rgba(0, 8, 16, .45) 100%); }

#ui { position: fixed; inset: 0; pointer-events: none; z-index: 10; }

/* ---------- loading ---------- */
#loading { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: radial-gradient(ellipse at 50% 40%, #0d2a40 0%, #06121d 70%); transition: opacity .8s ease; }
#loading.done { opacity: 0; pointer-events: none; }
.load-inner { width: min(420px, 86vw); text-align: center; }
.load-kicker, .logo-kicker, .modal-kicker { font: 600 12px/1.2 var(--sans); letter-spacing: .22em; text-transform: uppercase; color: var(--teal); display: flex; align-items: center; gap: 8px; }
.load-kicker { justify-content: center; }
.load-title { font: 700 clamp(34px, 6vw, 52px)/1.05 var(--serif); margin: 12px 0 26px; color: var(--gold-2); text-shadow: 0 2px 20px rgba(232, 196, 120, .25); }
.load-title span { display: block; font-size: .38em; letter-spacing: .4em; text-transform: uppercase; color: var(--muted); margin: 6px 0; }
.load-track { height: 6px; border-radius: 6px; background: rgba(255, 255, 255, .08); overflow: hidden; }
#load-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--teal), var(--gold)); border-radius: 6px; transition: width .2s; }
#load-text { margin-top: 12px; font-size: 13px; color: var(--muted); letter-spacing: .04em; }

/* ---------- panels ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); backdrop-filter: blur(8px) saturate(1.15); -webkit-backdrop-filter: blur(8px) saturate(1.15); }

/* ---------- HUD ---------- */
#hud { position: absolute; inset: 0; pointer-events: none; }
#hud[hidden] { display: none; }
.hud-status { position: absolute; top: var(--gut); left: var(--gut); width: clamp(230px, 22vw, 290px); padding: 12px 14px 12px; }
.hs-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.rank-badge { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font: 700 17px var(--serif); color: #1c1305; background: radial-gradient(circle at 35% 30%, var(--gold-2), var(--gold) 55%, var(--gold-3)); box-shadow: 0 0 0 2px rgba(0, 0, 0, .35), 0 0 14px rgba(232, 196, 120, .35); flex: none; }
.hs-captain { font: 700 16px/1.15 var(--serif); color: var(--gold-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.hs-title { font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-top: 2px; }
.bar-row { display: flex; align-items: center; gap: 8px; margin: 6px 0; font-size: 12px; }
.bar-label { width: 62px; display: flex; align-items: center; gap: 5px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-size: 10.5px; font-weight: 600; }
.bar-val { min-width: 54px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.bar { flex: 1; height: 8px; border-radius: 6px; background: rgba(255, 255, 255, .09); overflow: hidden; position: relative; }
.bar.thin { height: 5px; }
.bar-fill { height: 100%; border-radius: inherit; transition: width .18s ease-out; }
.bar-fill.hull { background: linear-gradient(90deg, #2fbf71, #7dffb0); }
.bar-fill.hull.mid { background: linear-gradient(90deg, #e09a2a, #ffd166); }
.bar-fill.hull.low { background: linear-gradient(90deg, #c7321f, #ff6b5b); animation: pulse 0.9s ease-in-out infinite; }
.bar-fill.speed { background: linear-gradient(90deg, #1e8f9a, var(--teal)); transition: width .1s linear; }
.bar-fill.enemy { background: linear-gradient(90deg, #c7321f, #ff8a65); }
.bar-fill.gold { background: linear-gradient(90deg, var(--gold-3), var(--gold-2)); }
@keyframes pulse { 50% { opacity: .55; } }
.chips { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border-radius: 999px; background: rgba(255, 255, 255, .06); border: 1px solid var(--line-soft); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.chip.money { color: var(--gold-2); border-color: rgba(232, 196, 120, .3); }
.chip.danger { color: #ffb4a8; border-color: rgba(255, 90, 72, .4); }
.money-float { position: absolute; left: 22px; bottom: -6px; font: 700 15px var(--sans); opacity: 0; pointer-events: none; }
.money-float.pos { color: var(--green); }
.money-float.neg { color: #ff9a8c; }
.money-float.go { animation: floatUp 1.4s ease-out forwards; }
@keyframes floatUp { 0% { opacity: 0; transform: translateY(0); } 15% { opacity: 1; } 100% { opacity: 0; transform: translateY(26px); } }

.hud-wanted { position: absolute; top: var(--gut); left: 50%; transform: translateX(-50%); text-align: center; width: min(460px, 46vw); }
.stars { display: inline-flex; gap: 4px; padding: 6px 12px; border-radius: 999px; background: rgba(5, 15, 25, .55); border: 1px solid var(--line-soft); }
.star .ico { width: 24px; height: 24px; fill: rgba(255, 255, 255, .07); stroke: rgba(255, 255, 255, .32); stroke-width: 1.4; }
.star.on .ico { fill: #ffcf5a; stroke: #ffe39a; filter: drop-shadow(0 0 6px rgba(255, 190, 60, .65)); }
.star.partial .ico { fill: rgba(255, 207, 90, calc(var(--p, 0) * .55)); }
.star.flash .ico { animation: starFlash .6s steps(2) infinite; }
@keyframes starFlash { 50% { fill: #ff5a48; stroke: #ffb4a8; filter: drop-shadow(0 0 7px rgba(255, 70, 50, .8)); } }
.wanted-status { margin-top: 6px; font-size: 13px; min-height: 18px; text-shadow: 0 1px 3px rgba(0, 0, 0, .9); }
.wanted-status b { font-weight: 700; display: inline-flex; align-items: center; gap: 6px; }
.wanted-status .danger { color: #ff8f80; }
.wanted-status .warn { color: var(--amber); }
.wanted-status .good { color: var(--green); }
.boss-bar { margin: 10px auto 0; width: min(420px, 44vw); }
.boss-bar[hidden] { display: none; }
.boss-name { font: 700 14px var(--serif); letter-spacing: .14em; text-transform: uppercase; color: #ffb4a8; text-shadow: 0 2px 6px #000; margin-bottom: 5px; }
.bar.boss { height: 11px; border: 1px solid rgba(255, 90, 72, .5); background: rgba(40, 0, 0, .5); }
.bar.boss .bar-fill { background: linear-gradient(90deg, #8e1b12, #ff5a48, #ffb547); }

.hud-right { position: absolute; top: var(--gut); right: var(--gut); width: clamp(190px, 17vw, 236px); display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.minimap-wrap { position: relative; width: 100%; aspect-ratio: 1; border-radius: 50%; box-shadow: 0 8px 30px rgba(0, 0, 0, .55), 0 0 0 4px rgba(10, 24, 36, .85), 0 0 0 5px rgba(232, 196, 120, .4); background: #071a2b; }
#minimap { width: 100%; height: 100%; display: block; border-radius: 50%; }
.mm-n { position: absolute; top: -2px; left: 50%; transform: translate(-50%, -50%); font: 700 11px var(--serif); color: #1c1305; background: var(--gold); border-radius: 50%; width: 20px; height: 20px; display: grid; place-items: center; box-shadow: 0 2px 6px rgba(0, 0, 0, .5); }
.env-row { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 7px 10px; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.env-row span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.env-row .wind i { font-style: normal; display: inline-block; color: var(--teal); transition: transform .5s; font-size: 12px; }
.objective { padding: 10px 12px 11px; }
.objective.warn { border-color: rgba(255, 90, 72, .6); }
.obj-kicker { font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--teal); display: flex; gap: 6px; align-items: center; font-weight: 700; }
.obj-title { font: 700 15px/1.25 var(--serif); color: var(--gold-2); margin: 5px 0 3px; }
.obj-text { font-size: 12.5px; color: #d5e1ea; line-height: 1.35; }
.obj-prog { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.objective.warn .obj-prog span { color: #ff8f80; font-weight: 700; }

.hud-target { position: absolute; left: var(--gut); bottom: var(--gut); width: clamp(240px, 22vw, 300px); padding: 11px 13px; }
.hud-target[hidden] { display: none; }
.tg-head { display: flex; gap: 9px; align-items: center; margin-bottom: 6px; }
.tg-dot { width: 11px; height: 11px; border-radius: 50%; box-shadow: 0 0 10px currentColor; flex: none; }
.tg-name { font: 700 14.5px/1.2 var(--serif); }
.tg-class { font-size: 11.5px; color: var(--muted); }
.tg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; margin-top: 6px; font-size: 12px; }
.tg-grid label { display: block; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.tg-grid span { font-weight: 600; }

.hud-actions { position: absolute; right: var(--gut); bottom: var(--gut); display: flex; gap: 6px; align-items: flex-end; }
.act { position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 64px; padding: 8px 8px 7px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line-soft); font-size: 11px; font-weight: 600; color: #d8e3ea; backdrop-filter: blur(6px); }
.act .ico { width: 20px; height: 20px; color: var(--gold-2); }
.act kbd { font-size: 10px; height: 1.6em; }
.act.small { min-width: 0; padding: 7px 8px; gap: 5px; }
.act.small span { color: var(--muted); }
.act .cd { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: rgba(0, 0, 0, .55); pointer-events: none; }
.act.ready { border-color: rgba(232, 196, 120, .35); }
.act b { color: var(--gold-2); }

.hud-prompt { position: absolute; left: 50%; bottom: clamp(70px, 12vh, 110px); transform: translateX(-50%); text-align: center; }
.hud-prompt[hidden] { display: none; }
.prompt-inner { display: inline-flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 999px; background: rgba(6, 18, 29, .82); border: 1px solid rgba(232, 196, 120, .5); box-shadow: 0 6px 24px rgba(0, 0, 0, .45); font-size: 15px; font-weight: 600; animation: promptIn .25s ease-out; }
.prompt-inner kbd { font-size: 13px; background: var(--gold); color: #1c1305; border-color: var(--gold-2); }
.prompt-bar { width: 260px; margin: 8px auto 0; }
.prompt-bar[hidden] { display: none; }
@keyframes promptIn { from { opacity: 0; transform: translateY(6px); } }

/* ---------- toasts / banner / mission card ---------- */
#toasts { position: absolute; z-index: 7; left: var(--gut); top: clamp(190px, 26vh, 240px); width: min(360px, 80vw); display: flex; flex-direction: column; gap: 7px; }
.toast { display: flex; gap: 9px; align-items: flex-start; padding: 9px 12px; border-radius: 10px; background: rgba(8, 21, 33, .86); border: 1px solid var(--line-soft); border-left: 3px solid var(--blue); font-size: 13.5px; line-height: 1.35; box-shadow: 0 6px 20px rgba(0, 0, 0, .35); animation: toastIn .3s ease-out; transition: opacity .5s, transform .5s; }
.toast .ico { margin-top: 2px; color: var(--blue); }
.toast-good { border-left-color: var(--green); } .toast-good .ico { color: var(--green); }
.toast-warn { border-left-color: var(--amber); } .toast-warn .ico { color: var(--amber); }
.toast-danger { border-left-color: var(--red); background: rgba(40, 10, 10, .82); } .toast-danger .ico { color: var(--red); }
.toast-hint { border-left-color: var(--teal); background: rgba(6, 30, 36, .88); } .toast-hint .ico { color: var(--teal); }
.toast.out { opacity: 0; transform: translateX(-12px); }
@keyframes toastIn { from { opacity: 0; transform: translateX(-16px); } }

.banner { position: absolute; z-index: 8; top: 19%; left: 50%; transform: translate(-50%, -12px); text-align: center; opacity: 0; transition: opacity .45s ease, transform .45s ease; width: min(900px, 94vw); pointer-events: none; }
.banner.show { opacity: 1; transform: translate(-50%, 0); }
.banner-title { font: 700 clamp(26px, 4.4vw, 50px)/1.05 var(--serif); letter-spacing: .12em; text-transform: uppercase; background: linear-gradient(180deg, #fff6d8, var(--gold) 60%, var(--gold-3)); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 3px 10px rgba(0, 0, 0, .8)); }
.banner-sub { margin-top: 8px; font-size: clamp(13px, 1.5vw, 17px); color: #e7eef3; text-shadow: 0 2px 8px #000; letter-spacing: .04em; }
.banner-danger .banner-title { background: linear-gradient(180deg, #ffd6cf, #ff6b5b 60%, #a3261b); -webkit-background-clip: text; background-clip: text; }
.banner-good .banner-title { background: linear-gradient(180deg, #eafff3, var(--green) 55%, #2fbf71); -webkit-background-clip: text; background-clip: text; }
.banner-warn .banner-title { background: linear-gradient(180deg, #fff1d6, var(--amber) 60%, #b36b00); -webkit-background-clip: text; background-clip: text; }
.banner-boss .banner-title { font-size: clamp(30px, 5.4vw, 64px); background: linear-gradient(180deg, #ffe0d9, #ff4a36 55%, #5e0f08); -webkit-background-clip: text; background-clip: text; }
.banner-boss .banner-sub { font-family: var(--serif); font-style: italic; font-size: clamp(15px, 1.8vw, 20px); }

.mc-kicker { font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--teal); display: flex; gap: 7px; align-items: center; font-weight: 700; }
.mc-title { font: 700 22px var(--serif); color: var(--gold-2); margin: 6px 0; }
.mc-brief { margin: 0 0 10px; font-size: 13.5px; line-height: 1.5; color: #dbe5ec; }
.mc-obj, .mc-tip { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; padding: 7px 10px; border-radius: 8px; background: rgba(232, 196, 120, .09); margin-top: 6px; }
.mc-obj { color: var(--gold-2); font-weight: 600; }
.mc-obj b { margin-left: auto; color: var(--text); }
.mc-tip { background: rgba(63, 208, 201, .08); color: #c7eeec; }
.mc-tip .ico { color: var(--teal); }
.briefing { width: min(600px, 100%); border-color: rgba(232, 196, 120, .5); }
.briefing.boss { border-color: rgba(255, 90, 72, .6); background: linear-gradient(180deg, rgba(48, 16, 14, .97), rgba(12, 14, 22, .97)); }
.briefing .story { margin-bottom: 14px; }
.boss-intro { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: rgba(255, 90, 72, .1); border: 1px solid rgba(255, 90, 72, .3); margin-bottom: 8px; font-size: 13px; line-height: 1.45; }
.boss-intro .ico { color: #ff8f80; margin-top: 2px; }
.boss-intro b { color: #ffb4a8; font-family: var(--serif); }
.boss-intro em { color: var(--muted); }
.boss-intro span { display: block; margin-top: 3px; color: #e8d6d3; }
.mc-obj b { display: inline-flex; align-items: center; gap: 4px; }
.modal-wrap.brief { background: rgba(2, 9, 16, .45); }

/* ---------- screens & buttons ---------- */
#screens { position: absolute; inset: 0; pointer-events: auto; z-index: 5; }
#screens:empty { display: none; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 9px; padding: 10px 16px; border-radius: 10px; border: 1px solid rgba(232, 196, 120, .35); background: rgba(255, 255, 255, .055); color: var(--text); font-weight: 600; font-size: 14.5px; cursor: pointer; transition: background .15s, border-color .15s, transform .08s, box-shadow .15s; text-align: left; line-height: 1.2; }
.btn:hover:not([disabled]) { background: rgba(232, 196, 120, .14); border-color: var(--gold); box-shadow: 0 0 0 3px rgba(232, 196, 120, .08); }
.btn:active:not([disabled]) { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.btn.primary { background: linear-gradient(180deg, #f2d48e, #d3a548); color: #1d1404; border-color: #f8e2a6; box-shadow: 0 4px 16px rgba(211, 165, 72, .25); }
.btn.primary:hover:not([disabled]) { background: linear-gradient(180deg, #f8e0a6, #ddb359); }
.btn.ghost { background: transparent; border-color: rgba(255, 255, 255, .16); }
.btn.big { padding: 14px 20px; font-size: 17px; }
.btn.tiny { padding: 6px 10px; font-size: 12.5px; border-radius: 8px; gap: 6px; }
.btn[disabled] { opacity: .42; cursor: not-allowed; }
.btn small { display: block; font-size: 12px; font-weight: 500; opacity: .78; margin-top: 2px; }
.btn > span { display: block; }

/* main menu */
#screens.menu { background: none; }
.menu-screen { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(3, 11, 19, .93) 0%, rgba(3, 11, 19, .76) 34%, rgba(3, 11, 19, .1) 68%, rgba(3, 11, 19, 0) 100%); }
.menu-left { position: absolute; left: clamp(20px, 7vw, 130px); top: 50%; transform: translateY(-50%); width: min(460px, calc(100vw - 40px)); }
.logo h1 { margin: 14px 0 0; font: 700 clamp(46px, 6.6vw, 88px)/.92 var(--serif); letter-spacing: .01em; background: linear-gradient(180deg, #fff7dc 0%, var(--gold) 52%, #9c6f22 100%); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 4px 18px rgba(0, 0, 0, .6)); }
.logo h1 span { display: block; font-size: .3em; letter-spacing: .5em; text-transform: uppercase; margin: .55em 0 .5em .1em; background: linear-gradient(90deg, var(--teal), #9ff0ec); -webkit-background-clip: text; background-clip: text; }
.logo-rule { height: 1px; margin: 22px 0 14px; background: linear-gradient(90deg, var(--gold), rgba(232, 196, 120, 0)); position: relative; }
.logo-rule i { position: absolute; left: 0; top: -4px; width: 9px; height: 9px; transform: rotate(45deg); background: var(--gold); }
.tagline { margin: 0 0 28px; font: italic 17px/1.5 var(--serif); color: #d6e2ea; }
.menu-buttons { display: flex; flex-direction: column; gap: 10px; max-width: 360px; }
.menu-buttons .btn { justify-content: flex-start; }
.menu-buttons .btn .ico { width: 20px; height: 20px; }
.menu-foot { margin-top: 30px; font-size: 12px; color: var(--muted); max-width: 380px; line-height: 1.5; }

/* modals */
.modal-wrap { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; background: rgba(2, 9, 16, .62); backdrop-filter: blur(3px); animation: fadeIn .25s ease-out; overflow: auto; }
@keyframes fadeIn { from { opacity: 0; } }
.modal { width: min(640px, 100%); padding: clamp(18px, 3vw, 30px); background: linear-gradient(180deg, rgba(16, 33, 48, .97), rgba(8, 20, 32, .97)); animation: rise .3s ease-out; max-height: calc(100vh - 32px); overflow: auto; }
.modal.wide { width: min(1020px, 100%); }
.modal.small { width: min(460px, 100%); }
@keyframes rise { from { transform: translateY(14px); opacity: .4; } }
.modal h2, .log h2, .port h2 { margin: 6px 0 12px; font: 700 clamp(22px, 3vw, 30px)/1.15 var(--serif); color: var(--gold-2); }
.modal h3 { font: 700 16px var(--serif); color: var(--gold-2); display: flex; align-items: center; gap: 8px; margin: 18px 0 8px; }
.story { font: 15px/1.6 var(--serif); color: #d8e3ea; margin: 0 0 12px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; align-items: center; }
.field { display: flex; flex-direction: column; gap: 6px; margin: 16px 0 6px; font-size: 13px; color: var(--muted); font-weight: 600; letter-spacing: .04em; }
.field input { padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: rgba(0, 0, 0, .3); font: 600 17px var(--serif); color: var(--gold-2); outline: none; }
.field input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(232, 196, 120, .15); }
.warn-note { display: flex; gap: 8px; align-items: center; margin-top: 10px; font-size: 13px; color: var(--amber); padding: 8px 10px; border-radius: 8px; background: rgba(255, 181, 71, .08); }

/* how to */
.howto { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 26px; }
.howto h3:first-child { margin-top: 4px; }
.kb { display: flex; align-items: center; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line-soft); font-size: 13.5px; }
.kb > span { display: flex; gap: 4px; min-width: 112px; }
.kb em { font-style: normal; color: #d2dde5; }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 7px; font-size: 13.5px; line-height: 1.45; color: #d2dde5; }
.steps b { color: var(--gold-2); }
.howto p { font-size: 13.5px; line-height: 1.5; color: #d2dde5; }
.tips { display: grid; gap: 7px; }
.tips div { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; padding: 8px 10px; border-radius: 8px; background: rgba(63, 208, 201, .07); color: #c7eeec; }
.tips .ico { color: var(--teal); margin-top: 1px; }

/* settings */
.settings h3 { margin: 16px 0 6px; }
.settings h3:first-child { margin-top: 0; }
.set-row { display: flex; align-items: center; gap: 14px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.set-row > span { flex: 1; }
.set-row small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.set-row input[type=range] { width: min(240px, 40vw); accent-color: var(--gold); }
.set-row output { width: 44px; text-align: right; font-variant-numeric: tabular-nums; color: var(--gold-2); font-weight: 600; }
.set-row select { padding: 7px 10px; border-radius: 8px; background: #0e2335; border: 1px solid var(--line); color: var(--text); }
.set-row.toggle { cursor: pointer; }
.set-row.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.set-row.toggle i { width: 42px; height: 24px; border-radius: 999px; background: rgba(255, 255, 255, .14); position: relative; transition: background .2s; flex: none; }
.set-row.toggle i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #dfe7ec; transition: transform .2s; }
.set-row.toggle input:checked + i { background: linear-gradient(90deg, var(--gold-3), var(--gold)); }
.set-row.toggle input:checked + i::after { transform: translateX(18px); }
.set-row.toggle input:focus-visible + i { outline: 2px solid var(--teal); outline-offset: 2px; }

/* captain's log & port */
.log-wrap, .port-wrap { position: absolute; inset: 0; display: grid; place-items: center; padding: 14px; background: rgba(2, 9, 16, .55); backdrop-filter: blur(2px); animation: fadeIn .2s ease-out; }
.log, .port { width: min(1180px, 100%); height: min(820px, calc(100vh - 28px)); display: flex; flex-direction: column; background: linear-gradient(180deg, rgba(14, 30, 44, .97), rgba(7, 18, 29, .97)); overflow: hidden; animation: rise .25s ease-out; }
.log-head, .port-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: clamp(14px, 2vw, 22px) clamp(16px, 2.4vw, 26px) 6px; flex-wrap: wrap; }
.log-head h2, .port-head h2 { margin: 4px 0 0; }
.port-head p { margin: 4px 0 0; max-width: 560px; font-size: 13.5px; }
.log-money { font: 700 20px var(--serif); color: var(--gold-2); display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 10px; background: rgba(232, 196, 120, .08); border: 1px solid var(--line); }
.port-chips { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; max-width: 520px; }
.tabs { display: flex; gap: 4px; padding: 10px clamp(16px, 2.4vw, 26px) 0; border-bottom: 1px solid var(--line-soft); overflow-x: auto; scrollbar-width: none; flex: none; }
.tab { display: inline-flex; align-items: center; gap: 7px; padding: 10px 14px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; border-radius: 8px 8px 0 0; }
.tab:hover { color: var(--text); background: rgba(255, 255, 255, .04); }
.tab.on { color: var(--gold-2); border-bottom-color: var(--gold); background: rgba(232, 196, 120, .07); }
.log-body, .port-body { flex: 1; overflow: auto; padding: clamp(14px, 2vw, 22px) clamp(16px, 2.4vw, 26px); }
.log-foot { display: flex; gap: 10px; align-items: center; padding: 12px clamp(16px, 2.4vw, 26px); border-top: 1px solid var(--line-soft); flex-wrap: wrap; background: rgba(0, 0, 0, .15); }
.sec { font: 700 16px var(--serif); color: var(--gold-2); display: flex; align-items: center; gap: 8px; margin: 22px 0 10px; flex-wrap: wrap; }
.sec small { font: 500 12px var(--sans); color: var(--muted); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.stat-grid.small { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin-top: 14px; }
.stat { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; padding: 10px 12px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line-soft); }
.stat .ico { grid-row: 1 / 3; width: 22px; height: 22px; color: var(--gold); }
.stat label { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.stat b { font-size: 13.5px; font-variant-numeric: tabular-nums; }
.ship-card { display: flex; gap: 18px; align-items: center; margin-bottom: 14px; }
.ship-card h3 { margin: 0 0 4px; font: 700 20px var(--serif); color: var(--gold-2); }
.ship-card p { margin: 0; font-size: 13.5px; }
.ship-img { width: 190px; height: 76px; display: grid; place-items: center; border-radius: 12px; background: radial-gradient(ellipse, #1f6c88 0%, #0b3550 70%); border: 1px solid var(--line-soft); flex: none; overflow: hidden; }
.ship-img img { max-width: 92%; max-height: 82%; filter: drop-shadow(4px 5px 3px rgba(0, 0, 0, .4)); }
.up-minis { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px; }
.up-mini { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; background: var(--panel-2); font-size: 13px; }
.up-mini .ico { color: var(--gold); }
.up-mini span { flex: 1; }
.pips { display: inline-flex; gap: 3px; vertical-align: middle; }
.pips i { width: 9px; height: 9px; border-radius: 2px; transform: rotate(45deg); background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .15); }
.pips i.on { background: var(--gold); border-color: var(--gold-2); box-shadow: 0 0 6px rgba(232, 196, 120, .5); }

/* crew */
.crew-hands { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 10px; background: var(--panel-2); margin-bottom: 14px; flex-wrap: wrap; }
.crew-hands b { font: 700 20px var(--serif); color: var(--gold-2); }
.crew-hands small { color: var(--muted); flex-basis: 100%; }
.crew-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.crew-grid.one { grid-template-columns: 1fr; }
.crew-card { display: flex; gap: 14px; padding: 14px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line-soft); }
.crew-card.vacant { opacity: .75; border-style: dashed; }
.crew-card p { margin: 6px 0 8px; font-size: 12.5px; line-height: 1.45; }
.crew-role { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--teal); font-weight: 700; display: flex; gap: 8px; align-items: center; }
.crew-name { font: 700 16px/1.3 var(--serif); color: var(--gold-2); margin-top: 3px; }
.crew-perk { font-size: 12.5px; color: #cfe6cf; margin-top: 4px; }
.crew-perk b { color: var(--green); font-weight: 600; }
.avatar { position: relative; width: 60px; height: 60px; border-radius: 50%; flex: none; display: grid; place-items: center; background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--c) 70%, white), var(--c) 55%, color-mix(in srgb, var(--c) 45%, black)); box-shadow: 0 0 0 2px rgba(0, 0, 0, .4), 0 0 0 3px rgba(232, 196, 120, .45); }
.avatar span { font: 700 20px var(--serif); color: rgba(10, 16, 22, .82); }
.avatar em { position: absolute; right: -4px; bottom: -4px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: #0b1d2d; border: 1px solid var(--line); color: var(--gold-2); }
.avatar em .ico { width: 14px; height: 14px; }
.avatar.sm { width: 46px; height: 46px; }
.avatar.sm span { font-size: 15px; }
.avatar.empty { background: rgba(255, 255, 255, .06); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .15); color: var(--muted); }
.avatar.empty .ico { width: 24px; height: 24px; }

/* cargo */
.cargo-row, .mkt-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line-soft); margin-bottom: 7px; }
.swatch { width: 12px; height: 12px; border-radius: 3px; flex: none; box-shadow: 0 0 0 2px rgba(0, 0, 0, .3); display: inline-block; }
.cargo-name { flex: 1; min-width: 0; }
.cargo-name b { display: block; font-size: 14px; }
.cargo-name small { color: var(--muted); font-size: 12px; }
.qty { font: 700 15px var(--serif); color: var(--gold-2); min-width: 40px; text-align: right; }
.val { color: var(--muted); font-size: 13px; min-width: 70px; text-align: right; font-variant-numeric: tabular-nums; }
.cap-row { display: flex; align-items: center; gap: 10px; margin: 6px 0 12px; font-size: 13px; }
.cap-row > span { display: flex; align-items: center; gap: 6px; color: var(--muted); min-width: 58px; }
.cap-row b { font-variant-numeric: tabular-nums; }
.empty { padding: 26px; text-align: center; color: var(--muted); font-style: italic; border: 1px dashed var(--line-soft); border-radius: 10px; }

/* map tab */
.map-tab { display: flex; flex-direction: column; height: 100%; min-height: 360px; gap: 10px; }
#worldmap { flex: 1; width: 100%; min-height: 300px; border-radius: 12px; border: 1px solid var(--line); cursor: crosshair; background: #06131f; }
.map-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: #c9d6df; align-items: center; }
.map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.map-legend i { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.map-legend i.dash { border-radius: 0; height: 0; border-top: 2px dashed rgba(255, 255, 255, .7); }

/* missions tab */
.missions-tab { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 22px; }
.mission-now { padding: 16px 18px; border-radius: 12px; background: linear-gradient(180deg, rgba(232, 196, 120, .1), rgba(232, 196, 120, .03)); border: 1px solid var(--line); }
.mission-now h3 { margin: 6px 0; font: 700 22px var(--serif); color: var(--gold-2); }
.mission-now p { font: 14px/1.6 var(--serif); color: #d8e3ea; margin: 0 0 10px; }
.mt-right .sec { margin-top: 0; }
.rank-row { display: flex; gap: 12px; padding: 9px 10px; border-radius: 10px; margin-bottom: 5px; align-items: flex-start; }
.rank-row.now { background: rgba(232, 196, 120, .08); border: 1px solid var(--line); }
.rank-row.locked { opacity: .5; }
.rank-num { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font: 700 13px var(--serif); background: rgba(255, 255, 255, .08); flex: none; }
.rank-row.done .rank-num, .rank-row.now .rank-num { background: var(--gold); color: #1c1305; }
.rank-info b { font: 700 14px var(--serif); }
.rank-ms { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 4px; font-size: 12.5px; color: var(--muted); }
.rank-ms span { display: inline-flex; align-items: center; gap: 5px; }
.rank-ms span.done { color: var(--green); }
.rank-ms span.now { color: var(--gold-2); font-weight: 600; }
.rank-ms em { font-style: normal; font-size: 10px; font-weight: 700; letter-spacing: .1em; color: #ff8f80; border: 1px solid rgba(255, 90, 72, .45); border-radius: 4px; padding: 0 4px; }

/* port */
.market { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(260px, 1fr); gap: 18px; }
.mkt-row.none { opacity: .6; }
.mkt-price { min-width: 92px; text-align: right; }
.mkt-price b { display: block; font: 700 16px var(--serif); color: var(--gold-2); }
.mkt-price em { font-style: normal; font-size: 11.5px; font-weight: 700; }
.mkt-price .up { color: var(--green); }
.mkt-price .down { color: #ff8f80; }
.mkt-price .flat { color: var(--muted); }
.mkt-btns { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; min-width: 200px; }
.mkt-side .btn.big { width: 100%; justify-content: flex-start; }
.compare { margin-top: 14px; padding: 12px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line-soft); }
.compare h4 { margin: 0 0 8px; font: 700 14px var(--serif); color: var(--gold-2); display: flex; gap: 7px; align-items: center; }
.compare table { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.compare th { text-align: right; font-weight: 600; color: var(--muted); padding: 4px; font-size: 11.5px; }
.compare td { padding: 4px; text-align: right; border-top: 1px solid var(--line-soft); }
.compare td:first-child, .compare th:first-child { text-align: left; }
.up-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.up-card { display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line-soft); }
.up-card.max { border-color: rgba(125, 255, 176, .35); }
.up-card p { margin: 0; font-size: 12.5px; line-height: 1.4; flex: 1; }
.up-top { display: flex; gap: 10px; align-items: center; }
.up-top .ico { width: 30px; height: 30px; padding: 6px; border-radius: 8px; background: rgba(232, 196, 120, .1); color: var(--gold-2); }
.up-top b { display: block; font: 700 15px var(--serif); margin-bottom: 3px; }
.up-fx { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.up-fx .next { color: var(--green); font-weight: 600; }
.up-fx .arrow { color: var(--gold); }
.up-card .btn { align-self: flex-start; }
.hull-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px; }
.hull-card { display: flex; gap: 14px; padding: 14px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line-soft); align-items: center; }
.hull-card.own { border-color: var(--line); background: rgba(232, 196, 120, .06); }
.hull-card img { width: 120px; height: auto; flex: none; filter: drop-shadow(3px 4px 3px rgba(0, 0, 0, .45)); }
.hull-card b { font: 700 16px var(--serif); color: var(--gold-2); }
.hull-card p { margin: 4px 0 8px; font-size: 12.5px; line-height: 1.4; }
.hull-stats { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; margin-bottom: 8px; color: #d2dde5; }
.hull-stats span { display: inline-flex; align-items: center; gap: 4px; }
.hull-stats .ico { color: var(--gold); }
.rumour { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; background: rgba(63, 208, 201, .07); border: 1px solid rgba(63, 208, 201, .2); font: italic 14px/1.5 var(--serif); color: #cdeeed; margin-bottom: 8px; }
.rumour b { font-style: normal; font-family: var(--sans); color: var(--teal); font-size: 12.5px; }
.rumour .ico { color: var(--teal); margin-top: 3px; }
.tavern-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.crew-card.small { padding: 12px; }
.services { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.svc { padding: 16px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line-soft); }
.svc.hot { border-color: rgba(255, 90, 72, .45); background: rgba(255, 90, 72, .05); }
.svc-head { display: flex; gap: 9px; align-items: center; font: 700 16px var(--serif); color: var(--gold-2); }
.svc-head .ico { width: 22px; height: 22px; color: var(--gold); }
.svc p { font-size: 13px; line-height: 1.45; margin: 8px 0 12px; }
.svc-btns { display: flex; gap: 8px; flex-wrap: wrap; }

/* plunder */
.plunder { width: min(860px, 100%); }
.plunder-cols { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 18px; margin-top: 14px; }
.plunder h4 { margin: 0 0 10px; font: 700 15px var(--serif); color: var(--gold-2); display: flex; gap: 8px; align-items: center; }
.your-hold { padding: 14px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line-soft); align-self: start; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border-radius: 999px; background: rgba(255, 255, 255, .06); font-size: 12.5px; }
.extras { display: grid; gap: 6px; margin-top: 12px; }
.extras div { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; padding: 8px 10px; border-radius: 8px; background: rgba(232, 196, 120, .08); }
.extras .ico { color: var(--gold); margin-top: 1px; }

/* end screens */
.end-screen { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; animation: fadeIn .8s ease-out; }
.end-screen.lose { background: radial-gradient(ellipse at center, rgba(60, 8, 4, .55), rgba(2, 6, 10, .88)); }
.end-screen.win { background: radial-gradient(ellipse at center, rgba(70, 50, 10, .45), rgba(2, 6, 10, .85)); }
.end-title { font-size: clamp(30px, 5vw, 48px) !important; text-transform: uppercase; letter-spacing: .06em; }
.end-screen.lose .end-title { color: #ff9a8c; }
.end-title.gold { background: linear-gradient(180deg, #fff7dc, var(--gold) 55%, #9c6f22); -webkit-background-clip: text; background-clip: text; color: transparent; }

.fatal { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 200; padding: 10px 16px; border-radius: 10px; background: #5a1410; color: #fff; font: 600 13px var(--sans); box-shadow: var(--shadow); }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .act span { display: none; }
  .act { min-width: 46px; }
  .act.small { display: none; }
}
@media (max-width: 900px) {
  .howto, .missions-tab, .market, .tavern-cols, .plunder-cols { grid-template-columns: 1fr; }
  .hud-right { width: 160px; }
  .objective .obj-text { display: none; }
  .hud-status { width: 210px; padding: 10px 11px; }
  .hs-captain { font-size: 14px; }
  .hud-wanted { top: calc(var(--gut) + 2px); }
  .star .ico { width: 19px; height: 19px; }
  #toasts { top: 170px; width: min(300px, 70vw); }
  .menu-screen { background: linear-gradient(180deg, rgba(3, 11, 19, .7), rgba(3, 11, 19, .92)); }
  .menu-left { left: 50%; transform: translate(-50%, -50%); text-align: left; }
}
@media (max-width: 640px) {
  .hud-target { display: none !important; }
  .hud-wanted { top: auto; bottom: calc(var(--gut) + 70px); width: 90vw; }
  .hud-right { width: 128px; }
  .env-row { font-size: 10.5px; padding: 5px 7px; flex-wrap: wrap; justify-content: center; }
  .env-row #h-weather { display: none; }
  .objective { padding: 8px 9px; }
  .obj-title { font-size: 13px; }
  .hud-status { width: calc(100vw - 128px - var(--gut) * 3); }
  .hud-prompt { bottom: 150px; width: 92vw; }
  .prompt-inner { font-size: 13px; }
  .mkt-btns { min-width: 0; }
  .mkt-row, .cargo-row { flex-wrap: wrap; }
  .ship-card { flex-direction: column; align-items: flex-start; }
}
@media (max-height: 640px) {
  .hud-right .objective .obj-text { display: none; }
  #toasts { top: 150px; }
  .menu-left { top: 52%; }
  .logo h1 { font-size: clamp(36px, 9vh, 64px); }
  .tagline { margin-bottom: 14px; }
  .menu-foot { margin-top: 14px; }
  .menu-buttons { gap: 7px; }
  .menu-buttons .btn { padding-top: 8px; padding-bottom: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
