@font-face {
  font-family: "Cormorant";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: local("Cormorant Garamond"), local("Cormorant"),
       url("https://fonts.gstatic.com/s/cormorantgaramond/v16/co3YmX5slCNuHLi8bLeY9MK7whWMhyjornFLsS6V7w.woff2") format("woff2");
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: #07060a;
  color: #d9c9b4;
  font-family: "Cormorant", "Cormorant Garamond", "EB Garamond", Georgia, serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

body {
  position: relative;
  background:
    radial-gradient(1100px 700px at 50% 60%, #1a0e08 0%, #07060a 55%, #000 100%),
    #07060a;
  background-attachment: fixed;
  display: grid;
  place-items: center;
}

body::before {
  content: "";
  position: fixed; inset: 0;
  background-image:
    radial-gradient(rgba(244,162,97,0.045) 1px, transparent 1px),
    radial-gradient(rgba(244,162,97,0.025) 1px, transparent 1px);
  background-size: 3px 3px, 9px 9px;
  background-position: 0 0, 1px 2px;
  mix-blend-mode: screen;
  pointer-events: none;
  animation: drift 18s linear infinite;
}

body::after {
  content: "";
  position: fixed; inset: 0;
  background: radial-gradient(circle at 50% 60%, transparent 0%, transparent 30%, rgba(0,0,0,0.55) 80%);
  pointer-events: none;
}

@keyframes drift {
  to { background-position: 0 60px, 1px 62px; }
}

main {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 4rem 1.5rem;
  max-width: 36rem;
}

.sigil {
  width: 7rem;
  height: 7rem;
  display: block;
  margin: 0 auto 2.5rem;
  filter: drop-shadow(0 0 18px rgba(244, 162, 97, 0.35));
  animation: pulse 5.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.9; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.03); filter: drop-shadow(0 0 26px rgba(244, 162, 97, 0.55)); }
}

h1 {
  font-weight: 400;
  font-size: clamp(2.6rem, 7vw, 4.2rem);
  letter-spacing: 0.04em;
  color: #f3e2c4;
  text-shadow: 0 0 24px rgba(244, 162, 97, 0.18);
  margin-bottom: 1.1rem;
}

.lede {
  font-style: italic;
  font-size: clamp(1.05rem, 2.2vw, 1.25rem);
  color: #a89074;
  letter-spacing: 0.02em;
  margin-bottom: 3.5rem;
}

.meta {
  font-size: 0.82rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: #6c5a45;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
}

.meta #cycle {
  transition: opacity 0.6s ease;
}

.dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #f4a261;
  box-shadow: 0 0 8px #f4a261, 0 0 16px rgba(244,162,97,0.6);
  animation: flicker 2.4s ease-in-out infinite;
}

@keyframes flicker {
  0%, 100% { opacity: 1; }
  47% { opacity: 0.5; }
  50% { opacity: 0.2; }
  53% { opacity: 0.7; }
}

footer {
  position: fixed;
  bottom: 1.5rem;
  left: 0; right: 0;
  text-align: center;
  font-size: 0.7rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: #4a3d2f;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  z-index: 1;
}

footer .sep { margin: 0 0.6rem; opacity: 0.5; }

@media (max-height: 560px) {
  .sigil { width: 5rem; height: 5rem; margin-bottom: 1.5rem; }
  .lede { margin-bottom: 2rem; }
  footer { position: static; margin-top: 2rem; }
}

/* ── chamber pages ─────────────────────────────────────────────── */

.chamber-eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.36em;
  text-transform: uppercase;
  color: #6c5a45;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  margin-bottom: 1.2rem;
}

main.chamber {
  text-align: center;
  max-width: 36rem;
  padding: 4rem 1.5rem;
}

main.chamber h1 {
  font-family: "Cormorant", "Cormorant Garamond", "EB Garamond", Georgia, serif;
  font-weight: 400;
  font-size: clamp(2rem, 5vw, 3.2rem);
  letter-spacing: 0.03em;
  color: #f3e2c4;
  margin-bottom: 1.5rem;
}

.chamber-lede {
  font-style: italic;
  font-size: 1.1rem;
  color: #a89074;
  margin-bottom: 3rem;
}

.chamber-foot a {
  font-size: 0.72rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: #6c5a45;
  text-decoration: none;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  transition: color 0.3s;
}

.chamber-foot a:hover {
  color: #f4a261;
}

#cycle {
  cursor: pointer;
  user-select: none;
}

#cycle:hover {
  color: #a89074;
}

#apex {
  cursor: default;
}

/* ── chamber: whisper ──────────────────────────────────────────── */

main.chamber.whisper { max-width: 38rem; }

