:root {
  color-scheme: light;
  --ink-950: #172827;
  --ink-900: #203633;
  --ink-800: #294640;
  --ink-700: #3e5c55;
  --ink-500: #6a7e77;
  --ink-300: #aebbb5;
  --line: #ccd4ce;
  --line-strong: #aebbb5;
  --paper: #f3f3ed;
  --surface: #ffffff;
  --surface-soft: #e9eee8;
  --sea: #5b9199;
  --leaf: #437653;
  --leaf-soft: #dce8d9;
  --signal: #e8ae3f;
  --signal-soft: #f8edcf;
  --danger: #c55f48;
  --danger-soft: #f5ded6;
  --info: #4e7f8a;
  --info-soft: #dbeaec;
  --shadow-sm: 0 2px 8px rgba(25, 45, 42, 0.1);
  --shadow-md: 0 10px 30px rgba(25, 45, 42, 0.16);
  --radius: 6px;
  --control-h: 38px;
  --topbar-h: 64px;
  --inventory-h: 238px;
  font-family: Inter, "Segoe UI", "Microsoft YaHei UI", Arial, sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 320px;
  min-height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  color: var(--ink-900);
  background: var(--paper);
  font-size: 14px;
  line-height: 1.45;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
  letter-spacing: 0;
}

button {
  border: 0;
}

button:focus-visible,
[tabindex]:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(232, 174, 63, 0.55);
  outline-offset: 2px;
}

button:disabled,
[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.48;
}

.app-shell {
  display: grid;
  grid-template-rows: var(--topbar-h) minmax(0, 1fr) var(--inventory-h);
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--paper);
}

.topbar {
  position: relative;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 1fr);
  align-items: center;
  min-width: 0;
  height: var(--topbar-h);
  padding: 0 18px;
  color: #f8f7ef;
  background: var(--ink-950);
  border-bottom: 3px solid var(--signal);
}

.topbar > * {
  min-width: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  color: var(--ink-950);
  background: var(--signal);
  border: 2px solid #f7d98c;
  border-radius: 4px;
  font-weight: 900;
}

.brand-copy {
  min-width: 0;
}

.brand-title {
  overflow: hidden;
  color: #ffffff;
  font-size: 17px;
  font-weight: 750;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-subtitle {
  overflow: hidden;
  margin-top: 2px;
  color: #aebfb8;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.day-meter {
  display: flex;
  align-items: center;
  justify-self: center;
  gap: 10px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid #46635d;
  border-radius: var(--radius);
  background: #263e3a;
}

.day-meter strong {
  color: #ffffff;
  font-size: 14px;
}

.day-meter small {
  color: #b7c6c0;
  font-size: 11px;
}

.day-progress {
  display: grid;
  grid-template-columns: repeat(7, 14px);
  gap: 4px;
}

.day-progress span {
  width: 14px;
  height: 6px;
  background: #557069;
  border-radius: 2px;
}

.day-progress span.is-complete {
  background: var(--leaf);
}

.day-progress span.is-current {
  background: var(--signal);
}

.topbar-actions,
.resource-pills {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.stat-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  height: 34px;
  padding: 0 9px;
  color: #dce6e1;
  background: #29443f;
  border: 1px solid #49665f;
  border-radius: var(--radius);
  white-space: nowrap;
}

.stat-pill svg,
.stat-pill img {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
}

.stat-pill strong {
  color: #ffffff;
  font-size: 13px;
}

.stat-pill.is-warning {
  color: #ffe8ae;
  border-color: #836c38;
  background: #473e29;
}

.icon-button {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: 0 0 var(--control-h);
  width: var(--control-h);
  height: var(--control-h);
  padding: 0;
  color: currentColor;
  background: transparent;
  border: 1px solid currentColor;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease, transform 120ms ease;
}

.icon-button:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
}

.icon-button:active:not(:disabled) {
  transform: translateY(1px);
}

.icon-button svg {
  width: 18px;
  height: 18px;
  pointer-events: none;
}

[data-tooltip]::after {
  position: absolute;
  z-index: 100;
  right: 0;
  bottom: calc(100% + 8px);
  width: max-content;
  max-width: 220px;
  padding: 6px 8px;
  color: #ffffff;
  background: var(--ink-950);
  border: 1px solid #527069;
  border-radius: 4px;
  content: attr(data-tooltip);
  font-size: 11px;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  transform: translateY(3px);
  transition: opacity 120ms ease, transform 120ms ease;
}

[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

.game-main,
.workspace,
.app-shell > main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(290px, 340px);
  min-height: 0;
  overflow: hidden;
}

.map-panel {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--sea);
  border-right: 1px solid var(--ink-700);
}

.scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--sea) url("assets/island-scene.svg") center center / cover no-repeat;
}

.scene > img,
.scene > svg {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scene-overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}

.scene-overlay > * {
  pointer-events: auto;
}

.map-toolbar {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 6;
  display: flex;
  gap: 6px;
  padding: 5px;
  color: var(--ink-900);
  background: rgba(247, 247, 240, 0.94);
  border: 1px solid rgba(32, 54, 51, 0.26);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.map-toolbar .icon-button {
  --control-h: 34px;
  border-color: transparent;
}

.map-toolbar .icon-button:hover {
  background: var(--surface-soft);
  border-color: var(--line);
}

.location-button,
.map-node {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 7px;
  max-width: 190px;
  min-height: 34px;
  padding: 6px 9px 6px 6px;
  color: var(--ink-950);
  background: rgba(255, 255, 250, 0.96);
  border: 2px solid rgba(32, 54, 51, 0.78);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.2;
  text-align: left;
  transition: transform 120ms ease, background-color 120ms ease, border-color 120ms ease;
}

.location-button:hover,
.map-node:hover,
.location-button.is-active,
.map-node.is-active {
  z-index: 7;
  background: #fff8e6;
  border-color: var(--signal);
  transform: translateY(-2px);
}

.location-button.is-locked,
.map-node.is-locked {
  color: #66756f;
  background: rgba(225, 229, 222, 0.92);
  border-style: dashed;
}

.node-icon {
  display: grid;
  place-items: center;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  color: #ffffff;
  background: var(--leaf);
  border-radius: 4px;
}

.node-icon.is-danger {
  background: var(--danger);
}

.node-icon.is-signal {
  color: var(--ink-950);
  background: var(--signal);
}

.map-caption {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 5;
  max-width: 310px;
  padding: 10px 12px;
  color: #f4f7f3;
  background: rgba(23, 40, 39, 0.88);
  border: 1px solid rgba(233, 238, 232, 0.22);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.map-caption strong {
  display: block;
  font-size: 13px;
}

.map-caption span {
  display: block;
  margin-top: 2px;
  color: #c7d3ce;
  font-size: 11px;
}

.side-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--surface);
}

.panel-section {
  min-width: 0;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.panel-section:last-child {
  border-bottom: 0;
}

.panel-heading,
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  margin: 0 0 10px;
}

.panel-heading h2,
.panel-heading h3,
.section-heading h2,
.section-heading h3 {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--ink-950);
  font-size: 13px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.eyebrow,
.panel-kicker {
  color: var(--ink-500);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.mission-panel {
  flex: 0 0 auto;
  background: #fbfaf4;
}

.mission-title {
  margin: 0 0 4px;
  color: var(--ink-950);
  font-size: 15px;
  line-height: 1.3;
}

.mission-copy {
  margin: 0;
  color: var(--ink-700);
  font-size: 12px;
}

.objective-list {
  display: grid;
  gap: 7px;
  margin: 11px 0 0;
  padding: 0;
  list-style: none;
}

.objective-item {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px;
  min-width: 0;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--signal);
  border-radius: 4px;
}

.objective-item.is-complete {
  color: #52665d;
  background: var(--leaf-soft);
  border-left-color: var(--leaf);
}

.objective-item.is-danger {
  background: var(--danger-soft);
  border-left-color: var(--danger);
}

.objective-item .status-icon {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
}

.objective-item .objective-label {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 12px;
  font-weight: 650;
}

.objective-item time,
.objective-item .objective-cost {
  color: var(--ink-500);
  font-size: 10px;
  white-space: nowrap;
}

.crew-list {
  display: grid;
  flex: 0 0 auto;
  gap: 7px;
}

.crew-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-width: 0;
  min-height: 48px;
  padding: 6px 8px;
  background: var(--surface-soft);
  border: 1px solid transparent;
  border-radius: var(--radius);
}

.crew-row:hover,
.crew-row.is-selected {
  background: var(--signal-soft);
  border-color: #dfc273;
}

.crew-avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  overflow: hidden;
  color: #ffffff;
  background: var(--ink-700);
  border-radius: 4px;
  font-size: 12px;
  font-weight: 800;
}

.crew-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.crew-info {
  min-width: 0;
}

.crew-name {
  display: block;
  overflow: hidden;
  color: var(--ink-950);
  font-size: 12px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crew-role,
.crew-state {
  display: block;
  overflow: hidden;
  color: var(--ink-500);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.condition-bar {
  width: 52px;
  height: 6px;
  overflow: hidden;
  background: #cfd7d1;
  border-radius: 2px;
}

.condition-bar > span {
  display: block;
  width: var(--value, 100%);
  height: 100%;
  background: var(--leaf);
}

.condition-bar.is-low > span {
  background: var(--danger);
}

.route-status {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 9px 10px;
  color: var(--ink-900);
  background: var(--info-soft);
  border: 1px solid #b6ced1;
  border-left: 4px solid var(--info);
  border-radius: var(--radius);
}

.route-status + .route-status {
  margin-top: 7px;
}

.route-status.is-ready {
  background: var(--leaf-soft);
  border-color: #bdd0ba;
  border-left-color: var(--leaf);
}

.route-status.is-at-risk {
  background: var(--danger-soft);
  border-color: #e8c4b8;
  border-left-color: var(--danger);
}

.route-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  color: #ffffff;
  background: var(--info);
  border-radius: 4px;
}

.route-status.is-ready .route-icon {
  background: var(--leaf);
}

.route-status.is-at-risk .route-icon {
  background: var(--danger);
}

.route-copy {
  min-width: 0;
}

.route-copy strong,
.route-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.route-copy strong {
  font-size: 12px;
}

.route-copy span {
  color: var(--ink-500);
  font-size: 10px;
}

.route-progress {
  color: var(--ink-700);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.action-log {
  flex: 1 1 auto;
  min-height: 100px;
  overflow: auto;
  padding: 0 4px 10px 0;
  scrollbar-color: var(--ink-300) transparent;
  scrollbar-width: thin;
}

.log-entry {
  position: relative;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 8px;
  min-width: 0;
  padding: 8px 4px 8px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-700);
  font-size: 11px;
}

.log-entry::before {
  position: absolute;
  top: 12px;
  left: 0;
  width: 4px;
  height: 18px;
  background: var(--line-strong);
  border-radius: 1px;
  content: "";
}

.log-entry.is-discovery::before {
  background: var(--signal);
}

.log-entry.is-success::before {
  background: var(--leaf);
}

.log-entry.is-alert::before {
  background: var(--danger);
}

.log-entry time {
  color: var(--ink-500);
  font-size: 10px;
}

.log-entry p {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.inventory-band {
  position: relative;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 480px);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #e7ebe5;
  border-top: 1px solid var(--line-strong);
  box-shadow: 0 -8px 24px rgba(25, 45, 42, 0.1);
}

.inventory-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 12px 14px;
}

.inventory-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  margin-bottom: 8px;
}

.inventory-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  margin: 0;
  color: var(--ink-950);
  font-size: 13px;
}

.inventory-count {
  color: var(--ink-500);
  font-size: 10px;
  font-weight: 650;
}

.inventory-filters,
.segmented-control {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  padding: 2px;
  background: #d7ddd7;
  border: 1px solid #c4cdc6;
  border-radius: var(--radius);
}

.inventory-filters button,
.segmented-control button {
  height: 26px;
  padding: 0 9px;
  color: var(--ink-700);
  background: transparent;
  border-radius: 4px;
  cursor: pointer;
  font-size: 10px;
  font-weight: 750;
  white-space: nowrap;
}

