/* ═══════════════════════════════════════════════════════════════
   Запертые двери академии — пасхалка на странице «98%».
   Вход — через замочную скважину (на обложке и под главами).
   ═══════════════════════════════════════════════════════════════ */

/* ── Скважина под главами ── */
.keyhole-call {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  margin: 2.2rem auto 0.6rem;
}
.keyhole-btn {
  width: 46px;
  height: 64px;
  padding: 0;
  border: 0;
  background: none;
  color: #e7c38f;
  cursor: pointer;
  filter: drop-shadow(0 0 6px rgba(255, 200, 140, 0.35));
  animation: keyhole-breathe 3.2s ease-in-out infinite;
  transition: transform 0.3s ease, filter 0.3s ease;
}
.keyhole-btn svg { width: 100%; height: 100%; display: block; }
.keyhole-btn:hover,
.keyhole-btn:focus-visible {
  transform: scale(1.08);
  filter: drop-shadow(0 0 14px rgba(120, 230, 160, 0.7));
  outline: none;
}
.keyhole-hint {
  font-size: 0.82rem;
  font-style: italic;
  color: var(--text-muted, #c5c5d0);
}
@keyframes keyhole-breathe {
  0%, 100% { filter: drop-shadow(0 0 5px rgba(255, 200, 140, 0.3)); }
  50% { filter: drop-shadow(0 0 14px rgba(255, 200, 140, 0.65)); }
}

/* ── Скважина на обложке: невидимая, только мерцает под курсором ── */
.cover-wrap {
  position: relative;
  display: block;
  border-radius: 0.8rem;
  margin-bottom: 0.7rem;
}
.cover-wrap .book-cover-img { margin-bottom: 0; }
.cover-keyhole {
  position: absolute;
  left: 43.5%;
  top: 0;
  width: 12%;
  height: 6.5%;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  transition: background 0.3s ease;
}
.cover-keyhole:hover,
.cover-keyhole:focus-visible {
  background: radial-gradient(circle, rgba(255, 215, 150, 0.55), transparent 65%);
  outline: none;
}

/* ── Коридор ── */
.secrets {
  margin: 0.5rem 0 1rem;
  text-align: center;
}
.secrets.is-appearing { animation: secrets-in 1.1s ease both; }
@keyframes secrets-in {
  from { opacity: 0; filter: blur(10px); transform: translateY(16px); }
  to { opacity: 1; filter: none; transform: none; }
}
.secrets-title {
  margin: 0 0 0.2rem;
  font-family: "Great Vibes", cursive;
  font-size: 2.6rem;
  font-weight: 400;
  color: var(--accent-pink, #e5a0b6);
  text-shadow: 0 0 18px rgba(229, 160, 182, 0.4);
}
.secrets-note {
  margin: 0 auto 2rem;
  max-width: 34rem;
  color: var(--text-muted, #c5c5d0);
  font-size: 0.92rem;
}

.corridor {
  position: relative;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 2.4rem;
  padding: 0.4rem 0 2rem;
}
.corridor-thread {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  z-index: 3;
}
.corridor-thread path {
  fill: none;
  stroke: #ff4d5e;
  stroke-width: 1.6;
  stroke-linecap: round;
  filter: drop-shadow(0 0 3px rgba(255, 59, 78, 0.95));
  transition: stroke-dashoffset 1.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Дверь ── */
.door {
  position: relative;
  z-index: 1;
  width: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
}
.door-frame {
  --calm: 0;
  --strain: 0;
  position: relative;
  width: 140px;
  height: 215px;
  padding: 0;
  border: 0;
  border-radius: 70px 70px 8px 8px;
  background: #120f17;
  overflow: hidden;
  perspective: 600px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  box-shadow:
    0 0 0 3px #3a2f3a,
    0 0 0 4px rgba(229, 160, 182, 0.35),
    0 18px 30px rgba(0, 0, 0, 0.55);
  transition: box-shadow 0.4s ease, filter 0.6s ease;
}
/* как у эмпатов — зелёный отсвет при наведении */
.door-frame:hover,
.door-frame:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 3px #3a2f3a,
    0 0 0 4px rgba(120, 230, 160, 0.65),
    0 0 34px rgba(90, 220, 140, 0.38),
    0 18px 30px rgba(0, 0, 0, 0.55);
}

.door-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 62%,
    rgba(255, 222, 180, 0.95), rgba(229, 160, 182, 0.55) 40%, rgba(120, 60, 120, 0.25) 75%, transparent);
  opacity: 0;
  transition: opacity 0.9s ease 0.35s;
}

.door-leaf {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  background: linear-gradient(180deg, #4a3442, #2c2130);
  transition: transform 1.3s cubic-bezier(0.5, 0.05, 0.2, 1);
}
.door-leaf.l { left: 0; transform-origin: 0 50%; border-right: 1px solid rgba(0, 0, 0, 0.55); }
.door-leaf.r { right: 0; transform-origin: 100% 50%; }
.door-leaf::before,
.door-leaf::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 9px;
  border: 1px solid rgba(229, 160, 182, 0.2);
  border-radius: 3px;
}
.door-leaf.r::before,
.door-leaf.r::after { left: 9px; right: 12px; }
.door-leaf::before { top: 42px; height: 86px; }
.door-leaf::after { bottom: 18px; height: 56px; }

/* спокойствие проступает тёплым светом изнутри */
.door-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 0 calc(var(--calm) * 46px) rgba(255, 220, 160, calc(var(--calm) * 0.85));
}

