/* A paper catalogue with a deep-green binding and softly lit model displays. */
:root {
  color-scheme: light;
  --paper: #f4f0e7;
  --page-top: #faf6ed;
  --surface: #fffaf0;
  --surface-2: #f3eee3;
  --surface-3: #e9e4d7;
  --surface-glass: #fffaf0eb;
  --ink: #262d2b;
  --muted: #555f58;
  --quiet-ink: #62695f;
  --line: #d5cdbb;
  --rule: #e6dfd0;
  --edge: #b8ac8c;
  --accent: #775422;
  --accent-strong: #654516;
  --brass: #b4914d;
  --brass-glint: #ead6a3;
  --sea: #2c574e;
  --teal: var(--sea);
  --sea-deep: #193d37;
  --sea-light: #e1eae1;
  --sea-ink: #224d42;
  --tab-active: #ece4d2;
  --tab-ink: #644d27;
  --navy: #19362f;
  --chip: #f1ecdf;
  --focus: #97652f;
  --button-fill: #2e554a;
  --button-ink: #fffaf0;
  --button-hover: #204435;
  --slip: #eee9dc;
  --strip: #e4e8dd;
  --strip-ink: #395449;
  --key: #fbf6eb;
  --stack-shadow: 0 2px 5px #40392512, 0 12px 28px -18px #4b3b1b70;
  --small-shadow: 0 1px 3px #493d2320;
  --glint: #ffffff85;
  --backdrop: #0f211ed1;
  --hero-ink: #20362e;
  --hero-muted: #4b6054;
  --hero-sky: #f2e8cf;
  --hero-mid: #e8e4d0;
  --hero-sea: #c5d5c9;
  --hero-shelf: #a7bdaf;
  --hero-haze: #fff6c98a;
  --hero-shade: #596b5621;
  --model-shadow: #24372f45;
  --positive: #1e6049;
  --caution: #775319;
  --negative: #92463c;
  --chart-water: #e1e9df;
  --display: 'Iowan Old Style', 'Palatino Linotype', 'Book Antiqua', Georgia, serif;
  --ui: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html[data-theme='dark'] {
  color-scheme: dark;
  --paper: #151d1b;
  --page-top: #202823;
  --surface: #242d28;
  --surface-2: #202722;
  --surface-3: #30382e;
  --surface-glass: #252d25ee;
  --ink: #f2ead8;
  --muted: #c0c5b4;
  --quiet-ink: #afb8a8;
  --line: #475044;
  --rule: #394339;
  --edge: #746e52;
  --accent: #e1bb78;
  --accent-strong: #f2d49e;
  --brass: #b39b64;
  --brass-glint: #d5c497;
  --sea: #91b9a9;
  --sea-deep: #152f28;
  --sea-light: #324a3d;
  --sea-ink: #c1e4cf;
  --tab-active: #424234;
  --tab-ink: #eee0b5;
  --navy: #111f1b;
  --chip: #30382d;
  --focus: #e6bd74;
  --button-fill: #a7c9ae;
  --button-ink: #152a20;
  --button-hover: #c1d8bd;
  --slip: #283129;
  --strip: #344238;
  --strip-ink: #d4e2cc;
  --key: #242e27;
  --stack-shadow: 0 2px 5px #0004, 0 14px 26px -18px #000c;
  --small-shadow: 0 1px 4px #0003;
  --glint: #fff3bd14;
  --backdrop: #050907cf;
  --hero-ink: #f7efdb;
  --hero-muted: #dce2d0;
  --hero-sky: #364238;
  --hero-mid: #3d5146;
  --hero-sea: #496359;
  --hero-shelf: #34483e;
  --hero-haze: #dcc48b32;
  --hero-shade: #15291c58;
  --model-shadow: #06171070;
  --positive: #a8d7ae;
  --caution: #e5c289;
  --negative: #f1b19e;
  --chart-water: #35453c;
}

html { background-color: var(--paper); }
body {
  color: var(--ink);
  background:
    radial-gradient(ellipse at 14% 0%, var(--glint), transparent 42rem),
    linear-gradient(var(--page-top), var(--paper) 40rem);
}
body ::selection { background: var(--sea); color: var(--surface); }
body :is(a, button, select, input, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
a, .ghost { color: var(--accent); }
button { -webkit-tap-highlight-color: transparent; }
input, select, textarea { accent-color: var(--sea); }
input::placeholder, textarea::placeholder { color: var(--quiet-ink); opacity: 1; }
footer, .version-link, .footer-data { color: var(--muted); }
footer { border-top: 1px solid var(--rule); margin-top: 16px; }
footer span:first-child { font: 500 12px var(--ui); }

.mast {
  background:
    radial-gradient(ellipse at 23% 0%, #64745b35, transparent 55%),
    linear-gradient(110deg, #1c362d, #223c31 53%, #172e27);
  box-shadow: inset 0 -1px #bca576, 0 2px 9px #191f171c;
}
html[data-theme='dark'] .mast {
  background: radial-gradient(ellipse at 17% 0, #63755732, transparent 48%), #11221c;
  box-shadow: inset 0 -1px #796d4c, 0 2px 9px #0003;
}
.nav { color: #d5ddcd; }
.nav.active, .nav:hover { color: #fff6df; }
.nav.active::after {
  height: 2px;
  background: linear-gradient(90deg,#b9a079,#e8cf92,#b9a079);
}
.dataset, .theme-toggle {
  border: 1px solid #a39e774e;
  border-radius: 6px;
  background: #b8b39113;
  color: #eee8cf;
}
.dataset:hover, .theme-toggle:hover { background: #c9be8f28; }
.dataset i { background: #b9cb9a; box-shadow: 0 0 4px #b9cb9a38; }
.theme-toggle { display: inline-grid; place-items: center; padding: 4px; min-width: 29px; min-height: 29px; }
.theme-toggle .icon { width: 16px; height: 16px; }

.heading h1 {
  color: var(--ink);
  font-family: var(--display);
  font-size: clamp(28px, 2.55vw, 39px);
  font-weight: 600;
  letter-spacing: -.045em;
}
.heading .action, .action {
  border-color: var(--button-fill);
  color: var(--button-ink);
  background: var(--button-fill);
  box-shadow: inset 0 1px var(--glint), var(--small-shadow);
}
.action:hover { background: var(--button-hover); border-color: var(--button-hover); }
.outline, .toolbtn, .tile-add, .round, .listitem .addsign, .build-chip, .fav-star, .ship-tools .remove {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}
.outline:hover, .toolbtn:hover, .round:hover, .tile-add:hover, .build-chip:hover,
.fav-star:hover, .ship-tools .remove:hover {
  background: var(--surface-3);
  border-color: var(--edge);
}
.quiet, .viewtabs button, .viewtabs small, .segment button, .switchline, .rank-key {
  color: var(--muted);
}
.viewtabs button.active, .shelf-tabs button.active {
  background: var(--tab-active);
  color: var(--tab-ink);
  box-shadow: inset 0 -2px var(--brass);
}
.quiet:hover, .viewtabs button:not(.active):hover { background: var(--surface-3); }
.segment {
  background: var(--slip);
  border-color: var(--line);
  border-radius: 6px;
  padding: 2px;
}
.segment button.on {
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--small-shadow);
}
.switchline input { background: var(--edge); }
.switchline input:checked { background: var(--sea); }
.switchline input:checked::before { background: var(--surface); }

.board, .tile, dialog, .history-row {
  background: var(--surface);
  border: 1px solid var(--edge);
  box-shadow: var(--stack-shadow);
}
.board { border-radius: 10px; }
.scroller { scrollbar-color: var(--edge) var(--surface-2); }
.comp-table { background: var(--surface); }
.comp-table .ship-cell { background:var(--surface-2); vertical-align:top; }
.ship-cell > .ship-symbols {
  padding:5px 7px;
  background:var(--surface-2);
  box-shadow:inset 0 -1px var(--line);
  align-content:start;
}
.ship-symbols, .ship-symbols__or { color:var(--muted); }
.ship-symbol {
  border-color:#698174;
  background:linear-gradient(#3a5147,#2b4238);
  color:#eff4e8;
}
.ship-symbol:is(:hover,:focus-visible,[aria-describedby]) { background:#46624f; border-color:#adbd9f; }
.ship-symbol__badge { background:#e5eadb; color:#253b30; }
.fleet-symbol-tip { border-color:#7a8a73; color:#fff9e8; background:#243d30; }
.fleet-symbol-tip span:not(:empty) { color:#e1e5d2; }
.comp-table td, .comp-table th { border-color: var(--line); border-bottom-color: var(--rule); }
.comp-table tbody tr:not(.band) td { background: var(--surface); }
.comp-table tbody tr:not(.band):nth-child(even) td { background: var(--surface-2); }
.comp-table .sticky { background: var(--key); color: var(--ink); }
.comp-table tbody tr:not(.band):nth-child(even) .sticky { background: var(--slip); }
.comp-table tbody tr:hover td, .comp-table tbody tr:not(.band):hover td { background: var(--sea-light); }
.comp-table .corner {
  color: #fbf2d4;
  background: radial-gradient(ellipse at 120% 0%, #8d95613d, transparent 65%),
              linear-gradient(135deg,#214135,#345444);
  box-shadow: inset 0 0 0 4px #79977312, inset 0 -2px #b49e6d;
}
html[data-theme='dark'] .comp-table .corner { background: linear-gradient(125deg,#243e31,#1b3429); }
.corner-title { color: #fbf1d4; font-family: var(--display); font-size: 19px; font-weight: 600; }
.corner small, .corner .icon { color: #d8dabb; }
.comp-table .band th, .comp-table .band .sticky {
  background: var(--strip);
  color: var(--strip-ink);
  border-color: var(--line);
  height: auto;
  min-height: 29px;
}
.band .icon, .group-toggle .icon { color: var(--sea); }
.group-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 23px;
  padding: 0;
  text-align: left;
  color: var(--strip-ink);
  font-weight: 650;
}
.group-toggle:hover { color: var(--accent); }
.comp-table .emptyval { color: var(--quiet-ink); }
.track { background: var(--slip); }
.track i { background: var(--edge); }
.track i.best { background: var(--positive); }
.value.best { color: var(--positive); }
.tone-green { --tone-ink: #245743; --tone-bg: #dfeadd; }
.tone-yellow { --tone-ink: #655321; --tone-bg: #f0e6ba; }
.tone-orange { --tone-ink: #794b23; --tone-bg: #f4e2c8; }
.tone-red { --tone-ink: #823f3a; --tone-bg: #f1dcd4; }
html[data-theme='dark'] .tone-green { --tone-ink:#b5ddba; --tone-bg:#304b39; }
html[data-theme='dark'] .tone-yellow { --tone-ink:#e7d288; --tone-bg:#48432c; }
html[data-theme='dark'] .tone-orange { --tone-ink:#edc18f; --tone-bg:#4f3e2f; }
html[data-theme='dark'] .tone-red { --tone-ink:#ecb39e; --tone-bg:#4c3632; }

/* Each hull has its own display shelf. The images have transparent, tightly-cropped edges. */
.comp-table .ship-card, .tile-img, .detail-image, .history-img, .listitem .thumb {
  background:
    radial-gradient(ellipse at 28% 18%, var(--hero-haze), transparent 58%),
    radial-gradient(ellipse at 61% 112%, var(--hero-shade), transparent 50%),
    linear-gradient(166deg, var(--hero-sky), var(--hero-mid) 44%, var(--hero-sea) 80%, var(--hero-shelf));
}
.comp-table .ship-card.t1, .tile:nth-child(3n+2) .tile-img { --hero-haze: #fff0ba97; }
.comp-table .ship-card.t2, .tile:nth-child(3n) .tile-img { --hero-haze: #e4f1d79e; }
html[data-theme='dark'] .comp-table .ship-card.t1, html[data-theme='dark'] .tile:nth-child(3n+2) .tile-img { --hero-haze: #dcc18b38; }
html[data-theme='dark'] .comp-table .ship-card.t2, html[data-theme='dark'] .tile:nth-child(3n) .tile-img { --hero-haze: #a0c5b131; }
.comp-table .ship-card {
  height: clamp(174px, 15vw, 219px);
  box-shadow: inset 0 -2px var(--brass);
}
.ship-card::before, .tile-img::before, .detail-image::before {
  inset: 4px;
  z-index: -1;
  border: 1px solid color-mix(in srgb, var(--brass) 40%, transparent);
  border-radius: 3px;
  mask-image: none;
  background-image: linear-gradient(155deg, var(--glint), transparent 32%);
  background-size: 100% 100%;
  pointer-events: none;
}
.ship-link { color: var(--hero-ink); padding: 11px 13px; }
.ship-name, .tile-name, .dlg-head h2 {
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: -.035em;
}
.ship-name { font-size: clamp(18px, 1.66vw, 25px); }
.ship-meta, .ship-link .country { color: var(--hero-muted); }
.ship-meta { font-weight: 600; }
.tier {
  color: var(--tab-ink);
  border-color: var(--edge);
  background: var(--surface-glass);
  font-family: var(--mono);
  letter-spacing: .02em;
}
.ship-art { filter: drop-shadow(0 4px 3px var(--model-shadow)); }
.ship-card .ship-art {
  height: 68%;
  max-height: calc(100% - 53px);
  width: calc(100% - 12px);
  left: 6px;
  bottom: 5px;
}
.ship-tools .remove, .ship-tools .fav-star, .tile>.fav-star, .drag-handle {
  background: var(--surface-glass);
  border: 1px solid var(--edge);
  border-radius: 5px;
  color: var(--muted);
}
.ship-tools .remove:hover { color: var(--negative); }
.fav-star.marked {
  background: var(--tab-active);
  border-color: var(--brass);
  color: var(--tab-ink);
}
.fav-star.marked .icon { fill: var(--brass); }
.build-chip {
  border-color: var(--edge);
  color: var(--tab-ink);
  background: var(--surface-glass);
  box-shadow: var(--small-shadow);
}
.ship-registry { color: var(--hero-muted); font: 500 .69rem/1.25 var(--ui); }
.drag-handle { cursor: grab; }
.drag-handle:active { cursor: grabbing; }
.comp-table [draggable='true']:focus-visible { outline-offset: -3px; }
.ship-cell.dragging, .ship-cell.is-dragging { opacity: .65; }
.ship-cell.drag-over, .ship-cell.is-drop-target { box-shadow: inset 3px 0 var(--brass); }

.grid { gap: clamp(8px, 1vw, 15px); }
.tile { border-radius: 9px; box-shadow: var(--small-shadow); }
.tile.selected { border-color: var(--sea); box-shadow: 0 0 0 1px var(--sea); }
.tile-img { height: clamp(120px, 11vw, 170px); border-bottom: 1px solid var(--edge); }
.tile-img .ship-art { height: calc(100% - 12px); width: calc(100% - 14px); left: 7px; bottom: 5px; }
.tile-body { border-top: 1px solid var(--glint); }
.tile-name { color: var(--ink); font-size: 23px; }
.specchip {
  border-color: var(--line);
  color: var(--muted);
  background: var(--chip);
}
.tile-add.on, .listitem .addsign.on, .chip.sel {
  border-color: var(--sea);
  color: var(--sea-ink);
  background: var(--sea-light);
}
.detail-image {
  height: clamp(175px, 28vh, 265px);
  border-radius: 7px;
  border: 1px solid var(--edge);
}
.detail-image .ship-art { height: 95%; width: 97%; left: 1.5%; bottom: 2%; }
.field-symbol, .stat-symbol { align-self:center; vertical-align:middle; }
.ship-symbols, .weapons-strip { color: var(--muted); }
.gear-glyph { border: 1px solid var(--edge); background: #293c35; }
@media (hover:hover) and (pointer:fine) {
  .tile:hover { border-color: var(--brass); box-shadow: var(--stack-shadow); }
  .tile-img .ship-art, .ship-card .ship-art { transition: transform .2s ease; }
  .tile-img:hover .ship-art, .ship-link:hover .ship-art { transform: translateY(-2px); }
}

.searchbox, .chip, .pair input, .sel-line select, .sel-line input, .quick-range, .resultshead select {
  border-color: var(--line);
  background-color: var(--surface);
  color: var(--ink);
}
body select option { color: var(--ink); background-color: var(--surface); }
.searchbox .icon, .resultshead, .quick-range { color: var(--muted); }
.chip:hover, .listitem:hover { background: var(--surface-3); }
.searchbox:focus-within { box-shadow: 0 0 0 2px var(--brass); }
.filter-count { background: var(--button-fill); color: var(--button-ink); }
.chip.filter { background: var(--tab-active); color: var(--tab-ink); border-color: var(--edge); }
.tray, .toast {
  background: #273e32;
  color: #fff8df;
  border: 1px solid #8f8b62;
  box-shadow: var(--stack-shadow);
}
.tray .action { color: #2b341e; background: #ddd3a3; }
.tray .action:hover { background: #f3e5b9; }

dialog { color:var(--ink); background: var(--surface); }
dialog::backdrop { background: var(--backdrop); }
.dlg-head, .dlg-foot { border-color: var(--line); }
.dlg-head { background: linear-gradient(110deg,var(--surface),var(--slip)); }
.dlg-foot { background: var(--surface-2); }
.dlg-head .round, .history-row .round { color:var(--muted); }
.detail-summary, .filter-note, .btn-hint, .help, .mutedtext { color:var(--muted); }
.history-row { border-color: var(--line); box-shadow: var(--small-shadow); }
.history-img { overflow:hidden; }
.detail-sec h3, .trait-brief h3, .card-section summary { color:var(--ink); }
.detail-sec h3 { font-weight:600; }
.card-section { border-color: var(--line); }
.card-section > summary { cursor: pointer; }
.radius, .stealth-stat {
  border: 1px solid var(--line);
  background: var(--chart-water);
  color: var(--ink);
}
html[data-theme='dark'] .radius svg { background:#e1e9df; border-radius:4px; }
.stealth-stat button { color: var(--accent); }
#buildDialog .build-editor details { border-color: var(--line); background: var(--surface-2); }
#buildDialog .build-editor .be-input, #buildDialog .build-editor .be-pick, #buildDialog .build-editor .be-res {
  border-color: var(--line); background: var(--surface); color: var(--ink);
}
#buildDialog .build-editor :is(.be-notes,.be-brief) { color:var(--muted); opacity:1; }
#buildDialog .build-editor .be-pick:hover, #buildDialog .build-editor .be-res:hover { border-color:var(--brass); }

.mu select, .mu .mu-ammo button, .mu .mu-swap {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}
.mu .mu-ammo button[aria-pressed=true], .mu .mu-swap:hover {
  background: var(--sea-light); color: var(--sea-ink); border-color: var(--sea);
}
.mu-plates > div { border-color: var(--line); }
.mu-input>span, .mu-plates dt small, .mu-plates dd small, .mu-note, .mu-summary, .mu-empty { color:var(--muted); }
.mu-pass { color:var(--positive); }
.mu-risk, .mu-variable { color:var(--caution); }
.mu-fail, .mu-bounce { color:var(--negative); }
.mu-unknown { color:var(--quiet-ink); }
.fl-harbor { color:var(--ink); }
.fl-harbor-stage { border:1px solid var(--edge); }
.fl-harbor-notes { color:var(--muted); }
.fl-harbor-row button, .fl-harbor-list button {
  color:var(--muted); background:var(--surface); border-color:var(--line);
}
.fl-harbor-row button:hover, .fl-harbor-list button:hover { background:var(--surface-3); }
.fl-harbor-row button.is-active, .fl-harbor-list button.is-active {
  border-color:var(--sea); color:var(--sea-ink); background:var(--sea-light);
}
.fl-harbor-ref a { color:var(--accent); }
.fl-harbor-modes { background:var(--slip); border-color:var(--line); }
.fl-harbor-modes button { color:var(--muted); }
.fl-harbor-modes button.is-active { color:var(--button-ink); background:var(--button-fill); }
.fl-radius-panel { background:var(--surface-2); border-color:var(--line); }
.fl-radius-head { color:#faf2d7; background:linear-gradient(120deg,#294737,#355346); }
.fl-radius-head span { color:#e1e6d3; }
.fl-radius-columns, .fl-radius-difference, .fl-radius-hint { color:var(--muted); }
.fl-radius-item { border-color:var(--line); color:var(--ink); }
.fl-radius-item:hover, .fl-radius-item[aria-pressed=true] { background:var(--sea-light); }
.fl-radius-name::before { border-color:var(--quiet-ink); }

/* Preserve a useful number of data rows under the responsive pinned table header. */
@media(max-width:610px) {
  .heading h1 { font-size:clamp(24px, 5.8vw, 30px); }
  .theme-toggle { min-width:26px; min-height:26px; }
  .comp-table .ship-card { height:clamp(133px, 35vw, 160px); }
  .ship-link { padding:7px; }
  .ship-name { font-size:clamp(15px,4.2vw,19px); }
  .ship-card .ship-art { height:62%; max-height:calc(100% - 47px); width:calc(100% - 6px);left:3px; }
  .tile-img { height:clamp(92px,23.5vw,134px); }
  .tile-name { font-size:19px; }
  .corner-title { font-size:14px; }
  .ship-registry { font-size:10px; }
  .viewtabs button, .quiet { gap:4px; }
  .theme-toggle .icon { width:15px; height:15px; }
}
@media(orientation:landscape) and (max-height:550px) {
  .ship-cell > .ship-symbols { padding:2px 4px; gap:3px 4px; }
  .heading h1 { font-size:20px; }
  .theme-toggle { min-width:24px; min-height:24px; }
  .comp-table .ship-card { height:clamp(80px,21vh,99px); }
  .ship-link { padding:4px 6px; }
  .ship-name { font-size:13px; margin-top:0; }
  .ship-card .ship-art { max-height:calc(100% - 28px); height:62%; width:98%; left:1%; bottom:2px; }
  .corner-title { font-size:12px; }
  .comp-table .band th { padding-top:2px; padding-bottom:2px; }
  .group-toggle { min-height:18px; }
  .detail-image { height:clamp(116px,39vh,180px); }
}
@media(prefers-reduced-motion:reduce) {
  .ship-card .ship-art, .tile-img .ship-art { transition:none; }
  .tile-img:hover .ship-art, .ship-link:hover .ship-art { transform:none; }
}
