/* Last Signal Fleet hangar. Brand B "Hull Stencil": Big Shoulders Stencil Display for display type, Instrument Sans
   for text and labels, Coalition Navy on gunmetal, crimson for the enemy and warnings only. */
@font-face { font-family: "Big Shoulders Stencil Display"; src: url("/fonts/BigShouldersStencilDisplay.ttf"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Instrument Sans"; src: url("/fonts/InstrumentSans.ttf"); font-weight: 400 700; font-stretch: 75% 100%; font-display: swap; }

:root {
  --navy: #1c3f94; --navy-text: #7b99d8; --plate: #e8e9e6; --ink: #191c21; --gunmetal: #16191e; --steel: #707378;
  --white: #f2f3f5; --muted: #9ea3aa; --crimson: #c8202f; --crimson-text: #fb8c86; --tier: #9aa4b2;
  --panel: rgba(22, 25, 30, 0.86); --line: rgba(232, 233, 230, 0.14);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--gunmetal); color: var(--white); overflow: hidden;
  font-family: "Instrument Sans", system-ui, sans-serif; font-feature-settings: "tnum"; }
#scene { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
#labels { position: fixed; inset: 0; pointer-events: none; }
button, input { font: inherit; color: inherit; }

.display { font-family: "Big Shoulders Stencil Display", sans-serif; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; }
.label, .tabs button, .tool, .strip, .tier, h2, .specs dt, .odds, .dim { font-weight: 600; text-transform: uppercase; letter-spacing: 0.14em; }

/* ── top bar ── */
.top { position: fixed; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 20px; padding: 14px 20px;
  background: linear-gradient(180deg, rgba(22,25,30,.95), rgba(22,25,30,0)); z-index: 3; }
.brand img { height: 30px; display: block; }
.tabs { display: flex; gap: 2px; background: var(--ink); padding: 3px; border: 1px solid var(--line); }
.tabs button { background: none; border: 0; padding: 8px 14px; font-size: 12px; color: var(--muted); cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--navy); color: var(--plate); }
.tabs button[data-tab="threat"][aria-selected="true"] { background: var(--crimson); }
#lookup { margin-left: auto; display: flex; align-items: center; background: var(--ink); border: 1px solid var(--line); }
#lookup .at { padding: 0 2px 0 12px; color: var(--muted); }
#lookup input { background: none; border: 0; outline: none; padding: 10px 8px; width: 220px; }
#lookup button { background: var(--navy); border: 0; padding: 10px 16px; font-weight: 600; cursor: pointer; text-transform: uppercase; letter-spacing: .1em; font-size: 13px; }
#lookup button:hover { filter: brightness(1.15); }

/* ── class / rank picker ── */
.picker { position: fixed; top: 74px; left: 20px; right: 20px; display: flex; gap: 8px; flex-wrap: wrap; z-index: 3; }
.picker button { background: var(--panel); border: 1px solid var(--line); padding: 8px 12px; font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; cursor: pointer; display: flex; align-items: center; gap: 8px; }
.picker button i { width: 9px; height: 9px; display: inline-block; background: var(--c, var(--steel)); }
.picker button[aria-pressed="true"] { border-color: var(--c, var(--plate)); background: var(--ink); }

.status { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); background: var(--panel); border-left: 4px solid var(--navy); padding: 14px 18px; z-index: 3; max-width: 90vw; }

/* ── ship card ── */
.card { position: fixed; left: 20px; top: 128px; width: 360px; max-height: calc(100vh - 150px); overflow: auto; background: var(--panel);
  border: 1px solid var(--line); padding: 18px 20px 20px; z-index: 2; backdrop-filter: blur(6px); }
