/* GRAYLINE v0.5.0: Field Systems and Human Readability */
:root {
  --v050-text-min: calc(10px * var(--ui-text-scale, 1));
  --v050-text-small: calc(11px * var(--ui-text-scale, 1));
  --v050-text-body: calc(12px * var(--ui-text-scale, 1));
  --v050-text-label: calc(12px * var(--ui-text-scale, 1));
  --v050-secondary: #9a9a9a;
  --v050-muted: #838383;
  --v050-quiet: #747474;
  --v050-line: #353535;
}

/* Human-readable minimums. Important information is never 6 to 8 pixels again. */
.command-context-copy small,
.command-button .command-copy small,
.command-button .command-cost,
.command-tooltip span,
.command-tooltip small,
.selection-stats small,
.selection-stats span,
.selection-subtitle,
.queue-label small,
.queue-item small,
.tactical-overview small,
.overview-card small,
.overview-card span,
.resource-item small,
.resource-time small,
.resource-item em,
#supplyFlowDetail,
.minimap-meta,
.event-rail-head,
.event-rail-head button,
.toast small,
.toast p,
.logistics-strip small,
.objective-list small,
.settings-section .setting-row small,
.settings-panel > header small,
.setting-help,
.input-reference span,
.strategic-sidebar,
.strategic-legend,
.bookmark-list button,
.strategic-sidebar button,
.rando-summary,
.map-card small,
.title-foot,
.hud-kicker {
  font-size: var(--v050-text-min) !important;
  line-height: 1.35;
}

.command-button .command-copy strong,
.command-button > span:not(.command-icon):not(.command-cost),
.command-context-copy strong,
.selection-title,
.queue-label strong,
.resource-item strong,
.logistics-strip strong,
.objective-list strong,
.toast strong,
.settings-section .setting-row strong,
.settings-nav button,
.command-tabs button,
.command-page-tools button,
.command-page-tools span {
  font-size: var(--v050-text-small) !important;
  line-height: 1.25;
}

.command-context-copy small,
.command-button .command-copy small,
.command-tooltip span,
.command-tooltip small,
.selection-subtitle,
.selection-stats small,
.selection-stats span,
.queue-label small,
.queue-item small,
.tactical-overview small,
.overview-card small,
.overview-card span,
.resource-item small,
.resource-time small,
.resource-item em,
#supplyFlowDetail,
.minimap-meta,
.logistics-strip small,
.objective-list small,
.settings-panel > header small,
.settings-section .setting-row small,
.setting-help,
.input-reference span,
.strategic-sidebar,
.strategic-legend,
.rando-summary,
.map-card small {
  color: var(--v050-secondary) !important;
}

.command-button:disabled .command-copy strong,
.command-button[aria-disabled="true"] .command-copy strong,
.command-button:disabled .command-cost,
.command-button[aria-disabled="true"] .command-cost {
  color: #868686 !important;
}

.command-button:disabled .command-copy small,
.command-button[aria-disabled="true"] .command-copy small {
  color: #777 !important;
}

.command-button,
.command-tabs button,
.command-page-tools button,
.queue-item button,
.minimap-tools button,
.overlay-actions button,
.title-actions button {
  min-height: 34px;
}

.command-button {
  padding: 7px 8px !important;
  gap: 7px !important;
  border-color: var(--v050-line) !important;
}

.command-button:hover:not(:disabled),
.command-button:focus-visible:not(:disabled) {
  border-color: #b8b8b8 !important;
  background: #101010 !important;
}

.command-button .command-icon {
  min-width: 25px;
  font-size: calc(18px * var(--ui-text-scale, 1)) !important;
}

