:root {
  --bg: #0a0e13;
  --panel: #101720;
  --viewer: #0b1016;
  --line: #263442;
  --text: #e8eef5;
  --muted: #93a4b5;
  --accent: #5aa7b5;
  --accent-dim: #2f6d78;
  --active: #8fd0db;
  --danger: #e08a8a;
  --touch: 2.75rem;
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, #15202c 0%, transparent 55%),
    var(--bg);
  color: var(--text);
}

body { overflow: auto; }

.page {
  width: min(100% - 2rem, 1200px);
  margin: 0 auto;
  padding: 1.5rem 0 2.5rem;
}

.page-header { margin-bottom: 1.25rem; }

.brand {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 650;
}

h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 650;
  line-height: 1.15;
}

.lede {
  margin: 0;
  max-width: 40rem;
  color: var(--muted);
  line-height: 1.5;
}

.tint-visualizer {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 19rem;
  min-height: 34rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  overflow: hidden;
  background: var(--panel);
}

.visualizer-viewer {
  position: relative;
  min-width: 0;
  aspect-ratio: 16 / 10;
  min-height: 22rem;
  background: var(--viewer);
}

.visualizer-viewer canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.visualizer-controls {
  padding: 1.25rem;
  background: var(--panel);
  border-left: 1px solid var(--line);
  overflow: auto;
}

.section { margin-bottom: 1.15rem; }

h2 {
  margin: 0 0 0.55rem;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.choice-row,
.tint-list {
  display: grid;
  gap: 0.4rem;
}

.choice-row {
  grid-template-columns: 1fr;
}

.window-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}

button {
  appearance: none;
  border: 1px solid var(--line);
  background: #121a23;
  color: var(--text);
  border-radius: 0.5rem;
  min-height: var(--touch);
  padding: 0.55rem 0.7rem;
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, opacity 0.15s;
}

button:hover:not(:disabled) { border-color: var(--accent-dim); }

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

button.active {
  border-color: var(--accent);
  background: #16303a;
  color: var(--active);
}

.tint-list button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.swatch {
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 0.3rem;
  border: 1px solid #5a6a7a;
  flex-shrink: 0;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.footnote {
  margin: 0.9rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.footnote a { color: var(--accent); }

.viewer-status,
.viewer-error {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 0.75rem;
  padding: 1.25rem;
  text-align: center;
  z-index: 2;
  pointer-events: none;
}

.viewer-status {
  background: rgba(11, 16, 22, 0.72);
  color: var(--muted);
  font-size: 0.95rem;
}

.viewer-error {
  background: rgba(26, 14, 14, 0.92);
  color: #f0d0d0;
  pointer-events: auto;
}

.viewer-error[hidden],
.viewer-status[hidden] { display: none; }

.viewer-error p { margin: 0; }

.viewer-error button {
  justify-self: center;
  pointer-events: auto;
  min-width: 10rem;
  text-align: center;
}

@media (max-width: 760px) {
  .page { width: min(100% - 1.25rem, 1200px); padding-top: 1rem; }

  .tint-visualizer {
    display: block;
    min-height: 0;
  }

  .visualizer-viewer {
    aspect-ratio: 4 / 3;
    min-height: 18rem;
  }

  .visualizer-controls {
    position: static;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .choice-row {
    grid-template-columns: repeat(3, 1fr);
  }

  .choice-row button {
    text-align: center;
    padding: 0.5rem 0.35rem;
    font-size: 0.82rem;
  }
}

.section-note {
  margin: 0 0 0.65rem;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.4;
}
.tint-list button .vlt {
  color: var(--muted);
  font-size: 0.8rem;
}
button.active .vlt { color: var(--active); }
