@font-face {
  font-family: Space;
  src: url(./space-grotesk-latin-500-normal.woff2);
}
@font-face {
  font-family: Space;
  src: url(./space-grotesk-latin-700-normal.woff2);
  font-weight: 700;
}
@font-face {
  font-family: Unbounded;
  src: url(./unbounded-latin-800-normal.woff2);
  font-weight: 800;
}
:root {
  --ink: #14272b;
  --paper: #fff2d6;
  --red: #bd301e;
  --blue: #265e73;
  --sea: #a4d9cc;
  --rule: #bcb79e;
  --side: max(24px, env(safe-area-inset-left));
  font:
    500 15px/1.4 Space,
    system-ui,
    sans-serif;
  color: var(--ink);
  background: var(--ink);
}
* {
  box-sizing: border-box;
}
body,
h1,
h2,
h3,
p,
figure,
dl,
dd {
  margin: 0;
}
[hidden] {
  display: none !important;
}
button,
select {
  font:
    700 15px Space,
    system-ui;
  color: var(--ink);
  cursor: pointer;
  background: var(--paper);
  border: 1px solid var(--ink);
  border-radius: 8px;
  height: 48px;
  padding: 0 16px;
}
button:hover,
select:hover {
  background: #f0e0bb;
}
button:active {
  transform: translateY(1px);
}
:focus-visible {
  outline: 3px solid #1d9d9a;
  outline-offset: 3px;
}
button:disabled {
  cursor: wait;
  opacity: 0.65;
}
button.primary {
  background: var(--red);
  color: #fff6df;
  border-color: var(--red);
}
button.primary:hover {
  background: #a42419;
}
small,
figcaption,
footer,
kbd,
.mast span,
.team-sheet th {
  font:
    700 11px/1.35 Space,
    system-ui;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.wordmark,
h1,
h2,
h3,
.instrument b {
  font-family: Unbounded, system-ui;
  font-weight: 800;
}
.wordmark {
  letter-spacing: -0.055em;
  font-size: 24px;
  line-height: 1;
}
#lobby {
  position: relative;
  z-index: 4;
  min-height: 100dvh;
  background: var(--paper);
  padding: 0 clamp(16px, 4vw, 64px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.mast,
footer,
.panel-head,
figcaption,
.setting,
.keys > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.mast {
  min-height: 72px;
  border-bottom: 2px solid var(--ink);
}
.mast .wordmark,
.panel-head .wordmark {
  color: var(--red);
}
.boarding {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
  width: 100%;
  max-width: 1440px;
  align-self: center;
  padding: 24px 0;
}
.brief {
  display: grid;
  gap: 16px;
  justify-items: start;
}
.brief small,
.panel-body > small {
  color: var(--red);
}
h1 {
  font-size: clamp(52px, 7.1vw, 116px);
  line-height: 0.91;
  letter-spacing: -0.085em;
  text-transform: uppercase;
}
h1 em {
  font-style: normal;
  color: var(--red);
}
.brief p,
#pause-view p {
  max-width: 39ch;
}
.teams,
.menu-actions {
  display: grid;
  gap: 8px;
  width: min(100%, 400px);
}
.teams button {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.teams button span {
  font-size: 20px;
}
.cover {
  border: 2px solid var(--ink);
  border-radius: 16px;
  overflow: hidden;
  background: var(--ink);
  color: var(--paper);
}
.cover img {
  display: block;
  width: 100%;
  height: clamp(240px, 54vh, 600px);
  object-fit: cover;
  object-position: center 44%;
}
figcaption {
  padding: 12px 16px;
}
.cover figcaption span {
  color: var(--sea);
}
footer {
  border-top: 1px solid var(--rule);
  padding: 16px 0;
  gap: 16px;
  color: #3f5351;
}
footer span:last-child {
  text-align: right;
}
#loading {
  width: min(100%, 400px);
}
progress {
  display: block;
  width: 100%;
  height: 8px;
  accent-color: var(--red);
}
#status {
  margin-top: 4px;
  font-size: 13px;
}
#canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  outline: 0;
  background: var(--ink);
}
#rescue-hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  color: var(--paper);
  font-variant-numeric: tabular-nums;
}
.instrument,
#hint,
#pickup-note,
#gear-strip,
#open-menu,
#respawn {
  background: #15292df2;
  color: var(--paper);
  border: 1px solid #80958a;
  border-radius: 8px;
}
.instrument {
  position: absolute;
  padding: 8px 12px;
}
.instrument small,
#respawn small {
  display: block;
  color: #d1d8c6;
}
.instrument b {
  font-size: 22px;
  line-height: 1.15;
  letter-spacing: -0.05em;
}
.instrument strong {
  font-size: 15px;
}
.mission {
  left: var(--side);
  top: 24px;
  max-width: min(55vw, 420px);
  border-left: 4px solid #fa8669;
}
.mission small {
  color: #ffb197;
}
[data-team="blue"] .mission {
  border-left-color: var(--sea);
}
[data-team="blue"] .mission small {
  color: var(--sea);
}
.goal-line,
.vitals,
.loadout,
.tally {
  display: flex;
  align-items: center;
  gap: 12px;
}
.goal-line {
  gap: 8px;
}
#bearing {
  color: #ffca64;
  font-size: 20px;
  line-height: 1;
}
.tally {
  top: 24px;
  right: var(--side);
  height: 56px;
  text-align: center;
  pointer-events: auto;
}
.tally:hover,
#open-menu:hover {
  background: #294144;
}
.tally i {
  font-style: normal;
  color: #92aaa2;
}
.tally span:first-child b {
  color: #ffab91;
}
.tally span:last-child b {
  color: var(--sea);
}
.vitals,
.loadout {
  bottom: 24px;
}
.vitals {
  left: var(--side);
  gap: 24px;
}
.loadout {
  right: var(--side);
  max-width: 52vw;
}
.loadout span:last-child {
  border-left: 1px solid #657b74;
  padding-left: 12px;
}
.loadout strong {
  display: block;
}
#pickup-note,
#gear-strip {
  position: absolute;
  left: var(--side);
  bottom: 88px;
  padding: 8px 12px;
  font-size: 13px;
}
#gear-strip {
  left: auto;
  right: var(--side);
  max-width: 50vw;
  display: flex;
  gap: 8px;
}
#gear-strip span {
  color: #c3d3ca;
}
#gear-strip .selected {
  color: #ffd386;
  font-weight: 700;
  text-decoration: underline;
}
.aim {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 28px;
  height: 28px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.aim i,
.aim b {
  position: absolute;
  border: 1px solid #0a1418;
  background: #fff9de;
  border-radius: 4px;
}
.aim i:nth-child(1),
.aim i:nth-child(2) {
  width: 4px;
  height: 9px;
  left: 12px;
}
.aim i:nth-child(1) {
  top: 0;
}
.aim i:nth-child(2) {
  bottom: 0;
}
.aim i:nth-child(3),
.aim i:nth-child(4) {
  width: 9px;
  height: 4px;
  top: 12px;
}
.aim i:nth-child(3) {
  left: 0;
}
.aim i:nth-child(4) {
  right: 0;
}
.aim b {
  width: 4px;
  height: 4px;
  top: 12px;
  left: 12px;
  background: #fff;
}
#open-menu {
  position: fixed;
  right: var(--side);
  top: 88px;
  height: 44px;
  font-size: 13px;
}
kbd {
  margin-left: 4px;
  color: #d5e0d5;
}
#hint {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  padding: 8px 12px;
  font-size: 13px;
  text-align: center;
  pointer-events: none;
}
#overlay {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 16px;
  background: #0c191fc7;
}
#match-panel {
  width: min(100%, 680px);
  max-height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 16px;
  box-shadow: 0 12px 48px #00131566;
}
.panel-head {
  padding: 12px 24px;
  border-bottom: 1px solid var(--rule);
}
.panel-head .wordmark {
  font-size: 20px;
}
.panel-head button {
  height: 44px;
}
.panel-body {
  overflow: auto;
  overscroll-behavior: contain;
  padding: 24px;
}
.panel-body h2 {
  font-size: clamp(24px, 4vw, 40px);
  line-height: 1.12;
  letter-spacing: -0.035em;
  margin: 4px 0 16px;
}
#pause-view,
#controls-view,
#score-view {
  display: grid;
  gap: 16px;
}
.menu-actions {
  width: 100%;
  grid-template-columns: 1fr 1fr;
}
.keys,
.team-sheet {
  border: 1px solid var(--rule);
  border-radius: 8px;
}
.keys > div,
.setting {
  gap: 16px;
  padding: 8px 12px;
}
.keys > div + div {
  border-top: 1px solid var(--rule);
}
.keys dd {
  text-align: right;
  font-weight: 700;
}
.setting {
  padding: 0;
}
.setting select {
  min-width: 140px;
}
.keys dt,
.keys dd {
  font-size: 13px;
}
#board-teams {
  display: grid;
  gap: 16px;
}
.team-sheet {
  overflow: hidden;
  background: #fff9e9;
}
.team-sheet header {
  padding: 8px 12px;
  color: #fff2d6;
  background: var(--red);
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}
.team-sheet.chef header {
  background: var(--blue);
}
h3 {
  font-size: 15px;
  letter-spacing: -0.04em;
}
.team-sheet header b {
  font: 800 20px Unbounded;
}
.team-sheet table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.team-sheet th,
.team-sheet td {
  text-align: right;
  padding: 8px 4px;
}
.team-sheet th:first-child,
.team-sheet td:first-child {
  text-align: left;
  width: 43%;
  padding-left: 12px;
}
.team-sheet th:last-child,
.team-sheet td:last-child {
  padding-right: 12px;
}
.team-sheet td {
  border-top: 1px solid #e1dac8;
}
.team-sheet td:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.team-sheet tr.mine {
  background: #f8e8bd;
  font-weight: 700;
}
.team-sheet td[colspan] {
  width: auto;
}
.you {
  color: #774227;
  font-size: 11px;
  margin-left: 4px;
}
#board-status:empty {
  display: none;
}
#respawn {
  position: fixed;
  left: 50%;
  top: 62%;
  transform: translate(-50%, -50%);
  padding: 12px 16px;
  text-align: center;
  pointer-events: none;
}
#respawn strong,
#respawn span {
  display: block;
}
#respawn strong {
  font-size: 20px;
}
#respawn span {
  font-size: 13px;
}
#fault {
  position: fixed;
  z-index: 8;
  bottom: 16px;
  left: 16px;
  right: 16px;
  padding: 16px;
  border-radius: 8px;
  background: #762e2b;
  color: white;
}
body.panel-open #rescue-hud,
body.panel-open #open-menu,
body.panel-open #respawn,
body.panel-open #hint {
  visibility: hidden;
}
@media (max-width: 700px) {
  :root {
    --side: max(16px, env(safe-area-inset-left));
  }
  .boarding {
    gap: 24px;
    grid-template-columns: 1fr;
  }
  .cover {
    grid-row: 1;
  }
  .cover img {
    height: clamp(128px, 22vh, 192px);
    object-fit: contain;
    background: #48757c;
  }
  .mast {
    min-height: 56px;
  }
  .brief {
    gap: 12px;
  }
  h1 {
    font-size: 48px;
  }
  h1 br {
    display: none;
  }
  h1 em {
    margin-left: 12px;
  }
  .teams {
    width: 100%;
  }
  .mission,
  .tally {
    top: 16px;
  }
  .vitals,
  .loadout {
    bottom: 16px;
  }
  .mission {
    max-width: 56vw;
  }
  .mission strong {
    font-size: 13px;
  }
  .tally {
    gap: 8px;
  }
  #open-menu {
    top: 80px;
  }
  #hint {
    bottom: 84px;
    max-width: 50vw;
  }
  #pickup-note {
    bottom: 124px;
  }
  #gear-strip {
    bottom: 124px;
  }
  .panel-body,
  .panel-head {
    padding: 16px;
  }
  .team-sheet th {
    letter-spacing: 0;
  }
  .instrument b {
    font-size: 20px;
  }
  .menu-actions {
    grid-template-columns: 1fr;
  }
}
#radio-view {
  display: grid;
  gap: 12px;
}
#radio-input {
  width: 100%;
  height: 48px;
  font: inherit;
  background: #fff9e9;
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 0 12px;
}
#radio-history {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 144px;
  overflow: auto;
  overflow-wrap: anywhere;
}
#radio-history:empty {
  display: none;
}
#radio-history li {
  padding: 8px 0;
  border-bottom: 1px solid var(--rule);
}
#radio-note {
  position: absolute;
  left: var(--side);
  top: 92px;
  max-width: min(56vw, 420px);
  overflow-wrap: anywhere;
  padding: 8px 12px;
  border-radius: 8px;
  background: #15292df2;
  color: var(--paper);
  font-size: 13px;
}
.menu-actions:has(#resume) .primary {
  grid-column: 1/-1;
}
#fault {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

