/* ==================================================================
   Vertical recording layout · 竖屏录制版
   上面：手部识别画面卡片   中间：阶段提示   下面：粒子圣诞树
   Loaded only by vertical.html, after style.css.
   ================================================================== */

:root {
  /* A small card tucked into the top-left corner, leaving the sky and the
     tree free. (The scene's own iPhone layout put it bottom-centre; a corner
     keeps it out of the tree's way even when the tree is at its widest.) */
  --v-cam-w: min(41.4vw, 19.8vh, 207px);
  --v-cam-h: calc(var(--v-cam-w) * 0.75 + 14px);
  --v-cam-top: calc(max(14px, env(safe-area-inset-top, 0px)) + 40px);
  --v-gap: 10px;
}

html,
body {
  overflow: hidden;
  background: #05030a;
}

/* The vertical page owns its own layout; drop the landscape HUD layers. */
body.is-recording-vertical .hud-top,
body.is-recording-vertical .ritual-steps,
body.is-recording-vertical .dock,
body.is-recording-vertical .toast,
body.is-recording-vertical .photo-callout,
body.is-recording-vertical #ritual {
  display: none !important;
}

/* ---- camera card ------------------------------------------------- */

body.is-recording-vertical .camera-panel {
  position: fixed !important;
  top: var(--v-cam-top) !important;
  left: 12px !important;
  bottom: auto !important;
  right: auto !important;
  transform: none !important;
  width: var(--v-cam-w) !important;
  max-width: calc(100vw - 24px) !important;
  padding: 3px !important;
  border-radius: 11px !important;
  background: rgba(14, 9, 20, 0.6) !important;
  border: 1px solid rgba(255, 255, 255, 0.16) !important;
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(var(--accent-rgb), 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.07) !important;
  z-index: 22;
  animation: v-cam-in 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
  transition: opacity 0.6s ease;
}


@keyframes v-cam-in {
  from { opacity: 0; transform: translateX(-50%) translateY(-14px) scale(0.96); }
  to { opacity: 1; transform: translateX(-50%); }
}

body.is-recording-vertical .camera-panel[hidden] { display: none !important; }

body.is-recording-vertical .cam-frame {
  aspect-ratio: 1 / 1;
  border-radius: 17px;
  border-color: rgba(var(--accent-rgb), 0.22);
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.45);
}

/* Laptop-sized windows: show the whole 16:9 frame instead of cropping it. */
.camera-panel[data-wide="1"] { --v-cam-w: min(42vw, 24vh, 260px); }
.camera-panel[data-wide="1"] .cam-frame { aspect-ratio: 16 / 10; }
.camera-panel[data-wide="1"] #cam { object-fit: cover; }

body.is-recording-vertical #cam {
  filter: saturate(0.92) contrast(1.04) brightness(0.94);
}

body.is-recording-vertical #skeleton {
  filter: drop-shadow(0 0 6px rgba(var(--accent-rgb), 0.55));
}

body.is-recording-vertical .cam-badge {
  left: 10px;
  bottom: 9px;
  font-size: 8px;
}

body.is-recording-vertical .cam-frame {
  aspect-ratio: 4 / 3;
  border-radius: 14px;
}

body.is-recording-vertical #cam { object-fit: cover; }

/* the readout row is about half the height it used to be */
body.is-recording-vertical .cam-readout {
  justify-content: space-between;
  align-items: center;
  gap: 5px;
  padding: 1px 3px 0;
}

body.is-recording-vertical .cam-readout strong {
  font-size: 5px;
  line-height: 1.2;
  letter-spacing: 0.06em;
}

body.is-recording-vertical .cam-readout .cam-expand {
  height: 12px;
  padding: 0 5px;
  font-size: 7px;
  line-height: 1;
}

body.is-recording-vertical .cam-close { width: 14px; height: 14px; font-size: 6px; top: -3px; right: -3px; }

/* the readout can drop the 合照 button on the smallest cards */
@media (max-width: 380px) {
  body.is-recording-vertical .cam-readout .cam-expand { display: none !important; }
}

body.is-recording-vertical .cam-caption {
  display: none;
}

body.is-recording-vertical .cam-close {
  position: absolute;
  right: -6px;
  top: -6px;
  margin: 0;
  width: 24px;
  height: 24px;
  font-size: 10px;
  background: rgba(10, 6, 14, 0.85);
  border-color: rgba(255, 255, 255, 0.22);
}

/* Placeholder before the camera starts: the card slot stays the same size
   so the layout never jumps once tracking is on. */
.v-cam-standby {
  display: none;
  position: fixed;
  top: var(--v-cam-top);
  bottom: auto;
  left: 12px;
  transform: none;
  width: var(--v-cam-w);
  max-width: calc(100vw - 24px);
  padding: 4px;
  border-radius: 14px;
  border: 1px dashed rgba(255, 255, 255, 0.16);
  background: rgba(14, 9, 20, 0.35);
  z-index: 21;
  transition: opacity 0.45s ease;
}

