/* =====================================================================
   Riddler — live styles.
   The "composite" block (everything within the .composite -> .sparks-overlay
   rules) is ported verbatim from build-artifacts/preview.html per SPEC §11.3
   and is LOCKED. Do not modify those rules.
   The rest of the file (page chrome per SPEC §4.1, §12) is for the live app.
   ===================================================================== */

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; overflow-x: hidden; overflow-x: clip; }
body {
  min-height: 100vh;
  display: block;
  overflow-x: hidden;
  overflow-x: clip;
  background: #08081a;
  color: #e6f6ff;
  font-family: "Inter", "Segoe UI", "SF Pro Text", -apple-system, BlinkMacSystemFont, sans-serif;
  font-feature-settings: "kern" 1;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle, rgba(255,255,255,.20) 1px, transparent 1.6px),
    radial-gradient(circle, rgba(0,212,255,.16) .8px, transparent 1.5px);
  background-size: 86px 86px, 137px 137px;
  background-position: 12px 8px, 44px 51px;
  opacity: .20;
  z-index: 0;
}

.page {
  position: relative;
  z-index: 1;
  max-width: 1240px;
  margin: 0 auto;
  padding: 36px 28px 56px;
  display: flex;
  flex-direction: column;
  gap: 32px;
  align-items: center;
}

/* =====================================================================
   Layout v2 — hero grid (added 2026-06-02)
   <980px: single-column stack (preserves prior behaviour).
   >=980px: two-column grid; signet+tagline left, intro+clock+cadence right.
   DOM source order composite -> tagline -> intro is preserved (LOCKED §11.3).
   ===================================================================== */
