/* Platform operations — Xiaohongshu scrapbook opening screen */
.video-scene.xhs-mode {
  background: #f3f0e8;
  color: #101114;
  padding: 0;
}

.video-scene.xhs-mode > .video-ambient,
.video-scene.xhs-mode > .gallery-head,
.video-scene.xhs-mode > .gallery-viewport,
.video-scene.xhs-mode > .gallery-controls {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.xhs-scrapbook {
  position: absolute;
  inset: 74px 0 0;
  overflow: hidden;
  background:
    linear-gradient(rgba(29, 35, 45, .075) 1px, transparent 1px),
    linear-gradient(90deg, rgba(29, 35, 45, .075) 1px, transparent 1px),
    #f3f0e8;
  background-size: 26px 26px;
  isolation: isolate;
}

.xhs-scrapbook::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 18% 20%, rgba(112, 121, 157, .08), transparent 24%),
    radial-gradient(circle at 84% 72%, rgba(177, 151, 127, .10), transparent 28%);
  mix-blend-mode: multiply;
}

.xhs-heading {
  position: absolute;
  left: 4.2vw;
  top: 4.2vh;
  z-index: 8;
  width: min(36vw, 500px);
}

.xhs-heading .eyebrow {
  margin: 0 0 12px;
}

.xhs-heading h2 {
  margin: 0;
  font-size: clamp(42px, 5.8vw, 86px);
  line-height: .9;
  letter-spacing: -.065em;
  font-weight: 500;
}

.xhs-heading p:last-child {
  width: min(360px, 80%);
  margin: 18px 0 0;
  font: 400 10px/1.7 "IBM Plex Mono", monospace;
  text-transform: uppercase;
}

.xhs-board-label {
  position: absolute;
  right: 4.2vw;
  top: 5.2vh;
  z-index: 8;
  display: grid;
  justify-items: end;
  gap: 7px;
  font: 500 9px/1.3 "IBM Plex Mono", monospace;
  letter-spacing: .06em;
}

.xhs-board-label b {
  font-size: 12px;
  font-weight: 500;
}

.xhs-board-label span {
  opacity: .48;
}

.xhs-board {
  position: absolute;
  inset: 0;
  z-index: 3;
}

.xhs-card {
  --rotation: 0deg;
  --delay: 0ms;
  position: absolute;
  width: clamp(145px, 17vw, 250px);
  padding: 10px 10px 30px;
  border: 1px solid rgba(16, 17, 20, .56);
  background: #fbfaf6;
  box-shadow: 0 15px 34px rgba(41, 36, 29, .11);
  transform: translateY(30px) rotate(var(--rotation)) scale(.96);
  transform-origin: 50% 50%;
  opacity: 0;
  transition:
    transform .72s cubic-bezier(.22, 1, .36, 1),
    opacity .45s ease,
    box-shadow .35s ease;
  transition-delay: var(--delay);
  cursor: pointer;
}

.xhs-scrapbook.is-ready .xhs-card {
  transform: translateY(0) rotate(var(--rotation)) scale(1);
  opacity: 1;
}

.xhs-card:hover,
.xhs-card:focus-visible {
  z-index: 20 !important;
  transform: translateY(-12px) rotate(0deg) scale(1.035) !important;
  box-shadow: 0 28px 60px rgba(41, 36, 29, .2);
  outline: none;
}

.xhs-card::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -17px;
  width: 36px;
  height: 30px;
  border: 2px solid #3956bd;
  border-bottom-width: 4px;
  border-radius: 5px 5px 2px 2px;
  transform: translateX(-50%) rotate(calc(var(--rotation) * -.35));
  background: rgba(243, 240, 232, .22);
  box-shadow: inset 0 -5px 0 rgba(57, 86, 189, .08);
}

.xhs-card::after {
  content: "";
  position: absolute;
  left: calc(50% - 8px);
  top: -26px;
  width: 16px;
  height: 14px;
  border: 2px solid #3956bd;
  border-bottom: 0;
  border-radius: 9px 9px 0 0;
}

.xhs-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid rgba(16, 17, 20, .38);
  background: #dedbd4;
  filter: saturate(.88) contrast(.98);
}

.xhs-card:nth-child(2) img,
.xhs-card:nth-child(5) img {
  aspect-ratio: 3 / 4;
}

.xhs-card-copy {
  position: absolute;
  left: 11px;
  right: 11px;
  bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 8px;
  font: 500 8px/1.2 "IBM Plex Mono", monospace;
}

.xhs-card-copy b {
  max-width: 75%;
  font-size: 9px;
  font-weight: 500;
  text-align: left;
}

.xhs-card-copy span {
  opacity: .52;
}

.xhs-card:nth-child(1) { left: 23vw; top: 19vh; --rotation: -5deg; --delay: 40ms; z-index: 4; }
.xhs-card:nth-child(2) { left: 43vw; top: 10vh; --rotation: 4deg; --delay: 100ms; z-index: 6; }
.xhs-card:nth-child(3) { right: 8vw; top: 18vh; --rotation: 2deg; --delay: 170ms; z-index: 5; }
.xhs-card:nth-child(4) { left: 11vw; bottom: 3vh; --rotation: -8deg; --delay: 230ms; z-index: 7; }
.xhs-card:nth-child(5) { left: 39vw; bottom: -7vh; --rotation: 6deg; --delay: 300ms; z-index: 8; }
.xhs-card:nth-child(6) { right: 19vw; bottom: 1vh; --rotation: -3deg; --delay: 360ms; z-index: 6; }

