:root {
  color-scheme: dark;
  --bg: #071f2a;
  --sea: #133f48;
  --paper: #f4ecd7;
  --ink: #16373a;
  --dim: #496366;
  --amber: #ffe198;
  --copper: #9c5129;
  --edge: #bcbca3;
  --mono: ui-monospace, "Courier New", monospace;
  font:
    16px/1.5 "Trebuchet MS",
    Arial,
    sans-serif;
  color: var(--paper);
  background: var(--bg);
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
  min-height: 100svh;
  background:
    radial-gradient(ellipse at 14% 18%, #164653 0, transparent 51%), var(--bg);
}
main {
  max-width: 1450px;
  margin: auto;
  padding: 10px clamp(12px, 2.8vw, 38px) 22px;
}
header,
.instruments,
.actions,
.crew-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
header {
  min-height: 47px;
  gap: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid #507074;
  margin-bottom: 14px;
}
header span,
.over,
.instruments span,
.fine,
.course,
h3,
summary {
  font-family: var(--mono);
}
header span {
  margin-left: auto;
  font-size: 0.67rem;
  letter-spacing: 0.12em;
  color: #b4ccc4;
}
.brand {
  font:
    bold 1.02rem Georgia,
    serif;
  letter-spacing: 0.07em;
  color: var(--amber);
  text-decoration: none;
}
button {
  font: inherit;
  font-weight: 700;
  font-size: 0.92rem;
  min-height: 44px;
  background: #fff5de;
  color: var(--ink);
  border: 1px solid #476461;
  border-radius: 4px;
  padding: 7px 12px;
  cursor: pointer;
}
header button {
  background: none;
  color: var(--paper);
  border-color: #547173;
}
button:disabled {
  opacity: 0.55;
  cursor: default;
}
button:focus-visible,
a:focus-visible,
summary:focus-visible,
#stage:focus-visible {
  outline: 3px solid #edac48;
  outline-offset: 3px;
}
.primary {
  background: #17564f;
  color: #fff2cc;
  border-color: #17564f;
}
.shell {
  display: grid;
  grid-template-columns: minmax(0, 2.4fr) minmax(270px, 0.95fr);
  align-items: start;
  gap: clamp(12px, 2.2vw, 28px);
}
.viewport {
  min-width: 0;
}
.instruments {
  min-height: 37px;
  flex-wrap: wrap;
  color: #d6e4d9;
}
.instruments b {
  font:
    italic bold 1.1rem Georgia,
    serif;
  margin-right: auto;
  color: var(--amber);
}
.instruments span,
.course {
  font-size: 0.73rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.035em;
}
#air[data-low="true"] {
  color: #ffc093;
}
#stage {
  position: relative;
  height: clamp(330px, 65svh, 710px);
  overflow: hidden;
  background: #237a81;
  border: 1px solid #658d8b;
  border-radius: 4px;
  touch-action: none;
  overscroll-behavior: contain;
  user-select: none;
  -webkit-user-select: none;
}
#stage {
  background: #276971 url("./harbor.webp") center / cover no-repeat;
}
body:not(.dive) #stage canvas {
  visibility: hidden;
}
#stage canvas {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
#loading {
  position: absolute;
  z-index: 2;
  left: 10px;
  top: 10px;
  margin: 0;
  padding: 5px 10px;
  background: #0a3039ed;
  color: #fff0bd;
  border-radius: 2px;
  pointer-events: none;
}

