:root {
  color-scheme: dark;
  --game-ink: #eef4f0;
  --game-muted: #aab9b4;
  --game-deep: #081514;
  --game-night: #10201e;
  --game-surface: #172b28;
  --game-surface-strong: #203b36;
  --game-line: #49655e;
  --game-signal: #f0be4f;
  --game-signal-strong: #ffd875;
  --game-water: #6bb4c1;
  --game-life: #73a96f;
  --game-danger: #df725c;
  --game-bar-target: clamp(40px, 7dvh, 48px);
  --game-bar-h: calc(var(--game-bar-target) + env(safe-area-inset-top, 0px));
  --game-scene-min: 300px;
  --game-sheet-target: 56px;
  --game-sheet-h: min(
    calc(var(--game-sheet-target) + env(safe-area-inset-bottom, 0px)),
    calc(100dvh - var(--game-bar-h) - var(--game-scene-min))
  );
  --game-content-max: 960px;
  font-family: Inter, "Segoe UI", "Microsoft YaHei UI", Arial, sans-serif;
  font-synthesis: none;
}

.game-app,
.game-app *,
.game-app *::before,
.game-app *::after {
  box-sizing: border-box;
}

.game-app {
  position: fixed;
  z-index: 500;
  inset: 0;
  width: 100%;
  min-width: 320px;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  color: var(--game-ink);
  background: var(--game-deep);
  font-size: 14px;
  line-height: 1.4;
  letter-spacing: 0;
  isolation: isolate;
}

.game-app [hidden] {
  display: none !important;
}

.game-app button,
.game-app input,
.game-app textarea {
  color: inherit;
  font: inherit;
  letter-spacing: 0;
}

.game-app button {
  border: 0;
  cursor: pointer;
}

.game-app button:disabled,
.game-app [aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.46;
}

.game-app button:focus-visible,
.game-app input:focus-visible,
.game-app textarea:focus-visible,
.game-app [tabindex]:focus-visible {
  outline: 3px solid rgba(240, 190, 79, 0.75);
  outline-offset: 3px;
}

/* Opening: no dashboard is rendered behind this screen. */
.wake-screen {
  position: absolute;
  z-index: 90;
  inset: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  place-items: center;
  min-height: 100%;
  padding: calc(20px + env(safe-area-inset-top, 0px))
    max(20px, env(safe-area-inset-right, 0px))
    calc(24px + env(safe-area-inset-bottom, 0px))
    max(20px, env(safe-area-inset-left, 0px));
  overflow: hidden;
  text-align: center;
  background: #050b0b;
}

.wake-screen__settings,
.wake-screen > .settings-button {
  justify-self: end;
  width: 44px;
  height: 44px;
  color: var(--game-muted);
  background: transparent;
}

.wake-screen__center {
  display: grid;
  place-items: center;
  gap: 24px;
  width: min(100%, 520px);
}

.wake-screen h1 {
  margin: 0;
  font-size: clamp(24px, 4dvh, 36px);
  font-weight: 760;
}

.wake-screen p {
  max-width: 28ch;
  margin: 0;
  color: var(--game-muted);
  font-size: 13px;
}

.wake-screen button[data-action="wake"],
.wake-screen .wake-action {
  position: relative;
  display: grid;
  place-items: center;
  width: 88px;
  height: 88px;
  color: var(--game-deep);
  background: var(--game-signal);
  border: 2px solid var(--game-signal-strong);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(240, 190, 79, 0.35);
  font-size: 15px;
  font-weight: 800;
  animation: wake-pulse 2.2s ease-out infinite;
}

.wake-screen button[data-action="wake"] svg,
.wake-screen .wake-action svg {
  width: 30px;
  height: 30px;
}

.wake-screen__caption {
  min-height: 38px;
  color: #c3d0cb;
  font-size: 12px;
}

@keyframes wake-pulse {
  0%, 35% { box-shadow: 0 0 0 0 rgba(240, 190, 79, 0.34); }
  75%, 100% { box-shadow: 0 0 0 24px rgba(240, 190, 79, 0); }
}

/* The sheet height is state-driven; both shell data and sheet data are supported. */
.game-shell,
.game-shell[data-sheet="closed"],
.game-shell:has(.context-sheet[data-mode="closed"]) {
  --game-sheet-target: 56px;
}

.game-shell[data-sheet="object"],
.game-shell[data-sheet="result"],
.game-shell:has(.context-sheet[data-mode="object"]),
.game-shell:has(.context-sheet[data-mode="result"]) {
  --game-sheet-target: 168px;
}

.game-shell[data-sheet="action"],
.game-shell:has(.context-sheet[data-mode="action"]) {
  --game-sheet-target: 208px;
}

