/* Touch operating shell: navy controls, white content, and semantic actions. */
@font-face {
  font-family: 'SUIT Variable';
  src: url('./assets/fonts/SUIT-Variable.woff2?sha=aa894a204d5a6fbae259dac6868d350cbd373a390caee0313f92946af741df23') format('woff2');
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --ink: #20354c;
  --navy: #20374f;
  --navy-deep: #142638;
  --teal: #087f83;
  --teal-deep: #066a70;
  --paper: #f2f5f9;
  --enamel: #ffffff;
  --enamel-shade: #eaf0f6;
  --line: #cfdae5;
  --line-deep: #a3b5c6;
  --muted: #566b80;
  --brass: #a87820;
  --brass-light: #f5dfab;
  --amber: #946000;
  --danger: #ad3542;
  --dock: 96px;
  --hud-height: 80px;
  --panel-width: 360px;
  --map-top-inset: calc(var(--hud-height) + 64px);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --ease: cubic-bezier(.2, .65, .3, 1);
  font-family: 'SUIT Variable', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  font-size: 14px;
  font-synthesis: none;
  color: var(--ink);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}
body { background: #566b80; }
button, input, select, textarea { font: inherit; }
button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-width: 44px; min-height: 44px; margin: 0; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); font-weight: 740; line-height: 1.4; cursor: pointer; touch-action: manipulation; transition: background-color 140ms var(--ease), border-color 140ms var(--ease); }
button > span { min-width: 0; }
button:hover:not(:disabled) { border-color: #87a8c1; background: #f2f7fb; }
button:active:not(:disabled) { background: #e8f1f8; }
button:disabled { color: #718396; background: #eaf0f6; border-color: #d4dee8; box-shadow: none; cursor: not-allowed; }
button:disabled svg { opacity: .5; filter: saturate(.25); }
button[aria-busy='true'] { cursor: progress; border-color: var(--brass); }
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
canvas:focus-visible,
a:focus-visible,
summary:focus-visible,
[role='application']:focus-visible {
  outline: 3px solid #16a3af;
  outline-offset: 3px;
}
[hidden] { display: none !important; }
strong { font-weight: 820; }
small { font-size: 12px; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}
#game, #field { position: absolute; inset: 0; width: 100%; height: 100%; }
#field { display: block; touch-action: none; }
.glyph-definitions { position: absolute; width: 0; height: 0; overflow: hidden; pointer-events: none; }
.ui-symbol, .action-icon, .tool-icon {
  display: block;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  overflow: visible;
}
.action-icon { width: 24px; height: 24px; }

/* Each resource is a separate instrument; the world stays visible between them. */
.hud {
  position: absolute;
  z-index: 7;
  top: calc(10px + var(--safe-top));
  left: calc(12px + var(--safe-left));
  right: calc(12px + var(--safe-right));
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  pointer-events: none;
}
.hud > *, .resource-strip { pointer-events: auto; }
.brand { flex: 0 0 auto; min-height: 60px; padding: 7px 11px; gap: 10px; text-align: left; border-color: #42607a; border-radius: 13px; background: var(--navy); color: #fff; box-shadow: 0 4px 14px #10253730; }
.brand > span { display: block; font-size: 14px; font-weight: 850; letter-spacing: -.025em; white-space: nowrap; }
.brand small { display: block; margin-top: 3px; font-size: 12px; font-weight: 600; color: #c2d4e4; }
.brand .ui-symbol { width: 34px; height: 34px; filter: drop-shadow(0 1px 1px #566b8044); }
.resource-strip { display: flex; align-items: center; gap: 7px; min-width: 0; }
.hud-number { display: flex; align-items: center; justify-content: flex-start; text-align: left; gap: 9px; min-width: 104px; min-height: 60px; padding: 8px 12px; border: 1px solid #42607a; border-radius: 12px; background: var(--navy); color: #fff; box-shadow: 0 4px 14px #10253730; font-variant-numeric: tabular-nums; }
.hud-number > span { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.hud-number small { color: #c2d4e4; font-size: 12px; font-weight: 650; line-height: 1.1; }
.hud-number strong { display: block; font-size: 19px; line-height: 1.1; letter-spacing: -.025em; white-space: nowrap; }
.hud-number .ui-symbol { width: 32px; height: 32px; }
.hud-cash { min-width: 169px; }
.hud-cash small { color: #c2d4e4; }
.hud-cash strong { color: #fff; }
.hud-save { flex: 0 0 48px; width: 48px; min-height: 60px; flex-direction: column; gap: 1px; padding: 4px; border-color: #42607a; background: var(--navy); color: #fff; font-size: 12px; }
.hud-save .ui-symbol { width: 29px; height: 29px; }
.clock { display: flex; align-items: center; gap: 8px; min-width: 0; min-height: 60px; margin-left: auto; padding: 7px 8px 7px 12px; border: 1px solid #42607a; border-radius: 12px; background: var(--navy); color: #fff; box-shadow: 0 4px 14px #10253730; font-variant-numeric: tabular-nums; }
.clock > span { min-width: 0; max-width: 168px; font-size: 12px; font-weight: 740; line-height: 1.45; }
.clock > .primary { border-color: var(--teal-deep); background: var(--teal); color: #fff; box-shadow: none; }
.speed-controls { display: flex; flex-shrink: 0; align-items: center; gap: 2px; padding: 2px; border: 1px solid #526b81; border-radius: 10px; background: var(--navy-deep); }
.speed-controls button { width: 44px; min-width: 44px; height: 44px; min-height: 44px; padding: 0; border: 0; border-radius: 7px; background: transparent; color: #dbe7f2; box-shadow: none; font-size: 14px; font-weight: 800; }
.speed-controls button[aria-pressed='true'] { background: var(--teal); color: #fff; }
.speed-controls .ui-symbol { width: 28px; height: 28px; }

/* Controls and live field notices sit below the resource instruments. */
.world-status { position: absolute; z-index: 3; top: calc(var(--hud-height) + 58px + var(--safe-top)); left: calc(12px + var(--safe-left)); max-width: min(520px, calc(100% - 240px)); padding: 5px 8px; border-radius: 7px; background: #142638df; color: #d7e6f3; font-size: 12px; line-height: 1.4; pointer-events: none; }
.camera-tools { position: absolute; z-index: 5; top: calc(var(--map-top-inset) + var(--safe-top)); right: calc(12px + var(--safe-right)); display: grid; grid-template-columns: repeat(4, 44px); gap: 6px; max-height: calc(100dvh - var(--hud-height) - var(--dock) - 64px); overflow-y: auto; scrollbar-width: none; }
.camera-tools button { width: 44px; height: 44px; min-height: 44px; padding: 6px; border-color: #42607a; border-radius: 10px; background: var(--navy); color: #fff; box-shadow: 0 3px 10px #10253730; }
.camera-tools .ui-symbol { width: 29px; height: 29px; }

/* Five primary tools remain visible in a bounded navy dock. */
.toolbar { position: absolute; z-index: 10; bottom: calc(10px + var(--safe-bottom)); left: 50%; transform: translateX(-50%); display: grid; grid-template-columns: repeat(5, minmax(44px, 1fr)); gap: 6px; width: 436px; max-width: calc(100% - 24px - var(--safe-left) - var(--safe-right)); padding: 6px; border: 1px solid #42607a; border-radius: 16px; background: var(--navy-deep); box-shadow: 0 5px 20px #10253740; }
.toolbar button { flex-direction: column; gap: 1px; min-width: 44px; min-height: 70px; padding: 4px; border: 1px solid transparent; border-radius: 10px; background: var(--navy); color: #e6eff7; box-shadow: none; }
.toolbar button[aria-pressed='true'] { border-color: #63c9ce; background: var(--teal); color: #fff; }
.toolbar button:active:not(:disabled) { transform: translateY(2px); }
.dock-art { display: grid; place-items: center; width: 46px; height: 46px; filter: drop-shadow(0 2px 1px #566b8038); }
.dock-art .ui-symbol { width: 43px; height: 43px; }
.dock-label { font-size: 14px; font-weight: 800; line-height: 18px; }

/* The canvas has exactly the visible hit area; no stretched letterboxing. */
.minimap { position: absolute; z-index: 4; left: calc(12px + var(--safe-left)); bottom: calc(var(--dock) + 8px + var(--safe-bottom)); width: 202px; padding: 10px; border: 1px solid #42607a; border-radius: 14px; background: var(--navy); color: #fff; box-shadow: 0 4px 16px #10253740; }
.minimap-heading { display: flex; align-items: center; gap: 5px; min-height: 44px; margin: -4px -4px 6px; }
.minimap-heading > .ui-symbol { width: 24px; height: 24px; }
.minimap-heading > span { flex: 1; min-width: 0; font-size: 12px; font-weight: 800; white-space: nowrap; color: #fff; }
.minimap-expand { width: 44px; height: 44px; min-width: 44px; min-height: 44px; padding: 7px; margin-left: auto; border-color: #526b81; background: var(--navy-deep); border-radius: 9px; }
.minimap-expand .ui-symbol { width: 26px; height: 26px; }
.minimap canvas { display: block; width: 180px; height: 135px; margin-inline: auto; border: 0; border-radius: 7px; background: #20354c; touch-action: none; box-shadow: inset 0 0 0 1px #20354c66; }
.minimap-footer { display: flex; align-items: center; justify-content: space-between; gap: 7px; margin-top: 7px; color: #c2d4e4; font-size: 12px; line-height: 17px; font-variant-numeric: tabular-nums; }
#minimap-coordinates { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.minimap-north { flex: 0 0 auto; color: #c2d4e4; }
.minimap.is-expanded { width: 310px; max-width: calc(100% - 24px - var(--safe-left) - var(--safe-right)); padding: 10px; }
.minimap.is-expanded canvas { width: min(288px, 100%, calc((100dvh - var(--hud-height) - var(--dock) - var(--safe-top) - var(--safe-bottom) - 96px) * 1.333333)); height: auto; aspect-ratio: 4 / 3; }
.minimap.is-expanded .minimap-heading > span { display: block; font-size: 14px; }
.minimap.is-expanded .minimap-expand { border-color: var(--brass); background: #cfdae5; }
.panel-open .minimap, .placing .minimap, .path-planning .minimap { display: none; }

/* Panels preserve the live field on the left, and become a bounded bottom sheet. */
.panel { position: absolute; z-index: 8; top: calc(var(--hud-height) + 8px + var(--safe-top)); right: calc(12px + var(--safe-right)); bottom: calc(var(--dock) + 8px + var(--safe-bottom)); display: flex; flex-direction: column; width: var(--panel-width); max-width: calc(100% - 24px); min-height: 0; border: 1px solid #b9cad9; border-radius: 16px; background: #fff; box-shadow: 0 8px 28px #10253740; overflow: hidden; }
.panel-head { display: flex; flex-shrink: 0; align-items: center; justify-content: space-between; gap: 8px; min-height: 60px; padding: 7px 10px; border-bottom: 1px solid #42607a; background: var(--navy); color: #fff; }
.panel-heading { display: flex; align-items: center; gap: 10px; min-width: 0; }
.panel-heading > div { min-width: 0; }
#panel-icon { width: 38px; height: 38px; filter: drop-shadow(0 2px 1px #20354c55); }
.panel-head small { font-size: 12px; font-weight: 580; color: #c2d4e4; }
.panel-head h1 { margin: 1px 0 0; font-size: 18px; font-weight: 840; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.panel-head > button { flex: 0 0 44px; width: 44px; height: 44px; padding: 6px; border-color: #526b81; border-radius: 10px; background: var(--navy-deep); }
.panel-content { flex: 1; min-height: 0; padding: 12px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #a3b5c6 transparent; }

/* Catalog search and categories lead to the cards; grades belong to detail. */
.catalog-search { display: flex; align-items: center; gap: 6px; padding: 0; margin: 0 0 6px; }
.catalog-search > label, .catalog-search .control { display: flex; flex: 1; flex-direction: row; align-items: center; gap: 7px; min-width: 0; margin: 0; padding: 0 9px; border: 1px solid #cfdae5; border-radius: 10px; background: #f5f8fc; box-shadow: inset 0 1px 3px #566b8012; }
.catalog-search .ui-symbol, .catalog-search .action-icon { width: 24px; height: 24px; }
.catalog-search input { margin: 0; padding: 11px 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; font-size: 15px; }
.catalog-search > button { flex: 0 0 44px; width: 44px; padding: 7px; }
.catalog-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 5px 0 7px; font-size: 14px; font-weight: 800; color: var(--ink); }
.catalog-heading small, .catalog-heading span:last-child { font-size: 12px; font-weight: 580; color: #566b80; }
.chips { display: flex; gap: 6px; overflow-x: auto; margin: 0 0 6px; padding: 0 0 2px; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #cfdae5 transparent; }
.chips button { flex: 0 0 auto; min-height: 44px; padding: 7px 10px; border-color: var(--line); border-radius: 9px; background: var(--paper); font-size: 14px; white-space: nowrap; box-shadow: none; }
.chips button[aria-pressed='true'] { color: #fff; border-color: var(--navy); background: var(--navy); box-shadow: none; }
.grade-tabs { margin-bottom: 14px; padding: 3px; gap: 3px; border: 1px solid #cfdae5; border-radius: 10px; background: #f5f8fc; }
.grade-tabs button { flex: 1 1 0; min-width: 0; border-color: transparent; border-radius: 7px; background: transparent; box-shadow: none; text-align: center; }
.grade-tabs button[aria-pressed='true'] { color: #fff; border-color: var(--teal); background: var(--teal); box-shadow: none; }
.build-shortcuts { display: flex; gap: 8px; margin: 11px 0; }
.build-shortcuts button { flex: 1; padding: 8px 6px; font-size: 12px; background: #f5f8fc; }
.facility-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.facility-choice { position: relative; display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 0; min-width: 0; min-height: 178px; padding: 0; border: 1px solid var(--line); border-radius: 12px; background: #fff; text-align: left; box-shadow: none; overflow: hidden; }
.facility-choice:hover:not(:disabled) { border-color: #566b80; background: #f5f8fc; }
.facility-choice[aria-pressed='true'] { border-color: var(--teal); background: #eefafa; box-shadow: inset 0 0 0 1px var(--teal); }
.facility-choice[data-locked='true'] { background: #f5f8fc; }
.facility-choice[data-locked='true'] .facility-art { position: relative; display: grid; place-items: center; width: 100%; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 10px; background: #eef3f8; }
.facility-choice-copy { display: flex; flex-direction: column; gap: 5px; width: 100%; min-width: 0; padding: 8px; }
.facility-choice-copy > strong, .facility-choice > strong { font-size: 14px; line-height: 1.3; letter-spacing: -.02em; }
.facility-choice > strong, .facility-choice > small { margin: 7px 10px 0; }
.facility-choice > small { font-size: 12px; color: #566b80; line-height: 1.5; }
.facility-choice-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 5px; min-width: 0; }
.facility-choice-meta strong { font-size: 14px; color: var(--teal-deep); font-variant-numeric: tabular-nums; }
.facility-choice-meta small { font-size: 12px; color: #566b80; white-space: nowrap; }
.facility-choice-spec { font-size: 12px; font-weight: 600; color: #566b80; line-height: 1.5; }
.lock-note { display: block; color: #566b80; font-size: 12px; font-weight: 760; line-height: 1.45; }
.facility-choice .lock-note { margin: 1px 0 0; }
.facility-art { position: relative; display: grid; place-items: center; width: 100%; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 10px; background: var(--enamel); }
.facility-art img { display: block; width: 100%; height: 100%; object-fit: contain; }
.facility-choice > .facility-art { border-radius: 11px 11px 0 0; aspect-ratio: 16 / 10; }
.facility-art-empty { padding: 8px; font-size: 12px; font-weight: 700; color: #566b80; text-align: center; }
.facility-silhouette { display: block; width: 100%; height: 100%; max-height: 250px; }
.facility-hero { margin: 0 0 12px; border: 1px solid #cfdae5; border-radius: 12px; background: #cfdae5; overflow: hidden; }
.facility-hero .facility-art { aspect-ratio: 16 / 9; border-radius: 0; }
.facility-hero img { max-height: 178px; }
.build-selected { display: flex; align-items: center; gap: 13px; margin: 4px 0 14px; padding: 8px; border: 1px solid #cfdae5; border-radius: 12px; background: #f5f8fc; box-shadow: inset 0 1px 0 #f5f8fc; }
.build-selected-art { flex: 0 0 112px; width: 112px; }
.build-selected > div:last-child { display: flex; flex-direction: column; justify-content: center; gap: 6px; min-width: 0; }
.build-selected h2 { margin: 0; font-size: 17px; line-height: 1.25; letter-spacing: -.025em; }
.build-selected strong { font-size: 17px; color: var(--teal-deep); font-variant-numeric: tabular-nums; }
.build-selected small { font-size: 12px; line-height: 1.45; color: #566b80; }
.build-placement-actions { align-items: stretch; }
.build-placement-actions button:first-child { flex: 1; min-width: 0; }

/* Forms, lists and disclosures share one measured hierarchy. */
.section-title { margin: 18px 0 10px; font-size: 15px; font-weight: 830; line-height: 1.45; letter-spacing: -.025em; }
.section-title:first-child { margin-top: 0; }
.row { display: flex; align-items: baseline; justify-content: space-between; gap: 13px; padding: 10px 0; border-bottom: 1px solid #cfdae566; font-size: 14px; line-height: 1.5; }
.row span { color: #566b80; }
.row strong { max-width: 64%; text-align: right; overflow-wrap: anywhere; color: #566b80; font-variant-numeric: tabular-nums; }
.note { margin: 11px 0; color: #566b80; font-size: 14px; font-weight: 500; line-height: 1.65; overflow-wrap: anywhere; }
.warning { padding: 10px 12px; border: 1px solid #e4be72; border-radius: 10px; background: #fff5dd; color: #835600; }
.rule { height: 1px; margin: 18px 0; border: 0; background: #cfdae5; }
.control { display: flex; flex-direction: column; gap: 7px; min-width: 0; margin: 13px 0; color: #566b80; font-size: 12px; font-weight: 650; line-height: 1.45; }
input, select, textarea { min-width: 0; width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid #cfdae5; border-radius: 9px; background: #f5f8fc; color: #20354c; box-shadow: inset 0 1px 3px #566b8012; font-size: 16px; line-height: 1.45; }
input::placeholder, textarea::placeholder { color: #566b80; }
input:disabled, select:disabled, textarea:disabled { background: #f5f8fc; color: #566b80; }
input[type='search']::-webkit-search-cancel-button { cursor: pointer; }
.input-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; min-width: 0; }
.input-grid .control { min-width: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.actions button { min-width: 44px; padding: 9px 11px; font-size: 14px; }
.primary, .secondary, .danger { border-color: #e8b6bc; background: #fff0f2; color: var(--danger); }
.primary { border-color: #566b80; background: var(--enamel); color: #f5f8fc; box-shadow: inset 0 1px 0 #cfdae5, 0 3px 0 #20354c; }
.primary:hover:not(:disabled) { border-color: var(--teal-deep); background: var(--teal-deep); }
.primary:active:not(:disabled) { box-shadow: inset 0 2px 4px #20354c2c, 0 1px 0 #20354c; }
.danger { border-color: #a3b5c6; background: var(--enamel); color: #566b80; }
.danger:hover:not(:disabled) { border-color: var(--danger); background: #ffe2e7; }
.full { width: 100%; }
.list-button { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; margin-bottom: 9px; padding: 12px 10px; border-color: #cfdae5; border-radius: 10px; background: #f5f8fc; text-align: left; font-size: 14px; }
.list-button > span:first-child { min-width: 0; flex: 1; }
.list-button strong { display: block; line-height: 1.45; }
.list-button small { display: block; margin-top: 5px; color: #566b80; font-size: 12px; line-height: 1.5; }
.list-button > span:last-child { flex: 0 0 auto; color: #566b80; font-size: 12px; }
.list-button > .action-icon { width: 30px; height: 30px; }
.empty { padding: 21px 12px; color: #566b80; font-size: 14px; line-height: 1.8; text-align: center; }
details { margin: 10px 0; padding: 0 11px; border: 1px solid #cfdae5; border-radius: 10px; background: #f5f8fc; }
summary { display: list-item; min-height: 44px; padding: 12px 0; color: #566b80; font-size: 14px; font-weight: 770; line-height: 1.5; cursor: pointer; }
summary::marker { color: #566b80; }
details[open] { background: #f5f8fc; border-color: #cfdae5; }
details[open] > summary { border-bottom: 1px solid #cfdae5; margin-bottom: 9px; color: #566b80; }
.compare-scroll { max-width: 100%; margin: 13px 0; overflow-x: auto; }
.grade-compare { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
.grade-compare th, .grade-compare td { padding: 10px 3px; border-bottom: 1px solid #cfdae5; text-align: right; overflow-wrap: anywhere; }
.grade-compare th:first-child { width: 24%; text-align: left; }
.grade-compare thead th { color: #566b80; font-weight: 850; }
.organization-item { margin-top: 14px; }
.organization-item summary small { display: block; margin-top: 5px; font-size: 12px; color: #566b80; }
.sub-tabs { margin-bottom: 16px; }
.document-link { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; padding: 10px 12px; border: 1px solid #cfdae5; border-radius: 9px; background: #f5f8fc; color: #566b80; font-size: 14px; font-weight: 700; text-decoration: none; }
.footer-note { margin: 19px 0 2px; color: #566b80; font-size: 12px; line-height: 1.7; }

/* Live operations: compact numbers, meaningful color and immediate controls. */
.summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 12px 0; }
.summary-card { display: grid; grid-template-columns: 32px minmax(0, 1fr); grid-template-rows: auto auto; align-items: center; column-gap: 8px; row-gap: 4px; min-width: 0; padding: 10px; border: 1px solid #cfdae5; border-radius: 10px; background: #f5f8fc; box-shadow: inset 0 1px 0 #f5f8fc; }
.summary-card .ui-symbol { grid-row: 1 / span 2; width: 31px; height: 31px; }
.summary-card small { min-width: 0; color: #566b80; font-size: 12px; line-height: 1.35; }
.summary-card strong { min-width: 0; color: #566b80; font-size: 16px; line-height: 1.3; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.tone-good { border-color: #a2d7d5; background-color: #eaf8f7; }
.tone-good strong { color: var(--teal-deep); }
.tone-warning { border-color: #e4be72; background-color: #fff5dd; }
.tone-warning strong { color: var(--amber); }
.tone-danger, .tone-bad { border-color: #e8b6bc; background-color: #fff0f2; }
.tone-danger strong, .tone-bad strong { color: var(--danger); }
.facility-overview { display: flex; align-items: center; gap: 12px; margin: 0 0 12px; }
.facility-overview-art { flex: 0 0 100px; width: 100px; }
.facility-overview > div:last-child { min-width: 0; }
.facility-overview h2 { margin: 0 0 7px; font-size: 18px; line-height: 1.3; letter-spacing: -.025em; }
.facility-overview small { display: block; margin-top: 6px; color: #566b80; font-size: 12px; }
.status-tag { display: inline-block; padding: 4px 8px; border: 1px solid #cfdae5; border-radius: 6px; background: #f5f8fc; color: #566b80; font-size: 12px; font-weight: 730; line-height: 1.3; vertical-align: middle; }
.status-tag[data-status='broken'] { border-color: #e8b6bc; background: #fff0f2; color: var(--danger); }
.status-tag[data-status='construction'] { border-color: #cfdae5; background: #f5f8fc; color: #566b80; }
.facility-alert { display: flex; align-items: center; gap: 9px; padding: 10px 11px; border: 1px solid #e4be72; border-radius: 10px; background: #fff5dd; color: #835600; font-size: 14px; font-weight: 780; line-height: 1.45; }
.facility-alert .ui-symbol { width: 28px; height: 28px; }
.facility-alert[data-issue='construction'] { border-color: #b9cad9; background: #edf4fa; color: #365b7e; }
.facility-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 11px 0; }
.facility-metrics > div { display: flex; flex-direction: column; align-items: center; gap: 5px; min-width: 0; padding: 9px 4px; border: 1px solid #cfdae5; border-radius: 9px; background: #f5f8fc; }
.facility-metrics small { color: #566b80; font-size: 12px; }
.facility-metrics strong { font-size: 18px; color: #566b80; font-variant-numeric: tabular-nums; }
.facility-actions { align-items: stretch; }
.facility-actions button { flex: 1 1 calc(50% - 8px); padding: 9px 7px; }
.stock-controls { margin: 12px 0; padding: 11px; border: 1px solid #a3b5c6; border-radius: 11px; background: #f5f8fc; }
.stock-controls .section-title { margin: 0 0 5px; color: #566b80; }
.stock-order { display: flex; align-items: flex-end; gap: 8px; margin: 10px 0 1px; }
.stock-order .control { flex: 1; min-width: 0; margin: 0; }
.stock-order button { flex: 0 0 auto; }
.port-list { display: grid; gap: 7px; margin: 10px 0; }
.port-button { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 48px; padding: 10px; border-color: #cfdae5; border-radius: 9px; background: #f5f8fc; text-align: left; font-size: 14px; }
.port-button[data-connected='false'] { border-color: #e4be72; background: #fff5dd; }
.port-button strong, .port-button small { display: block; }
.port-button small { margin-top: 4px; color: #566b80; font-size: 12px; line-height: 1.35; }
.port-button > span:last-child { flex: 0 0 auto; color: #566b80; font-size: 12px; }
.port-button .action-icon { width: 27px; height: 27px; }
.facility-traits { margin: 12px 0; padding: 0 10px; border-color: #cfdae5; background: #f5f8fc; }
.operation-controls { margin: 15px 0; padding: 12px; border: 1px solid #cfdae5; border-radius: 11px; background: #f5f8fc; }
.operation-controls > .section-title { margin-top: 0; }
.operation-controls > .full { margin-top: 8px; }
.operation-controls select { width: 100%; max-width: 100%; }
.operation-controls details { margin-top: 12px; }
.operation-controls .row strong { max-width: 61%; }
.path-quickstart { display: grid; gap: 9px; margin-bottom: 11px; }
.need { display: grid; grid-template-columns: 66px minmax(0, 1fr) 32px; align-items: center; gap: 8px; margin: 13px 0; font-size: 12px; }
.need strong { color: #566b80; text-align: right; font-variant-numeric: tabular-nums; }
.meter { height: 8px; border: 1px solid #cfdae5; border-radius: 6px; background: #cfdae5; overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 5px; background: var(--teal); }
.event, .reward-benefit { margin: 14px 0; padding: 13px 0 2px; border-top: 1px solid #cfdae5; font-size: 14px; }
.event .actions button { width: 100%; text-align: left; justify-content: flex-start; }
.reward-benefit h3 { margin: 0 0 7px; font-size: 14px; font-weight: 820; }
.ad-status { padding: 11px 12px; border: 1px solid #cfdae5; border-radius: 10px; background: #f5f8fc; font-size: 12px; line-height: 1.6; }
.menu-shop-link { margin: 12px 0 4px; }
.shop-screen { min-width: 0; }
.shop-intro { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.shop-intro > .ui-symbol { flex: 0 0 34px; width: 34px; height: 34px; }
.shop-intro h2 { margin: 0 0 7px; color: #17344e; font-size: 18px; line-height: 1.4; }
.shop-intro p, .shop-product p { margin: 0; font-size: 13px; line-height: 1.65; overflow-wrap: anywhere; }
.shop-status { padding: 12px; margin: 0 0 14px; border-radius: 10px; background: #edf4f8; color: #24435b; font-size: 13px; line-height: 1.6; }
.shop-product { padding: 15px; margin: 10px 0; border: 1px solid #cfdae5; border-radius: 14px; background: #fff; }
.shop-product.is-owned { border-color: #8cbeb8; background: #f4faf8; }
.shop-product-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 9px; }
.shop-product h3 { margin: 0; font-size: 16px; color: #17344e; }
.shop-price { font-size: 14px; font-weight: 820; color: #17344e; }
.shop-product > .primary { margin-top: 12px; min-height: 48px; }
.shop-product .shop-deal { margin-top: 10px; font-weight: 750; color: #21665f; }
.theme-preview { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0; }
.theme-swatch { padding: 28px 12px 10px; border: 1px solid #cfdae5; border-radius: 12px; color: #17344e; font-size: 13px; font-weight: 800; }
.theme-default { background: linear-gradient(165deg, #90ced0 0 47%, #e3c594 48% 63%, #719e64 64%); }
.theme-coastal { background: linear-gradient(165deg, #a7dce5 0 47%, #e2ebed 48% 63%, #719e64 64%); }
.shop-theme-actions button { min-width: 80px; min-height: 44px; flex: 1; }
.shop-theme-actions [aria-pressed="true"] { border-color: #2a8278; box-shadow: inset 0 0 0 1px #2a8278; background: #edf8f5; }

/* Cause-based flags remain anchored to real facilities. */
.facility-markers { position: absolute; z-index: 2; inset: 0; overflow: hidden; pointer-events: none; }
.facility-marker { position: absolute; width: 44px; height: 44px; min-width: 44px; min-height: 44px; padding: 6px; transform: translate(-50%, -100%); pointer-events: auto; border: 1px solid #cfdae5; border-radius: 10px; background: var(--enamel); box-shadow: inset 0 1px 0 #f5f8fc, 0 3px 0 #566b8088, 0 5px 9px #20354c30; }
.facility-marker:after { content: ''; position: absolute; bottom: -7px; left: 16px; border: 6px solid transparent; border-bottom: 0; border-top-color: #f5f8fc; }
.facility-marker .ui-symbol { width: 29px; height: 29px; }
.facility-marker[data-issue='repair'], .facility-marker[data-issue='access'] { border-color: #a3b5c6; background: var(--enamel); }
.facility-marker[data-issue='stock'] { border-color: #a3b5c6; background: var(--enamel); }
.facility-marker:hover:not(:disabled), .facility-marker:active:not(:disabled) { transform: translate(-50%, -100%); }
.marker-caption { position: absolute; left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%); display: none; width: max-content; max-width: 196px; padding: 7px 9px; border: 1px solid #cfdae5; border-radius: 7px; background: #f5f8fcf5; color: #566b80; font-size: 12px; font-weight: 700; line-height: 1.4; white-space: normal; pointer-events: none; }
.facility-marker:hover .marker-caption, .facility-marker:focus-visible .marker-caption { display: block; }

/* Contract confirmation stays above the dock and inside a bounded map-side card. */
.placement-card, .path-plan-card {
  position: absolute;
  z-index: 11;
  bottom: calc(var(--dock) + 13px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  width: 440px;
  max-width: calc(100% - 24px - var(--safe-left) - var(--safe-right));
  max-height: calc(100dvh - var(--hud-height) - var(--dock) - var(--safe-top) - var(--safe-bottom) - 35px);
  padding: 13px 14px;
  border: 1px solid #566b80;
  border-radius: 15px;
  background: #f5f8fcf8;
  box-shadow: inset 0 2px 0 #f5f8fc, 0 4px 0 #566b8072, 0 8px 24px #20354c44;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.placement-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.placement-head strong { display: block; margin-top: 4px; color: #566b80; font-size: 17px; line-height: 1.3; letter-spacing: -.02em; }
.placement-head small { color: #566b80; font-size: 12px; line-height: 1.4; }
.placement-head strong span { color: #566b80; font-size: 12px; font-weight: 650; }
.placement-close { flex: 0 0 44px; width: 44px; height: 44px; padding: 6px; border-color: #cfdae5; border-radius: 9px; background: #f5f8fc; }
.placement-close .action-icon { width: 28px; height: 28px; }
.placement-close > span:empty { display: none; }
.placement-cost { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 10px 0; padding: 10px 11px; border: 1px solid #a3b5c6; border-radius: 9px; background: var(--enamel); color: #566b80; font-size: 12px; line-height: 1.4; }
.placement-cost strong { margin-left: 4px; color: #566b80; font-size: 18px; font-variant-numeric: tabular-nums; }
.placement-position { display: flex; align-items: center; gap: 5px; font-size: 12px; }
.placement-position > span { flex: 1; min-width: 0; color: #566b80; white-space: nowrap; font-variant-numeric: tabular-nums; }
.placement-position button { min-width: 44px; min-height: 44px; padding: 6px 7px; font-size: 12px; }
.position-step { width: 44px; flex: 0 0 44px; border-color: #cfdae5; background: #f5f8fc; }
.position-step .action-icon { width: 25px; height: 25px; }
.position-step > span { display: none; }
.placement-ports { margin: 9px 0 5px; color: #566b80; font-size: 14px; line-height: 1.55; overflow-wrap: anywhere; }
.placement-reason { margin: 8px 0 11px; color: #566b80; font-size: 14px; font-weight: 750; line-height: 1.5; }
.placement-reason.invalid { color: #566b80; }
.placement-card > .primary { min-height: 48px; font-size: 14px; }
.field-hint { position: absolute; z-index: 6; bottom: calc(var(--dock) + 8px + var(--safe-bottom)); left: calc(226px + var(--safe-left)); display: flex; align-items: center; gap: 9px; width: max-content; max-width: calc(100% - 250px - var(--safe-left) - var(--safe-right)); padding: 7px 8px 7px 12px; border: 1px solid #42607a; border-radius: 11px; background: #142638ed; color: #fff; font-size: 14px; }
.field-hint > span { min-width: 0; max-height: 3.2em; overflow-y: auto; overflow-wrap: anywhere; line-height: 1.55; }
.field-hint button { flex: 0 0 auto; padding: 7px 10px; font-size: 14px; background: #cfdae5; }

/* Help, dialogs and saved-progress controls are part of the same game shell. */
.guide { position: absolute; z-index: 4; top: calc(var(--hud-height) + 96px + var(--safe-top)); left: calc(12px + var(--safe-left)); width: 280px; max-width: calc(100% - 228px - var(--safe-left) - var(--safe-right)); max-height: calc(100dvh - var(--hud-height) - var(--dock) - 124px - var(--safe-top) - var(--safe-bottom)); padding: 11px 12px; border: 1px solid var(--line); border-radius: 13px; background: #fffffff5; box-shadow: 0 4px 14px #10253730; overflow-y: auto; overscroll-behavior: contain; }
.guide-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: #566b80; font-size: 12px; font-weight: 720; }
.guide-head button { flex: 0 0 auto; min-width: 44px; min-height: 44px; margin: -4px -5px -4px 0; padding: 5px; border-color: transparent; background: transparent; box-shadow: none; font-size: 12px; }
.guide h2 { margin: 6px 0 7px; color: #566b80; font-size: 15px; font-weight: 840; line-height: 1.4; }
.guide p { margin: 6px 0 10px; color: #566b80; font-size: 14px; line-height: 1.65; }
.guide .actions { margin: 9px 0 0; gap: 6px; }
.guide .actions button { flex: 1; padding: 8px 7px; font-size: 12px; }
.guide .action-icon { width: 22px; height: 22px; }
.guide-track { display: flex; gap: 4px; margin-top: 11px; }
.guide-track i { flex: 1; height: 4px; border-radius: 3px; background: #cfdae5; }
.guide-track .done { background: #a3b5c6; }
.guide-track .current { background: #a3b5c6; }
.guide-compact button { justify-content: flex-start; width: 100%; min-height: 44px; padding: 3px; border: 0; background: transparent; box-shadow: none; text-align: left; font-size: 12px; }
.panel-open .guide, .placing .guide, .path-planning .guide { display: none; }
.toast { position: absolute; z-index: 40; top: calc(var(--hud-height) + 10px + var(--safe-top)); left: 50%; transform: translateX(-50%); max-width: calc(100% - 24px); padding: 12px 15px; border: 1px solid #cfdae5; border-radius: 11px; background: #f5f8fcf7; color: #566b80; box-shadow: 0 3px 0 #566b805f, 0 7px 20px #566b8037; font-size: 14px; font-weight: 650; line-height: 1.55; overflow-wrap: anywhere; pointer-events: none; }
.modal-layer { position: absolute; z-index: 30; inset: 0; display: flex; align-items: center; justify-content: center; padding: 22px; background: #20354ca6; }
.dialog { position: relative; width: 454px; max-width: 100%; max-height: calc(100dvh - 44px - var(--safe-top) - var(--safe-bottom)); padding: 25px; border: 1px solid var(--line); border-radius: 19px; background: #fff; box-shadow: 0 16px 44px #10253760; overflow-y: auto; overscroll-behavior: contain; }
.dialog > small { color: #566b80; font-size: 12px; font-weight: 700; letter-spacing: .035em; }
.dialog h2 { margin: 12px 0 16px; color: #20354c; font-size: 26px; font-weight: 850; letter-spacing: -.035em; line-height: 1.3; }
.dialog p { color: #566b80; font-size: 14px; font-weight: 500; line-height: 1.7; overflow-wrap: anywhere; }
.dialog .primary, .dialog .secondary, .dialog .danger { width: 100%; min-height: 48px; margin-top: 9px; padding: 12px; text-align: center; font-size: 14px; }
.dialog-heading { display: flex; align-items: flex-start; gap: 13px; }
.dialog-heading > .ui-symbol { width: 44px; height: 44px; }
.dialog-heading > div { min-width: 0; flex: 1; }
.dialog-heading h2 { margin: 5px 0 12px; }
.dialog-close { position: absolute; top: 12px; right: 12px; width: 44px; height: 44px; padding: 6px; }
.dialog-close .ui-symbol { width: 28px; height: 28px; }
.intro-icon { display: block; width: 96px; height: 96px; margin: 0 0 18px; border: 1px solid #a3b5c6; border-radius: 22px; object-fit: cover; box-shadow: 0 3px 0 #566b8066, 0 5px 12px #566b8029; }
.save-transfer-label { display: block; margin: 16px 0 9px; color: #566b80; font-size: 14px; font-weight: 790; }
.save-transfer-text { display: block; width: 100%; min-width: 0; min-height: 144px; max-height: 32dvh; padding: 11px; border: 1px solid #cfdae5; border-radius: 10px; background: #f5f8fc; color: #566b80; font: 16px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; resize: vertical; overscroll-behavior: contain; }
.save-transfer-status { text-align: left; overflow-wrap: anywhere; }
#copy-save-text { min-width: 44px; min-height: 44px; }

/* Profiles, meaningful need severity, and real busy indicators. */
.profile-overview {
  display: flex;
  align-items: center;
  gap: 13px;
  margin: 0 0 15px;
  padding: 12px;
  border: 1px solid #cfdae5;
  border-radius: 12px;
  background: var(--enamel);
}
.profile-overview > .ui-symbol {
  width: 49px;
  height: 49px;
  filter: drop-shadow(0 2px 1px #566b8035);
}
.profile-overview > div { min-width: 0; }
.profile-overview small { color: #566b80; font-size: 12px; font-weight: 650; }
.profile-overview h2 { margin: 4px 0 6px; color: #566b80; font-size: 20px; font-weight: 850; letter-spacing: -.025em; line-height: 1.3; }
.profile-overview span { color: #566b80; font-size: 12px; line-height: 1.45; }
.need[data-level='attention'] strong { color: var(--amber); }
.need[data-level='attention'] .meter { border-color: #e4be72; background: #fff5dd; }
.need[data-level='attention'] .meter i { background: #c78a19; }
.need[data-level='urgent'] strong { color: var(--danger); }
.need[data-level='urgent'] .meter { border-color: #e8b6bc; background: #fff0f2; }
.need[data-level='urgent'] .meter i { background: var(--danger); }
.hud-save { position: relative; }
.hud-save[aria-busy='true'] { border-color: #a3b5c6; background: var(--enamel); }
.hud-save[aria-busy='true']::after { content: ''; position: absolute; right: 4px; bottom: 4px; width: 6px; height: 6px; border-radius: 50%; background: #a3b5c6; box-shadow: 0 0 0 2px #cfdae5; }
.panel[aria-busy='true'] .panel-head { box-shadow: inset 0 1px 0 #566b8077, inset 0 -3px 0 #a3b5c6; }


/* Catalog/detail and cause-based overview contracts shared with ui.js. */
.hud-number:hover:not(:disabled), .brand:hover:not(:disabled), .hud-save:hover:not(:disabled), .camera-tools button:hover:not(:disabled) { background: #2c4d6a; color: #fff; }
.camera-tools .overlay-control { grid-column: span 3; width: auto; justify-content: flex-start; }
#overlay-label { font-size: 14px; white-space: nowrap; }
.panel-open .camera-tools { right: calc(var(--panel-width) + 24px + var(--safe-right)); }
#operations-alert { position: absolute; z-index: 5; top: calc(var(--hud-height) + 8px + var(--safe-top)); left: calc(12px + var(--safe-left)); max-width: calc(100% - 240px); height: 44px; min-height: 44px; max-height: 44px; padding: 6px 10px; flex-wrap: nowrap; overflow: hidden; background: var(--navy); border-color: #42607a; color: #fff; font-size: 14px; box-shadow: 0 3px 10px #10253730; }
#operations-alert[data-level='attention'] { background: #fff5dd; border-color: #e4be72; color: var(--amber); }
#operations-alert[data-level='urgent'] { background: #fff0f2; border-color: #e8b6bc; color: var(--danger); }
#operations-alert > span { display: flex; align-items: center; flex-wrap: nowrap; gap: 6px; min-width: 0; max-height: 30px; white-space: nowrap; overflow: hidden; line-height: 20px; }
#operations-alert strong { flex-shrink: 0; }
#operations-alert small { flex: 0 1 auto; min-width: 0; max-width: 160px; color: inherit; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.need-card { flex-direction: column; align-items: stretch; text-align: left; min-width: 0; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
.need-card strong, .need-card small { display: block; line-height: 1.5; }
.need-card .meter { margin-block: 8px; }
.construction-row { width: 100%; text-align: left; margin-block: 6px; padding: 10px 0; border-bottom: 1px solid var(--line); line-height: 1.55; }
.construction-row strong, .construction-row small { display: block; }
.panel-actions { flex: 0 0 auto; display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); background: #fff; box-shadow: 0 -4px 12px #20354c0c; }
.panel-actions button { flex: 1; min-height: 48px; font-size: 14px; }
.catalog-screen .note { margin: 5px 0; }
.catalog-screen .category-tabs { flex-wrap: nowrap; }
.catalog-card .facility-choice-spec { font-size: 12px; }
.detail-back { justify-content: flex-start; }
.detail-spec-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 12px 0; }
.detail-spec-grid > div { min-width: 0; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
.detail-spec-grid small, .detail-spec-grid strong { display: block; line-height: 1.45; }
.detail-spec-grid strong { margin-top: 5px; font-size: 14px; }
.budget-status, .cost-summary { margin: 12px 0; padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--paper); font-size: 14px; line-height: 1.55; }
.budget-status.tone-warning, .budget-status.tone-danger { border-color: currentColor; }
.cost-row, .cost-total { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; }
.cost-row > :last-child, .cost-total > :last-child { text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.cost-total { margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--line); font-weight: 820; }
.overview-summary { padding: 12px; border-radius: 12px; background: var(--paper); }
.overview-summary h2 { margin: 0 0 6px; font-size: 18px; }
.overview-filter { display: flex; gap: 6px; overflow-x: auto; margin: 12px 0; }
.overview-filter button { flex-shrink: 0; white-space: nowrap; }
.overview-filter button[aria-pressed='true'] { background: var(--navy); color: #fff; border-color: var(--navy); }
.issue-list { display: grid; gap: 10px; }
.issue-card, .issue-row { min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: #fff; font-size: 14px; line-height: 1.55; }
.issue-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.issue-row > div, .issue-row > span:first-of-type { flex: 1; min-width: 0; text-align: left; }
.issue-row strong, .issue-row small { display: block; line-height: 1.5; }
.issue-row small { color: var(--muted); }
.issue-row[data-issue="repair"] { border-left: 4px solid var(--danger); }
.issue-row[data-issue="access"], .issue-row[data-issue="stock"] { border-left: 4px solid #c78a19; }
.issue-card h3, .issue-row h3 { margin: 0 0 5px; font-size: 14px; }
.issue-card p, .issue-row p { margin: 5px 0; color: var(--muted); }
.issue-card[data-level='urgent'] { border-left: 4px solid var(--danger); }
.issue-card[data-level='attention'] { border-left: 4px solid #c78a19; }
.need-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.need-grid > div { min-width: 0; padding: 10px; border: 1px solid var(--line); border-radius: 10px; }
.overview-needs .need { font-size: 14px; }
.path-plan-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.path-plan-head strong { font-size: 17px; }
.path-plan-cost { margin: 10px 0; padding: 10px; border-radius: 9px; background: var(--paper); line-height: 1.55; }
.path-plan-reason { font-size: 14px; line-height: 1.55; color: var(--teal-deep); }
.path-plan-reason.invalid { color: var(--danger); }
.path-plan-actions { display: flex; gap: 8px; margin-top: 12px; }
.path-plan-actions button { flex: 1; min-height: 48px; }
.placing .field-hint, .path-planning .field-hint, .panel-open .field-hint { display: none; }

@media (max-width: 1180px) {
  .brand > span { display: none; }
  .brand { flex: 0 0 48px; width: 48px; padding: 7px; justify-content: center; }
  .hud { gap: 7px; }
  .hud-number { min-width: 94px; padding: 8px 9px; gap: 7px; }
  .hud-number strong { font-size: 17px; }
  .hud-cash { min-width: 153px; }
}
@media (max-width: 700px) and (orientation: portrait) {
  :root { --hud-height: 116px; --dock: 88px; }
  .hud { top: calc(6px + var(--safe-top)); left: calc(8px + var(--safe-left)); right: calc(8px + var(--safe-right)); display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; gap: 6px; }
  .brand, .hud-save { min-height: 48px; width: 44px; padding: 4px; border-radius: 10px; }
  .brand .ui-symbol, .hud-save .ui-symbol { width: 28px; height: 28px; }
  .hud-save > span { display: none; }
  .resource-strip { gap: 4px; }
  .hud-number { flex: 1; min-width: 0; min-height: 48px; gap: 3px; padding: 5px; border-radius: 10px; }
  .hud-number .ui-symbol { display: none; }
  .hud-number small { font-size: 12px; }
  .hud-number strong { min-width: 0; font-size: 14px; overflow: hidden; text-overflow: ellipsis; }
  .hud-cash { flex: 1.6; min-width: 0; }
  .clock { grid-column: 1 / -1; width: 100%; min-height: 52px; margin: 0; padding: 3px 5px 3px 8px; gap: 5px; }
  .clock > span { flex: 1; max-width: none; font-size: 12px; }
  .clock > .primary { font-size: 14px; padding-inline: 8px; }
  .speed-controls { padding: 1px; gap: 1px; }
  #operations-alert { left: calc(8px + var(--safe-left)); top: calc(var(--hud-height) + 6px + var(--safe-top)); max-width: calc(100% - 16px - var(--safe-left) - var(--safe-right)); }
  .world-status { display: none; }
  #operations-alert small { max-width: 120px; }
  .camera-tools, .panel-open .camera-tools { right: calc(8px + var(--safe-right)); top: calc(var(--map-top-inset) + var(--safe-top)); gap: 6px; }
  .toolbar { width: 376px; max-width: calc(100% - 16px - var(--safe-left) - var(--safe-right)); bottom: calc(8px + var(--safe-bottom)); gap: 4px; padding: 5px; border-radius: 14px; }
  .toolbar button { min-height: 64px; padding: 3px; }
  .dock-art, .dock-art .ui-symbol { width: 34px; height: 34px; }
  .dock-label { font-size: 14px; }
  .minimap { left: calc(8px + var(--safe-left)); bottom: calc(var(--dock) + 8px + var(--safe-bottom)); width: 128px; padding: 8px; }
  .minimap canvas { width: 110px; height: 82.5px; }
  .minimap:not(.is-expanded) .minimap-heading > span { display: none; }
  .minimap-footer { gap: 3px; font-size: 12px; line-height: 15px; }
  .minimap.is-expanded { width: 312px; max-width: calc(100% - 16px - var(--safe-left) - var(--safe-right)); }
  .panel { top: auto; right: calc(8px + var(--safe-right)); left: calc(8px + var(--safe-left)); bottom: calc(var(--dock) + 8px + var(--safe-bottom)); width: auto; max-width: none; height: 52dvh; max-height: 52dvh; border-radius: 14px; }
  .panel-head { min-height: 56px; padding: 5px 8px; }
  #panel-icon { width: 30px; height: 30px; }
  .panel-heading { gap: 7px; flex: 1; }
  .panel-content { padding: 10px; }
  .panel-actions { padding: 8px 10px; }
  .facility-choice { min-height: 174px; }
  .build-selected-art { flex-basis: 96px; width: 96px; }
  .guide { top: calc(var(--hud-height) + 64px + var(--safe-top)); left: calc(8px + var(--safe-left)); width: calc(100% - 220px); max-width: none; padding: 9px; }
  .guide .actions { display: grid; grid-template-columns: 1fr; }
  .guide p, .guide-track { display: none; }
  .field-hint { left: calc(148px + var(--safe-left)); bottom: calc(var(--dock) + 8px + var(--safe-bottom)); max-width: calc(100% - 156px - var(--safe-left) - var(--safe-right)); padding: 8px; }
  .placement-card, .path-plan-card { bottom: calc(var(--dock) + 8px + var(--safe-bottom)); max-width: calc(100% - 16px - var(--safe-left) - var(--safe-right)); padding: 11px; }
  .placement-cost { flex-wrap: wrap; }
  .placement-position { flex-wrap: wrap; }
  .placement-position > span { flex-basis: 100%; }
  .placement-position button:first-of-type { flex: 1; }
  .dialog { padding: 20px; }
}
@media (max-width: 360px) and (orientation: portrait) {
  .hud { column-gap: 4px; }
  .hud-number { padding-inline: 4px; }
  .hud-cash { flex: 1.8; }
  .clock > .primary { padding-inline: 6px; font-size: 14px; }
  .clock > .primary .action-icon { display: none; }
  .facility-list { grid-template-columns: 1fr; }
  .facility-choice { flex-direction: row; min-height: 94px; }
  .facility-choice > .facility-art { flex: 0 0 78px; width: 78px; aspect-ratio: auto; border-radius: 10px 0 0 10px; }
  .facility-choice-copy { flex: 1; gap: 4px; padding: 7px 8px; }
  .facility-choice-meta { flex-wrap: wrap; gap: 2px; }
  .catalog-heading { margin-block: 3px 5px; }
  .chips button { padding-inline: 8px; }
  .guide { max-height: 120px; width: 102px; }
  .build-selected { gap: 8px; }
  .build-selected-art { flex-basis: 80px; width: 80px; }
  .build-selected h2, .build-selected strong { font-size: 16px; }
  .dialog { padding: 18px; }
}
@media (max-height: 640px) and (orientation: portrait) {
  .panel-open .camera-tools { display: none; }
  .guide { display: none; }
}
@media (max-height: 540px) and (orientation: landscape) {
  :root { --hud-height: 64px; --dock: 84px; --panel-width: min(360px, 38vw); }
  .hud { top: calc(6px + var(--safe-top)); left: calc(8px + var(--safe-left)); right: calc(8px + var(--safe-right)); display: flex; gap: 5px; }
  .brand, .hud-save { flex: 0 0 44px; width: 44px; min-height: 48px; padding: 4px; }
  .brand > span, .hud-save > span { display: none; }
  .resource-strip { gap: 4px; }
  .hud-number { flex: 0 1 auto; min-height: 48px; min-width: 65px; gap: 4px; padding: 5px; }
  .hud-number .ui-symbol { display: none; }
  .hud-number strong { font-size: 14px; }
  .hud-cash { min-width: 118px; }
  .clock { flex: 1; width: auto; min-height: 48px; padding: 2px 4px 2px 7px; gap: 5px; }
  .clock > span { flex: 1; max-width: none; font-size: 12px; }
  .clock > .primary { padding-inline: 7px; font-size: 14px; }
  .clock > .primary .action-icon { display: none; }
  .speed-controls { gap: 1px; padding: 1px; }
  .world-status { display: none; }
  #operations-alert { left: calc(8px + var(--safe-left)); top: calc(var(--hud-height) + 6px + var(--safe-top)); max-width: calc(100% - var(--panel-width) - 32px); }
  .camera-tools, .panel-open .camera-tools { top: calc(var(--map-top-inset) + var(--safe-top)); right: calc(var(--panel-width) + 20px + var(--safe-right)); grid-template-columns: repeat(4, 44px); gap: 5px; max-height: none; overflow: visible; }
  .toolbar { bottom: calc(8px + var(--safe-bottom)); width: 375px; padding: 5px; gap: 5px; }
  .panel-open .toolbar { left: calc((100% - var(--panel-width) - 12px + var(--safe-left) - var(--safe-right)) / 2); max-width: calc(100% - var(--panel-width) - 32px - var(--safe-left) - var(--safe-right)); }
  .toolbar button { min-height: 60px; }
  .dock-art, .dock-art .ui-symbol { width: 32px; height: 32px; }
  .minimap { left: calc(8px + var(--safe-left)); right: auto; bottom: calc(var(--dock) + 8px + var(--safe-bottom)); width: 128px; padding: 8px; }
  .minimap canvas { width: 110px; height: 82.5px; }
  .minimap:not(.is-expanded) .minimap-heading > span { display: none; }
  .minimap.is-expanded { width: 280px; }
  .panel { top: calc(var(--hud-height) + 6px + var(--safe-top)); right: calc(8px + var(--safe-right)); left: auto; bottom: calc(var(--dock) + 8px + var(--safe-bottom)); width: var(--panel-width); height: auto; max-height: none; }
  .panel-open .panel { bottom: calc(8px + var(--safe-bottom)); }
  .panel-head { min-height: 54px; padding: 4px 7px; }
  .panel-head h1 { font-size: 17px; }
  #panel-icon { width: 28px; height: 28px; }
  .panel-content { padding: 9px; }
  .panel-actions { padding: 7px 9px; }
  .facility-list { grid-template-columns: 1fr; }
  .facility-choice { flex-direction: row; min-height: 96px; }
  .facility-choice > .facility-art { flex: 0 0 80px; width: 80px; aspect-ratio: auto; border-radius: 10px 0 0 10px; }
  .facility-choice-copy { padding: 7px; }
  .placement-card, .path-plan-card { left: auto; right: calc(8px + var(--safe-right)); transform: none; bottom: calc(var(--dock) + 8px + var(--safe-bottom)); width: var(--panel-width); max-height: calc(100dvh - var(--hud-height) - var(--dock) - 22px - var(--safe-top) - var(--safe-bottom)); padding: 10px; }
  .placement-position, .placement-cost { flex-wrap: wrap; }
  .placement-position > span { flex-basis: 100%; }
  .placement-position button:first-of-type { flex: 1; }
  .field-hint { left: calc(148px + var(--safe-left)); max-width: calc(100% - var(--panel-width) - 176px); }
  .guide { display: none; }
  .modal-layer { padding: 15px; }
  .dialog { max-height: calc(100dvh - 30px - var(--safe-top) - var(--safe-bottom)); padding: 18px 22px; }
  .intro-icon { float: left; width: 70px; height: 70px; margin: 0 14px 10px 0; }
  .save-transfer-text { min-height: 96px; max-height: 24dvh; }
}
@media (max-width: 740px) and (max-height: 540px) and (orientation: landscape) {
  .hud-number { min-width: 55px; padding-inline: 4px; }
  .hud-cash { min-width: 105px; }
  .clock > span { font-size: 12px; }
  .clock > .primary { max-width: 130px; font-size: 14px; padding-inline: 5px; }
  .camera-tools, .panel-open .camera-tools { grid-template-columns: repeat(3, 44px); }
  .camera-tools .overlay-control { grid-column: span 2; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* Account and return rewards use the same game panel and touch targets. */
.account-card,.cloud-card,.offline-card{margin:12px 0 18px;padding:18px;border:1px solid #c8d8d0;border-radius:18px;background:linear-gradient(145deg,#fffef8,#edf5ef);box-shadow:0 3px 0 #b4c4bb,0 8px 18px #25463d0b}.account-card-heading{display:flex;align-items:center;gap:12px;margin-bottom:14px}.account-card-heading h2{margin:0 0 4px;font-size:19px;color:#244a49}.account-card-heading p{margin:0;font-size:12px;color:#55716d;overflow-wrap:anywhere}.account-emblem{flex:0 0 46px;height:46px;display:grid;place-items:center;border-radius:14px;background:#d0e8dc;color:#245e55;font-size:30px}.account-emblem svg{width:34px;height:34px}.provider-button{width:100%;min-height:52px;margin:8px 0;display:flex;align-items:center;justify-content:flex-start;gap:12px;padding:12px 16px;border:1px solid #bacbc5;border-radius:13px;background:#fff;color:#203c39;font-weight:750;box-shadow:0 3px 0 #d2ded8;touch-action:manipulation}.provider-button:not(:disabled):active{transform:translateY(2px);box-shadow:0 1px 0 #d2ded8}.provider-apple{background:#223b37;color:#fff;border-color:#223b37;box-shadow:0 3px 0 #142823}.provider-button.linked{background:#e1f1e5;color:#275b44;border-color:#a7c7b3;opacity:1}.provider-button:disabled:not(.linked){opacity:.55}.provider-mark{width:24px;height:24px;display:block;flex-shrink:0}.provider-mark svg{width:24px;height:24px}.provider-check{margin-left:auto;color:#2b8756}.offline-payout{display:flex;flex-direction:column;align-items:center;gap:9px;padding:24px 12px;background:#e3f3e8;border:1px solid #bbd9c8;border-radius:18px}.offline-payout small,.offline-payout span{color:#526c61;font-size:13px}.offline-payout strong{font-size:clamp(28px,8vw,42px);font-weight:850;color:#1c6a50;font-variant-numeric:tabular-nums}.save-comparison{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin:16px 0}.save-comparison>div{padding:16px;border:1px solid #becfc7;border-radius:14px;background:#eff7f1;min-width:0}.save-comparison small{display:block;color:#637d70;font-size:11px;margin-bottom:8px}.save-comparison strong{font-size:17px;color:#25584c}.save-comparison p{font-size:12px;line-height:1.5;color:#60756b}.menu-account-link{margin:10px 0} .provider-button:focus-visible{outline:3px solid #eeb66b;outline-offset:3px}@media(max-width:360px){.save-comparison{grid-template-columns:1fr}.account-card,.cloud-card,.offline-card{padding:14px}}
