/* ==========================================================
   NATIVE DARK MODE (html.legion-dark)
   Inspired by player Dark Reader screenshots — Crater chrome,
   panels, forms, battles, and map without inverting sprites.
========================================================== */

html.legion-dark {
    color-scheme: dark;
    --crater-maroon: #8d1517;
    --crater-maroon-dark: #4a0a0a;
    --crater-maroon-header: #7a1012;
    --crater-maroon-bright: #c44;
    --crater-grey: #2a2c2e;
    --crater-grey-light: #323436;
    --crater-grey-panel: #262829;
    --crater-grey-tab: #3a3c3e;
    --crater-link: #f0a0a0;
    --crater-complete: #6dcf6d;
    --crater-incomplete: #ff6b6b;
    --crater-notice-bg: #3a3420;
    --crater-notice-border: #b8942a;
    --crater-error-bg: #3a1a1a;
    --crater-error-border: #cc4444;
    --crater-action-bg: #1a2838;
    --crater-action-border: #4a6a8a;
    --legion-dark-bg: #181a1b;
    --legion-dark-surface: #212325;
    --legion-dark-surface-2: #2a2c2e;
    --legion-dark-border: #555;
    --legion-dark-text: #e8e6e3;
    --legion-dark-muted: #b0aea8;
    --legion-dark-accent: #f0a0a0;
}

html.legion-dark body {
    background-color: var(--legion-dark-bg);
    color: var(--legion-dark-text);
}

html.legion-dark .crater-container {
    background-color: #4a0a0a;
    border-color: #1a0404;
    box-shadow:
        0 3px 10px rgba(0, 0, 0, 0.55),
        0 12px 24px rgba(0, 0, 0, 0.4);
}

html.legion-dark .crater-inner-box {
    background-color: var(--legion-dark-surface);
    border-color: #666;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.06),
        3px 3px 10px rgba(0, 0, 0, 0.45);
    color: var(--legion-dark-text);
}

html.legion-dark .crater-game-page,
html.legion-dark .crater-page-chrome,
html.legion-dark .crater-page-band,
html.legion-dark .crater-page-band-sub,
html.legion-dark .crater-page-crumbs,
html.legion-dark .crater-page-eyebrow {
    color: var(--legion-dark-text);
}

html.legion-dark .crater-page-band-title,
html.legion-dark .crater-page-band h1,
html.legion-dark .crater-page-band h2,
html.legion-dark h1,
html.legion-dark h2,
html.legion-dark h3 {
    color: var(--legion-dark-accent);
}

html.legion-dark a,
html.legion-dark .crater-page-crumbs a,
html.legion-dark .crumb-back {
    color: var(--legion-dark-accent);
}

html.legion-dark a:hover,
html.legion-dark .crater-page-crumbs a:hover {
    color: #ffc8c8;
}

/* —— Panels —— */

html.legion-dark .crater-panel,
html.legion-dark .crater-panel--compact {
    background: var(--legion-dark-surface-2);
    border-color: #666;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
    color: var(--legion-dark-text);
}