.command-tooltip {
  max-width: min(390px, 82vw) !important;
  padding: 11px 12px !important;
  border-color: #555 !important;
  background: rgba(0,0,0,.97) !important;
}
.command-tooltip strong { font-size: var(--v050-text-label) !important; }
.command-tooltip span,
.command-tooltip small { color: #b0b0b0 !important; }

/* Context and selection text remain legible against every battlefield state. */
.command-context-bar,
.selection-copy,
.resource-panel,
.logistics-strip,
.event-rail,
.objective-panel,
.minimap-panel {
  text-shadow: 0 1px 2px #000, 0 0 5px #000;
}

.selection-stats {
  gap: 5px 12px !important;
}
.selection-stats > * {
  min-height: 20px;
}

/* Contextual containment feedback. */
.command-button[data-command-label="LOAD TRANSPORT"],
.command-button[data-command-label="GARRISON"],
.command-button[data-command-label="EMP BURST"],
.command-button[data-command-label="AURA ON"],
.command-button[data-command-label="AURA OFF"] {
  border-style: double;
}

/* Command Index is retained only as a low-priority reference inside the manual. */
#commandIndexButton,
#titleCommandIndexButton,
#pauseCommandIndexButton {
  display: none !important;
}

/* Settings remain readable at all supported sizes. */
.settings-dialog .settings-layout,
.settings-dialog .settings-content,
.settings-panel,
.settings-fields {
  min-width: 0;
}
.settings-section .setting-row {
  min-height: 48px;
  gap: 10px;
}
.settings-section .setting-row > span {
  color: #d0d0d0 !important;
  font-size: var(--v050-text-body) !important;
}
.settings-section select,
.settings-section input[type="number"],
.settings-section input[type="search"],
.settings-section input[type="text"] {
  min-width: 0 !important;
  width: 100% !important;
  font-size: var(--v050-text-body) !important;
}
.settings-section output {
  color: #fff;
  font-size: var(--v050-text-small);
}
.settings-note {
  color: #969696 !important;
  font-size: var(--v050-text-min) !important;
}

/* Strategic map and compact screens provide visible continuation. */
.strategic-sidebar {
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #777 #090909;
}
.strategic-sidebar::after {
  content: "SCROLL FOR MORE";
  display: block;
  padding: 12px 0 4px;
  color: #888;
  font-size: var(--v050-text-min);
  letter-spacing: .12em;
}

/* Event rail warnings are clearly distinct and readable. */
.event-rail-head {
  color: #aaa !important;
}
.event-rail-head button {
  color: #b0b0b0 !important;
  border-color: #454545 !important;
}
.toast {
  border-color: #3d3d3d !important;
  background: rgba(0,0,0,.95) !important;
}
.toast p,
.toast small { color: #a5a5a5 !important; }
.toast-critical { border-color: #e4e4e4 !important; }

/* Tactical overview labels no longer clip silently. */
.overview-card,
.tactical-overview > * {
  min-width: 0;
}
.overview-card strong,
.overview-card small,
.overview-card span {
  overflow-wrap: anywhere;
  white-space: normal !important;
}

/* Clear upgrade and branch identity. */
.command-button[data-v050="true"]::after {
  content: "";
  position: absolute;
  right: 4px;
  top: 4px;
  width: 4px;
  height: 4px;
  border: 1px solid #aaa;
  opacity: .7;
}
.command-button[data-v050="true"] { position: relative; }

/* Stronger large-scale HUD values without expanding the whole interface. */
.resource-item strong,
.resource-time strong {
  color: #fff !important;
  font-size: calc(14px * var(--ui-text-scale, 1)) !important;
}
#supplyFlowDetail,
#powerDetail {
  color: #989898 !important;
}

/* User scale now meaningfully affects every major text family. */
html {
  font-size: calc(16px * var(--ui-text-scale, 1));
}

@media (max-width: 1366px), (max-height: 780px) {
  :root {
    --v050-text-min: calc(9px * var(--ui-text-scale, 1));
    --v050-text-small: calc(10px * var(--ui-text-scale, 1));
    --v050-text-body: calc(11px * var(--ui-text-scale, 1));
    --v050-text-label: calc(11px * var(--ui-text-scale, 1));
  }
  .command-button { padding: 5px 6px !important; }
  .command-button .command-icon { min-width: 22px; }
}

@media (max-width: 1100px), (max-height: 680px) {
  .settings-fields.two-column,
  .settings-section-grid {
    grid-template-columns: 1fr !important;
  }
  .settings-section .setting-row { min-height: 44px; }
}
