@font-face {
  font-family: LINESeedKR;
  src: url('/public/assets/fonts/LINESeedKR-Regular.woff2') format('woff2');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: LINESeedKR;
  src: url('/public/assets/fonts/LINESeedKR-Bold.woff2') format('woff2');
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: NexonKart;
  src: url('/public/assets/fonts/NEXON-Kart-Gothic-Bold.otf') format('opentype');
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: light;
  font-family: LINESeedKR, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  color: #17243c;
  background: #f5f6fa;
  --ink: #17243c;
  --muted: #52617a;
  --panel: #f5f6fa;
  --panel-deep: #e6ecf8;
  --paper: #ffffff;
  --line: #b7c5dc;
  --cobalt: #2359b6;
  --cobalt-deep: #19478f;
  --cat: #235fc2;
  --dog: #c33750;
}

::selection { color: #fff; background: #2359b6; }
button:focus-visible, select:focus-visible, canvas:focus-visible { outline-color: #19478f; }
.setup-card h2, .end-card h2, .commander-copy strong, .faction-choice-info strong,
.worker-identity h2, .inspection-header h2, .detail-title strong, .page-heading > strong,
.enemy-profile-copy h2, .hero-detail h3 {
  font-family: NexonKart, LINESeedKR, sans-serif;
  font-weight: 700;
}

/* The neutral frame stays quiet so the battlefield and faction markers lead. */
.status-bar { color: var(--ink); background: var(--panel); border-bottom-color: var(--line); box-shadow: 0 4px 12px #152a4826; }
.portrait { border-color: var(--cat); background-color: #e6ecf8; }
.portrait.eko { background-image: url('/public/game-art/commanders/eko-v2.webp'); background-size: 200% auto; background-position: 45% 7%; }
.portrait.kwon { border-color: var(--dog); background-color: #f8e9ed; }
.portrait.kwon { background-image: url('/public/game-art/commanders/kwon-v2.webp'); background-size: 195% auto; background-position: 45% 4%; }
.commander-copy span, .base-label, .base-status > span:last-child, .mobile-hp,
.money span, .wave span, .money small, .money #income { color: var(--muted); }
.health-track { background: #d4deed; border-color: #a5b6cf; }
.health-track i { background: var(--cat); }
.commander-enemy .health-track i { background: var(--dog); }
.money strong, .wave strong { color: var(--ink); }
.arena { background: #ccd5e0; }
.unit-tooltip, .notice { color: #fff; background: #17243ceb; border-color: #6d829f; }
.team-dot { background: #82b5ff; }
.team-dot.orange { background: #ef91a2; }
.audio-controls { position: absolute; top: 12px; right: 12px; z-index: 2; display: flex; gap: 8px; }
.sound-toggle { display: grid; place-items: center; width: 44px; height: 44px; padding: 9px; border: 1px solid #7189aa; border-radius: 9px; color: #fff; background: #17243ceb; cursor: pointer; }
.sound-toggle svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sound-toggle .sound-muted, .sound-toggle[aria-pressed="false"] .sound-waves { display: none; }
.sound-toggle[aria-pressed="false"] .sound-muted { display: block; }
.sound-toggle:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
@media (max-width: 650px) {
  .audio-controls { top: 7px; right: 7px; gap: 4px; }
}
.placement-bar { color: var(--ink); background: #f5f6faf5; border-color: var(--line); }
.placement-bar button { color: #fff; background: var(--cobalt); border-color: var(--cobalt-deep); }
.placement-bar button:hover { background: var(--cobalt-deep); }

.command-deck { color: var(--ink); background: var(--panel); border-top-color: #8da7cc; box-shadow: 0 -4px 14px #152a4826; }
.deck-map { border-right-color: var(--line); }
.map-frame { color: var(--ink); background: var(--panel-deep); border-color: var(--line); }
.map-heading small { color: var(--muted); }
.deck-kicker { color: var(--muted); }
.deck-tabs button { color: #40516c; }
.deck-tabs button:hover { color: var(--cobalt-deep); background: #e4ecfa; }
.deck-tabs button[aria-selected='true'], .deck-tabs button[aria-pressed='true'] { color: var(--ink); border-bottom-color: var(--cobalt); }
.capacity, .capacity small { color: var(--muted); }
.capacity strong { color: var(--ink); }
.deck-panel { scrollbar-color: #91a9cc #e6ecf8; }

.small-button, .primary-button { color: #fff; background: var(--cobalt); border-color: var(--cobalt-deep); }
.small-button:hover:not(:disabled), .primary-button:hover:not(:disabled) { background: var(--cobalt-deep); }
.small-button.quiet, .secondary-button, .page-controls button, .enemy-filter button,
.back-buildings, .inspection-close { color: var(--ink); background: #fff; border-color: #9fb2cf; }
.small-button.quiet:hover:not(:disabled), .secondary-button:hover,
.page-controls button:hover:not(:disabled), .enemy-filter button:hover,
.back-buildings:hover, .inspection-close:hover { background: #e6ecf8; }
.enemy-filter button[aria-pressed='true'] { color: #fff; background: var(--cobalt); border-color: var(--cobalt-deep); }

.building-card { color: var(--ink); background: #fff; border-color: var(--line); }
.building-card:hover { background: #e8effb; }
.building-card.selected { background: #e3edfc; border-color: var(--cobalt); }
.building-card .building-glyph { color: #fff; background: var(--cobalt); }
.building-name small, .unit-role, .detail-title p, .unit-card p,
.unit-copy p, .hero-detail p { color: var(--muted); }
.worker-building.unavailable { color: #52617a; background: #e8edf5; border-color: #c8d1df; }
.worker-building kbd { color: #244678; background: #e2ebf8; }
.worker-building .building-name small { color: #344f79; font-weight: 700; font-variant-numeric: tabular-nums; }

.research-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(230px, 1fr); gap: 12px; width: 100%; height: 100%; min-height: 0; }
.research-commands { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); align-content: center; gap: 6px; min-width: 0; min-height: 0; }
.research-command { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-width: 0; min-height: 96px; padding: 16px 4px 8px; border: 1px solid #7188a9; border-radius: 8px; color: var(--ink); background: #fff; cursor: pointer; }
.research-command:hover, .research-command.is-previewed { border-color: var(--cobalt); background: #e3edfc; }
.research-command:active { background: #d4e2f8; }
.research-command[aria-disabled='true'] { color: #40516c; background: #e8edf5; }
.research-command[aria-disabled='true'].is-previewed, .research-command[aria-disabled='true']:hover { border-color: var(--cobalt); background: #dfe8f7; }
.research-icon { display: grid; width: 44px; height: 44px; flex: 0 0 44px; place-items: center; border-radius: 8px; color: var(--cobalt-deep); background: #e6ecf8; }
.research-icon svg { width: 34px; height: 34px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.research-name { max-width: 100%; overflow: hidden; font-size: 12px; font-weight: 700; line-height: 1.15; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.research-level, .research-lock { position: absolute; top: 5px; color: #40577c; font-size: 11px; font-weight: 700; line-height: 1.1; }
.research-level { right: 5px; font-variant-numeric: tabular-nums; }
.research-lock { left: 5px; }
.research-detail { display: grid; grid-template-rows: auto auto 1fr auto; gap: 5px; min-width: 0; min-height: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: #fff; }
.research-detail-head, .research-detail-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.research-detail-head h3 { margin: 0; font-family: NexonKart, LINESeedKR, sans-serif; font-size: 15px; }
.research-detail-head > span { color: #40577c; font-size: 12px; font-weight: 700; white-space: nowrap; }
.research-description, .research-effect { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.35; }
.research-effect { color: #244b87; font-weight: 700; }
.research-compact-targets { display: none; color: var(--muted); font-weight: 400; }
.research-price { display: flex; flex-direction: column; min-width: 0; color: var(--ink); }
.research-price strong { font-size: 14px; font-variant-numeric: tabular-nums; }
.research-price span { color: #8d2e45; font-size: 11px; font-weight: 700; }
.research-purchase { min-height: 36px; white-space: nowrap; }

@media (max-width: 1200px) {
  .research-layout { grid-template-columns: minmax(0, 1fr) minmax(200px, .8fr); gap: 8px; }
  .research-commands { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: minmax(0, 1fr); align-content: stretch; }
  .research-command { flex-direction: row; min-height: 0; padding: 8px 5px; }
  .research-icon { width: 36px; height: 36px; flex-basis: 36px; }
  .research-icon svg { width: 28px; height: 28px; }
  .research-name { padding-right: 3px; }
}
@media (max-width: 700px) {
  .research-layout { grid-template-columns: minmax(0, 1fr) minmax(150px, .9fr); gap: 5px; }
  .research-commands { gap: 4px; }
  .research-command { flex-direction: column; gap: 2px; padding: 11px 2px 3px; }
  .research-icon { width: 30px; height: 30px; flex-basis: 30px; }
  .research-icon svg { width: 25px; height: 25px; }
  .research-name { font-size: 11px; padding: 0; }
  .research-level, .research-lock { top: 3px; }
  .research-level { right: 3px; }
  .research-lock { left: 3px; }
  .research-detail { padding: 8px; }
}
@media (max-width: 400px) {
  .research-detail-footer { gap: 4px; }
  .research-price strong { font-size: 12px; }
  .research-purchase { padding: 0 7px; font-size: 11px; }
}
@media (max-height: 420px) {
  .research-layout { gap: 5px; }
  .research-command { gap: 2px; min-height: 0; padding-top: 10px; }
  .research-icon { width: 27px; height: 27px; flex-basis: 27px; }
  .research-icon svg { width: 23px; height: 23px; }
  .research-detail { gap: 1px; padding: 3px 6px; }
  .research-detail-head h3 { font-size: 12px; line-height: 1.1; }
  .research-detail-head > span { font-size: 11px; }
  .research-description { display: none; }
  .research-effect { font-size: 11px; line-height: 1.1; }
  .research-compact-targets { display: block; }
  .research-price strong { font-size: 12px; }
  .research-purchase { min-height: 32px; }
}
@media (pointer: coarse) {
  .research-command, .research-purchase { min-height: 44px; }
}
.research-commands.research-commands-pair { grid-template-columns: repeat(2, minmax(0, 150px)); grid-auto-rows: auto; align-content: center; justify-content: center; }
.research-commands.research-commands-trio { grid-template-columns: repeat(3, minmax(0, 150px)); grid-auto-rows: auto; align-content: center; justify-content: center; }
.research-commands-pair .research-command { min-height: 96px; }
.research-commands-trio .research-command { min-height: 96px; }
@media (max-height: 420px) {
  .research-commands-pair .research-command, .research-commands-trio .research-command { min-height: 56px; }
}
.building-detail, .unit-inspector, .hero-detail { color: var(--ink); background: #fff; border-color: var(--line); }
.detail-head { background: #e6ecf8; border-bottom-color: var(--line); }
.unit-card, .unit-choice { color: var(--ink); background: #fff; border-color: var(--line); }
.unit-card h3, .unit-copy h3, .hero-detail h3, .unit-actions strong { color: var(--ink); }
.unit-choice:hover { background: #f0f5fd; }
.unit-choice[aria-pressed='true'] { border-color: var(--cobalt); background: #e3edfc; box-shadow: inset 0 0 0 1px var(--cobalt); }
.unit-meta, .unit-stats { color: #40577c !important; }
.built-label { color: #2359b6; }

.inspection-portrait { background: #e6ecf8; }
.spell-alert { position: absolute; top: 18%; left: 50%; z-index: 4; transform: translateX(-50%); padding: 10px 18px; border: 1px solid #a9c2e9; border-radius: 10px; background: #172b4a; color: #fff; font-weight: 700; text-align: center; box-shadow: 0 5px 18px #00000042; pointer-events: none; }
.spell-alert.is-enemy { background: #793446; border-color: #e0a3af; }
.spell-alert[hidden] { display: none; }
img[src$="/dog_guard.webp"], img[src$="/dog_vehicle.webp"] { height: auto; max-height: 100%; aspect-ratio: 1; }
img[src$="/dog_guard.webp"] { clip-path: inset(0 0 2.15% 0); }
img[src$="/dog_vehicle.webp"] { clip-path: polygon(3.2% 0, 100% 0, 100% 58.4%, 98.4% 58.4%, 98.4% 62.9%, 100% 62.9%, 100% 100%, 3.2% 100%); }
.inspection-portrait span, .inspection-header p, .inspection-stats dt, .inspection-note,
.inspection-vital small { color: var(--muted); }
.inspection-header h2, .inspection-stats dd { color: var(--ink); }
.inspection-track { background: #d4deed; }
.inspection-track i { background: var(--cat); }
.unit-inspector.faction-dog .inspection-track i:not(.shield) { background: var(--dog); }
.inspection-track i.shield { background: #5791be; }

.page-heading > span, .empty-note, .empty-selection p { color: var(--muted); }
.info-card, .guide-copy, .setup-opponent { color: var(--ink); background: #fff; border-color: var(--line); }
.info-card p, .info-card .meta, .guide-copy p, .setup-opponent small,
.hero-detail .hero-status, .available-list, .enemy-heading h2 small, .enemy-heading > span { color: var(--muted); }

.worker-identity { color: var(--ink); background: #e6ecf8; border-color: var(--line); }
.worker-identity p { color: var(--muted); }
.worker-orders { color: var(--ink); background: #fff; border-color: var(--line); }
.worker-orders p { color: var(--muted); }
.worker-orders p strong { color: var(--ink); }
.worker-buttons .worker-command { color: #fff; background: var(--cobalt); border-color: var(--cobalt-deep); }
.worker-buttons .worker-command:hover { background: var(--cobalt-deep); }
.worker-command kbd { color: #e0ebff; }

.enemy-profile { color: var(--ink); background: #fff; border-color: var(--line); }
.enemy-profile-art { background: #e6ecf8; }
.enemy-profile-copy > span, .enemy-profile-copy > small, .enemy-profile-copy p,
.enemy-profile-copy dt, .enemy-profile-empty span, .enemy-profile-empty p,
.enemy-count-legend, .enemy-empty { color: var(--muted); }
.enemy-profile-copy h2, .enemy-profile-copy dd { color: var(--ink); }
.enemy-unit, .enemy-chip { color: var(--ink); background: #fff; border-color: var(--line); }
.enemy-unit:hover { background: #edf3fc; }
.enemy-unit[aria-pressed='true'] { background: #e3edfc; border-color: var(--cobalt); box-shadow: inset 0 0 0 1px var(--cobalt); }
.enemy-unit strong { color: #40577c; }

.overlay { background: #101e35c9; }
.setup-card, .end-card { color: var(--ink); background: var(--panel); border-color: #cad5e7; box-shadow: 0 18px 50px #00000059; }
.setup-card h2, .end-card h2, legend { color: var(--ink); }
.setup-commander-art { background-size: contain; background-position: center bottom; }
.setup-commander-art.cat { background-image: url('/public/game-art/commanders/eko-v2.webp'); background-position: center bottom; }
.setup-commander-art.dog { background-image: url('/public/game-art/commanders/kwon-v2.webp'); background-position: center bottom; }
@media (min-width: 651px) and (min-height: 650px) {
  .setup-commander-art { transform: scale(1.14); transform-origin: center bottom; }
  .faction-art img { transform: scale(1.08); transform-origin: center bottom; }
}
.setup-card h2 span { color: var(--cobalt); }
.setup-grid legend, .setup-description, .end-card p, .eyebrow,
.setup-footer p, .setup-footer .difficulty-control { color: var(--muted); }
.faction-choice.faction-cat, .faction-choice.faction-dog { color: var(--ink); background: #fff; border-color: #b7c5dc; }
.faction-choice.faction-cat:hover, .faction-choice.faction-dog:hover { background: #f0f5fd; }
.faction-choice.faction-cat[aria-pressed='true'] { background: #e6effc; border-color: var(--cat); }
.faction-choice.faction-dog[aria-pressed='true'] { background: #fbecef; border-color: var(--dog); }
.faction-choice-info small { color: var(--muted); }
.faction-choice .faction-side { color: #40516c; background: #e5ebf4; }
.faction-choice[aria-pressed='true'] .faction-side { color: #fff; background: var(--cat); }
.faction-choice.faction-dog[aria-pressed='true'] .faction-side { color: #fff; background: var(--dog); }
.difficulty-control select { color: var(--ink); background: #fff; border-color: #9fb2cf; }

@media (max-height: 600px) and (min-width: 651px) {
  .worker-identity { gap: 6px; padding: 6px; }
  .worker-identity .portrait-focus { flex-basis: 52px; width: 52px; max-width: 40%; }
  .worker-identity h2, .worker-identity p { white-space: nowrap; }
}

@media (max-height: 420px) and (min-width: 651px) and (orientation: landscape) {
  .game-shell { grid-template-rows: auto minmax(90px, 1fr) minmax(0, 44dvh); }
  .worker-orders { padding-block: 8px; }
  .worker-buttons .worker-command { min-height: 80px; }
  .notice { right: 12px; left: auto; max-width: 34%; transform: none; }
}

@media (max-width: 500px) and (orientation: portrait) {
  .notice { top: 46px; max-width: calc(100% - 20px); }
}

.hero-alert { position: absolute; z-index: 5; top: 38%; left: 50%; display: flex; align-items: center; gap: 14px; width: min(390px, calc(100% - 32px)); padding: 12px 20px; border: 2px solid #df5267; border-radius: 12px; color: #fff; background: #17243cf2; box-shadow: 0 8px 24px #111b2d66; pointer-events: none; transform: translate(-50%, -50%); }
.hero-alert[hidden] { display: none; }
.hero-alert img { flex: 0 0 72px; width: 72px; height: 72px; object-fit: contain; }
.hero-alert div { min-width: 0; }
.hero-alert span { display: block; font-size: 13px; font-weight: 700; }
.hero-alert strong { display: block; color: #ff8c9b; font-family: NexonKart, LINESeedKR, sans-serif; font-size: clamp(24px, 3.8vw, 38px); line-height: 1.2; }
.hero-alert.is-entering { animation: hero-alert-enter 320ms cubic-bezier(.16, 1, .3, 1) both; }
@keyframes hero-alert-enter { from { opacity: 0; transform: translate(-50%, -50%) scale(1.08); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
@media (max-height: 420px) { .hero-alert { gap: 8px; padding: 7px 12px; } .hero-alert img { flex-basis: 48px; width: 48px; height: 48px; } }
@media (prefers-reduced-motion: reduce) { .hero-alert.is-entering { animation: none; } }