.game-shell[data-sheet="materials"],
.game-shell:has(.context-sheet[data-mode="materials"]) {
  --game-sheet-target: 240px;
}

.game-shell[data-sheet="workbench"],
.game-shell[data-sheet="night"],
.game-shell:has(.context-sheet[data-mode="workbench"]),
.game-shell:has(.context-sheet[data-mode="night"]) {
  --game-sheet-target: 252px;
}

.game-shell {
  --game-sheet-h: min(
    calc(var(--game-sheet-target) + env(safe-area-inset-bottom, 0px)),
    calc(100dvh - var(--game-bar-h) - var(--game-scene-min))
  );
  display: grid;
  grid-template-rows: var(--game-bar-h) minmax(var(--game-scene-min), 1fr) var(--game-sheet-h);
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--game-deep);
}
.game-shell { grid-template-rows: var(--game-bar-h) minmax(0, 1fr); }
.play-surface { display: grid; grid-template-rows: minmax(var(--game-scene-min), 1fr) var(--game-sheet-h); min-width: 0; min-height: 0; overflow: hidden; }
.game-shell[data-sheet="closed"] { --game-sheet-target: 104px; }
.game-shell:has(.context-sheet[data-mode="closed"]) { --game-sheet-target: 104px; }
.context-sheet { grid-template-rows: minmax(0, 1fr) auto; }

.game-bar {
  position: relative;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(86px, 1fr) minmax(170px, 360px) minmax(86px, 1fr);
  align-items: center;
  gap: 12px;
  min-width: 0;
  height: var(--game-bar-h);
  padding: env(safe-area-inset-top, 0px)
    max(12px, env(safe-area-inset-right, 0px)) 0
    max(12px, env(safe-area-inset-left, 0px));
  background: #0b1b19;
  border-bottom: 1px solid #35534d;
}

.game-bar__day,
.game-bar__tools {
  display: flex;
  align-items: center;
  min-width: 0;
}

.game-bar__day {
  gap: 8px;
}

.game-bar__day strong,
.game-bar__day small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-bar__day strong {
  font-size: 12px;
}

.game-bar__day small {
  color: var(--game-muted);
  font-size: 9px;
}

.game-bar__tools {
  justify-content: flex-end;
  gap: 4px;
}

.game-bar__tools button,
.game-bar .icon-button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  color: #c5d2cd;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
}

.game-bar__tools button:hover,
.game-bar .icon-button:hover {
  color: var(--game-signal-strong);
  background: #17302c;
  border-color: #3c5e57;
}

.game-bar svg {
  width: 18px;
  height: 18px;
}

.daylight-track {
  display: grid;
  grid-template-columns: repeat(6, minmax(16px, 1fr));
  align-items: center;
  justify-self: center;
  gap: 5px;
  width: min(100%, 330px);
  min-width: 0;
  height: 32px;
  padding: 0 9px;
  background: #132724;
  border: 1px solid #36554f;
  border-radius: 4px;
}

.daylight-track > span,
.daylight-track > i {
  display: block;
  width: 100%;
  height: 6px;
  background: var(--game-signal);
  border-radius: 1px;
  transition: background-color 180ms ease, opacity 180ms ease, transform 180ms ease;
}

.daylight-track > .is-spent,
.daylight-track > [data-state="spent"] {
  background: #40514d;
  opacity: 0.6;
}

.daylight-track > .is-preview,
.daylight-track > [data-state="preview"] {
  background: #7b6030;
  opacity: 0.78;
  transform: scaleY(0.66);
}

.daylight-track > .is-saved,
.daylight-track > [data-state="saved"] {
  background: var(--game-life);
  animation: daylight-return 620ms ease-out;
}

@keyframes daylight-return {
  0% { transform: scaleX(0.45); }
  55% { transform: scaleX(1.1); }
  100% { transform: scaleX(1); }
}

/* Full-bleed interactive scene. */
.scene-stage {
  position: relative;
  z-index: 1;
  min-width: 0;
  min-height: var(--game-scene-min);
  overflow: hidden;
  background: #1d3d40;
  contain: layout paint;
  touch-action: manipulation;
}

.scene-svg,
.scene-stage > svg.scene-svg,
.scene-stage > img.scene-svg,
.scene-stage > picture.scene-svg,
.scene-stage > picture.scene-svg > img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--scene-focus-x, 50%) var(--scene-focus-y, 50%);
  transition: opacity 420ms ease, transform 620ms cubic-bezier(0.2, 0.7, 0.2, 1), filter 420ms ease;
  user-select: none;
  -webkit-user-drag: none;
}