.inventory-filters button:hover,
.segmented-control button:hover,
.inventory-filters button.is-active,
.segmented-control button.is-active,
.segmented-control button[aria-selected="true"] {
  color: var(--ink-950);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.item-grid {
  display: grid;
  grid-auto-rows: 76px;
  grid-template-columns: repeat(auto-fill, minmax(116px, 1fr));
  gap: 8px;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 1px 4px 5px 1px;
  scrollbar-color: var(--ink-300) transparent;
  scrollbar-width: thin;
}

.item-card {
  position: relative;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-content: center;
  gap: 1px 7px;
  width: 100%;
  height: 76px;
  min-width: 0;
  padding: 8px;
  color: var(--ink-900);
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--item-color, var(--info));
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(30, 50, 46, 0.07);
  cursor: grab;
  text-align: left;
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

.item-card:hover,
.item-card:focus-visible,
.item-card.is-selected {
  z-index: 2;
  border-color: var(--signal);
  box-shadow: 0 4px 12px rgba(30, 50, 46, 0.15);
  transform: translateY(-2px);
}

.item-card:active {
  cursor: grabbing;
}

.item-card.is-depleted {
  filter: grayscale(0.75);
  opacity: 0.5;
}

.item-card.is-new::after {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 7px;
  height: 7px;
  background: var(--signal);
  border: 2px solid var(--surface);
  border-radius: 50%;
  content: "";
}

.item-icon {
  display: grid;
  grid-row: 1 / span 2;
  place-items: center;
  width: 38px;
  height: 38px;
  color: var(--ink-950);
  background: var(--item-soft, var(--info-soft));
  border-radius: 5px;
  font-size: 20px;
}

.item-icon img,
.item-icon svg {
  width: 26px;
  height: 26px;
  object-fit: contain;
}

.item-name {
  align-self: end;
  min-width: 0;
  overflow: hidden;
  color: var(--ink-950);
  font-size: 12px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-meta {
  align-self: start;
  min-width: 0;
  overflow: hidden;
  color: var(--ink-500);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-count {
  position: absolute;
  right: 6px;
  bottom: 5px;
  min-width: 20px;
  height: 18px;
  padding: 0 4px;
  color: #ffffff;
  background: var(--ink-800);
  border-radius: 3px;
  font-size: 10px;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
}

.merge-dock {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 12px 14px;
  background: var(--ink-900);
  border-left: 1px solid #4e6962;
  color: #eff4ef;
}

.merge-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  height: 30px;
  margin-bottom: 7px;
}

.merge-header h2,
.merge-header h3 {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: #ffffff;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.merge-cost {
  color: #b8c8c1;
  font-size: 10px;
  white-space: nowrap;
}

.merge-workbench {
  display: grid;
  grid-template-columns: minmax(82px, 1fr) 28px minmax(82px, 1fr) 34px minmax(92px, 1.15fr);
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.slot {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  height: 82px;
  padding: 7px;
  overflow: hidden;
  color: #9cb0a8;
  background: #19302d;
  border: 1px dashed #6f8880;
  border-radius: var(--radius);
  font-size: 10px;
  text-align: center;
}

.slot.is-filled {
  color: #ffffff;
  background: #294640;
  border-style: solid;
  border-color: var(--signal);
}

.slot.is-valid {
  border-color: #83b37e;
  box-shadow: inset 0 0 0 2px rgba(131, 179, 126, 0.18);
}

.slot.is-invalid {
  border-color: var(--danger);
  box-shadow: inset 0 0 0 2px rgba(197, 95, 72, 0.18);
}

.slot-result {
  background: #263c38;
  border-style: solid;
  border-color: #516d65;
}

.slot .item-icon {
  grid-row: auto;
  width: 34px;
  height: 34px;
  margin-bottom: 2px;
  color: var(--ink-950);
}

.slot .item-name {
  width: 100%;
  color: #ffffff;
  font-size: 10px;
  text-align: center;
}

.merge-operator {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: #c0cec8;
  font-size: 22px;
  font-weight: 500;
}

.merge-operator.is-arrow {
  width: 34px;
  color: var(--signal);
}

.merge-feedback {
  min-height: 31px;
  margin-top: 7px;
  color: #b8c8c1;
  font-size: 10px;
  line-height: 1.35;
}

.merge-feedback.is-valid {
  color: #b8d9b4;
}

.merge-feedback.is-invalid {
  color: #f1b6a7;
}

.primary-action,
.secondary-action,
.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 0;
  height: var(--control-h);
  padding: 0 14px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  transition: background-color 120ms ease, border-color 120ms ease, transform 120ms ease;
}

.primary-action {
  color: var(--ink-950);
  background: var(--signal);
  border: 1px solid #f1c565;
}

.primary-action:hover:not(:disabled) {
  background: #f0bd55;
}

.secondary-action {
  color: var(--ink-900);
  background: var(--surface);
  border: 1px solid var(--line-strong);
}

.secondary-action:hover:not(:disabled) {
  background: var(--surface-soft);
  border-color: var(--ink-500);
}

.text-button {
  height: 30px;
  padding: 0 8px;
  color: var(--info);
  background: transparent;
}

.text-button:hover:not(:disabled) {
  color: var(--ink-950);
  background: var(--info-soft);
}

.primary-action:active:not(:disabled),
.secondary-action:active:not(:disabled),
.text-button:active:not(:disabled) {
  transform: translateY(1px);
}

.merge-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  margin-top: auto;
}

.merge-actions .primary-action {
  min-width: 118px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 28, 27, 0.68);
}

.modal[hidden] {
  display: none;
}

.modal-dialog {
  width: min(560px, 100%);
  max-height: min(720px, calc(100dvh - 48px));
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-top: 5px solid var(--signal);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 17px 18px 13px;
  border-bottom: 1px solid var(--line);
}

.modal-header h2,
.modal-header h3 {
  margin: 0;
  color: var(--ink-950);
  font-size: 18px;
  line-height: 1.3;
}

.modal-header p {
  margin: 4px 0 0;
  color: var(--ink-500);
  font-size: 12px;
}

.modal-header .icon-button {
  --control-h: 32px;
  flex-basis: 32px;
  border-color: var(--line);
}

.modal-body {
  padding: 18px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 13px 18px 17px;
  border-top: 1px solid var(--line);
}

.discovery-result {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  min-width: 0;
  padding: 12px;
  background: var(--signal-soft);
  border: 1px solid #e5ca80;
  border-radius: var(--radius);
}

.discovery-result .item-icon {
  width: 72px;
  height: 72px;
  font-size: 34px;
}

.discovery-result h4 {
  margin: 0 0 3px;
  color: var(--ink-950);
  font-size: 16px;
}

.discovery-result p {
  margin: 0;
  color: var(--ink-700);
  font-size: 12px;
}

.cause-line {
  margin-top: 12px;
  padding: 10px 12px;
  color: var(--ink-700);
  background: var(--surface-soft);
  border-left: 3px solid var(--info);
  font-size: 12px;
}

.toast {
  position: fixed;
  z-index: 110;
  top: calc(var(--topbar-h) + 14px);
  left: 50%;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  width: min(420px, calc(100vw - 28px));
  min-height: 48px;
  padding: 9px 11px;
  color: #ffffff;
  background: var(--ink-900);
  border: 1px solid #4f6b64;
  border-left: 4px solid var(--signal);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  transform: translateX(-50%);
  animation: toast-in 180ms ease-out both;
}

.toast.is-success {
  border-left-color: #78a874;
}

.toast.is-error {
  border-left-color: #e27960;
}

.toast-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: var(--ink-950);
  background: var(--signal);
  border-radius: 4px;
}

.toast-copy {
  min-width: 0;
}

.toast-copy strong,
.toast-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toast-copy strong {
  font-size: 12px;
}

.toast-copy span {
  color: #b8c8c1;
  font-size: 10px;
}

.toast .icon-button {
  --control-h: 28px;
  flex-basis: 28px;
  color: #b8c8c1;
  border-color: transparent;
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 6px;
  color: var(--ink-700);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 3px;
  font-size: 9px;
  font-weight: 800;
  white-space: nowrap;
}

.badge.is-success {
  color: #315d3d;
  background: var(--leaf-soft);
  border-color: #b5ceb2;
}

.badge.is-warning {
  color: #6e5416;
  background: var(--signal-soft);
  border-color: #e5ca80;
}

.badge.is-danger {
  color: #803d2f;
  background: var(--danger-soft);
  border-color: #e6b9ac;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

[hidden] {
  display: none !important;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, -8px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

@media (max-width: 1180px) {
  :root {
    --inventory-h: 250px;
  }

  .topbar {
    grid-template-columns: minmax(170px, 1fr) auto minmax(170px, 1fr);
    padding: 0 12px;
  }

  .brand-subtitle,
  .stat-pill span {
    display: none;
  }

  .game-main,
  .workspace,
  .app-shell > main {
    grid-template-columns: minmax(0, 1fr) 294px;
  }

  .inventory-band {
    grid-template-columns: minmax(0, 1fr) minmax(340px, 400px);
  }

  .item-grid {
    grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  }

  .merge-workbench {
    gap: 5px;
  }

  .slot {
    height: 78px;
  }
}

@media (max-width: 900px) {
  body {
    overflow: auto;
  }

  .app-shell {
    grid-template-rows: auto 540px auto;
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }

  .topbar {
    grid-template-columns: minmax(160px, 1fr) auto;
    min-height: var(--topbar-h);
    height: auto;
  }

  .day-meter {
    display: none;
  }

  .game-main,
  .workspace,
  .app-shell > main {
    grid-template-columns: minmax(0, 1fr) 270px;
    min-height: 540px;
  }

  .inventory-band {
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .inventory-wrap {
    min-height: 218px;
  }

  .item-grid {
    max-height: 180px;
  }

  .merge-dock {
    min-height: 220px;
    border-top: 1px solid #4e6962;
    border-left: 0;
  }
}

@media (max-width: 680px) {
  .app-shell {
    grid-template-rows: auto auto auto;
  }

  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 8px 10px;
  }

  .brand-mark {
    width: 30px;
    height: 30px;
    flex-basis: 30px;
  }

  .brand-title {
    font-size: 14px;
  }

  .resource-pills .stat-pill:not(:first-child) {
    display: none;
  }

  .game-main,
  .workspace,
  .app-shell > main {
    display: flex;
    flex-direction: column;
    overflow: visible;
  }

  .map-panel {
    flex: 0 0 420px;
    min-height: 420px;
    border-right: 0;
    border-bottom: 1px solid var(--line-strong);
  }

  .scene {
    background-size: auto 100%;
  }

  .side-panel {
    max-height: none;
    overflow: visible;
  }

  .action-log {
    max-height: 180px;
  }

  .inventory-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .inventory-filters,
  .segmented-control {
    width: 100%;
    overflow-x: auto;
  }

  .item-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: 350px;
  }

  .merge-workbench {
    grid-template-columns: minmax(80px, 1fr) 24px minmax(80px, 1fr);
  }

  .merge-workbench .merge-operator.is-arrow {
    display: none;
  }

  .slot-result {
    grid-column: 1 / -1;
    width: 100%;
    height: 64px;
  }

  .merge-actions {
    margin-top: 10px;
  }

  .modal {
    align-items: end;
    padding: 10px;
  }

  .modal-dialog {
    max-height: calc(100dvh - 20px);
  }
}

}

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

@media print {
  body {
    overflow: visible;
  }

  .app-shell {
    height: auto;
  }

  .icon-button,
  .merge-actions,
  .toast,
  .modal {
    display: none !important;
  }
}

