#fullscreen, #fullscreenSettings {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid #ac9569;
  border-radius: 2px;
  background: transparent;
  color: inherit;
  font: 600 13px/1.2 var(--sans, sans-serif);
  white-space: nowrap;
  cursor: pointer;
}
#fullscreen svg { width: 17px; height: 17px; flex: none; }
#fullscreenSettings[hidden], #fullscreenPanel[hidden] { display: none; }
html.voyage-expanded, .voyage-expanded body { overflow: hidden; overscroll-behavior: none; }

.layout.voyage-fullscreen {
  --fs-left: max(10px, env(safe-area-inset-left));
  --fs-right: max(10px, env(safe-area-inset-right));
  --fs-top: max(6px, env(safe-area-inset-top));
  --fs-bottom: max(8px, env(safe-area-inset-bottom));
  --fs-ink: #fff3d5;
  --fs-surface: rgb(16 35 40 / 86%);
  --fs-edge: rgb(222 195 143 / 65%);
  position: fixed;
  z-index: 100;
  inset: 0;
  display: block;
  width: 100%;
  max-width: none;
  height: 100%;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  background: #142b34;
  box-sizing: border-box;
  isolation: isolate;
}
.voyage-fullscreen .scene-board,
.voyage-fullscreen .view-frame,
.voyage-fullscreen #scene {
  position: absolute;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  min-height: 0;
  max-height: none;
  aspect-ratio: auto;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.voyage-fullscreen .view-frame { z-index: 0; overflow: hidden; }