#whisper-form {
  display: flex;
  gap: 0.6rem;
  margin: 0 auto 2.5rem;
  max-width: 30rem;
}
#whisper-input {
  flex: 1;
  background: #15110d;
  border: 1px solid #2a2118;
  color: #f3e2c4;
  padding: 0.7rem 0.9rem;
  font-family: inherit;
  font-size: 1.05rem;
  border-radius: 4px;
  outline: none;
}
#whisper-input:focus { border-color: #f4a261; }
#whisper-submit {
  background: transparent;
  border: 1px solid #6c5a45;
  color: #d9c9b4;
  padding: 0.7rem 1.4rem;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.75rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 4px;
  transition: border-color 0.3s, color 0.3s;
}
#whisper-submit:hover:not(:disabled) { border-color: #f4a261; color: #f4a261; }
#whisper-submit:disabled { opacity: 0.4; cursor: wait; }

#whisper-thread {
  text-align: left;
  max-width: 30rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.whisper-entry { padding: 0.6rem 0.9rem; border-left: 2px solid transparent; }
.whisper-entry.you { color: #a89074; border-left-color: #2a2118; }
.whisper-entry.you::before { content: "you · "; font-size: 0.65rem; letter-spacing: 0.3em; text-transform: uppercase; color: #6c5a45; }
.whisper-entry.maze { color: #f3e2c4; border-left-color: #f4a261; font-style: italic; }
.whisper-entry.maze::before { content: "the maze · "; font-style: normal; font-size: 0.65rem; letter-spacing: 0.3em; text-transform: uppercase; color: #f4a261; }

/* ── chamber: cartographer ────────────────────────────────────── */

main.chamber.cartographer { max-width: 42rem; }

.canvas-wrap { margin: 0 auto 2rem; }
#cart-canvas {
  display: block;
  margin: 0 auto;
  border: 1px solid #2a2118;
  background: #0a0805;
  cursor: crosshair;
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  touch-action: none;
}
.cart-toolbar {
  display: flex;
  justify-content: center;
  gap: 0.8rem;
  margin-top: 0.9rem;
}
.cart-toolbar button {
  background: transparent;
  border: 1px solid #6c5a45;
  color: #d9c9b4;
  padding: 0.55rem 1.2rem;
  font-family: ui-monospace, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 4px;
}
.cart-toolbar button:hover { border-color: #f4a261; color: #f4a261; }
.cart-result {
  margin-top: 0.9rem;
  font-style: italic;
  font-size: 1.05rem;
  color: #f3e2c4;
  min-height: 1.6rem;
}

.cart-mapheading {
  font-size: 0.7rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: #6c5a45;
  margin: 2rem 0 0.8rem;
}
.cart-map { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; max-width: 22rem; margin: 0 auto; }
.cart-map li { padding: 0.4rem 0.8rem; border-left: 1px solid #2a2118; color: #d9c9b4; font-style: italic; }
.cart-map li.muted { color: #6c5a45; }

/* ── chamber: lantern ─────────────────────────────────────────── */

main.chamber.lantern { max-width: 60rem; }

.lantern-room {
  position: relative;
  height: 60vh;
  min-height: 360px;
  background: radial-gradient(circle at 50% 50%, #0e0a06 0%, #050402 80%);
  border: 1px solid #1c1610;
  border-radius: 6px;
  overflow: hidden;
  cursor: none;
  margin: 0 auto 1.5rem;
}
.lantern-lamp {
  position: absolute;
  left: 0; top: 0;
  width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(244,162,97,0.45) 0%, rgba(244,162,97,0.15) 30%, rgba(0,0,0,0) 70%);
  pointer-events: none;
  margin-left: -110px; margin-top: -110px;
  animation: lamp-flicker 1.7s ease-in-out infinite;
  mix-blend-mode: screen;
}
@keyframes lamp-flicker {
  0%, 100% { opacity: 1; }
  47% { opacity: 0.7; }
  52% { opacity: 1; }
}
.lantern-glyph {
  position: absolute;
  font-size: 1.8rem;
  color: #f4a261;
  opacity: 0;
  transition: opacity 0.18s ease;
  pointer-events: none;
  text-shadow: 0 0 10px rgba(244,162,97,0.6);
  user-select: none;
}
.lantern-glyph.revealed {
  opacity: 0.7 !important;
}
.lantern-fragments {
  max-width: 36rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  text-align: left;
}
.lantern-fragment {
  padding: 0.5rem 0.9rem;
  border-left: 2px solid #f4a261;
  color: #d9c9b4;
  font-style: italic;
}
main.chamber.lantern .chamber-foot {
  display: flex;
  justify-content: space-between;
  max-width: 60rem;
  margin: 2rem auto 0;
}
main.chamber.lantern .muted { color: #6c5a45; font-family: ui-monospace, monospace; font-size: 0.72rem; letter-spacing: 0.25em; text-transform: uppercase; }

/* ── chamber: names ───────────────────────────────────────────── */

main.chamber.names { max-width: 36rem; }

#names-form {
  display: flex;
  gap: 0.6rem;
  margin: 0 auto 2rem;
  max-width: 26rem;
}
#names-input {
  flex: 1;
  background: #15110d;
  border: 1px solid #2a2118;
  color: #f3e2c4;
  padding: 0.7rem 0.9rem;
  font-family: "Cormorant", "Cormorant Garamond", "EB Garamond", Georgia, serif;
  font-size: 1.2rem;
  font-style: italic;
  text-align: center;
  border-radius: 4px;
  outline: none;
  letter-spacing: 0.04em;
}
#names-input:focus { border-color: #f4a261; }
#names-form button {
  background: transparent;
  border: 1px solid #6c5a45;
  color: #d9c9b4;
  padding: 0.7rem 1.4rem;
  font-family: ui-monospace, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 4px;
}
#names-form button:hover { border-color: #f4a261; color: #f4a261; }

.names-hint {
  font-style: italic;
  color: #f3e2c4;
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}
.names-attempts {
  font-family: ui-monospace, monospace;
  font-size: 0.7rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: #6c5a45;
}
.names-scene {
  border-left: 2px solid #f4a261;
  padding: 1rem 1.2rem;
  text-align: left;
  font-style: italic;
  color: #f3e2c4;
  max-width: 30rem;
  margin: 1rem auto 0;
  background: rgba(244,162,97,0.04);
}

/* ── chamber: oracle ──────────────────────────────────────────── */

main.chamber.oracle { max-width: 36rem; }

.oracle-choices {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  max-width: 24rem;
  margin: 0 auto 2rem;
}
.oracle-choice {
  background: transparent;
  border: 1px solid #2a2118;
  color: #d9c9b4;
  padding: 0.9rem 1.4rem;
  font-family: "Cormorant", serif;
  font-size: 1.15rem;
  font-style: italic;
  letter-spacing: 0.02em;
  cursor: pointer;
  border-radius: 4px;
  transition: border-color 0.3s, color 0.3s, background 0.3s;
}
.oracle-choice:hover {
  border-color: #f4a261;
  color: #f4a261;
  background: rgba(244,162,97,0.04);
}
.oracle-passages {
  max-width: 32rem;
  margin: 0 auto;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.oracle-passage {
  color: #d9c9b4;
  font-style: italic;
  padding: 0.4rem 0.8rem;
  border-left: 1px solid #2a2118;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.6s, transform 0.6s;
}
.oracle-passage.show {
  opacity: 1;
  transform: translateY(0);
}
.oracle-passage.oracle-leaf {
  border-left-color: #f4a261;
  color: #f3e2c4;
}

/* ── chamber: mirror ──────────────────────────────────────────── */

main.chamber.mirror { max-width: 44rem; }

.mirror-stage {
  position: relative;
  width: 100%;
  height: 50vh;
  min-height: 320px;
  background: radial-gradient(circle at 50% 50%, #110a08 0%, #050402 80%);
  border: 1px solid #2a2118;
  border-radius: 6px;
  overflow: hidden;
  cursor: none;
  margin: 0 auto 1rem;
}
.mirror-cursor {
  position: absolute;
  left: 0; top: 0;
  width: 18px; height: 18px;
  margin-left: -9px; margin-top: -9px;
  border-radius: 50%;
  pointer-events: none;
  transition: opacity 0.4s;
}
.mirror-cursor.mine {
  background: rgba(244,162,97,0.75);
  box-shadow: 0 0 12px rgba(244,162,97,0.5);
}
.mirror-cursor.other {
  background: rgba(180,160,200,0.6);
  box-shadow: 0 0 12px rgba(180,160,200,0.4);
  opacity: 0;
}
.mirror-cursor.other.active { opacity: 1; }
.mirror-glyph {
  position: absolute;
  font-size: 2rem;
  color: #6c5a45;
  pointer-events: none;
  text-shadow: 0 0 8px rgba(108,90,69,0.5);
  transition: color 0.4s, text-shadow 0.4s;
}
#mirror-target-a { left: 15%; top: 30%; }
#mirror-target-b { right: 15%; top: 60%; }
.mirror-glyph.lit {
  color: #f4a261;
  text-shadow: 0 0 18px rgba(244,162,97,0.8);
}
.mirror-status {
  text-align: center;
  font-family: ui-monospace, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: #a89074;
  margin: 0.8rem 0 1.4rem;
}

/* ── chamber: stone ───────────────────────────────────────────── */

main.chamber.stone { max-width: 30rem; }

.stone-counter {
  font-family: "Cormorant Garamond", "EB Garamond", Georgia, serif;
  font-size: 5rem;
  color: #f3e2c4;
  margin: 1rem 0 1rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  letter-spacing: 0.04em;
  text-shadow: 0 0 16px rgba(244,162,97,0.18);
}
.stone-button {
  background: transparent;
  border: 1px solid #6c5a45;
  color: #d9c9b4;
  padding: 1rem 3rem;
  font-family: ui-monospace, monospace;
  font-size: 0.85rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 4px;
  margin-bottom: 2rem;
  transition: border-color 0.3s, color 0.3s;
}
.stone-button:hover { border-color: #f4a261; color: #f4a261; }
.stone-button.active { border-color: #f4a261; color: #f4a261; }
.stone-events {
  max-width: 28rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  text-align: left;
}
.stone-event {
  color: #d9c9b4;
  font-style: italic;
  padding: 0.5rem 0.9rem;
  border-left: 2px solid #f4a261;
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity 0.8s, transform 0.8s;
}
.stone-event.show {
  opacity: 1;
  transform: translateX(0);
}
