/* Shared colors. Game attributes, card samples and model textures keep their own colors. */
:root {
  color-scheme: dark;
  --shell-bg-0: #101619;
  --shell-bg-1: #171f23;
  --shell-bg-2: #202b2f;
  --shell-panel: #171f23;
  --shell-panel-strong: #1d282c;
  --shell-panel-soft: #1b2529;
  --shell-field: #10191b;
  --shell-line: #2f3e40;
  --shell-line-strong: #53665e;
  --shell-text: #e8eeed;
  --shell-muted: #a8b8b4;
  --shell-accent: #9bd8bb;
  --shell-accent-2: #b5dbc9;
  --shell-accent-soft: #233a31;
  --shell-accent-border: #4a7861;
  --shell-on-accent: #152c22;
  --shell-good: #98dab1;
  --shell-good-soft: #203b2c;
  --shell-good-border: #416b50;
  --shell-warn: #e6c57c;
  --shell-warn-soft: #3c321e;
  --shell-warn-border: #79613a;
  --shell-danger: #f0a3a9;
  --shell-danger-soft: #41262d;
  --shell-danger-border: #82515c;
  --shell-info: #a8c8ee;
  --shell-info-soft: #233448;
  --shell-info-border: #4b6a8e;
  --shell-special: #d3b7eb;
  --shell-special-soft: #352b44;
  --shell-special-border: #725c8a;
  --shell-shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
  --shell-backdrop: rgba(0, 0, 0, 0.64);
}

:root[data-theme="light"] {
  color-scheme: light;
  --shell-bg-0: #f3f6f4;
  --shell-bg-1: #edf3ef;
  --shell-bg-2: #e3ece6;
  --shell-panel: #ffffff;
  --shell-panel-strong: #edf3ef;
  --shell-panel-soft: #f5f8f6;
  --shell-field: #ffffff;
  --shell-line: #d2ddd6;
  --shell-line-strong: #80968a;
  --shell-text: #22332c;
  --shell-muted: #52685c;
  --shell-accent: #246b4e;
  --shell-accent-2: #285c47;
  --shell-accent-soft: #e3f1e9;
  --shell-accent-border: #6b9f82;
  --shell-on-accent: #ffffff;
  --shell-good: #216647;
  --shell-good-soft: #e4f2e9;
  --shell-good-border: #82ad92;
  --shell-warn: #81560e;
  --shell-warn-soft: #fbf0d9;
  --shell-warn-border: #c2a26a;
  --shell-danger: #a82c39;
  --shell-danger-soft: #fbe9ec;
  --shell-danger-border: #ce8b95;
  --shell-info: #285eaa;
  --shell-info-soft: #e9f0fc;
  --shell-info-border: #8ea9d4;
  --shell-special: #7750a5;
  --shell-special-soft: #f1eafa;
  --shell-special-border: #b29bc9;
  --shell-shadow: 0 16px 40px rgba(34, 51, 44, 0.09);
  --shell-backdrop: rgba(27, 38, 33, 0.4);
}

:root[data-theme="dark"][data-palette="sky"] {
  --shell-bg-0: #10151e;
  --shell-bg-1: #181f2c;
  --shell-bg-2: #232e40;
  --shell-panel: #181f2c;
  --shell-panel-strong: #202b3b;
  --shell-panel-soft: #1d2735;
  --shell-field: #111a29;
  --shell-line: #334157;
  --shell-line-strong: #5b7292;
  --shell-text: #e5edf8;
  --shell-muted: #a9bbd3;
  --shell-accent: #a4c7ff;
  --shell-accent-2: #bcd3f4;
  --shell-accent-soft: #253d60;
  --shell-accent-border: #547caf;
  --shell-on-accent: #162941;
}
:root[data-theme="light"][data-palette="sky"] {
  --shell-bg-0: #f2f5fa;
  --shell-bg-1: #eaf0f8;
  --shell-bg-2: #e0e8f3;
  --shell-panel-strong: #eaf0f8;
  --shell-panel-soft: #f5f7fc;
  --shell-line: #d2ddeb;
  --shell-line-strong: #8295b0;
  --shell-text: #233047;
  --shell-muted: #52657f;
  --shell-accent: #285eaa;
  --shell-accent-2: #244e8b;
  --shell-accent-soft: #e4edfc;
  --shell-accent-border: #789bd0;
}
:root[data-theme="dark"][data-palette="amber"] {
  --shell-bg-0: #1b1712;
  --shell-bg-1: #252019;
  --shell-bg-2: #332b20;
  --shell-panel: #252019;
  --shell-panel-strong: #2f281e;
  --shell-panel-soft: #2b251c;
  --shell-field: #1d1811;
  --shell-line: #493c2a;
  --shell-line-strong: #877251;
  --shell-text: #f0e6d6;
  --shell-muted: #c2b49e;
  --shell-accent: #e5c07b;
  --shell-accent-2: #efd6a7;
  --shell-accent-soft: #46351c;
  --shell-accent-border: #947444;
  --shell-on-accent: #30210e;
}
:root[data-theme="light"][data-palette="amber"] {
  --shell-bg-0: #faf6ef;
  --shell-bg-1: #f5ecdf;
  --shell-bg-2: #eee1cd;
  --shell-panel: #fffdfa;
  --shell-panel-strong: #f5ecdf;
  --shell-panel-soft: #fbf7f0;
  --shell-field: #fffdfa;
  --shell-line: #e1d3bc;
  --shell-line-strong: #aa9270;
  --shell-text: #3c3021;
  --shell-muted: #756046;
  --shell-accent: #8b570e;
  --shell-accent-2: #774c12;
  --shell-accent-soft: #f8ebd4;
  --shell-accent-border: #b28a4e;
}
:root[data-theme="dark"][data-palette="rose"] {
  --shell-bg-0: #1c141c;
  --shell-bg-1: #281d28;
  --shell-bg-2: #372735;
  --shell-panel: #281d28;
  --shell-panel-strong: #332532;
  --shell-panel-soft: #2d212d;
  --shell-field: #211620;
  --shell-line: #4d3748;
  --shell-line-strong: #8c6580;
  --shell-text: #f2e7ee;
  --shell-muted: #c6adbe;
  --shell-accent: #e5a9c9;
  --shell-accent-2: #efc2db;
  --shell-accent-soft: #4a2c3e;
  --shell-accent-border: #a36d8c;
  --shell-on-accent: #351c2b;
}
:root[data-theme="light"][data-palette="rose"] {
  --shell-bg-0: #f9f3f6;
  --shell-bg-1: #f6eaf1;
  --shell-bg-2: #efdfE8;
  --shell-panel: #fffdfd;
  --shell-panel-strong: #f6eaf1;
  --shell-panel-soft: #fcf7fa;
  --shell-field: #fffdfd;
  --shell-line: #e4d2df;
  --shell-line-strong: #b18bA2;
  --shell-text: #402c38;
  --shell-muted: #795c6d;
  --shell-accent: #a1386a;
  --shell-accent-2: #873259;
  --shell-accent-soft: #f8e5ef;
  --shell-accent-border: #bd7c9e;
}

