/* Dark instruments, oiled walnut edges and aged brass. UI only; no world filters. */
:root {
  color-scheme: dark;
  --helm-ink: #f0e9d9;
  --helm-muted: #b6bbb0;
  --helm-brass: #d3af70;
  --helm-warning: #ffb197;
  --helm-edge: #686252;
  --helm-surface: #19231f;
  --helm-inset: #101815;
  --helm-face: linear-gradient(145deg, #232d28, #151d19);
  --helm-grain: repeating-linear-gradient(3deg, #160b0433 0 1px, transparent 1px 4px, #e4b4771a 4px 5px, transparent 5px 9px);
  --helm-wood: linear-gradient(100deg, #42291c, #90603d 24%, #503322 49%, #835735 77%, #3c281c);
  --helm-frame: 5px;
}
html, body {
  background: #0f1714;
  color: var(--helm-ink);
  font-family: "Segoe UI", "Trebuchet MS", system-ui, sans-serif;
}
::selection { color: #111814; background: var(--helm-brass); }
* { scrollbar-color: #726044 #141c18; }
.panel, body #icwDiagnostics {
  color: var(--helm-ink);
  border: var(--helm-frame) solid transparent;
  border-radius: 12px;
  background: var(--helm-face) padding-box, var(--helm-grain) border-box, var(--helm-wood) border-box;
  box-shadow: inset 0 0 0 1px #cba56e50, 0 2px 0 #090d0b, 0 8px 22px #0005;
}
h1, h2 { color: var(--helm-ink); }
h1 { font-family: Georgia, "Times New Roman", serif; font-size: 44px; letter-spacing: .09em; font-weight: 700; }
h1 span { color: var(--helm-brass); }
h2 { letter-spacing: .015em; }
.sub, .note { color: var(--helm-muted); opacity: 1; }
.sub { font-weight: 500; line-height: 1.5; }
button, select, input, textarea {
  color: var(--helm-ink);
  font-family: inherit;
  font-weight: 600;
  border: 1px solid var(--helm-edge);
  border-radius: 7px;
}
button {
  background: linear-gradient(#d6b781, #b38c52);
  color: #18201b;
  box-shadow: inset 0 1px 0 #fff5, 0 2px 0 #0b100d;
  transition: border-color .12s, background-color .12s, box-shadow .12s;
}
button:hover:not(:disabled) { border-color: #efd3a1; box-shadow: inset 0 1px 0 #fff5, 0 0 0 1px #d3af7060, 0 2px 0 #0b100d; }
button:active:not(:disabled) { box-shadow: inset 0 1px 5px #0004; transform: translateY(1px); }
button.alt, .seg button, .tabs button {
  background: linear-gradient(#2e3931, #222c26);
  color: var(--helm-ink);
  border-color: #5e6353;
}
button.go { background: linear-gradient(#d6b781, #b38c52); color: #18201b; border-color: #d6b781; }
button:disabled { opacity: .48; box-shadow: none; }
select, input, textarea {
  background: var(--helm-inset);
  box-shadow: inset 0 1px 4px #0005;
  padding: 8px 10px;
  user-select: text;
  caret-color: var(--helm-brass);
}
select option { background: #19231f; color: var(--helm-ink); }
input::placeholder, textarea::placeholder { color: #a3aa9f; opacity: 1; }
button:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid #e8c990;
  outline-offset: 3px;
}
.seg button.on, .tabs button.on { background: linear-gradient(#725434, #523e29); color: #fff1d4; border-color: #b49663; }
.seg button:first-child { border-radius: 7px 0 0 7px; }
.seg button:last-child { border-radius: 0 7px 7px 0; }

/* Fleet selection. Keep the boat previews and selection behavior intact. */
#veil {
  background: radial-gradient(ellipse at 50% 0, #5c64412b, transparent 65%), linear-gradient(155deg, #1b2923, #0b100e 80%);
  align-items: flex-start;
  padding: 24px;
}
#title { --helm-frame: 7px; margin-block: auto; flex-shrink: 0; padding: 24px 28px; }
#title .bar2 { gap: 12px; margin: 16px 0; }
#title label { display: flex; align-items: center; gap: 8px; max-width: 100%; }
#portSel { max-width: min(300px, 60vw); min-width: 0; }
.boats { gap: 10px; }
.boat { background: #1d2822; border: 1px solid #60614e; border-radius: 8px; color: #c6cbbf; }
.boat img { background: #263b36; }
.boat div { border-top: 1px solid #83704d; padding: 7px 10px 9px; line-height: 1.45; }
.boat b { color: var(--helm-ink); margin-bottom: 2px; }
.boat:hover { border-color: #cfad75; }
.boat.sel { outline: 2px solid #e0b97a; outline-offset: 2px; background: #344034; }
.boat.sel b { color: #f4d6a0; }
.boat.lock { opacity: .58; }
.boat em { background: #19231feb; color: #ead5ac; border: 1px solid #a38a60; border-radius: 4px; padding: 2px 7px; }

/* Instruments and switches keep their familiar places around the water view. */
#topL { padding: 9px 14px; }
#topL .big { color: #f3deb6; letter-spacing: .025em; }
#topL small { color: #bdc5b8; opacity: 1; font-weight: 500; }
#wallet b { color: #9dd3ac; }
#gauges { padding: 12px 14px; }
#spd { color: #f5e4c3; font-variant-numeric: tabular-nums; font-weight: 650; letter-spacing: -.025em; }
#spd small { color: #b8bfb1; opacity: 1; letter-spacing: 0; }
.row { font-weight: 600; }
.bar { background: #080f0b; border: 1px solid #716245; box-shadow: inset 0 1px 3px #0008; height: 9px; }
.bar i { background: #cea451; }
#windc { border-radius: 50%; background: #d9d0b9; box-shadow: 0 0 0 2px #967348, 0 0 0 3px #0b100d; }
#sw { top: 156px; gap: 6px; }
#sw button {
  background: linear-gradient(#28342c, #19231e);
  color: #e3e7dc;
  border: 1px solid #7c6544;
  border-radius: 7px;
  box-shadow: inset 3px 0 0 #67442c, inset 0 1px 0 #e0bd7a20, 0 2px 4px #0004;
}
#sw button.on { background: linear-gradient(#354b39, #273b2c); border-color: #9b9d6a; }
#sw button i { background: #485247; border: 1px solid #b4ac8870; box-shadow: inset 0 1px 2px #0008; }
#sw button.on i { background: #98db8d; box-shadow: 0 0 7px #8fdb8070; }
#help { color: #d0d5c8; }
#help b { background: #303c32; color: #ead3aa; border: 1px solid #7f7153; box-shadow: 0 1px 1px #0008; }
#prompt { --helm-frame: 3px; background: linear-gradient(#dac08c, #bb945a) padding-box, var(--helm-wood) border-box; color: #19231b; border-radius: 8px; }
#badge { --helm-frame: 2px; background: #352b20; color: #f1c58d; border-color: #b48e57; border-radius: 7px; }
#wpinfo { background: #21322b; border-color: #967348; color: #f1d8a8; }
#job { color: #ead9b8; }
#mapbox { padding: 5px; }
#mapbox canvas, #chart canvas { border-radius: 6px; outline: 1px solid #9d83594d; }
#mapbox span, #chart span { color: #c4c9bc; opacity: 1; }
#chartBar b { color: #e6c99a; }
#chatIn { background: #152019ed; color: var(--helm-ink); border: 1px solid #8c7753; opacity: .92; box-shadow: 0 2px 8px #0004; border-radius: 7px; }
#chatIn:focus { opacity: 1; border-color: #e8c990; outline: 2px solid #d3af7055; }
#chatLog div { background: #17251feb; color: var(--helm-ink); border: 1px solid #675d45; border-radius: 7px; }
#chatLog div.me { background: #2d4334f2; border-color: #80916b; }
.lbl { background: #1c2a23ed; color: #eee4cf; border: 1px solid #b2986b; border-radius: 5px; box-shadow: 0 2px 4px #0004; }
.lbl.wp { background: #d4b073; color: #19231b; }
.lbl.wpt { background: #315a55; color: #f0eee1; border-color: #9ab6a0; }
.toast { background: #26392e; color: #f0e8d6; border: 1px solid #9b845e; border-radius: 8px; box-shadow: 0 3px 10px #0005; }
.toast.warn { background: #603a2d; color: #ffe0c7; border-color: #c48c65; }
.toast.good { background: #304b38; color: #e5f3dc; border-color: #8ca47a; }
#msg { background: #0e1715cf; color: #f2e6cd; }

/* Harbor and terrain reports use the same wood-framed instrument surfaces. */
#harbor { padding: 20px 24px; }
#harbor > div:first-child { gap: 12px; }
.tabs { border-bottom: 1px solid #7c69464d; padding-bottom: 10px; gap: 8px; }
.item { background: #101a15; border: 1px solid #5b604d; border-radius: 8px; padding: 11px 13px; color: #c5ccbf; }
.item b { color: #eee4cf; }
#repairDialog { width: min(460px, calc(100vw - 32px)); padding: 22px; }
#repairDialog::backdrop { background: #080e0bd1; }
#repairDialog form > b { color: #ebd2a6; font-size: 20px; }
#repairDialog label { color: #d5dccd; font-size: 14px; }
#repairDialog textarea { resize: vertical; min-height: 108px; line-height: 1.5; }
#repairLocation { color: var(--helm-muted); }
#repairStatus { color: #ecd1a0; line-height: 1.45; }
#repairRecent { border-top: 1px solid #71604788; padding-top: 6px; }
#repairRecent:empty { display: none; }
#reportTerrain { background: linear-gradient(#62452f, #3c2c21); color: #f1dfbf; border-color: #a58b5e; }

/* Specificity keeps the optional diagnostics' dynamically inserted CSS in theme. */
body #icwDiagnostics { --helm-frame: 4px; }
body #icwDiagnostics header { background: #202a24; border-bottom: 1px solid #7c69465c; }
body #icwDiagnostics h2, body #icwDiagnostics h3 { color: #ead4ad; }
body #icwDiagnostics .diag-muted, body #icwDiagnostics th { color: #b8c0b2; }
body #icwDiagnostics .diag-card { background: #303b30; border: 1px solid #7f72543d; border-radius: 6px; }
body #icwDiagnostics .diag-value { color: #f1e2c6; }
body #icwDiagnostics button { background: #354233; color: #f1e6d0; border-color: #8a7957; }
body #icwDiagnostics button:focus-visible { outline-color: #e8c990; }
body #icwDiagnostics svg { background: #111d16; }
body #icwDiagnostics .diag-line { stroke: #a7c99b; }
body #icwDiagnostics .diag-budget { stroke: #d5b275; }
@media (max-width: 760px) {
  #veil { padding: 12px; }
  #title { padding: 18px 16px; --helm-frame: 5px; }
  h1 { font-size: 30px; letter-spacing: .05em; }
  #title .bar2 { gap: 10px; }
  #harbor { padding: 16px; }
  #harbor > div:first-child, .tabs, .item { flex-wrap: wrap; }
  #jumpSel { max-width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  button { transition: none; }
  .toast { animation: none; }
}
