:root {
  --ink: #0f172a;
  --quiet: #475569;
  --panel: rgba(255, 255, 255, 0.88);
  --line: rgba(15, 23, 42, 0.12);
  --harbour: #1d5fa8;
  --green: #2fbf71;
  /* Ship families: the same colours as KIND in js/kit.js. */
  --cargo: #2563eb;
  --tanker: #b42318;
  --passenger: #7c3aed;
  --tug: #f97316;
  --service: #eab308;
  --fishing: #0d9488;
  --pleasure: #db2777;
  --other: #64748b;
  font: 14px/1.45 system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #e3edf5; }

.stage { position: fixed; inset: 0; overflow: hidden; }
.stage__canvas { position: absolute; inset: 0; touch-action: none; }
.stage__labels { position: absolute; inset: 0; pointer-events: none; }

.tag {
  position: absolute; left: 0; top: 0;
  padding: 1px 6px 1px 5px; border-radius: 6px;
  border-left: 3px solid var(--kind, var(--other));
  background: rgba(15, 23, 42, 0.8); color: #fff;
  font-size: 11px; font-weight: 600; white-space: nowrap;
  pointer-events: auto; cursor: pointer;
}
.tag--selected { background: var(--harbour); }
.tag--cargo, .kind--cargo { --kind: var(--cargo); }
.tag--tanker, .kind--tanker { --kind: var(--tanker); }
.tag--passenger, .kind--passenger { --kind: var(--passenger); }
.tag--tug, .kind--tug { --kind: var(--tug); }
.tag--service, .kind--service { --kind: var(--service); }
.tag--fishing, .kind--fishing { --kind: var(--fishing); }
.tag--pleasure, .kind--pleasure { --kind: var(--pleasure); }
.tag--other, .kind--other { --kind: var(--other); }

.panel {
  position: absolute; z-index: 1;
  background: var(--panel); backdrop-filter: blur(8px);
  border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.08);
}
.panel--top {
  top: 16px; left: 16px; right: 16px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 10px 16px;
}
.panel--top h1 { margin: 0; font-size: 18px; }
.panel--top h1 span { color: var(--harbour); }

.status { display: inline-flex; align-items: center; gap: 6px; color: var(--quiet); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(47, 191, 113, 0.2); }

.panel--board {
  top: 84px; right: 16px; width: min(380px, calc(100% - 32px));
  max-height: calc(100% - 140px); overflow: auto; padding: 12px 16px;
}
.panel--board h2 { margin: 0 0 6px; font-size: 14px; }
.board__count, .board__empty { margin: 0 0 8px; color: var(--quiet); }
.board__kinds { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.board__kinds small { color: var(--quiet); }
.kind { display: inline-flex; align-items: center; gap: 5px; }
.kind__swatch { width: 10px; height: 10px; border-radius: 3px; background: var(--kind, var(--other)); }
.board__table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.board__table th { text-align: left; font-weight: 600; color: var(--quiet); font-size: 12px; padding: 4px 6px 4px 0; border-bottom: 1px solid var(--line); }
.board__table td { padding: 4px 6px 4px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
.board__table td:first-child { white-space: normal; }
.board__table td:first-child .kind { margin-right: 6px; vertical-align: -1px; }
.board__table tbody tr { cursor: pointer; }
.board__table tbody tr:hover td { background: rgba(29, 95, 168, 0.07); }

.panel--card { left: 16px; top: 84px; width: min(300px, calc(100% - 32px)); padding: 12px 16px 14px; }
.card__head { display: flex; align-items: center; gap: 8px; }
.card__head h2 { margin: 0; font-size: 16px; flex: 1; overflow-wrap: anywhere; }
.card__close { border: 0; background: none; font-size: 20px; line-height: 1; color: var(--quiet); cursor: pointer; padding: 4px; }
.card__facts { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 10px 0 12px; }
.card__facts dt { color: var(--quiet); }
.card__facts dd { margin: 0; font-variant-numeric: tabular-nums; }
.card__follow {
  border: 1px solid var(--harbour); background: #fff; color: var(--harbour);
  border-radius: 8px; padding: 6px 14px; font: inherit; font-weight: 600; cursor: pointer;
}
.card__follow[aria-pressed='true'] { background: var(--harbour); color: #fff; }

.panel--warn { left: 16px; bottom: 56px; max-width: 520px; padding: 12px 16px; margin: 0; }

.credits {
  position: absolute; left: 16px; bottom: 12px; z-index: 1;
  color: var(--quiet); font-size: 12px;
}
.credits a { color: inherit; }

@media (max-width: 640px) {
  .panel--board { top: auto; bottom: 40px; max-height: 38%; }
  .panel--card { top: auto; bottom: 40px; z-index: 2; }
}
