/* Scoped additions: reset confirmation and HALO top-bound notebook. */
.reset-confirm-dialog {
  width: min(calc(100vw - 52px), 330px);
  margin: auto;
  padding: 29px 23px 24px;
  border: 1px solid rgba(230,201,121,.26);
  border-radius: 23px;
  color: var(--cream);
  background: linear-gradient(150deg, #171b27, #0b0d15);
  box-shadow: 0 24px 70px #0009;
}
.reset-confirm-dialog::backdrop { background: #03050bae; backdrop-filter: blur(6px); }
.reset-confirm-dialog h2 { margin: 0 0 24px; font-size: 16px; line-height: 1.8; font-weight: 400; text-align: center; }
.reset-confirm-actions { display: flex; gap: 11px; }
.reset-confirm-actions button { flex: 1; padding: 11px 6px; border: 1px solid #e6c97930; border-radius: 13px; font-size: 12px; color: var(--cream); background: #ffffff08; cursor: pointer; }
.reset-confirm-actions #resetConfirm { color: var(--gold-light); background: #e6c97912; }
.reset-confirm-actions button:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

#secretBookDialog { position: fixed; overflow: hidden; }
#secretBookDialog[open] { display: grid; place-items: center; padding: max(32px, env(safe-area-inset-top)) 18px max(22px, env(safe-area-inset-bottom)); }
#secretBookDialog .secret-book-shell {
  position: relative;
  width: min(90vw, 430px, calc((100svh - 156px) * .75));
  color: #26364b;
  container-type: inline-size;
  animation: halo-notebook-arrive .7s cubic-bezier(.2,.75,.2,1) both;
  isolation: isolate;
}
#secretBookDialog .secret-book {
  width: 100%;
  aspect-ratio: 3 / 4;
  container-type: inline-size;
  perspective: 1500px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  filter: none;
  box-shadow: 0 26px 55px #0007;
  border-radius: 5px 5px 9px 9px;
  background: #ede0c5;
}
#secretBookDialog .secret-book::before {
  content: "";
  position: absolute;
  inset: 3px -3px -6px 3px;
  z-index: -1;
  border-radius: 5px 5px 9px 9px;
  background: #d7c7a7;
  box-shadow: 0 2px #f2e6ce, 0 4px #ac9b7e, 0 7px #e1d2b2, 0 10px 12px #0003;
}
#secretBookDialog .secret-book-page {
  display: block;
  position: absolute;
  inset: 0;
  padding: 0;
  border: 0;
  border-radius: 5px 5px 8px 8px;
  overflow: hidden;
  background: #eee3cb;
  box-shadow: none;
  transform-origin: center top;
  transform: none;
  transition: none;
  opacity: 0;
  visibility: hidden;
  z-index: 1;
  pointer-events: none;
  backface-visibility: hidden;
}
#secretBookDialog .secret-book-page::after {
  content: "";
  inset: 0;
  border: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, #5743271a, transparent 4%, transparent 97%, #785f3912);
  box-shadow: inset 0 0 0 1px #8b6e4433;
  pointer-events: none;
}
#secretBookDialog .secret-book-page.active { opacity: 1; visibility: visible; pointer-events: auto; transform: none; z-index: 4; }
#secretBookDialog .secret-book-page.past { transform: none; }
#secretBookDialog .secret-book-page.turn-under { visibility: visible; opacity: 1; z-index: 3; }
#secretBookDialog .secret-book-page.turn-over { visibility: visible; opacity: 1; z-index: 5; }
.halo-art { display: block; width: 100%; height: 100%; object-fit: contain; opacity: 0; -webkit-user-drag: none; }
.page-ready .halo-art { opacity: 1; }
/* Re-typeset just the existing title areas with one common typewriter face.
   The source art is losslessly encoded and never painted over. Each small
   paper layer displays a blank top strip from that same original page. */
#secretBookDialog .halo-heading {
  position: absolute;
  top: var(--title-y);
  left: var(--title-x);
  width: var(--title-w);
  height: var(--title-h);
  margin: 0;
  padding: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  background: #f0e5cd;
  color: #203650;
  font-family: "Courier New", Courier, monospace;
  font-size: var(--title-size, 3cqw);
  font-weight: 700;
  font-style: normal;
  letter-spacing: .035em;
  line-height: 1;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
}
#secretBookDialog .page-ready .halo-heading { opacity: 1; }
.halo-title-paper { position: absolute; inset: 0 auto auto 0; width: var(--patch-width); height: auto; max-width: none; pointer-events: none; }
.halo-heading span { position: relative; z-index: 1; }
#secretBookDialog .halo-cover .halo-heading { letter-spacing: .24em; font-weight: 400; }
.notebook-binding {
  position: absolute;
  top: calc(-1 * clamp(16px, 6.84cqw, 29px));
  left: 8%;
  right: 8%;
  height: clamp(23px, 10.54cqw, 45px);
  z-index: 15;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}
.notebook-binding i {
  position: relative;
  display: block;
  width: clamp(6px, 2.85cqw, 12px);
  height: clamp(21px, 9.7cqw, 42px);
  border: clamp(1px, .57cqw, 2.5px) solid #77644c;
  border-left-color: #e1cdb0;
  border-right-color: #3b342d;
  border-radius: 50%;
  background: linear-gradient(90deg, transparent 30%, #f5e6ca8c 55%, transparent 70%);
  box-shadow: 1px 1px 2px #0006, inset 1px 0 1px #f7e9d680;
}
.notebook-binding i::after { content: ""; position: absolute; width: 80%; height: 12%; border-radius: 50%; background: #61503b; box-shadow: 0 1px #fff8; bottom: -1px; left: -1px; z-index: -1; }
.halo-book-hint { margin: 22px 0 9px; color: #dfd3bd99; font-size: 10px; letter-spacing: .16em; line-height: 1.6; text-align: center; }
#secretBookDialog .secret-book-controls { margin-top: 0; gap: 23px; }
#secretBookDialog .secret-book-controls small { min-width: 56px; font-size: 10px; }
#secretBookDialog .secret-book-controls button { cursor: pointer; font-size: 16px; }
#secretBookDialog .secret-book-controls button:focus-visible { outline: 1px solid var(--gold); outline-offset: 3px; }
#secretBookDialog.book-closing .secret-book-shell { animation: halo-notebook-close 1.15s cubic-bezier(.2,.72,.2,1) both; }
#secretBookDialog.book-closing .secret-book-page.active { transform: none; }
@keyframes halo-notebook-arrive { from { opacity: 0; transform: translateY(24px) rotateX(8deg); } to { opacity: 1; transform: none; } }
@keyframes halo-notebook-close { 0% { opacity: 1; transform: perspective(1100px) rotateX(0); } 50% { opacity: .9; transform: perspective(1100px) translateY(6px) rotateX(8deg) scale(.98); } 100% { opacity: 0; transform: perspective(1100px) translateY(25px) rotateX(18deg) scale(.9); } }
@media (prefers-reduced-motion: reduce) {
  #secretBookDialog .secret-book-shell,
  #secretBookDialog.book-closing .secret-book-shell { animation: none; }
}