#lobby.boarding-again { z-index: 6; }
footer .credits { position: relative; }
.credits summary { cursor: pointer; min-height: 44px; padding: 12px 0 12px 8px; }
.credits p {
  position: absolute;
  bottom: 100%;
  right: 0;
  width: min(260px, 75vw);
  margin: 0 0 8px;
  padding: 12px;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid currentColor;
  border-radius: 8px;
  font: 500 13px/1.4 Space, sans-serif;
  letter-spacing: normal;
  text-transform: none;
  z-index: 1;
}

.room-links { display: flex; align-items: center; gap: 16px; margin-top: 12px; }
.room-links button, .back-harbor { display:inline-flex; align-items:center; height:44px; font:700 14px/1.3 Space,sans-serif; color:var(--ink); }
.room-links button { background:transparent; }
#friend-invite { width:min(400px,calc(100% - 32px)); border:2px solid var(--ink); border-radius:12px; padding:24px; background:var(--paper); color:var(--ink); }
#friend-invite::backdrop { background:#102126ba; }
#friend-invite form { display:grid; gap:16px; }
#friend-invite h2, #friend-invite p { margin:0; }
#friend-invite h2 { font:800 22px/1.2 Unbounded,sans-serif; }
#invite-url { min-width:0; width:100%; height:44px; padding:0 12px; border:1px solid var(--ink); border-radius:4px; }
#friend-invite form div {display:flex;gap:12px;}
