/* Take the wheel: the chart fills the screen, instruments on top, the helm at the bottom. */

.play {
  position: relative;
  height: 100svh;
  min-height: 600px;
  overflow: hidden;
  isolation: isolate;
  color: var(--ink);
}
/* the night chip turns the bridge display on, whatever the page theme */
body.play-page[data-weather="night"] {
  color-scheme: dark;
  --c-water: #0b1a26;
  --paper: #0b1a26;
  --paper-hi: #10243a;
  --ink: #dbe9f0;
  --ink-2: #a4bccb;
  --sound: #7fc4e0;
  --route: #f0705f;
  --route-text: #f58a7b;
  --brass: #c9a45a;
  --brass-hi: #ecd393;
  --brass-lo: #7e6128;
  --brass-text: #e2c27e;
  --glass: #0f2e44;
  --glass-hi: #7fc4e0;
  --rule: rgba(127, 196, 224, 0.22);
  --shadow: rgba(0, 0, 0, 0.5);
}
.sea {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
}

/* ---------- instruments ---------- */
.hud {
  position: absolute;
  z-index: 3;
  top: calc(var(--bar-h) + 6px);
  left: var(--gutter);
  right: var(--gutter);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
}
.hud > * {
  pointer-events: auto;
}
.gauges {
  display: flex;
  gap: 0;
  background: color-mix(in srgb, var(--paper-hi) 90%, transparent);
  border: 1px solid var(--ink);
  border-radius: 4px;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brass) 55%, transparent), 0 10px 22px -14px var(--shadow);
}
.gauge {
  margin: 0;
  padding: 6px 11px 7px;
  display: grid;
  grid-template-columns: auto auto;
  grid-template-areas: "label label" "val unit";
  align-items: baseline;
  column-gap: 3px;
  font-family: var(--mono);
  min-width: 72px;
}
.gauge + .gauge {
  border-left: 1px solid var(--rule);
}
.g-label {
  grid-area: label;
  font-size: 8.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.g-val {
  grid-area: val;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.g-unit {
  grid-area: unit;
  font-size: 10px;
  color: var(--ink-2);
}
.gauge.warn .g-val {
  color: var(--route-text);
}
.hud-side {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.chips {
  display: flex;
  gap: 3px;
  padding: 3px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--paper-hi) 90%, transparent);
  border: 1px solid var(--rule);
}
.chips button,
.sound {
  appearance: none;
  border: 0;
  font: 600 12px/1 var(--sans);
  letter-spacing: 0.02em;
  padding: 8px 11px;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.chips button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
}
.sound {
  border: 1px solid var(--rule);
  background: color-mix(in srgb, var(--paper-hi) 90%, transparent);
  display: inline-flex;
  gap: 6px;
  align-items: center;
}
.sound::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1.5px solid var(--ink-2);
}
.sound[aria-pressed="true"]::before {
  background: var(--route);
  border-color: var(--route);
}

.toast {
  position: absolute;
  z-index: 4;
  left: 50%;
  top: calc(var(--bar-h) + 118px);
  transform: translate(-50%, -6px);
  width: max-content;
  max-width: calc(100% - 2 * var(--gutter));
  margin: 0;
  padding: 9px 16px;
  border-radius: 6px;
  background: var(--ink);
  color: var(--paper);
  font-size: 14px;
  line-height: 1.35;
  text-align: center;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
}
.toast.on {
  opacity: 1;
  transform: translate(-50%, 0);
}
@media (min-width: 760px) {
  .toast {
    top: calc(var(--bar-h) + 76px);
  }
}

/* ---------- the helm ---------- */
.helm {
  position: absolute;
  z-index: 3;
  left: 0;
  right: 0;
  bottom: calc(14px + env(safe-area-inset-bottom));
  padding: 0 var(--gutter);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  pointer-events: none;
  transition: opacity 0.3s;
}
.play:not([data-state="playing"]) .helm {
  opacity: 0;
  visibility: hidden;
}
.lever,
.wheel {
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.lever {
  position: relative;
  width: 108px;
  height: 196px;
  padding: 14px 10px 14px 52px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--paper-hi) 88%, transparent);
  border: 1px solid var(--ink);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brass) 50%, transparent), 0 12px 24px -16px var(--shadow);
  cursor: ns-resize;
}
.lever-mark {
  position: absolute;
  left: 9px;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
  transform: translateY(-50%);
}
.lever-mark:nth-child(1) {
  top: 14px;
}
.lever-mark:nth-child(2) {
  top: calc(14px + 168px * 0.25);
}
.lever-mark:nth-child(3) {
  top: calc(14px + 168px * 0.5);
  color: var(--ink);
  font-weight: 700;
}
.lever-mark:nth-child(4) {
  top: calc(14px + 168px * 0.75);
  color: var(--route-text);
}
.lever-track {
  position: absolute;
  left: 66px;
  top: 14px;
  bottom: 14px;
  width: 8px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--brass-lo), var(--brass) 50%, var(--brass-lo));
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
}
.lever-handle {
  position: absolute;
  left: -14px;
  top: -11px;
  width: 36px;
  height: 22px;
  border-radius: 6px;
  background: linear-gradient(180deg, var(--brass-hi), var(--brass) 55%, var(--brass-lo));
  border: 1px solid var(--brass-lo);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}
