/* Salz & Säbel: UI styles (DESIGN.md §9). Pixel look: Endesga-32 subset, 4 px borders, chunky shadows.
   Sections: 1 tokens, 2 base, 3 layout, 4 HUD, 5 widgets, 6 sheets/modals, 7 Kapitän + Takelage, 8 Insel,
   9 Karte/Flotten, 10 Berichte, 11 Rangliste/Optionen, 12 responsive, 13 motion. */

/* ---------------------------------------------------------------------------------------------- 1 tokens */
:root {
	--c-ink: #181425; --c-night: #262b44; --c-slate: #3a4466; --c-steel: #5a6988; --c-fog: #8b9bb4; --c-mist: #c0cbdc;
	--c-white: #ffffff; --c-gold: #feae34; --c-yellow: #fee761; --c-orange: #f77622; --c-red: #e43b44; --c-darkred: #a22633;
	--c-wood: #733e39; --c-darkwood: #3e2731; --c-tan: #b86f50; --c-skin1: #e8b796; --c-skin2: #c28569; --c-sand: #ead4aa;
	--c-green: #63c74d; --c-darkgreen: #3e8948; --c-pine: #265c42; --c-blue: #0099db; --c-deep: #124e89; --c-foam: #2ce8f5;
	--path-h: #feae34; --path-s: #e43b44; --path-w: #0099db; --path-g: #8b9bb4;
	--font-px: 'Press Start 2P', ui-monospace, 'Courier New', monospace;
	--font-body: 'Silkscreen', ui-monospace, 'Courier New', monospace;
	--bw: 4px;
	--shadow: 6px 6px 0 var(--c-darkwood);
	--shadow-sm: 4px 4px 0 var(--c-darkwood);
	--panel-bg: var(--c-night);
	--text: var(--c-mist);
	--dim: var(--c-fog);
	--sheet-w: 360px;
	color-scheme: dark;
}

/* ----------------------------------------------------------------------------------------------- 2 base */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
	margin: 0; background: var(--c-ink); color: var(--text); font: 14px/1.5 var(--font-body);
	background-image: radial-gradient(var(--c-night) 1px, transparent 1px); background-size: 16px 16px;
	overflow: hidden; -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, h4 { font-family: var(--font-px); font-weight: normal; margin: 0; line-height: 1.4; }
h2 { font-size: 12px; } h3 { font-size: 10px; }
p { margin: 0 0 8px; }
a { color: var(--c-yellow); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
ul.plain { list-style: none; margin: 0; padding: 0; }
img.px, canvas { image-rendering: pixelated; image-rendering: crisp-edges; }
img.px { display: inline-block; vertical-align: middle; flex: none; }
.px-glyph { display: inline-block; text-align: center; flex: none; }
.dim { color: var(--dim); }
.small { font-size: 12px; }
.good { color: var(--c-green); } .bad { color: var(--c-red); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.arrow { text-align: center; color: var(--dim); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--c-yellow); outline-offset: 2px; }
::selection { background: var(--c-gold); color: var(--c-ink); }
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: var(--c-ink); }
::-webkit-scrollbar-thumb { background: var(--c-slate); border: 3px solid var(--c-ink); }
* { scrollbar-color: var(--c-slate) var(--c-ink); scrollbar-width: thin; }

/* boot screen */
.boot { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: var(--c-ink); text-align: center; padding: 16px; }
.boot-inner h1 { font-size: clamp(18px, 6vw, 32px); color: var(--c-gold); text-shadow: 4px 4px 0 var(--c-wood), 7px 7px 0 var(--c-darkwood); margin: 20px 0 12px; }
.boot svg { width: 96px; height: 96px; image-rendering: pixelated; animation: bob 2.4s steps(2) infinite; }
.boot.error #boot-msg { color: var(--c-red); max-width: 520px; }
.boot-error { color: var(--c-red); }

/* ---------------------------------------------------------------------------------------------- 3 layout */
.app {
	height: 100vh; height: 100dvh; display: grid;
	grid-template-columns: 240px minmax(0, 1fr) var(--sheet-w);
	grid-template-rows: auto minmax(0, 1fr) 36px;
	grid-template-areas: "top top top" "side center panel" "ticker ticker ticker";
}
.topbar { grid-area: top; display: flex; align-items: center; gap: 16px; padding: 8px 14px; background: var(--c-night); border-bottom: var(--bw) solid var(--c-slate); position: relative; z-index: 20; min-width: 0; }
.side { grid-area: side; display: flex; flex-direction: column; gap: 10px; padding: 12px 8px 12px 12px; overflow-y: auto; min-height: 0; scrollbar-width: none; }
.side::-webkit-scrollbar { display: none; }
.center { grid-area: center; position: relative; min-width: 0; min-height: 0; overflow: hidden; margin: 12px 0; border: var(--bw) solid var(--c-slate); background: var(--c-ink); box-shadow: var(--shadow); }
.panel-col { grid-area: panel; padding: 12px 12px 12px 14px; overflow-y: auto; min-height: 0; display: flex; flex-direction: column; gap: 12px; }
.ticker { grid-area: ticker; }
.bottomnav { grid-area: nav; display: none; }

.tab { position: absolute; inset: 0; display: none; }
.tab.active { display: block; }
.tab.scroll { overflow-y: auto; overflow-x: hidden; padding: 16px; background: var(--c-ink); }
.tab.canvas-tab { background: #124e89; overflow: hidden; }
.tab.canvas-tab canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

.panel { background: var(--panel-bg); border: var(--bw) solid var(--c-slate); box-shadow: var(--shadow); padding: 12px 14px; margin-bottom: 16px; position: relative; }
.panel.danger { border-color: var(--c-darkred); }
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 14px 0 8px; }
.sec-head:first-child { margin-top: 0; }
.sec-head h3 { color: var(--c-fog); }
.sec-sep { height: 4px; background: var(--c-slate); margin: 12px 0; }

/* -------------------------------------------------------------------------------------------------- 4 HUD */
.brand { display: flex; flex-direction: column; gap: 2px; width: 216px; flex: none; }
.brand-name { font-family: var(--font-px); font-size: 11px; color: var(--c-gold); text-shadow: 2px 2px 0 var(--c-wood); letter-spacing: 1px; white-space: nowrap; }
.brand-link { font-size: 11px; color: var(--c-yellow); text-decoration: none; }
.brand-link:hover { text-decoration: underline; }
.ver { font-size: 10px; color: var(--c-steel); position: absolute; left: 14px; bottom: 2px; display: none; }

