/* Adapt the same collection to a desk, a phone and the Telegram sheet. */
:root {
  --display: var(--ui);
  --paper:#f3f6f6; --page-top:#f9faf8; --surface:#fff; --surface-2:#f7f9f9;
  --surface-3:#eaf1f1; --surface-glass:#fffffff0; --ink:#192e36; --muted:#4e646d;
  --quiet-ink:#61757b; --rule:#e2e9e9; --edge:#c6d3d4; --line:#d4dfe0;
  --key:#f3f7f7; --slip:#edf2f2; --strip:#e2ebeb; --strip-ink:#314e55;
  --brass:#ab8053; --sea:#327976; --sea-ink:#175952; --sea-light:#e1f0ed;
  --tab-active:#e1eeeb; --tab-ink:#18534f; --accent:#266b69; --focus:#ac6a28;
  --button-fill:#215e5b; --button-ink:#fff; --button-hover:#194c4b;
  --hero-ink:#18343c; --hero-muted:#3e5963;
  --stage-top:#f5f7f4; --stage-bottom:#bdd2d5; --mast-bg:#172c34;
  --stack-shadow:0 1px 2px #162f3810; --small-shadow:0 1px 2px #162f380c;
}
html[data-theme='dark'] {
  --paper:#141e23; --page-top:#172329; --surface:#202e34; --surface-2:#1c292f;
  --surface-3:#293d43; --surface-glass:#202f35ee; --ink:#edf3f2; --muted:#b9c8c9;
  --quiet-ink:#9fb2b5; --rule:#304046; --edge:#465d62; --line:#384d53;
  --key:#213137; --slip:#26373d; --strip:#2a4147; --strip-ink:#dbe7e6;
  --brass:#c0a080; --sea:#80bab3; --sea-ink:#c4e8e0; --sea-light:#2d4848;
  --tab-active:#2c4448; --tab-ink:#d5eeea; --accent:#9cd6d0; --focus:#e9bf89;
  --button-fill:#a8d7cd; --button-ink:#142f31; --button-hover:#c0e4db;
  --hero-ink:#f0f5f3; --hero-muted:#c2d8d9;
  --stage-top:#253b42; --stage-bottom:#506b73; --mast-bg:#102027;
}
body { background:var(--paper); }
html .mast, html[data-theme='dark'] .mast {
  background:var(--mast-bg); box-shadow:inset 0 -1px #ffffff1f;
  padding-top:max(env(safe-area-inset-top,0px),var(--app-safe-top,0px));
}
.nav.active::after {background:#9cd0c5}
.identity { flex-shrink:0; border-radius:3px }
.identity img#brand {display:block; object-position:left center}
.heading h1,.ship-name,.tile-name,.dlg-head h2,.corner-title {
  font-family:var(--ui); letter-spacing:-.035em; font-weight:650;
}
.heading h1 {font-size:clamp(25px,2.6vw,38px); line-height:1.12; margin:0}
.heading {gap:10px}
.heading > :first-child,.kv > *,.tile-body,.detail-summary {min-width:0}
.heading .action {flex:none}
.board,.tile,.detail-image,.history-row {border-color:var(--edge)}
.comp-table .corner,html[data-theme='dark'] .comp-table .corner {
  background:var(--strip); color:var(--strip-ink); box-shadow:none;
}
.corner-title,.corner small {color:var(--strip-ink)}
.comp-table .ship-card,.tile-img,.detail-image,.history-img,.listitem .thumb {
  background:radial-gradient(ellipse at 72% 47%,#fff2,transparent 67%),linear-gradient(177deg,var(--stage-top) 0%,var(--stage-bottom) 100%);
}
.ship-card::before,.tile-img::before,.detail-image::before {display:none}
.comp-table .ship-card {box-shadow:inset 0 -1px var(--edge);height:clamp(179px,15.3vw,218px)}
.ship-cell .ship-link {
  display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:auto auto auto minmax(0,1fr);
  align-items:start;justify-items:start;gap:1px;padding:9px 12px 7px;
}
.ship-link .ship-meta {max-width:100%;min-height:18px}
.ship-link .ship-name {max-width:100%;line-height:1.12;margin:3px 0 1px;overflow-wrap:break-word;text-wrap:pretty}
.ship-link .ship-art {
  position:static;align-self:stretch;justify-self:center;width:100%;height:100%;max-height:100%;
  min-height:0;min-width:0;object-fit:contain;object-position:center 62%;
}
.ship-card .country {line-height:1.3}
.ship-card .ship-name,.ship-card .country {position:relative}
.ship-card .ship-tools {align-items:center;right:5px;top:5px}
.ship-cell > .ship-symbols {min-height:33px;align-content:center;background:var(--surface-2)}
.comp-table .metric-heading {padding:0}
.metric-sort {
  display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:6px;align-items:center;
  box-sizing:border-box;width:100%;min-height:37px;padding:5px 9px;color:inherit;background:transparent;
  font:inherit;line-height:1.25;text-align:start;cursor:pointer;
}
.metric-sort .stat-symbol {--stat-size:14px;color:var(--muted)}
.metric-sort .metric-label {min-width:0;overflow-wrap:break-word;hyphens:auto}
.sort-direction {color:var(--quiet-ink);font-size:12px;font-weight:550}
.metric-heading[aria-sort] .metric-sort {
  color:var(--sea-ink);font-weight:680;background:var(--sea-light);box-shadow:inset 3px 0 var(--sea);
}
.metric-heading[aria-sort] .sort-direction {color:var(--sea-ink);font-weight:800}
@media (hover:hover) {.metric-sort:hover {background:var(--sea-light);color:var(--sea-ink)}}
.comp-table .metric-sort:focus-visible {outline-offset:-3px}
.group-toggle .icon {margin-right:0}
.group-toggle {min-height:25px;gap:5px;line-height:1.2}
.value {font-variant-numeric:tabular-nums}
.metric {column-gap:8px;row-gap:3px}
.metric .track {flex-shrink:1}
.kv b,.kv span,.detail-summary,.detail-note,.listitem .ship-name,.tile-name,.history-row strong {
  overflow-wrap:break-word;hyphens:auto
}
.tile-name {line-height:1.15}
.tray {background:var(--mast-bg);color:#f5f6f4}
.mast nav .nav {white-space:nowrap}
footer {gap:8px;flex-wrap:wrap}
html[data-telegram] {--tg-height:var(--tg-viewport-stable-height,100dvh)}
html[data-telegram] dialog {max-height:calc(var(--tg-height) - var(--app-safe-top,0px) - var(--app-safe-bottom,0px) - 10px)}
html[data-telegram] .scroller {max-height:max(150px,calc(var(--tg-height) - var(--app-safe-top,0px) - var(--app-safe-bottom,0px) - 192px))}
html[data-telegram] :is(.mast-inner,main,footer) {
  padding-left:max(var(--app-padding,14px),var(--app-safe-left,0px),env(safe-area-inset-left));
  padding-right:max(var(--app-padding,14px),var(--app-safe-right,0px),env(safe-area-inset-right))
}
footer {padding-bottom:max(12px,var(--app-safe-bottom,0px),env(safe-area-inset-bottom))}
@media(max-width:610px) {
  .heading h1 {font-size:clamp(21px,5.55vw,28px)}
  .mast-inner {gap:6px}
  .mast nav {margin-left:0;gap:clamp(3px,1.4vw,8px)}
  .identity img#brand {width:clamp(66px,19vw,90px);height:36px}
  .nav {font-size:clamp(10px,2.8vw,12px)}
  main, footer {padding-inline:8px}
  .ship-cell .ship-link {padding:5px 6px 15px;gap:0}
  .ship-link .ship-meta {min-height:17px}
  .comp-table .ship-card {height:clamp(133px,35vw,151px)}
  .ship-link .ship-name {font-size:clamp(14px,3.9vw,18px);margin:2px 0}
  .ship-cell > .ship-symbols {min-height:24px;align-content:flex-start}
  .comp-table .metric-heading {padding:0}
  .metric-sort {min-height:38px;grid-template-columns:minmax(0,1fr) auto;gap:2px;padding:5px 5px;font-size:11px;line-height:1.25}
  .metric-sort .stat-symbol {display:none}
  .sort-direction {font-size:10px}
  .comp-table .sticky[scope='row'] {overflow-wrap:break-word}
  .metric .track {display:none}
  .group-toggle .band-title {hyphens:auto;overflow-wrap:break-word}
  .comp-table td .value {padding:2px 4px;font-size:12px}
  html[data-telegram] {--app-padding:8px}
  html[data-telegram] .scroller {max-height:calc(var(--tg-height) - var(--app-safe-top,0px) - var(--app-safe-bottom,0px) - 157px)}
}
@media(max-width:360px) {
  .mast-inner {padding-inline:6px;gap:3px}
  .mast .nav .icon {display:none}
  .viewtabs button {padding-inline:3px}
  .heading .action {padding-inline:7px}
}
@media(orientation:landscape) and (max-height:550px) {
  .heading h1 {font-size:20px}
  .comp-table .ship-card {height:clamp(79px,22vh,105px)}
  .ship-cell .ship-link {grid-template-rows:auto auto minmax(0,1fr);padding:2px 6px 12px;gap:0}
  .ship-link .ship-meta {min-height:14px}
  .ship-cell .ship-name {font-size:13px;line-height:1.08;margin:0}
  .metric-sort,.group-toggle {min-height:23px}
  .metric-sort {padding-block:2px}
  .ship-cell > .ship-symbols {min-height:21px}
  html[data-telegram] .scroller {max-height:max(120px,calc(var(--tg-height) - var(--app-safe-top,0px) - var(--app-safe-bottom,0px) - 122px))}
}

@media (min-width:611px) and (max-width:885px) {
  .mast-inner {gap:clamp(12px,2.4vw,21px)}
  .mast nav {gap:clamp(7px,1.6vw,15px)}
  .dataset-date {display:none}
}

.comp-table .corner-hint {display:block;max-width:17ch;margin-top:9px;font-size:11px;line-height:1.35;font-weight:450;color:var(--muted)}
@media(max-width:610px){.comp-table .corner-hint{font-size:10px;margin-top:5px}}
@media(orientation:landscape) and (max-height:550px){.comp-table .corner-hint{display:none}}
