:root { --text: #f0e2ca; --muted: #a89980; --accent: #a61920; }
body { background: #211b16; isolation: isolate; }
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  background: linear-gradient(#17110b26, #100c0780), url('assets/detective-desk.png') center / cover no-repeat;
  pointer-events: none;
}
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background: radial-gradient(ellipse at 50% 42%, transparent 30%, #0d0a0766 100%);
  pointer-events: none;
}
.viewer {
  width: min(100%, 510px);
  padding-top: max(18px, env(safe-area-inset-top));
  padding-bottom: max(17px, env(safe-area-inset-bottom));
  filter: drop-shadow(0 12px 30px #0003);
}
.stage { --card-width: 260px; --card-height: 370px; --drag: 0px; --lean: 0deg; perspective: 1200px; isolation: isolate; }
.slide { pointer-events: none; z-index: 2; transform-origin: 50% 12%; }
.slide.is-active, .stage.is-reverse .slide.is-active { pointer-events: none; z-index: 4; transform: translate3d(var(--drag),0,0) rotate(var(--lean)); }
.slide.is-leaving { z-index: 5; visibility: visible; }
.poster {
  display: flex;
  position: relative;
  align-items: center;
  justify-content: center;
  width: var(--card-width);
  height: var(--card-height);
  padding: 4px 4px 8px;
  background: #d6c3a0 url('assets/newsprint-paper.png') center / 440px;
  border-radius: 0;
  pointer-events: none;
  box-shadow: 1px 1px 0 #eee0bd, 2px 5px 0 #8c7757, 0 15px 30px #0007;
  clip-path: polygon(0 0,100% 0,100% 99.6%,98% 100%,95% 99.5%,92% 100%,89% 99.6%,85% 100%,81% 99.6%,76% 100%,71% 99.5%,66% 100%,60% 99.5%,55% 100%,49% 99.6%,44% 100%,38% 99.6%,33% 100%,27% 99.5%,22% 100%,17% 99.6%,12% 100%,7% 99.5%,3% 100%,0 99.6%);
}
.slide.is-active .poster { pointer-events: auto; }
.poster img { border-radius: 0; box-shadow: none; }
.poster::after {
  content: '';
  position: absolute;
  bottom: 1px;
  right: 0;
  width: 8px;
  height: 8px;
  background: linear-gradient(135deg, #6f543255 0 45%, #f2e5c9 49% 65%, #aa9878 100%);
  clip-path: polygon(100% 0,100% 100%,0 100%);
  pointer-events: none;
}
.is-leaving .poster::after { animation: paper-curl .68s ease both; }
.deck-peek {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--card-width);
  height: var(--card-height);
  padding: 5px;
  background: #d6c3a0 url('assets/newsprint-paper.png') center / 440px;
  border: 0;
  border-radius: 0;
  box-shadow: 2px 5px 16px #0007;
  transition: transform .45s var(--ease);
}
.deck-peek[hidden] { display: none; }
.deck-peek img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; opacity: .8; pointer-events: none; }
.peek-next { transform: translate(calc(-50% + 11px),-50%) scale(.96) rotate(2.5deg); }
.peek-prev { transform: translate(calc(-50% - 11px),-50%) scale(.96) rotate(-2deg); }
.peek-next:hover { transform: translate(calc(-50% + 15px),-50%) scale(.96) rotate(3deg); }
.peek-prev:hover { transform: translate(calc(-50% - 15px),-50%) scale(.96) rotate(-3deg); }
.stage.is-dragging .slide.is-active { transition: none; }
.stage-arrow { z-index: 6; color: #e4d5ba; background: #1f180e88; border-color: #d8c9ac50; }
.controls {
  position: relative;
  flex: none;
  margin-top: 7px;
  padding: 10px 17px 17px;
  background: #d8c5a3 url('assets/newsprint-paper.png') center / 520px;
  color: #32271c;
  border: 1px solid #927a5155;
  box-shadow: 0 1px 1px #fff3,0 7px 20px #0005;
  clip-path: polygon(0 .8%,5% 0,10% .7%,17% .2%,23% .8%,30% 0,36% .7%,42% .2%,48% .8%,55% 0,61% .7%,68% 0,75% .8%,82% .2%,88% .7%,95% 0,100% .7%,100% 99.5%,95% 100%,90% 99.6%,83% 100%,77% 99.5%,70% 100%,64% 99.6%,57% 100%,50% 99.5%,43% 100%,36% 99.6%,29% 100%,23% 99.5%,16% 100%,10% 99.6%,5% 100%,0 99.5%);
}
.discovery { display: flex; align-items: center; gap: 15px; padding-bottom: 8px; border-bottom: 3px double #51412b9c; }
.next-chapter { display: flex; flex: 1; align-items: center; gap: 12px; min-width: 0; min-height: 35px; padding: 1px 0; color: #41291c; background: transparent; text-align: left; }
.chapter-text { display: flex; flex-direction: column; gap: 3px; }
.chapter-eyebrow { font-size: 7px; color: #6e5a40; letter-spacing: .15px; }
#chapter-title { font: bold 15px/1.1 Georgia,'Times New Roman',serif; }
.chapter-arrow { color: #8d1b1d; font-size: 25px; transition: transform .25s; }
.next-chapter:hover .chapter-arrow { transform: translateX(4px); }
.discovery .slide-meta { flex: none; gap: 10px; }
.slide-counter { font-family: Georgia,'Times New Roman',serif; font-size: 11px; color: #79684e; }
#current-slide { color: #822022; font-weight: bold; }
.counter-divider { color: #9a8769; }
.expand { color: #665039; }
.expand:hover { color: #8d1b1d; }
.viewer .tabs {
  display: grid;
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap: 0;
  margin: 0 0 11px;
  padding: 0;
  border: 0;
  border-bottom: 3px double #51412b9c;
  border-radius: 0;
  background: none;
}
.viewer .tabs button {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 30px;
  padding: 5px 3px;
  color: #51402d;
  background: transparent;
  border-radius: 0;
  font: bold 12px/1 Georgia,'Times New Roman',serif;
  letter-spacing: .2px;
  text-transform: uppercase;
}
.viewer .tabs button:not(:nth-child(3n)) { border-right: 1px solid #715a3c45; }
.viewer .tabs button:nth-child(-n+3) { border-bottom: 1px solid #715a3c45; }
.viewer .tabs button::after { display: none; }
.viewer .tabs button>span { padding: 2px 4px; border-bottom: 2px solid transparent; }
.viewer .tabs button[aria-selected=true] { color: #8d1b1d; }
.viewer .tabs button[aria-selected=true]>span { border-bottom-color: #8d1b1d; transform: rotate(-2deg); }
.viewer .tabs button:hover { color: #8d1b1d; background: #9f43250a; }
.telegram {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 61px;
  padding: 10px 20px;
  overflow: hidden;
  border: 1px solid #6a0e0e;
  border-radius: 2px;
  background: linear-gradient(115deg,#85151a,#b7242b 47%,#94161d);
  color: #fff0d5;
  box-shadow: inset 0 0 0 3px #eaa37519,inset 0 0 0 4px #5310104d,0 3px 0 #4f1514,0 6px 12px #5c231435;
  transition: filter .2s,transform .2s,box-shadow .2s;
}
.telegram::before { content: ''; position: absolute; inset: 0; background: url('assets/newsprint-paper.png') center / 350px; mix-blend-mode: soft-light; opacity: .18; pointer-events: none; }
.telegram::after { content: ''; position: absolute; inset: 0; background: linear-gradient(115deg,transparent 35%,#fff3 50%,transparent 65%); transform: translateX(-150%); animation: ticket-light 6s ease 2; pointer-events: none; }
.telegram:hover { background: linear-gradient(115deg,#981c20,#c42b31 47%,#a21c22); transform: translateY(-1px); filter: brightness(1.06); box-shadow: inset 0 0 0 3px #eaa37520,inset 0 0 0 4px #5310104d,0 4px 0 #4f1514,0 8px 18px #5c23144d; }
.telegram:active { transform: translateY(2px); }
.telegram-seal { display: grid; place-items: center; flex: none; width: 33px; height: 33px; border: 1px solid #e5b88c99; border-radius: 50%; box-shadow: 0 0 0 3px #f5c28c12; }
.telegram-icon { width: 18px; height: 18px; }
.telegram-copy { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.telegram-kicker { font-size: 7px; letter-spacing: .35px; color: #ebbd99; }
#telegram-label { font: bold 17px/1.1 Georgia,'Times New Roman',serif; letter-spacing: .05px; }
@keyframes ticket-light { 0%,70% { transform: translateX(-150%); } 100% { transform: translateX(150%); } }
@keyframes paper-curl { 0% { width: 8px; height: 8px; } 40% { width: 80px; height: 80px; } 100% { width: 130px; height: 130px; opacity: .3; } }
@media(max-width:699px) {
  body::before { background-position: 43% center; }
  body::after { background: linear-gradient(#160c0620,#160c0640); }
  .viewer { padding-inline: 11px; padding-top: max(12px,env(safe-area-inset-top)); padding-bottom: max(12px,env(safe-area-inset-bottom)); }
  .controls { padding: 9px 13px 14px; }
  .viewer .tabs button { font-size: 11px; }
}
@media(max-height:650px) {
  .viewer { padding-top: max(8px,env(safe-area-inset-top)); }
  .controls { padding-block: 7px 11px; margin-top: 3px; }
  .discovery { padding-bottom: 5px; }
  .next-chapter { min-height: 29px; }
  #chapter-title { font-size: 13px; }
  .viewer .tabs { margin-bottom: 8px; }
  .viewer .tabs button { min-height: 26px; font-size: 10px; }
  .telegram { min-height: 52px; padding-block: 8px; }
  #telegram-label { font-size: 15px; }
}
@media(max-height:450px) and (min-width:600px) {
  .viewer { width: min(100%,750px); max-width: 750px; grid-template-rows: 1fr; gap: 20px; }
  .stage { min-height: 220px; }
  .controls { margin-top: 0; }
  #telegram-label { font-size: 14px; }
}
@media(prefers-reduced-motion:reduce) {
  .slide.is-active,.stage.is-reverse .slide.is-active { transform: none; }
}