html.legion-dark .crater-panel-top,
html.legion-dark .crater-panel-bottom {
    background: linear-gradient(to bottom, #7a1012 0%, #5a0c0c 100%);
    color: #fff;
    border-color: #3a0808;
}

html.legion-dark .crater-panel-body {
    background: var(--legion-dark-surface-2);
    color: var(--legion-dark-text);
}

html.legion-dark .crater-game-intro {
    background: var(--legion-dark-surface);
    border-color: #555;
    color: var(--legion-dark-muted);
}

/* —— Tabs —— */

html.legion-dark .c-tab {
    background: linear-gradient(to bottom, #3a3c3e 0%, #2a2c2e 55%, #222 100%);
    border-color: #666;
    color: #eee;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 -1px 0 rgba(0, 0, 0, 0.2);
}

html.legion-dark .c-tab:hover {
    background: linear-gradient(to bottom, #45474a 0%, #333 55%, #2a2c2e 100%);
    color: #fff;
}

html.legion-dark .c-tab.active-nav {
    background: var(--legion-dark-surface) !important;
    border-color: #666 #666 var(--legion-dark-surface);
    color: #fff;
}

html.legion-dark .c-side-tab,
html.legion-dark a.c-side-tab-link {
    background: linear-gradient(to right, #3a3c3e, #2a2c2e);
    border-color: #555;
    color: #ddd;
}

html.legion-dark .c-side-tab.active,
html.legion-dark .c-side-tab.active:hover {
    background: var(--legion-dark-surface);
    color: #fff;
    border-color: #4d0707;
}

html.legion-dark .nav-dropdown,
html.legion-dark .nav-menu-popup .crater-panel,
html.legion-dark .map-popup-panel {
    background: var(--legion-dark-surface-2) !important;
    color: var(--legion-dark-text);
    border-color: #666;
}

html.legion-dark .nav-menu-body,
html.legion-dark .nav-menu-body--account {
    background: linear-gradient(to bottom, #2a2222 0%, #221a1a 100%) !important;
}

html.legion-dark .nav-menu-row,
html.legion-dark .nav-menu-card {
    background: #2a2c2e;
    border-color: #555;
    color: var(--legion-dark-accent);
}

html.legion-dark .nav-menu-row:hover,
html.legion-dark .nav-menu-card:hover {
    background: #323028;
    border-color: #b00000;
    color: #ffb0b0;
}

html.legion-dark .nav-menu-group-label {
    color: #c08080;
}

/* —— Forms & buttons —— */

html.legion-dark input,
html.legion-dark select,
html.legion-dark textarea {
    background: #1a1c1d;
    border-color: #666;
    color: var(--legion-dark-text);
}

html.legion-dark input::placeholder,
html.legion-dark textarea::placeholder {
    color: #888;
}

html.legion-dark .crater-btn,
html.legion-dark .crater-submit-btn,
html.legion-dark button.crater-btn {
    background: linear-gradient(to bottom, #3a3c3e 0%, #2a2c2e 100%);
    border-color: #777;
    color: #fff;
}

html.legion-dark .crater-btn-primary,
html.legion-dark .crater-submit-btn.cb-btn-primary,
html.legion-dark button.crater-btn-primary {
    background: linear-gradient(to bottom, #8d1517 0%, #5a0c0c 100%);
    border-color: #a88;
    color: #fff;
}

html.legion-dark .crater-btn:hover,
html.legion-dark .crater-submit-btn:hover {
    filter: brightness(1.12);
}

/* —— Tables / lists —— */

html.legion-dark table,
html.legion-dark .crater-table,
html.legion-dark .items-mart-table,
html.legion-dark .staff-table {
    color: var(--legion-dark-text);
}

html.legion-dark th {
    background: #3a1010;
    color: #ffd0d0;
    border-color: #555;
}

html.legion-dark td {
    border-color: #444;
    background: transparent;
}

html.legion-dark tr:nth-child(even) td {
    background: rgba(255, 255, 255, 0.03);
}

html.legion-dark .crater-action-msg,
html.legion-dark .crater-notice-box,
html.legion-dark .crater-error-box {
    color: var(--legion-dark-text);
}

html.legion-dark .crater-action-msg {
    background: var(--crater-action-bg);
    border-color: var(--crater-action-border);
}

html.legion-dark .crater-notice-box {
    background: var(--crater-notice-bg);
    border-color: var(--crater-notice-border);
}

html.legion-dark .crater-error-box {
    background: var(--crater-error-bg);
    border-color: var(--crater-error-border);
}

/* —— Drawers —— */

html.legion-dark .v7-sliding-drawer {
    background: var(--legion-dark-surface);
    color: var(--legion-dark-text);
    border-color: #555;
}

html.legion-dark .v7-sliding-drawer .drawer-header {
    background: #5a0c0c;
    color: #fff;
}

html.legion-dark .drawer-content {
    background: var(--legion-dark-surface);
    color: var(--legion-dark-text);
}

html.legion-dark .dex-item,
html.legion-dark .member-row,
html.legion-dark .leaderboard-row {
    background: var(--legion-dark-surface-2);
    border-color: #444;
    color: var(--legion-dark-text);
}

/* —— Battle —— */

html.legion-dark .cb-battle-panel .crater-panel-body,
html.legion-dark .battle-choose-panel,
html.legion-dark .battle-results-panel {
    background: transparent;
    color: var(--legion-dark-text);
}

html.legion-dark .cb-move-btn,
html.legion-dark .cb-move-btn-face {
    background: #2a2c2e;
    border-color: #666;
    color: #eee;
}

html.legion-dark .cb-move-btn:has(input:checked) .cb-move-btn-face,
html.legion-dark label.cb-move-btn:has(input:checked) {
    border-color: #e05050;
    box-shadow: 0 0 0 1px #e05050;
}

html.legion-dark .team-select-card,
html.legion-dark .crater-team-select label,
html.legion-dark .tb-prebattle label,
html.legion-dark .tb-mid-switch label {
    background: var(--legion-dark-surface-2);
    border-color: #555;
    color: var(--legion-dark-text);
}

/* Training Battle — Choose Your Lead (beats trainer_battle.css) */
html.legion-dark .tb-prebattle-panel.crater-panel,
html.legion-dark .tb-mid-switch .crater-panel,
html.legion-dark .tb-results-phase .crater-panel {
    background: var(--legion-dark-surface-2);
    border-color: #555;
    color: var(--legion-dark-text);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45);
}

html.legion-dark .tb-prebattle .crater-panel-body,
html.legion-dark .tb-mid-switch .crater-panel-body {
    background: var(--legion-dark-surface);
    color: var(--legion-dark-text);
}

html.legion-dark .crater-panel-top--sub,
html.legion-dark .tb-prebattle-panel .crater-panel-top.crater-panel-top--sub,
html.legion-dark .tb-mid-switch .crater-panel-top.crater-panel-top--sub {
    background: #2a2c2e;
    border-bottom-color: #444;
    color: var(--legion-dark-accent);
    text-shadow: none;
}

html.legion-dark .tb-opponent-roster,
html.legion-dark .tb-team-select-list {
    background: var(--legion-dark-surface-2);
    border-color: #555;
    box-shadow: none;
}

html.legion-dark .tb-roster-row,
html.legion-dark .tb-team-select-row,
html.legion-dark label.tb-team-select-row {
    background: #2a2c2e;
    border-bottom-color: #3a3c3e;
    color: var(--legion-dark-text);
}

html.legion-dark .tb-roster-row.tb-roster-row-alt,
html.legion-dark .tb-team-select-row.tb-team-select-alt {
    background: #232526;
}

html.legion-dark label.tb-team-select-row:hover,
html.legion-dark .tb-team-select-row:not(label):hover {
    background: #323436;
}

html.legion-dark label.tb-team-select-row:has(input:checked),
html.legion-dark .tb-team-select-row.tb-team-select-row--switch:has(.tb-team-select-row--active),
html.legion-dark .tb-team-select-row.tb-team-select-row--switch:active {
    background: #353738;
    box-shadow: inset 4px 0 0 #c44;
}

html.legion-dark .tb-roster-name,
html.legion-dark .tb-team-name,
html.legion-dark .tb-section-header,
html.legion-dark label.tb-team-select-row:has(input:checked) .tb-team-name {
    color: var(--legion-dark-accent);
}

html.legion-dark .tb-roster-stat,
html.legion-dark .tb-team-stat,
html.legion-dark .tb-section-hint,
html.legion-dark .tb-prebattle-section > .tb-opponent-order-hint,
html.legion-dark .tb-hp-text {
    color: var(--legion-dark-muted);
}

html.legion-dark .tb-prebattle-actions {
    border-top-color: #555;
}

html.legion-dark .tb-mini-hp-track {
    background: #1a1c1d;
    border-color: #444;
}

/* Catch success (catch_success.php) — page CSS loads after theme-dark;
   html.legion-dark + class beats .catch-success-* alone. */
html.legion-dark .catch-success-page,
html.legion-dark .catch-hero,
html.legion-dark .cs-card {
    background: transparent;
    color: var(--legion-dark-text);
}

html.legion-dark .catch-success-wrap,
html.legion-dark .catch-hero,
html.legion-dark .cs-card {
    background:
        repeating-linear-gradient(0deg, transparent 0 31px, rgba(240, 160, 160, 0.04) 31px 32px),
        var(--legion-dark-surface-2);
    border-color: #555;
    border-top-color: #8d1517;
    color: var(--legion-dark-text);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}

html.legion-dark .catch-success-title,
html.legion-dark .catch-success-page h1,
html.legion-dark .catch-success-page h2,
html.legion-dark .catch-success-rarity,
html.legion-dark .cs-name,
html.legion-dark .cs-rarity-msg {
    color: var(--legion-dark-accent);
}

html.legion-dark .catch-success-rarity--gold {
    color: #e0b84a;
}

html.legion-dark .catch-success-name,
html.legion-dark .catch-success-meta,
html.legion-dark .catch-success-ot strong {
    color: var(--legion-dark-text);
}

html.legion-dark .catch-success-sub,
html.legion-dark .catch-success-ot {
    color: var(--legion-dark-muted);
}

html.legion-dark .catch-success-sprite,
html.legion-dark .catch-success-wrap img,
html.legion-dark .pokemon-sprite-stack img {
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.45));
}

html.legion-dark .catch-success-actions .crater-btn {
    background: linear-gradient(#3a3c3e, #2a2c2e);
    border-color: #666;
    color: var(--legion-dark-text);
}

html.legion-dark .catch-success-actions .crater-btn:hover {
    border-color: #c44;
    color: #ffc8c8;
}

html.legion-dark .catch-success-actions .crater-btn-primary {
    background: linear-gradient(#5a2020, #3a1010);
    border-color: #866;
    color: #ffc8c8;
}

html.legion-dark .catch-success-actions .crater-btn-primary:hover {
    border-color: #c44;
    color: #fff;
}

/* —— Map —— */

html.legion-dark .map-sidebar,
html.legion-dark .map-compass-help,
html.legion-dark .map-encounter-box,
html.legion-dark .map-players-bar {
    background: var(--legion-dark-surface-2);
    border-color: #555;
    color: var(--legion-dark-text);
}

html.legion-dark .map-compass button {
    background: #333;
    border-color: #666;
    color: #fff;
}

/* —— Mobile hamburger panel —— */

html.legion-dark .crater-top-tabs {
    background: #2a2c2e;
    border-color: #666;
}

html.legion-dark .mobile-menu-section + .mobile-menu-section {
    border-top-color: #555;
}

html.legion-dark .mobile-menu-section-title {
    color: var(--legion-dark-accent);
}

html.legion-dark .mobile-menu-section-items .c-tab,
html.legion-dark .mobile-panel-menu-item {
    background: linear-gradient(to bottom, #3a3c3e 0%, #2a2c2e 100%);
    border-color: #666;
    color: #eee;
}

/* Common light surfaces that Dark Reader was flipping */
html.legion-dark .dashboard-card,
html.legion-dark .dash-card,
html.legion-dark .stat-box,
html.legion-dark .info-box,
html.legion-dark .white-box,
html.legion-dark .content-box,
html.legion-dark .box,
html.legion-dark .yp-card,
html.legion-dark .team-slot,
html.legion-dark .pokemon-card,
html.legion-dark .forum-board,
html.legion-dark .forum-thread-row,
html.legion-dark .msg-thread,
html.legion-dark .profile-card {
    background-color: var(--legion-dark-surface-2);
    border-color: #555;
    color: var(--legion-dark-text);
}

html.legion-dark .hr,
html.legion-dark hr {
    border-color: #555;
    background: #555;
}

html.legion-dark .text-muted,
html.legion-dark .muted,
html.legion-dark .crater-page-band-sub,
html.legion-dark .opt-intro {
    color: var(--legion-dark-muted);
}

/* Names / links on darkened cards — light accent, not maroon-on-dark */
html.legion-dark .member-card-name,
html.legion-dark a.member-card-name,
html.legion-dark .yt-slot-cta,
html.legion-dark .yt-team-hint a,
html.legion-dark .yp-empty a,
html.legion-dark .items-mart-lock-msg a,
html.legion-dark .members-page-link,
html.legion-dark .drawer-prof-links a,
html.legion-dark .members-subtitle,
html.legion-dark .profile-comments-label,
html.legion-dark .profile-title,
html.legion-dark .members-title {
    color: var(--legion-dark-accent);
}

html.legion-dark .member-card-name:hover,
html.legion-dark a.member-card-name:hover,
html.legion-dark .drawer-prof-links a:hover {
    color: #ffc8c8;
}

html.legion-dark .member-action-btn {
    background: linear-gradient(#3a3c3e, #2a2c2e);
    border-color: #666;
    color: #eee;
}

html.legion-dark .member-action-btn:hover {
    background: #323436;
    border-color: #a44;
    color: #ffc8c8;
}

/* —— Broad surfaces inside main chrome —— */

html.legion-dark .crater-inner-box table,
html.legion-dark .crater-inner-box .crater-table,
html.legion-dark .crater-panel-body table {
    background: transparent;
    color: var(--legion-dark-text);
}

html.legion-dark .crater-inner-box tbody tr,
html.legion-dark .crater-panel-body tbody tr {
    background: var(--legion-dark-surface);
    color: var(--legion-dark-text);
}

html.legion-dark .crater-inner-box tbody tr:nth-child(even),
html.legion-dark .crater-panel-body tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.04);
}

html.legion-dark .crater-inner-box td,
html.legion-dark .crater-inner-box th,
html.legion-dark .crater-panel-body td {
    color: inherit;
}

/* ==========================================================
   POKÉMART / items.php
========================================================== */

html.legion-dark .items-balance-amount {
    color: var(--legion-dark-accent);
}

html.legion-dark .items-balance-hint {
    color: var(--legion-dark-muted);
}

html.legion-dark .items-mart-categories {
    background: #2a2222;
    border-color: #555;
}

html.legion-dark .items-mart-cat-btn {
    background: transparent;
    border-bottom-color: #444;
    color: var(--legion-dark-accent);
}

html.legion-dark .items-mart-cat-btn:hover {
    background: #323028;
}

html.legion-dark .items-mart-cat-btn.is-active {
    background: #5a0c0c;
    color: #fff;
}

html.legion-dark .items-mart-cat-count {
    background: rgba(255, 255, 255, 0.12);
    color: inherit;
}

html.legion-dark .items-mart-table,
html.legion-dark .items-mart-table td,
html.legion-dark .items-mart-table th {
    border-color: #555;
    color: var(--legion-dark-text);
}

html.legion-dark .items-mart-table tbody tr,
html.legion-dark .items-mart-row {
    background: var(--legion-dark-surface);
    color: var(--legion-dark-text);
}

html.legion-dark .items-mart-table tbody tr:nth-child(even),
html.legion-dark .items-mart-table tbody tr:nth-child(even) td {
    background: #262829;
}

html.legion-dark .items-mart-table tbody tr:nth-child(odd) td {
    background: var(--legion-dark-surface);
}

html.legion-dark .items-mart-item-cell,
html.legion-dark .items-mart-desc,
html.legion-dark .items-mart-owned,
html.legion-dark .items-mart-price,
html.legion-dark .items-mart-buy {
    color: var(--legion-dark-text);
}

html.legion-dark .items-mart-desc,
html.legion-dark .items-mart-lock-msg {
    color: var(--legion-dark-muted);
}

html.legion-dark .items-mart-submit-row {
    background: #2a2222;
    border-top-color: #555;
}

html.legion-dark .items-mart-submit-row .crater-btn,
html.legion-dark .items-mart-buy .crater-btn {
    background: linear-gradient(to bottom, #8d1517 0%, #5a0c0c 100%);
    border-color: #a88;
    color: #fff;
}

html.legion-dark .items-mart-qty-label select,
html.legion-dark .items-mart-buy select {
    background: #1a1c1d;
    border-color: #666;
    color: var(--legion-dark-text);
}

/* ==========================================================
   YOUR TEAM / PC (your_team, your_pokemon, change_team)
========================================================== */

html.legion-dark .member-card,
html.legion-dark .yt-poke-card,
html.legion-dark .yp-poke-card,
html.legion-dark .ct-poke-card-btn,
html.legion-dark article.member-card {
    background: linear-gradient(180deg, #2a2c2e 0%, #232526 100%);
    border-color: #555;
    border-left-color: #8b4545;
    color: var(--legion-dark-text);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

html.legion-dark .member-card:hover,
html.legion-dark .yt-poke-card:hover,
html.legion-dark .yp-poke-card:hover {
    border-color: #a44;
    border-left-color: #c44;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
}

html.legion-dark .yt-slot--empty {
    background: linear-gradient(to bottom, #2a2c2e 0%, #222425 100%);
    border-color: #555;
    color: var(--legion-dark-muted);
}

html.legion-dark .ct-slot--empty {
    background: linear-gradient(to bottom, #2a2c2e 0%, #222425 100%);
    border-color: #555;
    color: var(--legion-dark-muted);
}

html.legion-dark .yt-slot--empty .yt-slot-label,
html.legion-dark .yt-slot--empty .yt-slot-hint,
html.legion-dark .ct-slot--empty .ct-slot-label,
html.legion-dark .ct-slot--empty .ct-slot-hint,
html.legion-dark .ct-slot-cta-hint {
    color: var(--legion-dark-muted);
}

html.legion-dark .yt-slot-num,
html.legion-dark .ct-slot-num {
    background: rgba(240, 160, 160, 0.18);
    color: var(--legion-dark-accent);
}

html.legion-dark .yt-slot--lead .yt-slot-num,
html.legion-dark .ct-slot--lead .ct-slot-num,
html.legion-dark .yt-lead-chip,
html.legion-dark .ct-lead-badge {
    background: var(--legion-dark-accent, #c44);
    color: #fff;
}

html.legion-dark .yt-slot--empty .yt-slot-num,
html.legion-dark .ct-slot--empty .ct-slot-num {
    background: rgba(255, 255, 255, 0.08);
    color: #999;
}

html.legion-dark .yt-sprite-frame,
html.legion-dark .yt-poke-card .pokemon-sprite-stack,
html.legion-dark .ct-sprite-frame,
html.legion-dark .ct-poke-card .pokemon-sprite-stack {
    background: linear-gradient(180deg, #323436 0%, #2a2c2e 100%);
    border-color: rgba(240, 160, 160, 0.2);
}

html.legion-dark .ct-action-btn,
html.legion-dark .ca-reorder-btn {
    background: #2a2c2e;
    border-color: #666;
    color: var(--legion-dark-text);
}

html.legion-dark .ct-action-btn:hover,
html.legion-dark .ca-reorder-btn:hover:not(:disabled) {
    border-color: #c44;
    background: #322828;
}

html.legion-dark .ct-action-btn--primary {
    background: linear-gradient(180deg, #8b2020 0%, #6e1a1a 100%);
    border-color: #5a0c0c;
    color: #fff;
}

html.legion-dark .ct-slot-modal-backdrop {
    background: rgba(0, 0, 0, 0.65);
}

html.legion-dark .ct-slot-modal-sheet {
    background: linear-gradient(180deg, #2a2c2e 0%, #222425 100%);
    border-color: #8b4545;
}

html.legion-dark .ct-slot-modal-sub {
    color: var(--legion-dark-muted);
}

html.legion-dark .ct-slot-pick-btn {
    background: #232526;
    border-color: #555;
    border-left-color: #8b4545;
    color: var(--legion-dark-text);
}

html.legion-dark .ct-slot-pick-btn:hover,
html.legion-dark .ct-slot-pick-btn:focus-visible {
    background: #2e3032;
    border-color: #a44;
}

html.legion-dark .ct-slot-pick-btn--empty {
    color: var(--legion-dark-muted);
}

html.legion-dark .st-card {
    background: linear-gradient(180deg, #2a2c2e 0%, #232526 100%);
    border-color: #555;
    border-left-color: #8b4545;
}

html.legion-dark .st-card--empty {
    background: #222425;
}

html.legion-dark .st-hint,
html.legion-dark .st-copy-label {
    color: var(--legion-dark-muted);
}

html.legion-dark .st-card-name {
    color: var(--legion-dark-accent, #e8b0b0);
}

html.legion-dark .st-slot-badge {
    background: rgba(240, 160, 160, 0.16);
    color: var(--legion-dark-accent, #e8b0b0);
}

html.legion-dark .st-member {
    background: #323436;
    border-color: #555;
}

html.legion-dark .st-name-input,
html.legion-dark .st-copy-select {
    background: #1a1c1d;
    border-color: #666;
    color: var(--legion-dark-text);
}

html.legion-dark .st-card-actions .ct-action-btn {
    background: #2a2c2e;
    border-color: #666;
    color: var(--legion-dark-text);
}

html.legion-dark .yt-poke-meta,
html.legion-dark .yp-poke-meta,
html.legion-dark .yt-poke-moves,
html.legion-dark .yp-poke-moves,
html.legion-dark .ct-poke-meta,
html.legion-dark .member-card-page,
html.legion-dark .yt-team-hint,
html.legion-dark .ct-team-hint,
html.legion-dark .yt-moves-empty,
html.legion-dark .yp-moves-empty {
    color: var(--legion-dark-muted);
}

html.legion-dark .yp-on-team {
    background: rgba(240, 160, 160, 0.14);
    border-color: rgba(240, 160, 160, 0.35);
    color: var(--legion-dark-accent);
}

html.legion-dark .yp-toolbar,
html.legion-dark .yp-toolbar-body,
html.legion-dark .yp-stats-bar,
html.legion-dark .yt-stats-bar,
html.legion-dark .yt-quick-actions {
    color: var(--legion-dark-text);
}

html.legion-dark .yp-search-input,
html.legion-dark .yp-page .search-wrap input,
html.legion-dark input.yp-search-input {
    background: #1a1c1d !important;
    border-color: #666 !important;
    color: var(--legion-dark-text) !important;
}

html.legion-dark .yp-sort-nav {
    background: #2a2c2e !important;
    border-color: #555 !important;
}

html.legion-dark .yp-roster-body {
    background: #1e2021 !important;
}

html.legion-dark .yp-page-nav,
html.legion-dark .yp-page-node,
html.legion-dark .yp-jump-btn {
    background: linear-gradient(180deg, #3a3c3e 0%, #2a2c2e 100%);
    border-color: #666;
    color: var(--legion-dark-text);
}

html.legion-dark .yp-page-nav:hover,
html.legion-dark .yp-page-node:hover,
html.legion-dark .yp-jump-btn:hover {
    background: #404244;
    color: var(--legion-dark-accent);
}

html.legion-dark .yp-page-nav.is-disabled {
    background: #2a2c2e;
    border-color: #555;
    color: #777;
}

html.legion-dark .yp-page-node.active {
    background: linear-gradient(180deg, #8d1517 0%, #5a0c0c 100%);
    border-color: var(--legion-dark-accent);
    color: #fff;
}

html.legion-dark .yp-page-ellipsis,
html.legion-dark .yp-pagination-meta,
html.legion-dark .yp-jump-label {
    color: var(--legion-dark-muted);
}

html.legion-dark .yp-pagination-total {
    color: var(--legion-dark-text);
}

html.legion-dark .yp-jump-input {
    background: #1a1c1d;
    border-color: #666;
    color: var(--legion-dark-text);
}

html.legion-dark .yp-page-status {
    color: var(--legion-dark-muted);
}

html.legion-dark .yp-page .search-suggestions {
    background: #1a1c1d;
    border-color: #555;
}

html.legion-dark .yp-page .search-suggestions button {
    background: #1a1c1d;
    color: var(--legion-dark-text);
}

html.legion-dark .yp-page .search-suggestions button:hover,
html.legion-dark .yp-page .search-suggestions button.active {
    background: #323028;
}

html.legion-dark .yt-empty .members-empty,
html.legion-dark .members-empty.yt-empty,
html.legion-dark .members-empty {
    background: linear-gradient(180deg, #2a2c2e 0%, #232526 100%);
    border-color: #555;
    color: var(--legion-dark-muted);
}

html.legion-dark .members-empty-title {
    color: var(--legion-dark-accent);
}

html.legion-dark .members-empty-text,
html.legion-dark .yt-action-evolve,
html.legion-dark .yp-action-evolve {
    color: var(--legion-dark-accent) !important;
    border-color: #866 !important;
}

html.legion-dark .ct-pc-scroll,
html.legion-dark .ct-pc-body,
html.legion-dark .ct-pc-panel .crater-panel-body {
    background: var(--legion-dark-surface);
    color: var(--legion-dark-text);
}

/* ==========================================================
   WILD / SHARED BATTLE UI
========================================================== */

html.legion-dark .cb-battle-panel.crater-panel,
html.legion-dark .cb-battle-panel {
    background: var(--legion-dark-surface);
    border-color: #340000;
    color: var(--legion-dark-text);
}

html.legion-dark .cb-battle-panel .crater-panel-body {
    background: #1e2021;
    color: var(--legion-dark-text);
}

html.legion-dark .cb-battle-head {
    background: #262829;
    border-bottom-color: #444;
}

html.legion-dark .cb-battle-root,
html.legion-dark .cb-battle-root h2,
html.legion-dark .cb-battle-root h3,
html.legion-dark .battle-title,
html.legion-dark .battle-subtitle {
    color: var(--legion-dark-accent);
}

html.legion-dark .cb-fighter-plate {
    background: linear-gradient(#2a2c2e, #222425);
    border-color: #555;
    color: var(--legion-dark-text);
    box-shadow:
        0 3px 0 rgba(0, 0, 0, 0.45),
        0 8px 16px rgba(0, 0, 0, 0.4);
}

html.legion-dark .fighter-name,
html.legion-dark .cb-hp-label {
    color: var(--legion-dark-accent);
}

html.legion-dark .cb-hp-line,
html.legion-dark .vortex-hp-line {
    color: var(--legion-dark-text);
}

html.legion-dark .cb-battle-log {
    background: #1a1c1d;
    border-color: #555;
    border-left-color: #c44;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

html.legion-dark .cb-battle-log-toggle {
    background: #2a2222;
    border-bottom-color: #444;
    color: var(--legion-dark-accent);
}

html.legion-dark .cb-battle-log-title {
    background: transparent;
    border-bottom-color: transparent;
    color: var(--legion-dark-accent);
}

html.legion-dark .cb-battle-log-hint {
    color: var(--legion-dark-muted);
}

html.legion-dark .cb-action-dock {
    background: #1e2021;
    border-top-color: #444;
    box-shadow: 0 -6px 14px rgba(0, 0, 0, 0.35);
}

html.legion-dark .cb-battle-log-content,
html.legion-dark .cb-log-entry {
    color: var(--legion-dark-text);
}

html.legion-dark .cb-log-entry--player {
    color: #f0e6e0;
}

html.legion-dark .cb-log-entry--enemy {
    color: var(--legion-dark-muted);
}

html.legion-dark .cb-log-entry::before {
    background: #c44;
}

html.legion-dark .cb-log-entry--player::before {
    background: #e05050;
}

html.legion-dark .cb-status-badge {
    background: #3a2222;
    color: var(--legion-dark-accent);
    border-color: #666;
}

html.legion-dark .cb-move-btn,
html.legion-dark .cb-move-btn-face,
html.legion-dark .vortex-attack-list label,
html.legion-dark .vortex-attack-list .cb-move-btn-face {
    background: linear-gradient(#2a2c2e, #222425);
    border-color: #666;
    color: var(--legion-dark-text);
}

html.legion-dark .cb-captcha-panel {
    background: var(--legion-dark-surface-2);
    color: var(--legion-dark-text);
    border-color: #555;
}

html.legion-dark .cb-captcha-title,
html.legion-dark .cb-captcha-message,
html.legion-dark .cb-captcha-prompt {
    color: var(--legion-dark-accent);
}

html.legion-dark .battle-error {
    background: var(--crater-error-bg);
    border-color: var(--crater-error-border);
    color: #ffb0b0;
}

html.legion-dark .battle-results-panel,
html.legion-dark .battle-end-panel {
    color: var(--legion-dark-text);
    border-top-color: #555;
}

html.legion-dark .battle-choose-panel,
html.legion-dark .crater-team-select,
html.legion-dark .tb-prebattle,
html.legion-dark .tb-mid-switch {
    background: transparent;
    color: var(--legion-dark-text);
}

/* ==========================================================
   MAP PAGE
========================================================== */

html.legion-dark #map-page,
html.legion-dark .map-page {
    --map-legion-panel: #2a2c2e;
    --map-legion-panel-alt: #323436;
    --map-legion-border: #555;
    --map-legion-border-dark: #444;
    --map-legion-link: #f0a0a0;
    --map-legion-text: #e8e6e3;
    --map-legion-muted: #b0aea8;
    --map-legion-dark: #f0a0a0;
    color: var(--legion-dark-text);
    background-color: var(--legion-dark-surface);
    background-image: none;
}

html.legion-dark #map-page .map-quick-links,
html.legion-dark #map-page .map-stats-bar,
html.legion-dark #map-page #center {
    background: linear-gradient(180deg, #2a2c2e 0%, #232526 100%);
    border-color: #555;
    color: var(--legion-dark-text);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

html.legion-dark #map-page .map-quick-links a,
html.legion-dark #map-page a {
    color: var(--legion-dark-accent);
}

html.legion-dark #map-page .map-quick-links .pipe-sep {
    color: #777;
}

html.legion-dark #map-page .map-notice-bar {
    background: linear-gradient(180deg, #3a3420 0%, #2e2a18 100%);
    border-color: #b8942a;
    color: #f0e8c8;
    box-shadow: none;
}

html.legion-dark #map-page .map-sidebar-panel,
html.legion-dark #map-page .map-compass,
html.legion-dark #map-page .map-encounter,
html.legion-dark .map-sidebar,
html.legion-dark .map-compass-help,
html.legion-dark .map-encounter-box {
    background: linear-gradient(180deg, #2a2c2e 0%, #222425 100%);
    border-color: #555;
    color: var(--legion-dark-text);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.05),
        0 2px 4px rgba(0, 0, 0, 0.35);
}

html.legion-dark #map-page .map-frame {
    filter: drop-shadow(0 3px 10px rgba(0, 0, 0, 0.55));
}

html.legion-dark #map-page .map-frame-top,
html.legion-dark #map-page .map-frame-bottom {
    background-color: #444;
}

html.legion-dark #map-page .map-frame-body {
    background: linear-gradient(180deg, #3a3c3e 0%, #2a2c2e 100%);
    border-color: #555;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.35);
}

html.legion-dark #map-page .encounter-idle-text,
html.legion-dark #map-page .encounter-idle-heading {
    color: var(--legion-dark-muted);
}

html.legion-dark #map-page .map-stat-link {
    background: linear-gradient(180deg, #3a2222 0%, #2a1a1a 100%);
    border-color: #666;
    color: var(--legion-dark-accent);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

html.legion-dark #map-page .map-stat-link:hover {
    background: linear-gradient(180deg, #4a2a2a 0%, #322020 100%);
    color: #ffc8c8;
}

html.legion-dark #map-page .map-compass-help,
html.legion-dark #map-page .map-encounter-body,
html.legion-dark #map-page .map-encounter-hint {
    color: var(--legion-dark-muted);
    background: transparent;
}

/* Variant encounter/card tints: css/components/pokemon-variant-bg.css */

html.legion-dark #map-page .encounter-special-badge {
    color: #f0d060;
}

html.legion-dark #map-page .map-members-popup-panel,
html.legion-dark .map-members-popup-panel,
html.legion-dark .map-popup-panel {
    background: var(--legion-dark-surface-2) !important;
    color: var(--legion-dark-text);
    border-color: #555;
}

html.legion-dark #map-page .map-popup-list,
html.legion-dark .map-popup-list {
    background: var(--legion-dark-surface);
    color: var(--legion-dark-text);
}

/* ==========================================================
   MEMBERS DRAWER / PROFILE MODAL
========================================================== */

html.legion-dark .v7-sliding-drawer {
    background:
        linear-gradient(180deg, rgba(90, 12, 12, 0.12) 0%, transparent 40%),
        var(--legion-dark-surface);
    color: var(--legion-dark-text);
}

html.legion-dark .members-shared-nav,
html.legion-dark .dex-toolbar {
    background:
        linear-gradient(180deg, rgba(176, 0, 0, 0.12) 0%, transparent 45%),
        var(--legion-dark-surface-2);
    border-color: #666;
}

html.legion-dark .members-top-links a,
html.legion-dark .members-sub-links a {
    background: linear-gradient(#3a3c3e, #2a2c2e);
    border-color: #666;
    color: var(--legion-dark-accent);
}

html.legion-dark .members-top-links a:hover,
html.legion-dark .members-sub-links a:hover {
    background: #323436;
    border-color: #a44;
    color: #ffc8c8;
}

html.legion-dark .members-sub-links a.active-sub-link,
html.legion-dark .members-top-links a.active-sub-link {
    background: linear-gradient(180deg, #b00000 0%, #8a0000 100%);
    color: #fff;
    border-color: #4d0707;
}

html.legion-dark .members-list-heading {
    color: var(--legion-dark-accent);
    border-bottom-color: #555;
}

html.legion-dark .members-section-empty,
html.legion-dark .members-page-status,
html.legion-dark .members-page-range,
html.legion-dark .members-note,
html.legion-dark .drawer-team-empty {
    color: var(--legion-dark-muted);
}

html.legion-dark .members-loading {
    background: rgba(26, 28, 29, 0.85);
    border-color: #555;
    color: var(--legion-dark-muted);
}

html.legion-dark .members-search-box {
    background: linear-gradient(180deg, #2a2c2e 0%, #232526 100%);
    border-color: #555;
    color: var(--legion-dark-text);
}

html.legion-dark .members-search-label {
    color: var(--legion-dark-accent);
}

html.legion-dark .members-select,
html.legion-dark .members-input {
    background: #1a1c1d;
    border-color: #666;
    color: var(--legion-dark-text);
}

html.legion-dark .members-divider {
    border-top-color: #555;
}

html.legion-dark .drawer-prof-stat,
html.legion-dark .profile-stats,
html.legion-dark #members-drawer .profile-header {
    background: linear-gradient(165deg, #2a2c2e 0%, #232526 100%);
    border-color: #555;
    border-left-color: #a44;
    color: var(--legion-dark-text);
    box-shadow: none;
}

html.legion-dark .drawer-prof-stat-label {
    color: var(--legion-dark-accent);
}

html.legion-dark .drawer-prof-stat-value {
    color: var(--legion-dark-text);
}

html.legion-dark .profile-comments,
html.legion-dark .drawer-prof-comments-wrap .profile-comments {
    background: transparent;
    border-color: transparent;
    color: var(--legion-dark-text);
}

html.legion-dark .drawer-prof-comments-wrap {
    background: linear-gradient(180deg, #2a2c2e 0%, #232526 100%);
    border-color: #555;
    box-shadow: none;
}

html.legion-dark .drawer-prof-comments-wrap .profile-comments-label,
html.legion-dark .drawer-team-heading {
    border-bottom-color: rgba(255, 255, 255, 0.1);
    color: var(--legion-dark-accent);
}

html.legion-dark .prof-hero {
    background: linear-gradient(145deg, #8a1212 0%, #5a0c0c 55%, #3a0808 100%);
    border-color: #2a0606;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45);
}

html.legion-dark .drawer-prof-hero {
    background:
        radial-gradient(ellipse 80% 120% at 100% 0%, rgba(255, 120, 80, 0.12) 0%, transparent 55%),
        linear-gradient(145deg, #9a1616 0%, #5a0c0c 55%, #2e0707 100%);
    border-color: #1a0404;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.06) inset,
        0 8px 22px rgba(0, 0, 0, 0.5);
}

html.legion-dark .prof-hero-sprite,
html.legion-dark .drawer-prof-hero-sprite {
    background: rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.14);
}

html.legion-dark .drawer-prof-chip {
    background: rgba(0, 0, 0, 0.35);
    border-color: rgba(255, 255, 255, 0.22);
    color: #ffd8d0;
}

html.legion-dark .drawer-prof-chip:hover {
    background: rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 255, 255, 0.4);
    color: #fff;
}

html.legion-dark .drawer-prof-chip--status {
    background: rgba(255, 255, 255, 0.08);
    color: #e8c8c0;
}

html.legion-dark .drawer-prof-eyebrow {
    color: rgba(255, 200, 190, 0.75);
}

html.legion-dark .prof-stat-tile {
    background: linear-gradient(180deg, #2a2c2e 0%, #232526 100%);
    border-color: #555;
}

html.legion-dark .prof-stat-tile-label {
    color: var(--legion-dark-accent);
}

html.legion-dark .prof-stat-tile-value {
    color: var(--legion-dark-text);
}

html.legion-dark .prof-comments-text {
    background: #1a1c1d;
    border-color: #555;
    color: var(--legion-dark-text);
}

html.legion-dark .yp-card-actions {
    border-top-color: rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.2);
}

html.legion-dark .yp-roster-body > .yp-pagination:last-of-type {
    border-top-color: #555;
}

html.legion-dark .yp-poke-card .pokemon-sprite-stack,
html.legion-dark .drawer-team-item > .pokemon-sprite-stack,
html.legion-dark #members-drawer .drawer-pokemon-sprite-col,
html.legion-dark #members-drawer .drawer-pokemon-card .pokemon-sprite-stack,
html.legion-dark .prof-pokemon-card .pokemon-sprite-stack {
    background: linear-gradient(180deg, #323436 0%, #262829 100%);
    border-color: #555;
}

html.legion-dark .yp-on-team,
html.legion-dark #members-drawer .drawer-pokemon-team-badge,
html.legion-dark .prof-pokemon-card .drawer-pokemon-team-badge {
    background: linear-gradient(180deg, #8d1d1d 0%, #5a0c0c 100%);
    border-color: #3a0808;
    color: #fff;
}

html.legion-dark .drawer-team-item,
html.legion-dark .drawer-pokemon-card,
html.legion-dark .drawer-team-grid .drawer-team-item,
html.legion-dark #members-drawer .drawer-pokemon-card,
html.legion-dark #members-drawer .drawer-team-item,
html.legion-dark #members-drawer .member-card,
html.legion-dark .yp-poke-card,
html.legion-dark .prof-pokemon-card {
    background: linear-gradient(165deg, #2a2c2e 0%, #232526 100%);
    border-color: #555;
    border-left-color: #a44;
    color: var(--legion-dark-text);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

html.legion-dark #members-drawer .drawer-pokemon-card:hover,
html.legion-dark #members-drawer .drawer-team-item:hover,
html.legion-dark #members-drawer .member-card:hover,
html.legion-dark .yp-poke-card:hover,
html.legion-dark .prof-pokemon-card:hover {
    border-color: #777;
    border-left-color: #c55;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.45);
}

html.legion-dark #members-drawer .drawer-pokemon-card-name,
html.legion-dark #members-drawer .drawer-pokemon-card .member-card-name,
html.legion-dark .drawer-pkmn-name {
    color: var(--legion-dark-accent);
}

html.legion-dark #members-drawer .drawer-pokemon-card-meta,
html.legion-dark .drawer-pkmn-meta,
html.legion-dark .drawer-pkmn-exp {
    color: var(--legion-dark-muted);
}

html.legion-dark #members-drawer .drawer-team-empty {
    background: #1a1c1d;
    border-color: #555;
    color: var(--legion-dark-muted);
}

html.legion-dark .dex-region-btn,
html.legion-dark .dex-gen-btn,
html.legion-dark .dex-completion-bar {
    background: linear-gradient(180deg, #2a2c2e 0%, #232526 100%);
    border-color: #555;
    color: var(--legion-dark-text);
}

html.legion-dark .dex-region-btn:hover,
html.legion-dark .dex-gen-btn:hover {
    background: #323436;
    border-color: #a44;
    color: #ffc8c8;
}

html.legion-dark .dex-region-btn.active {
    background: linear-gradient(#bd1818, #7c0707);
    border-color: #4e0000;
    color: #fff;
}

html.legion-dark .dex-gen-btn.active {
    background: linear-gradient(180deg, #3a2222 0%, #2a1a1a 100%);
    border-color: #c44;
    color: var(--legion-dark-accent);
}

html.legion-dark .dex-completion-text,
html.legion-dark .dex-gen-completion,
html.legion-dark .dex-empty-hint {
    color: var(--legion-dark-muted);
}

html.legion-dark .dex-completion-track {
    background: #1a1c1d;
    border-color: #555;
}

html.legion-dark .dex-item,
html.legion-dark .dex-item.dex-item-form,
html.legion-dark .dex-item.dex-item-inline-form {
    background: var(--legion-dark-surface-2);
    border-color: #444;
    color: var(--legion-dark-text);
}

/* Leaderboards drawer — dark zebra rows (no white/tan) */
html.legion-dark #leaderboards-drawer .drawer-lb-tab,
html.legion-dark .drawer-lb-tab {
    background: transparent;
    color: rgba(255, 235, 235, 0.78);
    border-color: transparent;
}

html.legion-dark #leaderboards-drawer .drawer-lb-tab:hover,
html.legion-dark .drawer-lb-tab:hover {
    color: #fff;
    background: rgba(176, 0, 0, 0.45);
}

html.legion-dark #leaderboards-drawer .drawer-lb-tab.is-active,
html.legion-dark .drawer-lb-tab.is-active {
    background: linear-gradient(180deg, #b00000 0%, #8a0000 100%);
    border-color: rgba(255, 200, 200, 0.25);
    color: #fff;
}

html.legion-dark #leaderboards-drawer .drawer-lb-panel,
html.legion-dark .drawer-lb-panel {
    background: var(--legion-dark-surface);
    border-color: #5a0c0c;
    color: var(--legion-dark-text);
}

html.legion-dark #leaderboards-drawer .drawer-lb-table,
html.legion-dark .drawer-lb-table {
    background: transparent;
    color: var(--legion-dark-text);
}

html.legion-dark #leaderboards-drawer .drawer-lb-tr,
html.legion-dark .drawer-lb-tr {
    background: #2a1a1a;
    border-bottom-color: #3a2a2a;
    color: var(--legion-dark-text);
}

html.legion-dark #leaderboards-drawer .drawer-lb-tr:nth-child(even),
html.legion-dark .drawer-lb-tr:nth-child(even) {
    background: #1e2022;
}

html.legion-dark #leaderboards-drawer .drawer-lb-tr:hover,
html.legion-dark .drawer-lb-tr:hover {
    background: #323436;
}

html.legion-dark #leaderboards-drawer .drawer-lb-tr--gold,
html.legion-dark .drawer-lb-tr--gold {
    background: linear-gradient(180deg, #3a3020 0%, #2a2418 100%) !important;
    color: var(--legion-dark-text);
}

html.legion-dark #leaderboards-drawer .drawer-lb-tr--silver,
html.legion-dark .drawer-lb-tr--silver {
    background: linear-gradient(180deg, #2e3032 0%, #222425 100%) !important;
    color: var(--legion-dark-text);
}

html.legion-dark #leaderboards-drawer .drawer-lb-tr--bronze,
html.legion-dark .drawer-lb-tr--bronze {
    background: linear-gradient(180deg, #3a2a1e 0%, #2a1e16 100%) !important;
    color: var(--legion-dark-text);
}

html.legion-dark #leaderboards-drawer .drawer-lb-rank-num,
html.legion-dark .drawer-lb-rank-num,
html.legion-dark #leaderboards-drawer .drawer-lb-main-stat,
html.legion-dark .drawer-lb-main-stat,
html.legion-dark #leaderboards-drawer .drawer-lb-td-num,
html.legion-dark .drawer-lb-td-num,
html.legion-dark #leaderboards-drawer .drawer-lb-td-owner,
html.legion-dark .drawer-lb-td-owner {
    color: var(--legion-dark-text);
}

html.legion-dark #leaderboards-drawer .drawer-lb-username,
html.legion-dark .drawer-lb-username,
html.legion-dark #leaderboards-drawer .drawer-lb-poke-name,
html.legion-dark .drawer-lb-poke-name {
    color: var(--legion-dark-accent);
}

html.legion-dark #leaderboards-drawer .drawer-lb-username:hover,
html.legion-dark .drawer-lb-username:hover,
html.legion-dark #leaderboards-drawer .drawer-lb-poke-name:hover,
html.legion-dark .drawer-lb-poke-name:hover {
    color: #ffc8c8;
}

html.legion-dark #leaderboards-drawer .drawer-lb-user-sub,
html.legion-dark .drawer-lb-user-sub,
html.legion-dark #leaderboards-drawer .drawer-lb-sub-stat,
html.legion-dark .drawer-lb-sub-stat,
html.legion-dark #leaderboards-drawer .drawer-lb-empty,
html.legion-dark .drawer-lb-empty {
    color: var(--legion-dark-muted);
}

html.legion-dark #leaderboards-drawer .drawer-lb-dex-label,
html.legion-dark .drawer-lb-dex-label,
html.legion-dark #leaderboards-drawer .drawer-lb-pct,
html.legion-dark .drawer-lb-pct {
    color: var(--legion-dark-text);
}

html.legion-dark #leaderboards-drawer .drawer-lb-pct,
html.legion-dark .drawer-lb-pct {
    background: rgba(240, 160, 160, 0.12);
    border-color: rgba(240, 160, 160, 0.28);
}

html.legion-dark #leaderboards-drawer .drawer-lb-dex-track,
html.legion-dark .drawer-lb-dex-track {
    background: #1a1c1d;
}

html.legion-dark #drawer-lb-footer.drawer-lb-footer,
html.legion-dark .drawer-lb-footer,
html.legion-dark #leaderboards-drawer .drawer-lb-footer {
    color: #9a9890;
}

html.legion-dark #drawer-lb-footer.drawer-lb-footer a,
html.legion-dark .drawer-lb-footer a,
html.legion-dark #leaderboards-drawer .drawer-lb-footer a {
    color: var(--legion-dark-accent);
}

/* Members hub page (members.php) */
html.legion-dark .trainer-avatar-render {
    background: #1a1c1d;
    border-color: #555;
}

html.legion-dark .roster-mon-pod {
    background: linear-gradient(to bottom, #2a2c2e 0%, #232526 100%);
    border-color: #555;
    color: var(--legion-dark-text);
}

html.legion-dark .stats-table-view td {
    border-bottom-color: #444;
    color: var(--legion-dark-text);
}

html.legion-dark .stats-table-view td.field-header,
html.legion-dark .trainer-profile-link {
    color: var(--legion-dark-accent);
}

html.legion-dark .stats-money {
    color: #6dcf6d;
}

/* ==========================================================
   PIPE NAV / OPTIONS LIST / PAGE CRUMBS
========================================================== */

html.legion-dark .crater-options-list,
html.legion-dark .crater-pipe-nav,
html.legion-dark .crater-page-crumbs {
    background: var(--legion-dark-surface-2);
    border-color: #555;
    color: var(--legion-dark-text);
}

html.legion-dark .crater-options-list strong,
html.legion-dark .crater-page-crumbs .crumb-current {
    color: var(--legion-dark-text);
}

html.legion-dark .crater-pipe-nav .pipe-sep,
html.legion-dark .crater-page-crumbs .crumb-sep {
    color: #888;
}

html.legion-dark .crater-pipe-nav a.pipe-active {
    color: #fff;
}

/* ==========================================================
   FILTER CHROME (chips + search toolbars)
========================================================== */

html.legion-dark {
    --legion-chip-bg: #2a2c2e;
    --legion-chip-bg-hover: #343739;
    --legion-chip-border: #666;
    --legion-chip-text: #e8e8e8;
    --legion-chip-active-bg: linear-gradient(180deg, #b00000 0%, #7a0000 100%);
    --legion-chip-active-border: #8b2020;
    --legion-chip-active-text: #fff;
    --legion-filter-row-bg: linear-gradient(180deg, #262829 0%, #1e2021 100%);
    --legion-filter-row-border: #555;
    --legion-filter-label: #d8d8d8;
    --legion-search-input-border: #666;
}

html.legion-dark .legion-filter-row,
html.legion-dark .legion-filter-row.crater-options-list,
html.legion-dark .drawer-pokemon-filters {
    background: var(--legion-filter-row-bg);
    border-color: var(--legion-filter-row-border);
    color: var(--legion-dark-text);
}

html.legion-dark .legion-filter-label,
html.legion-dark .legion-search-label,
html.legion-dark .legion-search-form > strong,
html.legion-dark .legion-filter-toolbar .members-search-box > strong,
html.legion-dark .legion-filter-toolbar .roster-search-form > strong {
    color: var(--legion-filter-label);
}

html.legion-dark a.legion-chip,
html.legion-dark .legion-chip-group > a,
html.legion-dark .legion-filter-row.crater-pipe-nav > a {
    background: var(--legion-chip-bg);
    border-color: var(--legion-chip-border);
    color: var(--legion-chip-text);
}

html.legion-dark a.legion-chip:hover,
html.legion-dark .legion-chip-group > a:hover,
html.legion-dark .legion-filter-row.crater-pipe-nav > a:hover {
    background: var(--legion-chip-bg-hover);
    border-color: #888;
    color: #fff;
}

html.legion-dark a.legion-chip.pipe-active,
html.legion-dark a.legion-chip.is-active,
html.legion-dark .legion-chip-group > a.pipe-active,
html.legion-dark .legion-chip-group > a.is-active,
html.legion-dark .legion-filter-row.crater-pipe-nav > a.pipe-active,
html.legion-dark .legion-filter-row.crater-pipe-nav > a.is-active,
html.legion-dark .drawer-pokemon-filters .drawer-poke-filter-nav a.pipe-active,
html.legion-dark .drawer-pokemon-filters .drawer-poke-filter-nav a.is-active,
html.legion-dark #members-drawer .drawer-pokemon-filters .drawer-poke-filter-nav a.pipe-active,
html.legion-dark #members-drawer .drawer-pokemon-filters .drawer-poke-filter-nav a.is-active,
html.legion-dark #members-drawer .drawer-pokemon-filters .crater-pipe-nav a.pipe-active,
html.legion-dark #members-drawer .drawer-pokemon-filters .crater-pipe-nav a.is-active {
    background: var(--legion-chip-active-bg);
    border-color: var(--legion-chip-active-border);
    color: var(--legion-chip-active-text);
}

html.legion-dark .legion-filter-toolbar .legion-filter-row,
html.legion-dark .legion-filter-toolbar .yp-sort-nav.legion-filter-row {
    background: var(--legion-dark-surface-2);
    border-color: #555;
}

html.legion-dark .legion-search-input,
html.legion-dark .legion-filter-toolbar .members-input,
html.legion-dark .legion-filter-toolbar .roster-search-input,
html.legion-dark .legion-filter-toolbar .yp-search-input,
html.legion-dark .legion-filter-toolbar .ct-search-input,
html.legion-dark .legion-filter-toolbar .ca-search-input {
    background: #1a1b1c;
    border-color: var(--legion-search-input-border);
    color: var(--legion-dark-text);
}

html.legion-dark .legion-search-input:focus,
html.legion-dark .legion-filter-toolbar .members-input:focus,
html.legion-dark .legion-filter-toolbar .roster-search-input:focus,
html.legion-dark .legion-filter-toolbar .yp-search-input:focus,
html.legion-dark .legion-filter-toolbar .ct-search-input:focus,
html.legion-dark .legion-filter-toolbar .ca-search-input:focus {
    border-color: #c04040;
    box-shadow: 0 0 0 2px rgba(176, 0, 0, 0.28);
}

/* ==========================================================
   CHANGE ATTACKS / MOVE MANAGEMENT (change_attacks.php)
========================================================== */

html.legion-dark .ca-move-type-nav,
html.legion-dark .crater-options-list.ca-move-type-nav {
    background: var(--legion-dark-surface-2) !important;
    border-color: #555 !important;
    color: var(--legion-dark-text);
}

html.legion-dark .ca-move-type-nav strong {
    color: var(--legion-dark-text);
}

html.legion-dark .ca-picker-body,
html.legion-dark .ca-catalog-body {
    background: #1e2021 !important;
    color: var(--legion-dark-text);
}

html.legion-dark .ca-poke-card--odd {
    background: #262829;
}

html.legion-dark a.ca-poke-card:hover,
html.legion-dark .ca-poke-card--odd:hover {
    background: #322828;
    border-color: #a44;
}

html.legion-dark .ca-picker-empty {
    background: linear-gradient(to bottom, #2a2c2e 0%, #232526 100%);
    border-color: #555;
    color: var(--legion-dark-muted);
}

html.legion-dark .ca-poke-meta,
html.legion-dark .ca-poke-moves,
html.legion-dark .ca-target-meta,
html.legion-dark .ca-slots-hint,
html.legion-dark .ca-moves-empty {
    color: var(--legion-dark-muted);
}

html.legion-dark .ca-meta-sep {
    color: #777;
}

html.legion-dark .ca-on-team {
    color: #6dcf6d;
}

html.legion-dark .ca-slot-card {
    background: var(--legion-dark-surface-2);
    border-color: #555;
    color: var(--legion-dark-text);
}

html.legion-dark .ca-slot-card:hover {
    background: #322828;
    border-color: #a66;
}

html.legion-dark .ca-slot-card:has(input:checked) {
    background: #322020;
    border-color: var(--crater-maroon, #8d1517);
    box-shadow: 0 0 0 1px rgba(224, 80, 80, 0.35);
}

html.legion-dark .ca-slot-card--empty {
    background: linear-gradient(to bottom, #2a2c2e 0%, #222425 100%);
}

html.legion-dark .ca-slot-card.ca-drop-hover {
    background: #322828 !important;
    border-color: var(--crater-maroon, #8d1517) !important;
}

html.legion-dark .ca-slot-num {
    color: var(--legion-dark-muted);
}

html.legion-dark .ca-slot-name {
    color: var(--legion-dark-accent);
}

html.legion-dark .ca-slot-stats {
    color: var(--legion-dark-muted);
}

html.legion-dark .ca-slot-stats--empty {
    color: #888;
}

html.legion-dark .ca-section-title {
    color: var(--legion-dark-accent);
    border-bottom-color: #555;
}

html.legion-dark .ca-move-row {
    background: var(--legion-dark-surface-2);
    border-color: #555;
    color: var(--legion-dark-text);
}

html.legion-dark .ca-move-row--odd {
    background: #262829;
}

html.legion-dark .ca-move-row:hover:not(:disabled) {
    background: #322828;
    border-color: #a66;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

html.legion-dark .ca-move-row--selected {
    background: #322020 !important;
    border-color: var(--crater-maroon, #8d1517) !important;
}

html.legion-dark .ca-move-row--known {
    background: #232526;
    border-color: #444;
}

html.legion-dark .ca-move-row--known .ca-move-name {
    color: #888;
}

html.legion-dark .ca-move-row--known .ca-move-stats {
    color: #777;
}

html.legion-dark .ca-move-name {
    color: var(--legion-dark-accent);
}

html.legion-dark .ca-move-stats {
    color: var(--legion-dark-muted);
}

html.legion-dark .ca-move-price {
    color: var(--legion-dark-text);
}

html.legion-dark .ca-price-stab,
html.legion-dark .ca-price-free {
    color: #6dcf6d;
}

html.legion-dark .ca-price-was {
    color: #888;
}

html.legion-dark .ca-clear-search {
    color: var(--legion-dark-accent);
}

html.legion-dark .search-suggestions {
    background: #1a1c1d;
    border-color: #555;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
}

html.legion-dark .search-suggestions button {
    background: #1a1c1d;
    color: var(--legion-dark-text);
}

html.legion-dark .search-suggestions button:hover,
html.legion-dark .search-suggestions button.active {
    background: #323028;
    color: #ffc8c8;
}

/* Type badge pills keep colored backgrounds; only fix light-on-light text hues */
html.legion-dark .ca-type-badge.bg-steel,
html.legion-dark .ca-type-badge.bg-electric,
html.legion-dark .ca-type-badge.bg-ice,
html.legion-dark .ca-type-badge.bg-fairy {
    color: #1a1a1a;
}

/* ==========================================================
   DASHBOARD / ACCOUNT HUB (dashboard.php)
========================================================== */

html.legion-dark .dashboard-hub {
    color: var(--legion-dark-text);
}

html.legion-dark .dashboard-panel-head {
    border-bottom-color: #8d1517;
}

html.legion-dark .dashboard-panel-head h2 {
    color: var(--legion-dark-accent);
}

html.legion-dark .dashboard-news-item {
    background:
        repeating-linear-gradient(0deg, transparent 0 31px, rgba(240, 160, 160, 0.04) 31px 32px),
        var(--legion-dark-surface-2);
    border-color: #555;
    color: var(--legion-dark-text);
}

html.legion-dark .dashboard-news-item--pinned {
    border-color: #866;
    box-shadow: inset 3px 0 0 #c44;
}

html.legion-dark .dashboard-news-item h3 {
    color: var(--legion-dark-accent);
}

html.legion-dark .dashboard-news-date {
    color: var(--legion-dark-muted);
}

html.legion-dark .dashboard-news-body,
html.legion-dark .dashboard-news-item p {
    color: var(--legion-dark-text);
}

html.legion-dark .dashboard-news-body a,
html.legion-dark .dashboard-news-item a {
    color: var(--legion-dark-accent);
}

html.legion-dark .dashboard-side-card {
    background:
        repeating-linear-gradient(0deg, transparent 0 31px, rgba(240, 160, 160, 0.04) 31px 32px),
        var(--legion-dark-surface-2);
    border-color: #340000;
    color: var(--legion-dark-text);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}

html.legion-dark .dashboard-side-title {
    color: var(--legion-dark-accent);
}

html.legion-dark .dashboard-quick-links a {
    background: linear-gradient(#3a3c3e, #2a2c2e);
    border-color: #666;
    color: var(--legion-dark-text);
}

html.legion-dark .dashboard-quick-links a:hover {
    border-color: #c44;
    color: #ffc8c8;
}

html.legion-dark .dashboard-messages {
    border-top-color: #555;
    border-bottom-color: #555;
    color: var(--legion-dark-text);
}

html.legion-dark .dashboard-msg-new {
    color: var(--legion-dark-accent);
}

html.legion-dark .dashboard-msg-inbox {
    color: var(--legion-dark-text);
}

html.legion-dark .dashboard-stat-line {
    color: var(--legion-dark-text);
}

html.legion-dark .dashboard-stat-line a {
    color: var(--legion-dark-accent);
}

html.legion-dark .dashboard-boost-line {
    color: var(--legion-dark-accent);
}

html.legion-dark .dashboard-boost-until {
    color: var(--legion-dark-muted);
}

html.legion-dark .dashboard-promo-label {
    color: var(--legion-dark-accent);
}

html.legion-dark .dashboard-promo-input {
    background: #1a1c1d;
    border-color: #666;
    color: var(--legion-dark-text);
}

html.legion-dark .dashboard-promo-msg {
    color: var(--legion-dark-text);
}

html.legion-dark .dashboard-notice {
    background: var(--crater-notice-bg);
    border-color: var(--crater-notice-border);
    border-left-color: var(--crater-notice-border);
    color: var(--legion-dark-text);
}

/* ==========================================================
   MESSAGES (messages.php) — tabs, split panes, compose
========================================================== */

html.legion-dark .msg-toolbar {
    border-bottom-color: #555;
}

html.legion-dark .msg-tab {
    background: linear-gradient(to bottom, #3a3c3e 0%, #2a2c2e 55%, #222 100%);
    border-color: #666;
    color: #eee;
}

html.legion-dark .msg-tab:hover {
    background: linear-gradient(to bottom, #45474a 0%, #333 55%, #2a2c2e 100%);
    color: #fff;
}

html.legion-dark .msg-tab.active {
    background: linear-gradient(to bottom, #6a1214 0%, #4a0c0e 100%);
    border-color: #888 #888 var(--legion-dark-surface-2);
    color: #f5eaea;
}

html.legion-dark .msg-action-btn {
    background: linear-gradient(to bottom, #3a3c3e 0%, #2a2c2e 100%);
    border-color: #666;
    color: var(--legion-dark-accent);
}

html.legion-dark .msg-action-btn:hover:not(.disabled) {
    background: linear-gradient(to bottom, #45474a 0%, #323436 100%);
    color: #ffc8c8;
}

html.legion-dark .msg-action-btn--delete {
    color: #f0a0a0;
}

html.legion-dark .msg-action-btn.disabled {
    color: #888;
    opacity: 0.7;
}

html.legion-dark .msg-panel-body,
html.legion-dark .msg-split {
    background: var(--legion-dark-surface);
}

html.legion-dark .msg-list-pane {
    background: var(--legion-dark-surface-2);
    border-right-color: #555;
}

html.legion-dark .msg-detail-pane {
    background: var(--legion-dark-surface);
    color: var(--legion-dark-text);
}

html.legion-dark .msg-list-empty,
html.legion-dark .msg-empty-hint,
html.legion-dark .msg-meta-date,
html.legion-dark .msg-read-footer {
    color: var(--legion-dark-muted);
}

html.legion-dark .msg-empty-state {
    background: linear-gradient(to bottom, #2a2c2e 0%, #232526 100%);
    border-color: #555;
    color: var(--legion-dark-text);
}

html.legion-dark .msg-empty-title {
    color: var(--legion-dark-accent);
}

html.legion-dark .msg-item {
    background: var(--legion-dark-surface-2);
    border-bottom-color: #444;
    color: var(--legion-dark-text);
}

html.legion-dark .msg-item:hover {
    background: #323436;
}

html.legion-dark .msg-item.selected,
html.legion-dark .msg-item.msg-unread.selected {
    background: #322828;
    box-shadow: inset 3px 0 0 var(--legion-dark-accent);
}

html.legion-dark .msg-item.msg-unread {
    background: #2e2a22;
}

html.legion-dark .msg-from-label,
html.legion-dark .msg-to-label {
    color: var(--legion-dark-text);
}

html.legion-dark .msg-subject-link,
html.legion-dark .msg-item.msg-unread .msg-subject-link,
html.legion-dark .msg-read-date {
    color: var(--legion-dark-accent);
}

html.legion-dark .msg-read-header {
    border-bottom-color: #555;
}

html.legion-dark .msg-read-subject,
html.legion-dark .msg-read-body,
html.legion-dark .msg-form-table,
html.legion-dark .msg-save-label {
    color: var(--legion-dark-text);
}

html.legion-dark .msg-input,
html.legion-dark .msg-textarea {
    background: #1a1c1d;
    border-color: #666;
    color: var(--legion-dark-text);
}

/* ==========================================================
   MEMBERS DRAWER — view-all Pokémon filters / title
========================================================== */

html.legion-dark #members-drawer .drawer-view-nav a,
html.legion-dark #members-drawer #member-pokemon-back-link {
    color: var(--legion-dark-accent);
}

html.legion-dark #members-drawer .drawer-view-nav a:hover,
html.legion-dark #members-drawer #member-pokemon-back-link:hover {
    color: #ffc8c8;
}

html.legion-dark #members-drawer #member-pokemon-title.profile-title,
html.legion-dark #members-drawer #view-member-pokemon .profile-title {
    color: var(--legion-dark-accent);
}

html.legion-dark .drawer-pokemon-filters,
html.legion-dark #members-drawer .drawer-pokemon-filters {
    background: var(--legion-dark-surface-2);
    border: 1px solid #555;
    color: var(--legion-dark-text);
}

html.legion-dark .drawer-pokemon-filters .drawer-poke-filter-nav,
html.legion-dark #members-drawer .drawer-pokemon-filters .crater-pipe-nav {
    background: transparent;
    border: none;
    color: var(--legion-dark-text);
}

html.legion-dark .drawer-pokemon-filters .drawer-poke-filter-nav strong,
html.legion-dark #members-drawer .drawer-pokemon-filters strong {
    color: var(--legion-dark-text);
}

html.legion-dark .drawer-pokemon-filters .drawer-poke-filter-nav a,
html.legion-dark #members-drawer .drawer-pokemon-filters .drawer-poke-filter-nav a {
    color: var(--legion-chip-text);
}

html.legion-dark .drawer-pokemon-filters .drawer-poke-filter-nav a:hover,
html.legion-dark #members-drawer .drawer-pokemon-filters .drawer-poke-filter-nav a:hover {
    color: #fff;
}

html.legion-dark .drawer-pokemon-filters .drawer-poke-filter-nav a.pipe-active,
html.legion-dark #members-drawer .drawer-pokemon-filters .drawer-poke-filter-nav a.pipe-active,
html.legion-dark #members-drawer .drawer-pokemon-filters .crater-pipe-nav a.pipe-active {
    color: var(--legion-chip-active-text);
}

html.legion-dark .drawer-pokemon-filters .pipe-sep,
html.legion-dark #members-drawer .drawer-pokemon-filters .pipe-sep {
    color: #888;
}

html.legion-dark #members-drawer .drawer-pokemon-empty,
html.legion-dark #members-drawer .drawer-pokemon-grid .members-empty,
html.legion-dark #members-drawer #member-pokemon-status {
    color: var(--legion-dark-muted);
}

html.legion-dark #members-drawer .drawer-pokemon-page-link {
    color: var(--legion-dark-accent);
}

html.legion-dark #members-drawer .drawer-pokemon-page-active {
    color: var(--legion-dark-text);
}


/* ==========================================================
   POKEDEX DETAIL PAGE
========================================================== */

html.legion-dark .dex-detail-section {
    background: var(--legion-dark-surface-2);
    border-color: #555;
    color: var(--legion-dark-text);
}

html.legion-dark .dex-detail-page {
    color: var(--legion-dark-text);
}

/* Header */

html.legion-dark .dex-detail-name,
html.legion-dark .dex-duplicate-title,
html.legion-dark .dex-missing-title,
html.legion-dark .dex-mega-title {
    color: var(--legion-dark-accent);
}

html.legion-dark .dex-detail-number,
html.legion-dark .dex-detail-meta-title,
html.legion-dark .dex-progress-text,
html.legion-dark .dex-ownership-label {
    color: var(--legion-dark-muted);
}

/* Progress */

html.legion-dark .dex-progress-track {
    background: #1a1c1d;
}

html.legion-dark .dex-progress-fill {
    background: linear-gradient(#c44,#8d1517);
}

html.legion-dark .dex-progress-fill.mastered {
    background: linear-gradient(#ffe680,#d9a400);
}

/* Navigation */

html.legion-dark .dex-nav-btn {
    background: linear-gradient(#3a3c3e,#2a2c2e);
    border-color: #666;
    color: var(--legion-dark-text);
}

html.legion-dark .dex-nav-btn:hover:not(:disabled) {
    background: #323436;
    border-color: #c44;
    color: #fff;
}

/* Location cards */

html.legion-dark .dex-location-card {
    background: #262829;
    border-color: #555;
}

html.legion-dark .dex-location-card:hover {
    background: #323436;
    border-color: #777;
}

html.legion-dark .dex-location-name {
    color: var(--legion-dark-accent);
}

html.legion-dark .dex-location-meta,
html.legion-dark .dex-location-message,
html.legion-dark .dex-location-region-title {
    color: var(--legion-dark-muted);
}

html.legion-dark .dex-location-rarity {
    background: #1a1c1d;
    border-color: #555;
    color: var(--legion-dark-text);
}

/* Variant circles */

html.legion-dark .v-none {
    background: #444;
    color: #999;
}

/* Variant filter pills */

html.legion-dark .dex-stats-filter-btn,
html.legion-dark .dex-top-filter-btn{
    background:#323436;
    border:1px solid #555;
    color:var(--legion-dark-text);
}

html.legion-dark .dex-stats-filter-btn:hover,
html.legion-dark .dex-top-filter-btn:hover{
    background:#3b3d3f;
    color:#fff;
}

html.legion-dark .dex-stats-filter-btn.active,
html.legion-dark .dex-top-filter-btn.active{
    background:#8d1517;
    border-color:#b00000;
    color:#fff;
}

/* Ownership */

html.legion-dark .dex-ownership-duplicates,
html.legion-dark .dex-ownership-missing {
    border-left-color: #555;
}

html.legion-dark .dex-empty-message {
    color: var(--legion-dark-muted);
}

html.legion-dark .dex-server-card,
html.legion-dark .dex-server-record{
    background: var(--legion-dark-surface-2);
    border-color:#555;
    color:var(--legion-dark-text);
}

html.legion-dark .dex-server-card:hover,
html.legion-dark .dex-server-record:hover{
    background:#323436;
    border-color:#777;
}

html.legion-dark .dex-top-trainer{
    background:var(--legion-dark-surface-2);
    border-color:#555;
    color:var(--legion-dark-text);
}

html.legion-dark .dex-top-trainer:hover{
    background:#323436;
    border-color:#777;
}

html.legion-dark .dex-evo-card{
    background:var(--legion-dark-surface-2);
    border-color:#555;
    color:var(--legion-dark-text);
}

html.legion-dark .dex-evo-card.current{
    background:#322020;
    border-color:#b00000;
}

html.legion-dark .dex-learnset-header{
    background:#323436;
    border-color:#555;
    color:var(--legion-dark-accent);
}

html.legion-dark .dex-learnset-header:hover{
    background:#3b3d3f;
}

html.legion-dark .dex-learnset-level-badge{
    background:#444;
    color:#fff;
}

html.legion-dark .dex-learnset-row{
    border-bottom-color:#444;
}

html.legion-dark .dex-learnset-name,
html.legion-dark .dex-learnset-move,
html.legion-dark .dex-learnset-row a{
    color: var(--legion-dark-text);
}

html.legion-dark .dex-learnset-row a:hover{
    color: var(--legion-dark-accent);
}

html.legion-dark .dex-evolution-method{
    background:#323436;
    border-color:#555;
    color:var(--legion-dark-text);
}


/* ==========================================================
   POKEDEX TEXT
========================================================== */

html.legion-dark .dex-overall-title,
html.legion-dark .dex-gen-title,
html.legion-dark .dex-location-name,
html.legion-dark .dex-detail-name,
html.legion-dark .dex-duplicate-title,
html.legion-dark .dex-missing-title,
html.legion-dark .dex-section-title,
html.legion-dark .dex-top-name,
html.legion-dark .dex-search-name{
    color: var(--legion-dark-accent);
}

html.legion-dark .dex-gen-label,
html.legion-dark .dex-detail-number,
html.legion-dark .dex-detail-meta-title,
html.legion-dark .dex-location-meta,
html.legion-dark .dex-search-meta,
html.legion-dark .dex-overall-header,
html.legion-dark .dex-progress-text,
html.legion-dark .dex-server-label,
html.legion-dark .dex-top-meta{
    color: var(--legion-dark-muted);
}

html.legion-dark .dex-gen-percent,
html.legion-dark .dex-gen-values,
html.legion-dark .dex-server-value,
html.legion-dark .dex-detail-number,
html.legion-dark .dex-overall-header span{
    color: var(--legion-dark-text);
}

html.legion-dark .dex-item-name{
    color: var(--legion-dark-accent);
}

html.legion-dark .dex-form-base,
html.legion-dark .dex-form-base a{
    color: var(--legion-dark-muted);
}

html.legion-dark .dex-form-base a:hover{
    color: #ffc8c8;
}

html.legion-dark .dex-top-exp{
    color: var(--legion-dark-text);
}


/* ==========================================================
   SAFE WHITE-PANEL FALLBACKS (inside main chrome)
========================================================== */

html.legion-dark .crater-inner-box .white-box,
html.legion-dark .crater-inner-box .content-box,
html.legion-dark .crater-inner-box .info-panel,
html.legion-dark .crater-inner-box .light-panel,
html.legion-dark .crater-panel-body .white-box,
html.legion-dark .crater-panel-body .content-box {
    background-color: var(--legion-dark-surface-2);
    border-color: #555;
    color: var(--legion-dark-text);
}

/* Inline cream/white surfaces that pages still hardcode */
html.legion-dark .crater-inner-box [style*="background:#fff"],
html.legion-dark .crater-inner-box [style*="background: #fff"],
html.legion-dark .crater-inner-box [style*="background:#ffffff"],
html.legion-dark .crater-inner-box [style*="background: #ffffff"],
html.legion-dark .crater-inner-box [style*="background:#f5f5f5"],
html.legion-dark .crater-inner-box [style*="background: #f5f5f5"],
html.legion-dark .crater-inner-box [style*="background:#fafafa"],
html.legion-dark .crater-inner-box [style*="background: #fafafa"] {
    background-color: var(--legion-dark-surface-2) !important;
    color: var(--legion-dark-text);
}

/* —— Theme toggle control —— */

.legion-theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin: 0;
    padding: 4px 8px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.2);
    color: #fff;
    font-family: Verdana, Arial, sans-serif;
    font-size: 12px;
    font-weight: bold;
    line-height: 1.2;
    cursor: pointer;
    vertical-align: middle;
}

.legion-theme-toggle:hover,
.legion-theme-toggle:focus-visible {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.55);
    outline: none;
}

.legion-theme-toggle-icon {
    font-size: 13px;
    line-height: 1;
}

html.legion-dark .legion-theme-toggle {
    background: rgba(255, 255, 255, 0.1);
}

@media (max-width: 620px) {
    .legion-theme-toggle-label {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
    }

    .legion-theme-toggle {
        min-height: var(--crater-touch-target, 44px);
        min-width: var(--crater-touch-target, 44px);
        justify-content: center;
        padding: 8px;
    }
}

/* Re-assert variant card fills/fg after dark-mode card/meta greys (loads after style.css). */
html.legion-dark #members-drawer .drawer-pokemon-card.encounter-variant--dark,
html.legion-dark #members-drawer .drawer-team-item.encounter-variant--dark,
html.legion-dark .yt-poke-card.encounter-variant--dark,
html.legion-dark .yp-poke-card.encounter-variant--dark,
html.legion-dark .ct-poke-card.encounter-variant--dark,
html.legion-dark .prof-pokemon-card.encounter-variant--dark,
html.legion-dark tr.encounter-variant--dark > td,
html.legion-dark tr.encounter-variant--dark:nth-child(even) > td {
    background: var(--poke-variant-dark-bg);
    border-color: var(--poke-variant-dark-border);
    color: var(--poke-variant-dark-fg);
}

html.legion-dark #members-drawer .drawer-pokemon-card.encounter-variant--cosmic,
html.legion-dark #members-drawer .drawer-team-item.encounter-variant--cosmic,
html.legion-dark .yt-poke-card.encounter-variant--cosmic,
html.legion-dark .yp-poke-card.encounter-variant--cosmic,
html.legion-dark .ct-poke-card.encounter-variant--cosmic,
html.legion-dark .prof-pokemon-card.encounter-variant--cosmic,
html.legion-dark tr.encounter-variant--cosmic > td,
html.legion-dark tr.encounter-variant--cosmic:nth-child(even) > td {
    background: var(--poke-variant-cosmic-bg);
    border-color: var(--poke-variant-cosmic-border);
    color: var(--poke-variant-cosmic-fg);
}

html.legion-dark #members-drawer .drawer-pokemon-card.encounter-variant--ghostly,
html.legion-dark #members-drawer .drawer-team-item.encounter-variant--ghostly,
html.legion-dark .yt-poke-card.encounter-variant--ghostly,
html.legion-dark .yp-poke-card.encounter-variant--ghostly,
html.legion-dark .ct-poke-card.encounter-variant--ghostly,
html.legion-dark .prof-pokemon-card.encounter-variant--ghostly,
html.legion-dark tr.encounter-variant--ghostly > td,
html.legion-dark tr.encounter-variant--ghostly:nth-child(even) > td {
    background: var(--poke-variant-ghostly-bg);
    border-color: var(--poke-variant-ghostly-border);
    color: var(--poke-variant-ghostly-fg);
}

html.legion-dark .encounter-variant--dark .member-card-name,
html.legion-dark .encounter-variant--dark a.member-card-name,
html.legion-dark .encounter-variant--dark .yt-poke-meta,
html.legion-dark .encounter-variant--dark .yp-poke-meta,
html.legion-dark .encounter-variant--dark .ct-poke-meta,
html.legion-dark .encounter-variant--dark .yt-poke-moves,
html.legion-dark .encounter-variant--dark .yp-poke-moves,
html.legion-dark #members-drawer .encounter-variant--dark .drawer-pokemon-card-name,
html.legion-dark #members-drawer .encounter-variant--dark .drawer-pokemon-card-meta,
html.legion-dark #members-drawer .encounter-variant--dark .drawer-pkmn-name,
html.legion-dark #members-drawer .encounter-variant--dark .drawer-pkmn-meta,
html.legion-dark #members-drawer .encounter-variant--dark .drawer-pkmn-exp,
html.legion-dark .view-pokemon-table tr.encounter-variant--dark .roster-pkmn-name {
    color: var(--poke-variant-dark-fg);
}

html.legion-dark .encounter-variant--cosmic .member-card-name,
html.legion-dark .encounter-variant--cosmic a.member-card-name,
html.legion-dark .encounter-variant--cosmic .yt-poke-meta,
html.legion-dark .encounter-variant--cosmic .yp-poke-meta,
html.legion-dark .encounter-variant--cosmic .ct-poke-meta,
html.legion-dark .encounter-variant--cosmic .yt-poke-moves,
html.legion-dark .encounter-variant--cosmic .yp-poke-moves,
html.legion-dark #members-drawer .encounter-variant--cosmic .drawer-pokemon-card-name,
html.legion-dark #members-drawer .encounter-variant--cosmic .drawer-pokemon-card-meta,
html.legion-dark #members-drawer .encounter-variant--cosmic .drawer-pkmn-name,
html.legion-dark #members-drawer .encounter-variant--cosmic .drawer-pkmn-meta,
html.legion-dark #members-drawer .encounter-variant--cosmic .drawer-pkmn-exp,
html.legion-dark .view-pokemon-table tr.encounter-variant--cosmic .roster-pkmn-name {
    color: var(--poke-variant-cosmic-fg);
}

html.legion-dark .encounter-variant--ghostly .member-card-name,
html.legion-dark .encounter-variant--ghostly a.member-card-name,
html.legion-dark .encounter-variant--ghostly .yt-poke-meta,
html.legion-dark .encounter-variant--ghostly .yp-poke-meta,
html.legion-dark .encounter-variant--ghostly .ct-poke-meta,
html.legion-dark .encounter-variant--ghostly .yt-poke-moves,
html.legion-dark .encounter-variant--ghostly .yp-poke-moves,
html.legion-dark #members-drawer .encounter-variant--ghostly .drawer-pokemon-card-name,
html.legion-dark #members-drawer .encounter-variant--ghostly .drawer-pokemon-card-meta,
html.legion-dark #members-drawer .encounter-variant--ghostly .drawer-pkmn-name,
html.legion-dark #members-drawer .encounter-variant--ghostly .drawer-pkmn-meta,
html.legion-dark #members-drawer .encounter-variant--ghostly .drawer-pkmn-exp,
html.legion-dark .view-pokemon-table tr.encounter-variant--ghostly .roster-pkmn-name {
    color: var(--poke-variant-ghostly-fg);
}
