:root {
  --game-surface:#0b1821;
  --game-surface-raised:#0e1d27;
  --game-surface-input:#08141d;
  --game-surface-control:#10212d;
  --game-border:rgba(255,255,255,.085);
  --game-text:#e8edf1;
  --game-muted:#87949e;
}

/* The Unified option also carries the Rankings palette into the app shell. */
html[data-game-theme="unified"] {
  --bg:#071119;
  --panel:#0b1821;
  --panel2:#0e1d27;
  --line:rgba(255,255,255,.085);
  --gold:#e5b04d;
  --gold2:#ffd476;
  --blue:#51aaff;
  --green:#3ed884;
  --red:#ff6d79;
  --text:#e8edf1;
  --muted:#87949e;
}

/* Rankings ships with the Unified palette internally. Remap it in Classic mode. */
html[data-game-theme="classic"] #ranking .ranking-root {
  --rank-bg:var(--bg);
  --rank-panel:#0c141b;
  --rank-panel-2:#101a23;
  --rank-line:rgba(255,255,255,.085);
  --rank-text:var(--text);
  --rank-muted:var(--muted);
  --rank-gold:var(--gold);
  --rank-gold-bright:var(--gold2);
  --rank-green:var(--green);
  --rank-red:var(--red);
  --rank-blue:var(--blue);
}

html[data-game-theme="classic"] #ranking :where(
  .ranking-tabs,
  .ranking-card,
  .ranking-simple-card,
  .ranking-hof-empty
) {
  background:var(--rank-panel) !important;
  border-color:var(--rank-line) !important;
}

html[data-game-theme="classic"] #ranking :where(
  .ranking-podium-panel,
  .ranking-trophy-card
) {
  background:linear-gradient(180deg,rgba(13,22,29,.97),rgba(7,13,18,.97)) !important;
  border-color:var(--rank-line) !important;
}

html[data-game-theme="classic"] #ranking :where(
  .ranking-refresh,
  .ranking-page-btn,
  .ranking-archive-close,
  .ranking-tiny-avatar,
  .ranking-insight,
  .ranking-active-player,
  .ranking-search,
  .ranking-archive-table-wrap
) {
  background-color:var(--rank-panel-2) !important;
  border-color:var(--rank-line) !important;
}

html[data-game-theme="classic"] #ranking .ranking-climb-strip {
  background:linear-gradient(90deg,rgba(93,178,255,.075),rgba(12,20,27,.90)) !important;
  border-color:rgba(93,178,255,.24) !important;
}

html[data-game-theme="classic"] #ranking .ranking-tab.active {
  color:#17120a;
  border-color:var(--gold2);
  background:linear-gradient(180deg,var(--gold2),#b97826);
  box-shadow:0 6px 18px rgba(220,166,74,.16);
}

html[data-game-theme="classic"] #ranking .ranking-table tbody tr.me {
  background:linear-gradient(90deg,rgba(93,178,255,.13),rgba(93,178,255,.025));
  box-shadow:inset 3px 0 0 var(--blue);
}

html[data-game-theme="classic"] #ranking .ranking-archive-modal {
  color:var(--text);
  background:var(--rank-bg) !important;
  border-color:rgba(220,166,74,.34) !important;
}

html[data-game-theme="classic"] #ranking .ranking-archive-head {
  background:var(--rank-panel) !important;
  border-color:var(--rank-line) !important;
}

html[data-game-theme="classic"] #ranking :where(
  .ranking-title,
  .ranking-card-title,
  .ranking-player-name,
  .ranking-party-name,
  .ranking-archive-title,
  .ranking-archive-player
) {
  color:var(--text);
}

html[data-game-theme="classic"] #ranking :where(
  .ranking-subtitle,
  .ranking-card-sub,
  .ranking-card-meta,
  .ranking-muted,
  .ranking-empty,
  .ranking-archive-sub
) {
  color:var(--muted);
}