/* Prototype document integration */
@media (min-width: 1001px) {
  .app-shell {
    grid-template-columns: minmax(220px, 258px) minmax(480px, 1fr) minmax(286px, 330px);
    grid-template-rows: var(--topbar-h) minmax(0, 1fr) var(--inventory-h);
  }

  .app-shell > .topbar {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .app-shell > .map-panel {
    grid-column: 1;
    grid-row: 2;
  }

  .app-shell > .scene {
    grid-column: 2;
    grid-row: 2;
  }

  .app-shell > .side-panel {
    grid-column: 3;
    grid-row: 2;
  }

  .app-shell > .inventory-band {
    grid-column: 1 / -1;
    grid-row: 3;
  }
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-lockup > div {
  min-width: 0;
}

.brand-lockup h1,
.brand-lockup p {
  overflow: hidden;
  margin: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-lockup h1 {
  color: #ffffff;
  font-size: 17px;
  line-height: 1.15;
}

.brand-lockup p {
  margin-top: 2px;
  color: #afc0b9;
  font-size: 10px;
}

.protocol-mark {
  position: relative;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  background: var(--signal);
  border: 2px solid #f5d58a;
  border-radius: 4px;
}

.protocol-mark::before,
.protocol-mark::after {
  position: absolute;
  content: "";
}

.protocol-mark::before {
  top: 7px;
  left: 15px;
  width: 4px;
  height: 17px;
  background: var(--ink-950);
  border-radius: 1px;
}

.protocol-mark::after {
  top: 14px;
  left: 8px;
  width: 18px;
  height: 4px;
  background: var(--ink-950);
  border-radius: 1px;
}

.time-status {
  display: grid;
  grid-template-columns: auto minmax(92px, 160px) auto;
  align-items: center;
  justify-self: center;
  gap: 11px;
  min-width: 0;
}

.day-label {
  display: grid;
  min-width: 62px;
}

.day-label strong {
  color: #ffffff;
  font-size: 13px;
}

.day-label span,
.weather-label {
  color: #b7c6c0;
  font-size: 10px;
  white-space: nowrap;
}

.weather-label {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 8px;
  color: #dce8e3;
  background: #29443f;
  border: 1px solid #4b6861;
  border-radius: 4px;
}

.period-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  align-items: center;
  gap: 3px;
  min-width: 92px;
  height: 24px;
}

.period-track > * {
  min-width: 14px;
  height: 6px;
  overflow: hidden;
  background: #526d66;
  border-radius: 2px;
  color: transparent;
  font-size: 0;
}

.period-track > .active,
.period-track > .is-active,
.period-track > [aria-current="true"] {
  background: var(--signal);
}

.period-track > .complete,
.period-track > .is-complete {
  background: #6c9a69;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}

.top-actions .icon-button {
  --control-h: 34px;
  flex-basis: 34px;
  color: #d9e5df;
  border-color: #4c6861;
}

.top-actions .danger-quiet:hover {
  color: #ffd9cf;
  background: #5c352f;
  border-color: #9c5e51;
}

.app-shell > .map-panel {
  position: relative;
  inset: auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 14px 12px;
  overflow: auto;
  background: #edf0ea;
  border-right: 1px solid var(--line-strong);
  scrollbar-color: var(--ink-300) transparent;
  scrollbar-width: thin;
}

.map-panel > .panel-heading,
.side-panel .panel-heading {
  min-height: 24px;
  margin-bottom: 8px;
  color: var(--ink-950);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.panel-meta {
  color: var(--ink-500);
  font-size: 10px;
  font-weight: 700;
  text-transform: none;
  white-space: nowrap;
}

.location-list {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.location-list .location-button,
.location-list .map-node,
.location-list > button {
  position: relative;
  inset: auto;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  width: 100%;
  max-width: none;
  min-height: 48px;
  padding: 7px;
  color: var(--ink-900);
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--info);
  box-shadow: none;
  font-size: 11px;
}

.location-list .location-button:hover,
.location-list .map-node:hover,
.location-list > button:hover,
.location-list .active,
.location-list .is-active {
  color: var(--ink-950);
  background: var(--signal-soft);
  border-color: #d8ba69;
  border-left-color: var(--signal);
  transform: translateX(2px);
}

.location-list i,
.location-list svg {
  width: 18px;
  height: 18px;
}

.location-list button > span,
.location-list button > div {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.crew-heading {
  margin-top: 18px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}

.map-panel .crew-list {
  min-height: 0;
}

.app-shell > .scene {
  position: relative;
  inset: auto;
  display: block;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--sea);
  border-right: 1px solid var(--line-strong);
}

.scene-art {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scene-vignette {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: transparent;
  border: 12px solid rgba(20, 40, 38, 0.06);
  pointer-events: none;
}

.world-object {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  max-width: 150px;
  padding: 5px 8px;
  color: var(--ink-950);
  background: rgba(255, 252, 237, 0.96);
  border: 2px solid var(--signal);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  font-size: 10px;
  font-weight: 800;
}

.world-object i,
.world-object svg {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
}

.world-object span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shelter-object { left: 39%; top: 67%; }
.fire-object { left: 55%; top: 70%; }
.collector-object { left: 62%; top: 56%; }
.beacon-object { left: 62%; top: 25%; }
.seedbed-object { left: 46%; top: 48%; }
.ruin-object { left: 72%; top: 39%; }

.scene-brief {
  position: absolute;
  z-index: 8;
  right: 14px;
  bottom: 14px;
  left: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 16px;
  min-width: 0;
  padding: 13px 14px;
  color: #f7f8f3;
  background: rgba(23, 40, 39, 0.92);
  border: 1px solid rgba(221, 232, 226, 0.24);
  border-left: 4px solid var(--signal);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

.scene-brief > div {
  min-width: 0;
}

.event-eyebrow {
  color: #f2ca72;
  font-size: 9px;
  font-weight: 850;
  text-transform: uppercase;
}

.scene-brief h2 {
  margin: 2px 0 3px;
  overflow: hidden;
  color: #ffffff;
  font-size: 15px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scene-brief p {
  display: -webkit-box;
  max-width: 670px;
  margin: 0;
  overflow: hidden;
  color: #c2d0ca;
  font-size: 11px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.command-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 0;
  height: var(--control-h);
  padding: 0 13px;
  color: var(--ink-950);
  background: var(--signal);
  border: 1px solid #f2c96e;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.command-button:hover:not(:disabled) {
  background: #f0be56;
}

.command-button i,
.command-button svg {
  flex: 0 0 17px;
  width: 17px;
  height: 17px;
}

.quiet-command {
  color: #f0f4f1;
  background: var(--ink-800);
  border-color: #5f7b73;
}

.quiet-command:hover:not(:disabled) {
  background: #36584f;
}

.app-shell > .side-panel {
  border-left: 0;
}

.status-section {
  flex: 0 0 auto;
  min-width: 0;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
}

.status-list {
  display: grid;
  gap: 6px;
}

.status-list > * {
  min-width: 0;
}

.route-section {
  background: #faf9f2;
}

.route-section .route-status {
  grid-template-columns: 1fr;
  padding: 0;
  background: transparent;
  border: 0;
}

.log-section {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}

.log-section .action-log {
  margin: 0;
  padding-left: 0;
  list-style: none;
}

.app-shell > .inventory-band {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 10px 14px 8px;
  overflow: hidden;
  background: #e7ebe5;
}

.inventory-head {
  display: flex;
  flex: 0 0 33px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  min-width: 0;
}

.inventory-head > div:first-child {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.inventory-head h2 {
  margin: 0;
  color: var(--ink-950);
  font-size: 13px;
  white-space: nowrap;
}

.inventory-head span {
  color: var(--ink-500);
  font-size: 10px;
}

.segmented-control .segment.active {
  color: var(--ink-950);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.inventory-workspace {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(510px, 44%);
  flex: 1 1 auto;
  gap: 12px;
  min-width: 0;
  min-height: 0;
}

.inventory-workspace > .item-grid {
  grid-auto-rows: 68px;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  min-height: 0;
}

.inventory-workspace .item-card {
  height: 68px;
}

.inventory-workspace > .merge-dock {
  display: grid;
  grid-template-columns: 78px 20px 78px minmax(190px, 1fr);
  grid-template-rows: minmax(0, 1fr);
  align-items: stretch;
  gap: 7px;
  min-width: 0;
  min-height: 0;
  padding: 9px;
  border: 1px solid #506a63;
  border-radius: var(--radius);
}

.slot-column {
  display: grid;
  grid-template-rows: 17px minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
}

.slot-label {
  overflow: hidden;
  color: #aebfb8;
  font-size: 9px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.slot-column .slot {
  width: 100%;
  height: 100%;
  min-height: 70px;
}

.slot-column .slot i,
.slot-column .slot svg {
  width: 18px;
  height: 18px;
}

.merge-symbol {
  display: grid;
  place-items: center;
  padding-top: 17px;
  color: #bfcec8;
  font-size: 20px;
}

.merge-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 0;
  padding-left: 9px;
  border-left: 1px solid #506a63;
}

.relation-preview {
  min-width: 0;
}

.relation-preview > * {
  display: block;
  min-width: 0;
}

.preview-kicker {
  margin-bottom: 3px;
  color: #eac36c;
  font-size: 9px;
  font-weight: 800;
}

.relation-preview strong {
  overflow: hidden;
  color: #ffffff;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.relation-preview p {
  display: -webkit-box;
  margin: 3px 0 0;
  overflow: hidden;
  color: #aebfb8;
  font-size: 9px;
  line-height: 1.3;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.relation-choices {
  min-width: 0;
}

.merge-result .primary-action {
  min-width: 104px;
  height: 34px;
  padding: 0 10px;
}

.day-controls {
  display: flex;
  flex: 0 0 35px;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.day-controls > span {
  overflow: hidden;
  color: var(--ink-500);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.day-controls .command-button {
  height: 30px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
}

.modal .modal-dialog {
  position: relative;
  z-index: 1;
  padding-top: 20px;
}

.modal-close {
  --control-h: 32px;
  position: absolute;
  z-index: 2;
  top: 10px;
  right: 10px;
  flex-basis: 32px;
  color: var(--ink-700);
  border-color: var(--line);
}

.modal-eyebrow {
  display: block;
  padding: 0 18px;
  color: var(--info);
  font-size: 9px;
  font-weight: 850;
  text-transform: uppercase;
}

.modal-dialog > h2 {
  margin: 4px 52px 11px 18px;
  color: var(--ink-950);
  font-size: 18px;
}

@media (max-width: 1220px) and (min-width: 1001px) {
  .app-shell {
    grid-template-columns: 220px minmax(440px, 1fr) 286px;
  }

  .weather-label {
    display: none;
  }

  .time-status {
    grid-template-columns: auto minmax(90px, 140px);
  }

  .inventory-workspace {
    grid-template-columns: minmax(280px, 1fr) minmax(470px, 46%);
  }

  .inventory-workspace > .merge-dock {
    grid-template-columns: 70px 18px 70px minmax(170px, 1fr);
  }

  .merge-result .primary-action span {
    display: none;
  }

  .merge-result .primary-action {
    min-width: 36px;
    width: 36px;
    padding: 0;
  }
}

@media (max-width: 680px) {
  .app-shell > .scene {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 1000px) {
  body {
    overflow: auto;
  }

  .app-shell {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    grid-template-rows: auto 520px auto auto;
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }

  .app-shell > .topbar {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .app-shell > .map-panel {
    grid-column: 1;
    grid-row: 2;
    max-height: 520px;
  }

  .app-shell > .scene {
    grid-column: 2;
    grid-row: 2;
    min-height: 520px;
  }

  .app-shell > .side-panel {
    display: grid;
    grid-column: 1 / -1;
    grid-row: 3;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    min-height: 230px;
    overflow: visible;
    border-top: 1px solid var(--line-strong);
  }

  .side-panel .status-section {
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }

  .side-panel .status-section:last-child {
    border-right: 0;
  }

  .log-section .action-log {
    max-height: 160px;
  }

  .app-shell > .inventory-band {
    grid-column: 1 / -1;
    grid-row: 4;
    min-height: 330px;
  }

  .inventory-workspace {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 150px 130px;
  }

  .inventory-workspace > .item-grid {
    max-height: 150px;
  }

  .inventory-workspace > .merge-dock {
    grid-template-columns: 82px 24px 82px minmax(0, 1fr);
  }
}

@media (max-width: 680px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto 410px auto auto auto;
  }

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

  .time-status {
    display: none;
  }

  .app-shell > .scene {
    grid-column: 1;
    grid-row: 2;
    min-height: 410px;
  }

  .app-shell > .map-panel {
    grid-column: 1;
    grid-row: 3;
    max-height: none;
    border-top: 1px solid var(--line-strong);
  }

  .location-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .map-panel .crew-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-shell > .side-panel {
    display: flex;
    grid-column: 1;
    grid-row: 4;
    flex-direction: column;
  }

  .side-panel .status-section {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .app-shell > .inventory-band {
    grid-column: 1;
    grid-row: 5;
    min-height: 490px;
  }

  .inventory-head {
    flex-basis: auto;
    flex-direction: column;
    margin-bottom: 8px;
  }

  .inventory-head .segmented-control {
    width: 100%;
  }

  .inventory-workspace {
    grid-template-rows: 230px 184px;
  }

  .inventory-workspace > .item-grid {
    max-height: 230px;
  }

  .inventory-workspace > .merge-dock {
    grid-template-columns: 68px 18px 68px minmax(0, 1fr);
  }

  .merge-result {
    grid-template-columns: minmax(0, 1fr) 36px;
  }

  .merge-result .primary-action {
    min-width: 36px;
    width: 36px;
    padding: 0;
  }

  .merge-result .primary-action span {
    display: none;
  }

  .scene-brief {
    grid-template-columns: minmax(0, 1fr);
  }

  .scene-brief .command-button {
    width: 100%;
  }

  .modal {
    align-items: center;
  }
}

/* v0.2 experience and layout overrides */
:root {
  --topbar-h: 68px;
  --inventory-h: clamp(238px, 32dvh, 304px);
  --scene-min-h: 410px;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}

.app-shell {
  height: auto;
  min-height: max(100dvh, 720px);
  overflow: visible;
}

.topbar {
  position: sticky;
  top: 0;
  grid-template-columns: minmax(180px, 1fr) minmax(350px, auto) minmax(150px, 1fr);
}

.time-status {
  grid-template-columns: auto minmax(148px, 190px) auto;
  gap: 10px;
}

.action-budget {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 2px 10px;
  min-width: 148px;
  padding: 6px 9px;
  color: #dce8e3;
  background: #29443f;
  border: 1px solid #536f68;
  border-radius: var(--radius);
}

.action-budget > span {
  overflow: hidden;
  color: #b8c8c1;
  font-size: 9px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.action-budget > strong {
  color: #ffffff;
  font-size: 11px;
  white-space: nowrap;
}

.action-budget .period-track {
  grid-column: 1 / -1;
  min-width: 0;
  height: 8px;
}

.period-track > .period-dot.done {
  background: #78a874;
}

.period-track > .period-dot.current {
  background: var(--signal);
  box-shadow: 0 0 0 2px rgba(232, 174, 63, 0.2);
}

.period-track > .period-dot.future {
  background: #5b746d;
}

.objective-section {
  background: #fffaf0;
  border-bottom-color: #e6d49f;
}

.compact-objectives {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.compact-objectives li,
.compact-objectives > * {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  min-width: 0;
  min-height: 28px;
  padding: 4px 0;
  color: var(--ink-800);
  font-size: 11px;
  font-weight: 700;
}

.compact-objectives svg {
  width: 16px;
  height: 16px;
  color: var(--signal);
}

.compact-objectives .done,
.compact-objectives .is-complete {
  color: var(--leaf);
}

.app-shell > .side-panel {
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-color: var(--ink-300) transparent;
  scrollbar-width: thin;
}

.route-section,
.log-section {
  flex: 0 0 auto;
}

.log-section .action-log {
  max-height: 180px;
}

.scene-art {
  transform: scale(1.06);
  transform-origin: center;
  transition: filter 420ms ease, opacity 240ms ease, transform 540ms cubic-bezier(0.22, 0.75, 0.22, 1);
  will-change: transform;
}

.scene[data-location="coast"] .scene-art {
  transform: scale(1.28) translate(13%, -8%);
}

.scene[data-location="tidal_flat"] .scene-art {
  transform: scale(1.34) translate(4%, -15%);
}

.scene[data-location="rainforest"] .scene-art {
  transform: scale(1.36) translate(13%, 7%);
}

.scene[data-location="crash_trail"] .scene-art {
  transform: scale(1.24) translate(2%, -4%);
}

.scene[data-location="highland"] .scene-art {
  transform: scale(1.34) translate(-9%, 8%);
}

.scene[data-location="ruins"] .scene-art {
  transform: scale(1.42) translate(-18%, -1%);
}

.scene[data-explored="false"] .scene-art,
.scene.is-unexplored .scene-art {
  filter: saturate(0.62) brightness(0.78) contrast(0.94);
}

.scene-location-nav {
  position: absolute;
  z-index: 7;
  top: 14px;
  right: 14px;
  display: grid;
  gap: 6px;
  width: min(188px, calc(100% - 28px));
  pointer-events: auto;
}

.scene-location-nav:empty {
  display: none;
}

.scene-location-nav button,
.scene-location-chip {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  min-width: 0;
  min-height: 38px;
  padding: 5px 7px;
  color: var(--ink-950);
  background: rgba(255, 255, 250, 0.94);
  border: 1px solid rgba(32, 54, 51, 0.42);
  border-left: 3px solid var(--info);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  font-size: 10px;
  font-weight: 800;
  text-align: left;
}

.scene-location-nav button:hover,
.scene-location-nav button.active,
.scene-location-nav button.is-active {
  background: #fff8e6;
  border-left-color: var(--signal);
}

.scene-location-nav button > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scene-location-nav svg {
  width: 16px;
  height: 16px;
}

.scene-brief {
  right: auto;
  bottom: 14px;
  left: 14px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  width: min(520px, calc(100% - 28px));
  padding: 11px 12px;
  border-left-width: 4px;
}

.mission-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.day-mission-label {
  overflow: hidden;
  color: #ffe09b;
  font-size: 9px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mission-meta .event-eyebrow {
  padding-left: 8px;
  border-left: 1px solid #667b75;
  color: #aebfb8;
  white-space: nowrap;
}

.scene-brief h2 {
  margin-top: 3px;
  font-size: 14px;
}

.scene-brief p {
  -webkit-line-clamp: 1;
}

.scene-brief .location-intel {
  margin-top: 4px;
  color: #f2d183;
  font-size: 10px;
}

.scene-command {
  display: grid;
  justify-items: stretch;
  gap: 4px;
  min-width: 142px;
}

.scene-command .command-button {
  width: 100%;
}

.explore-meta {
  color: #aebfb8;
  font-size: 9px;
  text-align: center;
}

.world-object {
  transition: opacity 220ms ease, transform 300ms ease;
}

.world-object:not([hidden]) {
  animation: world-object-in 360ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.scene.revealing .scene-art,
.scene.is-revealing .scene-art {
  animation: scene-reveal 720ms ease-out both;
}

.scene.revealing .scene-vignette,
.scene.is-revealing .scene-vignette {
  animation: reveal-ring 620ms ease-out both;
}

.inventory-head {
  align-items: center;
}

.inventory-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.workspace-toggle {
  --control-h: 30px;
  flex: 0 0 30px;
  color: var(--ink-700);
  background: var(--surface);
  border-color: var(--line-strong);
}

.app-shell.workspace-collapsed,
.app-shell.is-workspace-collapsed {
  --inventory-h: 52px;
}

.inventory-band.is-collapsed,
.inventory-band.workspace-collapsed {
  min-height: 52px;
}

.inventory-band.is-collapsed .inventory-workspace,
.inventory-band.is-collapsed .day-controls,
.inventory-band.workspace-collapsed .inventory-workspace,
.inventory-band.workspace-collapsed .day-controls {
  display: none;
}

.inventory-band.is-collapsed .inventory-head,
.inventory-band.workspace-collapsed .inventory-head {
  flex-basis: 100%;
}

.inventory-workspace {
  grid-template-columns: minmax(380px, 1fr) minmax(500px, 42%);
}

.inventory-workspace > .item-grid {
  grid-auto-rows: 76px;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  align-content: start;
}

.inventory-workspace .item-card {
  grid-template-columns: 42px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  height: 76px;
  padding: 8px 28px 8px 8px;
}

.item-card.selected,
.item-card.is-selected {
  z-index: 2;
  border-color: var(--signal);
  box-shadow: 0 0 0 2px rgba(232, 174, 63, 0.22), 0 4px 12px rgba(30, 50, 46, 0.15);
  transform: translateY(-2px);
}

.item-card .item-name {
  display: -webkit-box;
  align-self: end;
  overflow: hidden;
  font-size: 11px;
  line-height: 1.25;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.item-tags {
  min-width: 0;
  overflow: hidden;
  color: var(--ink-500);
  font-size: 9px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-qty {
  position: absolute;
  right: 6px;
  bottom: 6px;
  display: grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 4px;
  color: #ffffff;
  background: var(--ink-800);
  border-radius: 3px;
  font-size: 10px;
  font-weight: 850;
}

.slot.filled,
.slot.is-filled {
  color: #ffffff;
  background: #294640;
  border-style: solid;
  border-color: var(--signal);
}

.slot.drag-over,
.slot.is-receiving {
  border-color: #f4d17d;
  box-shadow: 0 0 0 3px rgba(232, 174, 63, 0.22);
  animation: slot-receive 220ms ease-out;
}

.merge-dock {
  position: relative;
  overflow: hidden;
}

.merge-dock.combining,
.merge-dock.is-combining {
  pointer-events: none;
}

.merge-dock.combining::after,
.merge-dock.is-combining::after {
  position: absolute;
  z-index: 8;
  top: 50%;
  left: 20%;
  width: 60%;
  height: 2px;
  background: var(--signal);
  box-shadow: 0 0 14px rgba(244, 209, 125, 0.9);
  content: "";
  transform-origin: left;
  animation: relation-scan 420ms ease-in-out both;
}

.merge-dock.combining .slot,
.merge-dock.is-combining .slot {
  animation: slot-charge 420ms ease-in-out both;
}

.merge-dock.is-invalid,
.merge-dock.invalid {
  animation: dock-shake 240ms ease-out;
}

.relation-preview.is-result,
.relation-preview.result-pop {
  animation: result-pop 320ms cubic-bezier(0.2, 0.85, 0.25, 1.25) both;
}

.item-card.just-created,
.item-card.is-new-result {
  animation: item-created 1.6s ease-out both;
}

.status-row.just-completed,
.status-row.is-newly-complete,
.route-item.just-progressed {
  animation: milestone-complete 900ms ease-out both;
}

.action-feedback {
  position: fixed;
  z-index: 105;
  top: calc(var(--topbar-h) + 14px);
  left: 50%;
  display: grid;
  grid-template-columns: 1fr;
  gap: 3px;
  width: min(430px, calc(100vw - 28px));
  padding: 12px 14px;
  color: #ffffff;
  background: rgba(24, 47, 43, 0.98);
  border: 1px solid #5e7b72;
  border-left: 5px solid var(--signal);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  transform: translateX(-50%);
  animation: feedback-in 260ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.action-feedback.is-success {
  border-left-color: #78a874;
}

.action-feedback.is-error {
  border-left-color: var(--danger);
}

.feedback-kicker {
  color: #f2ca72;
  font-size: 9px;
  font-weight: 850;
}

.feedback-formula {
  overflow: hidden;
  color: #c2d0ca;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feedback-result-line {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  margin-top: 3px;
}

.feedback-result-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: var(--ink-950);
  background: var(--signal);
  border-radius: 4px;
}

.feedback-result-icon svg {
  width: 17px;
  height: 17px;
}

.feedback-result {
  min-width: 0;
  overflow: hidden;
  font-size: 14px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feedback-impact {
  margin: 2px 0 0 36px;
  color: #b8c8c1;
  font-size: 10px;
}

@keyframes scene-reveal {
  0% { filter: saturate(0.55) brightness(0.72); }
  45% { filter: saturate(1.35) brightness(1.12); }
  100% { filter: saturate(1) brightness(1); }
}

@keyframes reveal-ring {
  0% { border-width: 38px; border-color: rgba(232, 174, 63, 0.6); }
  100% { border-width: 12px; border-color: rgba(20, 40, 38, 0.06); }
}

@keyframes world-object-in {
  from { opacity: 0; transform: translateY(8px) scale(0.92); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes slot-receive {
  0% { transform: scale(0.96); }
  65% { transform: scale(1.04); }
  100% { transform: scale(1); }
}

@keyframes slot-charge {
  0%, 100% { filter: brightness(1); transform: scale(1); }
  55% { filter: brightness(1.45); transform: scale(0.96); }
}

@keyframes relation-scan {
  0% { opacity: 0; transform: scaleX(0); }
  45% { opacity: 1; transform: scaleX(1); }
  100% { opacity: 0; transform: scaleX(1); }
}

@keyframes dock-shake {
  0%, 100% { transform: translateX(0); }
  30% { transform: translateX(-5px); }
  60% { transform: translateX(4px); }
  80% { transform: translateX(-2px); }
}

@keyframes result-pop {
  from { opacity: 0; transform: translateY(5px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes item-created {
  0% { border-color: var(--signal); box-shadow: 0 0 0 0 rgba(232, 174, 63, 0.55); }
  45% { border-color: var(--signal); box-shadow: 0 0 0 5px rgba(232, 174, 63, 0.18); }
  100% { box-shadow: 0 0 0 0 rgba(232, 174, 63, 0); }
}

@keyframes milestone-complete {
  0% { background: #fff4cf; box-shadow: inset 0 0 0 2px rgba(232, 174, 63, 0.58); }
  100% { box-shadow: inset 0 0 0 0 rgba(232, 174, 63, 0); }
}

@keyframes feedback-in {
  from { opacity: 0; transform: translate(-50%, -10px) scale(0.98); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

@media (min-width: 1001px) {
  .app-shell {
    grid-template-columns: 226px minmax(520px, 1fr) minmax(292px, 320px);
    grid-template-rows: var(--topbar-h) minmax(var(--scene-min-h), 1fr) var(--inventory-h);
  }

  .app-shell > .map-panel {
    overflow-y: auto;
  }
}

@media (max-height: 760px) and (min-width: 1001px) {
  :root {
    --inventory-h: 220px;
  }

  .app-shell {
    min-height: 704px;
  }

  .scene-brief {
    width: min(480px, calc(100% - 28px));
  }

  .scene-brief #eventText {
    display: none;
  }
}

@media (max-width: 1220px) and (min-width: 1001px) {
  .app-shell {
    grid-template-columns: 210px minmax(460px, 1fr) 286px;
  }

  .topbar {
    grid-template-columns: minmax(166px, 1fr) minmax(290px, auto) minmax(130px, 1fr);
  }

  .time-status {
    grid-template-columns: auto minmax(138px, 168px);
  }

  .inventory-workspace {
    grid-template-columns: minmax(330px, 1fr) minmax(460px, 44%);
  }
}

@media (max-width: 1000px) {
  :root {
    --inventory-h: auto;
  }

  .app-shell {
    grid-template-columns: 210px minmax(0, 1fr);
    grid-template-rows: auto 500px auto auto;
    min-height: 100dvh;
  }

  .topbar {
    position: sticky;
    grid-template-columns: minmax(160px, 1fr) minmax(310px, auto) minmax(120px, 1fr);
  }

  .app-shell > .side-panel {
    overflow: visible;
  }

  .app-shell > .inventory-band {
    min-height: 340px;
    overflow: visible;
  }

  .inventory-workspace {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 170px minmax(132px, auto);
  }

  .inventory-workspace > .item-grid {
    max-height: 170px;
  }

  .inventory-workspace > .merge-dock {
    grid-template-columns: 82px 24px 82px minmax(0, 1fr);
  }
}

@media (max-width: 680px) {
  :root {
    --topbar-h: 94px;
  }

  .app-shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto auto auto;
    min-height: 100dvh;
  }

  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: 48px 38px;
    gap: 0 8px;
    min-height: var(--topbar-h);
    padding: 4px 8px;
  }

  .brand-lockup {
    grid-column: 1;
    grid-row: 1;
  }

  .brand-lockup p {
    display: none;
  }

  .protocol-mark {
    flex-basis: 30px;
    width: 30px;
    height: 30px;
  }

  .protocol-mark::before {
    top: 5px;
    left: 13px;
  }

  .protocol-mark::after {
    top: 12px;
    left: 6px;
  }

  .time-status {
    display: grid;
    grid-column: 1 / -1;
    grid-row: 2;
    grid-template-columns: auto minmax(0, 1fr);
    justify-self: stretch;
  }

  .day-label {
    grid-template-columns: auto auto;
    align-items: center;
    gap: 6px;
    min-width: 92px;
  }

  .day-label span {
    overflow: hidden;
    max-width: 62px;
    text-overflow: ellipsis;
  }

  .weather-label {
    display: none;
  }

  .action-budget {
    min-width: 0;
    height: 34px;
    padding: 4px 7px;
  }

  .action-budget .period-track {
    height: 5px;
  }

  .top-actions {
    grid-column: 2;
    grid-row: 1;
    gap: 5px;
  }

  .top-actions .icon-button {
    --control-h: 36px;
    flex-basis: 36px;
  }

  .app-shell > .scene {
    display: grid;
    grid-column: 1;
    grid-row: 2;
    grid-template-rows: 232px auto;
    min-height: 0;
    overflow: visible;
  }

  .scene-art {
    position: relative;
    grid-column: 1;
    grid-row: 1;
    height: 232px;
    min-height: 232px;
    object-fit: cover;
    overflow: hidden;
  }

  .scene-vignette,
  .scene-overlay {
    top: 0;
    bottom: auto;
    height: 232px;
    overflow: hidden;
  }

  .scene-location-nav {
    top: 8px;
    right: 8px;
    display: flex;
    width: calc(100% - 16px);
    overflow-x: auto;
    scrollbar-width: none;
  }

  .scene-location-nav::-webkit-scrollbar {
    display: none;
  }

  .scene-location-nav button,
  .scene-location-chip {
    flex: 0 0 auto;
    min-width: 122px;
  }

  .scene-brief {
    position: relative;
    inset: auto;
    grid-column: 1;
    grid-row: 2;
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
    padding: 11px 12px 12px;
    border-width: 1px 0 0;
    border-top: 4px solid var(--signal);
    border-radius: 0;
    box-shadow: none;
  }

  .scene-brief #eventText {
    display: none;
  }

  .scene-command {
    min-width: 0;
  }

  .scene-command .command-button {
    min-height: 44px;
  }

  .app-shell > .map-panel {
    grid-column: 1;
    grid-row: 3;
    max-height: none;
    overflow: visible;
  }

  .location-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .location-list .location-button,
  .location-list .map-node,
  .location-list > button {
    min-height: 52px;
  }

  .map-panel .crew-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .app-shell > .inventory-band {
    grid-column: 1;
    grid-row: 4;
    min-height: 0;
    padding: 11px 10px 10px;
    overflow: visible;
  }

  .inventory-head {
    align-items: stretch;
    gap: 8px;
  }

  .inventory-head > div:first-child {
    min-height: 24px;
  }

  .inventory-tools {
    width: 100%;
  }

  .segmented-control {
    justify-content: flex-start;
    width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .segmented-control::-webkit-scrollbar {
    display: none;
  }

  .segmented-control .segment {
    flex: 0 0 auto;
    min-height: 36px;
  }

  .workspace-toggle {
    --control-h: 40px;
    flex-basis: 40px;
  }

  .inventory-workspace {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 300px auto;
    gap: 10px;
  }

  .inventory-workspace > .item-grid {
    grid-auto-rows: 80px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: 300px;
  }

  .inventory-workspace .item-card {
    height: 80px;
  }

  .item-card .item-name {
    font-size: 11px;
  }

  .item-tags {
    font-size: 8px;
  }

  .inventory-workspace > .merge-dock {
    grid-template-columns: minmax(0, 1fr) 22px minmax(0, 1fr);
    grid-template-rows: 96px auto;
    gap: 8px;
    min-height: 0;
    padding: 10px;
  }

  .slot-column .slot {
    min-height: 76px;
  }

  .merge-symbol {
    padding-top: 17px;
  }

  .merge-result {
    grid-column: 1 / -1;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    gap: 8px;
    padding: 10px 0 0;
    border-top: 1px solid #506a63;
    border-left: 0;
  }

  .merge-result .primary-action {
    width: 100%;
    min-width: 0;
    min-height: 44px;
  }

  .merge-result .primary-action span {
    display: inline;
  }

  .day-controls {
    flex-basis: auto;
    align-items: center;
    justify-content: space-between;
    min-height: 48px;
  }

  .day-controls > span {
    white-space: normal;
  }

  .day-controls .command-button {
    min-height: 44px;
  }

  .app-shell > .side-panel {
    display: flex;
    grid-column: 1;
    grid-row: 5;
    flex-direction: column;
    min-height: 0;
    overflow: visible;
  }

  .side-panel .status-section {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .log-section .action-log {
    max-height: none;
  }

  .action-feedback {
    top: calc(var(--topbar-h) + 8px);
    width: calc(100vw - 20px);
  }

  .toast {
    top: calc(var(--topbar-h) + 8px);
  }

  .modal {
    padding: 12px;
  }

  .modal-actions {
    flex-direction: column-reverse;
  }

  .modal-actions .modal-action {
    width: 100%;
    min-height: 44px;
  }
}

@media (max-width: 420px) {
  .brand-lockup h1 {
    font-size: 15px;
  }

  .item-tags {
    display: none;
  }

  .inventory-workspace .item-card {
    grid-template-rows: minmax(0, 1fr);
  }

  .action-budget > span {
    font-size: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }

  .scene-art {
    will-change: auto;
  }
}

/* v0.2 runtime class alignment */
.compact-objectives > .objective-row {
  grid-template-columns: 20px minmax(0, 1fr);
  width: 100%;
  min-height: 46px;
  padding: 7px 8px;
  color: var(--ink-800);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid #e5ddc6;
  border-left: 3px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  text-align: left;
}

.compact-objectives > .objective-row:hover,
.compact-objectives > .objective-row.active {
  background: #ffffff;
  border-left-color: var(--signal);
}

.compact-objectives > .objective-row.done {
  color: var(--leaf);
  background: var(--leaf-soft);
  border-color: #bdd0ba;
}

.objective-row > span,
.crew-copy,
.status-row > span {
  min-width: 0;
}

.objective-row strong,
.objective-row small,
.crew-copy strong,
.crew-copy small,
.status-row strong,
.status-row small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.objective-row strong,
.crew-copy strong,
.status-row strong {
  color: var(--ink-950);
  font-size: 11px;
}

.objective-row small,
.crew-copy small,
.status-row small {
  margin-top: 1px;
  color: var(--ink-500);
  font-size: 9px;
  white-space: nowrap;
}

.crew-row {
  width: 100%;
  cursor: pointer;
  text-align: left;
}

.crew-state.ready {
  color: var(--leaf);
}

.crew-state.risk {
  color: var(--danger);
}

.status-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 20px;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 48px;
  padding: 7px 8px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-left: 3px solid var(--danger);
  border-radius: 4px;
}

.status-row > svg:first-child {
  width: 20px;
  height: 20px;
}

.status-row .status-mark {
  width: 18px;
  height: 18px;
  color: var(--danger);
}

.status-row.partial {
  background: var(--signal-soft);
  border-left-color: var(--signal);
}

.status-row.partial .status-mark {
  color: #8b681d;
}

.status-row.done {
  background: var(--leaf-soft);
  border-color: #bdd0ba;
  border-left-color: var(--leaf);
}

.status-row.done .status-mark {
  color: var(--leaf);
}

.route-status {
  display: grid;
  gap: 8px;
}

.route-item {
  min-width: 0;
  padding: 9px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-left: 3px solid var(--info);
  border-radius: 4px;
}

.route-item.ready {
  background: var(--leaf-soft);
  border-left-color: var(--leaf);
}

.route-item.closed {
  opacity: 0.58;
}

.route-title {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.route-title svg {
  width: 16px;
  height: 16px;
}

.route-title strong {
  overflow: hidden;
  color: var(--ink-950);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.route-title > span {
  color: var(--ink-500);
  font-size: 9px;
  font-weight: 800;
}

.route-item .route-progress {
  width: 100%;
  height: 5px;
  margin-top: 7px;
  overflow: hidden;
  background: #d9dfda;
  border-radius: 2px;
}

.route-item .route-progress > span {
  display: block;
  height: 100%;
  background: var(--info);
}

.route-item p {
  margin: 6px 0 0;
  color: var(--ink-500);
  font-size: 9px;
}

.route-requirements {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 6px;
  margin-top: 6px;
}

.route-requirements > span {
  color: var(--ink-500);
  font-size: 8px;
}

.route-requirements > .met {
  color: var(--leaf);
  font-weight: 750;
}

.action-log > li {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 7px;
  padding: 7px 2px;
  color: var(--ink-700);
  border-bottom: 1px solid var(--line);
  font-size: 9px;
}

.action-log > li > span {
  color: var(--ink-500);
  white-space: nowrap;
}

.action-log > li > p {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.action-budget.empty {
  color: #ffd5cb;
  background: #54372f;
  border-color: #936153;
}

.location-list .location-button {
  grid-template-columns: 30px minmax(0, 1fr) auto 18px;
}

.location-list .location-cost {
  color: var(--ink-500);
  font-size: 9px;
  font-weight: 800;
  white-space: nowrap;
}

.location-list .location-check {
  width: 16px;
  height: 16px;
  color: var(--leaf);
}

.item-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  max-width: 60px;
  padding: 1px 4px;
  overflow: hidden;
  color: #60470d;
  background: var(--signal-soft);
  border: 1px solid #dfc273;
  border-radius: 3px;
  font-size: 8px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-badge.excluded-badge {
  color: var(--ink-500);
  background: var(--surface-soft);
  border-color: var(--line);
}

.item-card.suggested {
  border-color: #d4b45c;
}

.item-card.excluded {
  opacity: 0.62;
}

.action-feedback.tone-success {
  border-left-color: #78a874;
}

.action-feedback.tone-warning {
  border-left-color: var(--signal);
}

.action-feedback.tone-error,
.action-feedback.tone-failure {
  border-left-color: var(--danger);
}

.feedback-impact {
  display: grid;
  gap: 2px;
}

.feedback-impact > span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.feedback-impact svg {
  flex: 0 0 12px;
  width: 12px;
  height: 12px;
  color: #9bc197;
}

.toast.tone-success {
  border-left-color: #78a874;
}

.toast.tone-warning {
  border-left-color: var(--signal);
}

.toast.tone-error,
.toast.tone-failure {
  border-left-color: var(--danger);
}

@media (min-width: 1001px) {
  .app-shell {
    grid-template-rows: var(--topbar-h) clamp(500px, calc(100dvh - var(--topbar-h)), 680px) auto;
  }

  .scene-brief {
    top: 14px;
    right: auto;
    bottom: auto;
    left: 14px;
    width: min(440px, calc(100% - 230px));
  }

  .app-shell > .side-panel,
  .app-shell > .map-panel {
    min-height: 0;
    overflow-y: auto;
  }
}

@media (max-width: 1220px) and (min-width: 1001px) {
  .scene-brief {
    grid-template-columns: minmax(0, 1fr);
  }

  .scene-command {
    min-width: 0;
  }
}

/* v0.3: crew -> exploration -> insight -> synthesis -> route */
.crew-row.active {
  background: #fff6d8;
  border-color: var(--signal);
  box-shadow: inset 3px 0 0 var(--signal);
}

.crew-row.unavailable {
  background: #f1f2ee;
}

.crew-copy strong {
  display: flex;
  align-items: baseline;
  gap: 5px;
}

.crew-copy strong em {
  overflow: hidden;
  color: var(--ink-500);
  font-size: 8px;
  font-style: normal;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crew-copy small {
  display: -webkit-box;
  line-height: 1.25;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.crew-state b {
  display: block;
  margin-top: 3px;
  color: #8a671a;
  font-size: 8px;
  font-weight: 800;
}

.crew-context {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 2px 6px;
  margin-top: 8px;
  padding: 8px;
  color: var(--ink-700);
  background: #f8f1d9;
  border: 1px solid #ddc87f;
  border-radius: 4px;
}

.crew-context span,
.crew-context small {
  color: var(--ink-500);
  font-size: 8px;
}

.crew-context strong {
  font-size: 10px;
}

.crew-context small {
  grid-column: 1 / -1;
  line-height: 1.35;
}

.mission-flow {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-top: 7px;
  overflow-x: auto;
  scrollbar-width: none;
}

.app-shell > .scene {
  overflow-x: clip;
}

.mission-flow::-webkit-scrollbar {
  display: none;
}

.mission-flow > span {
  flex: 0 0 auto;
  padding: 3px 5px;
  color: #c8d3cf;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid #536b64;
  border-radius: 3px;
  font-size: 8px;
}

.mission-flow > span.done {
  color: #dcebd8;
  background: rgba(93, 140, 91, 0.3);
  border-color: #72966d;
}

.mission-flow > svg {
  flex: 0 0 10px;
  width: 10px;
  height: 10px;
  color: #8fa49d;
}

.explore-lead {
  display: grid;
  padding: 6px 7px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid #526a63;
  border-radius: 4px;
}

.explore-lead span,
.explore-lead small {
  color: #aebfb8;
  font-size: 8px;
}

.explore-lead strong {
  color: #ffffff;
  font-size: 10px;
}

.explore-lead.matched {
  background: rgba(100, 151, 94, 0.22);
  border-color: #72966d;
}

.route-item.ready .route-progress > span {
  background: var(--leaf);
}

.route-state-copy {
  line-height: 1.4;
}

.route-item.closed .route-state-copy {
  color: #9d3f31;
  font-weight: 750;
}

.route-requirements > span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.route-requirements em {
  padding: 1px 3px;
  color: #8b681d;
  background: #fff1be;
  border-radius: 2px;
  font-size: 7px;
  font-style: normal;
}

.inventory-head {
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr) auto;
  align-items: center;
  min-height: 44px;
}

.insight-bank {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.insight-bank::-webkit-scrollbar {
  display: none;
}

.insight-bank > span {
  display: inline-grid;
  flex: 0 0 auto;
  grid-template-columns: auto auto;
  gap: 0 4px;
  padding: 3px 5px;
  background: #f4f5f0;
  border: 1px solid var(--line);
  border-radius: 3px;
  font-size: 8px;
}

.insight-bank > span.active {
  background: #fff2c5;
  border-color: #d6b958;
}

.insight-bank b {
  color: var(--ink-900);
}

.insight-bank em {
  grid-column: 1 / -1;
  color: var(--ink-500);
  font-size: 7px;
  font-style: normal;
}

.inventory-workspace > .item-grid {
  grid-auto-rows: 76px;
  max-height: 244px;
  padding-right: 4px;
  overflow-y: auto;
  scrollbar-color: #8aa098 transparent;
  scrollbar-width: thin;
}

.inventory-workspace .item-card {
  height: 76px;
}

.item-card.affinity {
  border-color: #72a3aa;
  box-shadow: inset 0 -2px 0 rgba(52, 117, 129, 0.18);
}

.item-card.expert-confirmed {
  border-color: #d4a82f;
  box-shadow: 0 0 0 2px rgba(232, 174, 63, 0.2);
}

.item-card.verified {
  border-color: #74a26e;
}

.item-badge.affinity-badge {
  color: #1e5c65;
  background: #e2f1f1;
  border-color: #8ab9bd;
}

.item-badge.verified-badge {
  color: #356733;
  background: #e6f1e3;
  border-color: #95b78e;
}

.merge-result {
  grid-template-columns: minmax(0, 1fr) 112px;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  align-items: stretch;
}

.advisor-context {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 1px 6px;
  padding-bottom: 5px;
  border-bottom: 1px solid #506a63;
}

.advisor-context span,
.advisor-context small {
  color: #aebfb8;
  font-size: 8px;
}

.advisor-context strong {
  color: #f4d17d;
  font-size: 9px;
}

.advisor-context small {
  grid-column: 1 / -1;
  line-height: 1.35;
}

.merge-result .relation-preview {
  grid-column: 1;
  grid-row: 2;
  align-self: center;
}

.merge-result .relation-choices {
  grid-column: 1;
  grid-row: 3;
}

.expert-hint-button {
  display: inline-flex;
  grid-column: 1;
  grid-row: 4;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 28px;
  padding: 0 8px;
  color: #f4d17d;
  background: #29433e;
  border: 1px solid #6b817a;
  border-radius: 4px;
  font-size: 8px;
  font-weight: 800;
}

.expert-hint-button svg {
  width: 13px;
  height: 13px;
}

.expert-hint-button:disabled {
  opacity: 0.45;
}

.merge-result .primary-action {
  grid-column: 2;
  grid-row: 2 / 5;
  width: 100%;
  height: 100%;
  min-height: 62px;
}

.property-chip {
  display: inline-block;
  margin: 0 3px 2px 0;
  padding: 2px 4px;
  color: #d7e6e1;
  background: #35534c;
  border: 1px solid #5c7870;
  border-radius: 3px;
}

.ending-option {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 3px 8px;
}

.ending-option > svg {
  grid-row: 1 / 3;
}

.ending-option > span {
  color: var(--ink-500);
  font-size: 10px;
}

.ending-option.qualified {
  background: var(--leaf-soft);
  border-color: #94b38e;
}

.ending-option.unavailable {
  opacity: 0.68;
}

.prototype-note,
.crew-manifest {
  padding: 10px;
  background: #f5f0dd;
  border: 1px solid #d9c88d;
  border-radius: 4px;
}

.prototype-note strong,
.crew-manifest strong,
.crew-manifest span {
  display: block;
}

.prototype-note strong,
.crew-manifest strong {
  margin-bottom: 4px;
  color: var(--ink-950);
}

.mobile-quick-nav {
  display: none;
}

@media (min-width: 1001px) {
  .app-shell {
    grid-template-rows: var(--topbar-h) clamp(430px, calc(100dvh - var(--topbar-h) - 150px), 520px) auto;
  }

  .app-shell > .inventory-band {
    min-height: 320px;
    overflow: visible;
  }

  .scene-brief {
    width: min(560px, calc(100% - 28px));
  }
}

@media (max-width: 1000px) {
  .inventory-head {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .insight-bank {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
    width: 100%;
  }

  .inventory-workspace {
    grid-template-rows: 244px minmax(180px, auto);
  }

  .inventory-workspace > .item-grid {
    max-height: 244px;
  }
}

@media (max-width: 680px) {
  body {
    padding-bottom: 58px;
  }

  .mobile-quick-nav {
    position: fixed;
    z-index: 90;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    min-height: 54px;
    padding-bottom: env(safe-area-inset-bottom);
    background: rgba(18, 36, 42, 0.98);
    border-top: 1px solid #60766f;
    box-shadow: 0 -4px 14px rgba(15, 30, 28, 0.18);
  }

  .mobile-quick-nav button {
    display: grid;
    place-items: center;
    align-content: center;
    gap: 2px;
    min-width: 0;
    min-height: 54px;
    color: #d9e3df;
    background: transparent;
    border: 0;
    border-right: 1px solid #354e48;
    font-size: 9px;
  }

  .mobile-quick-nav button:last-child {
    border-right: 0;
  }

  .mobile-quick-nav svg {
    width: 17px;
    height: 17px;
  }

  .scene-brief {
    gap: 8px;
  }

  .mission-flow {
    margin-top: 6px;
  }

  .inventory-workspace {
    grid-template-rows: 252px auto;
  }

  .inventory-workspace > .item-grid {
    grid-auto-rows: 78px;
    max-height: 252px;
  }

  .merge-result {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto auto auto;
  }

  .advisor-context,
  .merge-result .relation-preview,
  .merge-result .relation-choices,
  .expert-hint-button,
  .merge-result .primary-action {
    grid-column: 1;
    grid-row: auto;
  }

  .merge-result .primary-action {
    min-height: 44px;
  }
}

}

/* v0.4: scene-first interaction shell */
:root {
  --topbar-h: 70px;
  --drawer-gap: 12px;
  --hud-bg: rgba(18, 36, 42, 0.92);
}

html,
body,
#app {
  height: 100%;
  overflow: hidden;
}

.app-shell {
  position: relative;
  display: block;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: #10262a;
}

.app-shell > .topbar {
  position: absolute;
  z-index: 100;
  top: 0;
  right: 0;
  left: 0;
  display: grid;
  grid-template-columns: 170px minmax(330px, 420px) minmax(190px, 1fr) auto;
  gap: 14px;
  height: var(--topbar-h);
  padding: 0 14px;
  background: rgba(15, 34, 37, 0.97);
  border-bottom: 1px solid #547068;
  box-shadow: 0 6px 24px rgba(5, 18, 20, 0.24);
  backdrop-filter: blur(14px);
}

.brand-lockup {
  min-width: 0;
}

.brand-lockup h1 {
  font-size: 15px;
}

.brand-lockup p {
  display: none;
}

.time-status {
  display: grid;
  grid-template-columns: auto minmax(150px, 1fr) auto;
  gap: 8px;
  width: auto;
}

.day-label {
  min-width: 66px;
}

.day-label strong {
  font-size: 12px;
}

.day-label span {
  font-size: 9px;
}

.action-budget {
  min-width: 150px;
  padding: 5px 8px;
}

.action-budget > span {
  font-size: 8px;
}

.action-budget > strong {
  font-size: 11px;
}

.weather-button {
  display: grid;
  grid-template-columns: 20px auto;
  align-items: center;
  gap: 0 5px;
  min-width: 80px;
  min-height: 42px;
  padding: 5px 8px;
  color: #edf5f1;
  background: #29443f;
  border: 1px solid #58736b;
  border-radius: 5px;
}

.weather-button:hover {
  background: #35534c;
  border-color: #e8ae3f;
}

.weather-button > .weather-icon {
  display: grid;
  grid-row: 1 / 3;
  place-items: center;
  width: 19px;
  height: 19px;
  color: #f2c45f;
}

.weather-button > .weather-icon svg {
  width: 19px;
  height: 19px;
}

.weather-button span,
.weather-button small {
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.weather-button span {
  font-size: 10px;
  font-weight: 800;
}

.weather-button small {
  color: #aebfb8;
  font-size: 7px;
}

.chapter-track {
  display: grid;
  grid-template-columns: repeat(7, minmax(22px, 1fr));
  align-items: center;
  align-self: stretch;
  gap: 3px;
  max-width: 420px;
}

.chapter-day {
  position: relative;
  display: grid;
  place-items: center;
  height: 32px;
  color: #70857e;
  background: #1e3733;
  border: 1px solid #3e5b55;
  border-radius: 4px;
}

.chapter-day::after {
  position: absolute;
  right: -4px;
  width: 4px;
  height: 1px;
  content: "";
  background: #4a655e;
}

.chapter-day:last-child::after {
  display: none;
}

.chapter-day svg {
  width: 12px;
  height: 12px;
}

.chapter-day b {
  font-size: 7px;
}

.chapter-day.done {
  color: #b9d4b4;
  background: #315443;
}

.chapter-day.current {
  color: #192c2a;
  background: #efbe53;
  border-color: #ffe29a;
  box-shadow: 0 0 0 3px rgba(239, 190, 83, 0.16);
}

.top-actions {
  gap: 5px;
}

.top-actions .icon-button {
  width: 34px;
  height: 34px;
  min-height: 34px;
}

.night-button {
  color: #ffe29a;
  background: #3b463c;
  border-color: #8b7a4c;
}

.app-shell > .scene {
  position: absolute;
  z-index: 1;
  top: var(--topbar-h);
  right: 0;
  bottom: 0;
  left: 0;
  width: auto;
  height: auto;
  min-height: 0;
  overflow: hidden;
  background: #4f8993;
}

.scene-art {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.04);
  transition: filter 500ms ease, transform 800ms cubic-bezier(0.2, 0.75, 0.2, 1);
}

.scene[data-location="coast"] .scene-art { object-position: 50% 54%; }
.scene[data-location="tidal_flat"] .scene-art { object-position: 22% 62%; transform: scale(1.2); }
.scene[data-location="rainforest"] .scene-art { object-position: 61% 44%; transform: scale(1.16); }
.scene[data-location="crash_trail"] .scene-art { object-position: 42% 58%; transform: scale(1.18); }
.scene[data-location="highland"] .scene-art { object-position: 81% 38%; transform: scale(1.2); }
.scene[data-location="ruins"] .scene-art { object-position: 82% 70%; transform: scale(1.22); }

.scene[data-weather="overcast"] .scene-art { filter: saturate(0.82) brightness(0.9); }
.scene[data-weather="rain"] .scene-art { filter: saturate(0.78) brightness(0.78) contrast(1.08); }
.scene[data-weather="signal_window"] .scene-art { filter: saturate(1.06) brightness(1.03); }
.scene[data-weather="storm_edge"] .scene-art,
.scene[data-weather="superstorm"] .scene-art { filter: saturate(0.62) brightness(0.62) contrast(1.18); }

.weather-fx {
  position: absolute;
  z-index: 2;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.weather-fx span {
  position: absolute;
  display: none;
  inset: -25%;
}

.scene[data-weather="rain"] .weather-fx span,
.scene[data-weather="storm_edge"] .weather-fx span,
.scene[data-weather="superstorm"] .weather-fx span {
  display: block;
  background-image: repeating-linear-gradient(106deg, transparent 0 18px, rgba(222, 242, 244, 0.38) 19px 20px, transparent 21px 38px);
  animation: weather-rain 850ms linear infinite;
}

.scene[data-weather="storm_edge"] .weather-fx span:nth-child(2),
.scene[data-weather="superstorm"] .weather-fx span:nth-child(2) {
  animation-duration: 520ms;
  animation-delay: -260ms;
  opacity: 0.58;
}

.scene[data-weather="signal_window"] .weather-fx span:first-child {
  top: 9%;
  right: 7%;
  bottom: auto;
  left: auto;
  display: block;
  width: 150px;
  height: 150px;
  background: radial-gradient(circle, transparent 38%, rgba(239, 190, 83, 0.22) 39% 41%, transparent 42% 58%, rgba(239, 190, 83, 0.12) 59% 61%, transparent 62%);
  animation: signal-breathe 1800ms ease-in-out infinite;
}

@keyframes weather-rain {
  from { transform: translate3d(-4%, -12%, 0); }
  to { transform: translate3d(4%, 12%, 0); }
}

@keyframes signal-breathe {
  0%, 100% { opacity: 0.35; transform: scale(0.92); }
  50% { opacity: 1; transform: scale(1.06); }
}

.scene-vignette {
  z-index: 3;
  background: linear-gradient(180deg, rgba(8, 27, 29, 0.12) 0%, transparent 36%, rgba(8, 24, 25, 0.2) 62%, rgba(7, 20, 21, 0.74) 100%);
}

.scene-overlay {
  z-index: 4;
}

.scene-location-nav {
  top: 14px;
  right: auto;
  left: 50%;
  max-width: calc(100% - 620px);
  transform: translateX(-50%);
}

.scene-location-nav button,
.scene-location-chip {
  min-height: 38px;
  color: #eef5f1;
  background: rgba(15, 37, 39, 0.84);
  border: 1px solid rgba(219, 233, 226, 0.42);
  box-shadow: 0 4px 14px rgba(5, 18, 20, 0.18);
  backdrop-filter: blur(9px);
}

.scene-location-nav button.active {
  color: #192c2a;
  background: #f5ce70;
  border-color: #fff0b8;
}

.scene-vitals {
  position: absolute;
  top: 16px;
  right: 18px;
  display: flex;
  gap: 5px;
}

.scene-vitals > span {
  display: grid;
  grid-template-columns: 18px auto;
  align-items: center;
  gap: 4px;
  min-height: 36px;
  padding: 5px 7px;
  color: #f4f7f5;
  background: rgba(18, 38, 40, 0.86);
  border: 1px solid #647b74;
  border-radius: 4px;
  backdrop-filter: blur(9px);
}

.scene-vitals svg {
  width: 16px;
  height: 16px;
}

.scene-vitals b {
  font-size: 8px;
}

.scene-vitals .done { color: #d9efd4; border-color: #82aa7c; }
.scene-vitals .partial { color: #ffe29a; border-color: #c59f48; }
.scene-vitals .risk { color: #ffd2c7; border-color: #c56b58; }

.scene-brief {
  position: absolute;
  z-index: 8;
  top: auto;
  right: auto;
  bottom: 72px;
  left: 50%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 230px;
  gap: 12px;
  width: min(760px, calc(100% - 620px));
  height: auto;
  min-width: 460px;
  padding: 12px;
  color: #f0f5f2;
  background: rgba(14, 34, 36, 0.92);
  border: 1px solid rgba(198, 218, 210, 0.42);
  border-radius: 6px;
  box-shadow: 0 14px 38px rgba(4, 16, 17, 0.28);
  transform: translateX(-50%);
  backdrop-filter: blur(14px);
}

.scene-brief h2 {
  margin-top: 3px;
  font-size: 16px;
  line-height: 1.2;
}

.scene-brief #eventText,
.scene-brief .location-intel {
  display: inline;
  margin: 0 8px 0 0;
  color: #b9cac4;
  font-size: 9px;
}

.mission-meta {
  margin-bottom: 2px;
}

.mission-flow > span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  min-height: 24px;
  padding: 3px 6px;
  font-size: 8px;
}

.mission-flow > span svg {
  width: 11px;
  height: 11px;
}

.scene-command {
  align-content: center;
  min-width: 0;
}

.explore-lead {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 4px 6px;
}

.lead-avatar {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: #1b302d !important;
  background: #efc45f;
  border-radius: 50%;
  font-size: 11px !important;
  font-weight: 900;
}

.explore-lead small {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.explore-lead small svg {
  width: 12px;
  height: 12px;
}

.scene-command .command-button {
  min-height: 38px;
}

.world-object {
  cursor: pointer;
}

.world-object:hover {
  transform: translateY(-3px) scale(1.06);
}

.app-shell > .map-panel,
.app-shell > .side-panel {
  position: absolute;
  z-index: 75;
  top: calc(var(--topbar-h) + var(--drawer-gap));
  bottom: var(--drawer-gap);
  display: block;
  width: 280px;
  max-height: none;
  padding: 12px;
  overflow: auto;
  background: rgba(246, 248, 243, 0.97);
  border: 1px solid rgba(184, 199, 191, 0.9);
  border-radius: 6px;
  box-shadow: 0 18px 50px rgba(5, 20, 21, 0.28);
  opacity: 0;
  transition: transform 260ms cubic-bezier(0.2, 0.75, 0.2, 1), opacity 180ms ease;
  pointer-events: none;
  backdrop-filter: blur(16px);
}

.app-shell > .map-panel {
  left: var(--drawer-gap);
  transform: translateX(calc(-100% - 24px));
}

.app-shell > .side-panel {
  right: var(--drawer-gap);
  transform: translateX(calc(100% + 24px));
}

.app-shell > .map-panel.is-open,
.app-shell > .side-panel.is-open {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.panel-heading,
.drawer-heading {
  min-height: 34px;
}

.panel-heading > span:first-child,
.drawer-heading > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 850;
}

.panel-heading svg,
.drawer-heading svg {
  width: 15px;
  height: 15px;
}

.drawer-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.panel-close {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  color: var(--ink-700);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
}

.panel-close:hover {
  background: var(--surface-soft);
  border-color: var(--line);
}

.location-list .location-button {
  grid-template-columns: 28px minmax(0, 1fr) auto;
  min-height: 48px;
  padding: 6px;
}

.location-list .location-button > svg:first-child {
  width: 18px;
  height: 18px;
}

.location-cost {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 8px;
}

.location-cost svg {
  width: 11px;
  height: 11px;
}

.crew-list {
  gap: 5px;
}

.crew-row {
  grid-template-columns: 34px minmax(0, 1fr) 30px;
  min-height: 48px;
  padding: 6px;
}

.crew-avatar {
  width: 32px;
  height: 32px;
}

.crew-copy small {
  -webkit-line-clamp: 1;
}

.crew-state {
  display: grid;
  place-items: center;
  gap: 1px;
  font-size: 0;
}

.crew-state svg {
  width: 15px;
  height: 15px;
}

.crew-state b {
  margin: 0;
  font-size: 8px;
}

.crew-context {
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
}

.crew-context span {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  color: #1b302d;
  background: #efc45f;
  border-radius: 50%;
  font-size: 0;
}

.crew-context span::after {
  content: "队";
  font-size: 9px;
  font-weight: 900;
}

.crew-context small {
  grid-column: 2;
}

.crew-context > b {
  grid-column: 3;
  grid-row: 1 / 3;
  color: #8a671a;
  font-size: 13px;
}

.side-panel .status-section {
  padding: 10px 0;
}

.route-item {
  position: relative;
  display: grid;
  width: 100%;
  padding: 8px 28px 8px 8px;
  text-align: left;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 5px;
}

.route-item:hover {
  border-color: #6d9388;
  box-shadow: var(--shadow-sm);
}

.route-item .route-open {
  position: absolute;
  top: 50%;
  right: 7px;
  width: 14px;
  height: 14px;
  transform: translateY(-50%);
}

.route-item p {
  overflow: hidden;
  margin: 4px 0 0;
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.route-teaser {
  display: grid;
  grid-template-columns: repeat(3, 42px);
  justify-content: center;
  gap: 8px;
  padding: 12px;
  color: var(--ink-500);
  background: #eef1ed;
  border: 1px dashed var(--line-strong);
  border-radius: 5px;
}

.route-teaser span {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  background: #dfe5df;
  border-radius: 50%;
  filter: grayscale(1);
  opacity: 0.58;
}

.route-teaser svg {
  width: 19px;
  height: 19px;
}

.route-teaser b {
  grid-column: 1 / -1;
  text-align: center;
  font-size: 9px;
}

.log-section {
  display: none;
}

.app-shell > .inventory-band {
  position: absolute;
  z-index: 85;
  right: auto;
  bottom: 12px;
  left: 50%;
  display: block;
  width: min(1120px, calc(100% - 48px));
  height: min(430px, calc(100dvh - var(--topbar-h) - 32px));
  min-height: 0;
  overflow: hidden;
  background: rgba(246, 248, 243, 0.985);
  border: 1px solid #b8c7bf;
  border-radius: 6px;
  box-shadow: 0 18px 48px rgba(5, 20, 21, 0.32);
  transform: translate(-50%, 0);
  transition: transform 300ms cubic-bezier(0.2, 0.78, 0.2, 1);
  pointer-events: auto;
}

.app-shell > .inventory-band.is-collapsed {
  height: min(430px, calc(100dvh - var(--topbar-h) - 32px));
  transform: translate(-50%, calc(100% - 54px));
}

.inventory-head {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) auto;
  min-height: 53px;
  padding: 6px 10px;
  cursor: pointer;
  background: rgba(249, 250, 247, 0.99);
  border-bottom: 1px solid var(--line);
}

.inventory-head h2 {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.inventory-head h2 svg {
  width: 16px;
  height: 16px;
}

.inventory-workspace {
  height: calc(100% - 94px);
  min-height: 0;
}

.inventory-workspace > .item-grid {
  max-height: 100%;
}

.day-controls {
  min-height: 40px;
}

.panel-scrim {
  position: fixed;
  z-index: 65;
  inset: var(--topbar-h) 0 0;
  background: rgba(5, 18, 20, 0.25);
  backdrop-filter: blur(2px);
}

.panel-scrim[hidden] {
  display: none;
}

.mobile-quick-nav {
  display: none;
}

/* Expedition planner */
.expedition-hero {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 10px;
  color: #edf5f1;
  background: #24423e;
  border-radius: 6px;
}

.expedition-hero > svg {
  width: 34px;
  height: 34px;
  color: #f0c45f;
}

.expedition-hero b,
.expedition-hero small {
  display: block;
}

.expedition-hero b {
  font-size: 12px;
}

.expedition-hero small {
  margin-top: 2px;
  color: #b8cac3;
  font-size: 9px;
}

.expedition-step {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 6px;
  margin-top: 12px;
}

.expedition-step > span {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  color: #1c302d;
  background: #efc45f;
  border-radius: 50%;
  font-size: 9px;
  font-weight: 900;
}

.expedition-step > b {
  font-size: 10px;
}

.expedition-choice-grid {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.expedition-crew,
.expedition-gear {
  position: relative;
  display: grid;
  place-items: center;
  gap: 3px;
  min-height: 58px;
  padding: 6px;
  background: #f6f7f3;
  border: 1px solid var(--line);
  border-radius: 5px;
}

.expedition-crew:hover,
.expedition-gear:hover,
.expedition-crew.active,
.expedition-gear.active {
  background: #fff4ce;
  border-color: #d3a83e;
  box-shadow: inset 0 -3px 0 #e4b848;
}

.expedition-crew > span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: #f5f7f4;
  background: #355851;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 900;
}

.expedition-crew > svg {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 13px;
  height: 13px;
  color: #bf8a16;
}

.expedition-crew b,
.expedition-gear b {
  font-size: 8px;
}

.expedition-gear > svg {
  width: 22px;
  height: 22px;
}

.expedition-readout {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 12px;
  padding: 8px;
  background: #eef1ed;
  border: 1px solid var(--line);
  border-radius: 5px;
}

.expedition-readout.matched {
  background: #e6f0df;
  border-color: #94b68b;
}

.expedition-readout span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 0;
}

.expedition-readout svg {
  flex: 0 0 15px;
  width: 15px;
  height: 15px;
}

.expedition-readout b {
  overflow: hidden;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.expedition-bonus {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: 8px 0 0;
  padding: 7px;
  color: #32626a;
  background: #e2f0f1;
  border-radius: 4px;
  font-size: 9px;
}

.expedition-bonus svg {
  flex: 0 0 14px;
  width: 14px;
  height: 14px;
}

/* Visual onboarding */
.prologue-scene {
  position: relative;
  height: 230px;
  overflow: hidden;
  background: #345d62 url("assets/island-scene.svg") 50% 56% / 150% auto no-repeat;
  border: 1px solid #79918b;
  border-radius: 6px;
  box-shadow: inset 0 -70px 80px rgba(7, 24, 25, 0.52);
}

.prologue-scene::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(145deg, rgba(255, 218, 128, 0.06), transparent 45%, rgba(12, 27, 29, 0.35));
  pointer-events: none;
}

.prologue-scene button {
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  gap: 2px;
  width: 58px;
  height: 58px;
  color: #fff5d5;
  background: rgba(18, 42, 43, 0.86);
  border: 2px solid #efc45f;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(239, 196, 95, 0.45);
  animation: hotspot-pulse 1800ms ease-out infinite;
}

.prologue-scene button:nth-of-type(1) { right: 21%; bottom: 16%; }
.prologue-scene button:nth-of-type(2) { bottom: 22%; left: 16%; animation-delay: -600ms; }
.prologue-scene button:nth-of-type(3) { top: 12%; right: 14%; animation-delay: -1200ms; }

.prologue-scene button svg {
  width: 20px;
  height: 20px;
}

.prologue-scene button b {
  font-size: 8px;
}

.prologue-scene button.found {
  color: #17302d;
  background: #d9ecd2;
  border-color: #8ab883;
  animation: none;
}

@keyframes hotspot-pulse {
  0% { box-shadow: 0 0 0 0 rgba(239, 196, 95, 0.45); }
  65%, 100% { box-shadow: 0 0 0 13px rgba(239, 196, 95, 0); }
}

.prologue-readout {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  margin-top: 8px;
  padding: 6px 8px;
  background: #eef1ed;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.prologue-readout span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: #17302d;
  background: #efc45f;
  border-radius: 50%;
}

.prologue-readout svg {
  width: 15px;
  height: 15px;
}

.prologue-readout b {
  font-size: 10px;
}

.visual-readout span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.visual-readout svg {
  width: 15px;
  height: 15px;
}

/* Weather, day and route detail */
.weather-orbit {
  display: grid;
  place-items: center;
  width: 86px;
  height: 86px;
  margin: 0 auto 12px;
  color: #e6b542;
  background: #213f3c;
  border: 1px solid #678078;
  border-radius: 50%;
  box-shadow: 0 0 0 10px #edf1eb, 0 0 0 11px #c9d2cb;
}

.weather-orbit svg {
  width: 38px;
  height: 38px;
}

.weather-effects {
  display: grid;
  gap: 6px;
}

.weather-effects > span {
  display: grid;
  grid-template-columns: 22px 52px minmax(0, 1fr);
  align-items: center;
  gap: 5px;
  min-height: 38px;
  padding: 6px;
  background: #f1f3ef;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.weather-effects svg {
  width: 16px;
  height: 16px;
}

.weather-effects b {
  font-size: 9px;
}

.weather-effects small {
  color: var(--ink-500);
  font-size: 9px;
}

.day-visual {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px;
  color: #eef5f1;
  background: #223f3b;
  border-radius: 6px;
}

.day-weather,
.day-periods {
  display: flex;
  align-items: center;
  gap: 6px;
}

.day-weather svg {
  width: 28px;
  height: 28px;
  color: #efc45f;
}

.day-periods svg {
  width: 12px;
  height: 12px;
  color: #efc45f;
  fill: currentColor;
}

.day-goal-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 10px 0;
}

.day-goal-grid span {
  display: grid;
  place-items: center;
  gap: 5px;
  min-height: 72px;
  padding: 7px;
  text-align: center;
  background: #f4f5f1;
  border: 1px solid var(--line);
  border-radius: 5px;
}

.day-goal-grid svg {
  width: 22px;
  height: 22px;
  color: #426e64;
}

.day-goal-grid b {
  font-size: 9px;
}

.weather-effects.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.weather-effects.compact > span {
  grid-template-columns: 18px minmax(0, 1fr);
}

.route-visual {
  position: relative;
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  margin: 2px auto 14px;
  color: #17302d;
  background: #efc45f;
  border-radius: 50%;
}

.route-visual > svg {
  width: 36px;
  height: 36px;
}

.route-visual > span {
  position: absolute;
  right: -8px;
  bottom: -8px;
  left: -8px;
  height: 7px;
  overflow: hidden;
  background: #d8ded8;
  border: 1px solid #b9c5bd;
  border-radius: 4px;
}

.route-visual > span::after {
  display: block;
  width: var(--route-progress);
  height: 100%;
  content: "";
  background: #54835f;
}

.route-check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.route-check-grid > span {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 2px 5px;
  min-height: 42px;
  padding: 6px;
  background: #f3f4f0;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.route-check-grid > span.met {
  color: #356638;
  background: #e5efdf;
  border-color: #9ab591;
}

.route-check-grid svg {
  grid-row: 1 / 3;
  width: 15px;
  height: 15px;
}

.route-check-grid b {
  font-size: 9px;
}

.route-check-grid em {
  color: #8d6a1c;
  font-size: 7px;
  font-style: normal;
}

/* Spatial feedback */
.action-feedback {
  z-index: 160;
  top: calc(var(--topbar-h) + 14px);
  right: 18px;
  left: auto;
  width: min(360px, calc(100% - 36px));
  border-radius: 6px;
  box-shadow: 0 18px 45px rgba(6, 21, 22, 0.32);
  transform: none;
  animation-name: feedback-in-right;
}

@keyframes feedback-in-right {
  from { opacity: 0; transform: translateY(-10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.world-object[data-stage="partial"] {
  color: #ffe29a;
  border-color: #d0aa51;
  filter: saturate(0.82);
}

body.feedback-success .scene::after,
body.feedback-explore .scene::after,
body.feedback-discover .modal-dialog::after {
  position: absolute;
  z-index: 20;
  inset: 0;
  content: "";
  border: 3px solid rgba(239, 196, 95, 0.78);
  pointer-events: none;
  animation: world-confirm 850ms ease-out both;
}

@keyframes world-confirm {
  from { opacity: 1; box-shadow: inset 0 0 80px rgba(239, 196, 95, 0.28); }
  to { opacity: 0; box-shadow: inset 0 0 0 rgba(239, 196, 95, 0); }
}

@media (max-width: 1180px) and (min-width: 681px) {
  .app-shell > .topbar {
    grid-template-columns: 150px minmax(300px, 380px) 1fr auto;
  }

  .chapter-day svg {
    display: none;
  }

  .scene-location-nav,
  .scene-brief {
    max-width: none;
    width: calc(100% - 160px);
  }
}

@media (max-height: 720px) and (min-width: 681px) {
  .scene-brief {
    bottom: 62px;
    padding: 8px;
  }

  .scene-brief #eventText,
  .scene-brief .location-intel {
    display: none;
  }

  .mission-flow {
    margin-top: 4px;
  }

  .app-shell > .inventory-band.is-collapsed {
    transform: translate(-50%, calc(100% - 48px));
  }
}

@media (max-width: 680px) {
  :root {
    --topbar-h: 96px;
  }

  body {
    padding: 0;
  }

  .app-shell > .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: 44px 45px;
    gap: 0 6px;
    height: var(--topbar-h);
    padding: 3px 8px;
  }

  .brand-lockup {
    grid-column: 1;
    grid-row: 1;
  }

  .brand-lockup h1 {
    font-size: 13px;
  }

  .time-status {
    grid-column: 1 / -1;
    grid-row: 2;
    grid-template-columns: 62px minmax(0, 1fr) 74px;
    gap: 5px;
    width: 100%;
  }

  .day-label {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-content: center;
    gap: 0;
    min-width: 0;
  }

  .day-label strong,
  .day-label span {
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .top-actions {
    grid-column: 2;
    grid-row: 1;
  }

  .top-actions #mapToggle,
  .top-actions #statusToggle,
  .top-actions #saveButton {
    display: none;
  }

  .top-actions .icon-button {
    width: 31px;
    height: 31px;
    min-height: 31px;
  }

  .chapter-track {
    display: none;
  }

  .action-budget {
    min-width: 0;
  }

  .weather-button {
    min-width: 0;
    min-height: 38px;
    padding: 3px 5px;
  }

  .weather-button > .weather-icon,
  .weather-button > .weather-icon svg {
    width: 17px;
    height: 17px;
  }

  .app-shell > .scene {
    top: var(--topbar-h);
    bottom: 58px;
    min-height: 0;
  }

  .scene-art {
    position: absolute;
    inset: 0;
    height: 100%;
    min-height: 0;
  }

  .scene-vignette,
  .scene-overlay {
    inset: 0;
    height: auto;
  }

  .scene-location-nav {
    top: 7px;
    right: 7px;
    left: 7px;
    width: auto;
    max-width: none;
    transform: none;
  }

  .scene-location-nav button,
  .scene-location-chip {
    min-height: 34px;
    padding: 4px 7px;
  }

  .scene-vitals {
    top: 51px;
    right: 7px;
    gap: 3px;
  }

  .scene-vitals > span {
    grid-template-columns: 15px;
    min-height: 30px;
    padding: 4px;
  }

  .scene-vitals svg {
    width: 14px;
    height: 14px;
  }

  .scene-vitals b {
    display: none;
  }

  .scene-brief {
    right: 7px;
    bottom: 7px;
    left: 7px;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 7px;
    width: auto;
    min-width: 0;
    max-height: 188px;
    padding: 9px;
    overflow: hidden;
    transform: none;
  }

  .scene-brief h2 {
    overflow: hidden;
    margin: 2px 0 0;
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .scene-brief #eventText,
  .scene-brief .location-intel,
  .event-eyebrow {
    display: none;
  }

  .mission-flow {
    margin-top: 5px;
  }

  .mission-flow > span {
    min-height: 22px;
    max-width: 90px;
    overflow: hidden;
    padding: 2px 5px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .scene-command {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(145px, 1.4fr);
    gap: 6px;
  }

  .explore-lead {
    min-height: 36px;
  }

  .scene-command .command-button {
    min-height: 36px;
  }

  .explore-meta {
    display: none;
  }

  .app-shell > .map-panel,
  .app-shell > .side-panel,
  .app-shell > .inventory-band {
    position: fixed;
    z-index: 105;
    top: var(--topbar-h);
    right: 0;
    bottom: 58px;
    left: 0;
    width: 100%;
    height: auto;
    max-height: none;
    margin: 0;
    border: 0;
    border-radius: 0;
    opacity: 0;
    transform: translateY(18px);
    transition: transform 220ms ease, opacity 160ms ease;
    pointer-events: none;
  }

  .app-shell > .map-panel,
  .app-shell > .side-panel {
    padding: 10px;
    overflow-y: auto;
  }

  .app-shell > .map-panel.is-open,
  .app-shell > .side-panel.is-open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }

  .app-shell > .inventory-band,
  .app-shell > .inventory-band.is-collapsed {
    display: block;
    height: calc(100dvh - var(--topbar-h) - 58px);
    overflow: hidden;
    transform: translateY(100%);
  }

  body[data-panel="inventory"] .app-shell > .inventory-band {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }

  .inventory-head {
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 52px;
    padding: 5px 8px;
  }

  .inventory-head > div:first-child span {
    max-width: 170px;
  }

  .insight-bank {
    grid-column: 1 / -1;
    grid-row: 2;
    display: none;
  }

  .inventory-tools .segmented-control button:not([data-filter="focus"]):not([data-filter="all"]) {
    display: none;
  }

  .inventory-workspace {
    display: grid;
    grid-template-rows: minmax(150px, 42%) minmax(0, 1fr);
    height: calc(100% - 92px);
    min-height: 0;
    padding: 7px;
    overflow: hidden;
  }

  .inventory-workspace > .item-grid {
    grid-auto-rows: 72px;
    max-height: none;
    overflow-y: auto;
  }

  .inventory-workspace > .merge-dock {
    min-height: 0;
    overflow-y: auto;
  }

  .day-controls {
    min-height: 40px;
  }

  .day-controls #endDayButton {
    display: none;
  }

  .panel-scrim {
    display: none;
  }

  .mobile-quick-nav {
    z-index: 120;
    display: grid;
  }

  .mobile-quick-nav button.active {
    color: #1a302d;
    background: #efc45f;
  }

  .action-feedback {
    top: calc(var(--topbar-h) + 8px);
    right: 8px;
    left: 8px;
    width: auto;
  }

  .modal {
    z-index: 200;
    padding: 10px;
  }

  .modal-dialog {
    width: min(100%, 520px);
    max-height: calc(100dvh - 20px);
  }

  .expedition-choice-grid {
    grid-template-columns: repeat(4, minmax(58px, 1fr));
    overflow-x: auto;
  }

  .expedition-crew,
  .expedition-gear {
    min-width: 58px;
  }

  .prologue-scene {
    height: 210px;
  }
}

@media (max-width: 420px) {
  .brand-lockup h1 {
    font-size: 12px;
  }

  .top-actions {
    gap: 2px;
  }

  .top-actions .icon-button {
    width: 29px;
    height: 29px;
    min-height: 29px;
  }

  .scene-command {
    grid-template-columns: 110px minmax(0, 1fr);
  }

  .explore-lead {
    grid-template-columns: 25px minmax(0, 1fr);
  }

  .explore-lead small {
    display: none;
  }

  .day-goal-grid {
    grid-template-columns: 1fr;
  }

  .day-goal-grid span {
    grid-template-columns: 24px minmax(0, 1fr);
    min-height: 42px;
    text-align: left;
  }

  .route-check-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .weather-fx,
  .prologue-scene button,
  body.feedback-success .scene::after,
  body.feedback-explore .scene::after,
  body.feedback-discover .modal-dialog::after {
    animation: none !important;
  }
}
