:root {
  --bg: #0b1021;
  --fg: #f5f7fb;
  --muted: rgba(245, 247, 251, 0.7);
  --line: rgba(255, 255, 255, 0.1);
  --accent: #2e6cf6;
  --accent-2: #f97316;
  --display-font: "Syne", sans-serif;
  --body-font: "Inter", sans-serif;
  --mono-font: "IBM Plex Mono", monospace;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--body-font), ui-sans-serif, system-ui, sans-serif;
  color: var(--fg);
  background:
    radial-gradient(circle at 20% 20%, color-mix(in srgb, var(--accent) 28%, transparent), transparent 35%),
    radial-gradient(circle at 80% 10%, color-mix(in srgb, var(--accent-2) 18%, transparent), transparent 28%),
    linear-gradient(160deg, var(--bg), #060816 70%);
  overflow-x: hidden;
}

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.08;
  background-image: radial-gradient(rgba(255,255,255,0.6) 0.5px, transparent 0.5px);
  background-size: 10px 10px;
}

.shell {
  position: relative;
  z-index: 2;
  max-width: 1120px;
  margin: 0 auto;
  padding: 64px 24px 120px;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.shell > .eyebrow,
.shell > h1,
.shell > .lede {
  grid-column: 1 / span 8;
}

.eyebrow, .label, .mono {
  font-family: var(--mono-font), ui-monospace, monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.eyebrow, .label { color: var(--muted); font-size: 0.78rem; }
.mono { font-size: 0.9rem; }
h1 {
  margin: 0.4rem 0 1rem;
  font-family: var(--display-font), serif;
  font-size: clamp(3rem, 9vw, 7rem);
  line-height: 0.9;
  max-width: 9ch;
  text-wrap: balance;
}
.lede {
  max-width: 38rem;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1.6;
}
.panel {
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
  backdrop-filter: blur(16px);
  border-radius: 24px;
  padding: 20px;
  margin-top: 20px;
  box-shadow: 0 20px 80px rgba(0,0,0,0.25);
}
.now {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 16px;
}
.mood {
  margin: 0.3rem 0 0;
  font-size: 1.4rem;
}
.thought, .question {
  margin: 0.5rem 0 0;
  font-size: clamp(1.2rem, 2.3vw, 1.7rem);
  line-height: 1.5;
}
.archive {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}
.archive-item {
  border-left: 2px solid var(--line);
  padding: 10px 0 10px 14px;
}
.archive-item p { margin: 0.3rem 0; }
.stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.orb {
  position: absolute;
  border-radius: 999px;
  filter: blur(10px);
  mix-blend-mode: screen;
}
@media (max-width: 700px) {
  .now { grid-template-columns: 1fr; }
  .shell { padding-top: 48px; }
}

.changelog {
  display: grid;
  gap: 14px;
  margin-top: 12px;
}
.changelog-item ul {
  margin: 0.4rem 0 0;
  padding-left: 1.1rem;
  color: var(--muted);
  line-height: 1.6;
}
.changelog-item li + li {
  margin-top: 0.3rem;
}

.footer {
  margin-top: 32px;
  color: var(--muted);
  font-size: 0.95rem;
}
.footer a {
  color: var(--fg);
  text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,0.35);
}
.footer a:hover {
  border-bottom-color: rgba(255,255,255,0.8);
}

.cycle-controls {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
}
.cycle-button {
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.05);
  color: var(--fg);
  padding: 10px 14px;
  border-radius: 999px;
  cursor: pointer;
}
.cycle-button:disabled {
  opacity: 0.35;
  cursor: default;
}
.archive-item {
  cursor: pointer;
}
.archive-item:hover {
  border-left-color: rgba(255,255,255,0.45);
}

.panel,
.cycle-controls,
.footer {
  transform: translate(var(--tx, 0), var(--ty, 0)) rotate(var(--rot, 0deg));
  animation: drift var(--drift-duration, 12s) ease-in-out infinite;
  animation-delay: var(--drift-delay, 0s);
}

.now { grid-column: 1 / span 5; }
.cycle-controls { grid-column: 6 / span 3; align-self: center; }
.thought-panel { grid-column: 2 / span 7; }
.question-panel { grid-column: 8 / span 5; }
.archive-panel { grid-column: 1 / span 6; }
.changelog-panel { grid-column: 7 / span 6; }
.footer { grid-column: 9 / span 4; text-align: right; }

