:root { color-scheme: dark; font-family: "Segoe UI", system-ui, sans-serif; color: #e1ebe6; background: #10242a; --accent: #eabc7b; --panel: #10242ae6; --line: #bddbc970; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; overflow: hidden; }
button, input { font: inherit; }
select { font: inherit; }
button { cursor: pointer; color: inherit; background: #d4e6df0a; border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; }
button:hover:not(:disabled) { background: #d4e6df18; border-color: #d4e6df66; }
button:disabled { opacity: .45; cursor: wait; }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.hud-icon { width: 18px; height: 18px; flex: 0 0 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.faction-flag { display: block; width: 36px; height: 26px; object-fit: contain; flex-shrink: 0; overflow: hidden; border-radius: 2px; filter: drop-shadow(1px 1px #000); }
.toyotomi-flag { padding: 2px; background: #eee3c5; }
#stage { position: fixed; inset: 0; overflow: hidden; background: #10242a; }
#stage.is-loading > :not(#game-loading) { visibility: hidden; }
.game-loading { position: absolute; inset: 0; z-index: 20; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(ellipse at 50% 38%, #19383d 0, #10242a 52%, #09171b 100%); }
.loading-card { width: min(440px, 100%); padding: clamp(24px, 6vw, 40px); border: 1px solid #bddbc940;
  border-radius: 16px; background: #10242ae8; box-shadow: 0 24px 80px #0007; text-align: center; }
.loading-spinner { display: block; width: 42px; height: 42px; margin: 0 auto 22px; border: 3px solid #d4e6df2b;
  border-top-color: var(--accent); border-right-color: #eabc7b88; border-radius: 50%; animation: game-loading-spin .9s linear infinite; }
@keyframes game-loading-spin { to { transform: rotate(360deg); } }
.loading-eyebrow { margin: 0 0 8px; color: var(--accent); font-size: 11px; font-weight: 700; letter-spacing: 2px; }
.loading-card h1 { margin: 0; color: #edf3ed; font-size: clamp(20px, 5vw, 26px); font-weight: 600; }
.loading-card > p:not(.loading-eyebrow) { min-height: 1.5em; margin: 10px 0 22px; color: #afc7bf; font-size: 14px; }
.loading-progress-row { display: grid; grid-template-columns: minmax(0, 1fr) 44px; align-items: center; gap: 12px; }
#loading-progress { width: 100%; height: 8px; overflow: hidden; appearance: none; border: 0; border-radius: 8px; background: #d4e6df20; }
#loading-progress::-webkit-progress-bar { border-radius: inherit; background: #d4e6df20; }
#loading-progress::-webkit-progress-value { border-radius: inherit; background: linear-gradient(90deg, #97cbb0, var(--accent)); transition: width .25s ease; }
#loading-progress::-moz-progress-bar { border-radius: inherit; background: linear-gradient(90deg, #97cbb0, var(--accent)); }
#loading-percent { color: #edf3ed; font: 12px ui-monospace, monospace; text-align: right; }
#loading-retry { margin-top: 20px; padding: 8px 14px; font-size: 12px; }
#loading-retry:not([hidden]) { display: inline-flex; }
@media (prefers-reduced-motion: reduce) {
  .loading-spinner { animation: none; }
  #loading-progress::-webkit-progress-value { transition: none; }
}
#scene { position: absolute; top: 0; left: 0; display: block; image-rendering: pixelated; touch-action: none; cursor: grab; }
#scene:active { cursor: grabbing; }
#scene:focus-visible { outline: 1px solid #eabc7b55; outline-offset: -1px; }
#weather-canvas { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; pointer-events: none; }
.damage-numbers { position: absolute; inset: 0; pointer-events: none; z-index: 2; overflow: hidden; }
.flag-capture { position: absolute; left: 50%; top: 24%; z-index: 3; display: grid; justify-items: center; gap: 2px; pointer-events: none;
  transform: translate(-50%, -50%); color: #fff1cb; font: 900 22px ui-monospace, monospace; text-align: center;
  text-shadow: -2px -2px 0 #080c0e, 2px -2px 0 #080c0e, -2px 2px 0 #080c0e, 2px 2px 0 #000; }
.flag-capture:not([hidden]) { animation: flag-capture-pop 2.2s ease-out forwards; }
.flag-capture small { font-size: 13px; color: #ffe08a; }
.flag-capture-ring { position: absolute; left: 50%; top: 50%; width: 40px; height: 40px; margin: -20px 0 0 -20px; border: 3px solid #ffe08a;
  border-radius: 50%; opacity: 0; box-shadow: 0 0 14px #ffe08a; }
.flag-capture:not([hidden]) .flag-capture-ring { animation: flag-capture-ring 1.4s ease-out forwards; }
.flag-capture:not([hidden]) .flag-capture-ring:nth-child(2) { animation-delay: .25s; border-color: #8ff2e6; }
@keyframes flag-capture-pop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.4); }
  12% { opacity: 1; transform: translate(-50%, -50%) scale(1.25); }
  22% { transform: translate(-50%, -50%) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -90%) scale(1); }
}
@keyframes flag-capture-ring { 0% { opacity: .95; transform: scale(.3); } 100% { opacity: 0; transform: scale(9); } }
@media (prefers-reduced-motion: reduce) {
  .flag-capture:not([hidden]) { animation: flag-capture-fade 2.2s linear forwards; }
  .flag-capture:not([hidden]) .flag-capture-ring { animation: none; }
}
@keyframes flag-capture-fade { 0%, 80% { opacity: 1; } 100% { opacity: 0; } }
.damage-number { position: absolute; color: #fff1cb; font: 900 16px ui-monospace, monospace; letter-spacing: -1px;
  text-shadow: -2px -2px 0 #080c0e, 2px -2px 0 #080c0e, -2px 2px 0 #080c0e, 2px 2px 0 #080c0e, 3px 3px 0 #000;
  image-rendering: pixelated; will-change: transform, opacity, left, top; }
.damage-number[data-kind="block"] { color: #9eeaff; }
.damage-number[data-kind="guard-break"] { color: #ffb064; }
.damage-number[data-kind="critical"] { color: #fff6a6; font-size: 20px; }
.world-label { position: absolute; top: max(20px, env(safe-area-inset-top)); left: max(20px, env(safe-area-inset-left)); display: grid; gap: 4px; pointer-events: none; text-shadow: 0 1px 8px #0009; }
.world-label > span { color: var(--accent); font-size: 11px; font-weight: 650; letter-spacing: 3px; }
.world-label output { font-size: 14px; color: #edf3ed; }
.world-clock { display: flex; flex-wrap: wrap; max-width: calc(100vw - 160px); align-items: center; gap: 8px; color: #c7d5ce; font: 11px ui-monospace, monospace; }
.clock-wind, .weather-label { display: flex; align-items: center; gap: 5px; pointer-events: auto; font: 11px ui-monospace, monospace; color: #c7d5ce; }
.world-label .clock-wind output { font-size: 11px; }
.clock-wind[data-low="true"] { color: #eabc7b; }
.weather-label .hud-icon { width: 14px; height: 14px; flex-basis: 14px; }
 top: max(128px, calc(env(safe-area-inset-top) + 112px)); left: max(20px, env(safe-area-inset-left)); width: 208px; padding: 10px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; pointer-events: none; }
.left-hud { display: contents; }
.mobility-hud { position: absolute; top: max(128px, calc(env(safe-area-inset-top) + 112px)); left: max(20px, env(safe-area-inset-left)); width: 208px; padding: 10px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; pointer-events: none; }
.mobility-speed { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; color: #afc7bf; font-size: 11px; letter-spacing: .06em; list-style: none; cursor: pointer; pointer-events: auto; }
.mobility-speed::-webkit-details-marker { display: none; }
.mobility-speed::after { content: '+'; }
.mobility-hud[open] > .mobility-speed::after { content: '-'; }
#movement-speed { color: #edf3ed; font: 12px ui-monospace, monospace; letter-spacing: 0; }
.quest-log, .faction-kill-score { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); }
.quest-log { pointer-events: auto; }
.quest-log summary, .faction-kill-score h2 { margin: 0 0 6px; color: var(--accent); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.quest-log summary { cursor: pointer; }
#quest-objectives { display: grid; gap: 5px; max-height: 132px; overflow-y: auto; margin: 0; padding: 0 0 0 18px; color: #e1ebe6; font-size: 10px; line-height: 1.4; }
.quest-log > small { display: block; margin-top: 5px; color: #afc7bf; font-size: 9px; }
.faction-kill-table-wrap { max-width: 100%; overflow-x: auto; pointer-events: auto; }
#faction-kill-table { width: 100%; border-collapse: collapse; color: #d7e2db; font-size: 8px; text-align: center; }
#faction-kill-table th, #faction-kill-table td { min-width: 20px; padding: 3px 2px; border-bottom: 1px solid #bddbc933; }
#faction-kill-table th:first-child { min-width: 58px; text-align: left; }
#faction-kill-table tbody th { color: #eabc7b; font-weight: 600; }
#faction-kill-table output { font: 9px ui-monospace, monospace; }
#horse-hud { margin-top: 10px; }
#horse-hud progress { --accent: #97cbb0; }
#horse-controls { display: block; margin-top: 5px; color: #eabc7b; font: 11px/1.4 ui-monospace, monospace; }
.commerce-toggle.hud-shortcut { position: absolute; right: max(16px, env(safe-area-inset-right)); bottom: max(64px, calc(env(safe-area-inset-bottom) + 48px)); z-index: 3; display: grid; grid-template-columns: repeat(2, max-content); min-width: 76px; gap: 4px 6px; }
.silver-coin { color: #d3dae2; }
.commerce-toggle output { grid-column: 1 / -1; max-width: 10ch; overflow: hidden; text-overflow: ellipsis; color: #d3dae2; font: 11px ui-monospace, monospace; }
.menu.commerce-panel { width: min(520px, calc(100vw - 32px)); }
#commerce-title { display: flex; align-items: center; gap: 10px; }
.commerce-tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.commerce-tabs [role="tab"] { flex: 1; min-width: 0; padding: 10px 4px; border: 0; border-bottom: 2px solid transparent; background: transparent; box-shadow: none; font-size: 12px; }
.commerce-tabs [aria-selected="true"] { border-bottom-color: #d3dae2; color: #eef2f6; background: #d3dae20c; }
.commerce-info { margin: 0 0 12px; padding: 14px; border: 1px solid var(--line); border-radius: 6px; background: #07151933; }
.commerce-info p { margin: 10px 0 0; color: #afc7bf; font-size: 12px; line-height: 1.6; }
.commerce-info h2 { margin: 14px 0 0; color: #d3dae2; font-size: 12px; }
.commerce-info > :first-child { margin-top: 0; }
.commerce-panel > .menu-note { margin: 16px 0 0; font-size: 11px; }
.commerce-account { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.commerce-account p { margin: 0; overflow-wrap: anywhere; }
.commerce-totals { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin: 18px 0; }
.commerce-totals > div { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; }
.commerce-totals dt { color: #afc7bf; font-size: 12px; }
.commerce-totals dd { margin: 0 0 0 auto; overflow-wrap: anywhere; color: #d3dae2; font: 13px ui-monospace, monospace; }
.commerce-totals .commerce-primary-balance { display: block; padding-bottom: 18px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.commerce-primary-balance dd { margin: 6px 0 0; color: #f0f3f6; text-align: left; font: 650 clamp(32px, 5vw, 44px)/1.15 "Segoe UI", system-ui, sans-serif; font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.commerce-items summary { cursor: pointer; color: var(--accent); font-size: 12px; }
.commerce-items ul, #commerce-transactions { display: grid; gap: 8px; padding: 0; list-style: none; }
.commerce-items li, #commerce-transactions li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; padding-bottom: 8px; border-bottom: 1px solid #bddbc933; font-size: 12px; }
#commerce-transactions time, #commerce-transactions small { color: #afc7bf; font: 10px ui-monospace, monospace; }
#commerce-transactions small { flex-basis: 100%; }
.region-announcement { position: absolute; top: 42%; left: 50%; transform: translate(-50%, -50%); width: min(640px, calc(100% - 40px)); opacity: 0; color: #f5ead1; font-size: clamp(24px, 4vw, 44px); font-weight: 350; letter-spacing: 2px; line-height: 1.3; text-align: center; text-shadow: 0 2px 4px #000, 0 0 20px #000; pointer-events: none; }
.hud-toolbar { position: absolute; z-index: 4; top: max(16px, env(safe-area-inset-top)); right: max(16px, env(safe-area-inset-right)); display: flex; align-items: start; gap: 6px; }
.hud-shortcut { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 6px 8px; background: var(--panel); }
kbd { margin-left: 10px; color: #b4c9c1; font: 11px ui-monospace, monospace; }
.hud-shortcut kbd, .action-dock kbd { margin: 0; padding: 2px 3px; border: 1px solid #bddbc944; border-radius: 3px; background: #d4e6df12; color: #eef2e7; font: 10px ui-monospace, monospace; white-space: nowrap; }
.minimap-hud { position: absolute; top: max(72px, calc(env(safe-area-inset-top) + 56px)); right: max(16px, env(safe-area-inset-right)); width: 260px; overflow: hidden; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
#world-map-toggle { display: block; padding: 0; width: 100%; border: 0; border-radius: 0; }
#world-map-toggle:focus-visible { outline-offset: -3px; }
#minimap { display: block; width: 100%; height: auto; }
.minimap-hud > .minimap-controls, .world-map-panel > .minimap-controls { position: absolute; z-index: 2; top: 6px; right: 6px; min-width: 24px; min-height: 24px; padding: 2px 5px; border-radius: 4px; background: var(--panel); color: #d3dae2; font: 10px ui-monospace, monospace; }
.world-map-panel > .minimap-controls { top: 64px; right: 10px; }
.minimap-hud .hud-icon { width: 12px; height: 12px; flex-basis: 12px; }
.target-hud { position: absolute; top: max(80px, calc(env(safe-area-inset-top) + 64px)); left: 50%; transform: translateX(-50%); width: 170px; padding: 8px 10px; background: var(--panel); border-radius: 8px; pointer-events: none; }
.target-hud > div, .meter-label { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.target-hud > div { font-size: 11px; margin-bottom: 7px; }
.target-hud output { color: #a9c2c9; font: 11px ui-monospace, monospace; }
progress { display: block; appearance: none; width: 100%; height: 4px; border: 0; background: #d4e6df22; accent-color: var(--accent); }
progress::-webkit-progress-bar { background: #d4e6df22; }
progress::-webkit-progress-value { background: var(--accent); }
progress::-moz-progress-bar { background: var(--accent); }
.target-hud progress { --accent: #84b9c7; }
.target-hud { border: 1px solid #eabc7b99; box-shadow: inset 0 0 0 1px #eabc7b30, 0 0 18px #eabc7b18; }
.target-hud[data-threat="true"] progress { --accent: #ef9d82; }
.player-hud { position: absolute; left: max(16px, env(safe-area-inset-left)); bottom: max(16px, env(safe-area-inset-bottom)); width: 208px; padding: 10px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; pointer-events: none; }
.meter-label { margin-bottom: 7px; font-size: 11px; letter-spacing: .08em; color: #afc7bf; }
.meter-label output { font: 11px ui-monospace, monospace; color: #edf3ed; letter-spacing: 0; }
.stamina-label { margin-top: 8px; }
#campaign-time { margin: 0; font-size: 11px; }
#auto-travel-status { display: block; margin: 8px 0 0; font-size: 11px; line-height: 1.4; }
#campaign-time[data-error="true"] { color: #d58b7f; }
#stop-horse-travel { pointer-events: auto; margin-top: 8px; font-size: 11px; }
#look-at-moon:disabled { cursor: default; }
.party-hud { position: absolute; bottom: 3px; left: 3px; width: max-content; max-width: calc(100% - 6px); display: flex; flex-wrap: nowrap; justify-content: center; align-items: center; gap: 4px; padding: 0; margin: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; pointer-events: none; font: 10px ui-monospace, monospace; }
#party-distance { flex-shrink: 0; white-space: nowrap; }
#party-risk { flex: 0 0 12px; width: 12px; margin: 0; }
.party-hud[data-risk="safe"] { --accent: #8dbfab; }
.party-hud[data-risk="warning"] { --accent: #eabc7b; border-color: #eabc7b; color: #eabc7b; }
.party-hud[data-risk="danger"] { --accent: #e58e7e; border-color: #e58e7e; color: #e58e7e; }
#troop-formation { pointer-events: auto; flex: 0 1 auto; width: auto; min-width: 24px; min-height: 24px; display: flex; align-items: center; justify-content: center; gap: 3px; padding: 2px 5px; border-radius: 4px; font: 10px ui-monospace, monospace; }
#troop-formation-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#troop-formation kbd { margin: 0; }
.interaction-hud { position: absolute; left: 50%; bottom: max(120px, calc(env(safe-area-inset-bottom) + 104px)); transform: translateX(-50%); }
.interaction-hud button { background: #172c29f5; border-color: var(--accent); font-size: 12px; }
.interaction-hud output { color: var(--accent); font: 12px ui-monospace, monospace; }
#interaction-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.horse-label { display: flex; align-items: center; gap: 7px; }
#horse-travel { display: block; margin-top: 6px; color: #b5cac0; font: 11px ui-monospace, monospace; }
#player-stamina { --accent: #97cbb0; height: 3px; }
.jump-cue { position: absolute; left: 50%; bottom: 150px; transform: translateX(-50%); width: min(300px, calc(100vw - 32px)); padding: 14px 18px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; text-align: center; pointer-events: none; }
.jump-cue strong { display: block; margin-bottom: 10px; font-size: 11px; letter-spacing: .8px; }
.jump-cue[data-state="ready"] { color: #e9ffe6; border-color: #a5f0a4; box-shadow: 0 0 26px #a5f0a470, inset 0 0 16px #a5f0a426; }
.jump-cue[data-state="ready"] progress { --accent: #a5f0a4; }
.jump-cue[data-state="recover"], .jump-cue[data-state="missed"] { color: #f2bc96; }
.player-hud[data-result="defeat"] { border-color: #d58b7f; }
.equipment-hud { position: absolute; bottom: max(16px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 32px); background: var(--panel); padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; display: grid; gap: 5px; pointer-events: none; }
.weapon-status { display: flex; justify-content: center; align-items: center; gap: 8px; color: var(--accent); font-size: 11px; }
.action-dock { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 3px; }
.action-dock > span { display: inline-flex; flex-direction: row-reverse; align-items: center; justify-content: center; gap: 3px; min-height: 28px; padding: 3px; border: 1px solid #bddbc933; border-radius: 5px; background: #d4e6df0a; }
.hud-shortcut .hud-icon, .action-dock .hud-icon { width: 16px; height: 16px; flex-basis: 16px; }
.action-dock .dock-divider { margin-left: 4px; }
.equipment-hud output { color: #edf3ed; font: 15px ui-monospace, monospace; }
.equipment-hud small { color: #afc7bf; font-size: 11px; letter-spacing: .06em; }
.fps-widget { padding: 0; border: 0; }
.fps-overlay { display: flex; align-items: center; gap: 5px; min-height: 36px; list-style: none; color: #c2d4cb; font: 11px ui-monospace, monospace; padding: 6px 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; cursor: pointer; white-space: nowrap; }
.fps-overlay::-webkit-details-marker { display: none; }
.fps-overlay output { color: #edf3ed; }
.fps-details { position: absolute; top: calc(100% + 8px); right: 0; width: min(360px, calc(100vw - 32px)); padding: 12px; background: #10242af5; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px #0008; }
.fps-details header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 6px 12px; margin-bottom: 10px; font-size: 11px; }
.fps-details header strong { color: var(--accent); font-size: 12px; }
.fps-details header span { color: #afc7bf; font: 10px ui-monospace, monospace; }
.fps-details { display: grid; gap: 12px; }
.fps-details ol { display: grid; gap: 6px; margin: 6px 0 0; padding: 0 0 0 10px; list-style: none; }
.timing-area { --timing-color: #9fb6ad; }
.timing-area-heading, .fps-details li { display: grid; grid-template-columns: minmax(112px, 1fr) minmax(52px, .7fr) 48px; gap: 8px; align-items: center; color: var(--timing-color); font-size: 11px; }
.timing-area-heading { font-size: 12px; }
.timing-area-heading[data-rank="1"] { --timing-color: #ff8076; }
.timing-area-heading[data-rank="2"] { --timing-color: #f0c66f; }
.fps-details li { --timing-color: #9fb6ad; color: var(--timing-color); }
.fps-details li[data-rank="1"] { --timing-color: #ff8076; }
.fps-details li[data-rank="2"] { --timing-color: #f0c66f; }
.timing-area-heading output, .fps-details li output { color: #edf3ed; font: 10px ui-monospace, monospace; text-align: right; }
.timing-track { height: 5px; overflow: hidden; background: #d4e6df18; border-radius: 8px; }
.timing-track i { display: block; width: 0; height: 100%; background: var(--timing-color); border-radius: inherit; }
.match-panel { position: absolute; z-index: 3; top: max(88px, calc(env(safe-area-inset-top) + 72px)); left: 50%; transform: translateX(-50%); min-width: 190px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); color: #d4e6df; text-align: center; pointer-events: none; }
.match-panel p { margin: 0; font: 12px ui-monospace, monospace; }
.match-panel output { color: #f0c66f; font-size: 18px; font-weight: 750; }
.match-result { position: absolute; z-index: 5; top: 50%; left: 50%; width: min(420px, calc(100vw - 32px)); max-height: min(70vh, 560px); overflow: auto; transform: translate(-50%, -50%); padding: 22px; border: 1px solid #f0c66f88; border-radius: 12px; background: #101d1deF; color: #edf3ed; text-align: center; pointer-events: none; }
.match-result h2 { margin: 0 0 8px; font-size: 26px; }
.match-result h3 { margin: 20px 0 8px; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; }
.match-result p { margin: 0; color: #f0c66f; font-weight: 700; }
.match-result ol { display: grid; gap: 5px; margin: 0; padding: 0; list-style: none; color: #d4e6df; font: 13px ui-monospace, monospace; }
.world-message { position: absolute; bottom: 184px; left: 50%; transform: translateX(-50%); max-width: min(460px, calc(100vw - 40px)); margin: 0; padding: 8px 12px; border-radius: 7px; background: var(--panel); color: #d4e6df; font-size: 12px; text-align: center; pointer-events: none; }
.global-chat { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.chat-panel { position: absolute; right: max(16px, env(safe-area-inset-right)); bottom: max(224px, calc(env(safe-area-inset-bottom) + 208px)); width: min(320px, calc(100% - 32px)); padding: 8px 10px; border-radius: 8px; background: linear-gradient(270deg, #07151966, #07151900); text-shadow: 0 1px 3px #000, 0 0 8px #000; font-size: 11px; }
.chat-panel header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; padding-bottom: 6px; }
.chat-panel header strong { color: var(--accent); font-size: 11px; letter-spacing: .08em; }
#chat-status { color: #afc7bf; font-size: 11px; }
#global-chat:not(.is-open) #chat-status:not([data-error="true"]) { display: none; }
#chat-status[data-error="true"] { color: #ffb9a5; }
.chat-log { max-height: min(14dvh, 120px); overflow-y: auto; scrollbar-width: thin; overflow-wrap: anywhere; }
.chat-log p { margin: 0; padding: 3px 0; line-height: 1.5; }
.chat-log strong { color: #97cbb0; }
.global-chat.is-open .chat-panel { background: #07151988; border: 1px solid var(--line); pointer-events: auto; }
#chat-form { display: flex; gap: 8px; margin-top: 8px; }
#chat-input { min-width: 0; flex: 1; color: #edf3ed; background: #07151955; border: 1px solid var(--line); border-radius: 6px; padding: 10px; font-size: 16px; }
#chat-send { padding: 8px 12px; font-size: 11px; }
.chat-toggle { position: absolute; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); z-index: 3; }
.chatting .world-message { display: none; }
.speech-bubble { position: absolute; z-index: 2; width: max-content; max-width: min(320px, calc(100% - 32px)); padding: 10px 14px; border: 1px solid #eabc7b88; border-radius: 12px; background: #10242ae6; color: #edf3ed; font-size: 12px; line-height: 1.5; text-align: center; overflow-wrap: anywhere; pointer-events: none; transform: translate(-50%, calc(-100% - 12px)); box-shadow: 0 4px 18px #0005; }
.speech-bubble::after { content: ""; position: absolute; top: 100%; left: var(--tail-left, 50%); width: 10px; height: 10px; background: #10242a; border-right: 1px solid #eabc7b88; border-bottom: 1px solid #eabc7b88; transform: translate(-50%, -5px) rotate(45deg); }
.paused-label, .load-status { position: absolute; top: 44%; left: 50%; transform: translate(-50%, -50%); padding: 18px 24px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; text-align: center; pointer-events: none; }
.paused-label { font-size: 20px; letter-spacing: 1px; }
.paused-label small { display: block; margin-top: 6px; color: #afc7bf; font-size: 11px; letter-spacing: 0; }
.load-status { max-width: calc(100vw - 40px); font-size: 13px; }
.load-status.error { color: #ffb9a5; border-color: #d58b7f; z-index: 5; }
.menu { width: min(360px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 24px; border: 1px solid #d4e6df40; border-radius: 16px; background: #10242af5; color: #e1ebe6; overflow-y: auto; box-shadow: 0 24px 100px #0008; }
#controls-panel { width: min(760px, calc(100vw - 32px)); }
#controls-panel:has(.controls-guide[open]) { width: min(920px, calc(100vw - 32px)); }
#controls-panel button:not(.icon-button) { min-height: 26px; padding: 4px 8px; font-size: 10px; }
#controls-panel #play { width: min(100%, 190px); min-height: 30px; padding: 6px 8px; font-size: 10px; }
.menu::backdrop { background: #07151980; }
.menu.world-map-panel { position: fixed; inset: auto; left: 3vw; top: 3dvh; width: 94vw; height: 94dvh; min-width: min(360px, 100vw); min-height: min(300px, 100dvh); max-width: 100vw; max-height: 100dvh; margin: 0; padding: 0; border: 1px solid #9fb5a47a; border-radius: 12px; background: #0b1a1f59; overflow: hidden; resize: both; box-shadow: 0 12px 40px #0008; }
.world-map-panel::backdrop { background: transparent; }
.world-map-panel[open] { animation: world-map-enter 280ms ease-out both; }
@keyframes world-map-enter { from { opacity: 0; transform: scale(1.015); } to { opacity: 1; transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .world-map-panel[open] { animation: none; } }
.world-map-panel header { position: absolute; z-index: 1; inset: 10px 10px auto; margin: 0; pointer-events: none; }
.world-map-panel header > div { max-width: calc(100% - 60px); padding: 8px 12px; border-radius: 8px; background: #10242a99; pointer-events: auto; cursor: move; touch-action: none; user-select: none; }
.world-map-panel h1 { margin: 3px 0 0; font-size: 16px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.world-map-panel .eyebrow { font-size: 9px; letter-spacing: 1px; }
.world-map-panel header button { pointer-events: auto; background: #10242ae6; }
#world-map { position: absolute; inset: 0; display: block; width: 100%; height: 100%; opacity: .6; cursor: grab; touch-action: none; image-rendering: pixelated; }
#world-map.is-panning { cursor: grabbing; }
.world-map-layout { width: 100%; height: 100%; }
.map-dock { position: absolute; z-index: 1; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(420px, calc(100% - 24px)); padding: 6px; border: 1px solid var(--line); border-radius: 10px; background: #10242ab3; }
.map-dock button, .map-tools > summary { min-height: 36px; padding: 6px 10px; font-size: 11px; border-radius: 5px; }
.map-navigation { display: flex; align-items: center; gap: 4px; }
.map-navigation > button { display: grid; place-items: center; min-width: 36px; padding: 6px; }
.map-navigation > output { flex: 1; min-width: 56px; margin: 0 !important; text-align: center; white-space: nowrap; }
.map-tools { border: 0; padding: 0; flex-shrink: 0; }
.map-tools > summary { display: flex; align-items: center; justify-content: center; cursor: pointer; list-style: none; color: var(--accent); border: 1px solid var(--line); }
.map-tools > summary::-webkit-details-marker { display: none; }
.map-tools[open] > summary { background: #eabc7b18; }
.world-map-tools-content { position: absolute; bottom: calc(100% + 10px); right: 0; width: min(360px, calc(100vw - 24px)); max-height: min(60dvh, 480px); overflow-y: auto; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #10242af5; box-shadow: 0 8px 24px #0006; }
.map-dock .world-map-travel { display: grid; grid-template-columns: 1fr 1fr; margin-top: 0; gap: 8px; }
.map-dock .world-map-travel label, .map-dock .world-map-travel select { grid-column: 1 / -1; min-width: 0; font-size: 11px; }
.map-pan-controls { display: flex; gap: 6px; margin: 12px 0; }
.map-pan-controls button { flex: 1; }
.map-help > summary { cursor: pointer; color: var(--accent); font-size: 11px; }
.map-dock .map-data-note { font-size: 10px; line-height: 1.5; color: #9fb6ad; }
.world-map-panel output { display: block; margin-top: 12px; color: var(--accent); font: 11px ui-monospace, monospace; }
.map-dock > output { margin-top: 6px; padding: 0 4px; max-height: 48px; overflow-y: auto; color: #afc7bf; font: 10px/1.5 "Segoe UI", "Malgun Gothic", sans-serif; text-align: center; }
.world-map-panel p { margin: 10px 0 0; color: #afc7bf; font-size: 11px; line-height: 1.5; }
.world-map-panel a { color: #eabc7b; }
.world-map-travel { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.world-map-travel select { color: inherit; background: #122b31; border: 1px solid var(--line); border-radius: 6px; padding: 8px; }
.world-map-travel select:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.menu header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; }
.eyebrow { font-size: 10px; color: #afc7bf; letter-spacing: 2px; }
h1 { font-size: 26px; font-weight: 550; letter-spacing: -.6px; margin: 5px 0 0; }
.icon-button { border: 0; background: none; font-size: 24px; padding: 2px 8px; }
.primary-button { width: 100%; border-color: transparent; background: var(--accent); color: #233632; font-size: 13px; font-weight: 650; }
.primary-button:hover:not(:disabled) { background: #f2ca91; border-color: transparent; }
.settings-error { color: #ffb9a5; background: #d58b7f12; padding: 10px 12px; border-radius: 7px; font-size: 12px; line-height: 1.5; }
.audio-error { position: absolute; left: 20px; bottom: 230px; max-width: 320px; z-index: 6; pointer-events: none; }
fieldset { padding: 0; margin: 24px 0 18px; border: 0; }
legend { color: #afc7bf; font-size: 11px; letter-spacing: .08em; margin-bottom: 16px; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 18px 0; align-items: stretch; }
.settings-grid fieldset { min-width: 0; margin: 0; padding: 16px; border: 1px solid #bddbc933; border-radius: 10px; background: #07151933; }
.settings-grid legend { padding: 0 6px; margin-bottom: 12px; }
.menu-start-row { display: grid; grid-template-columns: minmax(180px, 220px) minmax(0, 1fr); align-items: center; gap: 14px; margin-bottom: 8px; }
.menu-start-row [data-account] { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px 12px; min-width: 0; }
.menu-start-row .account-status { grid-column: 1; margin: 0; font-size: 11px; line-height: 1.4; }
.menu-start-row .account-open { grid-column: 2; grid-row: 1; justify-self: end; white-space: nowrap; }
.menu-navigation-row { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 4px; }
.menu-navigation-row .restart-button { width: auto; font-size: 10px; }
.setting-label { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; margin-bottom: 12px; }
.setting-label output, .setting-label > span { color: #afc7bf; font-size: 12px; }
input[type="range"] { width: 100%; accent-color: var(--accent); height: 5px; margin: 0 0 22px; }
input[type="number"] { width: 100%; border: 1px solid var(--line); border-radius: 7px; background: #d4e6df0a; color: #e1ebe6; padding: 9px 12px; }
.view-actions { display: flex; gap: 8px; margin-top: 12px; }
.view-actions button { flex: 1; min-height: 26px; padding: 4px 6px; font-size: 10px; }
.menu-actions-row { display: grid; grid-template-columns: repeat(2, minmax(0, 180px)); gap: 8px; margin-top: 12px; }
#controls-panel .menu-actions-row .restart-button { width: auto; min-width: 0; height: 28px; min-height: 28px; padding: 4px 8px; font-size: 10px; line-height: 1.2; white-space: nowrap; }
details { border-top: 1px solid var(--line); padding-top: 16px; }
summary { cursor: pointer; color: #d4e6df; font-size: 13px; }
dl { display: grid; grid-template-columns: auto 1fr; gap: 10px 14px; margin: 16px 0 0; font-size: 12px; }
dt { color: #eabc7b; }
dd { margin: 0; text-align: right; color: #afc7bf; }
.controls-guide .controls-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.shortcut-group { min-width: 0; padding: 12px; border: 1px solid #bddbc933; border-radius: 8px; background: #07151933; }
.shortcut-group h2 { margin: 0; color: var(--accent); font-size: 12px; font-weight: 650; }
.shortcut-group dl { grid-template-columns: minmax(88px, auto) 1fr; gap: 7px 10px; margin-top: 10px; font-size: 11px; line-height: 1.45; }
.shortcut-group dd { text-align: left; }
.menu-note { font-size: 12px; line-height: 1.7; color: #afc7bf; margin: 22px 0 16px; }
.source-notes { margin: 16px 0; }
.source-notes p { font-size: 12px; line-height: 1.6; color: #afc7bf; }
.source-notes a { color: var(--accent); }
.restart-button { width: 100%; font-size: 11px; color: #cdb0a0; }
.inventory-panel { width: min(1160px, calc(100vw - 32px)); }
.inventory-panel header { margin-bottom: 12px; }
.inventory-intro, .inventory-notice { color: #afc7bf; font-size: 12px; line-height: 1.6; }
.inventory-filters { display: grid; grid-template-columns: 1fr 150px 160px; gap: 12px; margin: 20px 0; }
.inventory-filters label { display: grid; gap: 6px; font-size: 11px; color: #afc7bf; }
.inventory-filters input, .inventory-filters select { width: 100%; min-width: 0; padding: 9px 10px; border: 1px solid var(--line); border-radius: 7px; color: #e1ebe6; background: #1a333a; }
.inventory-filters select:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.inventory-content { display: grid; grid-template-columns: 300px minmax(0, 1fr) 225px; gap: 20px; align-items: start; }
.inventory-content h2 { margin: 0 0 12px; font-size: 14px; font-weight: 550; }
.inventory-character-panel { min-width: 0; }
.inventory-character-panel > h2 { margin-top: 24px; }
.inventory-character-panel dl { gap: 8px; font-size: 10px; }
.inventory-character-panel dt { color: #afc7bf; }
.inventory-character-panel dd { color: #e1ebe6; }
.inventory-catalog-heading { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.inventory-catalog-heading output { font-size: 12px; color: #afc7bf; }
.inventory-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; max-height: 55dvh; overflow-y: auto; padding: 2px; }
.item-card { min-width: 0; display: grid; justify-items: center; align-content: start; gap: 7px; padding: 10px 5px; background: linear-gradient(145deg, #38544940, #071a2440); }
.item-card[aria-pressed="true"] { border-color: var(--accent); background: #eabc7b12; }
.item-card.is-equipped { box-shadow: inset 0 -2px #93bc9d; }
.item-card strong { font-size: 12px; font-weight: 500; text-align: center; }
.item-card small { font-size: 10px; color: #afc7bf; }
.item-icon { width: 52px; height: 62px; display: grid; place-items: center; }
.item-icon svg { width: 100%; height: 100%; }
.inventory-detail { border: 1px solid var(--line); border-radius: 12px; padding: 16px; background: #d4e6df06; }
.inventory-item-actions { display: grid; gap: 8px; }
.inventory-item-actions button { min-width: 0; white-space: normal; }
.inventory-equipped { margin-bottom: 18px; }
.inventory-character-stage { position: relative; height: 360px; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: radial-gradient(ellipse at 50% 35%, #52726655, #071a2440 75%); }
#inventory-character { position: absolute; inset: 0; cursor: grab; touch-action: none; }
#inventory-character:active { cursor: grabbing; }
#inventory-character:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
.inventory-view-controls { display: flex; justify-content: center; gap: 8px; margin: 10px 0; }
.inventory-view-controls button { padding: 7px 12px; font-size: 10px; }
.inventory-preview-zoom { display: flex; align-items: center; gap: 12px; font-size: 10px; color: #afc7bf; }
.inventory-preview-zoom input { flex: 1; min-width: 0; }
.inventory-equipped > p { font-size: 10px; line-height: 1.6; color: #afc7bf; }
.inventory-preview { display: grid; place-items: center; height: 155px; margin-bottom: 18px; background: radial-gradient(ellipse, #d4e6df16, transparent 70%); }
.inventory-preview svg { width: 140px; height: 140px; }
.inventory-detail > p { font-size: 11px; line-height: 1.7; color: #c5d7ce; }
.inventory-detail .inventory-item-kind { font-size: 11px; color: #afc7bf; }
.inventory-detail .inventory-modifiers { color: var(--accent); margin: 18px 0; }
.inventory-pending { border: 1px solid #eabc7b55; padding: 10px; border-radius: 8px; color: var(--accent); font-size: 11px; line-height: 1.6; }
.inventory-notice { min-height: 18px; margin: 18px 0 0; }
button:not(.icon-button), .minimap-hud, .target-hud, .player-hud, .equipment-hud,
.fps-overlay, .world-message, .jump-cue, .paused-label, .load-status, .speech-bubble,
.inventory-detail, .inventory-character-stage, .menu {
  border: 1px solid #05090b;
  box-shadow: inset 0 0 0 1px var(--line), 3px 3px 0 #0009, 0 6px 16px #0006;
}
.menu { box-shadow: inset 0 0 0 1px var(--line), 4px 4px 0 #000b, 0 24px 100px #0008; }
.item-card.is-equipped { box-shadow: inset 0 -2px #93bc9d, inset 0 0 0 1px var(--line), 3px 3px 0 #0009, 0 6px 16px #0006; }
progress { box-shadow: 0 0 0 1px #05090b, 0 2px 0 #0008; }
.world-label, .meter-label, .equipment-hud, .world-message, .paused-label,
.chat-panel, .speech-bubble { text-shadow: -1px 0 #000, 1px 0 #000, 0 -1px #000, 0 1px #000, 2px 2px 0 #0009; }
.chat-panel { box-shadow: inset 0 1px #bddbc950, 0 2px 0 #05090b99; }
.item-icon svg, .inventory-preview svg { filter: drop-shadow(1px 0 #000) drop-shadow(-1px 0 #000) drop-shadow(0 1px #000) drop-shadow(2px 2px #0009); }
.battle-score { position: absolute; top: max(16px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); width: 320px; display: grid; grid-template-columns: 24px repeat(var(--score-count, 4), minmax(0, 1fr)); gap: 8px; padding: 8px 10px; border: 1px solid #05090b; border-radius: 8px; background: var(--panel); box-shadow: inset 0 0 0 1px var(--line), 3px 3px 0 #0009; pointer-events: auto; text-shadow: 1px 1px 2px #000; }
.battle-score > div { display: flex; align-items: center; justify-content: center; gap: 5px; padding-bottom: 3px; }
.battle-score span { min-height: 20px; font-size: 10px; letter-spacing: .04em; }
.battle-score output { font: 14px ui-monospace, monospace; }
.battle-score small { grid-column: 1 / -1; text-align: center; font-size: 10px; color: #b8c8c2; }
[data-team="joseon"] { color: #80cae9; }
[data-team="ming"] { color: #f19c88; }
[data-team="japan"] { color: #e8ce84; }
.personal-score { color: #f5ead1; border-left: 1px solid var(--line); }
.battle-score[data-faction="joseon"] [data-team="joseon"],
.battle-score[data-faction="ming"] [data-team="ming"],
.battle-score[data-faction="japan"] [data-team="japan"] { box-shadow: inset 0 -2px currentColor; }
.battle-score [data-player-team="true"] { box-shadow: inset 0 -2px currentColor; }
.battle-score[data-team-count="8"] { width: min(520px, calc(100vw - 32px)); gap: 4px; }
.battle-score[data-team-count="8"] .faction-flag { width: 26px; height: 19px; }
.battle-score[data-team-count="8"] > div { flex-direction: column; gap: 0; }
.battle-score[data-team-count="8"] .hud-icon { width: 16px; height: 16px; flex-basis: 16px; }
.faction-panel { width: min(1040px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow-y: auto; }
.faction-panel header { margin-bottom: 12px; }
.faction-choices { min-width: 0; margin: 0; padding: 0; border: 0; }
.faction-choices legend { margin-bottom: 10px; color: #e8dfce; font-size: 13px; }
.faction-portrait-carousel { display: flex; gap: 12px; overflow-x: auto; padding: 4px 4px 12px; scroll-snap-type: x mandatory; }
.faction-choice { position: relative; display: flex; flex: 1 0 200px; flex-direction: column; gap: 8px; margin: 0; padding: 7px; border: 1px solid var(--line); border-radius: 8px; background: #071a2440; color: #e2e8df; text-align: left; cursor: pointer; scroll-snap-align: start; }
.faction-choice:hover, .faction-choice[aria-pressed="true"] { border-color: var(--accent); background: #eabc7b14; }
.faction-choice:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.faction-choice:disabled { cursor: progress; opacity: .7; }
.faction-portrait { display: block; width: 100%; height: 260px; border-radius: 5px; background: radial-gradient(ellipse at 50% 35%, #73664966, #071a2440 75%); image-rendering: pixelated; }
.faction-choice-flag { position: absolute; top: 12px; right: 12px; width: 25px; height: 25px; }
.faction-choice strong { display: block; min-height: 2.4em; font-size: 12px; line-height: 1.25; }
.faction-choice small { color: #b8c8c2; font-size: 11px; line-height: 1.5; }
@media (min-width: 601px) {
  #stage:has(#match-panel:not([hidden])) .target-hud { top: max(136px, calc(env(safe-area-inset-top) + 120px)); }
}
@media (min-width: 601px) and (max-width: 900px) {
  .hud-toolbar { top: max(72px, calc(env(safe-area-inset-top) + 56px)); }
  .minimap-hud { top: max(128px, calc(env(safe-area-inset-top) + 112px)); }
}
@media (max-width: 900px) {
  .equipment-hud { bottom: max(132px, calc(env(safe-area-inset-bottom) + 116px)); }
  .interaction-hud { bottom: max(240px, calc(env(safe-area-inset-bottom) + 224px)); }
  .jump-cue { bottom: max(248px, calc(env(safe-area-inset-bottom) + 232px)); }
}
@media (max-width: 850px) {
  .inventory-content { grid-template-columns: 240px minmax(0, 1fr); }
  .inventory-character-panel { grid-row: span 2; }
  .inventory-detail { grid-column: 2; }
  .inventory-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1000px) {
  .world-message { max-width: min(380px, calc(100vw - 480px)); }
}
@media (max-width: 600px) {
  .menu-start-row { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .menu-start-row [data-account] { grid-template-columns: minmax(0, 1fr) auto; }
  .menu-actions-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #controls-panel .menu-actions-row .restart-button { height: auto; min-height: 28px; }
  #controls-panel .menu-actions-row .restart-button { white-space: normal; }
  .settings-grid { grid-template-columns: 1fr; gap: 0; }
  .settings-grid fieldset + fieldset { margin-top: 12px; }
  #controls-panel { padding: 18px; }
  .map-dock { bottom: max(12px, env(safe-area-inset-bottom)); }
  .world-map-tools-content { max-height: min(55dvh, calc(100dvh - 220px)); }
  .chat-panel { right: max(10px, env(safe-area-inset-right)); bottom: max(220px, calc(env(safe-area-inset-bottom) + 204px)); width: min(230px, calc(100% - 32px)); }
  .hud-toolbar { top: calc(min(190px, 50vw - 16px) + 22px); right: max(12px, env(safe-area-inset-right)); display: grid; grid-template-columns: repeat(2, max-content); }
  .fps-overlay { font-size: 10px; }
  .fps-overlay > span, #fps-frame-ms, .fps-time-unit { display: none; }
  .left-hud { position: absolute; z-index: 3; top: max(112px, calc(env(safe-area-inset-top) + 96px)); left: max(12px, env(safe-area-inset-left)); width: min(164px, calc(50% - 18px)); display: flex; flex-direction: column; gap: 6px; }
  .mobility-hud { position: static; width: 100%; padding: 6px; }
  .mobility-speed { align-items: center; flex-wrap: wrap; gap: 3px; font-size: 9px; letter-spacing: 0; }
  .mobility-speed > span { flex-basis: 100%; }
  #movement-speed { font-size: 11px; }
  .world-label { left: 12px; top: 16px; max-width: calc(50% - 18px); }
  .world-label output { font-size: 12px; }
  .world-label output { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .battle-score, .battle-score[data-team-count="8"] { position: static; transform: none; width: 100%; grid-template-columns: 14px repeat(var(--score-count, 4), minmax(0, 1fr)); gap: 3px; padding: 4px; }
  .battle-score[data-team-count="8"] { grid-template-columns: repeat(5, minmax(0, 1fr)) !important; }
  .battle-score > div, .battle-score[data-team-count="8"] > div { flex-direction: column; gap: 2px; padding-bottom: 1px; }
  .battle-score .faction-flag { width: 18px; height: 14px; }
  .battle-score span { min-height: 0; font-size: 9px; letter-spacing: 0; }
  .battle-score output { font-size: 12px; }
  .battle-score small { font-size: 9px; }
  .battle-score[data-team-count="8"] .faction-flag { width: 20px; height: 15px; }
  .battle-score[data-team-count="8"] .hud-icon { width: 14px; height: 14px; flex-basis: 14px; }
  .target-hud { top: 260px; left: 16px; transform: none; width: 150px; }
  .minimap-hud { top: max(16px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); width: min(190px, calc(50% - 16px)); }
  .party-hud { gap: 2px; }
  #party-distance { font-size: 9px; }
  #party-risk { flex-basis: 8px; width: 8px; }
  .interaction-hud { left: auto; right: 16px; transform: none; max-width: calc(100% - 204px); }
  .interaction-hud button { max-width: 100%; padding: 8px; gap: 4px; font-size: 11px; }
  .faction-panel { padding: 18px; }
  .faction-choice { flex-basis: 200px; }
  .faction-portrait { height: 148px; }
  .player-hud { left: max(8px, env(safe-area-inset-left)); bottom: max(8px, env(safe-area-inset-bottom)); width: 72px; padding: 6px; }
  .player-hud .meter-label { margin-bottom: 4px; }
  .player-hud .meter-label output { font-size: 9px; }
  .player-hud .hud-icon { width: 12px; height: 12px; flex-basis: 12px; }
  .player-hud .stamina-label { margin-top: 6px; }
  .equipment-hud { left: max(86px, calc(env(safe-area-inset-left) + 78px)); right: max(70px, calc(env(safe-area-inset-right) + 62px)); bottom: max(8px, env(safe-area-inset-bottom)); transform: none; width: auto; max-width: none; padding: 3px; gap: 3px; }
  .weapon-status { min-width: 0; gap: 3px; font-size: 9px; }
  #equipment { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .action-dock { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2px; }
  .action-dock > span { min-width: 0; min-height: 22px; gap: 2px; padding: 1px; }
  .action-dock kbd { padding: 1px 2px; font-size: 8px; }
  .action-dock .hud-icon { width: 12px; height: 12px; flex-basis: 12px; }
  .action-dock .dock-divider { margin-left: 0; }
  .action-dock .dock-divider .hud-icon, .action-dock > span:last-child .hud-icon { display: none; }
  .chat-toggle { right: max(8px, env(safe-area-inset-right)); bottom: max(8px, env(safe-area-inset-bottom)); width: 56px; min-height: 28px; padding: 3px; gap: 2px; }
  .chat-toggle kbd { padding: 1px 2px; font-size: 8px; }
  .commerce-toggle.hud-shortcut { right: max(8px, env(safe-area-inset-right)); bottom: max(42px, calc(env(safe-area-inset-bottom) + 34px)); min-width: 0; width: 56px; padding: 3px; gap: 2px; }
  .commerce-toggle output { max-width: 100%; font-size: 9px; }
  .world-message { top: 212px; bottom: auto; left: 12px; right: calc(min(190px, 50% - 16px) + 24px); transform: none; width: auto; max-width: none; max-height: 40px; overflow-y: auto; pointer-events: auto; font-size: 11px; }
  #stage:has(#combat-message:not([hidden])) .target-hud { top: 292px; }
  .controls-guide .controls-grid { grid-template-columns: 1fr; }
  .shortcut-group dl { grid-template-columns: minmax(112px, auto) 1fr; }
  .world-clock { max-width: 100%; gap: 4px; }
  #campaign-time { font-size: 10px; }
  .inventory-panel { padding: 18px; }
  .inventory-filters { grid-template-columns: 1fr 1fr; }
  .inventory-filters label:first-child { grid-column: 1 / -1; }
  .inventory-content { grid-template-columns: 1fr; }
  .inventory-character-panel { grid-row: auto; }
  .inventory-character-panel dl { grid-template-columns: 1fr 1fr; }
  .inventory-grid { max-height: 330px; }
  .inventory-catalog { grid-row: 3; }
  .inventory-character-stage { height: 285px; }
  .inventory-detail { grid-column: auto; grid-row: 2; display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 0 12px; padding: 12px; }
  .inventory-item-actions { grid-column: 2; }
  .inventory-item-actions button { padding: 8px; font-size: 10px; }
  .inventory-preview { grid-row: span 5; margin: 0; }
  .inventory-preview svg { width: 85px; }
}
@media (max-width: 380px) {
  .world-label { gap: 9px; }
  .world-label > span { font-size: 10px; letter-spacing: 1px; }
  .world-label output { font-size: 11px; }
}
@media (max-height: 600px) {
  .global-chat:not(.is-open) .chat-panel { display: none; }
}
.online-status {
  position: absolute;
  top: 5.5rem;
  left: 50%;
  transform: translateX(-50%);
  max-width: min(80vw, 42rem);
  padding: 0.4rem 0.7rem;
  background: #10242a;
  color: #d6f1dd;
  font-size: 0.75rem;
  text-align: center;
  pointer-events: none;
  z-index: 4;
}
.online-status[data-connected="false"] { color: #ffd18b; }