.game-shell[data-focus="wind"] .scene-svg {
  --scene-focus-x: 34%;
  transform: scale(1.08);
}

.game-shell[data-focus="water"] .scene-svg {
  --scene-focus-x: 68%;
  transform: scale(1.08);
}

.game-shell[data-story="tide"] .scene-svg,
.game-shell[data-story="t"] .scene-svg {
  --scene-focus-x: 70%;
  --scene-focus-y: 58%;
}

.scene-stage [data-layer] {
  opacity: 0;
  pointer-events: none;
  transition: opacity 360ms ease, transform 520ms ease;
}

.scene-stage [data-layer].is-visible,
.scene-stage [data-layer][data-visible="true"] {
  opacity: 1;
}

.scene-stage.is-impact .scene-svg,
.game-shell[data-story="s1"] .scene-stage.is-impact .scene-svg {
  animation: cabin-impact 440ms ease-out;
}

@keyframes cabin-impact {
  0%, 100% { transform: translate3d(0, 0, 0); }
  25% { transform: translate3d(-5px, 2px, 0); }
  55% { transform: translate3d(4px, -1px, 0); }
  78% { transform: translate3d(-2px, 1px, 0); }
}

.scene-hotspot {
  position: absolute;
  z-index: 15;
  top: var(--hotspot-y, 50%);
  left: var(--hotspot-x, 50%);
  display: grid;
  place-items: center;
  width: clamp(44px, 6vmin, 62px);
  height: clamp(44px, 6vmin, 62px);
  padding: 0;
  color: var(--game-ink);
  background: transparent;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  touch-action: manipulation;
}

.scene-hotspot::before,
.scene-hotspot::after {
  position: absolute;
  inset: 7px;
  border: 2px solid rgba(238, 244, 240, 0.76);
  border-radius: 50%;
  content: "";
  transition: border-color 180ms ease, background-color 180ms ease, transform 180ms ease;
}

.scene-hotspot::after {
  inset: 1px;
  border-width: 1px;
  opacity: 0;
}

.scene-hotspot:hover::before,
.scene-hotspot:focus-visible::before,
.scene-hotspot[aria-pressed="true"]::before {
  background: rgba(8, 21, 20, 0.42);
  border-color: var(--game-signal-strong);
  transform: scale(1.08);
}

.scene-hotspot.is-urgent::before,
.scene-hotspot[data-priority="urgent"]::before {
  border-color: var(--game-danger);
  animation: hotspot-breathe 1.8s ease-out infinite;
}

.scene-hotspot.is-opportunity::after,
.scene-hotspot[data-priority="opportunity"].is-new::after {
  border-color: var(--game-signal-strong);
  animation: opportunity-once 1.2s ease-out 1;
}

.scene-hotspot.is-complete::before,
.scene-hotspot[data-state="complete"]::before {
  border-color: var(--game-life);
  background: rgba(23, 54, 42, 0.46);
}

.scene-hotspot svg {
  position: relative;
  z-index: 1;
  width: 20px;
  height: 20px;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.62));
}

.scene-hotspot > span {
  position: absolute;
  top: calc(100% + 3px);
  left: 50%;
  width: max-content;
  max-width: 120px;
  padding: 3px 6px;
  overflow: hidden;
  color: #f4f7f4;
  background: rgba(7, 20, 19, 0.82);
  border-radius: 3px;
  opacity: 0;
  font-size: 10px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
  transform: translate(-50%, -3px);
  transition: opacity 150ms ease, transform 150ms ease;
  pointer-events: none;
}

.scene-hotspot:hover > span,
.scene-hotspot:focus-visible > span,
.scene-hotspot[aria-pressed="true"] > span {
  opacity: 1;
  transform: translate(-50%, 0);
}

@keyframes hotspot-breathe {
  0%, 100% { box-shadow: 0 0 0 0 rgba(223, 114, 92, 0); transform: scale(1); }
  50% { box-shadow: 0 0 0 9px rgba(223, 114, 92, 0.13); transform: scale(1.08); }
}

@keyframes opportunity-once {
  0% { opacity: 0; transform: scale(0.75); }
  45% { opacity: 1; transform: scale(1.18); }
  100% { opacity: 0; transform: scale(1.38); }
}

.scene-caption {
  position: absolute;
  z-index: 20;
  right: max(12px, env(safe-area-inset-right, 0px));
  bottom: 12px;
  left: max(12px, env(safe-area-inset-left, 0px));
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  width: min(680px, calc(100% - 24px));
  min-height: 44px;
  margin-inline: auto;
  padding: 8px 10px;
  color: #f3f6f4;
  background: rgba(7, 20, 19, 0.88);
  border-left: 3px solid var(--game-signal);
  pointer-events: none;
}