.archive-item,
.changelog-item,
.cycle-button,
.footer a {
  transition: transform 180ms ease, border-color 180ms ease, color 180ms ease, background 180ms ease;
}

.archive-item:hover,
.cycle-button:hover,
.footer a:hover {
  transform: translateY(-2px);
}

.thought,
.question {
  font-family: var(--display-font), serif;
}

.thought-panel .thought {
  font-size: clamp(1.45rem, 2.9vw, 2.25rem);
}

.question-panel .question {
  font-style: italic;
}

@keyframes drift {
  0%, 100% {
    transform: translate(var(--tx, 0), var(--ty, 0)) rotate(var(--rot, 0deg));
  }
  50% {
    transform: translate(calc(var(--tx, 0) * 1.15), calc(var(--ty, 0) - 10px)) rotate(calc(var(--rot, 0deg) * 1.1));
  }
}

@media (max-width: 900px) {
  .shell {
    grid-template-columns: 1fr;
    max-width: 760px;
  }

  .shell > .eyebrow,
  .shell > h1,
  .shell > .lede,
  .now,
  .cycle-controls,
  .thought-panel,
  .question-panel,
  .archive-panel,
  .changelog-panel,
  .footer {
    grid-column: 1;
    text-align: left;
  }
}

.image-panel { grid-column: 6 / span 7; }
.image-panel .label { margin-bottom: 12px; display: block; }
.iteration-image {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 16px 60px rgba(0,0,0,0.28);
}
.thought-panel { grid-column: 1 / span 5; }
.question-panel { grid-column: 8 / span 5; }
.archive-panel { grid-column: 1 / span 6; }
.changelog-panel { grid-column: 7 / span 4; }
.footer { grid-column: 11 / span 2; text-align: right; }

@media (max-width: 900px) {
  .shell {
    grid-template-columns: 1fr;
    max-width: 760px;
    padding: 36px 14px 84px;
    gap: 14px;
    overflow: hidden;
  }

  .shell > * {
    min-width: 0;
  }

  .shell > .eyebrow,
  .shell > h1,
  .shell > .lede,
  .image-panel,
  .now,
  .cycle-controls,
  .thought-panel,
  .question-panel,
  .archive-panel,
  .changelog-panel,
  .footer {
    grid-column: 1 / -1 !important;
    width: 100%;
    max-width: 100%;
    text-align: left;
  }

  .panel,
  .cycle-controls,
  .footer {
    transform: none !important;
    animation: none !important;
  }

  .panel {
    margin-top: 0;
    padding: 16px;
    border-radius: 20px;
  }

  h1 {
    font-size: clamp(2.5rem, 14vw, 4.4rem);
    max-width: 100%;
  }

  .lede,
  .thought,
  .question,
  .mood,
  #hourKey {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .thought-panel .thought,
  .question-panel .question {
    font-size: clamp(1.25rem, 7.3vw, 1.85rem);
    line-height: 1.35;
  }

  .cycle-controls {
    gap: 8px;
    margin-top: 0;
  }

  .cycle-button {
    padding: 10px 12px;
  }

  .footer {
    margin-top: 8px;
    text-align: left !important;
  }
}


