.appearance-switch {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  min-height: 44px;
  padding: .45rem .8rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--primary-bg);
  color: var(--text-main);
  font-size: .9rem;
  font-weight: 700;
  cursor: pointer;
}
.appearance-switch input {
  appearance: none;
  box-sizing: border-box;
  width: 2.25rem;
  height: 1.3rem;
  margin: 0;
  padding: 2px;
  background: #546078;
  border: 1px solid currentColor;
  border-radius: 2rem;
  color: white;
  cursor: pointer;
}
.appearance-switch input::before {
  content: "";
  display: block;
  height: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: currentColor;
}
.appearance-switch input:checked { background: #5148b7; }
.appearance-switch input:checked::before { margin-left: auto; }
.appearance-switch:focus-within { outline: 2px solid var(--accent-2); outline-offset: 3px; }
.appearance-login { display: flex; justify-content: center; margin-top: 1rem; }
.appearance-setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-bg);
  font-weight: 700;
}
@media (forced-colors: active) {
  .appearance-switch input { appearance: auto; }
  .appearance-switch input::before { display: none; }
}

:root[data-theme="light"] {
  color-scheme: light;
  --theme-controls: light;
  --bg: #f4f6fb;
  --surface: #fff;
  --surface-2: #edf1f8;
  --primary-bg: #f2f4fa;
  --text: #1d2941;
  --muted: #4f6079;
  --border: #c8d2e1;
  --accent: #5045ae;
  --accent-hover: #41358f;
  --accent-2: #5b4cb8;
  --danger: #a1263c;
  --success: #126044;
  --warning: #825307;
  --shadow: 0 12px 36px rgba(48, 64, 97, .10);

  /* Components use these overrides with their original dark colors as fallbacks. */
  --theme-page: var(--bg);
  --theme-panel: var(--surface);
  --theme-inset: var(--surface-2);
  --theme-ink: var(--text);
  --theme-muted: var(--muted);
  --theme-line: var(--border);
  --theme-accent: var(--accent);
  --theme-accent-bg: #eeebff;
  --theme-accent-line: #9589d4;
  --theme-info: #24568d;
  --theme-info-bg: #e5effb;
  --theme-success: var(--success);
  --theme-success-bg: #e2f3e9;
  --theme-danger: var(--danger);
  --theme-danger-bg: #fbe9ec;
  --theme-warning: var(--warning);
  --theme-warning-bg: #fcf1d8;
  --theme-shadow-color: rgba(35, 50, 77, .16);
}

html[data-theme="light"] body {
  color: var(--text);
  background: var(--bg);
}
html[data-theme="light"] :is(body.login, body.tablet-select) {
  background: radial-gradient(ellipse at 14% 0%, #e9e7fb, transparent 60%),
              radial-gradient(ellipse at 96% 12%, #e1f1f6, transparent 50%), var(--bg);
}
[data-theme="light"] body > nav,
[data-theme="light"] :is(.login-card, .select-card, .modal-card) {
  background: var(--surface);
  border-color: var(--border);
  box-shadow: var(--shadow);
}
[data-theme="light"] :is(.nav-center, .nav-user, .nav-icon-btn, .login-top, .select-option,
                         .login-mark, .select-icon, .login-eye, .select-option-arrow) {
  background: var(--primary-bg);
  border-color: var(--border);
}
[data-theme="light"] :is(.login-input, .form-control) { background-color: var(--surface); }
[data-theme="light"] :is(.form-control, .select-grid) { border-color: var(--border); }
[data-theme="light"] .form-control::placeholder { color: var(--muted); }
[data-theme="light"] .form-control:focus { border-color: var(--accent); }
[data-theme="light"] :is(.login-pill, .login-foot a, .select-option-arrow) { color: var(--accent); }
[data-theme="light"] .login-version { color: var(--muted); }
[data-theme="light"] :is(.nav-icon-btn, .select-option, .login-eye):hover {
  border-color: var(--theme-accent-line);
  background: var(--theme-accent-bg);
}
[data-theme="light"] :is(.login-btn, .btn-primary) {
  background: var(--accent);
  color: white;
}
[data-theme="light"] .btn-success { background: var(--success); color: white; }
[data-theme="light"] .tablet-timer-btn { color: var(--success); }
[data-theme="light"] .tablet-timer-btn.is-late { color: var(--danger); }
[data-theme="light"] :is(.btn-danger, .alert-danger) { background: var(--theme-danger-bg); color: var(--danger); }
[data-theme="light"] .alert-success { background: var(--theme-success-bg); color: var(--success); }
[data-theme="light"] .alert-warning { background: var(--theme-warning-bg); color: var(--warning); }
[data-theme="light"] .alert-info { background: var(--theme-info-bg); color: var(--theme-info); }
[data-theme="light"] .alert:not(.alert-info, .alert-danger, .alert-warning, .alert-success) {
  background: var(--surface-2);
}
