:root {
  color-scheme: dark;
  --bg: #090909;
  --ink: #f5f0e8;
  --muted: rgba(245, 240, 232, 0.62);
  --line: rgba(245, 240, 232, 0.24);
  --faint: rgba(245, 240, 232, 0.08);
  --accent: #f7d36b;
  --danger: #ff6f91;
  --glow: rgba(247, 211, 107, 0.2);
  font-family: Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  display: grid;
  place-items: center;
  overflow-x: hidden;
  overflow-y: auto;
  background:
    radial-gradient(circle at var(--x, 50%) var(--y, 50%), rgba(255, 255, 255, 0.08), transparent 16rem),
    linear-gradient(180deg, #101010, var(--bg));
  color: var(--ink);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.12;
  background:
    repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.09) 0 1px, transparent 1px 4px),
    radial-gradient(circle at 15% 20%, rgba(255, 255, 255, 0.08), transparent 14rem);
  mix-blend-mode: screen;
}

button,
select {
  font: inherit;
}

.experiment {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 1.2rem;
  width: min(820px, calc(100vw - 32px));
  min-height: min(720px, calc(100vh - 32px));
  padding: clamp(1rem, 4vw, 2.2rem);
  border: 1px solid var(--line);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.012)),
    rgba(0, 0, 0, 0.52);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
}

.experiment--full {
  width: min(960px, calc(100vw - 32px));
}

.topline,
.readout,
.soft-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.eyebrow,
.note,
.small {
  color: var(--muted);
  font-family: "Courier New", monospace;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0;
  font-size: 0.76rem;
}

h1 {
  margin: 0;
  font-family: "Comic Sans MS", "Arial Rounded MT Bold", Arial, sans-serif;
  font-size: clamp(2.35rem, 8vw, 5.3rem);
  line-height: 0.9;
  letter-spacing: 0;
  transform: rotate(-0.4deg);
}

.note {
  max-width: 54ch;
  margin: 0;
  line-height: 1.45;
}

.stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 340px;
  overflow: hidden;
  border: 1px dotted var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.025);
}

.primary,
.ghost,
.chip,
select {
  min-height: 2.4rem;
  padding: 0.56rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  cursor: pointer;
}

.primary {
  border-color: rgba(247, 211, 107, 0.55);
  background: rgba(247, 211, 107, 0.12);
  box-shadow: 0 0 26px var(--glow);
}

.ghost:hover,
.primary:hover,
.chip:hover {
  transform: translateY(-1px) rotate(-0.2deg);
  border-color: rgba(245, 240, 232, 0.58);
}

select {
  color: var(--ink);
}

select option {
  color: #101010;
}

.result {
  display: grid;
  gap: 0.35rem;
  min-height: 5.5rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.045);
}

.result strong {
  font-size: clamp(1.4rem, 4vw, 2.5rem);
}

.tiny-doodle {
  position: absolute;
  color: rgba(245, 240, 232, 0.26);
  font-family: "Courier New", monospace;
  font-size: 0.72rem;
  transform: rotate(-8deg);
  user-select: none;
}

.doodle-a {
  left: 1.2rem;
  bottom: 1.1rem;
}

.doodle-b {
  right: 1.4rem;
  top: 1.2rem;
  transform: rotate(7deg);
}

.pulse-dot {
  width: 1.05rem;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 34px var(--accent);
  animation: pulse 2.4s ease-in-out infinite;
}

.timer-face {
  color: rgba(245, 240, 232, 0.9);
  font-family: "Courier New", monospace;
  font-size: clamp(1.8rem, 7vw, 5rem);
  text-align: center;
  text-shadow: 0 0 30px rgba(247, 211, 107, 0.2);
  animation: slowDrift 5s ease-in-out infinite;
}

.fixation {
  position: relative;
  z-index: 1;
  width: 0.92rem;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #f5f0e8;
  box-shadow: 0 0 24px rgba(245, 240, 232, 0.52);
}

.fixation::after {
  content: "";
  position: absolute;
  inset: -0.55rem;
  border: 1px solid rgba(245, 240, 232, 0.22);
  border-radius: 50%;
}

.word-stage {
  min-height: 300px;
}

.word {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 1.05em;
  color: #f5f0e8;
  font-family: "Courier New", monospace;
  font-size: clamp(3.4rem, 16vw, 8.5rem);
  letter-spacing: 0.04em;
  text-shadow: 0 0 34px rgba(255, 255, 255, 0.14);
}

.word span {
  display: inline-block;
  min-width: 0.68em;
  transition: opacity 0.7s ease, transform 0.7s ease, color 0.7s ease;
}

.word span.changed {
  color: var(--accent);
  transform: translateY(-0.08em) rotate(-2deg);
}

.gaze {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 132px;
  aspect-ratio: 1;
  border: 1px solid rgba(245, 240, 232, 0.13);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  box-shadow:
    inset 0 0 40px rgba(0, 0, 0, 0.45),
    0 0 30px rgba(255, 255, 255, 0.045);
}

@keyframes slowDrift {
  0%,
  100% {
    transform: translateY(0) rotate(-0.2deg);
  }
  50% {
    transform: translateY(5px) rotate(0.2deg);
  }
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(0.86);
    opacity: 0.72;
  }
  50% {
    transform: scale(1.06);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

@media (max-width: 680px) {
  body {
    overflow: auto;
  }

  .experiment {
    min-height: calc(100vh - 24px);
    width: calc(100vw - 24px);
    padding: 1rem;
  }

  .stage {
    min-height: 300px;
  }
}
