/* SEED SYNC — Lab arcade chrome scoped for a deterministic generator console. */

@font-face {
  font-family: "Press Start 2P";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/press-start-2p.woff2") format("woff2");
}
@font-face {
  font-family: "Press Start 2P Fallback";
  src: local("Courier New");
  size-adjust: 166.64%;
  ascent-override: 60%;
  descent-override: 0%;
  line-gap-override: 0%;
}

:root {
  color-scheme: dark;

  --bg: #0a0a12;
  --surface: #12121d;
  --surface-2: #1a1a2a;
  --line: #28283c;
  --text: #e9e9f2;
  --dim: #9aa0b5;
  --cyan: #45f0ff;
  --magenta: #ff3d8b;
  --gold: #ffc857;
  --green: #41ff8b;
  --red: #ff5560;

  --pixel: "Press Start 2P", "Press Start 2P Fallback", "Courier New", monospace;
  --sans: -apple-system, "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --radius: 8px;
  --radius-sm: 5px;

  --duration-fast: 150ms;
  --duration-normal: 300ms;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  --glow-cyan: 0 0 14px rgba(69, 240, 255, 0.35);
  --gutter: clamp(0.85rem, 4vw, 2.5rem);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100svh;
  background:
    radial-gradient(1200px 540px at 50% -8%, rgba(69, 240, 255, 0.06), transparent 70%),
    radial-gradient(900px 500px at 100% 0%, rgba(255, 61, 139, 0.05), transparent 65%),
    radial-gradient(900px 600px at 0% 100%, rgba(255, 200, 87, 0.04), transparent 68%),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: clamp(0.95rem, 0.9rem + 0.25vw, 1.0625rem);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: rgba(69, 240, 255, 0.3);
  color: var(--text);
}

a { color: var(--cyan); }

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

button { cursor: pointer; }

h1, h2, h3, p { overflow-wrap: anywhere; }

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px rgba(69, 240, 255, 0.18);
  border-radius: 3px;
}

/* ---------- global scanline atmosphere ---------- */
.scanlines {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.16) 0 1px,
    transparent 1px 3px
  );
  mix-blend-mode: multiply;
  opacity: 0.55;
}

/* ---------- skip + back-to-lab chrome ---------- */
.skip-link {
  position: absolute;
  left: 12px;
  top: -56px;
  z-index: 200;
  background: var(--cyan);
  color: #05050d;
  padding: 10px 16px;
  border-radius: 6px;
  font-family: var(--mono);
  font-weight: 700;
  text-decoration: none;
  transition: transform var(--duration-normal) var(--ease-out);
}
.skip-link:focus-visible { transform: translateY(68px); }

.lab-link {
  position: fixed;
  top: clamp(0.6rem, 2vw, 1.1rem);
  left: clamp(0.6rem, 2vw, 1.1rem);
  z-index: 120;
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0.5rem 0.85rem;
  font-family: var(--pixel);
  font-size: 9px;
  letter-spacing: 0.06em;
  color: var(--dim);
  text-decoration: none;
  background: rgba(10, 10, 18, 0.82);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: color var(--duration-fast) ease,
    border-color var(--duration-fast) ease,
    box-shadow var(--duration-fast) ease,
    transform var(--duration-fast) var(--ease-out);
}
.lab-link:hover,
.lab-link:focus-visible {
  color: var(--cyan);
  border-color: var(--cyan);
  text-shadow: var(--glow-cyan);
  box-shadow: 0 0 18px rgba(69, 240, 255, 0.22);
  transform: translateX(-2px);
}

/* ---------- shell ---------- */
.app-shell {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 78rem;
  margin: 0 auto;
  padding: clamp(3.75rem, 9vw, 5.5rem) var(--gutter) clamp(3rem, 7vw, 5rem);
}

/* ---------- header / wordmark ---------- */
.app-header {
  display: grid;
  gap: 0.55rem;
  margin-bottom: clamp(1.5rem, 4vw, 2.5rem);
}