#relic-tag {
  position: absolute;
  z-index: 2;
  pointer-events: none;
  transform: translate(-50%, -100%);
  font: bold 0.7rem var(--mono);
  background: #382d19ed;
  color: #ffebae;
  border-bottom: 2px solid #fac775;
  border-radius: 3px;
  padding: 3px 6px;
  white-space: nowrap;
}
.course {
  color: #bed8d1;
  margin: 8px 0;
}
.touch {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}
.vertical,
#stick {
  position: absolute;
  bottom: 12px;
  pointer-events: auto;
}
.vertical {
  right: 10px;
  display: grid;
  gap: 4px;
}
.vertical button {
  font: 700 0.74rem var(--mono);
  background: #123f46de;
  color: white;
  border-color: #a2c6b6;
  touch-action: none;
}
.vertical button.active {
  background: #d9be7b;
  color: var(--ink);
}
#stick {
  left: 12px;
  width: 88px;
  height: 88px;
  border: 1px solid #cfe0d2;
  border-radius: 50%;
  background: #113940aa;
  display: grid;
  place-items: center;
  touch-action: none;
}
#stick span {
  display: grid;
  place-items: center;
  border-radius: 50%;
  width: 46px;
  height: 46px;
  background: #8cae9bb0;
  color: white;
  font: 700 0.66rem var(--mono);
  pointer-events: none;
}
.notes {
  padding: clamp(16px, 2.25vw, 31px);
}
aside {
  background: var(--paper);
  color: var(--ink);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 4px 0 #081b20;
  margin-top: 4px;
}
.selvedge {
  height: 8px;
  background: repeating-linear-gradient(
    110deg,
    #b76c42 0 14px,
    #e1c28a 14px 21px,
    #376d66 21px 35px,
    #e1c28a 35px 42px
  );
}
h1,
h2,
p {
  margin: 0 0 10px;
}
h1,
h2 {
  font-family: Georgia, serif;
  line-height: 1.02;
  letter-spacing: -0.05em;
}
h1 {
  font-size: clamp(3.2rem, 6vw, 5.4rem);
  margin-bottom: 16px;
}
h1 em {
  color: var(--copper);
}
h2 {
  font-size: clamp(1.65rem, 2.8vw, 2.65rem);
}
h3 {
  font-size: 0.84rem;
  margin: 16px 0 4px;
}
.over {
  color: #76512d;
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.09em;
}
.lede {
  font-weight: bold;
  font-size: 1.12rem;
}
.fine {
  font-size: 0.76rem;
  color: var(--dim);
}
.actions {
  gap: 7px;
  flex-wrap: wrap;
  margin: 12px 0;
}
.utility {
  border-top: 1px dashed var(--edge);
  padding-top: 12px;
}
ul {
  list-style: none;
  padding: 0;
}
.crew-row {
  border-block-start: 1px solid var(--edge);
  justify-content: space-between;
  padding: 6px 0;
}
.crew-row span {
  flex: 1;
}
details {
  border-top: 1px dashed var(--edge);
  padding: 6px 0;
  font-size: 0.87rem;
}
summary {
  font-weight: bold;
  cursor: pointer;
  min-height: 40px;
  line-height: 40px;
}

.notes :last-child {
  margin-bottom: 0;
}
ol {
  padding-inline-start: 20px;
}
#entries li {
  margin: 5px 0;
}
@media (pointer: coarse), (max-width: 720px) {
  .touch:not([hidden]) {
    display: block;
  }
}
@media (max-width: 730px) and (orientation: portrait) {
  main {
    padding: 4px 10px 15px;
  }
  header {
    margin-bottom: 5px;
  }
  header span {
    display: none;
  }
  header button {
    margin-left: auto;
  }
  .shell {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  .viewport,
  aside {
    width: 100%;
  }
  .lobby aside,
  .waiting aside {
    order: -1;
  }
  .lobby h1 {
    font-size: 2.8rem;
    margin-bottom: 6px;
  }
  .lobby h1 br {
    display: none;
  }
  .lobby h1 em:before {
    content: " ";
  }
  .notes {
    padding: 15px;
  }
  #stage {
    height: clamp(300px, 47svh, 520px);
  }
  .course {
    font-size: 0.68rem;
  }
  .instruments span {
    font-size: 0.65rem;
  }
  .menu .actions {
    margin: 8px 0;
  }
}
@media (orientation: landscape) and (max-height: 550px) {
  main {
    padding: 2px 8px 8px;
  }
  header {
    min-height: 32px;
    margin: 0;
  }
  .shell {
    grid-template-columns: minmax(0, 1.75fr) minmax(225px, 1fr);
    gap: 8px;
  }
  #stage {
    height: calc(100svh - 110px);
    min-height: 220px;
  }
  aside {
    max-height: calc(100svh - 42px);
    overflow: auto;
  }
  .notes {
    padding: 12px;
  }
  h1 {
    font-size: 2.7rem;
  }
  .instruments {
    min-height: 29px;
  }
  .instruments span {
    font-size: 0.6rem;
  }
}