.door-num {
  position: absolute;
  left: 0;
  right: 0;
  top: 14px;
  z-index: 2;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.95rem;
  letter-spacing: 0.1em;
  color: rgba(231, 195, 143, 0.75);
  transition: opacity 0.4s ease;
}
.door-lock {
  position: absolute;
  left: 50%;
  top: 52%;
  z-index: 2;
  width: 22px;
  height: 30px;
  margin: -15px 0 0 -11px;
  color: #e7c38f;
  transition: opacity 0.4s ease;
}
.door-lock svg { width: 100%; height: 100%; display: block; }

.door-chains {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.door-plate {
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-main, #f3f3f5);
}
.door-sub {
  font-size: 0.7rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--accent-violet, #b59adf);
}
.door-hint {
  min-height: 2.6em;
  max-width: 170px;
  font-size: 0.76rem;
  font-style: italic;
  line-height: 1.35;
  color: var(--text-muted, #c5c5d0);
}

/* открыта */
.door.is-open .door-leaf.l { transform: rotateY(-108deg); }
.door.is-open .door-leaf.r { transform: rotateY(108deg); }
.door.is-open .door-glow { opacity: 1; }
.door.is-open .door-lock,
.door.is-open .door-num,
.door.is-open .door-chains { opacity: 0; }
.door.is-current .door-plate { color: var(--accent-pink, #e5a0b6); }

/* дверь Первоосновы: чем сильнее жмёшь, тем крепче держится */
.door[data-mode="patience"] .door-chains { opacity: calc(var(--strain) / 5); }
.door.is-strain .door-frame {
  animation: door-shake 0.42s ease;
  box-shadow:
    0 0 0 3px #3a2f3a,
    0 0 0 4px rgba(255, 80, 90, 0.75),
    0 0 calc(12px + var(--strain) * 7px) rgba(255, 59, 78, 0.55),
    0 18px 30px rgba(0, 0, 0, 0.55);
}
@keyframes door-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px) rotate(-1deg); }
  40% { transform: translateX(4px) rotate(1deg); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
}

/* последняя дверь: заперта, пока не открыты три другие */
.door.is-locked .door-frame { filter: grayscale(0.55) brightness(0.72); }
.door.is-locked .door-chains { opacity: 0.9; }
.door.is-ready .door-frame { animation: door-call 2.4s ease-in-out infinite; }
@keyframes door-call {
  0%, 100% { box-shadow: 0 0 0 3px #3a2f3a, 0 0 0 4px rgba(255, 77, 94, 0.5), 0 0 16px rgba(255, 59, 78, 0.3), 0 18px 30px rgba(0, 0, 0, 0.55); }
  50% { box-shadow: 0 0 0 3px #3a2f3a, 0 0 0 4px rgba(255, 77, 94, 0.9), 0 0 36px rgba(255, 59, 78, 0.6), 0 18px 30px rgba(0, 0, 0, 0.55); }
}

/* ── Сейф ── */
.door-code {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}
.door-code[hidden] { display: none; }
.code-label {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted, #c5c5d0);
}
.code-digits { display: flex; gap: 0.35rem; }
.code-digits input {
  width: 2.1rem;
  height: 2.6rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(231, 195, 143, 0.55);
  background: #15121b;
  color: #f4d7aa;
  font: 1.35rem Georgia, "Times New Roman", serif;
  text-align: center;
  caret-color: var(--accent-pink, #e5a0b6);
}
.code-digits input:focus {
  outline: none;
  border-color: rgba(120, 230, 160, 0.8);
  box-shadow: 0 0 12px rgba(90, 220, 140, 0.35);
}
.door-code.is-wrong .code-digits { animation: door-shake 0.42s ease; }
.door-code.is-wrong input { border-color: rgba(255, 80, 90, 0.9); color: #ff8a94; }

/* ── Комната за дверью ── */
.room {
  max-width: 820px;
  margin: 0 auto;
  text-align: left;
}
.room:empty { display: none; }
.room-head {
  margin: 0 0 1rem;
  text-align: center;
  font-family: "Great Vibes", cursive;
  font-size: 2.1rem;
  font-weight: 400;
  color: var(--accent-pink, #e5a0b6);
}
.secret-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 0.9rem;
}
.secret {
  padding: 0.95rem 1.05rem;
  border-radius: 1rem;
  background: linear-gradient(135deg, rgba(229, 160, 182, 0.07), rgba(181, 154, 223, 0.07));
  border: 1px solid rgba(255, 255, 255, 0.08);
  animation: secret-in 0.8s ease both;
}
.secret h4 {
  margin: 0 0 0.4rem;
  font-size: 0.96rem;
  color: var(--accent-pink, #e5a0b6);
}
.secret p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-muted, #c5c5d0);
}
/* длинные тексты третьей двери — в одну колонку, письмо как письмо */
.secret-list--column { grid-template-columns: 1fr; max-width: 680px; margin: 0 auto; }
.secret p + p { margin-top: 0.6rem; }
.secret--letter p {
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  color: #eadfe7;
}

@keyframes secret-in {
  from { opacity: 0; filter: blur(6px); transform: translateY(10px); }
  to { opacity: 1; filter: none; transform: none; }
}

.teaser {
  max-width: 34rem;
  margin: 0 auto;
  padding: 1.6rem 1.6rem 1.8rem;
  text-align: center;
  border-radius: 1.2rem;
  background: radial-gradient(circle at 50% 0%, rgba(255, 59, 78, 0.14), transparent 60%),
    linear-gradient(170deg, #2c2433, #1e1c26);
  border: 1px solid rgba(255, 77, 94, 0.4);
  box-shadow: 0 0 40px rgba(255, 59, 78, 0.18);
  animation: secret-in 1.1s ease both;
}
.teaser p { margin: 0 0 0.8rem; line-height: 1.65; color: var(--text-main, #f3f3f5); }
.teaser .teaser-tree {
  font-family: "Great Vibes", cursive;
  font-size: 1.9rem;
  color: #ff8a94;
  text-shadow: 0 0 16px rgba(255, 59, 78, 0.55);
}
.teaser .teaser-soon {
  margin: 1rem 0 0;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-violet, #b59adf);
}

@media (max-width: 680px) {
  .corridor { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.8rem 1rem; justify-items: center; }
  .door { width: 100%; max-width: 150px; }
  .door-frame { width: 120px; height: 185px; }
  .secrets-title { font-size: 2.2rem; }
}

@media (prefers-reduced-motion: reduce) {
  .keyhole-btn,
  .door.is-ready .door-frame,
  .door.is-strain .door-frame,
  .secrets.is-appearing,
  .secret,
  .teaser { animation: none; }
  .door-leaf,
  .door-glow,
  .corridor-thread path { transition: none; }
}
