/* Web UI theme. Origin-inspired maritime palette; all game rules stay in their
   existing modules. Pixel-art geometry, map hit targets and sprites stay intact. */
:root {
  color-scheme: light;
  --bg: #f3f4f6;
  --panel: #fff;
  --line: #dce2e7;
  --muted: #657480;
  --paper: #203746;
  --gold: #8a6830;
  --ink: #173d50;
  --green: #227267;
  --ocean: #173d50;
  --brass: #c8aa72;
  --shadow: 0 5px 24px #1c394908;
}
body {
  background: radial-gradient(ellipse at 10% 0, #e7edef 0, transparent 50%), var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Malgun Gothic', sans-serif;
  color: var(--paper);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}
body:has(dialog[open]) { overflow: hidden; }
button, input, select { border-radius: 11px; }
button { background: #fff; border-color: var(--line); font-weight: 550; }
button:hover:not(:disabled) { background: #edf3f5; border-color: #9aafb9; }
button:active:not(:disabled) { background: #dfe9ed; }
button:disabled { opacity: .45; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 3px solid #347fa4; outline-offset: 3px;
}
.ui-icon { width: 22px; height: 22px; flex: 0 0 auto; vertical-align: middle; }
.app-shell { max-width: 1512px; padding: 0 36px; }
.masthead { height: 92px; gap: 28px; border-bottom: 1px solid #d6dfe4; }
.brand { gap: 12px; }
.brand-symbol {
  display: grid; place-items: center; width: 46px; height: 46px;
  background: var(--ocean); color: #e6cf9f; border: 1px solid #31566a;
  border-radius: 14px; box-shadow: 0 3px 10px #153d5018;
}
.brand-symbol .ui-icon { width: 31px; height: 31px; }
.eyebrow { font: 600 9px/1.5 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; letter-spacing: 2px; }
h1 { font-size: 21px; letter-spacing: -.7px; margin: 1px 0 0; font-weight: 700; }
h1 em { font: normal 27px Georgia, serif; vertical-align: -1px; margin-left: 3px; }
.edition { color: var(--muted); font-size: 12px; padding-left: 25px; }
.edition span { color: var(--gold); }
.masthead nav { gap: 6px; }
.masthead nav button { min-height: 40px; padding: 8px 12px; display: flex; align-items: center; gap: 7px; background: #ffffff8c; border: 1px solid #dce2e7; }
.masthead nav .ui-icon { width: 17px; height: 17px; }
#settings { width: 40px; padding: 10px; justify-content: center; }
#music[aria-pressed=true] { background: #dcece6; color: #276b58; }
main { padding-top: 28px; }
.topline { margin-bottom: 21px; gap: 16px; }
.page-heading { display: flex; flex-direction: column; gap: 3px; }
.page-heading .eyebrow { color: var(--gold); font-size: 9px; }
.page-heading h2 { margin: 0; font-size: 30px; letter-spacing: -1.1px; line-height: 1.35; }
.breadcrumb { font-size: 12px; letter-spacing: 0; }
.breadcrumb strong { color: var(--ocean); font-weight: 600; }
.date { background: #fff9; padding: 10px 15px; border: 1px solid #dde3e8; border-radius: 12px; font-size: 12px; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.date small { margin-left: 12px; font-size: 12px; }
.campaign-toolbar {
  display: grid; grid-template-columns: repeat(8,minmax(0,1fr));
  padding: 7px; gap: 4px; background: #ffffffbe; border: 1px solid #fff;
  box-shadow: var(--shadow); border-radius: 18px; margin-bottom: 24px;
}
.campaign-toolbar button { display: flex; flex-direction: column; gap: 8px; align-items: center; justify-content: center; border: 0; background: transparent; padding: 12px 4px; font-size: 11px; border-radius: 12px; min-height: 76px; }
.campaign-toolbar .ui-icon { color: var(--ocean); }
.campaign-toolbar button:first-child { background: var(--ocean); color: #fff; }
.campaign-toolbar button:first-child .ui-icon { color: #e5cea5; }
.campaign-toolbar button:first-child:hover { background: #26546a; }
.layout { grid-template-columns: minmax(0,1fr) 284px; gap: 22px; align-items: start; }
.harbor-panel { min-width: 0; }
.scene-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: #fff; padding: 16px 20px; border: 1px solid var(--line); border-bottom: 0; border-radius: 20px 20px 0 0; }
.scene-label { position: static; color: var(--paper); text-shadow: none; min-width: 0; }
.scene-label h2 { font-size: 21px; letter-spacing: -.5px; font-weight: 700; margin-bottom: 1px; }
.scene-label span { font: 600 8px/1.5 'Segoe UI', sans-serif; letter-spacing: 1.8px; color: var(--muted); }
.view-switch { position: static; display: flex; gap: 2px; background: #ecf0f2; border-radius: 10px; padding: 3px; flex-shrink: 0; }
.view-switch button { background: transparent; color: var(--muted); border: 0; font-size: 11px; padding: 8px 12px; border-radius: 7px; min-height: 34px; }
.view-switch button[aria-pressed=true] { background: #fff; color: var(--ocean); box-shadow: 0 1px 5px #233b4920; }
.viewport { border: 1px solid var(--line); border-block: 0; }
.viewport canvas { aspect-ratio: 16/10; }
.scene-hint { bottom: 12px; left: 12px; right: 12px; width: fit-content; max-width: calc(100% - 24px); border: 1px solid #ffffff38; border-radius: 8px; background: #143648eb; color: #f8f6ed; padding: 6px 10px; font-size: 10px; pointer-events: none; }
.location-strip { background: #fff; padding: 13px 18px; border-radius: 0 0 18px 18px; border-color: var(--line); font-size: 11px; }
.location-strip strong { color: var(--ocean); font-weight: 650; }
.location-strip span { color: var(--muted); }
.location-strip strong::before { content: ''; display: inline-block; width: 6px; height: 6px; background: #438579; border-radius: 50%; margin-right: 7px; vertical-align: 1px; }
.facility-heading { display: flex; align-items: baseline; justify-content: space-between; margin: 23px 2px 10px; gap: 10px; }
.facility-heading h3 { margin: 0; font-size: 15px; letter-spacing: -.3px; }
.facility-heading span { font-size: 10px; color: var(--muted); }
.actions { grid-template-columns: repeat(6,minmax(0,1fr)); gap: 8px; margin-top: 0; }
.action { flex-direction: column; padding: 13px 4px 12px; gap: 8px; font-size: 11px; border-radius: 14px; background: #fff; box-shadow: 0 2px 4px #20374603; }
.action .ui-icon { color: var(--gold); width: 23px; height: 23px; }
.primary, .action.primary { background: var(--ocean); color: #fff; border-color: var(--ocean); }
.primary:hover:not(:disabled), .action.primary:hover:not(:disabled) { background: #29576b; border-color: #29576b; }
.sidebar { gap: 16px; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); }
.panel-head { padding: 13px 17px; letter-spacing: 1.6px; font-size: 9px; font-weight: 600; color: var(--muted); }
.panel-head span { font-size: 10px; letter-spacing: 0; color: inherit; }
.captain-panel { background: linear-gradient(135deg,#234f62,#163747); border-color: #224c60; color: #fff; }
.captain-panel .panel-head { color: #d9c596; border-color: #ffffff1c; }
.captain { padding: 18px; gap: 13px; }
.portrait { width: 56px; height: 70px; border: 1px solid #ccba8e; border-radius: 10px; }
.captain h3 { font-size: 18px; font-weight: 650; letter-spacing: -.4px; }
.captain p { color: #bacbd2; font-size: 11px; }
.stats { gap: 12px; padding: 0 18px 18px; }
.stat small { font-size: 10px; color: #b6c9d1; }
.stat strong { font: 650 23px/1.4 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-variant-numeric: tabular-nums; color: #f4ddb0; }
.stat strong span { color: #bacbd2; }
.stat strong + small { margin: 4px 0 0; font-size: 9px; line-height: 1.6; }
.ship-summary { padding: 15px 18px; }
.ship-title { margin-bottom: 13px; gap: 8px; }
.ship-title strong { font-weight: 700; }
.ship-title small { background: #edf2f4; padding: 3px 6px; border-radius: 5px; }
.resource { font-size: 12px; margin: 0; padding: 7px 0; color: var(--muted); border-top: 1px solid #edf0f3; }
.resource b { color: var(--paper); font-weight: 600; font-variant-numeric: tabular-nums; }
.quest { padding: 18px; background: #f4eddf; border: 1px solid #e6dbc6; border-radius: 18px; color: #4b452f; }
.quest .eyebrow { color: #816a41; }
.quest h3 { font-size: 15px; margin: 9px 0; }
.quest p { color: #6a624f; font-size: 12px; line-height: 1.8; }
.quest button { border: 1px solid #d7c8ab; color: #65502e; background: #fff9; border-radius: 10px; min-height: 40px; }
.quest .small { margin-top: 9px; font-size: 10px; }
.log-panel { background: #ffffff90; border: 1px solid #fff; border-radius: 18px; padding: 20px; margin-top: 24px; gap: 12px; grid-template-columns: 134px 1fr; }
.log-title h3 { font-weight: 650; font-size: 13px; }
.log-title small { font: 600 8px 'Segoe UI',sans-serif; letter-spacing: 1.5px; }
.log-list { gap: 9px; }
.log-item { color: var(--muted); font-size: 11px; gap: 12px; }
.log-item:first-child { color: var(--ocean); }
.log-item time { color: #768590; font: 600 10px/1.6 'Segoe UI',sans-serif; }
footer { color: #6c7b86; font-size: 9px; border-color: #dce2e7; margin-top: 24px; }
kbd { border-color: #c8d2d9; border-radius: 4px; background: #ffffff8c; }
dialog { width: min(760px,calc(100% - 40px)); max-height: calc(100dvh - 64px); background: #f7f8fa; color: var(--paper); border: 1px solid #ffffffb3; border-radius: 24px; box-shadow: 0 32px 100px #0826364d; overscroll-behavior: contain; }
dialog::backdrop { background: #0c273d66; backdrop-filter: blur(8px); }
.dialog-header { padding: 24px 28px 19px; background: #f7f8faf2; border-color: var(--line); position: sticky; top: 0; z-index: 10; backdrop-filter: blur(16px); }
.dialog-header h2 { font-size: 23px; font-weight: 700; letter-spacing: -.6px; margin-top: 5px; }
.dialog-header button, .conversation-close { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border-radius: 50%; background: #e5e9ee; color: #677986; border: 0; flex: 0 0 auto; }
#dialog-body { padding: 24px 28px 28px; font-size: 13px; }
#dialog-body h3 { font-size: 16px; margin-top: 24px; letter-spacing: -.3px; }
#dialog-body > button { margin: 3px 4px 5px 0; }
.intro, .help-list { color: var(--muted); }
.intro { line-height: 1.85; }
.notice { background: #e9eff3; border-left: 3px solid #849cab; border-radius: 0 10px 10px 0; color: #455d6c; padding: 12px 16px; }
input, select { background: #fff; border-color: #ced8df; color: var(--paper); min-height: 42px; padding: 10px 12px; accent-color: var(--ocean); }
input[type=checkbox],input[type=radio],input[type=range] { min-height: auto; }
input[type=checkbox] { width: 17px; height: 17px; vertical-align: -3px; }
.form-row { gap: 10px; flex-wrap: wrap; }
.form-row label { color: #566a78; }
.market-quantity { display: inline-flex; align-items: center; gap: 10px; }
fieldset { border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin: 18px 0; min-width: 0; }
fieldset legend { color: var(--ocean); font-weight: 650; padding: 0 6px; }
fieldset label { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 5px; max-width: 100%; }
fieldset button { margin: 5px; }
table { font-size: 12px; background: #fff; }
th { font-weight: 600; background: #edf1f4; padding: 13px 10px; }
td { border-color: #e5eaee; padding: 12px 10px; }
td button { min-height: 36px; padding: 7px 10px; background: #f0f4f6; }
.table-wrap { border: 1px solid var(--line); border-radius: 12px; }
.goods-name { color: var(--ocean); font-weight: 650; }
.route-option { background: #fff; border-radius: 10px; }
.route-option.selected { background: #e0ecf1; border-color: #88a5b5; }
.section-row { border-color: #e1e7ec; padding: 16px 0; flex-wrap: wrap; }
.section-row strong { font-weight: 650; }
.dialog-actions button { min-height: 44px; }
.small, .muted { color: var(--muted); }
.danger, .resource .danger, #dialog-error, .conversation-error { color: #ad4439; }
#toast { background: #153d50f2; border: 1px solid #fff4; color: #fff; border-radius: 14px; box-shadow: 0 8px 36px #16394b33; backdrop-filter: blur(12px); }
.ship-card, .item-grid article, .npc-grid article, .discovery-grid article, .npc-dialogue { background: #fff; border-color: var(--line); border-radius: 14px; padding: 15px; }
.item-grid strong, .npc-grid strong, .discovery-grid strong { color: var(--ocean); }
.item-grid p, .discovery-grid p { color: var(--muted); }
.item-grid small, .npc-grid small, .npc-dialogue small, .discovery-grid small { color: #6c7d85; }
.npc-portrait { border-radius: 8px; border-color: #bfae85; }
.shipyard-ship { border-radius: 10px; border-color: #416d7c; }
.settings-new-game { background: #f8ebe6; border: 1px solid #e6c7bb; border-radius: 14px; }
.settings-new-game strong { color: #8c443a; }
.settings-new-game p { color: #855d54; }
.danger-action { background: #a34438; color: #fff; border-color: #a34438; }
.danger-action:hover:not(:disabled) { background: #89372d; border-color: #89372d; }
.renown-grid > div, .hero-grid article { background: #fff; border-color: var(--line); border-radius: 14px; }
.renown-grid strong { font: 650 25px/1.4 'Segoe UI',sans-serif; color: var(--ocean); }
.hero-grid article { border-top-color: var(--hero); }
.hero-grid h3 { color: var(--ocean); }
.story-cutscene, .story-excerpt { background: #fff; color: var(--paper); border-color: #d2dee4; border-left-color: var(--brass); border-radius: 12px; box-shadow: none; }
.cutscene-dialogue { padding: 8px 0; }
.cutscene-dialogue .dialogue-text { color: var(--paper); font-style: normal; }
.event-meta-card { background: #eaf0f3; border-color: #d7e2e7; border-radius: 12px; }
.event-meta-card .intro { margin-bottom: 6px; }
.reward-preview { color: #476b4e; }
.requirements-box { background: #fbefe7; border-color: #e7ceba; color: #835b38; border-radius: 12px; }
.requirements-box .help-list { color: #835b38; }
.ready-badge { background: #e5f0e9; color: #35694e; border-color: #c4ddce; border-radius: 12px; }
.story-tag { background: #e7eef2; border-color: #d2e0e7; color: #496372; }
.story-tag.mate { background: #e5f0e9; border-color: #c5dccc; color: #3c7055; }
.story-tag.item { background: #f5ecdc; border-color: #e5d7bc; color: #806236; }
summary { color: #426c81; min-height: 36px; }
.conversation-popup { background: #f7f8fa; color: var(--paper); border-color: #fff; border-radius: 24px; padding: 26px; }
.conversation-popup::backdrop { background: #0c273d66; backdrop-filter: blur(8px); }
.conversation-popup h2 { color: var(--muted); }
.conversation-line h3 { color: var(--ocean); }
.conversation-popup footer { border-color: var(--line); }
.conversation-count { color: var(--muted); }
.conversation-actions button { color: var(--ocean); background: #fff; border-color: var(--line); min-height: 44px; border-radius: 11px; }
.conversation-actions button:last-child { background: var(--ocean); color: #fff; border-color: var(--ocean); }
.conversation-actions button:disabled { color: var(--muted); background: #e8edf0; }
.conversation-portrait { border-radius: 12px; }
.navigation-readout { background: #e6eef2; color: #446271; border-radius: 12px; margin-top: 10px; font-size: 12px; }
.sea-controls { padding: 12px 0; }
.fog-legend { background: #edf2f4; color: #5a707d; font-size: 10px; border-color: var(--line); }
.port-overflow { background: #e4ecef; }
.town-label { border-radius: 5px; background: #173b49f2; border-color: #e8dbb46e; color: #fff8e7; font-size: 12px; box-shadow: 0 1px 4px #153b4933; }
.town-label:hover:not(:disabled) { background: #f0deb5; color: #203b47; border-color: #fff3d6; }
.port-label { border-radius: 4px; }
.port-label:hover:not(:disabled) { background: #f0d99f; color: #203538; }
.muted-building { background: #29474bea; color: #e4e8df; }
.battle-board, .duel-arena { border-radius: 18px; border-color: #365c6c; }
.battle-controls, .duel-controls { background: #e9eef2; border: 1px solid var(--line); border-radius: 14px; padding: 12px; gap: 8px; }
.battle-controls button, .duel-controls button, .battle-map-controls button { min-height: 42px; }
.battle-status { background: #fff; border-radius: 18px; }
.battle-status h3 { color: var(--ocean); }
.battle-log p:first-child { color: var(--ocean); background: #eaf0f3; }
.target-list .section-row { background: #fff; border-color: var(--line); border-radius: 12px; padding: 12px; }
.duelist h3 { color: #fff6e6; }
.duelist p { color: #e4c48f; }
.duel-round { color: #e4c48f; border-radius: 12px; }
.duel-controls select { background: #fff; color: var(--ocean); border-color: #c4d3dc; }
.hex { border-radius: 0; font-weight: 400; }
.hex:hover:not(:disabled) { border: 0; background: #719ca5; }
.hex.reachable:hover:not(:disabled) { background: #cfbb83; color: #183137; }
.hex.enemy:hover:not(:disabled) { background: #a96557; color: #fff; }
.debug-panel { border-radius: 18px; }
.loading { padding: 100px 20px; }
@media (min-width:1500px) { .viewport canvas { aspect-ratio: 16/9; } }
@media (max-width:1100px) {
  .app-shell { padding: 0 24px; }
  .layout { grid-template-columns: minmax(0,1fr) 254px; gap: 16px; }
  .campaign-toolbar button { font-size: 10px; }
  .actions { grid-template-columns: repeat(4,minmax(0,1fr)); }
  .scene-toolbar { padding: 14px; }
  .view-switch button { padding: 8px; }
  .stats { padding: 0 15px 16px; }
  .stat strong { font-size: 21px; }
}
@media (max-width:800px) {
  .app-shell { padding: 0 20px; }
  .layout { grid-template-columns: minmax(0,1fr); }
  .sidebar { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
  .quest { grid-column: 1/-1; }
  .actions { grid-template-columns: repeat(6,minmax(0,1fr)); }
  .campaign-toolbar { grid-template-columns: repeat(4,minmax(0,1fr)); }
  .campaign-toolbar button { min-height: 66px; padding: 9px 4px; gap: 5px; font-size: 11px; }
  .captain { padding: 18px; }
  .stats { grid-template-columns: 1fr; gap: 15px; padding: 0 18px 18px; }
  .topline { margin-bottom: 18px; }
  .log-panel { grid-template-columns: 1fr; }
  .log-title { display: flex; align-items: center; gap: 12px; }
  .log-title h3 { margin: 0; }
}
@media (max-width:560px) {
  html { scrollbar-gutter: auto; }
  .app-shell { padding: 0 16px; }
  .masthead { height: auto; min-height: 112px; flex-wrap: wrap; padding: 16px 0 12px; gap: 12px; }
  .brand { gap: 10px; }
  .brand-symbol { width: 38px; height: 38px; border-radius: 12px; }
  .brand-symbol .ui-icon { width: 26px; height: 26px; }
  h1 { font-size: 19px; }
  h1 em { font-size: 24px; }
  .brand .eyebrow { font-size: 7px; letter-spacing: 1.6px; }
  .masthead nav { width: 100%; margin-left: 0; justify-content: flex-end; gap: 6px; }
  .masthead nav button { min-height: 36px; padding: 7px 11px; font-size: 11px; }
  #music { margin-right: auto; }
  #settings { width: 36px; }
  main { padding-top: 22px; }
  .page-heading h2 { font-size: 27px; }
  .page-heading .eyebrow { font-size: 8px; }
  .topline { align-items: flex-end; gap: 8px; }
  .date { padding: 8px 10px; font-size: 10px; white-space: nowrap; }
  .date small { display: block; text-align: right; margin: 3px 0 0; font-size: 10px; }
  .campaign-toolbar { gap: 3px; padding: 5px; border-radius: 16px; margin-bottom: 20px; }
  .campaign-toolbar button { font-size: 10px; gap: 6px; min-height: 67px; }
  .campaign-toolbar .ui-icon { width: 21px; height: 21px; }
  .scene-toolbar { border-radius: 16px 16px 0 0; padding: 13px 12px; gap: 6px; }
  .scene-label h2 { font-size: 19px; }
  .scene-label span { font-size: 7px; letter-spacing: 1px; }
  .view-switch button { font-size: 10px; padding: 6px 8px; }
  .masthead nav button, .view-switch button, .dialog-header button, .conversation-close { min-height: 44px; }
  #settings { width: 44px; }
  .dialog-header button, .conversation-close { width: 44px; }
  .viewport canvas { aspect-ratio: 4/3; }
  .scene-hint { font-size: 9px; padding: 5px 7px; bottom: 8px; left: 8px; }
  .viewport:has(.town-labels) .scene-hint { display: none; }
  .location-strip { font-size: 10px; padding: 11px 12px; border-radius: 0 0 16px 16px; gap: 8px; }
  .location-strip .right { display: none; }
  .actions { grid-template-columns: repeat(4,minmax(0,1fr)); gap: 7px; }
  .action { min-height: 75px; padding: 12px 3px; font-size: 11px; }
  .facility-heading { margin-top: 20px; }
  .sidebar { gap: 10px; margin-top: 4px; }
  .panel { border-radius: 16px; }
  .panel-head { padding: 12px; font-size: 8px; letter-spacing: 1px; }
  .panel-head span { font-size: 9px; }
  .captain { flex-direction: column; align-items: flex-start; padding: 14px; gap: 12px; }
  .captain h3 { font-size: 16px; }
  .captain p { font-size: 10px; }
  .stats { padding: 0 14px 16px; gap: 11px; }
  .stat strong { font-size: 22px; }
  .ship-summary { padding: 14px 12px; }
  .ship-title { flex-direction: column; align-items: flex-start; gap: 4px; }
  .resource { font-size: 11px; padding: 8px 0; }
  .quest { padding: 18px; }
  .log-panel { padding: 17px; gap: 16px; margin-top: 20px; }
  .log-item { font-size: 11px; gap: 8px; }
  .log-item time { min-width: 43px; font-size: 9px; }
  footer { padding-bottom: max(24px,env(safe-area-inset-bottom)); font-size: 8px; letter-spacing: 0; }
  dialog, .conversation-popup { width: 100%; max-width: 100%; max-height: 92dvh; margin: auto 0 0; border-radius: 24px 24px 0 0; border: 0; padding: 0; }
  .dialog-header { padding: 23px 20px 17px; }
  .dialog-header::before, .conversation-popup::before { content: ''; width: 34px; height: 4px; border-radius: 4px; background: #cad3dc; position: absolute; top: 8px; left: calc(50% - 17px); }
  .dialog-header h2 { font-size: 21px; }
  #dialog-body { padding: 20px 20px max(26px,env(safe-area-inset-bottom)); }
  #dialog-body button { min-height: 42px; }
  input, select { font-size: 16px; }
  .table-wrap { margin-inline: -4px; }
  td, th { padding: 10px 8px; }
  .market-wrap { border: 0; border-radius: 0; overflow: visible; margin: 0; }
  .market-table { display: block; background: transparent; }
  .market-table thead { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .market-table tbody { display: grid; gap: 10px; }
  .market-table tbody tr { display: grid; grid-template-columns: minmax(0,1fr) auto; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
  .market-table td { padding: 0; border: 0; }
  .market-table td:first-child { grid-column: 1/-1; font-size: 14px; font-weight: 650; color: var(--ocean); margin-bottom: 12px; }
  .market-table td:first-child small { font-size: 11px; font-weight: 400; color: var(--muted); }
  .market-table td[data-label] { font-variant-numeric: tabular-nums; font-size: 14px; }
  .market-table td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 3px; font-size: 10px; color: var(--muted); }
  .market-table td:last-child { grid-column: 1/-1; display: flex; gap: 7px; margin-top: 13px; }
  .market-table td button { flex: 1; margin: 0; font-size: 12px; }
  .market-table td button:first-child { background: var(--ocean); border-color: var(--ocean); color: #fff; }
  .item-grid article { grid-template-columns: 48px minmax(0,1fr); }
  .item-grid button { grid-column: 2; justify-self: start; }
  .npc-grid article { padding: 12px; gap: 10px; }
  .ship-card-info { flex: 1 0 100%; }
  .ship-card > div:last-child { display: flex; flex-wrap: wrap; gap: 7px; width: 100%; }
  .ship-card button { flex: 1 1 auto; white-space: normal; }
  .hero-grid { grid-template-columns: 1fr; }
  .conversation-popup { padding: 28px 20px max(24px,env(safe-area-inset-bottom)); }
  .conversation-stage { gap: 16px; }
  .conversation-popup footer { flex-direction: column; align-items: stretch; }
  .conversation-actions { justify-content: flex-end; }
  .conversation-popup footer .conversation-count { text-align: right; }
  .conversation-actions button { flex: 1 0 auto; }
  .conversation-line p { font-size: 16px; line-height: 1.8; }
  .renown-grid { gap: 7px; }
  .renown-grid > div { padding: 12px; }
  .renown-grid strong { font-size: 22px; }
  .combat-layout { gap: 16px; }
  .duel-controls button { flex: 1 0 auto; }
  .battle-controls label { margin-left: 0; flex-wrap: wrap; }
  .battle-map-controls button { font-size: 11px; }
  #toast { bottom: max(20px,env(safe-area-inset-bottom)); width: max-content; font-size: 12px; }
}
@media (prefers-reduced-motion:reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}