.level {
  margin: 0;
  font-family: var(--pixel);
  font-size: 9px;
  letter-spacing: 0.22em;
  color: var(--gold);
  text-shadow: 0 0 12px rgba(255, 200, 87, 0.3);
}

.wordmark {
  position: relative;
  margin: 0.1rem 0 0.2rem;
  font-family: var(--pixel);
  font-weight: 400;
  font-size: clamp(1.5rem, 0.6rem + 6vw, 3.4rem);
  line-height: 1.12;
  letter-spacing: 0.02em;
  color: var(--text);
  text-shadow: 0 0 22px rgba(69, 240, 255, 0.45), 3px 3px 0 var(--magenta);
}
.wordmark::before,
.wordmark::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.4;
  z-index: -1;
}
.wordmark::before {
  color: var(--cyan);
  transform: translate(-2px, -1px);
  text-shadow: none;
}
.wordmark::after {
  color: var(--magenta);
  transform: translate(2px, 1px);
  text-shadow: none;
}

.tagline {
  margin: 0;
  font-family: var(--mono);
  font-size: clamp(0.78rem, 0.7rem + 0.4vw, 0.95rem);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
}
.cursor {
  color: var(--cyan);
  margin-left: 0.15em;
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.privacy-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  width: fit-content;
  max-width: 100%;
  margin: 0.7rem 0 0;
  padding: 0.5rem 0.85rem;
  border: 1px solid rgba(65, 255, 139, 0.4);
  border-radius: 999px;
  background: rgba(65, 255, 139, 0.08);
  color: var(--green);
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  line-height: 1.4;
}
.privacy-badge__dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 10px rgba(65, 255, 139, 0.8);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.78); }
}

/* ---------- panels ---------- */
.panel {
  position: relative;
  padding: clamp(1.05rem, 2.5vw, 1.6rem);
  background: linear-gradient(180deg, var(--surface-2), var(--surface) 64%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.42);
}
/* thin neon top-rail keyed to each surface's role */
.panel::before {
  content: "";
  position: absolute;
  left: 1.1rem;
  right: 1.1rem;
  top: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--rail, var(--cyan));
  box-shadow: 0 0 12px var(--rail, var(--cyan));
  opacity: 0.75;
}

.console-panel { --rail: var(--cyan); margin-bottom: clamp(1rem, 2.5vw, 1.5rem); }

.section-heading {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-bottom: 1.15rem;
}
.section-heading__title {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.panel-tag {
  flex: none;
  display: inline-grid;
  place-items: center;
  min-width: 2.9rem;
  height: 1.6rem;
  padding: 0 0.45rem;
  font-family: var(--pixel);
  font-size: 8px;
  letter-spacing: 0.04em;
  color: var(--bg);
  background: var(--cyan);
  border-radius: 3px;
  box-shadow: 0 0 14px rgba(69, 240, 255, 0.4);
}
.panel-tag--cyan { background: var(--cyan); box-shadow: 0 0 14px rgba(69, 240, 255, 0.4); }

h2 {
  margin: 0;
  font-family: var(--pixel);
  font-weight: 400;
  font-size: clamp(0.72rem, 0.62rem + 0.5vw, 0.92rem);
  letter-spacing: 0.04em;
  line-height: 1.4;
  color: var(--text);
}

.help-text {
  margin: 0.4rem 0 0;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.01em;
}

/* ---------- run status pill ---------- */
.run-status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--dim);
}
.run-status::before {
  content: "";
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}
.run-status[data-state="idle"] { color: var(--dim); }
.run-status[data-state="ok"] { color: var(--green); }
.run-status[data-state="busy"] { color: var(--cyan); }
.run-status[data-state="busy"]::before { animation: pulse 0.9s ease-in-out infinite; }
.run-status[data-state="error"] { color: var(--red); }

/* ---------- seed form ---------- */
.seed-form { display: grid; gap: 0.7rem; }

label {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
}