.hero {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
}
.hero-left {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.hero-right {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-items: center;
  text-align: center;
}
.main-action {
  width: 100%;
  max-width: 1240px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  align-items: center;
  margin: 0 auto;
}
.main-action .riddle-card {
  max-width: 1240px;
}
.main-action .form,
.main-action .lockout-banner {
  max-width: 640px;
}

@media (min-width: 1100px) {
  .hero {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: 48px;
    align-items: center;
  }
  .hero-left {
    align-items: stretch;
  }
  .hero-left .composite {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
  }
  /* Tagline lives in the right column at ≥ 1100 px (Layout v2 iter 3,
     2026-06-02 evening — moved from the left column because, when the
     orbit's Brain and Lightbulb sit between RIDDLER and the slogan,
     the visual link "RIDDLER -> Built with AI" gets broken by the icons.
     Now sits as the first line of the right column, immediately above
     the intro paragraph — visually "directly above the intro" and in
     DOM source order still "between composite and intro" per SPEC
     §15.5 #11 / §15.6 #1 v1.2). Mobile (< 1100 px): the default
     centred tagline rule below 1100 px still wins. */
  .hero-right .tagline {
    text-align: left;
    max-width: none;
    margin: 0;
    padding: 0;
    color: rgba(225, 240, 255, .78);
    font-size: 15px;
    letter-spacing: 0.02em;
  }
  .hero-right .intro {
    margin-top: 4px;
  }
  .hero-right {
    align-items: stretch;
    text-align: left;
  }
  .hero-right .intro {
    margin: 0;
    text-align: left;
    max-width: none;
  }
  .hero-right .clock {
    text-align: left;
  }
  .hero-right .cadence-panel {
    margin-top: 4px;
    padding: 16px 0 0 0;
    border-top: 1px solid rgba(0, 212, 255, .14);
    text-align: left;
  }
  .hero-right .cadence-row {
    justify-content: flex-start;
  }
  .hero-right .cadence-help {
    text-align: left;
  }
  .hero-right .cadence-slider {
    flex: 1;
    min-width: 200px;
    max-width: 360px;
  }
}

/* ===== Composite container — five-layer sandwich (LOCKED — from preview.html) ===== */
.composite {
  position: relative;
  width: min(760px, 94vw);
  aspect-ratio: 16 / 10;
  isolation: isolate;
}
.wordmark-bg, .wordmark-fg {
  position: absolute;
  left: 5%;
  right: 5%;
  top: 50%;
  width: 90%;
  height: auto;
  transform: translateY(-50%);
  pointer-events: none;
  filter: drop-shadow(0 0 24px rgba(255, 0, 255, .32))
          drop-shadow(0 0 14px rgba(0, 212, 255, .26));
}
.wordmark-bg {
  z-index: 1;
  -webkit-mask-image: linear-gradient(to right, transparent 0%, black 100%);
          mask-image: linear-gradient(to right, transparent 0%, black 100%);
}
.wordmark-fg {
  z-index: 4;
  -webkit-mask-image: linear-gradient(to left, transparent 0%, black 100%);
          mask-image: linear-gradient(to left, transparent 0%, black 100%);
}
.orbit {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(440px, 62vw);
  aspect-ratio: 1;
  z-index: 2;
  isolation: isolate;
}
.rotor { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; animation: orbit-spin 36s linear infinite; transform-origin: 50% 50%; }
@keyframes orbit-spin { to { transform: rotate(360deg); } }
.trail { position: absolute; inset: 0; overflow: visible; }
.trail-path {
  fill: none;
  stroke: url(#trailGradient);
  stroke-width: 8;
  stroke-linejoin: round;
  stroke-linecap: round;
  stroke-dasharray: 36 18;
  filter: url(#neonGlow);
  animation: energy-flow 3.8s linear infinite;
}
.trail-core { fill: none; stroke: rgba(255,255,255,.75); stroke-width: 2; stroke-linecap: round; }
@keyframes energy-flow { to { stroke-dashoffset: -108; } }
.node {
  position: absolute;
  left: calc(50% + var(--x));
  top: calc(50% + var(--y));
  width: 122px;
  height: 122px;
  transform: translate(-50%, -50%);
}
.node-mask {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background:
    radial-gradient(circle,
      rgba(6,6,12,1)    0%,
      rgba(6,6,12,.97) 10%,
      rgba(6,6,12,.78) 25%,
      rgba(6,6,12,.45) 40%,
      rgba(6,6,12,.18) 55%,
      rgba(6,6,12,.06) 70%,
      rgba(6,6,12,.015) 85%,
      rgba(6,6,12,0)  100%);
  pointer-events: none;
  z-index: 0;
}
.upright {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  animation: counter-spin 36s linear infinite;
}
@keyframes counter-spin { to { transform: rotate(-360deg); } }
.halo, .icon {
  position: absolute;
  animation: spotlight 15s ease-in-out infinite;
  animation-delay: var(--spot-delay);
}
.halo {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.32), rgba(0,212,255,.20) 34%, rgba(255,0,255,.11) 56%, transparent 72%);
  filter: blur(8px);
  opacity: .12;
}
.icon {
  width: 118px;
  height: 118px;
  object-fit: contain;
  opacity: .30;
  transform: scale(.94);
  filter: drop-shadow(0 0 5px rgba(0,0,0,.55));
}
@keyframes spotlight {
  0%, 26.67% { opacity: 1; transform: scale(1.06); filter: drop-shadow(0 0 6px #fff) drop-shadow(0 0 20px rgba(0,212,255,.85)) drop-shadow(0 0 34px rgba(255,0,255,.45)); }
  33.33%, 93.33% { opacity: .30; transform: scale(.94); filter: drop-shadow(0 0 5px rgba(0,0,0,.55)); }
  100% { opacity: 1; transform: scale(1.06); filter: drop-shadow(0 0 6px #fff) drop-shadow(0 0 20px rgba(0,212,255,.85)) drop-shadow(0 0 34px rgba(255,0,255,.45)); }
}
.halo { animation-name: halo-visit; }
@keyframes halo-visit { 0%,26.67%,100%{opacity:.85;transform:scale(1)} 33.33%,93.33%{opacity:.10;transform:scale(.78)} }
.letter-shield {
  position: absolute;
  left: 6%;
  top: 50%;
  transform: translateY(-50%);
  width: 46%;
  height: 32%;
  z-index: 3;
  pointer-events: none;
  background:
    radial-gradient(ellipse 55% 65% at 35% 50%,
      rgba(6,6,12,.94) 35%,
      rgba(6,6,12,.70) 60%,
      rgba(6,6,12,.30) 82%,
      transparent 100%);
  border-radius: 18%;
}
.sparks-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}

/* Locked signature tagline — per SPEC §4.1, §11.3 */
.tagline {
  margin: 8px auto 0;
  max-width: 640px;
  font-size: clamp(14px, 1.4vw, 16px);
  font-weight: 400;
  letter-spacing: 0.04em;
  color: rgba(220, 230, 245, .72);
  text-align: center;
}

@media (max-width: 720px) {
  .composite { aspect-ratio: 5 / 4; }
  .orbit { width: min(360px, 78vw); }
  .letter-shield { width: 50%; height: 28%; }
}

/* ===== Page chrome (live app — §4.1 + §12) ===== */

.intro {
  margin: 0 auto;
  max-width: 640px;
  text-align: center;
  font-size: clamp(15px, 1.5vw, 17px);
  line-height: 1.55;
  color: rgba(230, 246, 255, .85);
}

.clock {
  font-size: 14px;
  letter-spacing: 0.04em;
  color: rgba(230, 246, 255, .6);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.riddle-card {
  width: 100%;
  max-width: 760px;
  padding: 28px 26px;
  border: 1px solid rgba(0, 212, 255, .18);
  border-radius: 14px;
  background: rgba(10, 12, 28, .55);
  box-shadow: 0 0 36px -10px rgba(0, 212, 255, .25),
              inset 0 0 0 1px rgba(255, 255, 255, .02);
  text-align: center;
}
.riddle-text {
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.32;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: #e6f6ff;
  text-shadow: 0 0 14px rgba(0, 212, 255, .35);
  font-variant-ligatures: common-ligatures;
  margin: 0;
}
.riddle-meta {
  margin-top: 10px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(230, 246, 255, .42);
}

.countdown {
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
  color: rgba(230, 246, 255, .82);
  text-align: center;
  transition: color 240ms ease;
}
.countdown.warn { color: #ffb86b; }
.countdown.urgent {
  color: #ff6b6b;
  animation: countdown-pulse 1.4s ease-in-out infinite;
}
@keyframes countdown-pulse {
  0%, 100% { text-shadow: 0 0 6px rgba(255, 107, 107, .25); }
  50%      { text-shadow: 0 0 24px rgba(255, 107, 107, .85); }
}

.form {
  width: 100%;
  max-width: 760px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.field-label {
  font-size: 13px;
  letter-spacing: 0.06em;
  color: rgba(230, 246, 255, .65);
  margin-bottom: 6px;
  display: block;
}
.field-helper {
  font-size: 12px;
  color: rgba(230, 246, 255, .42);
  margin-top: 4px;
}
.answer-input, .email-input {
  width: 100%;
  background: rgba(8, 10, 22, .85);
  color: #e6f6ff;
  border: 1px solid rgba(0, 212, 255, .22);
  border-radius: 10px;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 16px;
  outline: none;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}
.answer-input {
  resize: vertical;
  min-height: 88px;
  max-height: 220px;
  line-height: 1.45;
}
.answer-input:focus, .email-input:focus {
  border-color: #00d4ff;
  box-shadow: 0 0 0 3px rgba(0, 212, 255, .15);
}
.answer-input:disabled, .email-input:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.check-btn {
  align-self: center;
  width: 100%;
  max-width: 320px;
  padding: 14px 22px;
  background: linear-gradient(135deg, #00d4ff 0%, #2af3ff 100%);
  color: #04101a;
  border: none;
  border-radius: 12px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: background 200ms ease, transform 120ms ease, box-shadow 200ms ease;
  box-shadow: 0 0 24px -6px rgba(0, 212, 255, .55);
}
.check-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #ff3df5 0%, #00d4ff 100%);
  transform: translateY(-1px);
}
.check-btn:disabled {
  opacity: .55;
  cursor: not-allowed;
  background: linear-gradient(135deg, #44546b 0%, #2a3543 100%);
  color: rgba(230, 246, 255, .55);
  box-shadow: none;
}
.check-btn .spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 8px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spinner-spin 800ms linear infinite;
  vertical-align: -3px;
}
@keyframes spinner-spin { to { transform: rotate(360deg); } }

.status-line {
  min-height: 1.5em;
  font-size: 15px;
  text-align: center;
  letter-spacing: 0.02em;
  color: rgba(230, 246, 255, .75);
}
.status-line.is-success { color: #5cffa8; }
.status-line.is-error   { color: #ff6b6b; }
.status-line.is-busy    { color: #ffb86b; }

.lockout-banner {
  width: 100%;
  max-width: 760px;
  padding: 12px 16px;
  text-align: center;
  border: 1px solid rgba(255, 107, 107, .35);
  border-radius: 10px;
  background: rgba(40, 12, 18, .55);
  color: #ffd7d7;
  font-size: 14px;
  letter-spacing: 0.04em;
  display: none;
}
body.is-locked .lockout-banner { display: block; }
body.is-locked .answer-input,
body.is-locked .email-input,
body.is-locked .check-btn {
  opacity: .45;
  cursor: not-allowed;
}

/* Cadence control */
.cadence-panel {
  width: 100%;
  max-width: 760px;
  padding: 18px 22px;
  border-top: 1px solid rgba(0, 212, 255, .12);
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: center;
}
.cadence-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}
.cadence-label {
  font-size: 14px;
  color: rgba(230, 246, 255, .72);
  letter-spacing: 0.04em;
}
.cadence-value {
  font-variant-numeric: tabular-nums;
  color: #e6f6ff;
  font-weight: 500;
}
.cadence-slider {
  appearance: none;
  -webkit-appearance: none;
  width: 280px;
  max-width: 100%;
  height: 4px;
  background: rgba(0, 212, 255, .25);
  border-radius: 999px;
  outline: none;
  cursor: pointer;
}
.cadence-slider::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #00d4ff;
  border: 2px solid #08081a;
  box-shadow: 0 0 12px rgba(0, 212, 255, .65);
  cursor: pointer;
}
.cadence-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #00d4ff;
  border: 2px solid #08081a;
  box-shadow: 0 0 12px rgba(0, 212, 255, .65);
  cursor: pointer;
}
.cadence-help {
  font-size: 12px;
  color: rgba(230, 246, 255, .42);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(20px);
  padding: 10px 18px;
  background: rgba(8, 12, 22, .92);
  border: 1px solid rgba(0, 212, 255, .35);
  color: #e6f6ff;
  border-radius: 999px;
  font-size: 13px;
  letter-spacing: 0.04em;
  opacity: 0;
  pointer-events: none;
  transition: opacity 240ms ease, transform 240ms ease;
  z-index: 50;
}
.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