.scene-caption strong {
  color: var(--game-signal-strong);
  font-size: 11px;
  white-space: nowrap;
}

.scene-caption p {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.vital-strip {
  position: absolute;
  z-index: 18;
  top: 10px;
  right: max(10px, env(safe-area-inset-right, 0px));
  display: flex;
  gap: 6px;
}

.vital-strip > span,
.vital-strip > button {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 5px;
  min-height: 34px;
  padding: 5px 7px;
  color: var(--game-muted);
  background: rgba(9, 28, 26, 0.82);
  border: 1px solid #47645d;
  border-radius: 4px;
}

.vital-strip svg {
  width: 17px;
  height: 17px;
}

.vital-strip b,
.vital-strip small {
  display: block;
  font-size: 9px;
  line-height: 1.2;
}

.vital-strip .is-safe,
.vital-strip [data-state="safe"] {
  color: #d7ecd6;
  border-color: var(--game-life);
}

.vital-strip .is-risk,
.vital-strip [data-state="risk"] {
  color: #ffd1c8;
  border-color: var(--game-danger);
}

/* One contextual band replaces task lists, side panels and the permanent workshop. */
.context-sheet {
  position: relative;
  z-index: 40;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  width: 100%;
  height: var(--game-sheet-h);
  min-height: 0;
  padding: 0 max(12px, calc((100vw - var(--game-content-max)) / 2));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  overflow: hidden;
  color: var(--game-ink);
  background: #10221f;
  border-top: 1px solid #4a665f;
  box-shadow: 0 -12px 34px rgba(0, 0, 0, 0.28);
  transition: height 240ms cubic-bezier(0.2, 0.72, 0.2, 1);
}

.context-sheet[data-mode="closed"] {
  grid-template-rows: 56px;
}

.context-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 56px;
}

.context-head > div,
.context-head > span {
  min-width: 0;
}

.context-head strong,
.context-head small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.context-head strong {
  font-size: 13px;
}

.context-head small {
  margin-top: 2px;
  color: var(--game-muted);
  font-size: 10px;
}

.context-head button,
.context-sheet .sheet-back {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: #d7e1dd;
  background: transparent;
  border: 1px solid #3d5b54;
  border-radius: 4px;
}

.context-sheet__body,
.context-sheet > .sheet-body {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-color: #526e66 transparent;
  scrollbar-width: thin;
}

.context-sheet[data-mode="closed"] .context-sheet__body,
.context-sheet[data-mode="closed"] > .sheet-body {
  display: none;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  width: min(100%, var(--game-content-max));
  margin-inline: auto;
  padding: 8px 0 12px;
}

.action-grid > button,
.context-sheet .action-button {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 56px;
  padding: 7px 9px;
  color: #edf4f0;
  text-align: left;
  background: #1a312d;
  border: 1px solid #48645d;
  border-radius: 5px;
}

.action-grid > button:hover,
.context-sheet .action-button:hover,
.action-grid > button[aria-pressed="true"] {
  background: #24423c;
  border-color: var(--game-signal);
}

.action-grid svg,
.context-sheet .action-button svg {
  width: 22px;
  height: 22px;
  color: var(--game-signal-strong);
}

.action-grid b,
.action-grid small,
.context-sheet .action-button b,
.context-sheet .action-button small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.action-grid b,
.context-sheet .action-button b {
  font-size: 12px;
}

.action-grid small,
.context-sheet .action-button small {
  color: var(--game-muted);
  font-size: 9px;
}

.action-grid .action-cost,
.context-sheet .action-cost {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--game-signal-strong);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.action-cost del {
  color: #84968f;
  font-weight: 500;
}

.action-cost .crew-mark {
  color: #b9d7c0;
  font-size: 9px;
  font-style: normal;
}

.workbench {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(300px, 1.1fr);
  gap: 14px;
  width: min(100%, var(--game-content-max));
  height: 100%;
  margin-inline: auto;
  padding: 8px 0 12px;
  overflow: hidden;
}

.workbench__selection,
.workbench__preview,
.workbench > section,
.workbench > div {
  min-width: 0;
  min-height: 0;
}