.voyage-fullscreen .view-frame::before, .voyage-fullscreen .view-frame::after,
.voyage-fullscreen .scene-board::before, .voyage-fullscreen .scene-board::after { display: none; }
.voyage-fullscreen #scene canvas { width: 100%; height: 100%; }
.voyage-fullscreen .chart-caption {
  position: absolute;
  z-index: 5;
  inset: 0 0 auto;
  display: flex;
  align-items: center;
  gap: clamp(5px, 1vw, 14px);
  min-height: 0;
  margin: 0;
  padding: var(--fs-top) var(--fs-right) 7px var(--fs-left);
  border: 0;
  background: linear-gradient(to bottom, rgb(13 28 33 / 95%) 0%, rgb(13 28 33 / 77%) 72%, transparent);
  color: var(--fs-ink);
  pointer-events: none;
}
.voyage-fullscreen .chart-name {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 8px;
  flex: 1;
}
.voyage-fullscreen #seaName { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.voyage-fullscreen #seaName, .voyage-fullscreen #timer { margin: 0; color: var(--fs-ink); font-size: clamp(15px, 2vw, 21px); }
.voyage-fullscreen :is(#seaStage, .clock span) { color: #e7d4af; font-size: 11px; }
.voyage-fullscreen .clock { display: flex; align-items: baseline; gap: 5px; color: var(--fs-ink); }
.voyage-fullscreen :is(#fullscreen, #fullscreenSettings, .camera-controls button, .orbit-button) {
  box-sizing: border-box;
  min-height: 44px;
  margin: 0;
  border: 1px solid var(--fs-edge);
  border-radius: 2px;
  background: var(--fs-surface);
  box-shadow: none;
  color: var(--fs-ink);
  font: 600 13px/1.15 var(--sans, sans-serif);
  pointer-events: auto;
}
.voyage-fullscreen :is(#fullscreen, #fullscreenSettings):hover,
.voyage-fullscreen :is(#fullscreenSettings[aria-expanded="true"], .camera-controls button[aria-pressed="true"]) {
  border-color: #f6ddb3;
  box-shadow: inset 0 0 0 1px #e6ce9e;
  color: #ffedcc;
  background: #473b2c;
}
.voyage-fullscreen .helm-ledger,
.voyage-fullscreen .voyage-record {
  position: absolute;
  z-index: 3;
  inset: 0;
  width: 100%;
  height: 100%;
  align-self: stretch;
  box-sizing: border-box;
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  pointer-events: none;
}
.voyage-fullscreen .helm-ledger { z-index: 4; }
.voyage-fullscreen :is(.ledger-title, .helm-keys, .view-label, .log-title, .ledger-footer a) { display: none; }
.voyage-fullscreen .helm-ledger .helm-station {
  position: absolute;
  bottom: var(--fs-bottom);
  left: var(--fs-left);
  width: clamp(154px, 24vw, 228px);
  padding: 0;
}
.voyage-fullscreen .helm-ledger .helm-pad {
  max-width: none;
  gap: 2px;
  margin: 0;
}
.voyage-fullscreen .helm-ledger .steer {
  min-height: 44px;
  border: 1px solid var(--fs-edge);
  background: rgb(18 38 43 / 76%);
  box-shadow: inset 0 0 0 2px rgb(18 38 43 / 32%);
  color: var(--fs-ink);
  pointer-events: auto;
}
.voyage-fullscreen .helm-ledger .steer i { border-color: currentColor; }
.voyage-fullscreen .helm-ledger .steer:is(.active, :active) { background: #743e31; border-color: #ffdfae; }
.voyage-fullscreen .helm-hub { color: #f6d595; filter: drop-shadow(0 1px 2px #182226); }
.voyage-fullscreen .helm-hub svg { width: 38px; height: 38px; }
.voyage-fullscreen .view-controls, .voyage-fullscreen .orbit-controls {
  position: absolute;
  z-index: 2;
  inset: auto var(--fs-right) var(--fs-bottom) auto;
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  pointer-events: none;
}
.voyage-fullscreen .camera-controls { display: flex; gap: 3px; padding: 0; border: 0; background: none; box-shadow: none; }
.voyage-fullscreen .camera-controls button, .voyage-fullscreen .orbit-button { min-width: 0; padding-inline: clamp(6px, 1vw, 12px); }
.voyage-fullscreen .orbit-controls:not([hidden]) { display: flex; gap: 3px; bottom: calc(var(--fs-bottom) + 49px); }
.voyage-fullscreen .orbit-controls[hidden] { display: none; }
.voyage-fullscreen #minimap {
  position: absolute;
  inset: calc(var(--fs-top) + 51px) var(--fs-right) auto auto;
  width: clamp(86px, 12vw, 155px);
  height: auto;
  pointer-events: none;
}
.voyage-fullscreen .log {
  position: absolute;
  inset: calc(var(--fs-top) + 51px) auto auto var(--fs-left);
  width: max-content;
  max-width: min(44%, 34em);
  min-height: 0;
  padding: 5px 8px;
  border: 0;
  border-left: 2px solid #b39962;
  border-radius: 0;
  background: var(--fs-surface);
  color: var(--fs-ink);
}
.voyage-fullscreen #status { margin: 0; color: var(--fs-ink); font: 500 12px/1.5 var(--sans, sans-serif); }
/* Keep the water visible through the full voyage, including departure and arrival. */
.voyage-fullscreen #overlay:not([hidden]) {
  position: absolute;
  inset: calc(var(--fs-top) + 51px) auto auto var(--fs-left);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: min(425px, calc(100% - var(--fs-left) - var(--fs-right) - 110px));
  max-height: calc(100% - var(--fs-top) - var(--fs-bottom) - 130px);
  box-sizing: border-box;
  overflow: auto;
  margin: 0;
  padding: 7px 10px;
  border: 1px solid var(--fs-edge);
  border-left: 3px solid #d8ba84;
  color: var(--fs-ink);
  background: var(--fs-surface);
  pointer-events: auto;
}
.voyage-fullscreen #overlay::before { display: none; }
.voyage-fullscreen #overlay .primary { justify-self: start; margin: 0; padding: 5px 10px; }
.voyage-fullscreen #overlay :is(h3, p) { margin-block: 0; color: var(--fs-ink); }
.voyage-fullscreen #overlay h3 { font-size: 16px; }
.voyage-fullscreen #overlay p { font-size: 12px; line-height: 1.45; }
.voyage-fullscreen #overlay :is(small, a) { color: #f0d09b; }
.voyage-fullscreen #overlay[hidden] { display: none; }
.voyage-fullscreen #overlay:not([hidden]) + .log { display: none; }
.voyage-fullscreen #fullscreenPanel:not([hidden]) {
  position: absolute;
  top: calc(var(--fs-top) + 49px);
  right: var(--fs-right);
  display: grid;
  gap: 4px;
  width: min(290px, calc(100% - var(--fs-left) - var(--fs-right)));
  max-height: calc(100% - var(--fs-top) - var(--fs-bottom) - 50px);
  box-sizing: border-box;
  padding: 8px 14px;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid #a58d64;
  border-radius: 2px;
  background: #e9dfc6;
  box-shadow: 0 3px 20px #111e2280;
  pointer-events: auto;
  grid-template-areas: "vessel" "readings" "mode" "trim" "motor" "hint" "footer";
}
.voyage-fullscreen #fullscreenPanel .vessel-entry { min-height: 52px; }
.voyage-fullscreen #fullscreenPanel .vessel-plate { height: 56px; }

@media (max-width: 620px) {
  .voyage-fullscreen .chart-caption { gap: 4px; }
  .voyage-fullscreen #seaStage, .voyage-fullscreen .clock span { display: none; }
  .voyage-fullscreen :is(#fullscreen, #fullscreenSettings) { padding-inline: 7px; }
  .voyage-fullscreen .camera-controls { display: grid; grid-template-columns: 1fr 1fr; }
  .voyage-fullscreen .orbit-controls:not([hidden]) { bottom: calc(var(--fs-bottom) + 95px); }
  .voyage-fullscreen .log { max-width: calc(100% - 130px); }
  .voyage-fullscreen #overlay:not([hidden]) { grid-template-columns: 1fr; gap: 4px; width: calc(100% - var(--fs-left) - var(--fs-right) - 94px); }
  .voyage-fullscreen #overlay .primary { font-size: 13px; }
}

@media (max-height: 430px) and (min-aspect-ratio: 1/1) {
  .voyage-fullscreen .helm-ledger .helm-station { width: 162px; }
  .voyage-fullscreen .camera-controls { display: flex; }
  .voyage-fullscreen .orbit-controls:not([hidden]) { bottom: calc(var(--fs-bottom) + 47px); }
  .voyage-fullscreen #minimap { width: 82px; }
  .voyage-fullscreen #overlay:not([hidden]) { grid-template-columns: minmax(0, 1fr) auto; width: min(425px, 62%); padding-block: 5px; }
}