.seed-row { display: grid; gap: 0.7rem; }

.seed-input {
  width: 100%;
  min-height: 3rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(8, 8, 14, 0.6);
  color: var(--text);
  font-family: var(--mono);
  font-size: 1rem;
  letter-spacing: 0.02em;
  transition: border-color var(--duration-fast) ease,
    box-shadow var(--duration-fast) ease,
    background-color var(--duration-fast) ease;
}
.seed-input::placeholder { color: rgba(154, 160, 181, 0.6); }
.seed-input:hover { border-color: rgba(69, 240, 255, 0.45); }
.seed-input:focus {
  outline: none;
  border-color: var(--cyan);
  background: rgba(8, 8, 14, 0.85);
  box-shadow: 0 0 0 1px var(--cyan), 0 0 18px rgba(69, 240, 255, 0.2);
}

.seed-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

/* ---------- buttons ---------- */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 3rem;
  padding: 0.65rem 1.15rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: color var(--duration-fast) ease,
    border-color var(--duration-fast) ease,
    background-color var(--duration-fast) ease,
    box-shadow var(--duration-fast) ease,
    transform var(--duration-fast) var(--ease-out);
}

.button-primary {
  color: var(--bg);
  background: var(--cyan);
  border-color: var(--cyan);
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--cyan), 0 0 22px rgba(69, 240, 255, 0.35);
}
.button-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--cyan), 0 0 32px rgba(69, 240, 255, 0.55);
}
.button-primary:active { transform: translateY(1px); }

.button-ghost {
  border-color: var(--line);
  background: rgba(8, 8, 14, 0.4);
  color: var(--dim);
}
.button-ghost:hover {
  color: var(--cyan);
  border-color: var(--cyan);
  background: rgba(69, 240, 255, 0.08);
  box-shadow: 0 0 16px rgba(69, 240, 255, 0.18);
}
.button-ghost:active { transform: translateY(1px); }
.button-ghost.is-copied {
  color: var(--green);
  border-color: var(--green);
  background: rgba(65, 255, 139, 0.1);
  box-shadow: 0 0 16px rgba(65, 255, 139, 0.22);
}
.button[data-action="random"].is-rolling span:first-child {
  display: inline-block;
  animation: spin 0.55s var(--ease-out);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- generator grid ---------- */
.generator-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(1rem, 2.5vw, 1.5rem);
  margin-bottom: clamp(1rem, 2.5vw, 1.5rem);
}

.card { display: flex; flex-direction: column; gap: 1.1rem; min-width: 0; }

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}
.card-head__title { display: flex; align-items: center; gap: 0.7rem; min-width: 0; }

.card-glyph {
  flex: none;
  font-family: var(--mono);
  font-size: 1.05rem;
  letter-spacing: 0.06em;
  line-height: 1;
  color: var(--cyan);
  text-shadow: 0 0 10px rgba(69, 240, 255, 0.45);
}
.card-glyph--magenta { color: var(--magenta); text-shadow: 0 0 10px rgba(255, 61, 139, 0.45); }
.card-glyph--gold { color: var(--gold); text-shadow: 0 0 10px rgba(255, 200, 87, 0.45); }
.card-glyph--green { color: var(--green); text-shadow: 0 0 10px rgba(65, 255, 139, 0.45); }

.card-meta {
  margin: 0.3rem 0 0;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.06em;
}

/* ---------- canvas frames ---------- */
.canvas-frame {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.018) 0 8px, transparent 8px 16px),
    rgba(8, 8, 14, 0.7);
  padding: 6px;
  overflow: hidden;
}
.preview-canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 3px;
  background: #05050d;
}

/* ---------- readouts ---------- */
.readout,
.string-list {
  display: grid;
  gap: 0.7rem;
  margin: 0;
}
.readout div { min-width: 0; }
dt {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
}
dd { margin: 0.3rem 0 0; min-width: 0; }

