/* Shared site theme. The original dark palette remains the default. */
:root { color-scheme: dark; }
.topbar-side .theme-toggle { width: 36px; height: 36px; flex: 0 0 36px; }
.theme-toggle > span { display: grid; place-items: center; }
.theme-toggle .theme-icon-dark { display: none; }
:root[data-theme="light"] .theme-toggle .theme-icon-light { display: none; }
:root[data-theme="light"] .theme-toggle .theme-icon-dark { display: grid; }
@media (max-width: 600px) {
    .topbar-side .theme-toggle { position: absolute; top: 10px; right: calc(var(--gutter) + 48px); }
    .topbar-inner > .brand { padding-right: 96px; }
}

/* Silver surfaces, graphite text and crimson actions match the launcher. */
:root[data-theme="light"] {
    color-scheme: light;
    --bg: #e7eaeb;
    --bg-deep: #dce1e3;
    --surface: #f5f6f6;
    --surface-raised: #fff;
    --surface-sunken: #fafbfb;
    --surface-glow: #e1e6e8;
    --surface-2: #fff;
    --ink: #22282c;
    --ink-2: #38444b;
    --ink-muted: #59656b;
    --ink-subtle: #626f76;
    --text-muted: #59656b;
    --bone: #22282c;
    --bone-dim: #59656b;
    --crimson: #a72b31;
    --crimson-hot: #b32d39;
    --crimson-dark: #7d2028;
    --crimson-soft: #a72b310c;
    --crimson-glow: transparent;
    --gold: #77541d;
    --gold-bright: #704b10;
    --gold-dark: #795d2c;
    --gold-soft: #79531f0d;
    --gold-glow: transparent;
    --rule: #c2c9cc;
    --rule-strong: #79878e;
    --rule-gold: #a18b62;
    --teal: #216957;
    --chrome: #4c5c65;
    --chrome-bright: #313d45;
    --chrome-edge: #79878e;
    --success: #286449;
    --success-soft: #2864490f;
    --danger: #a72b31;
    --danger-soft: #a72b310f;
    --warning: #79531f;
    --warning-soft: #79531f0f;
    --shadow-1: 0 2px 10px #22282c12;
    --shadow-2: 0 14px 34px #22282c1a;
    --shadow-hover: 0 8px 22px #22282c1c, 0 0 0 1px var(--rule-strong);
    --shadow-surface: inset 0 1px 0 #fff, 0 2px 3px #22282c0a, 0 12px 28px -16px #22282c30;
    --shadow-control: inset 0 1px 0 #fff, 0 2px 0 #b9c0c4, 0 5px 10px #22282c0c;
}
:root[data-theme="light"] body { background: var(--bg); color: var(--ink); }
:root[data-theme="light"] ::selection { background: #a72b31; color: #fff; }
:root[data-theme="light"] :is(input, textarea)::placeholder { color: #647178; }
:root[data-theme="light"] :is(input, select, textarea) { accent-color: var(--crimson); }

/* Global chrome and controls, including mobile navigation. */
:root[data-theme="light"] .page-shell > .topbar {
    background: #f5f6f6f5;
    border-color: var(--rule);
    box-shadow: inset 0 1px 0 #fff, 0 4px 16px #22282c12;
}
:root[data-theme="light"] .brand-mark { color: #313d45; text-shadow: 0 1px 0 #fff, 0 2px 1px #79878e30; }
:root[data-theme="light"] .nav { border-color: var(--rule); }
:root[data-theme="light"] .nav a { color: var(--ink-2); border-color: #c2c9cc66; }
:root[data-theme="light"] body[data-page] .nav a[aria-current="page"] { color: var(--ink); background: #dce1e366; }
:root[data-theme="light"] .nav a::after { background: var(--crimson); }
:root[data-theme="light"] .nav a:hover { color: var(--ink); background: #dce1e366; }
:root[data-theme="light"] .language-option.is-active { background: #e1e6e8; }
:root[data-theme="light"] :is(.secondary-button, .icon-button) {
    background: linear-gradient(180deg, #fff, #eef1f2);
    border-color: #c2c9cc #b4bec3 #98a5ac;
    color: var(--ink-2);
    box-shadow: var(--shadow-control);
}
:root[data-theme="light"] :is(.secondary-button, .icon-button):hover {
    background: #fff;
    border-color: var(--chrome-edge);
    color: var(--ink);
    box-shadow: var(--shadow-control);
}
:root[data-theme="light"] :is(.tab-button, .rating-nav-button).is-active {
    background: linear-gradient(180deg, #fff, #e1e6e8);
    color: var(--ink);
    border-color: var(--chrome-edge);
    box-shadow: inset 0 1px #fff, inset 0 -2px var(--crimson), 0 3px 8px #22282c10;
}
:root[data-theme="light"] :is(.primary-button, .admin-balance-editor .admin-balance-apply):hover {
    background: #ba343d;
    color: #fff;
}
:root[data-theme="light"] :is(.primary-button, .secondary-button, .icon-button, .auction-action):not(:disabled):active {
    box-shadow: inset 0 2px 5px #22282c20, 0 1px 0 #b9c0c4;
}
:root[data-theme="light"] :is(.primary-button, .secondary-button, .icon-button, .auction-action):is(:disabled, [aria-disabled="true"]) { box-shadow: none; }
:root[data-theme="light"] .site-footer { background: #dce1e3; box-shadow: inset 0 1px #fff8; }
:root[data-theme="light"] ::-webkit-scrollbar-thumb { background: #89969d; }
:root[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: #65757d; }

/* Text remains dark on light panels; artwork itself is never inverted. */
:root[data-theme="light"] :is(.discovery-card, .atlas-card) { background: var(--surface); box-shadow: var(--shadow-surface); }
:root[data-theme="light"] :is(.discovery-card, .atlas-card):hover { background: #fff; box-shadow: var(--shadow-hover); }
:root[data-theme="light"] :is(.auth-panel, .balance-panel) { background: linear-gradient(155deg, #fff, var(--surface) 65%); }
:root[data-theme="light"] .atlas-search { box-shadow: inset 0 2px 5px #22282c0a, 0 1px #fff; }
:root[data-theme="light"] :is(.auth-form, .drop-search, .auction-field) input:focus { box-shadow: inset 0 2px 5px #22282c12; }
:root[data-theme="light"] .balance-display strong { text-shadow: none; }
:root[data-theme="light"] .hero-actions .secondary-button { background: #f5f6f6eb; }

/* Legacy panels had literal dark backgrounds instead of shared variables. */
:root[data-theme="light"] :is(
    .server-offer-panel, .server-offer-panel--accent, .server-offer-panel--autosell, .server-offer-panel--ammo,
    .autosell-drop-preview, .ammo-system-class, .download-launch-card, .pet-builder,
    .pet-equipment-list li, .pet-stat-grid li, .pet-gear-card,
    .transformation-grade, .transformation-card, .transformation-viewer,
    .admin-balance-overview span, .admin-balance-account-line,
    .operator-gifts__head [data-operator-status], .operator-gift-card, .operator-player-row,
    .operator-balance-target, .operator-preset__pick, .admin-character-item, .admin-pet-roll-editor,
    .admin-referral-meta > span, .admin-referral-reward-row, .admin-silver-summary__meta,
    .admin-silver-metrics span, .admin-silver-snapshot, .admin-empty-state, .games-visual-wrap
) { background: var(--surface); }
:root[data-theme="light"] :is(
    .autosell-drop-steps span, .ammo-system-badges span, .ammo-item, .pet-gear-card > span,
    .monster-row-drop-details, .monster-profile-drops, .monster-characteristic, .monster-loot-card,
    .item-set-item, .item-set-effect-list, .admin-pet-roll-stat.is-inactive
) { background: #dce1e34d; }
:root[data-theme="light"] :is(.monster-loot-card:hover, .item-set-item:hover, .admin-character-item--equipped) { background: var(--gold-soft); }
:root[data-theme="light"] :is(.monster-loot-icon, .monster-row-drop-icon, .monster-profile-drop-item .monster-loot-icon, .ammo-item-icon) { background: #dce1e3; }
:root[data-theme="light"] .monster-drop-search input { background: var(--surface-sunken); }
:root[data-theme="light"] .monster-loot-card.is-blessed { background: linear-gradient(90deg, var(--gold-soft), var(--surface-sunken) 58%); }
:root[data-theme="light"] .monster-loot-meter { background: var(--rule); }
:root[data-theme="light"] .enhancement-material-count { background: #f5f6f6f2; }
:root[data-theme="light"] .auction-action:not(:disabled):not(.is-own) {
    color: #fff;
    background: #a72b31;
    border-color: #b74c52 #98282f #7d2028;
    box-shadow: inset 0 1px #ffffff20, 0 2px #7d2028, 0 5px 12px #22282c12;
}
:root[data-theme="light"] .auction-action:not(:disabled):not(.is-own):hover { background: #ba343d; }
:root[data-theme="light"] :is(.item-set-admin-status.is-error, .item-set-card--site-hidden .item-set-site-badge) { color: var(--danger); }

/* Rarity families stay distinct, with stronger text contrast on silver. */
:root[data-theme="light"] .pet-equipment-page {
    --pet-paper: #fff;
    --pet-paper-soft: #eef1f2;
    --pet-ink: #22282c;
    --pet-ink-2: #38444b;
    --pet-ink-muted: #59656b;
}
:root[data-theme="light"] .pet-result-panel { background: linear-gradient(180deg, var(--result-soft), transparent), #fff; }
:root[data-theme="light"] .pet-rarity-card__body { background: linear-gradient(180deg, #fff, var(--pet-paper-soft)); }
:root[data-theme="light"] .pet-rarity-card summary { background: linear-gradient(180deg, var(--rarity-soft), transparent), var(--surface); }
:root[data-theme="light"] :is(.pet-choice small, .pet-rarity-card__lines) { color: var(--ink-muted); }
:root[data-theme="light"] .pet-rarity { background: var(--surface-sunken); }
:root[data-theme="light"] .pet-rarity--normal { color: #495d69; }
:root[data-theme="light"] .pet-rarity--rare { color: #245ea3; }
:root[data-theme="light"] .pet-rarity--epic { color: #7444b5; }
:root[data-theme="light"] .pet-rarity--legendary { color: #875013; }
:root[data-theme="light"] .pet-rarity--mythic { color: #a02985; }
:root[data-theme="light"] :is(.transformation-grade, .transformation-viewer) { --grade-accent: #495d69; }
:root[data-theme="light"] :is(.transformation-grade--rare, .transformation-viewer[data-grade="rare"]) { --grade-accent: #245ea3; }
:root[data-theme="light"] :is(.transformation-grade--epic, .transformation-viewer[data-grade="epic"]) { --grade-accent: #7444b5; }
:root[data-theme="light"] :is(.transformation-grade--legendary, .transformation-viewer[data-grade="legendary"]) { --grade-accent: #875013; }
:root[data-theme="light"] :is(.transformation-grade--mythic, .transformation-viewer[data-grade="mythic"]) { --grade-accent: #a02985; }
:root[data-theme="light"] :is(.transformation-card__media, .transformation-viewer__media) { background: linear-gradient(135deg, var(--grade-soft), transparent 55%), #dce1e3; }
:root[data-theme="light"] .transformation-viewer__close { background: #f5f6f6ee; color: var(--ink); }
