/* Integration overrides (loaded last). Structural safety only; visual theme lives in theme/layout/screens. */
[hidden] { display: none !important; }
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body { background: var(--bg, #0f1114); color: var(--ink, #e7ddc8); overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; }
button[disabled] { cursor: not-allowed; }
img { max-width: 100%; display: block; }
.shell { display: flex; flex-direction: column; height: 100vh; min-height: 0; }
.topbar { flex: 0 0 auto; }
.main { display: flex; flex: 1 1 auto; min-height: 0; }
.stage { flex: 1 1 auto; min-width: 0; overflow: auto; }
.rail { flex: 0 0 auto; }
.sidebar { flex: 0 0 320px; min-width: 0; overflow: hidden; display: flex; flex-direction: column; }
.log-feed { overflow: auto; flex: 1 1 auto; }
body[data-mode="full"] .topbar, body[data-mode="full"] .rail, body[data-mode="full"] .sidebar { display: none !important; }
body[data-mode="full"] .main { display: block; height: 100vh; }
body[data-mode="full"] .stage { height: 100vh; overflow: auto; }
.modal-backdrop { position: fixed; inset: 0; z-index: 800; display: flex; align-items: center; justify-content: center; background: rgba(5, 6, 8, .78); padding: 24px; }
.modal { width: min(620px, 94vw); max-height: 88vh; overflow: auto; }
.modal.modal-wide { width: min(1040px, 94vw); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.modal-foot { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.choice-list { display: flex; flex-direction: column; gap: 8px; }
.choice-btn { text-align: left; }
.toast-wrap { position: fixed; right: 24px; bottom: 24px; z-index: 1200; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.icon, .ico { display: inline-block; width: 1em; height: 1em; vertical-align: -0.12em; }
.ico { background: currentColor; -webkit-mask-size: contain; mask-size: contain; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; -webkit-mask-position: center; mask-position: center; }
.art-img { width: 100%; height: 100%; object-fit: cover; }
.map-svg { width: 100%; height: auto; display: block; }
.map-road { stroke: #8d8574; stroke-width: 2; stroke-dasharray: 6 6; fill: none; }
.map-road.rough { stroke: #b58c4e; }
.map-road.overgrown { stroke: #7f8a52; stroke-dasharray: 2 9; opacity: .5; }
.map-district-label { fill: #e7ddc8; font-size: 18px; letter-spacing: .16em; opacity: .75; cursor: pointer; }
.map-block-label { fill: #d9d0bd; font-size: 12px; opacity: .8; }
.map-block-dot { stroke: #0f1114; stroke-width: 2; }
.map-rv-ring { fill: none; stroke: #e2a33e; stroke-width: 2; animation: rvPulse 2s infinite; }
@keyframes rvPulse { 0% { opacity: .9; r: 14; } 70% { opacity: 0; r: 26; } 100% { opacity: 0; } }
.table-wrap { overflow: auto; }
.stat-table { width: 100%; border-collapse: collapse; }
.stat-table th, .stat-table td { text-align: left; padding: 4px 8px; }
.rep-bar, .capacity-bar, .meter { position: relative; overflow: hidden; }
.rep-fill, .capacity-fill, .enemy-hp-fill { height: 100%; }
.enemy-hp { height: 8px; overflow: hidden; }
.event-art { max-height: 260px; overflow: hidden; }
.prologue-art, .camp-art, .ending-bg { position: relative; overflow: hidden; }
.prologue-art .art-img, .ending-bg .ending-art { width: 100%; height: 100%; object-fit: cover; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.vehicle-card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.slot-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat-grid.big { grid-template-columns: repeat(4, 1fr); }
.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1 1 auto; }
.screen { padding: 24px 28px 48px; max-width: 1600px; margin: 0 auto; }
.screen-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; margin-bottom: 16px; }
.screen-body { margin-top: 16px; }
.map-layout { display: flex; flex-direction: column; gap: 14px; }
.map-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 18px; align-items: start; }
.map-side { display: flex; flex-direction: column; gap: 12px; }
.block-list { display: flex; flex-direction: column; gap: 8px; }
.block-card { text-align: left; display: block; width: 100%; }
.market { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; }
.market-list { min-width: 0; }
.item-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) 90px 160px; gap: 10px; align-items: center; }
.item-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.price-col { text-align: right; }
.camp-layout { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(320px, .8fr); gap: 20px; }
.camp-options { display: flex; flex-direction: column; gap: 10px; }
.camp-option { text-align: left; }
.encounter-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(340px, .8fr); gap: 20px; }
.battle-log { max-height: 240px; overflow: auto; }
.encounter-side { display: flex; flex-direction: column; gap: 12px; }
.title-screen { position: relative; min-height: 100vh; overflow: hidden; }
.title-bg { position: absolute; inset: 0; }
.title-bg .title-art { width: 100%; height: 100%; object-fit: cover; }
.title-vignette { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(8,9,11,.95) 0%, rgba(8,9,11,.55) 45%, rgba(8,9,11,.1) 100%); }
.title-logo, .title-menu, .title-top, .title-meta, .title-footer { position: relative; z-index: 2; }
.title-screen { display: flex; flex-direction: column; justify-content: center; padding: 8vh 7vw; gap: 18px; }
.title-top { position: absolute; top: 28px; left: 7vw; right: 7vw; }
.title-menu { display: flex; flex-direction: column; gap: 8px; max-width: 380px; }
.menu-btn { text-align: left; }
.title-meta { position: static !important; left: auto !important; bottom: auto !important; display: flex; gap: 18px; margin-top: 8px; color: var(--paper-dim); }
.title-footer { position: absolute; bottom: 24px; left: 7vw; right: 7vw; }
.prologue { display: flex; align-items: center; justify-content: center; padding: 32px; min-height: 100vh; }
.prologue-panel { display: grid; grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr); width: min(1040px, 94vw); max-height: 88vh; overflow: hidden; }
.prologue-art { min-height: 420px; }
.prologue-art .art-img { width: 100%; height: 100%; min-height: 420px; object-fit: cover; }
.prologue-text { display: flex; flex-direction: column; gap: 14px; min-height: 0; overflow-y: auto; }
.prologue-kicker { color: var(--muted); letter-spacing: .2em; font-size: 10px; }
.prologue-copy { color: var(--paper-2); font-size: 15px; line-height: 1.85; letter-spacing: .01em; }
.prologue-dots { display: flex; gap: 6px; margin-top: auto; }
.prologue-dot { width: 26px; height: 3px; background: rgba(231,221,200,.2); display: inline-block; }
.prologue-dot.active { background: #e2a33e; }
.prologue-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ending { position: relative; min-height: 100vh; overflow: hidden; }
.ending-bg { position: absolute; inset: 0; }
.ending-main { position: relative; z-index: 2; padding: 7vh 7vw; max-width: 1200px; }
.ending-text-wrap { max-width: 760px; }
.ending-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 22px; }
.ending-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.unlock-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(176px, 1fr)); gap: 10px; width: 100%; }
.unlock-card { display: flex; flex-direction: column; align-items: stretch; gap: 6px; }
.unlock-card .vehicle-art { width: 100%; aspect-ratio: 16 / 7; overflow: hidden; background: #0b0e12; border: 1px solid rgba(60,48,30,.25); }
.unlock-card .vehicle-art .art-img { width: 100%; height: 100%; object-fit: cover; }
.encounter-art { position: relative; }
@media (max-width: 1360px) {
  .market { grid-template-columns: minmax(0, 1fr) 280px; }
  .map-wrap { grid-template-columns: minmax(0, 1fr) 320px; }
  .sidebar { flex-basis: 280px; }
}
@media (max-width: 1180px) {
  .map-wrap, .market, .camp-layout, .encounter-layout, .ending-columns, .grid-2 { grid-template-columns: 1fr; }
  .item-row { grid-template-columns: 30px minmax(0, 1fr) 80px; }
  .item-actions { grid-column: 1 / -1; }
}

/* =====================================================================
   Lead integration fixes: HUD structure, modal text, camp, encounter, title
   ===================================================================== */

/* ---- topbar: two rows (brand spans both) ---- */
.topbar {
  display: flex !important;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  height: auto !important;
  min-height: 88px;
  padding: 7px 16px 6px !important;
}
.hud-row { display: flex; align-items: center; gap: 14px; min-width: 0; }
.hud-top { height: 38px; }
.hud-bottom { height: 30px; gap: 12px; }
.topbar .brand { height: 38px !important; min-width: 178px; padding-right: 14px; }
.topbar .hud-loc { flex: 0 1 auto; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.topbar .hud-loc .loc-line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.topbar .hud-loc .tiny { font-size: 9px; letter-spacing: .18em; color: var(--muted-2); }
.topbar .hud-chips { flex: 1 1 auto; min-width: 0; gap: 4px; }
.topbar .hud-chip { height: 26px !important; padding: 0 7px !important; font-size: 10.5px !important; gap: 4px; }
.topbar .hud-chip b { font-size: 11.5px !important; }
.topbar .hud-chip .ico { width: 12px; height: 12px; }
.topbar .hud-phase { display: flex; align-items: center; gap: 6px; padding: 0; }
.topbar .hud-phase .tiny { font-size: 9px; letter-spacing: .16em; color: var(--muted); }
.topbar .hud-phase .phase-track { padding: 0 0 0 4px; border-left: 0; }
.topbar .hud-phase .phase-dot { width: 15px; height: 15px; margin-right: 3px; }
.topbar .hud-phase .phase-dot::after { width: 4px; height: 4px; margin: -2px 0 0 -2px; }
.topbar .hud-actions { display: flex; gap: 4px; margin-left: 2px; }
.topbar .hud-actions .btn.icon { width: 26px; height: 26px; min-height: 0; padding: 0; }
.topbar .hud-actions .ico { width: 14px; height: 14px; }
.topbar .hud-objective {
  display: flex !important;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
  margin-left: auto;
  padding-left: 12px;
  border-left: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--paper-3);
}
.topbar .hud-objective .tiny { color: var(--muted-2); letter-spacing: .16em; font-size: 9px; white-space: nowrap; }
.topbar .hud-objective-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46vw; }
.topbar .hud-threat { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; font-family: var(--font-mono); font-size: 10px; color: var(--muted); }
.topbar .hud-threat.warn { color: var(--sodium); }
.topbar .hud-threat.danger { color: var(--alert-2); }

/* ---- modal event / beat text ---- */
.modal-body .event-text,
.modal-body .beat-text,
.modal-body .beat-line,
.modal-body .prologue-copy {
  color: var(--paper-2) !important;
  font-size: 15px;
  line-height: 1.8;
}
.modal-body .event-text { white-space: pre-wrap; }
.event-art { max-height: 210px; border: 1px solid var(--line); overflow: hidden; background: #0b0e12; }
.event-art .art-img { width: 100%; max-height: 210px; object-fit: cover; }
.beat-lines { display: flex; flex-direction: column; gap: 10px; border-left: 2px solid var(--sodium); padding: 12px 14px; background: rgba(0,0,0,.22); }
.beat-line { display: flex; gap: 10px; align-items: baseline; }
.beat-speaker { flex: 0 0 auto; min-width: 74px; color: var(--sodium); font-family: var(--font-head); font-size: 12px; letter-spacing: .1em; }
.modal-kicker { color: var(--muted-2); }

/* ---- camp ---- */
.camp-options .camp-option { display: flex; flex-direction: column; gap: 4px; width: 100%; }
.camp-option .camp-option-name { color: var(--paper) !important; font-family: var(--font-head); font-size: 15px; letter-spacing: .06em; }
.camp-option .camp-option-hint { color: var(--muted) !important; }
.camp-option.direct { border-style: dashed; }
.camp-screen .camp-art { min-height: 300px; max-height: 520px; }
.camp-screen .camp-art .art-img { width: 100%; height: 100%; object-fit: cover; }

/* ---- encounter ---- */
.encounter-screen { max-width: 1480px; }
.encounter-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.encounter-art { position: relative; aspect-ratio: 16 / 6.2; min-height: 180px; overflow: hidden; border: 1px solid var(--line); background: #0b0e12; }
.encounter-art .art-img { width: 100%; height: 100%; object-fit: cover; }
.encounter-art-shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.08), rgba(0,0,0,.55)); }
.encounter-art-label { position: absolute; left: 12px; bottom: 10px; color: var(--paper-3); letter-spacing: .16em; }
.enemy-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: space-between; }
.enemy-panel { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; }
.encounter-intro { font-size: 13px; line-height: 1.7; }
.enemy-hp { display: block !important; }
.enemy-hp .bar { height: 10px; overflow: hidden; border: 1px solid rgba(163,58,58,.42); background: #150d0d; margin-bottom: 5px; }
.enemy-hp .enemy-hp-fill { height: 100%; background: linear-gradient(90deg, #7d2620, #c8514b); box-shadow: inset 0 0 8px rgba(0,0,0,.5); }
.encounter-side .choice-list { grid-template-columns: 1fr; }
.encounter-side .choice-btn { padding: 9px 11px; }

/* ---- map readability & fit ---- */
.map-block-label { font-size: 11px; opacity: .58; }
.map-block.current .map-block-label, .map-block.selected .map-block-label { opacity: 1; font-weight: 700; }
.map-district-label { font-size: 16px; opacity: .85; }
.district-card .district-name { color: var(--paper-2) !important; }
.district-card .district-meta { color: var(--muted) !important; }
.district-card.active .district-name { color: var(--paper) !important; }
.map-side .block-list { max-height: 280px; overflow-y: auto; padding-right: 2px; }
.map-legend { color: var(--paper-3); }

/* ---- ending ---- */
.ending-main { width: min(1180px, 92vw); margin: 0 auto; padding: 6vh 2vw 5vh; }
.ending-text-wrap { max-width: 780px; }
.ending .ending-text { color: var(--paper-2); font-size: 15px; line-height: 1.9; margin-bottom: 10px; }
.ending-columns { align-items: start; }
.ending .panel { background: rgba(12,14,18,.86); }
.ending-actions { justify-content: flex-start; }

/* ---- misc ---- */
.screen { max-width: 1480px; }
.screen-title { font-family: var(--font-head); letter-spacing: .06em; }
.btn.icon { min-width: 28px; min-height: 28px; display: inline-flex; align-items: center; justify-content: center; }
.log-item.flavor { opacity: .78; }
@media (max-width: 1360px) {
  .topbar .hud-objective-text { max-width: 32vw; }
  .prologue-panel { grid-template-columns: 1fr; max-height: 92vh; overflow-y: auto; }
  .prologue-art { min-height: 220px; }
}
@media (max-width: 1180px) {
  .topbar .hud-mobile-hide { display: none; }
  .prologue-panel { width: 94vw; }
}
/* vehicle card modal: keep art + body side by side, footer full width in body */
.vehicle-card-grid .vehicle-card { align-items: stretch; gap: 10px; }
.vehicle-card-grid .vehicle-art { flex: 0 0 150px; height: auto; aspect-ratio: 16 / 7; align-self: flex-start; display: grid; place-items: center; }
.vehicle-card-grid .vehicle-art .art-img { width: 100%; height: 100%; object-fit: contain; }
.vehicle-card-grid .vehicle-card-body { flex: 1 1 0; min-width: 0; }
.vehicle-card-grid .vehicle-card-body .row { flex-wrap: wrap; row-gap: 4px; }
.vehicle-card-grid .vehicle-card-body .tag { margin-left: 0 !important; }
.vehicle-card-grid .vehicle-card-body .panel-foot { margin-top: 10px; padding: 0; border: 0; background: none; }
.vehicle-card-grid .vehicle-card-body .panel-foot .btn { width: 100%; }
/* modal vehicle cards: portrait card layout */
.vehicle-card-grid .vehicle-card { flex-direction: column; }
.vehicle-card-grid .vehicle-art { width: 100%; flex: 0 0 auto; aspect-ratio: 16 / 5.2; }
.vehicle-card-grid .vehicle-card-body { width: 100%; flex: 1 1 auto; }
/* fit all six district cards on 1280–1400 widths */
@media (max-width: 1400px) {
  .district-strip { gap: 6px; }
  .district-strip .district-card { min-width: 118px; padding: 7px 8px; }
  .district-strip .district-name { font-size: 12px; }
  .district-strip .district-meta { font-size: 8px; letter-spacing: 0; }
}
/* map legend is decorative: never steal clicks from block dots / roads */
.map-legend, .map-legend * { pointer-events: none; }
