/* ---- tokens ---- */
:root {
  --ink: oklch(96% 0.01 260);
  --ink-dim: oklch(96% 0.01 260 / 0.62);
  --ink-faint: oklch(96% 0.01 260 / 0.38);
  --navy: oklch(16% 0.035 275);
  --panel: oklch(20% 0.03 275 / 0.55);
  --panel-border: oklch(96% 0.01 260 / 0.14);
  --accent: oklch(82% 0.15 85);
  --accent-ink: oklch(22% 0.06 80);
  --focus: oklch(82% 0.15 85 / 0.9);
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--navy);
  color: var(--ink);
  font-family: var(--mono);
  -webkit-font-smoothing: antialiased;
}

#stage {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  display: block;
}

/* ---- corner ticks ---- */
.corner-tick {
  position: fixed;
  width: 14px;
  height: 14px;
  border: 0 solid var(--ink-faint);
  pointer-events: none;
  z-index: 3;
}
.corner-tick.tl { top: 12px; left: 12px; border-top-width: 1px; border-left-width: 1px; }
.corner-tick.tr { top: 12px; right: 12px; border-top-width: 1px; border-right-width: 1px; }
.corner-tick.bl { bottom: 12px; left: 12px; border-bottom-width: 1px; border-left-width: 1px; }
.corner-tick.br { bottom: 12px; right: 12px; border-bottom-width: 1px; border-right-width: 1px; }

/* ---- HUD ---- */
.hud { position: fixed; left: 0; right: 0; z-index: 5; pointer-events: none; }
.hud > * { pointer-events: auto; }

.hud-top {
  top: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 28px 32px 0;
}

.wordmark {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.32em;
}
.tagline {
  margin: 6px 0 0;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--ink-dim);
}

/* seed plate with technical corner squares */
.seed-plate {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--panel-border);
  background: var(--panel);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.seed-plate::before, .seed-plate::after,
.seed-plate .seed-label::before, .seed-plate .seed-label::after { content: none; }
.seed-label { font-size: 10px; letter-spacing: 0.22em; color: var(--ink-faint); }
.seed-value {
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--ink);
  background: none;
  border: 0;
  padding: 2px 0;
  cursor: pointer;
}
.seed-value:hover { color: var(--accent); }
.copy-glyph { color: var(--ink-faint); flex: none; }

/* ---- bottom control bar ---- */
.hud-bottom {
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 0 16px max(22px, env(safe-area-inset-bottom));
}

.panel {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  padding: 10px 14px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: var(--panel);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 18px 50px oklch(10% 0.03 275 / 0.55);
}

.field { display: flex; align-items: center; gap: 8px; }
.field-label {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
  flex: none;
}

/* buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
  background: oklch(96% 0.01 260 / 0.07);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  padding: 9px 14px;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease, transform 160ms ease;
}
.btn:hover { background: oklch(96% 0.01 260 / 0.14); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: default; }

.btn-primary {
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-ink);
}
.btn-primary:hover { background: oklch(86% 0.16 85); }

.btn-icon { padding: 9px 10px; }
.btn-small { padding: 6px 10px; font-size: 11px; }

/* selects */
.select-wrap { position: relative; display: inline-flex; }
.select-wrap select {
  appearance: none;
  -webkit-appearance: none;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--ink);
  background: oklch(96% 0.01 260 / 0.07);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  padding: 8px 28px 8px 10px;
  cursor: pointer;
  transition: background 160ms ease;
}
.select-wrap select:hover { background: oklch(96% 0.01 260 / 0.14); }
.select-wrap select option { background: oklch(18% 0.03 275); color: var(--ink); }
.select-arrow {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-faint);
  pointer-events: none;
}

/* palette dots */
.palette-dots { display: flex; gap: 7px; }
.palette-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid oklch(96% 0.01 260 / 0.25);
  padding: 0;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease;
}
.palette-dot:hover { transform: scale(1.15); }
.palette-dot[aria-checked="true"] {
  box-shadow: 0 0 0 2px var(--navy), 0 0 0 3.5px var(--accent);
}

/* tune panel */
.tune-panel { gap: 18px; max-width: min(720px, calc(100vw - 32px)); }
.field-slider input[type="range"] {
  width: 140px;
  accent-color: var(--accent);
  cursor: pointer;
}
.switch {
  appearance: none;
  -webkit-appearance: none;
  width: 34px;
  height: 19px;
  border-radius: 999px;
  background: oklch(96% 0.01 260 / 0.15);
  border: 1px solid var(--panel-border);
  position: relative;
  cursor: pointer;
  transition: background 160ms ease;
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--ink);
  transition: transform 160ms ease;
}
.switch:checked { background: oklch(70% 0.13 85 / 0.55); }
.switch:checked::after { transform: translateX(15px); }

.seed-input {
  width: 118px;
  font-family: inherit;
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--ink);
  background: oklch(96% 0.01 260 / 0.07);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  padding: 8px 10px;
}
.seed-input::placeholder { color: var(--ink-faint); }
.seed-input:focus { outline: none; }

.hint {
  margin: 0;
  width: 100%;
  text-align: center;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
}

/* toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 108px;
  transform: translateX(-50%) translateY(8px);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--ink);
  background: oklch(18% 0.03 275 / 0.92);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  padding: 9px 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease, transform 200ms ease;
  z-index: 8;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* focus */
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---- responsive ---- */
@media (max-width: 760px) {
  .hud-top { padding: 20px 20px 0; }
  .tagline { display: none; }
  .panel { gap: 10px; padding: 9px 10px; max-width: calc(100vw - 28px); }
  .field-label { display: none; }
  .field-slider input[type="range"] { width: 110px; }
  .hint { display: none; }
  .wordmark { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