body.is-recording-vertical:not(.has-camera) .v-cam-standby { display: block; }

/* The face stays on screen for the whole take: no stage hides or dims the
   card. The tree is framed to start below it (see main.js applyCardFit). */
body.tree-ready .v-cam-standby,
body.stage-grow .v-cam-standby,
body.stage-lights .v-cam-standby { opacity: 1; visibility: visible; }
body.tree-ready .camera-panel,
body.stage-grow .camera-panel,
body.stage-lights .camera-panel { opacity: 1 !important; visibility: visible; }

.v-cam-standby-inner {
  aspect-ratio: 1 / 1;
  border-radius: 17px;
  display: grid;
  place-items: center;
  gap: 6px;
  text-align: center;
  background:
    radial-gradient(circle at 50% 42%, rgba(var(--accent-rgb), 0.1), transparent 62%),
    rgba(8, 5, 12, 0.55);
}

.v-cam-standby-glyph {
  font-size: 26px;
  color: var(--accent-soft);
  opacity: 0.7;
  text-shadow: 0 0 22px rgba(var(--accent-rgb), 0.6);
}

.v-cam-standby-copy {
  font-size: 10.5px;
  letter-spacing: 0.14em;
  line-height: 1.7;
  color: rgba(255, 248, 253, 0.56);
}


/* ---- caption between the camera and the tree ---------------------- */

.v-caption-hint { display: none; }

.v-caption {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  top: calc(var(--v-cam-top) + 3px);
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  pointer-events: none;
  text-align: center;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

body.tree-ready .v-caption-hint { font-size: 17px; }

body.is-focusing .v-caption {
  opacity: 0;
  transform: translateX(-50%) translateY(-6px);
}

.v-caption-hint {
  margin: 0;
  font-family: var(--pixel-font);
  font-size: 15px;
  letter-spacing: 0.14em;
  color: var(--accent-soft);
  text-shadow: 0 0 18px rgba(var(--accent-rgb), 0.55);
  white-space: nowrap;
}

.v-caption-progress {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--pixel-font);
  font-size: 9.5px;
  letter-spacing: 0.22em;
  color: rgba(255, 248, 253, 0.46);
}

.v-caption-meter {
  width: 86px;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.v-caption-meter i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(var(--accent-rgb), 0.55), var(--accent));
  box-shadow: 0 0 10px rgba(var(--accent-rgb), 0.7);
  transition: width 0.3s ease;
}

/* ---- photo chip (top-left) + its album card ----------------------- */

.v-photo-chip {
  position: fixed;
  top: max(12px, env(safe-area-inset-top, 0px));
  left: 12px;
  z-index: 25;
  height: 30px;
  padding: 0 10px 0 8px;
  gap: 6px;
  font-size: 10.5px;
}

.v-photo-chip .photo-label { letter-spacing: 0.08em; }

/* keep the photo tools on one line, clear of the bottom edge */
body.is-recording-vertical .photo-tools {
  white-space: nowrap;
  gap: 8px;
  padding: 6px 8px;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
}

body.is-recording-vertical .photo-tools .tool-close,
body.is-recording-vertical .photo-tools .tool-clear {
  white-space: nowrap;
  padding: 0 8px;
}

/* the album prompt opens over the scene; dismissable from its corner */
body.is-recording-vertical .photo-callout {
  z-index: 26;
}