.workbench__selection {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.workbench__slots,
.workbench .material-slots {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 18px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  min-height: 64px;
}

.workbench__slots > button,
.workbench .material-slot {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  min-width: 0;
  min-height: 54px;
  padding: 6px;
  color: var(--game-ink);
  text-align: left;
  background: #182e2a;
  border: 1px dashed #617a73;
  border-radius: 4px;
}

.workbench__preview {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-content: center;
  align-items: center;
  gap: 10px;
  padding-left: 14px;
  border-left: 1px solid #3d5a53;
}

.workbench__preview h3,
.workbench__preview p {
  margin: 0;
}

.workbench__preview h3 {
  font-size: 14px;
}

.workbench__preview p {
  margin-top: 4px;
  color: var(--game-muted);
  font-size: 10px;
}

.workbench__specs {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}

.workbench__specs > span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  min-height: 24px;
  padding: 3px 6px;
  color: #d9e5e0;
  background: #203b36;
  border: 1px solid #4a675f;
  border-radius: 3px;
  font-size: 9px;
}

.material-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  grid-auto-rows: 72px;
  gap: 7px;
  min-width: 0;
  min-height: 0;
  padding: 4px 2px 8px;
  overflow: auto;
  overscroll-behavior: contain;
}

.material-grid > button {
  display: grid;
  grid-template-rows: 28px minmax(0, 1fr) auto;
  place-items: center;
  min-width: 0;
  min-height: 72px;
  padding: 5px;
  color: #dce7e2;
  text-align: center;
  background: #19312c;
  border: 1px solid #49675f;
  border-radius: 4px;
}

.material-grid > button:hover,
.material-grid > button[aria-pressed="true"],
.material-grid > button.is-selected {
  background: #294941;
  border-color: var(--game-signal);
}

.material-grid svg {
  width: 24px;
  height: 24px;
  color: #9fc8c0;
}

.material-grid b,
.material-grid small {
  display: block;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.material-grid b {
  font-size: 10px;
}

.material-grid small {
  color: var(--game-muted);
  font-size: 8px;
}

.context-sheet .primary-action,
.context-sheet .confirm-action,
.night-overlay .primary-action,
.complete-screen .primary-action,
.feedback-dialog .primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 120px;
  min-height: 44px;
  padding: 8px 14px;
  color: #14201d;
  background: var(--game-signal);
  border: 1px solid var(--game-signal-strong);
  border-radius: 4px;
  font-weight: 800;
}

.context-sheet .primary-action:hover,
.context-sheet .confirm-action:hover,
.night-overlay .primary-action:hover,
.complete-screen .primary-action:hover,
.feedback-dialog .primary-action:hover {
  background: var(--game-signal-strong);
}

.context-sheet .quiet-action,
.feedback-dialog .quiet-action {
  min-height: 44px;
  padding: 8px 12px;
  color: #d3dfda;
  background: transparent;
  border: 1px solid #49665e;
  border-radius: 4px;
}

/* Night and ending remain scenes, not report cards. */
.night-overlay,
.complete-screen {
  position: absolute;
  z-index: 70;
  inset: 0;
  display: grid;
  align-content: end;
  justify-items: center;
  padding: var(--game-bar-h) max(16px, env(safe-area-inset-right, 0px))
    calc(24px + env(safe-area-inset-bottom, 0px))
    max(16px, env(safe-area-inset-left, 0px));
  background: rgba(2, 9, 9, 0.82);
}

.night-overlay__scene,
.complete-screen__scene {
  position: absolute;
  z-index: -1;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.58;
}

.night-overlay__content,
.complete-screen__content {
  width: min(100%, 720px);
  padding: 16px 0;
  border-top: 1px solid rgba(185, 211, 201, 0.45);
}

.night-overlay h2,
.complete-screen h2 {
  margin: 0;
  font-size: clamp(20px, 3dvh, 30px);
}

.night-overlay p,
.complete-screen p {
  max-width: 54ch;
  margin: 8px 0 16px;
  color: #c7d4cf;
}

.night-result-list {
  display: grid;
  gap: 8px;
  margin: 10px 0 16px;
}

.night-result-list > div {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 42px;
  border-bottom: 1px solid rgba(104, 137, 126, 0.42);
}

.feedback-dialog {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 14px;
  color: var(--game-ink);
  background: rgba(2, 9, 9, 0.76);
  border: 0;
}
.feedback-dialog:not([open]) { display: none !important; }

.feedback-dialog::backdrop {
  background: rgba(2, 9, 9, 0.76);
}

.feedback-dialog > form,
.feedback-dialog__panel {
  display: grid;
  gap: 12px;
  width: min(100%, 520px);
  max-height: calc(100dvh - 28px);
  padding: 18px;
  overflow: auto;
  color: var(--game-ink);
  background: #142925;
  border: 1px solid #536f67;
  border-radius: 6px;
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.46);
}

.feedback-dialog h2,
.feedback-dialog p {
  margin: 0;
}

