/* The site uses a persistent, optional appearance control independent of Portal. */
.site-header-controls { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.site-theme-toggle {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 8px 12px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--surface); color: var(--ink);
  font: 600 13px/1.4 Arial, Helvetica, sans-serif; cursor: pointer;
}
.site-theme-toggle[hidden] { display: none; }
.site-theme-toggle .ui-icon { width: 18px; height: 18px; color: var(--theme-accent-text, #6846ad); }
.site-theme-toggle:hover { background: var(--tint); }
.site-theme-toggle:focus-visible { outline: 3px solid var(--theme-accent-text, #6846ad); outline-offset: 3px; }
@media (max-width: 980px) {
  .site-header { flex-wrap: wrap; gap: 12px; }
  .site-header-controls { margin-left: auto; }
  .site-header .menu-button { display: inline-grid; place-items: center; min-height: 44px; min-width: 44px; }
  .site-header nav { display: none; order: 3; flex-basis: 100%; flex-direction: column; align-items: stretch; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); gap: 3px; }
  .site-header nav.is-open { display: flex; }
  .site-header nav > a { padding: 12px; font-size: 15px; }
}
@media (max-width: 420px) {
  .site-header { gap: 10px; }
  .site-theme-toggle { padding: 8px; min-width: 44px; }
  .site-theme-toggle span { display: none; }
}

/* 60% neutral surfaces, 30% violet family, 10% logo accents. */
@media screen {
  html[data-theme="dark"] {
    color-scheme: dark;
    --theme-surface: #1c1c1e;
    --theme-raised: #2c2c2e;
    --theme-border: #424245;
    --theme-text: #f4f2ed;
    --theme-muted: #b8b8bf;
    --theme-purple-soft: #352449;
    --theme-purple-border: #665182;
    --theme-accent-text: #cfadff;
    --theme-info-bg: #19343c;
    --theme-info-border: #34616c;
    --theme-info-text: #8de5f1;
    --theme-warning-bg: #3b2b20;
    --theme-warning-border: #856439;
    --theme-warning-text: #ffd083;
    --theme-pink-bg: #3d2641;
    --theme-pink-border: #704779;
    --theme-pink-text: #f4adeb;
    --theme-success-bg: #1c352d;
    --theme-success-border: #3d6957;
    --theme-success-text: #9ae5bb;
    --theme-danger-bg: #40242e;
    --theme-danger-border: #875063;
    --theme-danger-text: #ffb5c6;
    --theme-blue-bg: #252e48;
    --theme-blue-border: #52638e;
    --theme-blue-text: #aebdff;
  }
  html[data-theme="dark"] body.playful {
    --bg: #000000;
    --surface: var(--theme-surface);
    --ink: var(--theme-text);
    --muted: var(--theme-muted);
    --line: var(--theme-border);
    --accent: #6846ad;
    --tint: var(--theme-purple-soft);
    --soft: var(--theme-warning-bg);
    --dark: #241638;
  }
  html[data-theme="dark"] .site-header { color: var(--ink); }
  html[data-theme="dark"] .site-header nav .ui-icon { color: var(--theme-accent-text); }
  html[data-theme="dark"] .btn.primary { background: #00778b; color: #fff; }
  html[data-theme="dark"] .btn.primary:hover { background: #006d80; color: #fff; }
  html[data-theme="dark"] .site-header nav > a.btn > .ui-icon { color: inherit; }
  html[data-theme="dark"] :is(.tab[aria-selected="true"], .toast, .mini-stack span:nth-child(3)) { background: #6846ad; color: #fff; }
  html[data-theme="dark"] .playful .stage-sticker { color: #352847; }
  html[data-theme="dark"] .hero-form .btn.primary.submit-btn { background: #ffc875; color: #352847; }
  html[data-theme="dark"] .hero-form .btn.primary.submit-btn:hover { background: #ffd698; color: #352847; }
  html[data-theme="dark"] body.playful .activity-card:nth-child(3n+1) { --card-accent: var(--theme-accent-text); background: var(--theme-purple-soft); border-color: var(--theme-purple-border); }
  html[data-theme="dark"] body.playful .activity-card:nth-child(3n+2) { --card-accent: var(--theme-info-text); background: var(--theme-info-bg); border-color: var(--theme-info-border); }
  html[data-theme="dark"] body.playful .activity-card:nth-child(3n) { --card-accent: var(--theme-warning-text); background: var(--theme-warning-bg); border-color: var(--theme-warning-border); }
  html[data-theme="dark"] body.playful .activity-card .skill-art, html[data-theme="dark"] body.playful .activity-card .round-btn, html[data-theme="dark"] body.playful .activity-card .level-tag { background: var(--theme-raised); }
  html[data-theme="dark"] body.playful .activity-card .card-bottom { border-color: var(--theme-border); }
  html[data-theme="dark"] input::placeholder, html[data-theme="dark"] textarea::placeholder { color: var(--theme-muted); }
  html[data-theme="dark"] :where(input:not([type="checkbox"]), select, textarea):not(:focus):not(:disabled) { border-color: #77777c; }
  html[data-theme="dark"] .route-piece-ai { background: #6846ad; color: #fff; }
}
