@import url("/homes/theme-tokens.css");
/* UI theme tokens affect surfaces and controls, never hue-filter puzzle artwork. */
html[data-theme],
html[data-theme] body {
  background: var(--theme-background);
  color: var(--theme-ink);
}
html[data-theme]
  :is(
    .game-dialog,
    .game-card,
    .card-body,
    .companion-games a,
    .stage-node,
    .field input,
    .field select
  ) {
  background-color: var(--theme-paper);
  color: var(--theme-ink);
  border-color: var(--theme-line);
}
html[data-theme] :is(.adventure-intro, .chapter-tabs, .toy-box) {
  background: var(--theme-soft);
  border-color: var(--theme-line);
}
html[data-theme] .no-scroll-shell :is(.hud, .board-area) {
  background: var(--theme-soft);
}
html[data-theme] .game-dialog::backdrop {
  background: color-mix(in oklab, var(--theme-ink) 42%, transparent);
}
html[data-theme]
  :is(.welcome h1 span, .chapter-label, .adventure-progress strong) {
  color: var(--theme-primary);
}
html[data-theme]
  :is(
    .primary,
    .seo-play,
    .share-play,
    .filters button.active,
    .chapter-tabs button.active
  ) {
  background: var(--theme-primary);
  color: #fff;
  border-color: var(--theme-primary);
  box-shadow: none;
}
html[data-theme] :is(.game-dialog .secondary, .stage-node.cleared) {
  background: var(--theme-soft);
  color: var(--theme-ink);
  border-color: var(--theme-line);
  box-shadow: none;
}
html[data-theme] .stage-node.current {
  background: var(--theme-primary);
  color: #fff;
  border-color: var(--theme-primary);
}
html[data-theme] :is(.brand-mark, .theme-selected-mark) {
  background: var(--theme-accent);
  color: var(--theme-ink);
}
html[data-theme] :is(.seo-footer, .seo-header, .seo-article, .share-landing) {
  color: var(--theme-ink);
  border-color: var(--theme-line);
}
html[data-theme]
  :is(
    .seo-footer p,
    .seo-footer small,
    .seo-article p,
    .share-invite,
    .share-landing footer
  ) {
  color: var(--theme-muted);
}
html[data-theme] :is(a, button, input, select):focus-visible {
  outline-color: var(--theme-focus);
}
html[data-theme="dark"] {
  color-scheme: dark;
}
html[data-theme="dark"] :is(.brand-mark, .theme-selected-mark) {
  color: var(--theme-background);
}
html[data-theme="dark"] .game-dialog::backdrop {
  background: #0009;
}
html[data-theme="dark"]
  :is(
    .welcome h1 span,
    .eyebrow,
    .save-label,
    .chapter-label,
    .adventure-progress strong,
    .hud strong,
    .shared-score strong,
    .control-zone .micro,
    .no-scroll-shell .game-header .back-button
  ) {
  color: var(--theme-accent);
}
html[data-theme="dark"]
  :is(
    .filters,
    .tutorial-banner,
    .skin-options button,
    .chapter-tabs button:not(.active),
    .game-dialog input,
    .game-dialog select
  ) {
  background: var(--theme-soft);
  color: var(--theme-ink);
  border-color: var(--theme-line);
}
html[data-theme="dark"]
  :is(
    .tutorial-banner h2,
    .tutorial-banner p,
    .tutorial-banner b,
    .tutorial-banner button,
    .collection-reward,
    .game-dialog h2,
    .game-dialog h3,
    .game-dialog p,
    .settings-heading button
  ) {
  color: var(--theme-ink);
}
html[data-theme="dark"]
  :is(
    .shared-score small,
    .toy-label,
    .toy-caption,
    .adventure-hub footer,
    .card-footer,
    .game-card .card-body p
  ) {
  color: var(--theme-muted);
}
html[data-theme="dark"] .skin-options [aria-pressed="true"] {
  border-color: var(--theme-accent);
}
html[data-theme="dark"] .game-dialog .share-emoji {
  background: var(--theme-soft);
  color: var(--theme-ink);
}
/* Puzzle artwork retains its authored light surfaces and semantic colors. */
html[data-theme="dark"] :is(.board-area, .game-cover, .adventure-art) {
  --ink: #253b38;
  --muted: #63736b;
  --paper: #fcfdf8;
  --line: #d9dfd2;
  color: #253b38;
  color-scheme: light;
}
html[data-theme="dark"] .game-card {
  box-shadow: 0 5px 0 #0003;
}
/* Palette choices are swatches, without a second card behind them. */
.settings-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.game-dialog .settings-heading h2 {
  margin: 0;
}
.game-dialog .settings-heading button {
  width: 44px;
  height: 44px;
  min-height: 44px;
  margin: 0;
  padding: 6px;
  border: 0;
  background: transparent;
  box-shadow: none;
  font-size: 24px;
}
.theme-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0 24px;
}
.game-dialog .theme-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 8px 2px;
  margin: 0;
  min-width: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  border-radius: 12px;
  font-size: 12px;
  line-height: 1.3;
  color: var(--theme-ink);
}
.theme-swatch {
  position: relative;
  display: block;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: linear-gradient(
    135deg,
    var(--sample-bg) 0 48%,
    var(--sample-soft) 48% 72%,
    var(--sample-primary) 72%
  );
  border: 1px solid var(--sample-primary);
  outline: 3px solid transparent;
  outline-offset: 4px;
}
.theme-option[aria-pressed="true"] .theme-swatch {
  outline-color: var(--theme-primary);
}
.theme-selected-mark {
  display: none;
  position: absolute;
  right: -3px;
  bottom: -2px;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 14px;
  font-style: normal;
  border: 2px solid var(--theme-paper);
}
.theme-option[aria-pressed="true"] .theme-selected-mark {
  display: grid;
}
@media (prefers-reduced-motion: no-preference) {
  .theme-swatch {
    transition: outline-color 0.16s;
  }
}