.lever-handle::after {
  content: "";
  position: absolute;
  left: 6px;
  right: 6px;
  top: 10px;
  height: 2px;
  background: var(--route);
  border-radius: 1px;
}
.wheel {
  position: relative;
  width: 168px;
  height: 168px;
  cursor: grab;
}
.wheel svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(0 8px 10px var(--shadow));
}
.wheel-spin {
  transform-box: view-box;
  transform-origin: 0 0;
}
.wheel-spokes path {
  stroke: var(--brass-lo);
  stroke-width: 6;
  stroke-linecap: round;
}
.wheel-rim {
  fill: none;
  stroke: var(--brass);
  stroke-width: 7;
}
.wheel-rim.inner {
  stroke: var(--brass-lo);
  stroke-width: 1.5;
}
.wheel-hub {
  fill: var(--brass);
  stroke: var(--brass-lo);
  stroke-width: 1.5;
}
.wheel-hub-cap {
  fill: var(--brass-hi);
}
.wheel-grips circle {
  fill: var(--brass-hi);
  stroke: var(--brass-lo);
  stroke-width: 1.5;
}
.wheel-king {
  fill: var(--route);
  stroke: var(--brass-lo);
  stroke-width: 1.2;
}
.wheel-read {
  position: absolute;
  left: 50%;
  bottom: -4px;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  white-space: nowrap;
  padding: 3px 7px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--paper-hi) 92%, transparent);
  border: 1px solid var(--rule);
}

/* ---------- cards ---------- */
.card {
  position: absolute;
  z-index: 5;
  left: var(--gutter);
  right: var(--gutter);
  bottom: calc(16px + env(safe-area-inset-bottom));
  max-height: calc(100% - var(--bar-h) - 136px);
  overflow: auto;
  padding: 20px 18px 20px;
  background: var(--paper-hi);
  border: 1px solid var(--ink);
  border-radius: 6px;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brass) 45%, transparent), 0 24px 48px -24px var(--shadow);
}
.card[hidden] {
  display: none;
}
.card h1,
.card h2.result-title {
  font-size: clamp(44px, 12vw, 60px);
  line-height: 0.95;
  margin: 8px 0 10px;
}
.card h1 em {
  color: var(--route-text);
}
.card-lede {
  margin: 0 0 14px;
  color: var(--ink);
}
.howto-title {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brass-text);
  margin: 0 0 8px;
}
.howto {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: grid;
  gap: 8px;
  font-size: 14px;
  line-height: 1.4;
}
@media (max-width: 759px) {
  .card-lede {
    font-size: 15.5px;
  }
  .card h1,
  .card h2.result-title {
    font-size: 46px;
  }
}
.howto li {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 10px;
  align-items: start;
}
.keys {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  padding: 4px 0;
  border: 1px solid var(--ink-2);
  border-bottom-width: 2px;
  border-radius: 4px;
}
.weather-pick {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--ink-2);
}
.go {
  width: 100%;
}
.best {
  margin: 10px 0 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--ink-2);
  text-align: center;
}
.best:empty {
  display: none;
}
.tally {
  margin: 4px 0 12px;
  display: grid;
  gap: 0;
  font-size: 14px;
}
.tally div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--rule);
}
.tally dt {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-2);
  padding-top: 2px;
}
.tally dd {
  margin: 0;
  text-align: right;
}
.tally .total {
  border-bottom: 0;
  padding-top: 10px;
}
.tally .total dd {
  font-family: var(--mono);
  font-size: 26px;
  font-weight: 600;
  color: var(--route-text);
}
.orca-note {
  font-size: 13px;
  color: var(--ink-2);
  margin: 0 0 14px;
}
.orca-note a {
  color: inherit;
  text-decoration-color: var(--route);
}
.postcard {
  margin: 0 0 12px;
  padding: 10px 10px 14px;
  background: #fbf7ec;
  color: #1c2b3a;
  border: 1px solid rgba(28, 43, 58, 0.2);
  transform: rotate(-1.2deg);
  box-shadow: 0 14px 26px -18px rgba(0, 0, 0, 0.5);
}
.postcard img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
}
.postcard figcaption {
  display: grid;
  gap: 6px;
  padding: 10px 4px 0;
}
.postcard-kicker {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #b23426;
}
.postcard-line {
  font-family: var(--serif);
  font-style: italic;
  font-size: 21px;
  line-height: 1.2;
}
.postcard .maps-link {
  color: #1c2b3a;
  font-size: 14px;
  border-bottom: 2px solid #c0392b;
  text-decoration: none;
  font-weight: 600;
  justify-self: start;
}
.postcard .maps-link::after {
  content: " ↗";
  color: #b23426;
}
.postcard-credit {
  font-family: var(--mono);
  font-size: 10px;
  color: #3d4c59;
}
.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

@media (min-width: 760px) {
  .card {
    left: auto;
    right: max(var(--gutter), 4vw);
    top: calc(var(--bar-h) + 84px);
    bottom: auto;
    width: 440px;
    max-height: calc(100% - var(--bar-h) - 110px);
  }
  .helm {
    padding: 0 max(var(--gutter), 4vw);
  }
}