/* Shared neutral surfaces. No layout or sizing properties belong in this file. */
html[data-game-theme="unified"] .section :where(
  .admin-main,.admin-side,.admin-card,.admin-table-wrap,.admin-fund-stock-list,.admin-icon-list,
  .market-admin-section,.market-pace-card,.system-history-list,
  .asset-card,.assets-panel,
  .forum-head,.forum-card,.forum-panel,.forum-admin-box,
  .goods-panel,.goods-stat-card,.goods-summary,.goods-collection-card,.goods-item-card,.goods-trophy-requirements,
  .guide-top,.guide-copy-panel,.guide-visual-panel,.guide-visual-card,
  .hire-card,.hire-table-wrap,
  .court-shell,.court-head,.court-card,.court-panel,
  .loan-shell,.loan-card,
  .lottery-root,.lottery-hero,.lottery-card,.lottery-panel,.lottery-table-wrap,
  .mail-root,.mail-panel,.mail-folder-panel,.mail-card,.mail-compose,.mail-reader,
  .news-filter-bar,.news-impact-panel,.news-movers-panel,.news-panel,.news-card,
  .overview-hero,.overview-top-strip,.ov-card,.overview-panel,
  .party-root,.party-hero,.party-card,
  .police-wrap,.police-card,.police-panel,.police-table-wrap,
  .profile-shell,.profile-hero,.profile-card,
  .stocks-root,.stocks-c-panel,.stocks-c-card,.stocks-c-cathead,.stocks-c-dialog,.stocks-c-funds,.stocks-c-funds-head,.stocks-c-fund-card,.stocks-c-mhead,
  .tx-shell,.tx-controls,.tx-table-wrap
) {
  background-color:var(--game-surface) !important;
  background-image:none !important;
  border-color:var(--game-border) !important;
  color:var(--game-text);
}

/* Smaller surfaces nested inside the main panels. */
html[data-game-theme="unified"] .section :where(
  .admin-field,.admin-fund-stock,.admin-icon-choice,.admin-legacy-row,.market-danger-box,.market-explain,.market-logic-toggle,.market-pace-metrics,.market-status-item,.market-tool-note,
  .asset-chip,.assets-legacy-item,
  .forum-cat,.forum-stat,.forum-thread,
  .goods-toolbar,.goods-metric,.goods-price-box,.goods-item-actions,
  .guide-board,.guide-flow,.guide-footer,.guide-hint,.guide-list,
  .hire-field,.hire-option,.hire-pending-item,.hire-stat,.hire-table,
  .court-case-row,.court-chat,.court-evidence-row,.court-help,.court-kv,.court-log-row,.court-notice,.court-statement-row,.court-tools,.court-verdict-row,
  .loan-app-row,.loan-form,.loan-kpi,.loan-note,.loan-row-list,.loan-stat,
  .lottery-actions,.lottery-prize,.lottery-table,
  .mail-attach-compose,.mail-attachments,.mail-filter-row,.mail-folder-note,.mail-kpi,.mail-list,.mail-reader-empty,.mail-row,.mail-toolbar,
  .news-mover-row,.news-stat,.news-toolbar,.news-window-toggle,
  .ov-spark,.ov-you,
  .party-compact-box,.party-kpi,.party-post,.party-rule,.party-table,
  .police-divider,.police-empty,.police-field,.police-stat,.police-table,
  .profile-bio,.profile-danger-zone,.profile-kpi,.profile-legacy-item,.profile-mini-row,.profile-note,.profile-row,.profile-rows,
  .stocks-c-box,.stocks-c-move,.stocks-c-movebox,.stocks-c-mpanel,.stocks-c-prev,.stocks-c-stat,.stocks-c-fund-basket,.stocks-c-fund-row,.stocks-c-chartwrap,.stocks-c-spark,.stocks-c-tabs,
  .tx-stat,.tx-table
) {
  background-color:var(--game-surface-raised) !important;
  background-image:none !important;
  border-color:var(--game-border) !important;
  color:var(--game-text);
}

html[data-game-theme="unified"] .section :where(
  input:not([type="checkbox"]):not([type="radio"]),
  select,
  textarea
) {
  background-color:var(--game-surface-input) !important;
  background-image:none !important;
  border-color:var(--game-border) !important;
  color:var(--game-text) !important;
}

/* Neutral controls only. Semantic primary, danger, buy, and sell controls keep their colors. */
html[data-game-theme="unified"] .section :where(
  .admin-btn,.forum-btn,.guide-btn,.hire-btn,.court-button,.loan-btn,.lottery-btn,.mail-btn,.party-btn,.police-btn,.profile-btn,.stocks-c-btn,.tx-btn
):not(.primary):not(.danger):not(.good):not(.bad):not(.buy):not(.sell):not(.active) {
  background-color:var(--game-surface-control) !important;
  background-image:none !important;
  border-color:var(--game-border) !important;
  color:var(--game-text);
}

html[data-game-theme="unified"] .section :where(
  .admin-tab,.forum-tab,.court-tab,.loan-tab,.mail-tab,.party-tab,.police-tab,.stocks-c-catbtn
):not(.active):not(.selected) {
  background-color:transparent !important;
  background-image:none !important;
  border-color:var(--game-border) !important;
  color:var(--game-muted) !important;
}

html[data-game-theme="unified"] .section :where(table) {
  border-color:var(--game-border);
}

html[data-game-theme="unified"] .section :where(th,td) {
  border-color:var(--game-border) !important;
}

html[data-game-theme="unified"] .section :where(.muted,.ranking-muted) {
  color:var(--game-muted);
}
