/* =========================================================================
   SQ_d Hints — PHOSPHOR CRT theme
   Monochrome green terminal: scanlines, glow, flicker, monospace, Apple ][e.
   ========================================================================= */

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: #020d05;
  color: #33ff66;
  font-family: "Courier New", ui-monospace, Menlo, Consolas, monospace;
  line-height: 1.55;
  text-shadow: 0 0 6px rgba(51, 255, 102, 0.55);
  letter-spacing: 0.5px;
  min-height: 100vh;
  position: relative;
}

/* Scanline + glow overlay sits above everything but ignores clicks. */
.crt-overlay {
  display: block;
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(0, 0, 0, 0) 0px,
      rgba(0, 0, 0, 0) 2px,
      rgba(0, 0, 0, 0.28) 3px,
      rgba(0, 0, 0, 0.28) 4px
    ),
    radial-gradient(120% 120% at 50% 50%, transparent 60%, rgba(0,0,0,0.6) 100%);
  animation: flicker 6s infinite steps(60);
  /* Dimmed via filter (not opacity) on hover — the flicker animation drives
     the opacity property, so a filter avoids being overridden. */
  filter: opacity(1);
  transition: filter .25s ease;
}
/* Ease eye strain: fade the scanline interlace while reading the content. */
body:has(.page:hover) .crt-overlay { filter: opacity(0.3); }
@keyframes flicker {
  0%, 96%, 100% { opacity: 1; }
  97% { opacity: 0.82; }
  98% { opacity: 0.96; }
  99% { opacity: 0.8; }
}
@keyframes caret { 50% { opacity: 0; } }

/* ---- Masthead ---------------------------------------------------------- */
.masthead {
  max-width: 820px;
  margin: 0 auto;
  padding: 30px 22px 6px;
}
.masthead__bar {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid #1f7a3f;
  background: #062c14;
  color: #aaffcc;
  padding: 6px 10px;
}
.apple-mark { font-weight: bold; color: #aaffcc; font-size: 0.9rem; text-transform: none; letter-spacing: normal; }
.masthead__title {
  font-size: clamp(1.4rem, 4vw, 2rem);
  margin: 0;
  font-weight: bold;
  text-transform: uppercase;
}
.masthead__title::after {
  content: "_";
  animation: caret 1s steps(1) infinite;
}
.masthead__sub {
  display: inline;
  font-size: 0.9rem;
  font-weight: normal;
  letter-spacing: 2px;
}
.masthead__title { text-align: left; }
.masthead__logo { display: inline-flex; align-items: center; order: 2; margin-left: auto; }
.masthead__logo img { height: 38px; display: block; filter: invert(1); }
.tagline {
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 0.85rem;
  color: #1faf55;
}
.tagline::before { content: "> "; }

/* ---- Theme switch ------------------------------------------------------ */
.theme-switch {
  max-width: 820px;
  margin: 0 auto;
  padding: 12px 22px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.theme-switch__label { color: #1faf55; }
.theme-btn {
  font-family: inherit;
  font-size: 0.9rem;
  color: #33ff66;
  background: #041a0c;
  border: 1px solid #1f7a3f;
  padding: 6px 14px;
  cursor: pointer;
  text-shadow: inherit;
}
.theme-btn::before { content: "[ "; }
.theme-btn::after  { content: " ]"; }
.theme-btn:hover { background: #0a3c1d; }
.theme-btn.is-active {
  background: #33ff66;
  color: #021006;
  text-shadow: none;
  font-weight: bold;
}

/* ---- Page -------------------------------------------------------------- */
.page { max-width: 820px; margin: 0 auto; padding: 6px 22px 60px; }

.intro p {
  border: 1px dashed #1f7a3f;
  padding: 12px 14px;
}
.intro p::before { content: "REM "; color: #1faf55; }

.section-title {
  text-transform: uppercase;
  letter-spacing: 3px;
  font-size: 1.05rem;
  margin: 34px 0 12px;
  border-bottom: 1px solid #1f7a3f;
  padding-bottom: 4px;
}

/* ---- Stages ------------------------------------------------------------ */
.stage {
  border: 1px solid #145e2f;
  margin-bottom: 10px;
  background: #03150a;
}
.stage-label {
  width: 100%;
  text-align: left;
  font-family: inherit;
  font-size: 1.02rem;
  color: #33ff66;
  background: transparent;
  border: 0;
  padding: 13px 14px;
  cursor: pointer;
  text-shadow: inherit;
  display: flex;
  align-items: center;
  gap: 10px;
}
.stage-label::before { content: "[+]"; color: #aaffcc; }
.stage-label.is-open::before { content: "[-]"; }
.stage-label:hover { background: #0a3c1d; }
.stage-num {
  border: 1px solid #1f7a3f;
  padding: 1px 7px;
  color: #aaffcc;
}

/* Reveal */
.stage-hint, .spoiler-body { display: none; padding: 0 16px; }
.stage-hint.is-open {
  display: block;
  padding: 4px 16px 16px 26px;
  border-top: 1px dashed #145e2f;
}
.stage-hint p::before,
.stage-hint li { }
.stage-hint code {
  background: #062c14;
  color: #aaffcc;
  padding: 0 5px;
  border: 1px solid #145e2f;
}
.stage-hint blockquote {
  margin: 10px 0;
  padding: 8px 14px;
  border-left: 2px solid #33ff66;
  background: #052010;
  font-style: normal;
}
.stage-hint blockquote::before { content: "> "; }
.stage-hint .path { color: #aaffcc; white-space: nowrap; }
.stage-hint .how-to { color: #aaffcc; font-weight: bold; }
.stage-hint ol, .stage-hint ul { padding-left: 24px; }
.stage-hint li { margin: 6px 0; }
.stage-hint li::marker { color: #1faf55; }

/* Nested spoiler — danger styled but still monochrome-ish */
.spoiler-label {
  font-family: inherit;
  font-size: 0.85rem;
  color: #021006;
  background: #ffcc33;
  border: 0;
  padding: 6px 12px;
  margin-top: 10px;
  cursor: pointer;
  text-shadow: none;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.spoiler-body.is-open {
  display: block;
  margin-top: 8px;
  padding: 10px 14px;
  border: 1px dashed #ffcc33;
  background: #161000;
  color: #ffe699;
  text-shadow: 0 0 6px rgba(255, 204, 51, 0.4);
}
.spoiler-body strong { color: #fff3c2; }

/* ---- Solution ---------------------------------------------------------- */
.video-placeholder {
  border: 1px solid #1f7a3f;
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  background:
    repeating-linear-gradient(to bottom,
      rgba(0,0,0,0) 0 3px, rgba(51,255,102,0.04) 3px 4px);
}
.video-placeholder__inner { text-align: center; }
.video-playmark {
  display: inline-block;
  font-size: 2.4rem;
  border: 2px solid #33ff66;
  border-radius: 50%;
  width: 64px; height: 64px;
  line-height: 60px;
  margin-bottom: 10px;
}
.video-caption { text-transform: uppercase; letter-spacing: 2px; }
.video-note { color: #1faf55; }
.video-note::before { content: "// "; }

/* ---- Footer ------------------------------------------------------------ */
.colophon {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 22px 44px;
  text-align: center;
  color: #1faf55;
  font-size: 0.8rem;
  letter-spacing: 2px;
}
.rule { border: 0; border-top: 1px solid #1f7a3f; margin: 0 0 14px; }
.colophon p::after { content: " \2588"; animation: caret 1s steps(1) infinite; }
.theme-toggle { cursor: pointer; }
.theme-toggle:hover { color: #4dff88; }
