/* Periodic Speller — theme picker dropdown, per-theme overrides on
   the tile palette, and the export-results button.
 *
 * Scoped --ps-* tokens hold the per-theme tile palettes (pastel cream,
 * mono off-white, Heisenberg green CRT, vintage paper). The element-
 * category palette stays in base.css under --category-* — those are
 * data, not chrome, and intentionally non-brand. */
:root {
  --ps-pastel-bg: #f0f4ff;
  --ps-mono-symbol: #f8fafc;

  --ps-heisenberg-bg: #0c1a0c;
  --ps-heisenberg-bright: #22c55e;
  --ps-heisenberg-mid: #4ade80;
  --ps-heisenberg-deep: #166534;
  --ps-heisenberg-shadow: #14532d;

  --ps-vintage-bg: #fef3c7;
  --ps-vintage-bg-soft: #fef9ee;
  --ps-vintage-deep: #451a03;
  --ps-vintage-mid: #78350f;
  --ps-vintage-border: #92400e;
  --ps-vintage-line: #d6d3d1;
  --ps-vintage-line-soft: #a8a29e;
}

/* Theme picker */
.theme-picker-wrap {
  position: relative;
}

.theme-popover {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.6rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
  min-width: 240px;
  box-shadow: 0 12px 32px color-mix(in srgb, var(--pure-black) 40%, transparent);
  animation: modalIn 0.15s ease-out;
  z-index: 10;
}

.theme-popover[hidden] {
  display: none;
}

.theme-swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem 0.4rem;
  border-radius: 8px;
  border: 2px solid transparent;
  background: none;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 600;
}

.theme-swatch:hover {
  background: var(--border);
}

.theme-swatch.active {
  border-color: var(--accent);
  color: var(--text);
}

.theme-swatch-preview {
  width: 36px;
  height: 28px;
  border-radius: 5px;
  border: 1.5px solid color-mix(in srgb, var(--pure-white) 10%, transparent);
}

/* Theme overrides on tiles */
.tiles[data-theme='pastel'] .tile {
  background: var(--ps-pastel-bg, #f0f4ff);
  border-width: 2px;
}
.tiles[data-theme='pastel'] .tile .tile-symbol {
  color: var(--surface-1);
}
.tiles[data-theme='pastel'] .tile .tile-name {
  color: var(--text-3);
}
.tiles[data-theme='pastel'] .tile .tile-mass {
  color: var(--text-2);
}
.tiles[data-theme='pastel'] .tile-unmatched {
  background: var(--text-1);
  border-color: var(--text-1);
}
.tiles[data-theme='pastel'] .tile-unmatched .tile-symbol {
  color: var(--text-2);
}
.tiles[data-theme='pastel'] .tile-unmatched .tile-name {
  color: var(--text-1);
}

.tiles[data-theme='neon'] .tile {
  background: var(--surface-0);
  box-shadow: 0 0 10px var(--tile-border),
    inset 0 0 8px color-mix(in srgb, var(--pure-white) 3%, transparent);
}
.tiles[data-theme='neon'] .tile .tile-symbol {
  text-shadow: 0 0 12px currentColor;
}

.tiles[data-theme='mono'] .tile {
  border-color: var(--text-1);
  background: var(--tile-bg);
}
.tiles[data-theme='mono'] .tile .tile-number {
  color: var(--text-1);
}
.tiles[data-theme='mono'] .tile .tile-symbol {
  color: var(--ps-mono-symbol, #f8fafc);
}
.tiles[data-theme='mono'] .tile .tile-name {
  color: var(--text-2);
}

.tiles[data-theme='heisenberg'] .tile {
  background: var(--ps-heisenberg-bg, var(--ps-heisenberg-bg, #0c1a0c));
  border-color: var(--ps-heisenberg-bright, var(--ps-heisenberg-bright, #22c55e));
}
.tiles[data-theme='heisenberg'] .tile .tile-number {
  color: var(--ps-heisenberg-bright, var(--ps-heisenberg-bright, #22c55e));
}
.tiles[data-theme='heisenberg'] .tile .tile-symbol {
  color: var(--ps-heisenberg-mid, var(--ps-heisenberg-mid, #4ade80));
}
.tiles[data-theme='heisenberg'] .tile .tile-name {
  color: var(--ps-heisenberg-deep, var(--ps-heisenberg-deep, #166534));
}
.tiles[data-theme='heisenberg'] .tile .tile-mass {
  color: var(--ps-heisenberg-shadow, var(--ps-heisenberg-shadow, #14532d));
}
.tiles[data-theme='heisenberg'] .tile-unmatched {
  background: var(--ps-heisenberg-bg, var(--ps-heisenberg-bg, #0c1a0c));
  border-color: var(--ps-heisenberg-deep, var(--ps-heisenberg-deep, #166534));
}
.tiles[data-theme='heisenberg'] .tile-unmatched .tile-symbol {
  color: var(--ps-heisenberg-deep, var(--ps-heisenberg-deep, #166534));
}
.tiles[data-theme='heisenberg'] .tile-unmatched .tile-name {
  color: var(--ps-heisenberg-shadow, var(--ps-heisenberg-shadow, #14532d));
}

.tiles[data-theme='vintage'] .tile {
  background: var(--ps-vintage-bg, var(--ps-vintage-bg, #fef3c7));
  border-color: var(--ps-vintage-border, var(--ps-vintage-border, #92400e));
  border-width: 2px;
}
.tiles[data-theme='vintage'] .tile .tile-number {
  color: var(--ps-vintage-border, var(--ps-vintage-border, #92400e));
}
.tiles[data-theme='vintage'] .tile .tile-symbol {
  color: var(--ps-vintage-deep, var(--ps-vintage-deep, #451a03));
}
.tiles[data-theme='vintage'] .tile .tile-name {
  color: var(--ps-vintage-mid, var(--ps-vintage-mid, #78350f));
}
.tiles[data-theme='vintage'] .tile .tile-mass {
  color: var(--ps-vintage-border, var(--ps-vintage-border, #92400e));
}
.tiles[data-theme='vintage'] .tile-unmatched {
  background: var(--ps-vintage-bg-soft, var(--ps-vintage-bg-soft, #fef9ee));
  border-color: var(--ps-vintage-line, var(--ps-vintage-line, #d6d3d1));
}
.tiles[data-theme='vintage'] .tile-unmatched .tile-symbol {
  color: var(--ps-vintage-line-soft, var(--ps-vintage-line-soft, #a8a29e));
}
.tiles[data-theme='vintage'] .tile-unmatched .tile-name {
  color: var(--ps-vintage-line, var(--ps-vintage-line, #d6d3d1));
}

.export-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.export-option {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.export-option input[type='checkbox'] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.export-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.5rem 1.2rem;
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.export-btn:hover {
  color: var(--text);
  border-color: var(--accent);
  background: var(--border);
}
