:root {
  color-scheme: dark;
  --ink: #edf7f5;
  --muted: #98b5bb;
  --faint: #668790;
  --night: #04111d;
  --panel: #0a2232;
  --panel-strong: #0e2b3d;
  --panel-soft: rgba(9, 31, 46, 0.84);
  --line: rgba(164, 211, 213, 0.18);
  --line-strong: rgba(164, 211, 213, 0.36);
  --aqua: #66e3d3;
  --aqua-dark: #153f45;
  --sand: #f0b777;
  --danger: #f28d82;
  --nav-height: 76px;
  --radius: 18px;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--night);
}

body {
  min-width: 320px;
  min-height: 100svh;
  margin: 0;
  color: var(--ink);
  background: #061725;
  overflow-x: hidden;
}

button,
input,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(102, 227, 211, 0.45);
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1,
h2,
h3 {
  font-family: "Songti SC", "STSong", "Noto Serif SC", serif;
  font-weight: 700;
}

.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;
}

.app-shell {
  width: 100%;
  min-height: 100svh;
  padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom));
}

.topbar {
  position: sticky;
  z-index: 30;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 68px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  border-bottom: 1px solid var(--line);
  background: rgba(4, 17, 29, 0.91);
  backdrop-filter: blur(18px);
}

.brand-lockup,
.top-actions,
.view-heading,
.section-row,
.scene-head,
.quest-topline,
.queue-header,
.recipe-head,
.chat-identity,
.dialog-actions {
  display: flex;
  align-items: center;
}

.brand-lockup {
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(102, 227, 211, 0.42);
  border-radius: 50%;
  color: var(--aqua);
  background: #0b2d3c;
  box-shadow: 0 0 24px rgba(70, 215, 203, 0.18);
  font-family: "Songti SC", serif;
  font-weight: 800;
}

.brand-lockup h1 {
  overflow: hidden;
  max-width: 140px;
  color: var(--ink);
  font-size: 19px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.eyebrow,
.section-kicker {
  color: var(--aqua);
  font-family: Inter, "PingFang SC", sans-serif;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.11em;
  line-height: 1.35;
  text-transform: uppercase;
}

.top-actions {
  flex: 0 0 auto;
  gap: 8px;
}

.save-status {
  display: none;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.save-status span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--aqua);
  box-shadow: 0 0 8px var(--aqua);
}

.icon-button {
  display: grid;
  width: 42px;
  height: 42px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink);
  background: #0b2535;
  font-size: 14px;
  font-weight: 750;
}

.resource-strip {
  position: sticky;
  z-index: 25;
  top: calc(68px + env(safe-area-inset-top));
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 21, 34, 0.94);
  backdrop-filter: blur(15px);
}

.resource-pill {
  display: flex;
  min-width: 0;
  min-height: 48px;
  align-items: center;
  gap: 7px;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--ink);
  background: rgba(21, 53, 68, 0.72);
  text-align: left;
}

.resource-pill:hover {
  border-color: var(--line-strong);
}

