.bib {
  --bib-ink: #171218;
  --bib-night: #090b15;
  --bib-indigo: #171528;
  --bib-wine: #642838;
  --bib-wine-dark: #32151d;
  --bib-gold: #d8ad60;
  --bib-gold-soft: #f0d89c;
  --bib-paper: #eee0bd;
  --bib-paper-deep: #d7c49b;
  --bib-line: rgba(216, 173, 96, .32);
  overflow: hidden;
  margin: 0 0 2.4rem;
  border: 1px solid rgba(216, 173, 96, .24);
  border-radius: 26px;
  color: #f8f0e4;
  background: var(--bib-night);
  box-shadow: 0 28px 80px rgba(4, 4, 10, .34);
}

.bib [hidden] { display: none !important; }
.bib *, .bib *::before, .bib *::after { box-sizing: border-box; }
.bib button { font: inherit; }
.bib-kicker {
  display: inline-block;
  color: var(--bib-gold);
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.bib-hero {
  position: relative;
  min-height: clamp(460px, 56vw, 650px);
  isolation: isolate;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  background: #080b13;
}
.bib-hero > img {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 52%;
}
.bib-hero-veil {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(5, 8, 17, .26), rgba(6, 7, 14, .12) 40%, rgba(6, 6, 12, .96) 100%),
    linear-gradient(90deg, rgba(7, 8, 15, .9), rgba(7, 8, 15, .18) 62%, rgba(7, 8, 15, .35));
}
.bib-hero-copy {
  width: min(760px, calc(100% - 3rem));
  margin: 0 0 clamp(2.2rem, 6vw, 4.7rem) clamp(1.5rem, 6vw, 5rem);
  text-shadow: 0 2px 18px rgba(0, 0, 0, .7);
}
.bib-hero-copy h2 {
  max-width: 710px;
  margin: .55rem 0 .8rem;
  color: #fff8ec;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(2.2rem, 5.8vw, 4.8rem);
  font-weight: 500;
  line-height: .98;
  letter-spacing: -.035em;
}
.bib-hero-copy p {
  max-width: 620px;
  margin: 0;
  color: #e7ddce;
  font-size: clamp(.98rem, 1.8vw, 1.2rem);
  line-height: 1.65;
}
.bib-hero-points { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.35rem; }
.bib-hero-points span {
  padding: .5rem .75rem;
  border: 1px solid rgba(240, 216, 156, .34);
  border-radius: 999px;
  color: #f2e5c9;
  background: rgba(8, 9, 17, .58);
  backdrop-filter: blur(8px);
  font-size: .75rem;
  font-weight: 700;
}