.callout-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 248, 253, 0.6);
  font-size: 9px;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.callout-close:hover { color: #fff; border-color: rgba(255, 255, 255, 0.34); }

/* ---- recording hint ---------------------------------------------- */

.v-hint {
  position: fixed;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  z-index: 21;
  max-width: 64vw;
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 9.5px;
  line-height: 1.5;
  letter-spacing: 0.05em;
  color: rgba(255, 248, 253, 0.5);
  background: rgba(10, 6, 14, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: opacity 1.2s ease;
}

.v-hint {
  opacity: 0.78;
}

body.is-focusing .v-hint {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

/* ---- enlarged photo browsing ------------------------------------- */

/* The pinch-to-enlarge gesture is the money shot on camera, so the photo
   tools sit above the photo instead of over the tree base. */


body.is-recording-vertical .photo-tools::after {
  display: none;
}

/* ---- portrait fine tuning ---------------------------------------- */

@media (max-width: 760px) {
  .v-caption-hint { font-size: 14px; letter-spacing: 0.1em; }
  .v-hint { max-width: 80vw; }
}

/* Short windows (e.g. a landscape laptop): shrink the camera card first. */
@media (max-height: 700px) {
  :root { --v-cam-w: min(40vw, 30vh, 220px); --v-gap: 8px; }
}

/* boot failure note */
.v-boot-error {
  position: fixed;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 200;
  margin: 0;
  max-width: calc(100vw - 32px);
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 120, 120, 0.45);
  background: rgba(40, 8, 12, 0.92);
  color: #ffd9df;
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}

.v-boot-error[hidden] { display: none; }

/* small "building the tree" note for ?start=tree (no full-screen scrim) */
.v-build-note {
  position: fixed;
  left: 50%;
  top: max(18px, calc(env(safe-area-inset-top, 0px) + 12px));
  transform: translateX(-50%);
  margin: 0;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(10, 6, 14, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 248, 253, 0.7);
  font-family: var(--pixel-font);
  font-size: 11px;
  letter-spacing: 0.16em;
  z-index: 34;
  pointer-events: none;
}

/* ---- booth shortcut (right of the camera card) -------------------- */

.v-booth-slot {
  position: fixed;
  top: var(--v-cam-top);
  right: 12px;
  z-index: 23;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.v-booth-slot.is-shown { opacity: 1; pointer-events: auto; }

.v-booth-btn {
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(var(--accent-rgb), 0.4);
  background: rgba(var(--accent-rgb), 0.1);
  color: var(--accent-soft);
  font-family: var(--pixel-font);
  font-size: 10px;
  letter-spacing: 0.1em;
  cursor: pointer;
}

.v-booth-btn:hover { background: rgba(var(--accent-rgb), 0.2); }

/* ---- photo booth in the portrait page ---------------------------- */
/* The booth brings its own camera preview; the tracking card, its skeleton
   and the stage hint would show through it, so they step aside. */
body.is-booth .camera-panel,
body.is-booth .v-cam-standby,
body.is-booth .v-booth-slot,
body.is-booth .v-caption,
body.is-booth .v-hint {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

body.is-booth .photo-callout,
body.is-booth .v-photo-chip { display: none !important; }

/* the booth sheet is a full-screen layer above the stage */
body.is-booth .booth { z-index: 60; }

/* the default booth grade is 原片 in the recording page */
body.pixel-ui .booth-media[data-filter="none"] #booth-video { filter: none; }

/* ---- progress line beside the album chip --------------------------- */
/* The stage hint is gone; only the growth / lights bar remains, on the same
   line as the album chip: 92px bar + "2 / 3", starting right after the chip.
   It stays under the camera card's layer so it can never paint over the face. */
body.is-recording-vertical .v-caption {
  position: fixed;
  left: calc(12px + 70px);
  right: auto;
  top: max(12px, env(safe-area-inset-top, 0px));
  transform: none;
  display: none;
  z-index: 24;
  height: 30px; /* exactly the album chip's height, so both share one line */
  padding: 0;
  flex-direction: row;
  align-items: center;
  pointer-events: none;
}

body.is-recording-vertical.stage-grow .v-caption,
body.is-recording-vertical.stage-lights .v-caption {
  display: flex;
}

body.is-recording-vertical .v-caption-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 12px;
  border-radius: 999px;
  background: rgba(12, 6, 18, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.09);
}

body.is-recording-vertical .v-caption-meter {
  display: block;
  width: 92px;
  height: 3px;
  flex: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  overflow: hidden;
}

body.is-recording-vertical .v-caption-meter i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(var(--accent-rgb), 0.6), var(--accent));
  box-shadow: 0 0 8px rgba(var(--accent-rgb), 0.8);
}

body.is-recording-vertical .v-caption-count {
  font-size: 8.5px;
  letter-spacing: 0.12em;
  white-space: nowrap;
}

/* ---- photo tools line (with a photo open) ------------------------- */
body.is-recording-vertical .photo-tools {
  white-space: nowrap;
  gap: 8px;
  padding: 6px 8px;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
}

body.is-recording-vertical .photo-tools .tool-close,
body.is-recording-vertical .photo-tools .tool-clear {
  white-space: nowrap;
  padding: 0 8px;
}

/* ---- boot failure / build notes ----------------------------------- */
.v-boot-error {
  position: fixed;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 200;
  margin: 0;
  max-width: calc(100vw - 32px);
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 120, 120, 0.45);
  background: rgba(40, 8, 12, 0.92);
  color: #ffd9df;
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}

.v-boot-error[hidden] { display: none; }

.v-build-note {
  position: fixed;
  left: 50%;
  top: max(18px, calc(env(safe-area-inset-top, 0px) + 12px));
  transform: translateX(-50%);
  margin: 0;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(10, 6, 14, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 248, 253, 0.7);
  font-family: var(--pixel-font);
  font-size: 11px;
  letter-spacing: 0.16em;
  z-index: 34;
  pointer-events: none;
}