.strip { display: flex; justify-content: space-between; font-size: 10px; color: var(--steel); padding-bottom: 10px; border-bottom: 2px solid var(--white); margin-bottom: 14px; }
.tier { font-size: 12px; color: var(--tier); display: flex; align-items: center; gap: 8px; }
.tier::before { content: ""; width: 10px; height: 10px; background: var(--tier); }
.card h1 { font-family: "Big Shoulders Stencil Display", sans-serif; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; font-size: 46px; line-height: .95; margin: 8px 0 6px; }
.sub { color: var(--muted); font-size: 14px; }
.sub b { color: var(--white); font-weight: 600; }
.specs { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); margin: 16px 0; }
.specs div { background: var(--ink); padding: 8px 10px; }
.specs div:nth-child(4):last-child { grid-column: span 3; }
.specs dt { font-size: 10px; color: var(--muted); }
.specs dd { margin: 2px 0 0; font-size: 20px; font-weight: 600; }
.specs dd small { font-size: 12px; color: var(--muted); font-weight: 500; }
.card h2 { font-size: 11px; color: var(--navy-text); margin: 4px 0 6px; }
.threat .card h2 { color: var(--crimson-text); }
.weapons { list-style: none; padding: 0; margin: 0 0 12px; }
.weapons li { padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.blurb { color: var(--muted); font-size: 14px; line-height: 1.45; margin: 10px 0; }
.verify { border-top: 1px solid var(--line); padding-top: 10px; font-size: 13px; color: var(--muted); }
.verify summary { cursor: pointer; color: var(--white); font-weight: 600; }
.verify code { color: var(--white); word-break: break-all; }
.odds { font-size: 10px; }
.follow { display: block; margin-top: 14px; text-align: center; background: var(--navy); color: var(--plate); text-decoration: none; padding: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; font-size: 13px; }
.threat .follow { background: var(--ink); border: 1px solid var(--line); }

/* ── ship systems (moving parts) ── */
.systems { margin: 4px 0 14px; border: 1px solid var(--line); padding: 8px 10px; }
.systems summary { cursor: pointer; list-style: none; }
.systems summary h2 { display: inline; margin: 0; }
.systems summary::after { content: " +"; color: var(--navy-text); font-weight: 700; }
.systems[open] summary::after { content: " −"; }
#rigCount { color: var(--muted); }
.systems .slider { margin: 8px 0; }
.systems label { display: flex; justify-content: space-between; font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.systems label .val { color: var(--plate); font-feature-settings: "tnum"; }
.systems input[type=range] { width: 100%; accent-color: var(--navy-text); height: 28px; }
.threat .systems input[type=range] { accent-color: var(--crimson-text); }
.ghost { background: none; border: 1px solid var(--line); color: var(--muted); padding: 6px 10px; font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; cursor: pointer; }
.handle { display: none; }

/* ── tools ── */
.tools { position: fixed; right: 20px; bottom: 20px; display: flex; gap: 6px; z-index: 2; flex-wrap: wrap; justify-content: flex-end; }
.tool { background: var(--panel); border: 1px solid var(--line); padding: 9px 12px; font-size: 11px; cursor: pointer; }
.tool[aria-pressed="true"] { border-color: var(--navy-text); color: var(--plate); }
.tool[aria-pressed="false"] { color: var(--muted); }

/* ── dimension labels (CSS2D) ── */
.dim { background: var(--ink); border: 1px solid var(--plate); color: var(--plate); font-size: 12px; padding: 3px 7px; white-space: nowrap; }
.dim small { color: var(--muted); margin-right: 6px; }
.dim.crew { border-color: var(--navy-text); color: var(--navy-text); }
.threat .dim { border-color: var(--crimson-text); }

/* ── phones: the card is a bottom sheet, collapsed to its summary until the handle is pulled ── */
@media (max-width: 760px) {
  .top { flex-wrap: wrap; gap: 8px; padding: 10px 12px 6px; }
  .brand img { height: 22px; }
  .tabs { order: 3; width: 100%; }
  .tabs button { flex: 1; padding: 9px 6px; }
  #lookup { margin-left: auto; min-width: 0; flex: 1; max-width: 250px; }
  #lookup input { width: 100%; min-width: 0; font-size: 16px; padding: 9px 6px; }
  #lookup button { padding: 10px 12px; font-size: 12px; white-space: nowrap; }
  #lookup button .long { display: none; }
  .picker { top: 118px; left: 12px; right: 12px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .picker::-webkit-scrollbar { display: none; }
  .picker button { flex: none; padding: 8px 10px; }
  .card { left: 0; right: 0; top: auto; bottom: 0; width: auto; border-left: 0; border-right: 0; border-bottom: 0;
    padding: 6px 16px calc(16px + env(safe-area-inset-bottom)); max-height: var(--sheet-closed, 236px); overflow: hidden; transition: max-height .25s ease; }
  .card.open { max-height: 74vh; overflow: auto; }
  .card.open ~ .tools { display: none; }
  .handle { display: block; width: 100%; background: none; border: 0; padding: 4px 0 10px; cursor: pointer; }
  .handle span { display: block; width: 44px; height: 5px; margin: 0 auto; background: var(--steel); border-radius: 3px; }
  .strip { margin-bottom: 10px; padding-bottom: 8px; }
  .card h1 { font-size: 34px; margin: 4px 0 4px; }
  .specs { margin: 10px 0; }
  .specs dd { font-size: 17px; }
  .tools { left: 12px; right: 12px; bottom: calc(var(--sheet-closed, 236px) + 10px); justify-content: center; gap: 5px; }
  .tool { padding: 8px 8px; font-size: 10px; letter-spacing: .08em; }
  .dim { font-size: 10px; padding: 2px 5px; }
  .dim small { margin-right: 4px; }
}
@media (max-width: 370px) {
  .tools .tool#tView { display: none; }
  .card h1 { font-size: 30px; }
}