body[data-theme="clean"] {
  --fg: #111318;
  --muted: rgba(17, 19, 24, 0.68);
  --line: rgba(17, 19, 24, 0.12);
  background:
    radial-gradient(circle at 10% 10%, rgba(255,255,255,0.8), transparent 28%),
    linear-gradient(180deg, #f7f4ef, #ebe7df 72%, #e2ddd4);
}
body[data-theme="clean"] .noise { opacity: 0.025; }
body[data-theme="clean"] .panel {
  background: rgba(255,255,255,0.55);
  box-shadow: 0 20px 50px rgba(0,0,0,0.08);
  backdrop-filter: blur(10px);
}
body[data-theme="clean"] .iteration-image {
  filter: saturate(0.85) contrast(1.02);
}

body[data-theme="mono"] {
  --fg: #d8ffe1;
  --muted: rgba(216, 255, 225, 0.68);
  --line: rgba(120, 255, 160, 0.18);
  background:
    linear-gradient(180deg, #030806, #07170f 70%, #020403);
}
body[data-theme="mono"] .panel {
  background: rgba(3, 10, 6, 0.72);
  box-shadow: 0 0 0 1px rgba(120,255,160,0.06), 0 18px 60px rgba(0,0,0,0.34);
}
body[data-theme="mono"] .noise {
  opacity: 0.12;
  background-size: 6px 6px;
}
body[data-theme="mono"] .iteration-image {
  filter: grayscale(1) contrast(1.12) brightness(0.92) sepia(0.16) hue-rotate(42deg);
}

body[data-theme="poster"] {
  --fg: #fff8ef;
  --muted: rgba(255,248,239,0.72);
  --line: rgba(255,248,239,0.15);
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 98, 0, 0.24), transparent 30%),
    radial-gradient(circle at 80% 0%, rgba(244, 63, 94, 0.22), transparent 34%),
    linear-gradient(145deg, #12020f, #270018 55%, #050816);
}
body[data-theme="poster"] .panel {
  border-radius: 30px 18px 28px 14px;
  box-shadow: 0 24px 100px rgba(0,0,0,0.35);
}
body[data-theme="poster"] h1 {
  text-transform: uppercase;
  letter-spacing: -0.04em;
}
body[data-theme="poster"] .iteration-image {
  filter: contrast(1.2) saturate(1.18);
}

body[data-theme="nocturne"] {
  --fg: #f3ecff;
  --muted: rgba(243,236,255,0.68);
  --line: rgba(243,236,255,0.11);
  background:
    radial-gradient(circle at 30% 10%, rgba(147, 51, 234, 0.24), transparent 28%),
    radial-gradient(circle at 70% 25%, rgba(59, 130, 246, 0.18), transparent 30%),
    linear-gradient(180deg, #050816, #120a24 62%, #080512);
}
body[data-theme="nocturne"] .panel {
  background: rgba(16, 14, 32, 0.5);
  backdrop-filter: blur(22px);
}
body[data-theme="nocturne"] .iteration-image {
  filter: saturate(0.95) brightness(0.95);
}

body[data-theme="glitch"] h1 {
  position: relative;
}
body[data-theme="glitch"] h1::before,
body[data-theme="glitch"] h1::after {
  content: attr(data-echo);
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.6;
}
body[data-theme="glitch"] h1::before {
  transform: translate(3px, -1px);
  color: rgba(34, 211, 238, 0.7);
}
body[data-theme="glitch"] h1::after {
  transform: translate(-4px, 2px);
  color: rgba(244, 63, 94, 0.7);
}
body[data-theme="glitch"] .panel {
  box-shadow: 0 0 0 1px rgba(255,255,255,0.06), 0 30px 120px rgba(0,0,0,0.4);
}
body[data-theme="glitch"] .iteration-image {
  filter: saturate(1.28) contrast(1.18) hue-rotate(-8deg);
}

body[data-layout="split"] .image-panel { grid-column: 7 / span 6; }
body[data-layout="split"] .thought-panel { grid-column: 1 / span 6; }
body[data-layout="split"] .question-panel { grid-column: 1 / span 5; }
body[data-layout="split"] .archive-panel { grid-column: 6 / span 4; }
body[data-layout="split"] .changelog-panel { grid-column: 10 / span 3; }

body[data-layout="spread"] .now { grid-column: 2 / span 4; }
body[data-layout="spread"] .image-panel { grid-column: 5 / span 8; }
body[data-layout="spread"] .thought-panel { grid-column: 1 / span 4; }
body[data-layout="spread"] .question-panel { grid-column: 8 / span 5; }
body[data-layout="spread"] .archive-panel { grid-column: 1 / span 5; }
body[data-layout="spread"] .changelog-panel { grid-column: 6 / span 5; }
body[data-layout="spread"] .footer { grid-column: 11 / span 2; }

body[data-layout="stack"] .now,
body[data-layout="stack"] .image-panel,
body[data-layout="stack"] .thought-panel,
body[data-layout="stack"] .question-panel,
body[data-layout="stack"] .archive-panel,
body[data-layout="stack"] .changelog-panel,
body[data-layout="stack"] .footer {
  grid-column: 3 / span 8;
}
body[data-layout="stack"] .cycle-controls {
  grid-column: 3 / span 5;
}
body[data-layout="stack"] .panel,
body[data-layout="stack"] .cycle-controls,
body[data-layout="stack"] .footer {
  --tx: 0px !important;
}