.hud-res { display: flex; gap: 10px; flex: 1 1 auto; min-width: 0; }
.hres { flex: 1 1 0; min-width: 0; display: flex; align-items: center; gap: 8px; background: var(--c-ink); border: 3px solid var(--c-slate); padding: 4px 8px; }
.hres.full { border-color: var(--c-orange); }
.hres.full .hres-amt { color: var(--c-orange); }
.hres-body { min-width: 0; flex: 1; }
.hres-top { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.hres-amt { font-family: var(--font-px); font-size: 11px; color: var(--c-white); white-space: nowrap; }
.hres-rate { font-size: 10px; color: var(--c-green); white-space: nowrap; }
.hres-bar { height: 6px; margin-top: 4px; }

.hud-meta { display: flex; align-items: center; gap: 10px; flex: none; position: relative; }
.clock { font-family: var(--font-px); font-size: 10px; color: var(--c-sand); white-space: nowrap; }
.pill { font-family: var(--font-px); font-size: 8px; padding: 7px 9px; border: 3px solid var(--c-slate); background: var(--c-ink); color: var(--c-mist); white-space: nowrap; line-height: 1; }
.pill.speed { cursor: pointer; }
.pill.speed.fast { background: var(--c-gold); color: var(--c-ink); border-color: var(--c-wood); box-shadow: 0 3px 0 var(--c-wood); }
.pill.prot { border-color: var(--c-blue); color: var(--c-foam); }
.pill.alarm { border-color: var(--c-red); background: var(--c-darkred); color: var(--c-white); cursor: pointer; animation: alarm 0.8s steps(2) infinite; }
.popover { position: absolute; right: 0; top: calc(100% + 10px); z-index: 30; background: var(--c-night); border: var(--bw) solid var(--c-slate); box-shadow: var(--shadow-sm); padding: 8px; min-width: 220px; }
.pop-title { font-family: var(--font-px); font-size: 8px; color: var(--c-fog); margin-bottom: 6px; }
.pop-opt { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: var(--c-ink); border: 3px solid var(--c-slate); padding: 8px; margin-bottom: 4px; }
.pop-opt b { font-family: var(--font-px); font-size: 10px; min-width: 38px; }
.pop-opt span { font-size: 12px; color: var(--dim); }
.pop-opt.on { border-color: var(--c-gold); }
.pop-opt:hover { border-color: var(--c-mist); }

/* captain card (always visible) */
.capcard { position: relative; background: var(--c-night); border: var(--bw) solid var(--c-slate); box-shadow: var(--shadow); padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; cursor: pointer; --path: var(--c-fog); border-top-color: var(--path); }
.capcard:hover { border-color: var(--path); }
.cap-frame { display: inline-block; line-height: 0; padding: 4px; background: var(--c-wood); border: 3px solid var(--c-darkwood); box-shadow: inset 0 0 0 2px var(--c-tan), 3px 3px 0 var(--c-darkwood); }
.cap-frame img { display: block; }
.cap-frame.big { padding: 6px; }
.cap-frame.small img { width: 72px; height: 72px; }
.cap-frame.glow { box-shadow: inset 0 0 0 2px var(--c-gold), 0 0 0 3px var(--c-gold), 0 0 18px var(--c-gold); }
.cap-portrait { line-height: 0; }
.capcard .cap-frame { align-self: center; }
.cap-portrait img { width: 128px; height: 128px; }
.cap-main { min-width: 0; text-align: center; }
.cap-name { font-family: var(--font-px); font-size: 11px; color: var(--c-white); overflow-wrap: anywhere; }
.cap-title { font-size: 13px; color: var(--path); margin: 4px 0 6px; }
.cap-lvl-row { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; font-size: 11px; }
.cap-level { font-family: var(--font-px); font-size: 9px; color: var(--c-gold); }
.cap-xp-text { color: var(--dim); font-size: 10px; }
.cap-xp { height: 10px; margin-top: 4px; }
.cap-meta { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; font-size: 11px; }
.cap-loc { color: var(--c-sand); }
.cap-loc::before { content: '\2693 '; }
.cap-loc.aboard::before { content: '\26F5 '; }
.cap-loc.aboard { color: var(--c-foam); }
.cap-status { padding: 2px 6px; border: 2px solid var(--c-darkred); color: var(--c-red); font-size: 10px; }
.cap-status.hungover { border-color: var(--c-darkgreen); color: var(--c-green); }
.cap-status.ok { border-color: var(--c-darkgreen); color: var(--c-green); }
.cap-badges { display: flex; flex-direction: column; gap: 5px; }
.cap-badges:empty { display: none; }
.badge-btn b { font-weight: normal; }
.lbl-short { display: none; }
.badge-btn { font-family: var(--font-px); font-size: 8px; line-height: 1.3; padding: 7px 8px; border: 3px solid var(--c-ink); background: var(--c-gold); color: var(--c-ink); box-shadow: 0 3px 0 var(--c-wood); text-align: center; animation: badge 1s steps(2) infinite; }
.badge-btn.cap-ap { background: var(--c-blue); color: var(--c-white); box-shadow: 0 3px 0 var(--c-deep); }
.badge-btn.cap-evt { background: var(--c-orange); color: var(--c-ink); box-shadow: 0 3px 0 var(--c-darkred); }
.cap-actives { display: flex; flex-direction: column; gap: 6px; }
.cap-active { position: relative; display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 6px 8px; background: var(--c-ink); border: 3px solid var(--pc, var(--c-gold)); overflow: hidden; }
.cap-active > * { position: relative; z-index: 1; }
.act-ring { position: absolute !important; inset: 0; z-index: 0 !important; background: conic-gradient(rgba(24, 20, 37, .78) calc(var(--p, 0) * 1deg), transparent 0); }
.cap-active[data-state="running"] .act-ring { background: conic-gradient(transparent calc((360 - var(--p, 0)) * 1deg), rgba(254, 174, 52, .4) 0); }
.cap-active[data-state="ready"] { animation: badge 1s steps(2) infinite; }
.cap-active.disabled { cursor: default; }
.act-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.act-label { font-size: 12px; color: var(--c-white); }
.act-sub { font-size: 11px; color: var(--c-gold); }
.cap-active[data-state="cooling"] .act-sub { color: var(--dim); }

/* nav */
.sidenav { display: flex; flex-direction: column; gap: 5px; }
.nav-item { position: relative; display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 10px; text-align: left; background: var(--c-night); border: 3px solid var(--c-slate); color: var(--c-mist); font-family: var(--font-px); font-size: 9px; box-shadow: 0 3px 0 var(--c-darkwood); }
.nav-item:hover { border-color: var(--c-mist); }
.nav-item.active { background: var(--c-slate); border-color: var(--c-gold); color: var(--c-white); }
.nav-label { flex: 1; }
.nav-badge { min-width: 22px; padding: 4px 6px; background: var(--c-gold); color: var(--c-ink); font-family: var(--font-px); font-size: 8px; text-align: center; animation: badge 1s steps(2) infinite; }
.nav-badge.red { background: var(--c-red); color: var(--c-white); animation: none; }
.nav-badge.dot { min-width: 0; width: 10px; height: 10px; padding: 0; font-size: 0; border: 2px solid var(--c-ink); animation: none; }

/* ticker */
.ticker { display: flex; align-items: center; gap: 10px; padding: 0 12px; background: var(--c-night); border-top: var(--bw) solid var(--c-slate); cursor: pointer; overflow: hidden; min-width: 0; }
.ticker:hover { background: #2d3352; }
.ticker-tag { font-family: var(--font-px); font-size: 8px; background: var(--c-red); color: var(--c-white); padding: 4px 6px; flex: none; }
.ticker-lane { flex: 1; overflow: hidden; white-space: nowrap; mask-image: linear-gradient(90deg, transparent, #000 24px, #000 calc(100% - 24px), transparent); -webkit-mask-image: linear-gradient(90deg, transparent, #000 24px, #000 calc(100% - 24px), transparent); }
.ticker-track { display: inline-block; padding-left: 100%; animation: ticker 60s linear infinite; font-size: 13px; }
.ticker:hover .ticker-track { animation-play-state: paused; }
.tk b { color: var(--c-yellow); font-weight: normal; }
.tk-chat b { color: var(--c-foam); }
.tk-system { color: var(--c-orange); }
.tk-sep { color: var(--c-gold); font-style: normal; padding: 0 14px; }
.ticker-more { color: var(--dim); font-size: 10px; flex: none; }
.tk-static { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* phones: one-line Logbuch strip under the captain card (hidden on desktop, where the panel shows the card) */
.quest-strip { display: none; }
.quest-strip[hidden] { display: none !important; }

/* visually hidden, but reachable with the keyboard: shown while focused */
.sr-list { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sr-list:focus-within { position: absolute; z-index: 30; left: 8px; top: 8px; width: auto; height: auto; max-width: calc(100% - 16px); overflow: visible; clip: auto; white-space: normal; display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; background: var(--c-night); border: 3px solid var(--c-gold); box-shadow: var(--shadow-sm); }
.sr-list button { font-size: 13px; padding: 6px 8px; background: var(--c-ink); border: 2px solid var(--c-slate); color: var(--c-white); }
.sr-list button:focus-visible { border-color: var(--c-gold); outline: none; }

/* logbook + idle panel */
.logbook-card { background: var(--c-night); border: var(--bw) solid var(--c-slate); box-shadow: var(--shadow); padding: 12px 14px; }
.logbook-inner.claimable { }
.quest-text { font-size: 14px; color: var(--c-white); margin: 0 0 8px; }
.quest-bar { height: 20px; margin-bottom: 8px; }
.quest-bar .bar-label { font-size: 10px; }
.quest-hint { font-size: 12px; }
.quest-reward { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: 8px 0; font-size: 12px; }
.reward-row { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.idle-block { background: var(--c-night); border: var(--bw) solid var(--c-slate); box-shadow: var(--shadow); padding: 12px 14px; }
.idle-fleet { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; background: var(--c-ink); border: 3px solid var(--c-slate); padding: 6px 8px; margin-bottom: 6px; font-size: 12px; }
.idle-fleet .cd { margin-left: auto; color: var(--c-gold); }
.idle-hint { font-size: 12px; padding: 0 4px; }
.panel-idle { display: flex; flex-direction: column; gap: 14px; }
.panel-col.has-sheet .panel-idle { display: none; }

.incoming .inc-card, .inc-card { background: var(--c-ink); border: 3px solid var(--c-red); padding: 8px 10px; margin-bottom: 8px; }
.inc-head { display: flex; justify-content: space-between; gap: 8px; }
.alarm-text { color: var(--c-red); }
.log-sheet { display: flex; flex-direction: column; gap: 10px; }
.log-line { font-size: 13px; padding: 4px 0; border-bottom: 2px dotted var(--c-slate); }
.log-t { color: var(--c-steel); font-size: 11px; margin-right: 6px; white-space: nowrap; }
.log-who { color: var(--c-yellow); font-weight: normal; }
.k-chat .log-who { color: var(--c-foam); }
.k-system { color: var(--c-orange); }

/* ------------------------------------------------------------------------------------------- 5 widgets */
.res-chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 6px 1px 3px; background: var(--c-ink); border: 2px solid var(--c-slate); font-size: 12px; white-space: nowrap; }
.res-chip b { font-weight: normal; font-family: var(--font-body); color: var(--c-white); }
.res-chip.missing { border-color: var(--c-red); }
.res-chip.missing b { color: var(--c-red); }
.res-chip.xp b { color: var(--c-green); }
.cost-row { display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: center; }

:where(.bar) { height: 12px; }
.bar { position: relative; background: var(--c-ink); border: 2px solid var(--c-slate); overflow: hidden; --bar: var(--c-gold); }
.bar > i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--bar); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .25), inset 0 2px 0 rgba(255, 255, 255, .25); }
.bar.seg::after { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0, transparent calc(100% / var(--segs, 10) - 2px), var(--c-ink) calc(100% / var(--segs, 10) - 2px), var(--c-ink) calc(100% / var(--segs, 10))); pointer-events: none; }
.bar-label { position: absolute; inset: 0; display: grid; place-items: center; font-size: 10px; color: var(--c-white); text-shadow: 1px 1px 0 var(--c-ink), -1px -1px 0 var(--c-ink), 1px -1px 0 var(--c-ink), -1px 1px 0 var(--c-ink); z-index: 2; }

.pips { display: inline-flex; gap: 2px; --pip: var(--c-gold); }
.pips i { width: 8px; height: 8px; background: var(--c-ink); border: 2px solid var(--c-steel); display: block; }
.pips i.on { background: var(--pip); border-color: var(--c-ink); }
.pips.maxed i.on { background: var(--c-gold); }

.chip { display: inline-block; padding: 2px 6px; font-size: 11px; border: 2px solid var(--chip, var(--c-slate)); color: var(--chip, var(--c-mist)); background: var(--c-ink); line-height: 1.3; white-space: nowrap; }
.badge { display: inline-block; font-family: var(--font-px); font-size: 8px; padding: 4px 6px; background: var(--c-slate); color: var(--c-white); }
.badge.glow { background: var(--c-gold); color: var(--c-ink); animation: badge 1s steps(2) infinite; }
.dot { display: inline-block; width: 8px; height: 8px; margin-left: 6px; border: 2px solid var(--c-ink); background: var(--c-steel); vertical-align: middle; }
.dot.on { background: var(--c-green); }

.segmented { display: flex; gap: 4px; flex-wrap: wrap; }
.seg-btn { flex: 1 1 0; min-width: 0; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 6px; background: var(--c-ink); border: 3px solid var(--c-slate); color: var(--c-mist); font-family: var(--font-px); font-size: 8px; line-height: 1.3; }
.seg-btn.on { background: var(--c-slate); border-color: var(--seg, var(--c-gold)); color: var(--c-white); }
.seg-btn:hover { border-color: var(--c-mist); }

.empty { text-align: center; padding: 22px 12px; color: var(--c-mist); }
.empty p:first-child { font-size: 14px; }

/* buttons: two-step shadow, sink 2 px when pressed */
.btn { --bg: var(--c-gold); --fg: var(--c-ink); --s1: var(--c-wood); display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 10px 14px; background: var(--bg); color: var(--fg); border: 3px solid var(--c-ink); font-family: var(--font-px); font-size: 10px; line-height: 1.3; text-align: center; box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .22), inset 0 3px 0 rgba(255, 255, 255, .3), 0 2px 0 var(--s1), 0 4px 0 var(--c-ink); transition: none; user-select: none; position: relative; top: 0; }
.btn:hover { filter: brightness(1.1); }
.btn:active { top: 2px; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .22), inset 0 3px 0 rgba(255, 255, 255, .3), 0 0 0 var(--s1), 0 2px 0 var(--c-ink); }
.btn.small { min-height: 32px; padding: 7px 10px; font-size: 8px; }
.btn.block { display: flex; width: 100%; margin-top: 8px; }
.btn-red { --bg: var(--c-red); --fg: var(--c-white); --s1: var(--c-darkred); }
.btn-blue { --bg: var(--c-blue); --fg: var(--c-white); --s1: var(--c-deep); }
.btn-green { --bg: var(--c-green); --fg: var(--c-ink); --s1: var(--c-darkgreen); }
.btn-ghost { --bg: var(--c-night); --fg: var(--c-mist); --s1: var(--c-slate); border-color: var(--c-slate); }
.btn.disabled { --bg: #2f3552; --fg: var(--c-steel); --s1: #232a45; cursor: not-allowed; filter: none; }
.btn.disabled:active { top: 0; }
.btn.pulse:not(.disabled) { animation: badge 1.1s steps(2) infinite; }
.btn-label { display: inline-flex; align-items: center; gap: 6px; }
.ibtn { display: inline-grid; place-items: center; min-width: 32px; height: 32px; padding: 0 6px; background: var(--c-ink); border: 3px solid var(--c-slate); color: var(--c-mist); font-family: var(--font-px); font-size: 10px; line-height: 1; user-select: none; touch-action: manipulation; }
.ibtn:hover { border-color: var(--c-gold); }
.ibtn:active { background: var(--c-slate); }
.ibtn.disabled { opacity: .4; }

.stepper { display: inline-flex; align-items: center; gap: 4px; }
.step-input { width: 54px; height: 32px; text-align: center; background: var(--c-ink); border: 3px solid var(--c-slate); color: var(--c-white); font-family: var(--font-px); font-size: 10px; padding: 0 4px; }
.step-input:focus { border-color: var(--c-gold); outline: none; }
.step-max { font-size: 8px; }

.text-input, .text-area, .sel { width: 100%; background: var(--c-ink); border: 3px solid var(--c-slate); color: var(--c-white); padding: 8px 10px; font-size: 14px; min-height: 40px; }
.text-input:focus, .text-area:focus, .sel:focus { border-color: var(--c-gold); outline: none; }
.text-input.num { text-align: right; }
.text-area { min-height: 90px; font-size: 11px; resize: vertical; word-break: break-all; }
.sel { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--c-fog) 50%), linear-gradient(135deg, var(--c-fog) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 12px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 32px; }
.sel option, .sel optgroup { background: var(--c-night); color: var(--c-mist); }
.field { display: block; margin: 0 0 14px; }
.field-label { display: block; font-family: var(--font-px); font-size: 8px; color: var(--c-fog); margin-bottom: 6px; }
.field.check { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; background: var(--c-ink); border: 3px solid var(--c-slate); cursor: pointer; }
.field.check.disabled { opacity: .6; cursor: not-allowed; }
.field.check input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--c-gold); flex: none; }
.check-text { display: flex; flex-direction: column; gap: 2px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.row .text-input { flex: 1; min-width: 160px; }
.kv { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; padding: 4px 0; border-bottom: 2px dotted var(--c-slate); font-size: 13px; }
.kv > :first-child { color: var(--dim); }
.kv b { font-weight: normal; color: var(--c-white); text-align: right; }
.kv.total b { color: var(--c-gold); }
.reason { color: var(--c-orange); font-size: 12px; margin: 6px 0 0; }
.warn { color: var(--c-orange); margin: 6px 0 0; }
.verdict { margin: 6px 0 0; color: var(--c-mist); }
.verdict.good { color: var(--c-green); }
.verdict.warn { color: var(--c-orange); }
.verdict.bad { color: var(--c-red); }
.ct-need, .contract > .warn { grid-column: 1 / -1; margin: 0; }
.sub-block { margin-top: 16px; }

.tip { position: fixed; z-index: 400; max-width: 280px; padding: 8px 10px; background: var(--c-ink); border: 3px solid var(--c-gold); box-shadow: var(--shadow-sm); font-size: 12px; pointer-events: none; }
.tip-lines { display: flex; flex-direction: column; gap: 2px; }
.tip-lines b { font-family: var(--font-px); font-weight: normal; font-size: 9px; color: var(--c-gold); margin-bottom: 4px; line-height: 1.4; }

#toasts { position: fixed; z-index: 300; bottom: 64px; left: calc(50% - 60px); transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; width: min(92vw, 420px); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 8px; width: 100%; padding: 10px 12px; background: var(--c-night); border: var(--bw) solid var(--c-steel); box-shadow: var(--shadow-sm); font-size: 13px; animation: toastin .18s steps(3); cursor: pointer; }
.toast.toast-success { border-color: var(--c-green); }
.toast.toast-error { border-color: var(--c-red); }
.toast.clickable { border-color: var(--c-gold); }
.toast.out { opacity: 0; transition: opacity .3s; }

.cd { font-variant-numeric: tabular-nums; }

/* -------------------------------------------------------------------------------------- 6 sheets / modals */
.sheet { background: var(--c-night); border: var(--bw) solid var(--c-slate); box-shadow: var(--shadow); display: flex; flex-direction: column; min-height: 0; --accent: var(--c-slate); }
.sheet-desktop { max-height: 100%; animation: sheetin .15s steps(3); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; background: var(--c-slate); border-bottom: var(--bw) solid var(--accent, var(--c-ink)); flex: none; }
.sheet-title { font-size: 10px; color: var(--c-white); overflow-wrap: anywhere; }
.sheet-body { padding: 14px; overflow-y: auto; overflow-x: hidden; min-height: 0; flex: 1; overscroll-behavior: contain; }
.panel-col .sheet-desktop { flex: 1 1 auto; }
#sheet-layer { position: fixed; inset: 0; z-index: 150; pointer-events: none; }
.sheet-root { position: absolute; inset: 0; pointer-events: auto; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(24, 20, 37, .6); animation: fade .15s; }
.sheet-mobile { position: absolute; left: 0; right: 0; bottom: 0; max-height: 80vh; max-height: 80dvh; border-bottom: 0; border-left: 0; border-right: 0; box-shadow: 0 -6px 0 var(--c-darkwood); transform: translateY(0); transition: transform .15s steps(4); animation: sheetup .2s steps(5); padding-bottom: env(safe-area-inset-bottom); }
.sheet-root.closing .sheet-mobile { transform: translateY(100%); }
.sheet-root.closing .sheet-backdrop { opacity: 0; transition: opacity .15s; }
.sheet-handle { padding: 8px 0 2px; display: grid; place-items: center; touch-action: none; cursor: grab; background: var(--c-slate); }
.sheet-handle i { display: block; width: 48px; height: 6px; background: var(--c-steel); }
.sheet-mobile .sheet-head { touch-action: none; }

#modal-layer { position: fixed; inset: 0; z-index: 200; pointer-events: none; }
.modal-root { position: fixed; inset: 0; display: grid; place-items: center; padding: 12px; pointer-events: auto; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(24, 20, 37, .82); animation: fade .15s; }
.modal { position: relative; width: min(94vw, 460px); max-height: calc(100dvh - 24px); display: flex; flex-direction: column; background: var(--c-night); border: var(--bw) solid var(--accent, var(--c-slate)); box-shadow: var(--shadow); animation: pop .18s steps(4); }
.modal.wide { width: min(96vw, 860px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; background: var(--c-slate); border-bottom: var(--bw) solid var(--accent, var(--c-ink)); }
.modal-head h2 { font-size: 11px; color: var(--c-white); }
.modal-body { padding: 16px; overflow-y: auto; min-height: 0; flex: 1; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; padding: 12px 16px; border-top: var(--bw) solid var(--c-slate); background: var(--c-ink); }
.modal-foot .btn { margin: 0; }
.modal-text { margin: 0; font-size: 14px; }

/* creation */
.create-tag { text-align: center; color: var(--c-sand); font-size: 13px; margin-bottom: 12px; }
.create-cols { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px; }
.create-left { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.create-portrait .cap-frame img { width: 160px; height: 160px; }
.look-rows { width: 100%; display: flex; flex-direction: column; gap: 4px; }
.look-row { display: grid; grid-template-columns: 1fr auto 62px auto; gap: 4px; align-items: center; font-size: 12px; }
.look-label { color: var(--dim); }
.look-val { text-align: center; font-size: 11px; color: var(--c-white); }
.origin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.origin-card { text-align: left; padding: 8px 10px; background: var(--c-ink); border: 3px solid var(--c-slate); display: flex; flex-direction: column; gap: 4px; }
.origin-card.on { border-color: var(--pc, var(--c-gold)); box-shadow: 0 0 0 2px var(--c-ink), 0 0 12px var(--pc, var(--c-gold)); background: #1f1d34; }
.origin-name { font-family: var(--font-px); font-size: 9px; color: var(--c-white); }
.origin-desc { font-size: 11px; color: var(--dim); margin: 0; line-height: 1.35; }
.origin-perks { list-style: none; padding: 0; margin: 0; font-size: 11px; color: var(--c-sand); }
.origin-perks li { display: flex; align-items: center; gap: 4px; }
.speed-help { margin: 8px 0 0; font-size: 12px; }
.modal-create .modal-body { padding: 14px 16px; }

.progress { text-align: center; }
.progress-bar { height: 22px; margin: 12px 0; }
.progress-label { font-family: var(--font-px); font-size: 10px; line-height: 1.6; }

.welcome-time { font-size: 15px; color: var(--c-white); }
.wb-sec { margin-top: 14px; }
.wb-report { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; background: var(--c-ink); border: 3px solid var(--c-slate); padding: 6px 8px; margin-bottom: 4px; font-size: 13px; }
.wb-report:hover { border-color: var(--c-gold); }
.wb-rank.up { color: var(--c-green); } .wb-rank.down { color: var(--c-red); }
.wb-levels { display: flex; align-items: center; gap: 6px; color: var(--c-gold); }
ul.plain.news li { font-size: 13px; padding: 3px 0; }

.event-head { display: flex; gap: 14px; align-items: flex-start; }
.event-speaker { min-width: 0; }
.event-speaker b { font-family: var(--font-px); font-weight: normal; font-size: 9px; color: var(--c-orange); }
.event-text { font-size: 14px; margin: 6px 0 0; line-height: 1.5; }
.event-options { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.event-opt { text-align: left; padding: 10px 12px; background: var(--c-ink); border: 3px solid var(--c-slate); display: flex; flex-direction: column; gap: 2px; min-height: 44px; }
.event-opt:hover:not(.locked) { border-color: var(--c-gold); background: #1f1d34; }
.event-opt.locked { opacity: .5; cursor: not-allowed; }
.opt-label { font-size: 14px; color: var(--c-white); }
.opt-req { font-size: 11px; color: var(--c-orange); }
.opt-req.met { color: var(--c-green); }
.event-outcome { padding: 8px 0; }

.levelup { text-align: center; }
.lvl-banner { display: inline-block; font-family: var(--font-px); font-size: 20px; color: var(--c-ink); background: var(--c-gold); padding: 12px 20px; border: 4px solid var(--c-ink); box-shadow: 0 6px 0 var(--c-wood), 0 0 0 4px var(--c-gold); animation: stamp .5s steps(5); margin: 8px 0 18px; }
.lvl-portraits { display: flex; justify-content: center; align-items: center; gap: 14px; margin-bottom: 12px; }
.lvl-portraits img { width: 128px; height: 128px; }
.lvl-arrow { font-size: 22px; color: var(--c-gold); }
.lvl-name { font-family: var(--font-px); font-size: 10px; color: var(--c-white); }
.lvl-title { display: block; margin-top: 6px; font-family: var(--font-body); font-size: 14px; color: var(--c-gold); }
.lvl-gains { display: inline-block; text-align: left; margin: 12px 0 4px; }
.lvl-gains li { display: flex; align-items: center; gap: 8px; padding: 2px 0; color: var(--c-white); }
.alert-lead { font-size: 16px; color: var(--c-white); }
.modal-alert .modal-body { text-align: center; }

.debug-panel { position: fixed; right: 8px; bottom: 44px; z-index: 140; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; background: rgba(24, 20, 37, .9); border: 3px dashed var(--c-orange); padding: 6px; max-width: calc(100vw - 16px); }
.debug-panel b { font-family: var(--font-px); font-size: 8px; color: var(--c-orange); }
.table-wrap { overflow-x: auto; }
.ai-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.ai-table th, .ai-table td { padding: 4px 8px; border-bottom: 2px solid var(--c-slate); text-align: left; white-space: nowrap; }
.ai-table th { font-family: var(--font-px); font-size: 8px; color: var(--c-fog); font-weight: normal; }

/* --------------------------------------------------------------------------------- 7 Kapitän + Takelage */
.kap { max-width: 1100px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.kap-head { }
.head-card { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 20px; margin: 0; border-color: var(--path, var(--c-slate)); --path: var(--c-fog); }
.head-portrait .cap-frame img { width: 192px; height: 192px; }
.head-name { font-family: var(--font-px); font-size: 16px; color: var(--c-white); overflow-wrap: anywhere; }
.head-title { display: flex; align-items: center; gap: 8px; margin: 8px 0 4px; font-family: var(--font-px); font-size: 11px; color: var(--path); flex-wrap: wrap; }
.head-origin { margin: 0 0 10px; }
.head-level { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; flex-wrap: wrap; }
.head-level .lvl { font-family: var(--font-px); font-size: 12px; color: var(--c-gold); }
.xp-big { height: 16px; }
.xp-line { font-size: 12px; margin: 6px 0 10px; }
.head-points { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.point-badge { font-size: 12px; padding: 6px 10px; border: 3px solid var(--c-slate); background: var(--c-ink); }
.point-badge b { font-family: var(--font-px); font-size: 12px; margin-right: 4px; }
.point-badge.sp b { color: var(--c-gold); }
.point-badge.ap b { color: var(--c-blue); }
.point-badge.glow { border-color: var(--c-gold); animation: badge 1s steps(2) infinite; }
.point-badge.ap.glow { border-color: var(--c-blue); }
.head-stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.stat { background: var(--c-ink); border: 2px solid var(--c-slate); padding: 4px 6px; text-align: center; }
.stat b { display: block; font-family: var(--font-px); font-weight: normal; font-size: 11px; color: var(--c-white); }
.stat span { font-size: 10px; color: var(--dim); }

.kap-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.kap-cols .panel, .kap-bonus { margin: 0; }
.attr-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 4px 12px; align-items: center; padding: 10px 0; border-bottom: 2px dotted var(--c-slate); }
.attr-name b { font-weight: normal; color: var(--c-white); }
.attr-short { margin-left: 8px; font-family: var(--font-px); font-size: 8px; color: var(--c-fog); }
.attr-val { font-family: var(--font-px); font-size: 18px; color: var(--c-gold); }
.attr-plus.btn { min-width: 36px; padding: 0 10px; }
.attr-desc, .attr-now { grid-column: 1 / -1; margin: 0; font-size: 12px; }
.attr-desc { color: var(--dim); }
.attr-now { color: var(--c-green); }
.active-card { display: flex; gap: 12px; padding: 10px; margin-bottom: 8px; background: var(--c-ink); border: 3px solid var(--pc, var(--c-slate)); }
.active-card.locked { opacity: .55; border-color: var(--c-slate); }
.active-ico img { width: 48px; height: 48px; }
.active-body p { margin: 4px 0; }
.act-state.run { color: var(--c-gold); } .act-state.cool { color: var(--dim); }

details.bonus { background: var(--c-night); border: var(--bw) solid var(--c-slate); box-shadow: var(--shadow); }
details.bonus > summary { cursor: pointer; padding: 12px 14px; display: flex; align-items: center; gap: 10px; list-style: none; font-family: var(--font-px); font-size: 10px; color: var(--c-white); }
details.bonus > summary::-webkit-details-marker { display: none; }
details.bonus > summary::before { content: '\25B6'; color: var(--c-gold); font-size: 9px; }
details.bonus[open] > summary::before { content: '\25BC'; }
.bonus-body { padding: 0 14px 14px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 18px; }
.bonus-body > .empty, .bonus-body > p { grid-column: 1 / -1; }
.bonus-row { background: var(--c-ink); border: 2px solid var(--c-slate); padding: 8px 10px; }
.bonus-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.bonus-label { color: var(--c-white); }
.bonus-total { font-family: var(--font-px); font-size: 10px; font-weight: normal; }
.bonus-total.good { color: var(--c-green); } .bonus-total.bad { color: var(--c-red); }
.bonus-src { list-style: none; margin: 6px 0 0; padding: 0; }
.bonus-src li { display: flex; justify-content: space-between; gap: 10px; font-size: 11px; color: var(--dim); padding: 1px 0; }
.bonus-src i { font-style: normal; }
.bonus-src i.good { color: var(--c-green); } .bonus-src i.bad { color: var(--c-red); }

/* the skill tree: the showpiece */
.kap-tree-wrap { background: linear-gradient(180deg, #1c2038 0%, var(--c-night) 100%); border: var(--bw) solid var(--c-slate); box-shadow: var(--shadow); padding: 14px 14px 16px; position: relative; }
.tree-top { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.tree-title { font-size: 14px; color: var(--c-gold); text-shadow: 2px 2px 0 var(--c-wood); }
.title-hint { flex: 1 1 220px; margin: 0; font-size: 13px; color: var(--c-sand); }
.path-counters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.path-counter { display: grid; grid-template-columns: auto 1fr auto; grid-template-rows: auto auto; gap: 4px 8px; align-items: center; text-align: left; padding: 8px 10px; background: var(--c-ink); border: 3px solid var(--c-slate); }
.path-counter .px { grid-row: 1 / 3; }
.pc-name { font-family: var(--font-px); font-size: 8px; color: var(--pc); }
.pc-num { font-family: var(--font-px); font-size: 14px; font-weight: normal; color: var(--c-white); text-align: right; }
.pc-bar { grid-column: 2 / 4; height: 8px; }
.path-counter.dom { border-color: var(--pc); box-shadow: 0 0 0 2px var(--c-ink), 0 0 12px color-mix(in srgb, var(--pc) 55%, transparent); }
.path-counter.on { background: #20233d; }
.tree-seg { display: none; margin-bottom: 12px; }
.tree-scroll { overflow-x: auto; padding: 4px 2px 14px; }
.tree { display: grid; grid-template-columns: 82px repeat(3, minmax(0, 1fr)); gap: 8px; min-width: 640px; }
.tree .col-H { grid-column: 2; } .tree .col-S { grid-column: 3; } .tree .col-W { grid-column: 4; }
.tree-colhead { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 8px; background: var(--c-ink); border: 3px solid var(--pc); font-family: var(--font-px); font-size: 9px; color: var(--pc); box-shadow: 0 3px 0 color-mix(in srgb, var(--pc) 35%, var(--c-ink)); }
.tree-colhead b { font-weight: normal; color: var(--c-white); }
.tier-gutter { grid-column: 1; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 4px; padding: 6px 8px; border-left: 4px solid var(--c-steel); background: rgba(24, 20, 37, .5); }
.tier-gutter b { font-family: var(--font-px); font-size: 8px; color: var(--c-sand); font-weight: normal; }
.tier-gutter span { font-size: 11px; color: var(--dim); line-height: 1.3; }
.tier-gutter.cap { border-left-color: var(--c-gold); }
.tier-gutter.cap b { color: var(--c-gold); }
.tier-gutter.deck { border-left-color: var(--path-g); }
.tcell { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 104px; padding: 8px 4px 14px; background: rgba(24, 20, 37, .45); border: 2px solid transparent; }
.tcell::before { content: ''; position: absolute; left: 50%; top: 0; bottom: 0; width: 4px; margin-left: -2px; background: var(--pc); opacity: .22; }
.tcell.closed { background: rgba(24, 20, 37, .75); }
.tcell.closed::before { opacity: .08; }
.tcell.open { border-color: color-mix(in srgb, var(--pc) 25%, transparent); }
.tcell.cap { min-height: 120px; background: radial-gradient(ellipse at center, color-mix(in srgb, var(--pc) 18%, transparent) 0%, transparent 70%), rgba(24, 20, 37, .45); }
.tcell.deck { grid-column: 2 / -1; min-height: 100px; flex-direction: column; background: rgba(24, 20, 37, .6); border-color: color-mix(in srgb, var(--path-g) 35%, transparent); }
.tcell.deck::before { display: none; }
.deck-title { display: flex; align-items: center; gap: 8px; font-family: var(--font-px); font-size: 8px; color: var(--path-g); position: relative; }
.gate-note { position: relative; display: flex; align-items: center; gap: 4px; font-size: 10px; color: var(--c-orange); background: var(--c-ink); border: 2px solid var(--c-darkred); padding: 1px 6px; z-index: 1; }
.nodes { position: relative; z-index: 1; display: flex; justify-content: center; flex-wrap: wrap; gap: 10px 8px; }
.node-wrap { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 82px; }
.gate-note + .nodes { margin-top: 12px; }
.node-name { font-size: 9px; line-height: 1.25; text-align: center; color: var(--c-mist); overflow-wrap: break-word; hyphens: auto; -webkit-hyphens: auto; max-width: 100%; }
.node { position: relative; width: 52px; height: 52px; padding: 0; display: grid; place-items: center; background: var(--c-night); border: 4px solid var(--c-slate); color: inherit; box-shadow: 0 3px 0 var(--c-ink); transition: none; }
.node:hover { border-color: var(--c-mist); }
.node .pips { position: absolute; left: 50%; bottom: -11px; transform: translateX(-50%); background: var(--c-ink); padding: 1px 2px; }
.node-ico { line-height: 0; }
.node-scope { position: absolute; top: -9px; left: -9px; min-width: 18px; height: 18px; display: grid; place-items: center; background: var(--c-ink); border: 2px solid var(--c-slate); font-size: 10px; line-height: 1; color: var(--c-mist); }
.node-lock { position: absolute; right: -8px; bottom: -8px; line-height: 0; background: var(--c-ink); padding: 1px; }
.node-star { position: absolute; top: -12px; right: -10px; font-size: 16px; color: var(--c-gold); text-shadow: 2px 2px 0 var(--c-wood); animation: badge 1.4s steps(2) infinite; }
.node.capstone { width: 64px; height: 64px; border-width: 4px; }
.node-wrap:has(.capstone) { width: 104px; }
.node.st-locked { opacity: .45; filter: grayscale(.85); }
.node.st-locked:hover { opacity: .75; }
.node.st-ready { border-color: color-mix(in srgb, var(--pc) 55%, var(--c-slate)); }
.node.st-avail { border-color: var(--pc); animation: nodepulse 1.1s steps(2) infinite; }
.node.focus-ring { outline: 3px solid var(--c-white); outline-offset: 3px; }
.node.st-learned { border-color: var(--pc); background: color-mix(in srgb, var(--pc) 18%, var(--c-night)); box-shadow: 0 3px 0 var(--c-ink), 0 0 0 2px var(--c-ink), 0 0 14px color-mix(in srgb, var(--pc) 70%, transparent); }
.node.st-maxed { border-color: var(--c-gold); background: color-mix(in srgb, var(--pc) 22%, var(--c-night)); box-shadow: 0 3px 0 var(--c-ink), 0 0 0 2px var(--c-ink), 0 0 16px color-mix(in srgb, var(--c-gold) 60%, transparent); }
.node.free::after { content: ''; position: absolute; left: -4px; right: -4px; top: -4px; bottom: -4px; border: 2px dashed var(--c-green); pointer-events: none; opacity: .8; }
.tree-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 8px 0 0; }

.nd { --pc: var(--c-gold); }
.nd-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 12px; }
.nd-ico { padding: 8px; background: var(--c-ink); border: 4px solid var(--pc); box-shadow: 0 0 14px color-mix(in srgb, var(--pc) 50%, transparent); line-height: 0; }
.nd-title { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.nd-title > b { font-family: var(--font-px); font-weight: normal; font-size: 11px; color: var(--c-white); line-height: 1.4; }
.nd-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.nd-rank { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.nd-desc { font-size: 14px; color: var(--c-white); }
.nd-table { width: 100%; border-collapse: collapse; margin: 8px 0 12px; font-size: 13px; }
.nd-table th { font-family: var(--font-px); font-weight: normal; font-size: 8px; color: var(--c-fog); text-align: left; padding: 4px 2px; }
.nd-table td { padding: 4px 2px; border-top: 2px dotted var(--c-slate); }
.nd-table td.num { color: var(--c-white); }
.nd-table td.num:last-child { color: var(--c-green); }
.nd-scope, .nd-active, .nd-reqs { background: var(--c-ink); border: 2px solid var(--c-slate); padding: 8px 10px; margin-bottom: 10px; }
.nd-scope b, .nd-reqs b { font-family: var(--font-px); font-weight: normal; font-size: 9px; color: var(--c-sand); }
.nd-scope p { margin: 4px 0 0; }
.nd-active { border-color: var(--pc); }
.nd-active b { font-family: var(--font-px); font-weight: normal; font-size: 9px; color: var(--pc); }
.nd-active p { margin: 4px 0 0; }
.nd-reqs ul { margin-top: 6px; }
.req { display: flex; gap: 8px; align-items: baseline; font-size: 13px; padding: 2px 0; }
.req-mark { font-family: var(--font-px); font-size: 10px; }
.req.ok .req-mark { color: var(--c-green); }
.req.no .req-mark { color: var(--c-red); }
.req.no { color: var(--c-orange); }
.nd-foot { margin-top: 14px; }
.nd-foot p { margin: 0 0 4px; text-align: center; }

/* --------------------------------------------------------------------------------------------- 8 Insel */
.island-queue { position: absolute; left: 10px; top: 10px; z-index: 5; display: flex; flex-direction: column; gap: 4px; max-width: min(70%, 300px); pointer-events: none; }
.qline { display: flex; align-items: center; gap: 6px; background: rgba(24, 20, 37, .88); border: 3px solid var(--c-slate); padding: 4px 8px; font-size: 12px; color: var(--c-white); }
.qline.wait, .qline.idle { color: var(--dim); }
.qline .cd { margin-left: auto; color: var(--c-gold); }
.plot-tip { position: absolute; z-index: 6; transform: translate(-50%, -100%); pointer-events: none; white-space: nowrap; background: rgba(24, 20, 37, .92); border: 2px solid var(--c-gold); color: var(--c-white); font-family: var(--font-px); font-size: 8px; padding: 5px 7px; box-shadow: 3px 3px 0 var(--c-darkwood); }
.plot-tip[hidden] { display: none; }
.b-head { display: flex; gap: 14px; align-items: center; margin-bottom: 10px; }
.b-sprite { flex: none; padding: 6px; background: var(--c-ink); border: 3px solid var(--c-wood); line-height: 0; }
.b-empty { width: 64px; height: 64px; display: grid; place-items: center; opacity: .45; filter: grayscale(.7); }
.b-title { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.b-title > b { font-family: var(--font-px); font-weight: normal; font-size: 11px; color: var(--c-white); }
.b-desc { font-size: 13px; color: var(--c-mist); }
.eff-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.eff-table td { padding: 5px 2px; border-bottom: 2px dotted var(--c-slate); vertical-align: top; overflow-wrap: break-word; hyphens: auto; -webkit-hyphens: auto; }
.eff-table td:first-child { width: 42%; }
.eff-table td.num { color: var(--c-white); }
.eff-table td.next { color: var(--c-green); }
.eff-table td.arrow { width: 22px; }
.upgrade { margin-top: 14px; padding: 10px 12px; background: var(--c-ink); border: 3px solid var(--c-slate); }
.up-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 4px 0; flex-wrap: wrap; font-size: 13px; }
.maxed { color: var(--c-gold); text-align: center; margin: 0; font-family: var(--font-px); font-size: 10px; }
.queue-block { margin-top: 14px; }
.queue-item { background: var(--c-ink); border: 3px solid var(--c-slate); padding: 8px 10px; margin-bottom: 8px; display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.queue-item .btn { align-self: flex-end; margin: 0; }
.qi-main { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.qi-main b { font-weight: normal; color: var(--c-white); }
.qi-ship { display: inline-flex; align-items: center; gap: 6px; }
.stock-row { display: grid; grid-template-columns: auto 52px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 3px 0; font-size: 12px; }
.stock-bar { height: 10px; }
.ship-card { background: var(--c-ink); border: 3px solid var(--c-slate); padding: 10px; margin-bottom: 10px; display: flex; flex-direction: column; gap: 6px; }
.ship-card.locked { opacity: .55; }
.ship-head { display: flex; gap: 10px; align-items: center; }
.ship-head p { margin: 0; }
.ship-head b { color: var(--c-white); font-weight: normal; }
.ship-stats { display: flex; flex-wrap: wrap; gap: 4px; }
.ship-unit, .ship-total { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 12px; }
.ship-buy { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.ship-buy .btn { margin: 0; }
.training-run { padding: 8px 10px; background: var(--c-ink); border: 3px solid var(--c-darkgreen); display: flex; flex-direction: column; gap: 6px; }
.respec p { margin: 0 0 6px; }
.ex-form { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; margin-bottom: 8px; }
.ex-amount { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; }
.ex-amount .text-input { flex: 1; min-width: 0; }
.ibtn.quick { min-width: 40px; font-size: 8px; }
.ex-preview { min-height: 52px; }
.ex-line { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 6px 0; }
.contract { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; align-items: center; background: var(--c-ink); border: 3px solid var(--c-slate); padding: 8px 10px; margin-bottom: 8px; font-size: 13px; }
.contract.offer { border-color: var(--c-gold); }
.contract.mine { border-color: var(--c-blue); }
.contract .btn { margin: 0; grid-row: 1 / 3; grid-column: 2; }
.ct-main { display: flex; flex-direction: column; }
.ct-main b { font-weight: normal; color: var(--c-white); }
.ct-reward { display: flex; gap: 6px; align-items: center; }

/* ------------------------------------------------------------------------------------ 9 Karte / Flotten */
.map-controls { position: absolute; right: 10px; top: 10px; z-index: 5; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.map-btn { width: 40px; height: 40px; font-size: 18px; background: rgba(24, 20, 37, .9); }
.map-legend { position: absolute; left: 10px; bottom: 10px; z-index: 5; pointer-events: none; display: flex; gap: 10px; flex-wrap: wrap; background: rgba(24, 20, 37, .88); border: 3px solid var(--c-slate); padding: 4px 8px; font-size: 11px; }
.map-legend span { display: inline-flex; align-items: center; gap: 4px; }
.lg { display: inline-block; width: 10px; height: 10px; border: 2px solid var(--c-ink); }
.lg.me { background: var(--c-white); } .lg.rival { background: var(--c-fog); } .lg.post { background: var(--c-gold); } .lg.nest { background: var(--c-red); }
.i-owner { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; --path: var(--c-fog); }
.i-owner-main { min-width: 0; display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.i-owner-name { font-family: var(--font-px); font-weight: normal; font-size: 11px; color: var(--c-white); overflow-wrap: anywhere; }
.i-title { display: flex; align-items: center; gap: 6px; color: var(--path, var(--c-gold)); font-size: 13px; }
.nest-icon { padding: 6px; background: var(--c-ink); border: 3px solid var(--c-slate); line-height: 0; }
.nest-icon img { width: 64px; height: 64px; }
.i-info { margin-bottom: 10px; }
.i-actions { display: flex; flex-direction: column; gap: 0; }
.i-actions .btn { margin-top: 8px; justify-content: flex-start; }
.price-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 2px dotted var(--c-slate); }
.price-row .price { margin-left: auto; color: var(--c-white); }
.price.up { color: var(--c-green); } .price.down { color: var(--c-red); }
.price i { font-style: normal; font-size: 10px; }

.flotten { max-width: 900px; margin: 0 auto; }
.fl-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.slot-info { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.slot-info b { font-family: var(--font-px); font-weight: normal; font-size: 9px; color: var(--c-fog); }
.slot-info .big { font-family: var(--font-px); font-size: 16px; color: var(--c-gold); }
.home-ships { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.home-ship { display: flex; align-items: center; gap: 6px; background: var(--c-ink); border: 3px solid var(--c-slate); padding: 4px 10px 4px 6px; }
.fleet-card { background: var(--c-ink); border: 3px solid var(--c-slate); padding: 10px 12px; margin-bottom: 10px; display: flex; flex-direction: column; gap: 6px; }
.fleet-card.hostile { border-color: var(--c-red); }
.fleet-card.stationed { border-color: var(--c-blue); }
.fleet-head { display: flex; align-items: center; gap: 10px; }
.fleet-title { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.fleet-title b { font-weight: normal; color: var(--c-white); }
.fleet-cap { line-height: 0; border: 3px solid var(--c-gold); }
.fleet-cap img { width: 32px; height: 32px; }
.fleet-eta { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.fleet-eta .cd { color: var(--c-gold); }
.fleet-ships, .fleet-cargo, .ship-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; }
.fs { display: inline-flex; align-items: center; gap: 4px; }
.fleet-card .btn { align-self: flex-start; margin: 0; }

.send { display: flex; flex-direction: column; }
.send-target { padding: 8px 10px; background: var(--c-ink); border: 3px solid var(--c-slate); margin-bottom: 12px; display: flex; flex-direction: column; }
.send-target b { font-family: var(--font-px); font-weight: normal; font-size: 11px; color: var(--c-white); }
.mission-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.mission-btn span { overflow-wrap: anywhere; min-width: 0; }
.mission-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 6px 4px; background: var(--c-ink); border: 3px solid var(--c-slate); font-size: 12px; text-align: center; min-height: 64px; }
.mission-btn.on { border-color: var(--c-gold); background: #20233d; color: var(--c-white); }
.mission-help { margin: -6px 0 12px; }
.send-ship { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 6px 8px; background: var(--c-ink); border: 3px solid var(--c-slate); margin-bottom: 6px; }
.send-ship .ss-name { flex: 1 1 110px; min-width: 0; display: flex; flex-direction: column; }
.send-ship .stepper { margin-left: auto; }
.send-ship.blocked { opacity: .45; }
.ss-name { flex: 1; display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.ss-name b { font-weight: normal; color: var(--c-white); }
.quick-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.quick-row .btn { margin: 0; }
.cargo-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.cr-name { flex: 1; }
.send-summary { background: var(--c-ink); border: 3px solid var(--c-slate); padding: 8px 12px; margin: 6px 0 4px; }

/* ----------------------------------------------------------------------------------------- 10 Berichte */
.berichte { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 18px; align-items: start; max-width: 1200px; margin: 0 auto; }
.rep-top { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; align-items: stretch; }
.rep-top .btn { align-self: flex-end; margin: 0; }
.rep-list { display: flex; flex-direction: column; gap: 6px; }
.rep-item { position: relative; display: flex; align-items: center; gap: 10px; text-align: left; padding: 8px 10px; background: var(--c-night); border: 3px solid var(--c-slate); width: 100%; }
.rep-item:hover { border-color: var(--c-mist); }
.rep-item.sel { border-color: var(--c-gold); background: #20233d; }
.rep-item.o-sieg { border-left: 8px solid var(--c-gold); }
.rep-item.o-niederlage { border-left: 8px solid var(--c-red); }
.rep-item.o-abgewehrt { border-left: 8px solid var(--c-blue); }
.rep-item.o-unentschieden { border-left: 8px solid var(--c-fog); }
.rep-item-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.rep-item.unread .rep-item-main b { color: var(--c-white); }
.rep-item:not(.unread) .rep-item-main b { color: var(--c-mist); font-weight: normal; }
.rep-item-main b { font-weight: normal; font-size: 13px; overflow-wrap: anywhere; }
.rep-short { font-size: 12px; color: var(--c-sand); overflow-wrap: anywhere; }
.unread-dot { width: 10px; height: 10px; background: var(--c-red); border: 2px solid var(--c-ink); flex: none; animation: badge 1s steps(2) infinite; }
.rep-back { display: none; margin-bottom: 10px; }
.rep-detail { min-width: 0; }
@media (min-width: 900px) { .rep-list-box { position: sticky; top: 0; align-self: start; max-height: 100%; overflow-y: auto; } }

.battle-report, .report-plain { background: var(--c-night); border: var(--bw) solid var(--c-slate); box-shadow: var(--shadow); padding: 16px; display: flex; flex-direction: column; gap: 18px; }
.report-plain { gap: 10px; }
.battle-report h3, .report-plain h3 { color: var(--c-fog); margin-bottom: 8px; }
.rb-head { text-align: center; }
.rb-head .rb-title, .report-plain .rb-title { font-size: 12px; color: var(--c-white); line-height: 1.6; }
.rb-banner { display: inline-block; margin: 14px 0 8px; padding: 14px 26px; font-family: var(--font-px); font-size: clamp(16px, 4vw, 26px); letter-spacing: 2px; background: var(--bc); color: var(--c-ink); border: 4px solid var(--c-ink); box-shadow: 0 6px 0 color-mix(in srgb, var(--bc) 50%, #000), 0 0 0 4px var(--bc), 0 0 28px color-mix(in srgb, var(--bc) 60%, transparent); animation: stamp .55s steps(6) both; text-shadow: 2px 2px 0 rgba(255, 255, 255, .25); }
.rb-banner.b-niederlage, .rb-banner.b-abgewehrt { color: var(--c-white); text-shadow: 2px 2px 0 rgba(0, 0, 0, .35); }
.rb-banner.b-unentschieden { color: var(--c-ink); }
.rb-sub { color: var(--c-sand); margin: 8px 0 0; }
.battle-report.br-sieg { border-color: var(--c-gold); }
.battle-report.br-niederlage { border-color: var(--c-red); }
.battle-report.br-abgewehrt { border-color: var(--c-blue); }

.rb-caps { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 10px; align-items: center; }
.rb-vs { font-family: var(--font-px); font-size: 14px; color: var(--c-orange); text-shadow: 2px 2px 0 var(--c-darkwood); }
.rb-cap { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; background: var(--c-ink); border: 3px solid var(--path, var(--c-slate)); padding: 10px 6px 12px; position: relative; height: 100%; }
.rb-cap.mine { border-color: var(--c-gold); }
.rb-cap.aboard { box-shadow: 0 0 0 2px var(--c-ink), 0 0 14px color-mix(in srgb, var(--path) 60%, transparent); }
.rb-role { font-family: var(--font-px); font-size: 8px; color: var(--c-fog); }
.rb-role b { color: var(--c-gold); font-weight: normal; }
.rb-face img { width: 64px; height: 64px; }
.rb-face .nest-icon img, .rb-face img.px { }
.rb-name { font-family: var(--font-px); font-weight: normal; font-size: 9px; color: var(--c-white); overflow-wrap: anywhere; line-height: 1.5; }
.rb-cap .rb-title { display: flex; align-items: center; gap: 4px; color: var(--path); font-size: 12px; justify-content: center; }
.rb-loc { font-size: 11px; color: var(--c-foam); }
.rb-loc.away { color: var(--c-steel); }
.rb-flag { display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-px); font-size: 8px; background: var(--c-gold); color: var(--c-ink); padding: 3px 6px; }

.rb-skill-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.rb-chips { display: flex; flex-wrap: wrap; gap: 6px; align-content: flex-start; background: var(--c-ink); border: 2px solid var(--c-slate); padding: 8px; }
.rb-chips.mine { border-color: var(--c-gold); }
.rb-chips-title { width: 100%; font-family: var(--font-px); font-size: 8px; color: var(--c-fog); }
.skill-chip { font-size: 12px; padding: 3px 8px; background: #20233d; border: 2px solid var(--c-steel); color: var(--c-white); }
.rb-chips.mine .skill-chip { border-color: var(--c-gold); }

.rb-rounds { display: flex; flex-direction: column; gap: 12px; }
.round-table { width: 100%; border-collapse: collapse; font-size: 13px; background: var(--c-ink); border: 3px solid var(--c-slate); }
.round-table.mine { border-color: var(--c-gold); }
.round-table th { font-family: var(--font-px); font-weight: normal; font-size: 8px; color: var(--c-fog); padding: 6px 4px; text-align: left; border-bottom: 3px solid var(--c-slate); background: #20233d; }
.round-table th.num { text-align: right; }
.round-table td { padding: 5px 4px; border-bottom: 2px dotted var(--c-slate); vertical-align: middle; }
.round-table td.ship { display: flex; align-items: center; gap: 6px; border-bottom: 2px dotted var(--c-slate); white-space: nowrap; }
.round-table td.start { color: var(--c-white); }
.round-table td.rd { position: relative; opacity: 0; animation: cellin .35s steps(4) forwards; animation-delay: var(--d, 0ms); }
.round-table td.rd.done { color: var(--c-steel); }
.round-table td.rd.hit { color: var(--c-orange); }
.round-table td.lost { color: var(--c-red); }
.round-table tr.lossy td.ship { color: var(--c-white); }
.round-table tr.fort td { background: rgba(115, 62, 57, .25); }
.cellbar { display: block; height: 4px; margin-top: 3px; background: var(--c-night); }
.cellbar b { display: block; height: 100%; width: calc(var(--r, 1) * 100%); background: var(--c-green); }
td.lv-mid .cellbar b { background: var(--c-orange); }
td.lv-lo .cellbar b { background: var(--c-red); }
.cellbar.fortbar b { background: var(--c-tan); }

.trend { background: var(--c-ink); border: 2px solid var(--c-slate); padding: 8px 10px 6px; }
.trend-cols { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; height: 110px; align-items: end; margin-top: 8px; }
.trend-col { display: flex; flex-direction: column; height: 100%; justify-content: flex-end; }
.trend-col.off { opacity: .35; }
.trend-bars { flex: 1; display: flex; gap: 4px; align-items: flex-end; border-bottom: 3px solid var(--c-slate); }
.tb { flex: 1; min-height: 2px; position: relative; transition: height .4s steps(6); }
.tb span { position: absolute; bottom: 100%; left: 0; right: 0; text-align: center; font-size: 10px; color: var(--c-mist); }
.tb.mine { background: var(--c-gold); } .tb.foe { background: var(--c-red); }
.trend-label { text-align: center; font-family: var(--font-px); font-size: 8px; color: var(--c-fog); margin-top: 4px; }
.trend-legend { display: flex; gap: 14px; font-size: 11px; justify-content: center; margin-top: 6px; }
.trend-legend .mine { color: var(--c-gold); } .trend-legend .foe { color: var(--c-red); }

.rb-chron { background: var(--c-sand); color: var(--c-darkwood); border: 4px solid var(--c-tan); padding: 12px 16px; box-shadow: inset 0 0 0 2px #cfb98c; }
.rb-chron h3 { color: var(--c-wood); }
.chron { margin: 0; padding-left: 22px; }
.chron li { margin: 4px 0; font-size: 14px; opacity: 0; animation: cellin .4s steps(4) forwards; animation-delay: var(--d, 0ms); }
.rb-result { background: var(--c-ink); border: 3px solid var(--c-slate); padding: 12px 14px; }
.res-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 6px 0; border-bottom: 2px dotted var(--c-slate); }
.res-row:last-child { border-bottom: 0; }
.res-row > b { min-width: 96px; font-family: var(--font-px); font-weight: normal; font-size: 8px; color: var(--c-fog); }
.res-row.warn > b { color: var(--c-orange); }
.xp-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; background: #20233d; border: 2px solid var(--c-steel); }
.xp-chip.mine { border-color: var(--c-green); }
.xp-chip b { font-weight: normal; color: var(--c-green); }
.xp-chip .lvl { font-style: normal; font-family: var(--font-px); font-size: 8px; color: var(--c-gold); margin-left: 4px; animation: badge 1s steps(2) infinite; }
.rb-analysis { display: flex; gap: 12px; align-items: flex-start; background: #20233d; border: 3px solid var(--c-yellow); padding: 12px 14px; }
.rb-analysis b { font-family: var(--font-px); font-weight: normal; font-size: 9px; color: var(--c-yellow); }
.rb-analysis p { margin: 6px 0 0; font-size: 14px; color: var(--c-white); }
.rb-analysis.good { border-color: var(--c-green); }
.rb-analysis.good b { color: var(--c-green); }
.an-ico { font-size: 24px; color: var(--c-yellow); line-height: 1; }
.rb-buttons { display: flex; flex-wrap: wrap; gap: 10px; }
.rb-buttons .btn { margin: 0; }
.sp-sec { margin-bottom: 8px; }
.bgrid { display: flex; flex-wrap: wrap; gap: 6px; }
.bchip { font-size: 12px; padding: 3px 8px; background: var(--c-ink); border: 2px solid var(--c-slate); }
.report-text { font-size: 14px; }

/* ------------------------------------------------------------------------ 11 Rangliste / Optionen / Mehr */
.rangliste, .optionen { max-width: 720px; margin: 0 auto; }
.rk-top { margin-bottom: 10px; }
.rk-me { margin: 6px 0 0; color: var(--c-sand); }
.rk-me b { color: var(--c-gold); font-weight: normal; }
.rk-list { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; }
.rk-row { display: grid; grid-template-columns: 34px 36px minmax(0, 1fr) auto 44px; gap: 10px; align-items: center; text-align: left; width: 100%; padding: 6px 10px 6px 6px; background: var(--c-night); border: 3px solid var(--c-slate); min-height: 48px; }
.rk-row:hover { border-color: var(--c-mist); }
.rk-row.me { border-color: var(--c-gold); background: #2a2a3f; box-shadow: 0 0 0 2px var(--c-ink), 0 0 12px rgba(254, 174, 52, .4); }
.rk-rank { text-align: center; font-family: var(--font-px); font-size: 10px; color: var(--c-fog); }
.rk-rank b { font-weight: normal; }
.medal { display: inline-block; width: 26px; padding: 5px 0; color: var(--c-ink); }
.medal.m1 { background: var(--c-gold); } .medal.m2 { background: var(--c-mist); } .medal.m3 { background: var(--c-tan); }
.rk-face img { width: 32px; height: 32px; display: block; border: 2px solid var(--path, var(--c-slate)); }
.rk-name { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.rk-name > b { font-weight: normal; color: var(--c-white); overflow-wrap: anywhere; }
.rk-title { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--path, var(--c-fog)); flex-wrap: wrap; }
.rk-val { font-family: var(--font-px); font-size: 10px; color: var(--c-gold); text-align: right; }
.rk-delta { font-size: 11px; text-align: right; color: var(--c-steel); }
.rk-delta.up { color: var(--c-green); } .rk-delta.down { color: var(--c-red); }
.ccard { --path: var(--c-fog); }
.cc-head { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; }
.cc-head .cap-frame img { width: 128px; height: 128px; }
.cc-main { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; min-width: 0; }
.cc-name { font-family: var(--font-px); font-size: 11px; color: var(--c-white); overflow-wrap: anywhere; }
.cc-paths { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.cc-path { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 8px; align-items: center; font-size: 12px; }
.cc-path .bar { grid-column: 1 / -1; height: 8px; }
.cc-path b { font-family: var(--font-px); font-weight: normal; font-size: 10px; color: var(--pc); }
.cc-cap { color: var(--c-gold); display: flex; align-items: center; gap: 6px; }
.cc-actions { margin-top: 8px; }
.opt-title { margin-bottom: 14px; font-size: 14px; color: var(--c-gold); }
.optionen .panel { margin-bottom: 18px; }
.back-link { font-size: 14px; }
.more-menu { display: flex; flex-direction: column; gap: 8px; }
.more-item { display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--c-ink); border: 3px solid var(--c-slate); text-align: left; min-height: 48px; font-size: 15px; color: var(--c-white); }
.more-item span { flex: 1; }
.more-item i { font-style: normal; color: var(--c-fog); }

/* ---------------------------------------------------------------------------------------- 12 responsive */
@media (max-width: 1240px) and (min-width: 900px) {
	:root { --sheet-w: 320px; }
	.hres-rate { display: none; }
	.brand { width: 190px; }
	/* two rows when the resource chips would get too narrow */
	.topbar { flex-wrap: wrap; row-gap: 8px; }
	.hud-res { flex: 1 1 460px; min-width: 460px; }
	.hud-meta { margin-left: auto; }
}

@media (max-width: 899px) {
	body { overflow: hidden; }
	.app {
		grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr) 28px calc(58px + env(safe-area-inset-bottom));
		grid-template-areas: "top" "side" "center" "ticker" "nav";
	}
	.panel-col, .sidenav { display: none; }
	.bottomnav { display: flex; background: var(--c-night); border-top: var(--bw) solid var(--c-slate); padding-bottom: env(safe-area-inset-bottom); z-index: 25; }
	.bottomnav .nav-item { flex: 1; flex-direction: column; justify-content: center; gap: 2px; padding: 4px 2px; border-width: 0; box-shadow: none; background: transparent; font-size: 8px; letter-spacing: -0.5px; min-width: 0; min-height: 56px; text-align: center; }
	.bottomnav .nav-item.active { background: var(--c-slate); box-shadow: inset 0 4px 0 var(--c-gold); }
	.bottomnav .nav-label { flex: none; }
	.nav-badge { position: absolute; top: 2px; right: 6px; min-width: 18px; padding: 2px 4px; font-size: 9px; }

	.topbar { flex-wrap: wrap; gap: 6px 10px; padding: 6px 10px; }
	.brand { width: auto; flex: 0 0 auto; flex-direction: row; align-items: baseline; gap: 10px; order: 1; }
	.brand-name { display: none; }
	.hud-meta { order: 2; flex: 1 1 0; min-width: 0; gap: 6px 8px; }
	.clock { font-size: 8px; }
	.pill { font-size: 8px; padding: 8px 8px; min-height: 32px; display: inline-flex; align-items: center; }
	.pill.prot, .pill.alarm { position: static; }
	.hud-meta { flex-wrap: wrap; justify-content: flex-end; }
	.hud-res { order: 3; flex: 1 1 100%; gap: 6px; }
	.hres { padding: 3px 6px; gap: 5px; border-width: 2px; }
	.hres .px { width: 20px; height: 20px; }
	.hres-amt { font-size: 9px; }
	.hres-rate { display: none; }
	.hres-bar { height: 5px; margin-top: 3px; }
	.popover { right: 0; left: auto; }

	.side { padding: 6px 8px; overflow: visible; }
	.capcard { flex-direction: row; align-items: center; gap: 10px; padding: 6px 8px; box-shadow: var(--shadow-sm); border-width: 3px; border-top-width: 3px; flex-wrap: wrap; }
	.capcard .cap-frame { padding: 2px; box-shadow: none; }
	.cap-portrait img { width: 56px; height: 56px; }
	.cap-main { flex: 1 1 140px; text-align: left; }
	.cap-name { font-size: 9px; }
	.cap-title { margin: 2px 0 3px; font-size: 12px; }
	.cap-meta { margin-top: 3px; justify-content: flex-start; }
	.cap-lvl-row { font-size: 10px; }
	.cap-badges { flex-direction: row; gap: 6px; flex: 1 1 100%; }
	.cap-badges .badge-btn { flex: 1 1 0; }
	.lbl-long { display: none; } .lbl-short { display: inline; }
	.badge-btn { font-size: 9px; padding: 6px 8px; min-height: 40px; }
	.cap-actives { flex-direction: row; flex: 1 1 100%; }
	.cap-actives:empty { display: none; }
	.cap-active { min-height: 40px; }
	.quest-strip { display: flex; align-items: stretch; gap: 6px; margin-top: 6px; }
	.qs-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 6px 8px; min-height: 40px; background: var(--c-ink); border: 3px solid var(--c-slate); color: var(--c-white); font-size: 13px; text-align: left; }
	.qs-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
	.qs-prog { flex: none; font-family: var(--font-px); font-size: 9px; color: var(--c-gold); }
	.qs-claim { flex: none; }

	.center { margin: 0; border-width: 0; border-top: var(--bw) solid var(--c-slate); border-bottom: var(--bw) solid var(--c-slate); box-shadow: none; }
	.tab.scroll { padding: 12px 10px 24px; }
	.ticker { padding: 0 8px; border-top-width: 3px; }
	.ticker-track { font-size: 12px; }
	#toasts { top: 8px; bottom: auto; left: 50%; }
	.btn { min-height: 44px; }
	.btn.small { min-height: 40px; }
	.ibtn, .step-input { height: 44px; min-width: 44px; }
	.step-input { min-width: 56px; }
	.seg-btn { min-height: 44px; }
	.event-opt, .mission-btn { min-height: 48px; }
	.node { width: 56px; height: 56px; }
	.node.capstone { width: 68px; height: 68px; }

	.head-card { grid-template-columns: 1fr; text-align: center; }
	.head-portrait { display: flex; justify-content: center; }
	.head-portrait .cap-frame img { width: 144px; height: 144px; }
	.head-title, .head-level, .head-points { justify-content: center; }
	.head-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
	.kap-cols, .bonus-body { grid-template-columns: 1fr; }

	.path-counters { gap: 6px; }
	.path-counter { grid-template-columns: 1fr auto; padding: 6px; }
	.path-counter .px { display: none; }
	.pc-bar { grid-column: 1 / -1; }
	.tree-seg { display: flex; }
	.tree { min-width: 0; grid-template-columns: 62px minmax(0, 1fr); gap: 6px; }
	.tree .col-H, .tree .col-S, .tree .col-W { grid-column: 2; }
	.tree[data-view="H"] .col-S, .tree[data-view="H"] .col-W,
	.tree[data-view="S"] .col-H, .tree[data-view="S"] .col-W,
	.tree[data-view="W"] .col-H, .tree[data-view="W"] .col-S { display: none; }
	.tcell.deck { grid-column: 2; }
	.tier-gutter { padding: 4px 6px; }
	.tier-gutter span { font-size: 10px; }
	.node-wrap { width: 84px; }
	.tree-colhead { font-size: 8px; }

	.create-cols { grid-template-columns: 1fr; gap: 12px; }
	.origin-grid { grid-template-columns: 1fr; }
	.modal { width: 96vw; }
	.modal-body { padding: 12px; }

	.berichte { grid-template-columns: minmax(0, 1fr); gap: 0; }
	.berichte[data-mode="list"] .rep-detail { display: none; }
	.berichte[data-mode="detail"] .rep-list-box { display: none; }
	.rep-back { display: inline-flex; }
	.rb-caps { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
	.rb-vs { display: none; }
	.rb-skill-cols { grid-template-columns: 1fr; }
	.round-table { font-size: 12px; }
	.round-table td.ship span { max-width: 74px; overflow: hidden; text-overflow: ellipsis; }
	.battle-report { padding: 12px 10px; }
	.rk-row { grid-template-columns: 28px 34px minmax(0, 1fr) auto 38px; gap: 6px; }
	.debug-panel { bottom: 90px; }
	.sheet-body { padding: 12px; }
}

@media (max-width: 380px) {
	.hres-amt { font-size: 8px; }
	.pill.speed { font-size: 8px; padding: 8px 6px; }
	.node-wrap { width: 76px; }
}

/* ------------------------------------------------------------------------------------------ 13 motion */
@keyframes bob { 50% { transform: translateY(-4px); } }
@keyframes badge { 50% { filter: brightness(1.35); } }
@keyframes alarm { 50% { background: var(--c-red); } }
@keyframes nodepulse { 50% { border-color: var(--c-white); box-shadow: 0 3px 0 var(--c-ink), 0 0 12px var(--pc); } }
@keyframes ticker { from { transform: translateX(0); } to { transform: translateX(-100%); } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(.92); opacity: 0; } }
@keyframes sheetin { from { transform: translateX(24px); opacity: 0; } }
@keyframes sheetup { from { transform: translateY(100%); } }
@keyframes toastin { from { transform: translateY(-12px); opacity: 0; } }
@keyframes stamp { 0% { transform: scale(2.4) rotate(-6deg); opacity: 0; } 70% { transform: scale(.95) rotate(1deg); opacity: 1; } 100% { transform: scale(1) rotate(-1deg); opacity: 1; } }
@keyframes cellin { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
	.ticker-track { animation: none !important; padding-left: 0; display: block; }
	.round-table td.rd, .chron li { opacity: 1; }
}

/* short desktop windows: shrink the captain card so the whole tab list stays visible */
@media (min-width: 900px) and (max-height: 900px) {
	.cap-portrait img { width: 96px; height: 96px; }
	.side { gap: 8px; padding-top: 10px; }
	.nav-item { padding: 5px 10px; }
	.capcard .cap-meta { margin-top: 4px; }
}

@media (max-width: 899px) {
	.capcard { padding: 6px 8px; gap: 5px 8px; }
	.cap-portrait img { width: 48px; height: 48px; }
	.cap-title { margin: 0 0 2px; font-size: 11px; }
	.cap-xp { height: 8px; margin-top: 2px; }
	.cap-meta { margin-top: 2px; }
	.badge-btn { min-height: 40px; padding: 6px 8px; }
	.topbar { padding: 4px 10px; }
	.tier-gutter b { font-size: 8px; }
	.tier-gutter span { font-size: 9px; }
}

/* Phones: the Kapitän tab already shows the full captain sheet, so the compact card on top would only repeat it. */
@media (max-width: 899px) {
	.app[data-tab="kapitaen"] #capcard { display: none; }
}