.xhs-doodle {
  position: absolute;
  z-index: 2;
  color: #3956bd;
  font: 500 11px/1.4 "IBM Plex Mono", monospace;
  opacity: .86;
  pointer-events: none;
}

.xhs-doodle::after {
  content: "";
  display: block;
  width: 62px;
  height: 24px;
  margin-top: 3px;
  border-top: 2px solid currentColor;
  border-radius: 50%;
  transform: rotate(-8deg);
}

.xhs-doodle-a { left: 18vw; top: 33vh; transform: rotate(-7deg); }
.xhs-doodle-b { right: 6vw; bottom: 23vh; transform: rotate(8deg); }

.xhs-tab-note {
  position: absolute;
  right: 3.8vw;
  bottom: 4vh;
  z-index: 10;
  padding: 10px 13px;
  border: 1px solid rgba(16, 17, 20, .55);
  background: rgba(248, 246, 238, .88);
  font: 500 8px/1.4 "IBM Plex Mono", monospace;
  backdrop-filter: blur(6px);
}

.xhs-dialog {
  width: min(960px, 90vw);
  height: min(680px, 86vh);
  padding: 0;
  border: 1px solid #111318;
  background: #f4f1e9;
  color: #111318;
  box-shadow: 0 45px 120px rgba(0, 0, 0, .32);
}

.xhs-dialog::backdrop {
  background: rgba(22, 23, 26, .64);
  backdrop-filter: blur(8px);
}

.xhs-dialog[open] {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  animation: xhs-dialog-in .45s cubic-bezier(.22, 1, .36, 1);
}

@keyframes xhs-dialog-in {
  from { opacity: 0; transform: translateY(25px) scale(.97); }
}

.xhs-dialog-media {
  min-width: 0;
  padding: 28px;
  display: grid;
  place-items: center;
  background:
    linear-gradient(rgba(29, 35, 45, .065) 1px, transparent 1px),
    linear-gradient(90deg, rgba(29, 35, 45, .065) 1px, transparent 1px),
    #e9e6df;
  background-size: 22px 22px;
}

.xhs-dialog-media img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: calc(86vh - 56px);
  object-fit: contain;
  filter: drop-shadow(0 20px 35px rgba(0, 0, 0, .16));
}

.xhs-dialog-copy {
  position: relative;
  padding: 72px 42px 36px;
  overflow: auto;
}

.xhs-dialog-close {
  position: absolute;
  right: 12px;
  top: 12px;
  width: 36px;
  height: 36px;
  border: 1px solid;
  font-size: 22px;
}

.xhs-dialog-kicker {
  margin: 0 0 18px;
  font: 500 9px/1.3 "IBM Plex Mono", monospace;
  opacity: .58;
}

.xhs-dialog-copy h3 {
  margin: 0 0 26px;
  font-size: clamp(32px, 4vw, 58px);
  line-height: .95;
  letter-spacing: -.055em;
  font-weight: 500;
}

.xhs-dialog-copy > p:not(.xhs-dialog-kicker) {
  font-size: 14px;
  line-height: 1.75;
}

.xhs-dialog-meta {
  margin: 40px 0 0;
  display: grid;
  gap: 0;
  border-top: 1px solid rgba(17, 19, 24, .38);
}

.xhs-dialog-meta div {
  display: grid;
  grid-template-columns: 82px 1fr;
  gap: 18px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(17, 19, 24, .2);
}

.xhs-dialog-meta dt,
.xhs-dialog-meta dd {
  margin: 0;
  font: 500 9px/1.45 "IBM Plex Mono", monospace;
}

.xhs-dialog-meta dt { opacity: .48; }

.video-scene.xhs-mode > .scene-back {
  color: #111318;
  z-index: 30;
}

@media (max-width: 900px) {
  .xhs-heading { width: 54vw; }
  .xhs-card { width: clamp(130px, 23vw, 205px); }
  .xhs-card:nth-child(1) { left: 9vw; top: 26vh; }
  .xhs-card:nth-child(2) { left: 39vw; top: 18vh; }
  .xhs-card:nth-child(3) { right: 5vw; top: 31vh; }
  .xhs-card:nth-child(4) { left: 5vw; bottom: 5vh; }
  .xhs-card:nth-child(5) { left: 36vw; bottom: -3vh; }
  .xhs-card:nth-child(6) { right: 4vw; bottom: 7vh; }
}

@media (max-width: 620px) {
  .xhs-scrapbook { overflow: auto; padding-bottom: 90px; }
  .xhs-heading { position: relative; left: auto; top: auto; width: auto; margin: 28px 22px 12px; }
  .xhs-board-label { display: none; }
  .xhs-board { position: relative; inset: auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 14px; padding: 28px 18px 110px; }
  .xhs-card,
  .xhs-card:nth-child(n) { position: relative; inset: auto; width: 100%; bottom: auto; right: auto; left: auto; top: auto; }
  .xhs-card img,
  .xhs-card:nth-child(n) img { aspect-ratio: 3 / 4; }
  .xhs-doodle, .xhs-tab-note { display: none; }
  .xhs-dialog[open] { grid-template-columns: 1fr; height: 90vh; overflow: auto; }
  .xhs-dialog-media { min-height: 48vh; }
  .xhs-dialog-copy { padding: 48px 24px 28px; }
}

@media (prefers-reduced-motion: reduce) {
  .xhs-card,
  .xhs-scrapbook.is-ready .xhs-card,
  .xhs-card:hover { transition: none; transform: none !important; opacity: 1; }
}
