/* The coach floats over the battlefield and can collapse to a small tab. */
.tutorial {
  bottom: 40px; left: 16px; width: 316px; max-width: calc(100% - 32px);
  max-height: 206px; padding: 11px 27px 11px 11px; gap: 10px;
  background: linear-gradient(125deg, #34373cf5, #24272df5);
  border: 1px solid #b8a173; border-left: 3px solid #f2ce78;
  box-shadow: 0 5px 20px #0005, inset 0 1px #ffffff12;
  align-items: flex-start; overflow: auto;
}
.tutorial-num { color: #f2ce78; font: 20px/24px monospace; padding-top: 16px; }
.coach-content { min-width: 0; flex: 1; }
.coach-heading { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 4px; color: #d2b981; font-size: 9px; letter-spacing: 1px; }
.coach-heading small { font: 10px monospace; white-space: nowrap; color: #d9d6cf; letter-spacing: 0; }
.tutorial strong { display: block; font-size: 13px; line-height: 18px; color: #fff1d1; font-weight: 600; }
.tutorial p { margin: 6px 0 8px; font-size: 11px; line-height: 18px; color: #d6d6d5; }
.coach-progress { height: 3px; background: #181b1f; margin: 8px 0 9px; }
.coach-progress i { display: block; height: 100%; background: #edc478; transition: width .25s; }
.coach-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tutorial .coach-actions button { position: static; min-height: 28px; padding: 5px 8px; border: 1px solid #ad956c; background: linear-gradient(#585044, #403c36); color: #ffedc8; font-size: 10px; text-align: left; }
.coach-actions small { color: #aebbc9; font-size: 9px; line-height: 14px; }
.tutorial .coach-dismiss { top: 5px; right: 5px; width: 22px; height: 22px; min-width: 22px; min-height: 22px; padding: 0; font-size: 16px; line-height: 20px; color: #c9c8c4; border: 0; background: transparent; }
.coach-dismiss:hover { color: #fff3db; background: #ffffff12; }
.coach-complete { border-left-color: #a9d5ff; }
.coach-complete .coach-progress i { background: #a9d5ff; }
.coach-combat { border-left-color: #e6ad79; }
.coach-combat .coach-heading { color: #e5ba92; }
.tutorial .coach-actions .coach-secondary { padding: 4px 6px; min-height: 26px; background: #292c31; border-color: #696b6e; color: #c2c6cb; font-size: 9px; }
.tutorial .coach-actions button:disabled { opacity: .55; cursor: default; }
.coach-reopen { position: absolute; z-index: 8; left: 16px; bottom: 40px; padding: 7px 10px; font-size: 10px; color: #ead9b9; border: 1px solid #8f8066; background: #2a2d32ed; box-shadow: 0 2px 8px #0004; }
.coach-focus { outline: 2px solid #ffe29b !important; outline-offset: -2px; box-shadow: inset 0 0 16px #f5cc632c, 0 0 7px #f5cc6333 !important; }
.command-sidebar .catalog-card:is(.card-ready:not([data-production-state]), [data-production-state="ready"]) {
  border-color: #f3d184; box-shadow: inset 0 0 0 1px #f3d18455;
}
.catalog-card:is(.card-ready:not([data-production-state]), [data-production-state="ready"]) .card-bottom { background: #574a30; color: #fff0c9; }
.catalog-card[data-production-state="plan"] .card-bottom { background: #293b4a; color: #d9eeff; }
.catalog-card .progress { height: 3px; z-index: 2; pointer-events: none; }
.catalog-tooltip { font-size: 11px; line-height: 18px; box-shadow: 0 6px 24px #0009; }
.command-sidebar #selection-panel .selection-meta { font-size: 10px; line-height: 15px; color: #d8d9dc; }
.unit-commands button { transition: background-color .12s, border-color .12s; }
button:active:not(:disabled) { filter: brightness(.94); }
.top-actions button:active:not(:disabled), .sidebar-actions button:active:not(:disabled) { transform: translateY(1px); }

.training-entry { display: flex; gap: 14px; align-items: center; padding: 12px; margin: 14px 0 12px; background: linear-gradient(110deg, #4e403033, #2c3139); border: 1px solid #8d7957; border-left: 3px solid #e4bd79; }
.training-entry > div { min-width: 0; flex: 1; }
.training-entry strong { font-size: 12px; font-weight: 550; color: #f8deb4; }
.training-entry p { color: #bfc3cb; font-size: 10px; line-height: 17px; margin: 5px 0 0; }
.training-entry button { flex-shrink: 0; min-height: 38px; padding: 8px 12px; background: linear-gradient(#5c5140, #3c3b39); border: 1px solid #bca479; color: #ffe6b8; font-size: 11px; }
.training-entry button span { margin-left: 8px; }
.training-save-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; padding: 9px 10px; border: 1px solid #66655e; color: #c5c3ba; font-size: 10px; }
.training-save-row button { border: 0; background: transparent; color: #f3d299; padding: 4px; font-size: 10px; white-space: nowrap; }
.training-save-row > span { margin-right: auto; }
.training-save-row #restart-training { color: #afb4be; font-size: 9px; }
.launch-overlay { align-items: safe center; }
.launch-panel { padding-top: 12px; padding-bottom: 12px; }

@media (max-height: 820px) {
  .launch-overlay { padding-top: 22px; padding-bottom: 22px; align-items: flex-start; }
  .launch-panel { padding-top: 0; padding-bottom: 0; }
  .launch-kicker { margin-bottom: 10px; }
  .launch-title { font-size: 32px; line-height: 1.1; letter-spacing: 4px; }
  .launch-title > span { display: inline; font-size: 32px; letter-spacing: 4px; margin-left: 10px; }
  .launch-title > small { margin-top: 10px; font-size: 8px; letter-spacing: 2.5px; }
  .launch-description { margin: 12px 0; font-size: 10px; line-height: 17px; }
  .training-entry { margin: 10px 0 12px; padding: 10px; }
  .training-entry p { margin-top: 4px; font-size: 9px; line-height: 15px; }
  .map-briefing { padding: 10px 12px; margin-bottom: 12px; }
  .map-briefing select { padding: 7px 8px; font-size: 11px; }
  .map-briefing p { font-size: 9px; margin-top: 5px; }
  .field-label { margin-bottom: 8px; font-size: 10px; }
  .faction-option { display: grid; grid-template-columns: 23px 1fr; grid-template-rows: 20px 14px; column-gap: 8px; row-gap: 1px; align-content: center; height: 66px; padding: 9px 12px; }
  .faction-option .flag { grid-row: 1 / 3; align-self: center; font-size: 18px; line-height: 22px; margin: 0; }
  .faction-option strong { font-size: 12px; line-height: 18px; margin: 0; }
  .faction-option small { grid-column: 2; font-size: 8px; line-height: 14px; }
  .faction-description { margin: 7px 0 10px; min-height: 0; font-size: 10px; line-height: 16px; }
  .settings-row { margin: 8px 0; font-size: 10px; }
  .settings-row select { padding: 6px 8px; font-size: 10px; }
  .mode-description { margin: 5px 0 10px; font-size: 9px; line-height: 15px; }
  .deploy-button { padding: 12px 16px; }
  .deploy-button > span:first-child { font-size: 14px; }
  .deploy-button > span:last-child { font-size: 9px; }
  .save-actions .resume-button { padding: 9px 7px; }
  .save-summary { margin-top: 7px; font-size: 8px; line-height: 15px; }
  .launch-bottom { margin-top: 12px; }
}

@media (max-width: 580px) {
  .tutorial { left: 8px; bottom: 36px; max-width: calc(100% - 16px); width: 280px; padding: 8px 24px 8px 9px; gap: 7px; }
  .tutorial-num { display: none; }
  .tutorial strong { font-size: 12px; }
  .tutorial p { font-size: 10px; line-height: 16px; }
  .coach-reopen { left: 8px; bottom: 36px; }
  .training-entry { gap: 8px; padding: 10px; }
  .training-entry button { padding: 8px; }
  .training-entry button span { display: none; }
  .faction-option { grid-template-columns: minmax(0, 1fr); padding: 8px; }
  .faction-option .flag { display: none; }
  .faction-option small { grid-column: 1; }
}
@media (max-height: 650px) {
  .launch-overlay { align-items: flex-start; padding-top: 18px; padding-bottom: 18px; }
  .tutorial { max-height: 180px; bottom: 34px; }
}
@media (prefers-reduced-motion: reduce) {
  .coach-progress i, .unit-commands button { transition: none; }
}

/* Operational detail occupies the existing selected-unit area only. */
#selection-panel .selection-runtime { display: block; margin-top: 3px; color: #c4dbed; font-size: 9px; line-height: 14px; overflow-wrap: anywhere; }
#selection-panel .selection-runtime.operation-warning { color: #f4bd83; }
#selection-panel .selection-runtime.hidden { display: none; }
#selection-panel [data-order="return-air"] { border-color: #829ab0; color: #d4e7f6; }
#selection-panel [data-order="return-air"]:disabled { opacity: .5; cursor: default; }
.air-production-note { display: block; padding: 0 5px 4px; color: #c6d2df; font-size: 8px; line-height: 12px; text-align: left; }
.catalog-card:has(.air-production-note) { height: 92px; }
.catalog-card .card-bottom { gap: 3px; min-width: 0; }
.catalog-card .card-bottom > span { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.catalog-card .card-bottom > small { flex: none; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* A bounded, factual debrief is shown only after the match ends. */
.result-panel { width: min(640px, 100%); max-height: calc(100vh - 48px); overflow-y: auto; padding: 25px 28px; text-align: left; }
.result-panel > .eyebrow, .result-panel > h2, .result-panel > p { display: block; text-align: center; }
.result-panel h2 { font-size: 30px; margin: 15px 0 10px; letter-spacing: 4px; }
.result-panel #result-stats { display: block; margin: 18px 0 12px; }
.battle-report-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.battle-report-summary > div { padding: 9px 6px; border: 1px solid #848b9555; background: #22262b80; text-align: center; }
.battle-report-summary strong { font-size: 20px; }
.battle-report-summary small { margin-top: 5px; }
.battle-report-scope, .battle-report-totals { color: #c1c5cd; font-size: 10px; line-height: 17px; margin: 10px 0; }
.battle-report-scope { color: #e2c89e; }
.battle-report-events, .battle-report-insights { border-top: 1px solid #777e8855; padding-top: 10px; margin-top: 12px; }
.battle-report-events h3, .battle-report-insights h3 { margin: 0 0 9px; font-size: 12px; font-weight: 500; color: #f0d7ae; }
.battle-report-events ol, .battle-report-insights ul { list-style: none; padding: 0; margin: 0; }
.battle-report-events li { display: flex; gap: 10px; margin: 8px 0; }
.battle-report-events time { flex: 0 0 37px; font: 10px/17px monospace; color: #c2d5e6; }
.battle-report-events li strong { font-size: 11px; font-weight: 500; color: #e5e6e6; }
.battle-report-events p, .battle-report-empty { margin: 3px 0 0; font-size: 10px; line-height: 17px; color: #bfc3ca; }
.battle-report-insights li { display: flex; align-items: flex-start; gap: 8px; margin: 8px 0; font-size: 10px; line-height: 17px; color: #d4d6da; }
.battle-report-insights li small { display: inline-block; flex: 0 0 auto; padding: 0 5px; margin: 0; color: #e8d1a7; font-size: 9px; border: 1px solid #9c8b6a66; }
.result-panel .deploy-button { width: 100%; margin-top: 14px; }
@media (max-width: 580px) {
  .air-production-note { grid-column: 1 / -1; padding-bottom: 3px; }
  .result-panel { padding: 19px 17px; }
  .battle-report-summary { gap: 5px; }
  .battle-report-summary strong { font-size: 17px; }
  #selection-panel .selection-runtime { font-size: 8px; line-height: 12px; }
}
@media (max-height: 650px) { .result-panel { padding-top: 17px; padding-bottom: 17px; } }

/* Display density changes text and vertical rhythm, never battlefield width. */
.sidebar-display { display: flex; align-items: center; gap: 5px; }
#hud-density { padding: 2px 5px; min-height: 24px; background: #343840; border: 1px solid #747c89; color: #eee3ca; font-size: 11px; line-height: 16px; }
#hud-density:hover { background: #4a4f59; border-color: #dfbd83; }
body[data-ui-density="clear"] .resource small { font-size: 11px; }
body[data-ui-density="clear"] .top-actions .icon-btn { min-width: 28px; height: 28px; }
body[data-ui-density="clear"] .sidebar-heading { height: 32px; min-height: 32px; }
body[data-ui-density="clear"] .sidebar-heading h2 { font-size: 12px; }
body[data-ui-density="clear"] .intel-row { font-size: 11px; line-height: 16px; min-height: 24px; gap: 7px; }
body[data-ui-density="clear"] .sidebar-actions button,
body[data-ui-density="clear"] .command-sidebar #mouse-mode { min-height: 32px; font-size: 11px; padding: 4px 2px; }
body[data-ui-density="clear"] .production-tabs button { min-height: 32px; font-size: 12px; padding: 6px 0; }
body[data-ui-density="clear"] .catalog { grid-auto-rows: minmax(96px, max-content); }
body[data-ui-density="clear"] .catalog.research-catalog { grid-template-rows: 96px 96px auto 32px; }
body[data-ui-density="clear"] .catalog-card { height: 96px; min-height: 96px; }
body[data-ui-density="clear"] .catalog-card .card-art { height: 40px !important; min-height: 40px; flex-basis: 40px; }
body[data-ui-density="clear"] .catalog-card .card-name {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  height: 30px; margin-top: 3px; margin-bottom: 2px; font-size: 11px; line-height: 15px;
  white-space: normal; overflow-wrap: anywhere;
}
body[data-ui-density="clear"] .card-bottom { font-size: 11px; line-height: 16px; padding-bottom: 3px; }
body[data-ui-density="clear"] .card-bottom small { font-size: 10px; }
body[data-ui-density="clear"] .catalog-card:has(.air-production-note) { height: 112px; min-height: 112px; }
body[data-ui-density="clear"] .air-production-note { font-size: 10px; line-height: 14px; padding-bottom: 4px; }
body[data-ui-density="clear"] #queue-drawer > summary,
body[data-ui-density="clear"] #camera-drawer > summary { min-height: 32px; font-size: 11px; line-height: 20px; }
body[data-ui-density="clear"] #queue-count,
body[data-ui-density="clear"] #queue-summary { font-size: 11px; }
#queue-drawer > summary { overflow: hidden; text-overflow: ellipsis; }
body[data-ui-density="clear"] .queue-label,
body[data-ui-density="clear"] .queue-job-status,
body[data-ui-density="clear"] .queue-placeholder { font-size: 11px; line-height: 17px; }
body[data-ui-density="clear"] .camera-tools button,
body[data-ui-density="clear"] .camera-tools .view-tools button { height: 32px; font-size: 11px; }
body[data-ui-density="clear"] #selection-panel .selection-info h3 { font-size: 12px; line-height: 18px; margin-bottom: 5px; }
body[data-ui-density="clear"] .command-sidebar #selection-panel .selection-meta,
body[data-ui-density="clear"] #selection-panel .selection-runtime { font-size: 11px; line-height: 17px; }
#selection-panel .unit-commands { grid-template-columns: repeat(2, minmax(0, 1fr)); }
body[data-ui-density="clear"] #selection-panel .unit-commands button { min-height: 32px; height: 32px; font-size: 11px; line-height: 18px; gap: 4px; }
body[data-ui-density="clear"] #selection-panel .unit-commands button b { font-size: 10px; }
#selection-panel .selection-details { border-top: 1px solid #77808d66; margin-top: 4px; min-width: 0; }
#selection-panel .selection-details summary { cursor: pointer; padding: 6px 2px; font-size: 11px; line-height: 18px; color: #e2c696; }
#selection-panel .selection-detail-text { display: block; margin: 2px 0 6px; max-height: 180px; overflow-y: auto; font-size: 11px; line-height: 18px; white-space: pre-line; overflow-wrap: anywhere; color: #c9d0da; }
body[data-ui-density="clear"] .research-level { font-size: 10px; }
body[data-ui-density="clear"] .research-inline-rule { font-size: 11px; line-height: 17px; }
body[data-ui-density="clear"] .research-explainer { height: 32px; font-size: 11px; }
body[data-ui-density="clear"] .sidebar-footer { height: 26px; flex-basis: 26px; font-size: 10px; }
body[data-ui-density="clear"] .sidebar-footer button { font-size: 11px; }

/* Only the debrief body scrolls; both next actions remain on screen. */
.result-panel { display: flex; flex-direction: column; width: min(640px, 100%); height: min(760px, calc(100dvh - 48px)); max-height: calc(100dvh - 48px); padding: 0; overflow: hidden; }
.result-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 24px 28px 16px; scrollbar-width: thin; }
.result-scroll > .eyebrow, .result-scroll > h2, .result-scroll > p { display: block; text-align: center; }
.result-scroll > p { color: #c7cbd2; font-size: 12px; line-height: 19px; }
.result-scroll:focus-visible { outline: 2px solid #f0cf90; outline-offset: -3px; }
.result-panel #result-stats { margin-bottom: 0; }
.result-actions { display: grid; grid-template-columns: 1.25fr 1fr; flex: 0 0 auto; gap: 10px; padding: 14px 20px; border-top: 1px solid #858b9555; background: #292d34; }
.result-actions .deploy-button, .result-actions .resume-button { margin: 0; min-height: 44px; width: 100%; padding: 11px 13px; font-size: 12px; }
.result-actions .deploy-button > span:first-child { font-size: 13px; }
.battle-report-summary small, .battle-report-scope, .battle-report-totals,
.battle-report-events p, .battle-report-empty, .battle-report-insights li { font-size: 12px; line-height: 19px; }
.battle-report-events time { font-size: 11px; line-height: 19px; }
.battle-report-events li strong { font-size: 12px; }

.command-style-picker { margin: 12px 0 14px; padding: 0; border: 0; min-width: 0; }
.command-style-picker legend { margin-bottom: 7px; color: #e5d4b5; font-size: 12px; }
.command-style-picker legend span { margin-left: 8px; font-size: 11px; color: #acb3bf; }
.command-style-picker > div { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.command-style-picker label { display: flex; gap: 7px; align-items: flex-start; padding: 8px; border: 1px solid #717987; background: #2b3039; cursor: pointer; }
.command-style-picker label:has(input:checked) { border-color: #e2bc7b; background: #4b4336; }
.command-style-picker input { margin: 3px 0 0; accent-color: #e5bc7b; }
.command-style-picker strong { display: block; font-size: 12px; font-weight: 550; color: #f3e2c6; }
.command-style-picker small { display: block; margin-top: 4px; font-size: 11px; line-height: 16px; color: #c5cbd3; }
.interface-settings { margin-bottom: 22px; }
.interface-settings h3 { font-size: 14px; color: #f2d5a7; }
.interface-option { display: flex; justify-content: space-between; gap: 14px; align-items: center; margin: 14px 0; font-size: 12px; }
.interface-option small { display: block; margin-top: 4px; font-size: 11px; color: #aeb8c7; }
.interface-option select { max-width: 58%; padding: 7px; border: 1px solid #7c8797; background: #252a33; font-size: 12px; }
.training-entry p { font-size: 11px; line-height: 18px; }
@media (max-width: 580px) {
  body[data-ui-density="clear"] .sidebar-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body[data-ui-density="clear"] .catalog { grid-template-columns: minmax(0, 1fr); grid-auto-rows: minmax(82px, max-content); }
  body[data-ui-density="clear"] .catalog.research-catalog { grid-template-rows: none; }
  body[data-ui-density="clear"] .catalog-card .card-name { -webkit-line-clamp: 1; height: 16px; }
  body[data-ui-density="clear"] .catalog-card { height: 82px; min-height: 82px; }
  body[data-ui-density="clear"] .catalog-card:has(.air-production-note) { height: 98px; min-height: 98px; }
  .result-scroll { padding: 18px 16px 12px; }
  .result-actions { padding: 11px; gap: 7px; }
  .result-actions .deploy-button, .result-actions .resume-button { padding: 9px; font-size: 11px; }
  .command-style-picker > div { gap: 6px; }
  .command-style-picker label { padding: 7px 5px; gap: 5px; }
  .interface-option { align-items: flex-start; }
}
@media (max-height: 440px) {
  .result-panel { height: calc(100dvh - 24px); max-height: calc(100dvh - 24px); }
  .result-actions { padding-top: 8px; padding-bottom: 8px; }
}
.launch-bottom { flex-wrap: wrap; gap: 10px; }
.launch-bottom #retry-art { padding: 2px 6px; border: 1px solid #8d826c; color: #ebcc9c; font-size: 11px; }
.launch-bottom #retry-art:disabled { opacity: .4; }
.retry-art-feedback { font-size: 11px; color: #d7bf96; line-height: 18px; margin: 7px 0 0; }
.retry-art-feedback:empty { display: none; }
.production-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.production-tabs button { position: relative; min-height: 32px; padding: 4px 2px; font-size: 11px; }
.production-tabs button kbd { display: block; color: #c6c0b1; font-size: 9px; line-height: 11px; }
.production-tabs .secondary-production-tab { grid-column: 1 / -1; min-height: 23px; font-size: 10px; border-top: 1px solid #666c7355; }
@media (pointer: fine) {
  body[data-ui-density="clear"] .production-tabs .secondary-production-tab { min-height: 23px; padding: 2px 0; font-size: 10px; }
}
.queue-job-name[data-site-id] { cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.queue-job-name[data-site-id]:focus-visible { outline: 2px solid #e1bc7c; outline-offset: 2px; }
.coach-focus { animation: none !important; box-shadow: none !important; outline: 1px solid #d8b777; }
.performance-observation { margin-top: 18px; padding-top: 14px; border-top: 1px solid #737a8655; font-size: 12px; line-height: 19px; }
.performance-observation summary { min-height: 32px; color: #e7ce9d; cursor: pointer; }
.performance-observation h3 { margin: 12px 0 5px; font-size: 13px; }
.performance-observation p { color: #c4cad2; font-size: 11px; line-height: 18px; }
.performance-observation dl { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px 16px; margin: 12px 0; }
.performance-observation dt { color: #cbd1da; }
.performance-observation dd { margin: 0; color: #f3d6a3; }

/* Coarse-pointer targets only. Desktop command-deck width stays unchanged. */
.touch-control-note { display: none; }
@media (pointer: coarse) and (max-width: 900px) {
  .touch-control-note { display: block; margin: 8px 0 12px; color: #d4c8ac; font-size: 12px; line-height: 19px; }
  #battle, #minimap { touch-action: none; }
  .topbar { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "brand resources" "actions actions"; grid-template-rows: 32px 44px; height: 84px; flex-basis: 84px; gap: 2px 8px; padding: 3px 6px; }
  .topbar .brand { grid-area: brand; }
  .topbar .resource-cluster { grid-area: resources; justify-content: flex-end; }
  .topbar .top-actions { grid-area: actions; justify-content: flex-end; width: 100%; gap: 2px; }
  .top-actions .icon-btn { min-width: 44px; min-height: 44px; width: 44px; height: 44px; padding: 0; }
  .command-sidebar { overscroll-behavior: contain; }
  .sidebar-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sidebar-actions button, .command-sidebar #mouse-mode { min-height: 44px; height: auto; font-size: 11px; }
  .production-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); flex: none; }
  .production-tabs button { min-height: 44px; padding: 7px 3px; font-size: 11px; }
  body[data-ui-density="clear"] .production-tabs button { min-height: 44px; padding: 7px 3px; }
  .control-group-buttons { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .control-group-buttons button { min-height: 40px; height: 40px; }
  body #selection-panel .unit-commands button, body[data-ui-density="clear"] #selection-panel .unit-commands button { min-height: 44px; height: 44px; font-size: 11px; }
  .command-sidebar summary, .hud-density-toggle, .sidebar-footer button { min-height: 44px; display: flex; align-items: center; }
  .command-sidebar details > summary { display: list-item; padding-block: 11px; line-height: 22px; }
  body[data-ui-density="clear"] :is(#queue-drawer, #camera-drawer) > summary { min-height: 44px; }
  body[data-ui-density] .sidebar-footer { height: auto; min-height: 44px; flex-basis: 44px; }
  .command-sidebar .camera-tools button { min-height: 40px; }
  .queue-label button { min-width: 40px; min-height: 40px; }
  .selected-icons button { min-width: 40px; min-height: 40px; }
  .overlay button, .overlay select, .command-style-picker label { min-height: 44px; }
  .overlay summary { min-height: 44px; display: flex; align-items: center; }
  .modal-close { min-width: 44px; min-height: 44px; }
  .tutorial .coach-actions button, .tutorial .coach-dismiss, .coach-reopen { min-height: 44px; }
  .tutorial .coach-dismiss { min-width: 44px; width: 44px; height: 44px; }
  .tutorial { padding-right: 48px; }
}

/* Keep a complete production-card row visible on common desktop heights. */
@media (min-width: 901px) and (max-height: 820px) and (pointer: fine) {
  #selection-panel { max-height: 172px; overflow-y: auto; padding-top: 6px; padding-bottom: 6px; }
  body[data-ui-density="clear"] #selection-panel .selection-info h3 { margin-bottom: 2px; line-height: 16px; }
  body[data-ui-density="clear"] #selection-panel .selection-meta { font-size: 10px; line-height: 15px; }
  #selection-panel .selection-runtime:not(.operation-warning) { display: none; }
  #selection-panel .unit-commands [data-order="home"] { display: none; }
  body[data-ui-density="clear"] #selection-panel .unit-commands button { height: 28px; min-height: 28px; }
  #selection-panel .selection-details summary { padding: 3px 2px; line-height: 16px; font-size: 10px; }
  .command-sidebar .catalog { min-height: 100px; }
}
.skirmish-options {
  margin: 4px 0 10px;
  border: 1px solid #555b64;
  background: #242a32;
  color: #e7ddca;
  font-size: 11px;
}
.skirmish-options summary { padding: 6px 9px; cursor: pointer; }
.launch-overlay:has(.skirmish-options[open]) { align-items: flex-start; overflow-y: auto; }
.skirmish-options summary small { float: right; color: #c4b79d; font-size: 10px; }
.skirmish-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 9px; padding: 3px 9px; }
.skirmish-fields label { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.skirmish-fields select { min-width: 0; padding: 3px 2px; background: #191e25; border: 1px solid #676e79; }
.skirmish-fields .skirmish-check { justify-content: flex-start; min-height: 22px; }
.skirmish-fields input { accent-color: #dfc690; }
#skirmish-rule { margin: 4px 9px 7px; color: #c0c6d0; font-size: 10px; line-height: 1.45; }
.hotkey-settings summary { cursor: pointer; color: #eedcb4; }
.hotkey-settings p { color: #bcc5cf; font-size: 11px; }
.hotkey-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: 5px 12px; margin: 8px 0; }
.hotkey-grid label { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 11px; }
.hotkey-grid input { width: 42px; padding: 4px; text-align: center; color: #f4e3b8; background: #252c35; border: 1px solid #5c6876; }
#reset-hotkeys { padding: 5px 8px; color: #e2e5e8; background: #343e49; border: 1px solid #687584; }
.deployment-modes { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 6px; margin: 4px 0 8px; }
.deployment-modes button, .mode-modal button { padding: 7px 8px; border: 1px solid #6b7380; background: #292e38; color: #ece4d4; font-size: 11px; }
.deployment-modes button:hover, .mode-modal button:not(:disabled):hover { background: #434b57; }
.mode-modal { display: grid; gap: 10px; }
.mode-modal label { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.mode-modal select, .mode-modal input { min-width: 0; padding: 6px; background: #161d26; color: #f4eddd; border: 1px solid #707987; }
.mode-modal p { margin: 4px 0; color: #c7c9ce; line-height: 1.7; }
.mode-modal fieldset { min-width: 0; border: 1px solid #555e6b; margin: 0; padding: 9px; }
.mode-modal .campaign-list { display: grid; gap: 8px; }
.mode-modal .campaign-list button { text-align: left; display: grid; gap: 4px; width: 100%; }
.mode-modal .campaign-list button:disabled { opacity: .55; }
.mode-modal .campaign-list small { color: #c8c7c6; font-size: 11px; line-height: 1.5; }
.mode-modal .room-code { color: #f4d397; font: 600 20px monospace; letter-spacing: .12em; }
.mode-modal .room-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.campaign-objective,.online-indicator {
  position: absolute; top: 37px; left: 8px; max-width: calc(100% - 16px); z-index: 7;
  padding: 5px 8px; border: 1px solid #94876c; background: #24282eee; color: #f0deab; font-size: 11px;
}
.online-indicator { left: auto; right: 8px; color: #bcd9ed; border-color: #6d92ad; pointer-events: none; }
.special-support { display: grid; grid-template-columns: repeat(auto-fit,minmax(0,1fr)); gap: 4px; margin: 0 7px 4px; }
.special-support .production-support { margin: 0; padding: 4px 3px; min-height: 33px; display: grid; justify-content: stretch; gap: 2px; min-width: 0; }
.special-support .production-support small { margin: 0; font-size: 10px; }
.special-support .production-support span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.battle-layout { position: relative; }
.command-sidebar {
  position: absolute;
  inset: 6px 6px auto auto;
  height: min(620px, 82%);
  z-index: 15;
  width: min(235px, 48vw);
  border: 1px solid #6c727c;
  border-radius: 8px;
  box-shadow: 0 10px 28px #0007;
}
#entry-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 22px;
  background:
    radial-gradient(ellipse at 28% 25%, #574b35c0, transparent 58%),
    linear-gradient(135deg, #24242a, #151a1e);
}
#entry-screen[hidden], .entry-actions [hidden], #entry-progress[hidden] { display: none; }
.entry-card {
  width: min(100%, 460px);
  display: grid;
  gap: 18px;
  padding: clamp(20px, 4vw, 38px);
  border: 1px solid #907b54;
  border-radius: 10px;
  background: #292c30;
  color: #f5eddb;
  box-shadow: 0 16px 50px #0005;
}
.entry-card h1 { margin: 0; font-size: clamp(25px, 5vw, 37px); line-height: 1.3; }
#entry-status { min-height: 3em; margin: 0; color: #e8d5b6; line-height: 1.55; }
#entry-progress { width: 100%; height: 12px; accent-color: #d5ad6e; }
.entry-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.entry-actions button {
  min-height: 44px;
  padding: 8px 13px;
  border: 1px solid #a38d65;
  border-radius: 6px;
  background: #42403a;
  color: #f5eddb;
  font-size: 13px;
}
.entry-actions #enter-game:enabled { background: #e4bc82; color: #24201d; }
.entry-actions button:disabled { opacity: .6; cursor: default; }
.entry-actions a { color: #c6c9ce; padding: 8px 0; text-decoration: underline; }
@media (max-width: 580px) {
  .command-sidebar { width: min(220px, 62vw); }
}

.command-sidebar.panel-moved {
  inset: var(--panel-y) auto auto var(--panel-x);
  max-height: calc(100% - 12px);
}
.panel-toolbar {
  display: flex;
  flex: none;
  align-items: center;
  gap: 5px;
  padding: 3px 5px;
  background: #35343b;
  color: #eee1c7;
  border-bottom: 1px solid #78716a;
}
.panel-toolbar button { min-height: 27px; padding: 3px 6px; font-size: 11px; }
.panel-toolbar [data-panel-grip] {
  flex: 1;
  text-align: start;
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.panel-toolbar [data-panel-grip]:active { cursor: grabbing; }
.panel-toolbar [data-panel-reset]:disabled { opacity: .5; cursor: default; }
@media (pointer: coarse) { .panel-toolbar button { min-height: 36px; } }