.bib-body {
  position: relative;
  padding: clamp(2rem, 6vw, 5rem) clamp(1rem, 4vw, 3.6rem);
  background:
    radial-gradient(circle at 50% 10%, rgba(102, 50, 68, .22), transparent 35%),
    linear-gradient(180deg, #0b0c16, #11101d 62%, #0b0b13);
}
.bib-body::before {
  content: '';
  position: absolute;
  inset: 1.2rem;
  pointer-events: none;
  border: 1px solid rgba(216, 173, 96, .1);
  border-radius: 20px;
}
.bib-start, .bib-opening, .bib-result { position: relative; z-index: 1; max-width: 1120px; margin: 0 auto; }
.bib-intro, .bib-opening > header, .bib-result-head { max-width: 780px; margin: 0 auto 2.2rem; text-align: center; }
.bib-intro h2, .bib-opening h2, .bib-result-head h2 {
  margin: .45rem 0 .65rem;
  color: #fff8ec;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(2rem, 4.6vw, 3.6rem);
  font-weight: 500;
  line-height: 1.08;
}
.bib-intro p, .bib-result-head p { max-width: 670px; margin: 0 auto; color: #c9c0c5; line-height: 1.68; }

.bib-book-trigger {
  position: relative;
  display: grid;
  width: min(660px, 100%);
  min-height: 390px;
  margin: 0 auto;
  padding: 1.5rem 1rem 1rem;
  place-items: center;
  border: 0;
  border-radius: 28px;
  color: inherit;
  background: transparent;
  cursor: pointer;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.bib-book-trigger:focus-visible { outline: 2px solid var(--bib-gold); outline-offset: 6px; }
.bib-book-shadow {
  position: absolute;
  left: 12%;
  right: 12%;
  bottom: 64px;
  height: 54px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .66);
  filter: blur(18px);
  transform: perspective(300px) rotateX(62deg);
}
.bib-closed-book {
  position: relative;
  display: block;
  width: min(470px, 85vw);
  height: min(270px, 49vw);
  min-height: 205px;
  transform: perspective(900px) rotateX(58deg) rotateZ(-2deg);
  transform-style: preserve-3d;
  transition: transform .25s ease, filter .25s ease;
  filter: drop-shadow(0 25px 20px rgba(0, 0, 0, .48));
}
.bib-book-trigger:hover .bib-closed-book { transform: perspective(900px) rotateX(54deg) rotateZ(-1deg) translateY(-4px); }
.bib-page-edge {
  position: absolute;
  inset: 13px 8px -11px 22px;
  border: 2px solid #a99063;
  border-radius: 8px 18px 18px 8px;
  background:
    repeating-linear-gradient(0deg, #d7c498 0 2px, #ad976d 3px, #ead9ac 4px);
  box-shadow: 12px 13px 0 #281316;
}
.bib-book-cover {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  overflow: hidden;
  padding: 2.2rem;
  border: 4px solid #8c4c44;
  border-radius: 8px 18px 18px 8px;
  background:
    radial-gradient(circle at 40% 30%, rgba(215, 141, 109, .16), transparent 32%),
    repeating-linear-gradient(103deg, rgba(255,255,255,.018) 0 2px, transparent 2px 7px),
    linear-gradient(145deg, #6f2630, #421821 58%, #291016);
  box-shadow: inset 0 0 0 3px #2d1016, inset 0 0 0 5px rgba(216, 173, 96, .45), inset 0 0 45px #1d0b10;
  transform: translateZ(18px);
}
.bib-book-cover::before, .bib-book-cover::after {
  content: '';
  position: absolute;
  inset: 20px;
  border: 1px solid rgba(225, 183, 96, .52);
  border-radius: 4px 12px 12px 4px;
}
.bib-book-cover::after { inset: 29px; border-color: rgba(225, 183, 96, .22); }
.bib-book-cover i {
  width: 58px;
  height: 58px;
  margin-bottom: 1rem;
  border: 1px solid var(--bib-gold);
  border-radius: 50%;
  box-shadow: 0 0 0 7px rgba(216, 173, 96, .08), inset 0 0 20px rgba(216, 173, 96, .18);
}
.bib-book-cover i::before, .bib-book-cover i::after {
  content: '';
  position: absolute;
  top: 92px;
  left: 50%;
  width: 1px;
  height: 37px;
  background: var(--bib-gold);
  transform: rotate(45deg);
  transform-origin: 50% 100%;
}
.bib-book-cover i::after { transform: rotate(-45deg); }
.bib-book-cover b {
  position: relative;
  z-index: 1;
  color: #f0d699;
  font-family: Georgia, serif;
  font-size: clamp(.95rem, 3vw, 1.35rem);
  font-weight: 500;
  letter-spacing: .13em;
  text-align: center;
}
.bib-book-cover small { position: relative; z-index: 1; margin-top: .65rem; color: #d5ac66; font-size: .58rem; letter-spacing: .24em; }
.bib-book-spine {
  position: absolute;
  top: 1px;
  bottom: 0;
  left: -8px;
  width: 38px;
  border-radius: 16px 5px 5px 16px;
  background: linear-gradient(90deg, #2b0f15, #71313a 45%, #321017);
  box-shadow: inset -3px 0 rgba(216, 173, 96, .25);
  transform: translateZ(22px);
}
.bib-book-clasp {
  position: absolute;
  right: -17px;
  top: 41%;
  width: 48px;
  height: 48px;
  border: 2px solid #9f772e;
  border-radius: 4px 12px 12px 4px;
  background: linear-gradient(145deg, #e1b65d, #765018 55%, #bd8d35);
  transform: translateZ(28px);
  box-shadow: inset 0 0 9px rgba(50, 28, 5, .8);
}
.bib-hold-label {
  position: relative;
  z-index: 2;
  align-self: end;
  min-width: 250px;
  margin-top: .9rem;
  padding: .9rem 1.35rem;
  border: 1px solid var(--bib-gold);
  border-radius: 999px;
  color: #fff4dc;
  background: linear-gradient(135deg, #6a2a38, #3d1822);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .35);
  font-size: .88rem;
  font-weight: 800;
  letter-spacing: .05em;
}
.bib-click-hint { margin: .2rem 0 0; color: #918890; font-size: .72rem; text-align: center; }
.bib.is-holding .bib-closed-book { animation: bib-book-pulse .62s ease-in-out infinite alternate; filter: drop-shadow(0 27px 25px rgba(134, 75, 62, .38)); }
.bib.is-holding .bib-page-edge { animation: bib-edge-riffle .18s steps(2, end) infinite; }
.bib.is-holding .bib-hold-label { color: #2c1715; background: var(--bib-gold-soft); }

.bib-opening { min-height: 500px; padding: 1rem 0; }
.bib-opening-scene { display: grid; min-height: 300px; place-items: center; perspective: 1100px; }
.bib-opening-book { position: relative; width: min(620px, 88vw); height: min(330px, 50vw); min-height: 230px; transform: rotateX(48deg); transform-style: preserve-3d; }
.bib-opening-left, .bib-opening-right {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  border: 4px solid #57202b;
  background: linear-gradient(135deg, #e9d9b2, #bfa878);
  box-shadow: inset 0 0 38px rgba(76, 47, 26, .34), 0 24px 45px rgba(0,0,0,.42);
}
.bib-opening-left { left: 0; border-radius: 18px 2px 2px 18px; transform-origin: right center; }
.bib-opening-right { right: 0; border-radius: 2px 18px 18px 2px; transform-origin: left center; }
.bib-opening-book > i {
  position: absolute;
  z-index: calc(20 - var(--n));
  top: 5px;
  left: 50%;
  width: 48%;
  height: calc(100% - 10px);
  border: 1px solid #aa9469;
  border-radius: 3px 16px 16px 3px;
  background: linear-gradient(110deg, #f4e7c7, #c8b282);
  transform-origin: left center;
  animation: bib-page-turn 1.02s cubic-bezier(.55,.05,.35,1) infinite;
  animation-delay: calc(var(--n) * -.14s);
}
.bib-opening-book > b { position: absolute; z-index: 40; left: calc(50% - 3px); top: 2%; width: 6px; height: 96%; border-radius: 50%; background: #6a2833; box-shadow: 0 0 12px rgba(0,0,0,.5); }
.bib-opening-status { min-height: 1.5em; margin: .5rem 0 .9rem; color: #d6c9bd; text-align: center; }
.bib-progress { width: min(440px, 78%); height: 3px; margin: 0 auto; overflow: hidden; border-radius: 99px; background: rgba(255,255,255,.08); }
.bib-progress span { display: block; width: 100%; height: 100%; background: linear-gradient(90deg, var(--bib-wine), var(--bib-gold), var(--bib-wine)); transform-origin: left; animation: bib-progress 1.9s ease-out both; }

.bib-result-head { margin-bottom: 2rem; }
.bib-open-book {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  max-width: 1100px;
  margin: 0 auto;
  filter: drop-shadow(0 30px 35px rgba(0,0,0,.46));
}
.bib-open-book::before {
  content: '';
  position: absolute;
  z-index: 4;
  top: 1.4%;
  bottom: 1.4%;
  left: calc(50% - 5px);
  width: 10px;
  border-radius: 50%;
  background: linear-gradient(90deg, rgba(75,48,27,.28), rgba(255,255,255,.2), rgba(75,48,27,.36));
  box-shadow: 0 0 15px rgba(62, 39, 24, .3);
  pointer-events: none;
}
.bib-paper {
  position: relative;
  min-height: 630px;
  padding: clamp(2rem, 4.4vw, 3.7rem);
  color: #281f1e;
  background:
    repeating-linear-gradient(0deg, rgba(91,67,42,.025) 0 1px, transparent 1px 5px),
    linear-gradient(105deg, #dfcca2, #f6eacb 16%, #ead9b4 86%, #c4ad80);
  box-shadow: inset 0 0 45px rgba(101,73,43,.2);
}
.bib-paper-left { border-radius: 20px 3px 3px 20px; transform: perspective(1400px) rotateY(2deg); transform-origin: right center; }
.bib-paper-right { border-radius: 3px 20px 20px 3px; transform: perspective(1400px) rotateY(-2deg); transform-origin: left center; }
.bib-paper::after {
  content: '';
  position: absolute;
  inset: 13px;
  pointer-events: none;
  border: 1px solid rgba(111, 76, 39, .22);
  border-radius: inherit;
}
.bib-location { position: relative; z-index: 1; display: flex; justify-content: space-between; gap: 1rem; padding-bottom: 1rem; border-bottom: 1px solid rgba(100,69,40,.28); }
.bib-location span { display: grid; gap: .15rem; }
.bib-location span:last-child { text-align: right; }
.bib-location small, .bib-selected-meta > span, .bib-selected-meta strong small, .bib-key-block small, .bib-reading-block small, .bib-action-block small {
  color: #8a4c3e;
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
}
.bib-location strong { color: #4f2724; font-family: Georgia, serif; font-size: .95rem; font-weight: 600; }
.bib-page-title { position: relative; z-index: 1; margin: 2rem 0 1.45rem; color: #4b2824; font-family: Georgia, serif; font-size: clamp(1.6rem, 3vw, 2.25rem); font-weight: 500; text-align: center; }
.bib-page-title::after { content: '◆'; display: block; margin-top: .8rem; color: #9a6845; font-size: .55rem; }
.bib-lines { position: relative; z-index: 1; display: grid; gap: .65rem; margin: 0; padding: 0; list-style: none; }
.bib-lines li { position: relative; display: grid; grid-template-columns: 28px 1fr; gap: .7rem; align-items: start; padding: .9rem .75rem; border-radius: 8px; transition: background .25s ease, transform .25s ease; }
.bib-lines li > span { display: grid; width: 24px; height: 24px; place-items: center; border: 1px solid rgba(106,64,43,.35); border-radius: 50%; color: #835243; font-size: .65rem; }
.bib-lines li p { margin: 0; font-family: Georgia, serif; font-size: clamp(.98rem, 1.7vw, 1.14rem); font-style: italic; line-height: 1.65; }
.bib-lines li.is-selected { background: linear-gradient(90deg, rgba(137,63,62,.2), rgba(216,173,96,.25)); transform: translateX(5px); }
.bib-lines li.is-selected::before { content: ''; position: absolute; top: 0; bottom: 0; left: -8px; width: 5px; border-radius: 99px; background: #7c2836; box-shadow: 0 0 0 3px rgba(124,40,54,.12); }
.bib-lines li.is-selected > span { border-color: #7c2836; color: #7c2836; font-weight: 800; }
.bib-selected-meta { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-bottom: 1rem; border-bottom: 1px solid rgba(100,69,40,.28); }
.bib-selected-meta strong { color: #6b2b31; font-family: Georgia, serif; font-size: 1.05rem; }
.bib-selected-line { position: relative; z-index: 1; margin: 2rem 0 1.4rem; padding: 0 0 0 1.35rem; border-left: 3px solid #7c2836; color: #3b2221; font-family: Georgia, serif; font-size: clamp(1.35rem, 2.6vw, 2rem); font-style: italic; line-height: 1.38; }
.bib-selected-line::before { content: '“'; position: absolute; top: -.65rem; left: .2rem; color: rgba(124,40,54,.2); font-size: 4rem; line-height: 1; }
.bib-key-block { position: relative; z-index: 1; display: flex; align-items: baseline; gap: .8rem; margin-bottom: 1.35rem; padding: .7rem .85rem; border-radius: 8px; background: rgba(113,66,42,.08); }
.bib-key-block strong { color: #672d31; font-family: Georgia, serif; font-size: 1.08rem; }
.bib-reading-block, .bib-action-block { position: relative; z-index: 1; }
.bib-reading-block p, .bib-action-block p { margin: .45rem 0 0; color: #3a2d29; font-size: .96rem; line-height: 1.65; }
.bib-action-block { margin-top: 1.25rem; padding: 1rem 1.15rem; border: 1px solid rgba(123,77,43,.22); border-radius: 10px; background: rgba(255,255,255,.17); }
.bib-action-block p { color: #562a29; font-family: Georgia, serif; font-size: 1.05rem; font-weight: 600; }
.bib-page-footer { position: absolute; z-index: 1; right: 3.2rem; bottom: 1.8rem; left: 3.2rem; display: flex; justify-content: space-between; margin: 0; padding-top: .6rem; border-top: 1px solid rgba(100,69,40,.22); color: #806b50; font-family: Georgia, serif; font-size: .7rem; font-style: italic; }
.bib-page-footer b { font-style: normal; }

.bib-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .8rem; margin-top: 2rem; }
.bib-actions button {
  min-height: 47px;
  padding: .78rem 1.2rem;
  border: 1px solid var(--bib-line);
  border-radius: 999px;
  color: #fff4df;
  background: rgba(255,255,255,.035);
  cursor: pointer;
  font-size: .83rem;
  font-weight: 800;
}
.bib-actions button:hover { border-color: var(--bib-gold); background: rgba(216,173,96,.09); }
.bib-actions button:focus-visible { outline: 2px solid var(--bib-gold); outline-offset: 3px; }
.bib-actions .bib-share { border-color: var(--bib-gold); color: #2f1b17; background: var(--bib-gold-soft); }
.bib-actions span { margin-right: .45rem; }
.bib-share-status { min-height: 1.4em; margin: .85rem 0 0; color: #d7c6ae; font-size: .78rem; text-align: center; }
.bib-disclaimer { margin: .5rem 0 0; color: #77717b; font-size: .68rem; text-align: center; }

.bib-guide {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, .92fr);
  gap: clamp(1.5rem, 5vw, 4rem);
  padding: clamp(2rem, 5vw, 4rem);
  border-top: 1px solid rgba(216,173,96,.2);
  background:
    linear-gradient(130deg, rgba(83,35,49,.28), transparent 45%),
    #0a0b14;
}
.bib-guide-copy h3 { margin: .45rem 0 .75rem; color: #fff5e6; font-family: Georgia, serif; font-size: clamp(1.6rem, 3.5vw, 2.65rem); font-weight: 500; }
.bib-guide-copy p { max-width: 610px; margin: 0; color: #aaa2aa; line-height: 1.68; }
.bib-guide ol { display: grid; gap: .7rem; margin: 0; padding: 0; list-style: none; }
.bib-guide li { display: grid; grid-template-columns: 42px 1fr; gap: .85rem; align-items: center; padding: .75rem; border: 1px solid rgba(216,173,96,.14); border-radius: 13px; background: rgba(255,255,255,.025); }
.bib-guide li > b { display: grid; width: 40px; height: 40px; place-items: center; border: 1px solid var(--bib-gold); border-radius: 50%; color: var(--bib-gold); font-family: Georgia, serif; }
.bib-guide li span { display: grid; gap: .15rem; }
.bib-guide li strong { color: #f5e8d4; font-family: Georgia, serif; font-size: 1rem; }
.bib-guide li small { color: #918994; font-size: .74rem; line-height: 1.4; }

@keyframes bib-book-pulse {
  from { transform: perspective(900px) rotateX(57deg) rotateZ(-2deg) translateY(0); }
  to { transform: perspective(900px) rotateX(53deg) rotateZ(1deg) translateY(-8px); }
}
@keyframes bib-edge-riffle {
  0% { background-position-y: 0; }
  100% { background-position-y: 12px; }
}
@keyframes bib-page-turn {
  0% { transform: rotateY(0deg); opacity: 1; }
  48% { opacity: 1; }
  52% { opacity: .75; }
  100% { transform: rotateY(-178deg); opacity: .95; }
}
@keyframes bib-progress { from { transform: scaleX(0); } to { transform: scaleX(1); } }

@media (max-width: 820px) {
  .bib-guide { grid-template-columns: 1fr; }
  .bib-open-book { grid-template-columns: 1fr; gap: .6rem; filter: drop-shadow(0 24px 28px rgba(0,0,0,.38)); }
  .bib-open-book::before { display: none; }
  .bib-paper { min-height: auto; padding: 2.2rem 1.5rem 4.2rem; transform: none; }
  .bib-paper-left { border-radius: 18px 18px 7px 7px; }
  .bib-paper-right { border-radius: 7px 7px 18px 18px; }
  .bib-page-footer { right: 1.5rem; bottom: 1.4rem; left: 1.5rem; }
}

@media (max-width: 620px) {
  .bib { margin-right: -.4rem; margin-left: -.4rem; border-radius: 20px; }
  .bib-hero { min-height: 500px; }
  .bib-hero > img { object-position: 58% 50%; }
  .bib-hero-copy { width: calc(100% - 2rem); margin: 0 1rem 2rem; }
  .bib-hero-copy h2 { font-size: clamp(2.15rem, 11vw, 3.4rem); }
  .bib-hero-points { gap: .4rem; }
  .bib-hero-points span { padding: .42rem .58rem; font-size: .66rem; }
  .bib-body { padding: 2.7rem .75rem; }
  .bib-body::before { inset: .55rem; }
  .bib-book-trigger { min-height: 330px; padding-right: 0; padding-left: 0; }
  .bib-closed-book { width: min(355px, 88vw); height: 218px; min-height: 0; }
  .bib-book-cover { padding: 1.5rem; }
  .bib-book-cover i { width: 44px; height: 44px; margin-bottom: .7rem; }
  .bib-book-cover i::before, .bib-book-cover i::after { top: 73px; height: 29px; }
  .bib-book-cover b { font-size: .85rem; }
  .bib-hold-label { min-width: 220px; padding: .8rem 1rem; font-size: .77rem; }
  .bib-opening { min-height: 430px; }
  .bib-opening-book { width: 94vw; height: 225px; min-height: 0; }
  .bib-paper { padding-right: 1.15rem; padding-left: 1.15rem; }
  .bib-lines li { grid-template-columns: 24px 1fr; gap: .5rem; padding: .75rem .55rem; }
  .bib-selected-line { font-size: 1.3rem; }
  .bib-key-block { align-items: flex-start; flex-direction: column; gap: .25rem; }
  .bib-actions { display: grid; grid-template-columns: 1fr; }
  .bib-actions button { width: 100%; }
  .bib-guide { padding: 2.2rem 1.1rem; }
}

@media (prefers-reduced-motion: reduce) {
  .bib *, .bib *::before, .bib *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
