/* High-contrast modes — user preference (users.high_contrast), overrides the
   per-scenario palette on the game screen only. Scoped to :has(.game-screen)
   like the per-game theme block in games/show.html.erb; the extra body class
   outranks that block regardless of stylesheet order. */

body.hc-dark:has(.game-screen) {
  --theme-bg: #000000;
  --theme-text: #ffffff;
  --theme-accent: #ffd60a;
  --theme-bg-image: none;
  --panel-bg: #111111;
  --panel-header: #1a1a1a;
  --border-color: #777777;
  --border-subtle: #555555;
  --text-bright: #ffffff;
  --text-mid: #ffffff;
  --text-muted: #d0d0d0;
  --text-dim: #d0d0d0;
  --color-success: #4dd97a;
  --color-partial: #ffd60a;
  --color-failure: #ff6b6b;
  --color-failure-text: #ff6b6b;
  --color-heal: #4dd97a;
  --color-danger-text: #ff6b6b;
  --color-exit: #7fe0b0;
  --color-exit-hover: #a8f0cc;
  --color-exit-special: #ffd60a;
  --color-exit-special-hover: #ffe566;
}

body.hc-light:has(.game-screen) {
  --theme-bg: #ffffff;
  --theme-text: #000000;
  --theme-accent: #0047ab;
  --theme-bg-image: none;
  --panel-bg: #f2f2f2;
  --panel-header: #e8e8e8;
  --border-color: #888888;
  --border-subtle: #aaaaaa;
  --text-bright: #000000;
  --text-mid: #000000;
  --text-muted: #2a2a2a;
  --text-dim: #2a2a2a;
  --color-success: #0a6b32;
  --color-partial: #7a5800;
  --color-failure: #b00020;
  --color-failure-text: #b00020;
  --color-heal: #0a6b32;
  --color-danger-text: #b00020;
  --color-exit: #00584a;
  --color-exit-hover: #007a66;
  --color-exit-special: #6a4a00;
  --color-exit-special-hover: #8a6200;
}

/* Solid panels — the default 50%-transparent mixes stack with the background
   art and vignette, which is exactly the washed-out effect being fixed. */
body.hc-dark:has(.game-screen) .scene-panel,
body.hc-dark:has(.game-screen) .act-replay-panel,
body.hc-dark:has(.game-screen) .save-panel,
body.hc-light:has(.game-screen) .scene-panel,
body.hc-light:has(.game-screen) .act-replay-panel,
body.hc-light:has(.game-screen) .save-panel {
  background: var(--panel-bg);
  border-color: var(--border-color);
}

/* Opacity-based dimming is invisible to the variable overrides above — these
   selectors fade text with `opacity`, so they must be reset explicitly. */
body.hc-dark:has(.game-screen) .stat-label,
body.hc-light:has(.game-screen) .stat-label,
body.hc-dark:has(.game-screen) .act-header,
body.hc-light:has(.game-screen) .act-header,
body.hc-dark:has(.game-screen) .quest-hook-indicator,
body.hc-light:has(.game-screen) .quest-hook-indicator,
body.hc-dark:has(.game-screen) .action-prompt,
body.hc-light:has(.game-screen) .action-prompt,
body.hc-dark:has(.game-screen) .console-separator,
body.hc-light:has(.game-screen) .console-separator,
body.hc-dark:has(.game-screen) #inventory-panel .scene-panel-header h3,
body.hc-light:has(.game-screen) #inventory-panel .scene-panel-header h3,
body.hc-dark:has(.game-screen) .quest-panel-section .panel-section-header h3,
body.hc-light:has(.game-screen) .quest-panel-section .panel-section-header h3,
body.hc-dark:has(.game-screen) .panel-legal a,
body.hc-light:has(.game-screen) .panel-legal a,
body.hc-dark:has(.game-screen) .panel-legal span,
body.hc-light:has(.game-screen) .panel-legal span {
  opacity: 1;
}

/* Inactive momentum pips sit at 0.12 — legible but still clearly "unfilled" */
body.hc-dark:has(.game-screen) .momentum-pip,
body.hc-light:has(.game-screen) .momentum-pip {
  opacity: 0.4;
}

/* The stat bar tints its background with the accent, which muddies the
   accent-colored labels sitting on it. Keep it flat. */
body.hc-dark:has(.game-screen) .hero-stat-bar,
body.hc-light:has(.game-screen) .hero-stat-bar {
  background: var(--panel-bg);
}

/* No background art or edge vignette in high-contrast modes */
body.hc-dark:has(.game-screen)::before,
body.hc-light:has(.game-screen)::before,
body.hc-dark:has(.game-screen)::after,
body.hc-light:has(.game-screen)::after {
  display: none;
}