.resource-pill > span:last-child {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.resource-pill small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resource-pill strong {
  margin-top: 1px;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.resource-icon {
  display: block;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 5px;
  box-shadow: inset 0 0 0 3px rgba(4, 17, 29, 0.18);
}

.resource-icon.wood { background: #a56f46; }
.resource-icon.fiber { background: #d4c48a; border-radius: 50% 5px; }
.resource-icon.water { background: #4ca8c8; border-radius: 50% 50% 50% 8px; transform: rotate(45deg) scale(.8); }
.resource-icon.gold { background: #e7b653; border-radius: 50%; }

.content {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
}

.view {
  display: none;
  padding: 14px 12px 30px;
  animation: view-enter 180ms ease-out;
}

.view.active {
  display: block;
}

@keyframes view-enter {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.scene-card,
.quest-card,
.companion-peek,
.milestone-card,
.production-card,
.recipe-card,
.queue-card,
.market-column,
.listing-card,
.receipt-card,
.chat-card,
.delegate-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.2);
}

.scene-card {
  overflow: hidden;
  background: #091f30;
}

.scene-head {
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.scene-name {
  margin-top: 3px;
  color: var(--ink);
  font-family: "Songti SC", serif;
  font-size: 16px;
  font-weight: 700;
}

.area-chip,
.prototype-tag,
.weather-chip,
.quest-step,
.order-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(4, 17, 29, 0.72);
  white-space: nowrap;
}

.area-chip {
  min-width: 64px;
  min-height: 36px;
  gap: 3px;
  font-size: 12px;
}

.area-chip strong {
  color: var(--aqua);
  font-size: 18px;
}

.ocean-scene {
  position: relative;
  min-height: 366px;
  isolation: isolate;
  overflow: hidden;
  background-color: #0b3b55;
  background-image: url("./assets/ocean-dusk.jpg");
  background-position: center 58%;
  background-size: cover;
}

.ocean-scene::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  background: rgba(0, 17, 31, 0.28);
  content: "";
}

.weather-chip {
  position: absolute;
  top: 14px;
  left: 14px;
  min-height: 29px;
  padding: 0 10px;
  border-color: rgba(255, 255, 255, 0.25);
  color: rgba(255, 255, 255, 0.82);
  background: rgba(2, 16, 28, 0.5);
  font-size: 12px;
  backdrop-filter: blur(8px);
}

.sea-pulse {
  position: absolute;
  z-index: -1;
  width: 180px;
  height: 66px;
  border: 1px solid rgba(169, 239, 235, 0.24);
  border-radius: 50%;
  animation: sea-breathe 4.5s ease-in-out infinite;
}

.sea-pulse-one { top: 42%; left: 50%; transform: translate(-50%, -50%) rotate(-7deg); }
.sea-pulse-two { top: 52%; left: 50%; transform: translate(-50%, -50%) rotate(9deg); animation-delay: -2.1s; }

@keyframes sea-breathe {
  0%, 100% { opacity: .25; scale: .88; }
  50% { opacity: .72; scale: 1.12; }
}

.raft-grid {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  width: 204px;
  height: 204px;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 4px;
  transform: translate(-50%, -45%) rotate(45deg) skew(-4deg, -4deg);
  filter: drop-shadow(0 22px 12px rgba(0, 0, 0, 0.35));
}

.raft-tile {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(255, 232, 188, 0.38);
  border-radius: 4px;
  background-color: #9a6541;
  box-shadow: inset 0 0 0 5px rgba(54, 26, 14, 0.13);
  animation: tile-arrive 420ms cubic-bezier(.2, .8, .2, 1) both;
}

.raft-tile::before,
.raft-tile::after {
  position: absolute;
  background: rgba(62, 29, 15, 0.24);
  content: "";
}

.raft-tile::before { width: 100%; height: 2px; top: 31%; }
.raft-tile::after { width: 100%; height: 2px; top: 67%; }

.raft-tile.land {
  border-color: rgba(178, 215, 151, 0.65);
  background: #718657;
  box-shadow: inset 0 0 0 5px rgba(45, 58, 34, 0.2);
}

.building-marker {
  position: relative;
  z-index: 2;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 2px solid rgba(224, 255, 250, 0.74);
  border-radius: 50%;
  color: #e7ffff;
  background: #286b78;
  font-size: 11px;
  font-weight: 800;
  transform: rotate(-45deg) skew(4deg, 4deg);
  box-shadow: 0 0 16px rgba(102, 227, 211, 0.35);
}

@keyframes tile-arrive {
  from { opacity: 0; transform: scale(.65); }
  to { opacity: 1; transform: scale(1); }
}

.drift-supply {
  position: absolute;
  top: 56%;
  right: 8%;
  display: flex;
  width: 72px;
  height: 72px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  border: 1px solid rgba(255, 235, 191, 0.55);
  border-radius: 50%;
  color: #fff1d8;
  background: rgba(95, 58, 37, 0.78);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.28);
  animation: drift 3s ease-in-out infinite;
}

.drift-supply[hidden] { display: none; }
.drift-supply span { font-size: 22px; line-height: 1; }
.drift-supply small { margin-top: 3px; font-size: 10px; }

@keyframes drift {
  0%, 100% { transform: translateY(-4px) rotate(-2deg); }
  50% { transform: translateY(5px) rotate(3deg); }
}

.scene-foot {
  position: absolute;
  right: 12px;
  bottom: 12px;
  left: 12px;
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px 9px 12px;
  border: 1px solid rgba(255, 255, 255, 0.17);
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.84);
  background: rgba(2, 15, 26, 0.63);
  font-size: 12px;
  line-height: 1.4;
  backdrop-filter: blur(12px);
}

.prototype-tag {
  min-height: 25px;
  padding: 0 8px;
  border-color: rgba(102, 227, 211, 0.35);
  color: var(--aqua);
  background: rgba(10, 43, 55, 0.78);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
}

.prototype-tag.warning {
  border-color: rgba(240, 183, 119, 0.4);
  color: var(--sand);
  background: rgba(72, 48, 28, 0.62);
}

.home-panel-stack {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.quest-card {
  padding: 17px;
  background: #0c2939;
}

.quest-topline {
  justify-content: space-between;
  gap: 12px;
}

.quest-step {
  min-height: 25px;
  padding: 0 9px;
  font-size: 11px;
}

.quest-card h2 {
  margin-top: 10px;
  font-size: clamp(22px, 6vw, 29px);
  line-height: 1.22;
}

.quest-card > p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.quest-requirements {
  display: flex;
  min-height: 26px;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.requirement-chip {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  gap: 5px;
  padding: 0 9px;
  border-radius: 999px;
  color: var(--muted);
  background: #123548;
  font-size: 12px;
}

.requirement-chip.met { color: #baf6e8; }
.requirement-chip.missing { color: #ffc9bb; }

.primary-button,
.secondary-button,
.quiet-button,
.danger-button,
.text-button {
  min-height: 48px;
  border-radius: 12px;
  font-weight: 750;
}

.primary-button {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 15px;
  padding: 0 16px;
  border: 1px solid #f5c68d;
  color: #1d140b;
  background: var(--sand);
  box-shadow: 0 10px 24px rgba(219, 151, 78, 0.18);
}

.primary-button:hover:not(:disabled) { background: #f5c58e; }
.primary-button:active:not(:disabled) { transform: translateY(1px); }

.secondary-button {
  padding: 0 16px;
  border: 1px solid rgba(102, 227, 211, 0.46);
  color: #dffffa;
  background: #16515a;
}

.secondary-button.compact { min-height: 44px; padding: 0 12px; font-size: 13px; }

.quiet-button {
  min-width: 76px;
  padding: 0 14px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: #102f41;
}

.quiet-button.full { width: 100%; margin-top: 8px; }

.danger-button {
  min-height: 46px;
  padding: 0 16px;
  border: 1px solid rgba(242, 141, 130, 0.42);
  color: #ffd8d3;
  background: #512c2e;
}

.text-button {
  min-height: 44px;
  padding: 0 10px;
  border: 0;
  color: var(--aqua);
  background: transparent;
}

.progress-track {
  height: 3px;
  margin-top: 17px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.09);
}

.progress-track span {
  display: block;
  width: 12.5%;
  height: 100%;
  border-radius: inherit;
  background: var(--aqua);
  transition: width 300ms ease;
}

.companion-peek {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px;
}

.companion-peek h2 { margin-top: 2px; font-size: 17px; }
.companion-peek p:last-child { margin-top: 5px; color: var(--muted); font-size: 13px; line-height: 1.5; }

.companion-orb {
  position: relative;
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid rgba(102, 227, 211, 0.55);
  border-radius: 50%;
  background: #123d4a;
  box-shadow: 0 0 22px rgba(102, 227, 211, 0.18);
}

.companion-orb::before,
.companion-orb::after,
.companion-orb span {
  position: absolute;
  border: 1px solid rgba(170, 255, 245, 0.66);
  border-radius: 50%;
  content: "";
}

.companion-orb::before { width: 26px; height: 12px; transform: rotate(35deg); }
.companion-orb::after { width: 12px; height: 26px; transform: rotate(35deg); }
.companion-orb span { width: 7px; height: 7px; background: var(--aqua); box-shadow: 0 0 12px var(--aqua); }
.companion-orb.large { width: 58px; height: 58px; }

.milestone-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
}

.milestone-card h2 { margin-top: 4px; font-size: 17px; }
.milestone-card > strong { color: var(--sand); font-size: 17px; font-variant-numeric: tabular-nums; }

.view-heading {
  justify-content: space-between;
  gap: 16px;
  padding: 8px 2px 14px;
}

.view-heading h2 { margin-top: 2px; font-size: clamp(28px, 8vw, 38px); }
.view-intro { max-width: 680px; margin: -3px 2px 16px; color: var(--muted); font-size: 14px; line-height: 1.65; }

.production-layout,
.market-grid,
.companion-layout {
  display: grid;
  gap: 12px;
}

.production-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  padding: 16px;
}

.production-card .secondary-button { grid-column: 1 / -1; width: 100%; }

.card-icon {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border: 1px solid rgba(102, 227, 211, 0.45);
  border-radius: 15px;
  color: #dffdfa;
  background: #15505b;
  font-family: "Songti SC", serif;
  font-size: 17px;
  font-weight: 800;
}

.card-copy h3 { margin-top: 4px; font-size: 20px; }
.card-copy p { margin-top: 5px; color: var(--muted); font-size: 14px; line-height: 1.55; }

.recipe-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.recipe-card { padding: 14px; }
.recipe-head { justify-content: space-between; }
.recipe-symbol { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 12px; color: #fff2d3; background: #6e5131; font-size: 13px; font-weight: 800; }
.recipe-symbol.fish { color: #d5f8ff; background: #255672; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #526d75; }
.status-dot.ready { background: var(--aqua); box-shadow: 0 0 10px rgba(102, 227, 211, 0.56); }
.recipe-card h3 { margin-top: 12px; font-size: 17px; }
.recipe-card p { min-height: 38px; margin-top: 5px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.recipe-card button { width: 100%; margin-top: 10px; }

.queue-card { margin-top: 12px; padding: 16px; }
.queue-header { justify-content: space-between; gap: 12px; }
.queue-header h3 { font-size: 18px; }
.queue-header span { color: var(--muted); font-size: 12px; }
.empty-state { margin-top: 14px; padding: 18px; border: 1px dashed var(--line-strong); border-radius: 13px; color: var(--muted); text-align: center; font-size: 13px; }

.queue-job { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 14px; margin-top: 15px; }
.queue-job strong { font-size: 15px; }
.queue-job small { color: var(--muted); }
.queue-bar { grid-column: 1 / -1; height: 7px; overflow: hidden; border-radius: 99px; background: rgba(255,255,255,.08); }
.queue-bar span { display: block; height: 100%; background: var(--aqua); transition: width 1s linear; }

.boundary-notice {
  margin-bottom: 14px;
  padding: 14px 15px;
  border-left: 3px solid var(--sand);
  border-radius: 0 12px 12px 0;
  background: rgba(76, 48, 26, 0.48);
}

.boundary-notice strong { color: #ffd8a8; font-size: 13px; }
.boundary-notice p { margin-top: 4px; color: #d5c1a5; font-size: 12px; line-height: 1.55; }
.companion-boundary { border-left-color: var(--aqua); background: rgba(16, 62, 67, 0.38); }
.companion-boundary strong { color: #bdfff4; }
.companion-boundary p { color: #acd2d0; }

.market-column,
.listing-card,
.receipt-card,
.chat-card,
.delegate-card { padding: 16px; }

.section-row { justify-content: space-between; gap: 12px; }
.section-row h3 { font-size: 19px; }
.section-row > span { color: var(--faint); font-size: 11px; }

.order-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin-top: 13px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #0d2a3a;
}

.order-card .secondary-button { grid-column: 1 / -1; width: 100%; }
.avatar { display: grid; width: 40px; height: 40px; place-items: center; border-radius: 50%; color: #2d1909; background: #e0a96c; font-family: "Songti SC", serif; font-weight: 800; }
.avatar.blue { color: #d9f5ff; background: #32627a; }
.order-main { min-width: 0; }
.order-main strong { display: block; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.order-main p { margin-top: 3px; color: var(--muted); font-size: 13px; }
.order-price { text-align: right; }
.order-price strong { display: block; color: var(--sand); font-size: 17px; font-variant-numeric: tabular-nums; }
.order-price small { color: var(--faint); font-size: 11px; }
.order-status { min-width: 48px; min-height: 30px; font-size: 11px; }

.listing-card label,
.dialog-label {
  display: grid;
  gap: 7px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.listing-card input,
.listing-card select,
.chat-form input,
.dialog-label input {
  width: 100%;
  min-height: 48px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  color: var(--ink);
  background: #071c2a;
}

.form-split { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fee-preview { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; color: var(--muted); font-size: 12px; }
.fee-preview strong { color: var(--sand); }

.receipt-card {
  border-color: rgba(102, 227, 211, 0.35);
  background: #10343f;
}

.receipt-card h3 { color: #c9fff6; font-size: 17px; }
.receipt-card p { margin-top: 6px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.receipt-card dl { display: grid; grid-template-columns: 1fr auto; gap: 7px 14px; margin: 13px 0 0; font-size: 12px; }
.receipt-card dt { color: var(--muted); }
.receipt-card dd { margin: 0; color: var(--ink); font-variant-numeric: tabular-nums; }

.chat-card { padding-bottom: 12px; }
.chat-identity { gap: 11px; padding-bottom: 13px; border-bottom: 1px solid var(--line); }
.chat-identity > div:nth-child(2) { display: grid; min-width: 0; }
.chat-identity span { color: var(--muted); font-size: 11px; }
.chat-identity strong { margin-top: 2px; font-family: "Songti SC", serif; font-size: 18px; }
.chat-identity .text-button { margin-left: auto; }

.message-list {
  display: flex;
  min-height: 290px;
  max-height: 390px;
  flex-direction: column;
  gap: 10px;
  padding: 15px 0;
  overflow-y: auto;
}

.message {
  max-width: 86%;
  padding: 10px 12px;
  border-radius: 14px 14px 14px 4px;
  color: #d8eeec;
  background: #123846;
  font-size: 13px;
  line-height: 1.55;
}

.message.user {
  align-self: flex-end;
  border-radius: 14px 14px 4px 14px;
  color: #251b0e;
  background: #dbad74;
}

.message small { display: block; margin-top: 4px; color: rgba(208, 235, 232, .55); font-size: 11px; }
.message.user small { color: rgba(50, 29, 11, .58); }

.chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.chat-form button {
  min-width: 64px;
  min-height: 48px;
  border: 1px solid rgba(102, 227, 211, 0.45);
  border-radius: 11px;
  color: #dffff9;
  background: #16515a;
  font-weight: 750;
}

.delegate-card h3 { margin-top: 6px; font-size: 21px; }
.delegate-card > p:not(.section-kicker) { min-height: 52px; margin-top: 7px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.delegate-card .secondary-button { width: 100%; margin-top: 14px; }

.bottom-nav {
  position: fixed;
  z-index: 40;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  height: calc(var(--nav-height) + env(safe-area-inset-bottom));
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 7px 10px env(safe-area-inset-bottom);
  border-top: 1px solid var(--line);
  background: rgba(4, 17, 29, 0.96);
  backdrop-filter: blur(20px);
}

.nav-item {
  display: flex;
  min-width: 0;
  min-height: 58px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  padding: 5px;
  border: 0;
  border-radius: 12px;
  color: var(--faint);
  background: transparent;
}

.nav-item span { font-size: 18px; line-height: 1; }
.nav-item strong { font-size: 12px; }
.nav-item.active { color: var(--aqua); background: rgba(18, 59, 69, 0.72); }

dialog {
  color: var(--ink);
}

dialog::backdrop {
  background: rgba(0, 8, 15, 0.74);
  backdrop-filter: blur(4px);
}

.sheet-dialog,
.confirm-dialog {
  width: calc(100% - 24px);
  max-width: 520px;
  margin: auto auto 0;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 22px 22px 0 0;
  background: #082130;
  box-shadow: 0 -18px 48px rgba(0, 0, 0, .4);
}

.sheet-dialog[open] { animation: sheet-in 220ms ease-out; }

@keyframes sheet-in {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 18px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { margin-top: 2px; font-size: 24px; }
.inventory-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; max-height: 62svh; padding: 16px 16px calc(18px + env(safe-area-inset-bottom)); overflow-y: auto; }
.inventory-item { display: flex; min-height: 58px; align-items: center; justify-content: space-between; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #0e2c3d; }
.inventory-item span { color: var(--muted); font-size: 12px; }
.inventory-item strong { font-size: 16px; font-variant-numeric: tabular-nums; }
.settings-copy { margin: 16px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: #0e2c3d; }
.settings-copy p { margin-top: 7px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.sheet-dialog > .danger-button { width: calc(100% - 32px); margin: 0 16px calc(18px + env(safe-area-inset-bottom)); }

.confirm-dialog {
  max-width: 390px;
  margin: auto;
  padding: 20px;
  border-radius: 18px;
}

.confirm-dialog h2 { font-size: 22px; }
.confirm-dialog > p { margin-top: 8px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.dialog-actions { justify-content: flex-end; gap: 8px; margin-top: 18px; }
.dialog-label { margin-top: 16px; }

.toast {
  position: fixed;
  z-index: 100;
  right: 16px;
  bottom: calc(var(--nav-height) + env(safe-area-inset-bottom) + 15px);
  left: 16px;
  max-width: 460px;
  min-height: 46px;
  margin: 0 auto;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  color: var(--ink);
  background: #123548;
  box-shadow: 0 16px 36px rgba(0, 0, 0, .3);
  font-size: 13px;
  line-height: 1.55;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { border-color: rgba(242, 141, 130, .55); background: #4a292d; }

@media (min-width: 560px) {
  .save-status { display: flex; }
  .resource-strip { padding-right: 20px; padding-left: 20px; }
  .view { padding: 20px; }
  .ocean-scene { min-height: 430px; }
  .raft-grid { width: 240px; height: 240px; }
  .production-card { grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; }
  .production-card .secondary-button { grid-column: auto; width: auto; }
  .order-card { grid-template-columns: auto minmax(0, 1fr) auto auto; }
  .order-card .secondary-button { grid-column: auto; width: auto; }
  .inventory-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 900px) {
  :root { --nav-height: 0px; }
  .app-shell { padding: 0 0 30px 92px; }
  .topbar { min-height: 76px; padding-right: 28px; padding-left: 28px; }
  .resource-strip { top: 76px; max-width: none; padding: 10px 28px; }
  .bottom-nav { top: 0; right: auto; width: 92px; height: 100svh; grid-template-columns: 1fr; grid-template-rows: repeat(4, 80px); align-content: center; padding: 16px 10px; border-top: 0; border-right: 1px solid var(--line); }
  .nav-item { min-height: 68px; }
  .view { padding: 24px 28px 40px; }
  .home-view.active { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(340px, .8fr); align-items: start; gap: 18px; }
  .home-panel-stack { margin-top: 0; }
  .ocean-scene { min-height: 620px; }
  .raft-grid { width: 290px; height: 290px; }
  .drift-supply { right: 14%; }
  .production-layout { grid-template-columns: minmax(0, 1.2fr) minmax(310px, .8fr); }
  .queue-card { margin-top: 18px; }
  .market-grid { grid-template-columns: minmax(0, 1.15fr) minmax(330px, .85fr); align-items: start; }
  .receipt-card { grid-column: 2; }
  .companion-layout { grid-template-columns: minmax(0, 1.25fr) minmax(300px, .75fr); align-items: start; }
  .sheet-dialog { margin: auto 0 auto auto; height: 100svh; max-height: none; border-radius: 22px 0 0 22px; }
  .toast { bottom: 22px; }
}

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