code {
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
  word-break: break-all;
  color: var(--text);
}
.readout dd code,
.string-row dd code {
  display: block;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(8, 8, 14, 0.7);
}
.card--noise .readout dd code { color: var(--cyan); }
.card--dots .readout dd code { color: var(--magenta); }

/* ---------- palette ---------- */
.palette-list {
  display: grid;
  gap: 0.55rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.palette-item {
  display: grid;
  grid-template-columns: 2.6rem 1fr auto;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  padding: 0.45rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(8, 8, 14, 0.4);
  transition: border-color var(--duration-fast) ease,
    box-shadow var(--duration-fast) ease;
}
.palette-item:hover {
  border-color: rgba(255, 200, 87, 0.5);
  box-shadow: 0 0 16px rgba(255, 200, 87, 0.12);
}
.palette-swatch {
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
}
.palette-text { display: grid; gap: 0.15rem; min-width: 0; }
.palette-name {
  font-family: var(--pixel);
  font-size: 8px;
  letter-spacing: 0.08em;
  color: var(--gold);
}
.palette-text code { color: var(--text); }
.palette-copy {
  flex: none;
  min-height: 2.2rem;
  padding: 0.4rem 0.65rem;
}

/* ---------- strings ---------- */
.string-row dd {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
}
.string-row dd code {
  flex: 1 1 auto;
  min-width: 0;
}
.card--strings .string-row dd code { color: var(--green); }

/* ---------- copy buttons (cards + inline) ---------- */
.copy-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  min-height: 2.4rem;
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: color var(--duration-fast) ease,
    border-color var(--duration-fast) ease,
    background-color var(--duration-fast) ease,
    box-shadow var(--duration-fast) ease,
    transform var(--duration-fast) var(--ease-out);
}
.copy-button:hover {
  border-color: var(--cyan);
  background: rgba(69, 240, 255, 0.08);
  box-shadow: 0 0 14px rgba(69, 240, 255, 0.2);
}
.copy-button:active { transform: translateY(1px); }
.copy-button.is-copied {
  color: var(--green);
  border-color: var(--green);
  background: rgba(65, 255, 139, 0.1);
  box-shadow: 0 0 14px rgba(65, 255, 139, 0.22);
}
.copy-button--inline { align-self: stretch; }

/* ---------- payload ---------- */
.payload-panel { --rail: var(--cyan); }
.payload-output {
  width: 100%;
  min-height: 14rem;
  padding: 0.95rem;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(8, 8, 14, 0.7);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.55;
  transition: border-color var(--duration-fast) ease,
    box-shadow var(--duration-fast) ease;
}
.payload-output:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 1px var(--cyan), 0 0 18px rgba(69, 240, 255, 0.2);
}

/* ---------- footer ---------- */
.app-footer {
  display: grid;
  gap: 0.9rem;
  justify-items: center;
  margin-top: clamp(2rem, 5vw, 3.5rem);
  padding-top: clamp(1.5rem, 4vw, 2.5rem);
  border-top: 1px solid var(--line);
  text-align: center;
}
.app-footer__copy {
  margin: 0;
  font-family: var(--pixel);
  font-size: 8px;
  letter-spacing: 0.12em;
  line-height: 2;
  color: var(--dim);
}
.app-footer__algos {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin: 0;
}
.app-footer__algos span {
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--dim);
}

/* ---------- responsive: tablet ---------- */
@media (min-width: 40rem) {
  .seed-row {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: stretch;
  }
  .generator-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ---------- responsive: desktop (4-up with feature noise/dots) ---------- */
@media (min-width: 64rem) {
  .generator-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  /* the two canvas generators read as the hero pair */
  .card--noise,
  .card--dots {
    grid-column: span 2;
  }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .cursor,
  .privacy-badge__dot,
  .run-status[data-state="busy"]::before { animation: none !important; }
  .button-primary:hover,
  .lab-link:hover,
  .lab-link:focus-visible,
  .button-ghost:active,
  .copy-button:active { transform: none; }
}
