:root { color-scheme: dark; font-family: system-ui, sans-serif; background: #101820; color: #e8f4f3; }
[hidden] { display: none !important; }
* { box-sizing: border-box; } body { margin: 0; } header { padding: 12px 22px; background: #1b3038; display: flex; gap: 20px; align-items: baseline; }
h1 { font-size: 1.3rem; margin: 0; } header span { color: #a2c9c8; }
.app-shell { min-height: 100vh; }
.return-blackout { position: fixed; inset: 0; z-index: 1000; background: #000; }
.run-control-bar { padding: 12px 22px; border-bottom: 1px solid #39585e; background: #16252b; }
#start-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.main-layout { display: grid; grid-template-columns: minmax(0, 1fr) 440px minmax(0, 1fr); align-items: start; min-height: calc(100vh - 132px); padding: 20px 0 36px; }
.play-column { grid-column: 2; grid-row: 1; width: 440px; }
.left-panel { grid-column: 1; grid-row: 1; justify-self: end; width: min(320px, calc(100% - 40px)); margin-right: 20px; min-width: 0; display: grid; align-content: start; gap: 14px; }
.right-panel { grid-column: 3; grid-row: 1; justify-self: start; width: min(320px, calc(100% - 40px)); margin-left: 20px; min-width: 0; }
.side-card { min-width: 0; padding: 15px; border: 1px solid #466269; border-radius: 6px; background: #16252b; }
.side-card h2 { margin: 0 0 12px; font-size: 1rem; }
#recent-events-list { margin: 0; padding-left: 22px; min-height: 42px; font-size: .85rem; line-height: 1.45; overflow-wrap: anywhere; }
#recent-events-list li + li { margin-top: 7px; }
#recent-events-list:empty::after { content: '—'; color: #8da8ac; }
.score-panel dl { margin: 0; }
.score-panel dl > div { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid #39585e; }
.score-panel dt { color: #b2cacc; font-size: .85rem; }
.score-panel dd { margin: 0; font-weight: 700; white-space: nowrap; }
.score-panel .current-resource { margin-top: 4px; }
.score-panel .score-explanation { margin: 12px 0 0; }
label { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; } input, select, button { padding: 8px; border: 1px solid #527478; border-radius: 5px; background: #23383d; color: inherit; }
button { cursor: pointer; } button:hover { background: #345963; }
.tactical-frame { width: 100%; margin: 0 auto; border: 1px solid #527478; border-radius: 6px; overflow: hidden; background: #16252b; }
.status-area { padding: 12px 16px; border-bottom: 1px solid #39585e; }
.status-heading { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 9px; }
.status-row { display: grid; grid-template-columns: minmax(140px, 1fr) minmax(95px, 1fr); gap: 12px; align-items: center; margin: 5px 0; font-size: .9rem; }
.gauge { height: 9px; border: 1px solid #5b7779; border-radius: 8px; background: #30474b; overflow: hidden; }
.gauge span { display: block; height: 100%; width: 0; background: #70c5a9; }
#resource-gauge { background: #d8ba68; }
#versions { display: block; color: #8da8ac; font-size: .65rem; margin-top: 7px; }
.message-area { border-top: 1px solid #39585e; min-height: 88px; padding: 13px 16px; }
#events { display: block; white-space: pre-wrap; font-size: 1rem; line-height: 1.35; }
.message-area[data-priority="CRITICAL"] #events { color: #ffab9d; }
.message-area[data-priority="IMPORTANT"] #events { color: #ffe0a0; }
.message-area[data-priority="INFO"] #events { color: #b2cacc; font-weight: normal; }
button:disabled { cursor: not-allowed; opacity: .5; }
.map-wrap { overflow: auto; background: #071013; padding: 10px; } canvas { display: block; image-rendering: pixelated; max-width: 100%; height: auto; margin: auto; }
.controls { text-align: center; margin: 0; } .controls button { min-width: 50px; } #notice { min-height: 1.1em; margin: 6px 0 0; color: #f5c978; font-size: .8rem; }
.control-actions { display: flex; justify-content: center; margin-top: 12px; }
.resource-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
#run-result { width: min(100%, 440px); margin: 12px auto; padding: 14px; border: 1px solid #70c5a9; border-radius: 6px; text-align: center; font-weight: 700; }
#debug { overflow: auto; max-height: 70vh; }
#debug[hidden] { display: none; } #debug pre { white-space: pre-wrap; word-break: break-word; font-size: .78rem; } #toggles label { flex-direction: row; align-items: center; margin: 5px 0; }
#section-list { max-height: 200px; overflow: auto; font-size: .78rem; } .seed-controls { display: flex; gap: 5px; margin: 8px 0; }
@media (max-width: 1120px) {
  .main-layout { display: flex; flex-direction: column; align-items: center; }
  .play-column, .left-panel, .right-panel { width: min(440px, calc(100vw - 24px)); }
  .left-panel, .right-panel { margin: 18px 0 0; }
  #debug { max-height: none; }
}
@media (max-width: 600px) {
  header { padding: 10px 12px; gap: 8px; flex-wrap: wrap; }
  .run-control-bar { padding: 10px 12px; }
  #start-form label { flex: 1 1 130px; min-width: 0; }
  #start-form input, #start-form select { width: 100%; }
  .main-layout { padding-top: 12px; }
}

.gauge.critical span { background: #e05252 !important; }
.modal-prompt { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(88vw, 420px); z-index: 20; padding: 22px; text-align: center; background: #182e35; border: 2px solid #8fcfc4; border-radius: 8px; box-shadow: 0 0 0 100vmax #0009, 0 8px 30px #000b; }
.modal-actions, .portal-prompt div { display: flex; justify-content: center; gap: 14px; margin-top: 14px; }
.result-prompt h2 { margin: 0 0 12px; } .score-summary { margin: 16px 0; padding: 12px; border: 1px solid #527478; border-radius: 6px; text-align: left; }
.score-summary > strong { display: block; margin-bottom: 8px; color: #ffe0a0; } .score-summary p { display: grid; grid-template-columns: 1fr auto; align-items: baseline; margin: 7px 0; }
.score-summary p:first-of-type { font-size: 1.12rem; } .score-summary b { font-size: 1.35rem; color: #fff; } .score-summary p:first-of-type b { font-size: 1.7rem; color: #ffe0a0; }
.score-explanation { color: #b2cacc; font-size: .88rem; line-height: 1.5; }
.turnaround-prompt h2 { margin: 0 0 12px; }
.turnaround-prompt p { margin: 0; line-height: 1.6; }
.tactical-frame { position: relative; }

.direction-pad { display: grid; grid-template-columns: repeat(3, minmax(50px, 86px)); gap: 5px; justify-content: center; }
.direction-pad button { min-height: 43px; }
#attack { font-size: .75rem; background: #653142; }
.control-help { margin: 8px auto; max-width: 520px; color: #a9c7c8; font-size: .78rem; line-height: 1.5; }