/* Native controls, focus and selection follow the same palette on every page. */
html { accent-color: var(--shell-accent); background: var(--shell-bg-0); }
::selection { color: var(--shell-on-accent); background: var(--shell-accent); }
.appearance-dialog, .appearance-dialog * { box-sizing: border-box; }
.appearance-dialog:not([open]) { display: none; }
.appearance-dialog {
  width: min(480px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 0;
  overflow: auto;
  border: 1px solid var(--shell-line-strong);
  border-radius: 18px;
  background: var(--shell-panel);
  color: var(--shell-text);
  box-shadow: var(--shell-shadow);
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
}
.appearance-dialog::backdrop { background: var(--shell-backdrop); }
.appearance-shell { padding: 24px; }
.appearance-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.appearance-title { margin: 0; font-size: 21px; line-height: 1.4; }
.appearance-eyebrow { margin: 0 0 5px; color: var(--shell-accent); font-size: 11px; letter-spacing: .08em; }
.appearance-section { margin-top: 22px; }
.appearance-section-title { margin: 0 0 10px; font-size: 13px; font-weight: 650; }
.appearance-dialog button { font-family: inherit; cursor: pointer; }
.appearance-dialog :is(button, a):focus-visible { outline: 2px solid var(--shell-accent); outline-offset: 3px; }
.appearance-close {
  display: grid; place-items: center; flex: 0 0 36px; width: 36px; min-height: 36px;
  border: 1px solid var(--shell-line); border-radius: 10px;
  color: var(--shell-muted); background: var(--shell-panel-soft);
}
.appearance-hint { margin: 8px 0 0; color: var(--shell-muted); font-size: 12px; line-height: 1.7; }
.appearance-dialog fieldset { min-width: 0; margin: 22px 0 0; padding: 0; border: 0; }
.appearance-dialog legend { margin: 0 0 10px; padding: 0; font-size: 13px; font-weight: 650; }
.appearance-modes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.appearance-palettes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.appearance-choice {
  display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 11px 8px;
  border: 1px solid var(--shell-line); border-radius: 10px;
  background: var(--shell-panel-soft); color: var(--shell-muted); font-size: 13px;
}
.appearance-choice:hover, .appearance-close:hover { border-color: var(--shell-accent-border); color: var(--shell-text); }
.appearance-choice[aria-pressed="true"] {
  border-color: var(--shell-accent); background: var(--shell-accent-soft);
  color: var(--shell-accent); box-shadow: inset 0 0 0 1px var(--shell-accent); font-weight: 650;
}
.appearance-palettes .appearance-choice { justify-content: flex-start; min-height: 62px; padding: 12px; }
.appearance-swatch { display: block; width: 26px; height: 26px; flex: 0 0 26px; border-radius: 50%; border: 1px solid rgba(0,0,0,.16); }
[data-appearance-palette="forest"] .appearance-swatch { background: #78ac91; }
[data-appearance-palette="sky"] .appearance-swatch { background: #83a9df; }
[data-appearance-palette="amber"] .appearance-swatch { background: #ceaa6d; }
[data-appearance-palette="rose"] .appearance-swatch { background: #d49ab8; }
.appearance-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--shell-line); }
.appearance-reset { flex-shrink: 0; min-height: 36px; padding: 6px 0; color: var(--shell-muted); background: none; border: 0; font-size: 12px; text-decoration: underline; text-underline-offset: 3px; }
.appearance-reset:hover { color: var(--shell-accent); }
.appearance-done { min-width: 86px; min-height: 40px; padding: 8px 18px; border: 1px solid var(--shell-accent); border-radius: 10px; background: var(--shell-accent); color: var(--shell-on-accent); font-weight: 650; }
.appearance-done:hover { background: var(--shell-accent-2); border-color: var(--shell-accent-2); }
@media (max-width: 480px) {
  .appearance-shell { padding: 18px; }
  .appearance-choice { font-size: 12px; gap: 6px; }
}
@media (max-width: 360px) {
  .appearance-modes .appearance-choice { flex-direction: column; gap: 5px; }
}