.feedback-dialog label {
  display: grid;
  gap: 5px;
  color: #cfdbd6;
  font-size: 11px;
}

.feedback-dialog textarea {
  width: 100%;
  min-height: 108px;
  padding: 10px;
  resize: vertical;
  color: var(--game-ink);
  background: #0c1d1b;
  border: 1px solid #526d65;
  border-radius: 4px;
}

.feedback-dialog__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.toast {
  position: fixed;
  z-index: 120;
  top: calc(var(--game-bar-h) + 10px);
  left: 50%;
  width: min(calc(100% - 24px), 480px);
  min-height: 42px;
  padding: 10px 13px;
  color: #f1f5f3;
  text-align: center;
  background: #18322d;
  border: 1px solid #58736b;
  border-radius: 4px;
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.34);
  transform: translateX(-50%);
}

.toast.is-error,
.toast[data-tone="error"] {
  background: #47251f;
  border-color: var(--game-danger);
}

/* The new entry keeps the scene markup intentionally small; these aliases
   keep its semantic names aligned with the compact sheet styles above. */
.brand-mark { display: flex; align-items: center; gap: 7px; min-width: 0; font-size: 12px; }
.brand-mark strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-symbol { display: grid; place-items: center; width: 24px; height: 24px; color: var(--game-signal); }
.daylight-meter { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; min-width: 0; }
.daylight-meter > span { font-size: 12px; font-weight: 800; white-space: nowrap; }
.daylight-meter > small { color: var(--game-muted); font-size: 9px; white-space: nowrap; }
.game-actions { display: flex; justify-content: flex-end; gap: 4px; min-width: 0; }
.context-content { min-width: 0; min-height: 0; overflow: hidden; }
.context-nav { display: flex; align-items: center; gap: 7px; width: min(100%, var(--game-content-max)); margin: 0 auto; padding: 7px 0 10px; }
.context-nav button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 7px 10px; color: #dce9e3; background: #19322e; border: 1px solid #49675f; border-radius: 4px; }
.context-nav button:hover { color: var(--game-signal-strong); border-color: var(--game-signal); }
.context-nav svg { width: 17px; height: 17px; }
.context-nav b { color: var(--game-signal-strong); font-size: 10px; }
.context-idle { display: flex; align-items: center; gap: 10px; min-height: 56px; color: var(--game-muted); }
.context-idle strong, .context-idle small { display: block; }
.context-idle strong { color: var(--game-ink); font-size: 13px; }
.context-idle small { margin-top: 2px; font-size: 10px; }
.context-symbol { display: grid; place-items: center; width: 34px; height: 34px; color: var(--game-signal); border: 1px solid #49675f; border-radius: 4px; }
.arrival-objective { align-items: flex-start; padding: 4px 0 2px; }
.arrival-objective strong { font-size: 14px; }
.arrival-objective small { max-width: 42ch; line-height: 1.45; }
.objective-link { display: inline-flex; align-items: center; gap: 5px; min-height: 38px; margin-top: 8px; padding: 5px 9px; color: var(--game-signal-strong); background: #19332e; border: 1px solid #55776c; border-radius: 4px; font-size: 11px; font-weight: 800; }
.objective-link svg { width: 15px; height: 15px; }
.objective-link:hover { color: #10201d; background: var(--game-signal); }
.context-empty { padding: 12px; color: var(--game-muted); border: 1px dashed #49675f; }
.sheet-back { flex: 0 0 auto; }
.history-list { display: grid; gap: 6px; padding: 7px 0 12px; }
.history-row { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 8px; align-items: center; min-height: 34px; padding: 5px 8px; background: #19312d; border-bottom: 1px solid #36544d; }
.history-row span, .history-row small { color: var(--game-muted); font-size: 10px; }
.history-row b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.pause-menu { position: fixed; z-index: 80; top: var(--game-bar-h); right: 10px; display: grid; gap: 5px; width: min(220px, calc(100% - 20px)); padding: 9px; background: #10241f; border: 1px solid #527067; box-shadow: 0 15px 40px rgba(0,0,0,.42); }
.pause-menu-head { display: flex; align-items: center; justify-content: space-between; min-height: 34px; border-bottom: 1px solid #36554d; }
.pause-menu > button:not(.icon-button) { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 7px 9px; color: #dce9e3; text-align: left; background: transparent; }
.pause-menu > button:not(.icon-button):hover { background: #1d3a34; }
.pause-menu svg { width: 17px; height: 17px; }
.dialog-head { display: flex; align-items: start; justify-content: space-between; gap: 10px; }
.dialog-head small { color: var(--game-signal-strong); }
.rating-row { display: flex; gap: 6px; }
.rating-row button { width: 34px; height: 34px; color: var(--game-muted); background: #19332e; border: 1px solid #49675f; border-radius: 3px; }
.rating-row button.is-selected, .rating-row button:hover { color: #12201c; background: var(--game-signal); border-color: var(--game-signal-strong); }
.context-check { display: flex !important; grid-template-columns: auto 1fr !important; align-items: center; gap: 7px !important; }
.context-check input { accent-color: var(--game-signal); }
.night-choices { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 14px; }
.night-choices button { min-height: 42px; }
.night-choices .quiet-action { min-width: 120px; color: #d3dfda; background: transparent; border: 1px solid #49665e; border-radius: 4px; }
.day2-preview { display: flex; flex-wrap: wrap; gap: 7px; margin: 12px 0 16px; }
.day2-preview > span { display: inline-flex; align-items: center; gap: 5px; padding: 6px 8px; color: #dce9e3; background: #19332e; border: 1px solid #49675f; border-radius: 3px; font-size: 11px; }
.day2-preview svg { width: 15px; height: 15px; color: var(--game-signal-strong); }
.complete-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.secondary-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; padding: 8px 14px; color: #d3dfda; background: transparent; border: 1px solid #49665e; border-radius: 4px; font-weight: 700; }
.secondary-button:hover { color: var(--game-signal-strong); border-color: var(--game-signal); }
.scene-stage[data-time="afternoon"] .sky-layer { filter: sepia(.12) saturate(1.12); }
.scene-stage[data-time="night"] .sky-layer { filter: brightness(.58) saturate(.8); }
.scene-stage[data-weather="storm"] .rain-layer { opacity: .92; }
.scene-stage[data-weather="storm"] .scene-shade { opacity: .38; }
.deployed-layer > g, .tide-detail-layer { opacity: 0; transform: translateY(8px); transition: opacity 360ms ease, transform 520ms ease; }
.scene-stage.has-windbreak .windbreak-layer,
.scene-stage.has-patch .patch-layer,
.scene-stage.has-heat .heat-layer,
.scene-stage.has-collector .collector-layer,
.scene-stage.has-filter .filter-layer,
.scene-stage.has-tide .tide-detail-layer { opacity: 1; transform: translateY(0); }
.lin-restraint { transition: opacity 280ms ease, transform 420ms ease; }
.scene-stage.is-open .lin-restraint { opacity: 0; transform: translateY(36px) rotate(-8deg); }
.wake-copy { display: grid; place-items: center; gap: 12px; align-self: center; }
.wake-copy h1 { margin: 0; font-size: clamp(26px, 5vw, 42px); font-weight: 760; }
.wake-copy p { max-width: 28ch; margin: 0; color: var(--game-muted); font-size: 12px; line-height: 1.55; }
.protocol-glyph { display: grid; place-items: center; width: 52px; height: 52px; color: var(--game-signal); border: 1px solid #49675f; border-radius: 50%; box-shadow: 0 0 0 10px rgba(240,190,79,.06); }
.protocol-glyph svg { width: 26px; height: 26px; }
.wake-button { position: relative; display: grid; place-items: center; align-self: end; gap: 4px; width: 92px; height: 92px; margin-bottom: 20px; color: #11201c; background: var(--game-signal); border: 2px solid var(--game-signal-strong); border-radius: 50%; box-shadow: 0 0 0 0 rgba(240,190,79,.34); animation: wake-pulse 2.2s ease-out infinite; }
.wake-button svg { width: 25px; height: 25px; }
.wake-button strong { font-size: 13px; }
.wake-reset-button { min-height: 44px; margin: -6px 0 16px; padding: 8px 14px; color: #d7e5df; background: transparent; border: 1px solid #49675f; border-radius: 4px; font-size: 12px; font-weight: 700; }
.wake-reset-button:hover { color: var(--game-signal-strong); border-color: var(--game-signal); }
.wake-atmosphere { position: absolute; inset: 0; pointer-events: none; opacity: .72; }
.wake-atmosphere::before, .wake-atmosphere::after { content: ""; position: absolute; inset: 18% 12%; border: 1px solid rgba(107,180,193,.2); border-radius: 50%; transform: rotate(-12deg) scaleY(.34); }
.wake-atmosphere::after { inset: 28% 4%; opacity: .45; }
.wake-wave { position: absolute; left: -10%; width: 120%; height: 1px; background: rgba(107,180,193,.2); transform: rotate(-8deg); }
.wave-a { top: 42%; }
.wave-b { top: 58%; opacity: .52; }
.wake-scanline { position: absolute; inset: 0; background: repeating-linear-gradient(0deg, transparent 0 5px, rgba(238,244,240,.025) 6px 7px); }

@media (max-width: 680px) {
  .brand-mark strong { display: none; }
  .daylight-meter { gap: 5px; }
  .daylight-meter > small { display: none; }
  .context-nav { gap: 5px; }
  .context-nav button { flex: 1 1 0; padding-inline: 6px; }
  .context-nav button span { font-size: 10px; }
}

@media (max-width: 900px) {
  :root {
    --game-scene-min: 260px;
  }

  .game-bar {
    grid-template-columns: minmax(72px, 0.7fr) minmax(150px, 1.6fr) minmax(72px, 0.7fr);
    gap: 7px;
  }

  .workbench {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(86px, 1fr) auto;
    gap: 7px;
    overflow: auto;
  }

  .workbench__preview {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 8px 0 0;
    border-top: 1px solid #3d5a53;
    border-left: 0;
  }
}

@media (max-width: 680px) {
  :root {
    --game-scene-min: 240px;
    --game-content-max: 100%;
  }

  .game-bar {
    grid-template-columns: minmax(62px, 0.7fr) minmax(138px, 1.6fr) minmax(62px, 0.7fr);
    gap: 5px;
    padding-right: max(8px, env(safe-area-inset-right, 0px));
    padding-left: max(8px, env(safe-area-inset-left, 0px));
  }

  .game-bar__day small {
    display: none;
  }

  .game-bar__tools button,
  .game-bar .icon-button {
    width: 40px;
    height: 40px;
  }

  .daylight-track {
    gap: 4px;
    height: 30px;
    padding: 0 7px;
  }

  .scene-caption {
    right: 8px;
    bottom: 8px;
    left: 8px;
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
    width: auto;
    min-height: 42px;
    padding: 7px 9px;
  }

  .scene-caption strong {
    font-size: 9px;
  }

  .scene-caption p {
    display: -webkit-box;
    overflow: hidden;
    font-size: 12px;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .vital-strip {
    top: 7px;
    right: 7px;
    gap: 4px;
  }

  .vital-strip > span,
  .vital-strip > button {
    grid-template-columns: 18px;
    width: 34px;
    min-height: 34px;
    padding: 5px;
  }

  .vital-strip b,
  .vital-strip small {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }

  .context-sheet {
    padding-right: max(8px, env(safe-area-inset-right, 0px));
    padding-left: max(8px, env(safe-area-inset-left, 0px));
  }

  .action-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
    padding-top: 6px;
  }

  .action-grid > button,
  .context-sheet .action-button {
    min-height: 52px;
  }

  .material-grid {
    grid-auto-flow: column;
    grid-auto-columns: 72px;
    grid-template-columns: none;
    grid-template-rows: 72px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x proximity;
  }

  .material-grid > button {
    scroll-snap-align: start;
  }

  .workbench {
    grid-template-rows: minmax(78px, 1fr) auto;
    padding-top: 4px;
  }

  .workbench__slots,
  .workbench .material-slots {
    min-height: 58px;
  }

  .workbench__preview {
    position: sticky;
    bottom: 0;
    background: #10221f;
  }

  .workbench__specs > span:nth-child(n + 4) {
    display: none;
  }

  .feedback-dialog {
    align-items: end;
    padding: 0;
  }

  .feedback-dialog > form,
  .feedback-dialog__panel {
    width: 100%;
    max-height: min(78dvh, 620px);
    padding: 14px max(12px, env(safe-area-inset-right, 0px))
      calc(14px + env(safe-area-inset-bottom, 0px))
      max(12px, env(safe-area-inset-left, 0px));
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 6px 6px 0 0;
  }

  .feedback-dialog__actions > button {
    min-height: 44px;
  }
}

@media (max-width: 370px) {
  .game-bar {
    grid-template-columns: 62px minmax(126px, 1fr) 44px;
  }

  .game-bar__tools button:not(:last-child) {
    display: none;
  }

  .scene-hotspot {
    width: 48px;
    height: 48px;
  }

  .context-head small {
    display: none;
  }
}

@media (max-height: 560px) {
  :root {
    --game-scene-min: 220px;
  }

  .scene-caption {
    min-height: 38px;
  }

  .scene-caption p {
    font-size: 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .game-app *,
  .game-app *::before,
  .game-app *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}

@media (prefers-contrast: more) {
  .scene-hotspot::before,
  .action-grid > button,
  .context-sheet .action-button,
  .material-grid > button {
    border-width: 2px;
  }

  .scene-caption,
  .context-sheet,
  .game-bar {
    background: #071210;
  }
}
