html.is-edge { overflow: hidden; }
html.is-edge .page,
html.is-edge .topbar { pointer-events: none; user-select: none; }

.edge {
  position: fixed;
  inset: 0;
  z-index: 100;
  overflow: hidden;
  background: #020308;
  opacity: 0;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
.edge.is-shown { opacity: 1; }
.edge.is-fading { transition: opacity 0.9s ease; }
.edge.is-quick { transition: opacity 0.45s ease; }

.edge__canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.edge__fx { z-index: 2; pointer-events: none; }

.edge__title {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  width: min(92vw, 30em);
  margin: 0;
  transform: translate(-50%, -50%);
  text-align: center;
  text-wrap: balance;
  font-family: "Jura", var(--font-text);
  font-weight: 300;
  font-size: clamp(1.05rem, 2.3vw, 2rem);
  line-height: 1.7;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: #eef2ff;
  text-shadow: 0 0 2px rgba(2, 3, 8, 0.9), 0 0 22px rgba(160, 190, 255, 0.35);
  opacity: 0;
  filter: blur(8px);
  transition: opacity 3.2s ease, filter 3.2s ease;
  pointer-events: none;
}
.edge__title.is-on { opacity: 1; filter: none; }

.edge__back {
  position: absolute;
  top: clamp(0.9rem, 2.5vw, 1.5rem);
  left: clamp(0.9rem, 2.5vw, 1.5rem);
  z-index: 4;
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  padding: 0;
  border: 1px solid rgba(214, 224, 255, 0.45);
  border-radius: 50%;
  background: rgba(3, 5, 11, 0.6);
  color: #e8eeff;
  cursor: pointer;
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.7s ease, transform 0.7s ease, background-color 0.25s ease, border-color 0.25s ease;
}
.edge__back:hover { background: rgba(214, 224, 255, 0.14); border-color: #e8eeff; }
.edge__back svg { width: 1.3rem; height: 1.3rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.sound-ctl--edge {
  position: absolute;
  top: clamp(0.9rem, 2.5vw, 1.5rem);
  left: calc(clamp(0.9rem, 2.5vw, 1.5rem) + 3.6rem);
  z-index: 4;
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.7s ease 0.2s, transform 0.7s ease 0.2s;
}
.sound-ctl--edge .sound-ctl__btn {
  width: 3rem;
  height: 3rem;
  border-color: rgba(214, 224, 255, 0.45);
  background: rgba(3, 5, 11, 0.6);
  color: #e8eeff;
}
.sound-ctl--edge .sound-ctl__btn:hover { background: rgba(214, 224, 255, 0.14); border-color: #e8eeff; }
.sound-ctl--edge .sound-ctl__btn svg { width: 1.3rem; height: 1.3rem; }
.sound-ctl--edge .sound-ctl__panel {
  top: 50%;
  left: 100%;
  right: auto;
  padding: 0 0 0 0.55rem;
  transform: translate(-4px, -50%);
}
.sound-ctl--edge:hover .sound-ctl__panel,
.sound-ctl--edge:focus-within .sound-ctl__panel,
.sound-ctl--edge.is-open .sound-ctl__panel { transform: translate(0, -50%); }
.sound-ctl--edge .sound-ctl__box { border-color: rgba(214, 224, 255, 0.3); background: rgba(3, 5, 11, 0.92); }
.sound-ctl--edge .sound-ctl__range { accent-color: #dfe7ff; }

.edge.is-ready .edge__back,
.edge.is-ready .sound-ctl--edge { opacity: 1; transform: none; }
.edge__back:focus-visible,
.sound-ctl--edge .sound-ctl__btn:focus-visible { outline-color: #e8eeff; }

.edge__stage { position: absolute; inset: 0; z-index: 2; pointer-events: none; }

.edge[data-mode="archive"] { background: #000; cursor: default; }
.edge[data-mode="archive"].is-pointing { cursor: pointer; }
.edge[data-mode="archive"] .edge__title {
  top: 8%;
  font-size: clamp(0.8rem, 1.5vw, 1.15rem);
  letter-spacing: 0.3em;
  color: #eadfc8;
  text-shadow: 0 0 2px #000, 0 0 18px rgba(255, 200, 120, 0.25);
}
.arc { position: absolute; inset: 0; pointer-events: none; }
.arc-shade { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.55); opacity: 0; transition: opacity 0.35s ease; }
.arc-shade.is-on { opacity: 1; pointer-events: auto; }
.arc-book {
  position: absolute;
  left: 50%;
  top: 52%;
  display: flex;
  transform: translate(-50%, -50%) scale(0.92);
  opacity: 0;
  transition: opacity 0.35s ease, transform 0.35s ease;
  filter: drop-shadow(0 30px 50px rgba(0, 0, 0, 0.85));
}
.arc-book.is-open { opacity: 1; transform: translate(-50%, -50%) scale(1); pointer-events: auto; }
.arc-book.is-turning .arc-page > * { opacity: 0; }
.arc-page {
  position: relative;
  width: min(36vw, 19rem);
  aspect-ratio: 3 / 4;
  padding: 1.6rem 1.4rem;
  overflow: hidden;
  background: radial-gradient(ellipse 120% 90% at 50% 40%, #ddd4c0 0%, #c8bb9f 100%);
  color: #2a2118;
  cursor: pointer;
}
.arc-page > * { transition: opacity 0.15s ease; }
.arc-page--l { border-radius: 4px 0 0 4px; box-shadow: inset -22px 0 30px -18px rgba(40, 25, 10, 0.55); }
.arc-page--r { border-radius: 0 4px 4px 0; box-shadow: inset 22px 0 30px -18px rgba(40, 25, 10, 0.55); }
.arc-page__title { margin: 30% 0 1rem; font-family: var(--font-display); font-weight: 400; font-size: clamp(1rem, 1.8vw, 1.35rem); line-height: 1.3; text-align: center; }
.arc-page__mark { margin: 0; font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 0.68rem; letter-spacing: 0.08em; color: rgba(42, 33, 24, 0.6); text-align: center; }
.arc-page__text { margin: 30% 0 0; font-family: var(--font-text); font-size: clamp(0.85rem, 1.4vw, 1.02rem); line-height: 1.65; }
.arc-page__fig { position: absolute; inset: 1.4rem 1.2rem 2.2rem; }
.arc-page__fig svg { width: 100%; height: 100%; }
.arc-page__pencil { position: absolute; right: 1.6rem; bottom: 2.4rem; margin: 0; font-family: var(--font-text); font-style: italic; font-size: 0.85rem; color: rgba(60, 50, 40, 0.45); transform: rotate(-4deg); }
.arc-page__no { position: absolute; bottom: 0.8rem; left: 0; right: 0; font-size: 0.7rem; color: rgba(42, 33, 24, 0.45); text-align: center; }
.arc-book__close {
  position: absolute;
  top: -2.8rem;
  right: 0;
  width: 2.2rem;
  height: 2.2rem;
  padding: 0;
  border: 1px solid rgba(234, 223, 200, 0.5);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  color: #eadfc8;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}
.arc-notice {
  position: absolute;
  left: 50%;
  bottom: 12%;
  width: min(90vw, 36rem);
  margin: 0;
  transform: translateX(-50%);
  text-align: center;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: clamp(0.78rem, 1.3vw, 0.95rem);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #e2a446;
  text-shadow: 0 0 2px #000, 0 0 14px rgba(226, 164, 70, 0.4);
  opacity: 0;
  transition: opacity 0.6s ease;
}
.arc-notice.is-on { opacity: 1; }
.arc-end { position: absolute; inset: 0; display: grid; place-items: center; background: #000; opacity: 0; }
.arc-end.is-on { opacity: 1; }
.arc-end p {
  margin: 0;
  font-family: "Jura", var(--font-text);
  font-weight: 300;
  font-size: clamp(1rem, 2.2vw, 1.8rem);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: #e6e1d6;
  opacity: 0;
  transition: opacity 1.2s ease;
}
.arc-end.is-text p { opacity: 1; }

@media (max-width: 760px) {
  .arc-page { width: 44vw; padding: 1rem 0.8rem; }
  .arc-page__fig { inset: 0.8rem 0.6rem 1.8rem; }
  .arc-page__pencil { right: 0.9rem; bottom: 1.8rem; }
}

.edge[data-mode="anathema"] { background: radial-gradient(ellipse 70% 60% at 50% 50%, #170c0c 0%, #050304 75%); cursor: default; }
.ana { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.ana__sheet {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-sizing: border-box;
  width: min(88vw, 34rem);
  min-height: min(82vh, 44rem);
  padding: clamp(1.6rem, 5vw, 3rem) clamp(1.3rem, 4.5vw, 2.8rem);
  overflow: hidden;
  border-radius: 3px;
  background: radial-gradient(ellipse 85% 80% at 50% 45%, #e8dcc2 0%, #d5c4a0 55%, #a58b63 100%);
  box-shadow: inset 0 0 70px rgba(60, 30, 10, 0.55), 0 30px 80px rgba(0, 0, 0, 0.75);
  color: #7a0e1a;
  font-family: var(--font-cult);
  text-align: center;
  opacity: 0;
  transform: translateY(12px) rotate(-0.6deg);
  transition: opacity 1.6s ease, transform 1.6s ease;
}
.ana.is-on .ana__sheet { opacity: 1; transform: rotate(-0.6deg); }
.ana__spiral { position: absolute; left: 50%; top: 50%; width: 86%; transform: translate(-50%, -50%); opacity: 0.2; }
.ana__spiral path { fill: none; stroke: #7a0e1a; stroke-width: 0.7; stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 26s linear; }
.ana.is-drawing .ana__spiral path { stroke-dashoffset: 0; }
.ana__line { position: relative; margin: 0.35em 0; font-weight: 500; font-size: clamp(1.05rem, 2.6vw, 1.45rem); line-height: 1.25; text-shadow: 0 0 1px rgba(122, 14, 26, 0.6); opacity: 0; filter: blur(3px); transition: opacity 2.2s ease, filter 2.2s ease; }
.ana__line.is-on { opacity: 0.92; filter: none; }
.ana__warn { margin-top: 0.9em; font-weight: 700; font-size: clamp(1.6rem, 4.6vw, 2.6rem); }
.ana__coda { margin-top: 0.7em; font-size: clamp(0.85rem, 1.8vw, 1rem); color: #5c0b14; }
.arc-book.is-closed .arc-page { background: radial-gradient(ellipse 120% 90% at 50% 40%, #cbb9a0 0%, #a48a70 100%); color: #2a1010; }

@media (max-width: 760px) {
  .edge__title { letter-spacing: 0.18em; line-height: 1.6; }
}

@media (prefers-reduced-motion: reduce) {
  .edge__title { transition-duration: 1s; }
}
