/* Raster console materials. Nine-slice edges retain their width at every size.
   Important declarations live in one layer so old theme rules cannot restore
   flat outline buttons or the previous brass picture frames. Geometry is kept
   in command-ui.css; this layer owns only materials and interaction states. */
@layer consoleSkin {
  :root {
    --console-normal: url('assets/console-button-normal-v2.webp');
    --console-hover: url('assets/console-button-hover-v2.webp');
    --console-selected: url('assets/console-button-selected-v2.webp');
    --console-disabled: url('assets/console-button-disabled-v2.webp');
    --console-enamel: url('assets/console-enamel-v2.webp');
  }

  button {
    --console-surface: var(--console-normal);
    --console-edge: 6px;
    border-image: var(--console-surface) 48 fill / var(--console-edge) / 0 stretch !important;
    border-color: transparent !important;
    border-style: solid !important;
    border-radius: 0 !important;
    background: #182019 !important;
    box-shadow: 0 2px 3px #0009 !important;
    color: #d5d9c9;
    text-shadow: 0 1px 2px #000d;
    transition: color 90ms ease, filter 90ms ease !important;
    transform: none !important;
  }

  button:hover:not(:disabled), button:focus-visible {
    --console-surface: var(--console-hover);
    color: #f0ead4 !important;
    outline: 0 !important;
  }

  button.active, button.active:hover, button[aria-checked='true']:hover,
  button[aria-selected='true']:hover, button[aria-pressed='true']:hover,
  button[aria-checked='true'], button[aria-selected='true'],
  button[aria-pressed='true'], button:active:not(:disabled) {
    --console-surface: var(--console-selected);
    color: #f3deb0 !important;
  }

  button:active:not(:disabled) {
    box-shadow: 0 1px 1px #0008 !important;
  }

  button:focus-visible { filter: brightness(1.12) !important; }

  button:disabled {
    --console-surface: var(--console-disabled);
    cursor: default;
    opacity: 1 !important;
    filter: none !important;
    color: #8b9386 !important;
  }

  #start-button, #prepare-button, .coupon-entry button, #guide-ack,
  #growth-toggle.has-choice, .doctrine-upgrade.available, .doctrine-upgrade.chosen {
    --console-surface: var(--console-selected);
    color: #f0dfb7 !important;
  }

  #topbar, #command-panel, #production-sidebar {
    background: #19201a var(--console-enamel) repeat !important;
    background-size: 192px 192px !important;
  }

  #topbar {
    border-bottom: 0 !important;
    box-shadow: inset 0 -2px 2px #050805, 0 3px 8px #0009 !important;
  }

  #topbar > button { --console-edge: 5px; }
  #topbar #menu-button { --console-edge: 7px; }
  #topbar #growth-toggle.has-choice { animation: none !important; }

  #growth-badge:not(:empty) {
    background: #151a13 !important;
    color: #e9c782 !important;
    box-shadow: inset 0 1px 2px #000a;
  }

  #production-sidebar {
    border-image: none !important;
    border-left-color: #080d09 !important;
    box-shadow: inset 2px 0 3px #4b524033, inset 4px 0 7px #000a, -3px 0 9px #0008 !important;
  }

  #command-panel {
    border-top-color: #111710 !important;
    box-shadow: inset 0 2px 2px #69745a55, 0 -3px 8px #0008 !important;
  }

  #command-panel > section { border-right-color: #111810 !important; }
  #production-tabs button { --console-edge: 6px; }

  #production-sidebar .production-card {
    --console-edge: 5px;
    opacity: 1 !important;
    filter: none !important;
    box-shadow: 0 2px 4px #000a !important;
  }

  #production-sidebar .production-card.locked { --console-surface: var(--console-disabled); }
  #production-sidebar .production-card.locked .sprite-icon { filter: grayscale(.65) brightness(.58) !important; }
  #production-sidebar .production-card.locked:hover:not(:disabled) { --console-surface: var(--console-hover); }
  #production-sidebar .production-card:disabled { --console-surface: var(--console-disabled); }
  #production-sidebar .production-card.complete .sprite-icon { filter: brightness(.85) !important; }
  #production-sidebar .production-card b { color: #d9ddcc !important; }
  #production-sidebar .production-card .cost-line { color: #d5bc85 !important; }
  #production-sidebar .production-card.unaffordable .cost-line { color: #c99173 !important; }

  #production-sidebar .production-card .lock {
    background: linear-gradient(90deg, #10180d00, #10180ee8 12%, #10180ee8 88%, #10180d00) !important;
    color: #c1c8aa !important;
    border: 0 !important;
  }

  .card-details {
    background: #10170ef0 !important;
    color: #e2e3cd !important;
    text-shadow: 0 1px 2px #000;
  }

  #unit-orders button { --console-edge: 5px; }
  #unit-orders button .order-art { inset: 2px !important; width: auto !important; height: auto !important; }
  #unit-orders button:disabled .order-art { filter: grayscale(.8) brightness(.42) !important; }
  #unit-orders button > span:last-child {
    height: 17px !important;
    line-height: 17px !important;
    background: linear-gradient(#0b110add, #080d08) !important;
  }

  #unit-orders button b { color: #e6ce99 !important; background: #0b100bc9 !important; }
  .selection-icons button { --console-edge: 3px; }
  .minimap-controls button { --console-edge: 4px; }
  #growth-close, #doctrine-back, #intel-close { --console-edge: 5px; }

  #modal > .dialog, #growth, #tutorial, #right-panel {
    border-image: var(--console-normal) 48 fill / 11px / 0 stretch !important;
    background: #131b14 !important;
  }

  #minimap, .selection-info .portrait {
    border-image: var(--console-disabled) 48 / 5px / 0 stretch !important;
  }

  .system-nav > button, .main-actions > button, .pause-menu button,
  .deployment-difficulty button, .result-actions button, .coop-room-actions button {
    --console-edge: 7px;
  }

  .main-actions > button { padding-left: 27px !important; }
  .system-nav > button { color: #c3cbb9 !important; }
  .system-nav > button.active { color: #f3dfaf !important; }
  .doctrine-upgrade.locked, .doctrine-branch:disabled { --console-surface: var(--console-disabled); }
  .game-toggle { border: 0 !important; background: #0c130c !important; box-shadow: inset 0 2px 5px #000c !important; }
  .game-toggle button { --console-edge: 4px; }

  input:not([type='range']):not([type='checkbox']), select {
    border-image: var(--console-disabled) 48 fill / 5px / 0 stretch !important;
    border-color: transparent !important;
    background-color: #141b14 !important;
    color: #d7decb !important;
    box-shadow: inset 0 2px 4px #0009 !important;
  }
}
