/* ==========================================================================
   Sooner Or Later · Dailies Monitor — 启智科技 Qizhi DS (qizhi-ds)
   Dark, square (0px), near-black ground (#08090a), green-tinted surface
   (#101311), single Openmind Green accent (#a3ff12), sage-grey text scale.
   ========================================================================== */

/* Optical baseline normalization for macOS/iOS DIN Condensed (capHeight 712, descender -288)
   so uppercase display text centers cleanly against icons, dividers, and CJK nav labels. */
@font-face {
  font-family: 'DIN Condensed Optical';
  src: local('DIN Condensed Bold'), local('DIN Condensed');
  font-weight: 100 900;
  font-style: normal;
  ascent-override: 85.6%;
  descent-override: 14.4%;
  line-gap-override: 0%;
}

:root,
[data-theme="dark"] {
  color-scheme: dark;

  /* Exact qizhi-ds color tokens (tokens.css / tokens.json) */
  --qz-color-bg: #08090a;
  --qz-color-bg-deep: #000000;
  --qz-color-surface: #101311;
  --qz-color-surface-raise: #161b17;
  --qz-color-surface-hover: #1c221d;

  --qz-color-fg: #f2f5f0;
  --qz-color-fg-2: #c3cabe;
  --qz-color-fg-3: #9aa398;
  --qz-color-fg-4: #8c948b;
  --qz-color-fg-5: #6d756b;
  --qz-color-fg-6: #4e554d;
  --qz-color-numeral-dim: #333b2e;

  --qz-color-accent: #a3ff12;
  --qz-color-accent-hover: #c8ff6e;
  --qz-color-on-accent: #08090a;

  --qz-accent-06: rgba(163, 255, 18, 0.06);
  --qz-accent-07: rgba(163, 255, 18, 0.07);
  --qz-accent-09: rgba(163, 255, 18, 0.09);
  --qz-accent-10: rgba(163, 255, 18, 0.10);
  --qz-accent-16: rgba(163, 255, 18, 0.16);
  --qz-accent-20: rgba(163, 255, 18, 0.20);
  --qz-accent-30: rgba(163, 255, 18, 0.30);
  --qz-accent-35: rgba(163, 255, 18, 0.35);
  --qz-accent-45: rgba(163, 255, 18, 0.45);
  --qz-accent-60: rgba(163, 255, 18, 0.60);

  --qz-line-subtle: rgba(255, 255, 255, 0.08);
  --qz-line: rgba(255, 255, 255, 0.10);
  --qz-line-strong: rgba(255, 255, 255, 0.12);

  /* Minimal semantic complements for status/warnings */
  --qz-mint: #6ef0c8;
  --qz-warn: #e6b94c;
  --qz-warn-bg: rgba(230, 185, 76, 0.12);
  --qz-warn-line: rgba(230, 185, 76, 0.42);
  --qz-err: #ff5c5c;
  --qz-err-bg: rgba(255, 92, 92, 0.10);
  --qz-err-line: rgba(255, 92, 92, 0.45);

  /* Exact qizhi-ds radii, weights & typography */
  --qz-radius-none: 0px;
  --qz-radius-xs: 5px;
  --qz-radius-pill: 999px;

  --qz-weight-light: 300;
  --qz-weight-regular: 400;
  --qz-weight-bold: 700;

  --qz-font-sans: 'Noto Sans SC', 'PingFang SC', 'Hiragino Sans GB', system-ui, -apple-system, sans-serif;
  --qz-font-display: 'Anton', 'Oswald', 'DIN Condensed Optical', 'DIN Condensed', 'Arial Narrow', 'Noto Sans SC', sans-serif;
  --qz-font-latin: 'Oswald', 'DIN Condensed Optical', 'DIN Condensed', 'Arial Narrow', 'Noto Sans SC', sans-serif;
  --qz-font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Monaco, Consolas, monospace;

  --ease: cubic-bezier(.16, 1, .3, 1);
  --rail: 368px;
  --bar: 52px;
  --strip: 92px;
  --tools: 42px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
  height: 100dvh;
  overscroll-behavior: none;
}

body {
  margin: 0;
  background: var(--qz-color-bg);
  color: var(--qz-color-fg);
  font: var(--qz-weight-light) 14px/1.55 var(--qz-font-sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
  display: grid;
  grid-template-rows: var(--bar) minmax(0, 1fr) var(--strip);
  caret-color: var(--qz-color-accent);
}

::selection {
  background: var(--qz-color-accent);
  color: var(--qz-color-on-accent);
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

a {
  color: var(--qz-color-fg);
  text-decoration: none;
}

:focus-visible {
  outline: 2px solid var(--qz-color-accent);
  outline-offset: 2px;
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--qz-color-fg-6) transparent;
}

::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

::-webkit-scrollbar-thumb {
  background: var(--qz-color-numeral-dim);
  border-radius: var(--qz-radius-none);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--qz-accent-45);
}

::-webkit-scrollbar-track {
  background: transparent;
}

kbd {
  font: 400 11px/1 var(--qz-font-mono);
  letter-spacing: .04em;
  color: var(--qz-color-fg-3);
  border: 1px solid var(--qz-line-strong);
  border-radius: var(--qz-radius-none);
  padding: 3px 5px 2px;
  min-width: 18px;
  display: inline-block;
  text-align: center;
}

.num {
  font-family: var(--qz-font-display);
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
}

.mono {
  font-family: var(--qz-font-mono);
  font-variant-numeric: tabular-nums;
}

/* ── Shared Square Primitives (qizhi-ds: 0px radius) ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 30px;
  padding: 0 11px;
  border: 1px solid var(--qz-line-strong);
  border-radius: var(--qz-radius-none);
  font-size: 12.5px;
  font-weight: var(--qz-weight-regular);
  color: var(--qz-color-fg-2);
  background: transparent;
  white-space: nowrap;
  transition: background .14s, border-color .14s, color .14s;
}

.btn:hover:not(:disabled) {
  background: var(--qz-color-surface-hover);
  border-color: var(--qz-accent-45);
  color: var(--qz-color-fg);
}

.btn:disabled {
  opacity: .38;
  cursor: default;
}

.btn-xs {
  height: 26px;
  padding: 0 9px;
  font-size: 12px;
}

.btn-accent {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 30px;
  padding: 0 13px;
  border: 1px solid var(--qz-color-accent);
  border-radius: var(--qz-radius-none);
  background: var(--qz-color-accent);
  color: var(--qz-color-on-accent);
  font-size: 12.5px;
  font-weight: var(--qz-weight-bold);
  letter-spacing: .03em;
  white-space: nowrap;
  transition: background .14s, border-color .14s, opacity .14s;
}

.btn-accent:hover:not(:disabled) {
  background: var(--qz-color-accent-hover);
  border-color: var(--qz-color-accent-hover);
}

.btn-accent:disabled {
  opacity: .35;
  cursor: default;
}

.btn-accent.btn-xs {
  height: 26px;
  padding: 0 10px;
  font-size: 12px;
}

.btn-danger {
  border-color: var(--qz-err-line);
  color: var(--qz-err);
  background: var(--qz-err-bg);
}

.btn-danger:hover:not(:disabled) {
  background: rgba(255, 92, 92, 0.20);
  border-color: var(--qz-err);
  color: var(--qz-color-fg);
}

.dsel {
  height: 30px;
  padding: 0 24px 0 9px;
  background: var(--qz-color-bg);
  border: 1px solid var(--qz-line-strong);
  border-radius: var(--qz-radius-none);
  color: var(--qz-color-fg);
  font-size: 12.5px;
  font-weight: var(--qz-weight-regular);
  outline: none;
  cursor: pointer;
  min-width: 0;
  max-width: 100%;
}

.dsel:hover {
  border-color: var(--qz-accent-35);
}

.dsel:focus {
  border-color: var(--qz-color-accent);
}

.dsel-xs {
  height: 26px;
  padding: 0 20px 0 8px;
  font-size: 12px;
}

.ib {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 1px solid var(--qz-line-strong);
  border-radius: var(--qz-radius-none);
  color: var(--qz-color-fg-2);
  font-size: 12px;
}

.ib:hover {
  color: var(--qz-color-accent);
  border-color: var(--qz-accent-45);
  background: var(--qz-accent-07);
}

.tiny-chk {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--qz-color-fg-2);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.tiny-chk input {
  accent-color: var(--qz-color-accent);
  margin: 0;
  cursor: pointer;
}

.seg {
  display: flex;
  gap: 2px;
  background: var(--qz-color-bg);
  border: 1px solid var(--qz-line);
  border-radius: var(--qz-radius-none);
  padding: 2px;
}

.seg button {
  font-size: 12px;
  font-weight: var(--qz-weight-regular);
  padding: 5px 9px;
  border-radius: var(--qz-radius-none);
  color: var(--qz-color-fg-3);
  white-space: nowrap;
  transition: background .14s, color .14s;
}

.seg button:hover {
  color: var(--qz-color-fg);
}

.seg button[aria-pressed="true"] {
  background: var(--qz-accent-16);
  color: var(--qz-color-accent);
  box-shadow: inset 0 -1px 0 var(--qz-accent-45);
}

/* ==========================================================================
   Top Bar (52px · Minimal Studio Header)
   ========================================================================== */
.bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 18px 0 20px;
  border-bottom: 1px solid var(--qz-line-subtle);
  background: var(--qz-color-surface);
  min-width: 0;
  z-index: 10;
}

.mark {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  text-decoration: none;
  flex: none;
}

.qz-reel-mark {
  width: 9px;
  height: 9px;
  background: var(--qz-color-accent);
  flex: none;
  display: inline-block;
}

.mark-en {
  font: 700 22px/1 var(--qz-font-display);
  letter-spacing: .03em;
  text-transform: uppercase;
  transform: skewX(-10deg);
  display: inline-block;
  text-box-trim: trim-both;
  text-box-edge: cap alphabetic;
  color: var(--qz-color-fg);
}

.mark-en b {
  color: var(--qz-color-accent);
  font-weight: 700;
}

.bar nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  min-width: 0;
}

.modes {
  display: flex;
  align-items: stretch;
  height: 100%;
  gap: 2px;
  flex: none;
}

.mode {
  display: inline-flex;
  align-items: center;
  padding: 0 13px;
  height: 100%;
  border-radius: var(--qz-radius-none);
  font: 500 13.5px/1 var(--qz-font-sans);
  letter-spacing: .04em;
  color: var(--qz-color-fg-4);
  transition: background .14s, color .14s;
}

.mode em {
  font-style: normal;
  font: 400 15px/1 var(--qz-font-latin);
  letter-spacing: .08em;
  text-transform: uppercase;
  text-box-trim: trim-both;
  text-box-edge: cap alphabetic;
}

.mode span {
  font: 500 13.5px/1 var(--qz-font-sans);
  letter-spacing: .04em;
}

/* Single-language clean nav tabs (ZH shows 片库/拼图/看图, EN shows LIBRARY/SHEET/VIEWER) */
html[data-lang="zh"] .mode em {
  display: none;
}

html[data-lang="en"] .mode span {
  display: none;
}

.lang-seg {
  flex: none;
  margin-right: 0;
  height: 28px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: stretch;
}

.lang-seg button {
  padding: 0 9px;
  height: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: 400 11.5px/1 var(--qz-font-mono);
  letter-spacing: .04em;
  min-width: 30px;
  text-align: center;
}

.auth-lang-seg {
  margin-left: auto;
  margin-right: 0;
  height: 28px;
}

.mode:hover {
  color: var(--qz-color-fg);
  background: rgba(255, 255, 255, 0.03);
}

.mode[aria-pressed="true"] {
  color: var(--qz-color-accent);
  background: rgba(163, 255, 18, 0.06);
  box-shadow: inset 0 -2px 0 var(--qz-color-accent);
  font-weight: var(--qz-weight-bold);
}

.mode[aria-pressed="true"] em,
.mode[aria-pressed="true"] span {
  color: var(--qz-color-accent);
}

.nav-sep {
  width: 1px;
  height: 18px;
  background: var(--qz-line-strong);
  margin: 0 2px;
  flex: none;
}

.navbtn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  justify-content: center;
  color: var(--qz-color-fg-3);
}

.navbtn-icon:hover:not(:disabled) {
  color: var(--qz-color-accent);
}

.navbtn-lbl-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.navbtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px;
  box-sizing: border-box;
  border-radius: var(--qz-radius-none);
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: var(--qz-weight-regular);
  color: var(--qz-color-fg-2);
  white-space: nowrap;
  transition: background .14s, color .14s, border-color .14s;
}

.navbtn:hover:not(:disabled) {
  color: var(--qz-color-fg);
  background: var(--qz-color-surface-hover);
  border-color: var(--qz-line);
}

.navbtn:disabled {
  opacity: .5;
  cursor: default;
}

.navbtn.is-loading .sync-svg {
  animation: spin .85s linear infinite;
  color: var(--qz-color-accent);
}

.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--qz-radius-none);
  background: var(--qz-color-accent);
  color: var(--qz-color-on-accent);
  font: 700 11px/1 var(--qz-font-mono);
}

/* Compact Qizhi DS Avatar-Only Account & Settings Menu (#userMenuWrap) */
.user-menu-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-left: 0;
  flex: none;
}

.user-menu-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  box-sizing: border-box;
  background: transparent;
  border: 0;
  border-radius: var(--qz-radius-none);
  color: var(--qz-color-fg-2);
  transition: opacity .14s;
}

.user-menu-btn .um-avatar {
  width: 30px;
  height: 30px;
}

.user-menu-btn:hover .um-avatar,
.user-menu-btn[aria-expanded="true"] .um-avatar {
  border-color: var(--qz-color-accent);
  color: var(--qz-color-accent);
}

.um-avatar {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: none;
  overflow: hidden;
  box-sizing: border-box;
  background: var(--qz-color-surface-raise);
  border: 1px solid var(--qz-line-strong);
  border-radius: var(--qz-radius-none);
  color: var(--qz-color-fg-2);
  transition: border-color .14s, color .14s;
}

.um-avatar.is-admin {
  border-color: var(--qz-accent-45);
  color: var(--qz-color-accent);
}

.user-menu-btn:hover .um-avatar,
.user-menu-btn[aria-expanded="true"] .um-avatar {
  border-color: var(--qz-color-accent);
}

.um-avatar-img {
  display: none;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  user-select: none;
  pointer-events: none;
}

.um-avatar-icon {
  display: block;
  flex: none;
}

.um-avatar.has-photo .um-avatar-img {
  display: block;
}

.um-avatar.has-photo .um-avatar-icon {
  display: none;
}

.um-avatar-lg {
  width: 28px;
  height: 28px;
}

.um-avatar-sm {
  width: 20px;
  height: 20px;
}

.nav-user-txt {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-menu-pop {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 272px;
  max-width: min(340px, 92vw);
  z-index: 900;
  background: #0c0f0d;
  border: 1px solid #262e29;
  border-radius: var(--qz-radius-none);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.78);
  padding: 4px 0;
}

.um-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
}

.um-email {
  min-width: 0;
  flex: 1 1 auto;
  font: 500 13.5px/1.25 var(--qz-font-sans);
  letter-spacing: .02em;
  color: var(--qz-color-fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.um-role {
  flex: none;
  padding: 2px 6px;
  border-radius: var(--qz-radius-none);
  border: 1px solid var(--qz-line-strong);
  background: var(--qz-color-surface);
  color: var(--qz-color-fg-3);
  font: 600 10px/1.2 var(--qz-font-mono);
  letter-spacing: .06em;
}

.um-role.is-admin {
  border-color: var(--qz-accent-45);
  background: rgba(163, 255, 18, 0.12);
  color: var(--qz-color-accent);
}

.um-div {
  height: 1px;
  background: var(--qz-line-subtle);
  margin: 2px 0;
}

.um-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 12px;
}

.um-row-lbl {
  font: 400 12.5px/1.2 var(--qz-font-sans);
  color: var(--qz-color-fg-2);
}

.um-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 34px;
  padding: 7px 12px;
  box-sizing: border-box;
  border-radius: var(--qz-radius-none);
  color: var(--qz-color-fg-2);
  font: 400 12.5px/1.2 var(--qz-font-sans);
  text-align: left;
  transition: background .12s, color .12s;
}

.um-item:hover:not(:disabled) {
  background: #161b18;
  color: var(--qz-color-fg);
}

.um-item:disabled {
  opacity: .5;
  cursor: default;
}

.um-item.is-loading .sync-svg {
  animation: spin .85s linear infinite;
  color: var(--qz-color-accent);
}

.um-item-sync:hover:not(:disabled) .sync-svg {
  color: var(--qz-color-accent);
}

.um-item-meta {
  margin-left: auto;
  font: 400 11px/1 var(--qz-font-mono);
  color: var(--qz-color-fg-5);
  flex: none;
}

.um-item-admin:hover {
  background: rgba(163, 255, 18, 0.10);
  color: var(--qz-color-accent);
}

.um-item-admin svg {
  color: var(--qz-color-accent);
}

.um-item-logout:hover {
  color: var(--qz-err);
}

/* Global Search + Jump Popover */
.gsearch {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 228px;
  height: 30px;
  box-sizing: border-box;
  padding: 0 8px 0 10px;
  margin: 0;
  background: var(--qz-color-bg);
  border: 1px solid var(--qz-line-subtle);
  border-radius: var(--qz-radius-none);
  color: var(--qz-color-fg-4);
  transition: border-color .14s;
}

.gsearch:hover {
  border-color: var(--qz-line-strong);
}

.gsearch:focus-within {
  border-color: var(--qz-color-accent);
  color: var(--qz-color-fg-2);
}

.gsearch input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--qz-color-fg);
  font: var(--qz-weight-light) 12.5px var(--qz-font-sans);
}

.gsearch input::placeholder {
  color: var(--qz-color-fg-5);
}

.gsearch input::-webkit-search-cancel-button {
  filter: invert(.65);
}

.gsearch:focus-within kbd {
  visibility: hidden;
}

.gs-pop {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: max(100%, 460px);
  max-height: min(68vh, 520px);
  overflow: auto;
  z-index: 40;
  background: var(--qz-color-surface);
  border: 1px solid var(--qz-accent-35);
  border-radius: var(--qz-radius-none);
  box-shadow: 0 18px 48px rgba(0, 0, 0, .72);
  padding: 6px;
}

.gs-h {
  font: 400 11px/1.2 var(--qz-font-mono);
  letter-spacing: .08em;
  color: var(--qz-color-accent);
  padding: 8px 10px 6px;
}

.gs-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 6px 10px;
  border-radius: var(--qz-radius-none);
  color: var(--qz-color-fg-2);
}

.gs-item:hover,
.gs-item.on {
  background: var(--qz-accent-10);
  color: var(--qz-color-fg);
  box-shadow: inset 2px 0 0 var(--qz-color-accent);
}

.gs-pic {
  position: relative;
  flex: none;
  width: 72px;
  height: 41px;
  border-radius: var(--qz-radius-none);
  overflow: hidden;
  background: var(--qz-color-bg-deep);
  border: 1px solid var(--qz-line);
}

.gs-pic img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gs-txt {
  min-width: 0;
  flex: 1;
}

.gs-txt b {
  display: block;
  font: 400 13.5px/1.25 var(--qz-font-mono);
  letter-spacing: .03em;
  color: var(--qz-color-fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gs-sub {
  display: block;
  font-size: 12px;
  color: var(--qz-color-fg-4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gs-empty {
  padding: 14px 10px;
  color: var(--qz-color-fg-4);
  font-size: 13px;
}

/* ==========================================================================
   Mode Switching (Library | Sheet | Viewer)
   ========================================================================== */
.lib,
.csheet {
  display: none;
}

body.mode-lib .app,
body.mode-lib .strip,
body.mode-sheet .app,
body.mode-sheet .strip {
  display: none !important;
}

body.mode-lib .lib {
  display: grid;
  grid-row: 2 / 4;
  grid-template-columns: 292px minmax(0, 1fr);
  min-height: 0;
}

body.mode-sheet .csheet {
  display: flex;
  flex-direction: column;
  grid-row: 2 / 4;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  background: var(--qz-color-bg-deep);
}

/* ==========================================================================
   Custom Qizhi DS Dropdown (QSelect — Replaces Native OS <select> Popups)
   ========================================================================== */
.qsel {
  position: relative;
  display: inline-flex;
  align-items: center;
  box-sizing: border-box;
  height: 32px;
  min-width: 0;
  vertical-align: middle;
}

.qsel-full {
  width: 100%;
}

.qsel-sm {
  height: 32px;
  max-width: 170px;
}

.qsel-xs {
  height: 26px;
  width: 148px;
}

.qsel-jump {
  display: none;
  height: 32px;
  max-width: 168px;
}

.qsel-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.qsel-btn {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
  height: 100%;
  padding: 0 9px;
  box-sizing: border-box;
  background: var(--qz-color-surface);
  border: 1px solid var(--qz-line-strong);
  border-radius: var(--qz-radius-none);
  color: var(--qz-color-fg);
  font: 400 12px/1 var(--qz-font-sans);
  cursor: pointer;
  min-width: 0;
  transition: border-color .14s, background .14s, color .14s;
}

.qsel-xs .qsel-btn {
  padding: 0 6px;
  font-size: 11px;
  background: var(--qz-color-bg);
}

.qsel-btn:hover,
.qsel-btn:focus-visible,
.qsel-btn[aria-expanded="true"] {
  border-color: var(--qz-color-accent);
  background: var(--qz-color-surface-hover);
  outline: none;
}

.qsel-btn:disabled {
  opacity: .38;
  cursor: default;
}

.qsel-txt {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

.qsel-chev {
  flex: none;
  color: var(--qz-color-fg-4);
  transition: transform .15s ease, color .15s ease;
}

.qsel-btn[aria-expanded="true"] .qsel-chev {
  transform: rotate(180deg);
  color: var(--qz-color-accent);
}

.qsel-menu {
  position: fixed;
  z-index: 900;
  box-sizing: border-box;
  background: #0c0f0d;
  border: 1px solid #262e29;
  border-radius: var(--qz-radius-none);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.78);
  max-height: 300px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 3px 0;
  scrollbar-width: thin;
  scrollbar-color: #262e29 #0c0f0d;
}

.qsel-menu::-webkit-scrollbar {
  width: 6px;
}

.qsel-menu::-webkit-scrollbar-track {
  background: #0c0f0d;
}

.qsel-menu::-webkit-scrollbar-thumb {
  background: #262e29;
}

.qsel-opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 32px;
  padding: 6px 12px;
  box-sizing: border-box;
  border: 0;
  border-radius: var(--qz-radius-none);
  background: transparent;
  color: var(--qz-color-fg-2);
  font: 400 12.5px/1.25 var(--qz-font-sans);
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
}

.qsel-opt-lbl {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
}

.qsel-opt:hover,
.qsel-opt.is-focus {
  background: #161b18;
  color: var(--qz-color-fg);
}

.qsel-opt[aria-selected="true"] {
  background: rgba(163, 255, 18, 0.10);
  color: var(--qz-color-accent);
  font-weight: 500;
}

.qsel-opt[aria-selected="true"]:hover,
.qsel-opt[aria-selected="true"].is-focus {
  background: rgba(163, 255, 18, 0.16);
  color: var(--qz-color-accent);
}

.qsel-check {
  flex: none;
  color: var(--qz-color-accent);
  opacity: 0;
}

.qsel-opt[aria-selected="true"] .qsel-check {
  opacity: 1;
}

/* ==========================================================================
   Apple-Style Draggable 3–12 Columns Slider (.cols-ctrl · Qizhi DS)
   ========================================================================== */
.cols-ctrl {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 7px;
  box-sizing: border-box;
  background: transparent;
  border: 1px solid var(--qz-line-subtle);
  border-radius: var(--qz-radius-none);
  flex: none;
  transition: border-color .14s;
}

.cols-ctrl:hover {
  border-color: var(--qz-line-strong);
}

.cols-step-btn {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: var(--qz-radius-none);
  color: var(--qz-color-fg-3);
  background: transparent;
  flex: none;
  transition: color .14s, background .14s;
}

.cols-step-btn:hover:not(:disabled) {
  color: var(--qz-color-accent);
  background: var(--qz-accent-10);
}

.cols-step-btn:disabled {
  opacity: .28;
  cursor: default;
}

.cols-range {
  -webkit-appearance: none;
  appearance: none;
  width: 120px;
  height: 3px;
  margin: 0 2px;
  border-radius: var(--qz-radius-none);
  background: linear-gradient(
    to right,
    var(--qz-color-accent) 0%,
    var(--qz-color-accent) var(--pct, 0%),
    var(--qz-line-strong) var(--pct, 0%),
    var(--qz-line-strong) 100%
  );
  outline: none;
  cursor: grab;
}

.cols-range:active {
  cursor: grabbing;
}

.cols-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 14px;
  border-radius: var(--qz-radius-none);
  background: #e8ede9;
  border: 1px solid #08090a;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14);
  cursor: grab;
  transition: background .12s, box-shadow .12s, transform .12s;
}

.cols-range:hover::-webkit-slider-thumb,
.cols-range:focus-visible::-webkit-slider-thumb {
  background: var(--qz-color-accent);
  box-shadow: 0 0 0 2px var(--qz-accent-20);
}

.cols-range:active::-webkit-slider-thumb {
  background: var(--qz-color-accent);
  cursor: grabbing;
  transform: scale(1.06);
}

.cols-range::-moz-range-thumb {
  width: 12px;
  height: 14px;
  border-radius: var(--qz-radius-none);
  background: #e8ede9;
  border: 1px solid #08090a;
  cursor: grab;
  transition: background .12s, box-shadow .12s;
}

.cols-range:hover::-moz-range-thumb,
.cols-range:focus-visible::-moz-range-thumb,
.cols-range:active::-moz-range-thumb {
  background: var(--qz-color-accent);
}

.cols-range::-moz-range-track {
  height: 3px;
  border-radius: var(--qz-radius-none);
  background: transparent;
}

.cols-readout {
  min-width: 46px;
  text-align: right;
  font: 400 11.5px/1 var(--qz-font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
  color: var(--qz-color-accent);
  white-space: nowrap;
  user-select: none;
}

/* ==========================================================================
   Mode 2: Sheet 拼图 (Zero-Gap Edge-to-Edge Color Contact Sheet)
   ========================================================================== */
.csheet-top {
  position: sticky;
  top: 0;
  z-index: 8;
  display: flex;
  flex-direction: column;
  background: var(--qz-color-bg);
  border-bottom: 1px solid var(--qz-line);
}

.csheet-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px 20px;
  min-height: 44px;
  box-sizing: border-box;
}

.csheet-vsep {
  width: 1px;
  height: 16px;
  background: var(--qz-line-strong);
  flex: none;
}

/* Unified Slot Picker Trigger (Desktop Sheet & Compact Library) */
.slot-pick-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 9px;
  background: var(--qz-color-surface);
  border: 1px solid var(--qz-line-strong);
  border-radius: var(--qz-radius-none);
  color: var(--qz-color-fg);
  font-size: 12.5px;
  font-weight: var(--qz-weight-regular);
  line-height: 1;
  white-space: nowrap;
  max-width: 240px;
  min-width: 0;
  transition: border-color .14s, background .14s, color .14s;
}

.slot-pick-trigger:hover {
  border-color: var(--qz-accent-45);
  background: var(--qz-color-surface-hover);
}

.slot-pick-trigger.is-custom,
.slot-pick-trigger[aria-expanded="true"] {
  border-color: var(--qz-color-accent);
  background: var(--qz-accent-09);
  color: var(--qz-color-accent);
}

.slot-pick-tag {
  font: 400 10.5px/1 var(--qz-font-mono);
  color: var(--qz-color-fg-5);
  letter-spacing: .04em;
  flex: none;
}

.slot-pick-trigger.is-custom .slot-pick-tag,
.slot-pick-trigger[aria-expanded="true"] .slot-pick-tag {
  color: var(--qz-color-accent);
  opacity: .75;
}

.slot-pick-lbl {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  font-weight: 500;
}

.slot-pick-cnt {
  font-style: normal;
  font: 400 11px/1 var(--qz-font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--qz-color-fg-4);
  flex: none;
}

.slot-pick-trigger.is-custom .slot-pick-cnt,
.slot-pick-trigger[aria-expanded="true"] .slot-pick-cnt {
  color: var(--qz-color-accent);
}

.slot-pick-trigger .qsel-chev {
  flex: none;
  opacity: .75;
  transition: transform .14s;
}

.slot-pick-trigger[aria-expanded="true"] .qsel-chev {
  transform: rotate(180deg);
  opacity: 1;
}

.csheet-count {
  display: inline-flex;
  align-items: center;
  height: 28px;
  margin-right: 4px;
  line-height: 1;
}

.csheet-filters {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.csheet-reset {
  height: 30px;
  padding: 0 10px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-color: var(--qz-line-strong);
}

.csheet-reset:disabled {
  display: none;
}

.csheet-acts {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.csheet-tog {
  height: 28px;
  padding: 0 10px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-color: var(--qz-line-strong);
  font: 400 11.5px/1 var(--qz-font-mono);
  letter-spacing: .04em;
}

.csheet-tog[aria-pressed="true"] {
  border-color: var(--qz-color-accent);
  background: rgba(163, 255, 18, 0.14);
  color: var(--qz-color-accent);
  font-weight: var(--qz-weight-bold);
}

.csheet-grid {
  display: grid;
  grid-template-columns: repeat(var(--sheet-cols, 3), minmax(0, 1fr));
  gap: 0;
  padding: 0;
  margin: 0;
  width: 100%;
  background: #000000;
}

.csheet-tile {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  overflow: hidden;
  background: #000000;
  cursor: pointer;
  text-align: left;
}

.csheet-tile img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity .16s ease;
}

.csheet-tile.is-loading img {
  opacity: 0;
}

.csheet-tile.is-loading::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(163, 255, 18, 0.03) 62%,
    rgba(163, 255, 18, 0.14) 97%,
    rgba(163, 255, 18, 0.72) 99%,
    transparent 100%
  );
  transform: translateY(-100%);
  will-change: transform;
  animation: qscan-v 1.35s linear infinite;
}

.csheet-tile:hover::after,
.csheet-tile:focus-visible::after {
  content: "";
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 0 2px var(--qz-color-accent);
  pointer-events: none;
  z-index: 3;
}

.csheet-lbl {
  position: absolute;
  top: 0;
  left: 0;
  max-width: 100%;
  padding: 3px 7px;
  background: rgba(0, 0, 0, 0.72);
  color: rgba(242, 245, 240, 0.92);
  font: 400 11px/1.25 var(--qz-font-mono);
  letter-spacing: .02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  z-index: 2;
}

.csheet-grid[data-cols-tier="compact"] .csheet-lbl {
  font-size: 10px;
  padding: 2px 5px;
}

.csheet-grid[data-cols-tier="micro"] .csheet-lbl {
  font-size: 9px;
  padding: 1px 4px;
  max-width: calc(100% - 4px);
  letter-spacing: 0;
}

.csheet-grid[data-cols-tier="ultra"] .csheet-lbl {
  font-size: 8.5px;
  line-height: 1.2;
  padding: 1px 3px;
  max-width: calc(100% - 2px);
  letter-spacing: 0;
}

.csheet-grid.hide-labels .csheet-lbl {
  display: none;
}

.csheet-lbl-short {
  display: none;
}

.csheet-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 360px;
  padding: 48px 24px;
  text-align: center;
  color: var(--qz-color-fg-3);
  background: var(--qz-color-bg-deep);
}

.csheet-empty b {
  font: 600 16px/1.4 var(--qz-font-sans);
  color: var(--qz-color-fg);
}

/* ==========================================================================
   Mode 1: Library 片库
   ========================================================================== */
.lib-nav {
  border-right: 1px solid var(--qz-line-subtle);
  background: var(--qz-color-surface);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.lib-filter {
  flex: none;
  max-height: 58%;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 16px 18px;
  border-bottom: 1px solid var(--qz-line-subtle);
  display: grid;
  gap: 14px;
}

.filter-heading,
.tree-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: var(--qz-weight-bold);
  letter-spacing: .06em;
  color: var(--qz-color-fg-3);
}

.filter-heading button {
  font-size: 11.5px;
  font-weight: var(--qz-weight-regular);
  color: var(--qz-color-accent);
  padding: 2px 7px;
  border: 1px solid transparent;
  border-radius: var(--qz-radius-none);
}

.filter-heading button:hover:not(:disabled) {
  background: var(--qz-accent-10);
  border-color: var(--qz-accent-35);
}

.filter-heading button:disabled {
  color: var(--qz-color-fg-5);
  opacity: .5;
  cursor: default;
}

.flab {
  font-size: 11.5px;
  color: var(--qz-color-fg-4);
  margin: 0;
}

.fstate .fhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 8px;
}

.sync-stamp {
  font: 400 11px/1 var(--qz-font-mono);
  color: var(--qz-color-fg-5);
}

/* 2x3 Dark Square Status Tiles (qizhi-ds StatGrid hairline idiom) */
.ftiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--qz-line);
  border: 1px solid var(--qz-line);
  border-radius: var(--qz-radius-none);
  overflow: hidden;
}

.ftile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 7px 9px 7px;
  background: var(--qz-color-bg);
  color: var(--qz-color-fg-3);
  font-size: 11px;
  text-align: left;
  min-width: 0;
  transition: background .14s, color .14s;
}

.ftile:hover {
  background: var(--qz-color-surface-hover);
  color: var(--qz-color-fg-2);
}

.ftile[aria-pressed="true"] {
  background: var(--qz-accent-07);
  color: var(--qz-color-fg);
  box-shadow: inset 0 -2px 0 var(--qz-color-accent);
}

.ftile .ft-l {
  display: flex;
  align-items: center;
  gap: 5px;
  width: 100%;
  min-width: 0;
  line-height: 1.2;
  white-space: nowrap;
}

.ftile .ft-l span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ftile .ft-l i {
  width: 6px;
  height: 6px;
  border-radius: var(--qz-radius-none);
  flex: none;
}

.ftile .fc {
  font: 400 17px/1 var(--qz-font-display);
  color: var(--qz-color-fg);
  letter-spacing: .02em;
}

.ftile[aria-pressed="true"] .fc {
  color: var(--qz-color-accent);
}

.d-accent { background: var(--qz-color-accent); }
.d-mint { background: var(--qz-mint); }
.d-sage { background: var(--qz-color-fg-3); }
.d-bright { background: var(--qz-color-fg); }
.d-amber { background: var(--qz-warn); }

/* EP -> SC Tree */
.tree-heading {
  flex: none;
  padding: 14px 18px 6px;
  color: var(--qz-color-fg-4);
}

.tree {
  flex: 1;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 0 10px 28px;
}

.ep-g {
  margin-top: 12px;
}

.ep-g:first-child {
  margin-top: 2px;
}

.ep-h {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 5px 10px 6px;
  border-radius: var(--qz-radius-none);
  text-align: left;
}

.ep-h:hover {
  background: var(--qz-color-surface-hover);
}

.ep-h b {
  font: 400 20px/1 var(--qz-font-display);
  transform: skewX(-8deg);
  display: inline-block;
  letter-spacing: .02em;
  text-box-trim: trim-both;
  text-box-edge: cap alphabetic;
  color: var(--qz-color-fg);
}

.ep-h span {
  margin-left: auto;
  font: 400 11.5px/1 var(--qz-font-mono);
  color: var(--qz-color-fg-5);
  font-variant-numeric: tabular-nums;
}

.ep-h .chev {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid var(--qz-color-fg-4);
  border-bottom: 1.5px solid var(--qz-color-fg-4);
  transform: rotate(45deg);
  margin-top: -3px;
  transition: transform .15s;
  flex: none;
}

.ep-g.folded .ep-h .chev {
  transform: rotate(-45deg);
  margin-top: 0;
}

.ep-g.folded .ep-list {
  display: none;
}

.ep-g.folded .ep-h.has-on b {
  color: var(--qz-color-accent);
}

.sc-b {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 6px 18px;
  border-radius: var(--qz-radius-none);
  color: var(--qz-color-fg-3);
  font: 400 13.5px/1.15 var(--qz-font-latin);
  letter-spacing: .05em;
  text-align: left;
}

.sc-b:hover {
  background: var(--qz-color-surface-hover);
  color: var(--qz-color-fg);
}

.sc-b.on {
  background: var(--qz-accent-09);
  color: var(--qz-color-fg);
  box-shadow: inset 2px 0 0 var(--qz-color-accent);
}

.sc-b.on::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: var(--qz-radius-none);
  background: var(--qz-color-accent);
  margin-left: -10px;
  flex: none;
}

.sc-b .n {
  margin-left: auto;
  font: 400 11.5px/1 var(--qz-font-mono);
  color: var(--qz-color-fg-5);
  font-variant-numeric: tabular-nums;
}

.sc-b.on .n {
  color: var(--qz-color-accent);
}

/* Right Library Canvas (with subtle Qizhi corner glow) */
.lib-main {
  overflow: auto;
  min-height: 0;
  min-width: 0;
  position: relative;
  overscroll-behavior: contain;
  background-color: var(--qz-color-bg);
  background-image: radial-gradient(60% 45% at 94% 2%, var(--qz-accent-06) 0%, transparent 65%);
  background-attachment: local;
  --lib-cols: 3;
}

.lib-top {
  position: sticky;
  top: 0;
  z-index: 6;
  display: flex;
  flex-direction: column;
  background: var(--qz-color-bg);
  border-bottom: 1px solid var(--qz-line);
}

.lib-top-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  min-height: 44px;
  box-sizing: border-box;
}

.lib-jump {
  display: none;
}

.lib-scope {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font: 400 12.5px/1 var(--qz-font-sans);
  color: var(--qz-color-fg-3);
}

.lib-scope-slot {
  color: var(--qz-color-fg);
  font-weight: var(--qz-weight-medium);
}

.lib-scope.is-active .lib-scope-slot {
  color: var(--qz-color-accent);
}

.lib-count {
  display: inline-flex;
  align-items: center;
  height: 28px;
  font: 400 12px/1 var(--qz-font-mono);
  color: var(--qz-color-fg-4);
  letter-spacing: .04em;
  white-space: nowrap;
}

.lib-count b {
  font: 400 17px/1 var(--qz-font-display);
  color: var(--qz-color-accent);
  margin: 0 3px 0 0;
}

/* Unified Single-Row Inline Workflow Tab Rail (PC Library) */
.pipe-bar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 2px;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}

.pipe-bar::-webkit-scrollbar {
  display: none;
}

.pipe-sep {
  width: 1px;
  height: 14px;
  margin: 0 5px;
  background: var(--qz-line-strong);
  flex: none;
}

.pipe-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 44px;
  box-sizing: border-box;
  padding: 0 9px;
  border: 0;
  border-radius: var(--qz-radius-none);
  background: transparent;
  color: var(--qz-color-fg-3);
  font-size: 12.5px;
  font-weight: var(--qz-weight-regular);
  line-height: 1;
  white-space: nowrap;
  flex: none;
  transition: background .14s, color .14s, box-shadow .14s;
}

.pipe-btn:hover {
  background: rgba(255, 255, 255, 0.035);
  color: var(--qz-color-fg);
}

.pipe-btn.is-empty {
  color: var(--qz-color-fg-6);
}

.pipe-btn.is-empty:hover {
  color: var(--qz-color-fg-4);
}

.pipe-btn[aria-pressed="true"],
.pipe-more-tab[aria-expanded="true"] {
  background: rgba(163, 255, 18, 0.07);
  color: var(--qz-color-accent);
  box-shadow: inset 0 -2px 0 var(--qz-color-accent);
  font-weight: var(--qz-weight-bold);
}

.pipe-btn .slot-cnt {
  font-style: normal;
  font: 400 11px/1 var(--qz-font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: .01em;
  color: var(--qz-color-fg-5);
  padding: 0;
  background: transparent;
  border: 0;
}

.pipe-btn.is-empty .slot-cnt {
  opacity: .5;
}

.pipe-btn[aria-pressed="true"] .slot-cnt {
  color: var(--qz-color-accent);
  opacity: .85;
}

.pipe-more-tab .qsel-chev {
  opacity: .7;
  transition: transform .14s;
}

.pipe-more-tab[aria-expanded="true"] .qsel-chev {
  transform: rotate(180deg);
  opacity: 1;
}

.lib-top-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  flex: none;
}

.lib-banner {
  margin: 16px 20px 0;
  padding: 10px 14px;
  border-radius: var(--qz-radius-none);
  border: 1px solid var(--qz-err-line);
  background: var(--qz-err-bg);
  color: var(--qz-color-fg);
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* Scene-Grouped Shot Gallery */
.scene {
  padding: 0 20px 34px;
}

.scene-h {
  position: sticky;
  top: 44px;
  z-index: 4;
  display: flex;
  align-items: flex-end;
  gap: 16px;
  padding: 24px 0 18px;
  margin-bottom: 10px;
  background: var(--qz-color-bg);
  border-bottom: 1px solid var(--qz-line-subtle);
}

.scene-h h2 {
  font: 400 48px/.84 var(--qz-font-display);
  transform: skewX(-8deg);
  margin: 0;
  letter-spacing: .01em;
  white-space: nowrap;
  color: var(--qz-color-fg);
  flex: none;
}

.scene-h .h-ep {
  color: var(--qz-color-fg-5);
  margin-right: .28em;
}

.scene-h .scene-loc {
  font: 500 20px/1.15 var(--qz-font-sans);
  letter-spacing: .04em;
  color: var(--qz-color-fg-2);
  padding-bottom: 4px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scene-h .meta {
  margin-left: auto;
  flex: none;
  display: flex;
  align-items: baseline;
  gap: 14px;
  font-size: 12.5px;
  color: var(--qz-color-fg-4);
  white-space: nowrap;
  padding-bottom: 3px;
}

.scene-h .meta b {
  font: 400 16px/1 var(--qz-font-display);
  color: var(--qz-color-accent);
  margin-right: 3px;
}

.shots {
  display: grid;
  grid-template-columns: repeat(var(--lib-cols, 3), minmax(0, 1fr));
  gap: 18px 14px;
}

.lib-main[data-cols-tier="compact"] .shots {
  gap: 12px 8px;
}

.lib-main[data-cols-tier="compact"] .shot-meta {
  gap: 5px;
  margin-top: 6px;
  font-size: 11px;
}

.lib-main[data-cols-tier="compact"] .shot-meta b {
  font-size: 12px;
}

.lib-main[data-cols-tier="compact"] .mtag {
  font-size: 9.5px;
  padding: 2px 4px;
}

.lib-main[data-cols-tier="compact"] .sdots {
  gap: 3px;
}

.lib-main[data-cols-tier="compact"] .sdot {
  width: 5px;
  height: 5px;
}

.lib-main[data-cols-tier="micro"] .shots {
  gap: 10px 6px;
}

.lib-main[data-cols-tier="micro"] .shot-meta {
  gap: 4px;
  margin-top: 4px;
  font-size: 10px;
}

.lib-main[data-cols-tier="micro"] .shot-meta b {
  font-size: 10px;
  letter-spacing: 0;
  min-width: 0;
  flex: 1 1 auto;
}

.lib-main[data-cols-tier="micro"] .shot-meta .mtag {
  display: none;
}

.lib-main[data-cols-tier="micro"] .sdots {
  gap: 2px;
}

.lib-main[data-cols-tier="micro"] .sdot {
  width: 4px;
  height: 4px;
}

.lib-main[data-cols-tier="micro"] .half-empty {
  font-size: 9px;
  padding: 0 4px;
  letter-spacing: 0;
}

.lib-main[data-cols-tier="ultra"] .shots {
  gap: 8px 4px;
}

.lib-main[data-cols-tier="ultra"] .shot-meta {
  gap: 2px;
  margin-top: 3px;
  font-size: 9.5px;
}

.lib-main[data-cols-tier="ultra"] .shot-meta b {
  font-size: 9.5px;
  letter-spacing: 0;
  min-width: 0;
  flex: 1 1 auto;
}

.lib-main[data-cols-tier="ultra"] .shot-meta .mtag,
.lib-main[data-cols-tier="ultra"] .shot-meta .sdots {
  display: none;
}

.lib-main[data-cols-tier="ultra"] .half-empty {
  font-size: 8.5px;
  padding: 0 3px;
  letter-spacing: 0;
}

.shot {
  min-width: 0;
}

/* 16:9 Square MediaCard Cinema Frame */
.half {
  position: relative;
  aspect-ratio: 16 / 9;
  display: block;
  width: 100%;
  border-radius: var(--qz-radius-none);
  overflow: hidden;
  background: var(--qz-color-bg-deep);
  cursor: pointer;
}

.half::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--qz-radius-none);
  box-shadow: inset 0 0 0 1px var(--qz-line-subtle);
  pointer-events: none;
  transition: box-shadow .16s;
}

.half:hover::after {
  box-shadow: inset 0 0 0 1px var(--qz-accent-45);
}

.half.is-loading::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(163, 255, 18, 0.03) 62%,
    rgba(163, 255, 18, 0.14) 97%,
    rgba(163, 255, 18, 0.72) 99%,
    transparent 100%
  );
  transform: translateY(-100%);
  will-change: transform;
  animation: qscan-v 1.35s linear infinite;
}

.half img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .5s var(--ease), opacity .16s ease;
}

.half.is-loading img {
  opacity: 0;
}

.half:hover img {
  transform: scale(1.04);
}

/* Iconic Qizhi MediaCard green grid texture on empty/missing frame */
.half-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  font: 400 11px/1.2 var(--qz-font-mono);
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--qz-color-fg-5);
  background-color: var(--qz-color-bg-deep);
  background-image:
    linear-gradient(var(--qz-accent-09) 1px, transparent 1px),
    linear-gradient(90deg, var(--qz-accent-09) 1px, transparent 1px),
    radial-gradient(circle at 35% 30%, var(--qz-accent-10), transparent 64%);
  background-size: 28px 28px, 28px 28px, 100% 100%;
}

.half-empty span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}

/* Single crisp line below frame */
.shot-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--qz-color-fg-4);
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
}

.shot-meta b {
  font: 400 14px/1 var(--qz-font-mono);
  color: var(--qz-color-fg);
  letter-spacing: .02em;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Qizhi Square Tags (Tag.md: outline green / solid green) */
.mtag {
  font: 400 10.5px/1 var(--qz-font-mono);
  letter-spacing: .06em;
  padding: 3px 5px 2px;
  border-radius: var(--qz-radius-none);
  background: var(--qz-color-surface-raise);
  border: 1px solid var(--qz-line);
  color: var(--qz-color-fg-2);
  flex: none;
}

.mtag.outline {
  background: var(--qz-accent-07);
  border-color: var(--qz-accent-45);
  color: var(--qz-color-accent);
}

.mtag.solid {
  background: var(--qz-color-accent);
  border-color: var(--qz-color-accent);
  color: var(--qz-color-on-accent);
  font-weight: var(--qz-weight-bold);
}

.mtag.amber {
  background: var(--qz-warn-bg);
  border-color: var(--qz-warn-line);
  color: var(--qz-warn);
}

.sdots {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: none;
}

.sdot {
  width: 6px;
  height: 6px;
  border-radius: var(--qz-radius-pill);
  background: var(--qz-color-fg-6);
}

.sdot.st-done { background: var(--qz-color-accent); }
.sdot.st-ready { background: var(--qz-mint); }
.sdot.st-blocked { background: var(--qz-color-numeral-dim); }
.sdot.st-running { background: var(--qz-color-accent-hover); animation: pulse 1.1s ease-in-out infinite; }
.sdot.st-failed { background: var(--qz-err); }

.lib-empty {
  padding: 80px 28px;
  color: var(--qz-color-fg-3);
  max-width: 520px;
}

.lib-empty b {
  display: block;
  font: 700 22px/1.3 var(--qz-font-sans);
  color: var(--qz-color-fg);
  margin-bottom: 8px;
}

.lib-empty-reset {
  margin-top: 14px;
}

/* ==========================================================================
   Mode 2: Viewer 看图 (3-Part Cinema Dailies Workspace)
   ========================================================================== */
.app {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  min-height: 0;
}

.rail {
  border-right: 1px solid var(--qz-line-subtle);
  background: var(--qz-color-surface);
  overflow: auto;
  overscroll-behavior: contain;
  min-height: 0;
}

.slate {
  padding: 18px 22px 16px;
  border-bottom: 1px solid var(--qz-line-subtle);
}

.slate.slate-head {
  padding: 18px 22px 14px;
}

.rail-tools-host {
  border-bottom: 1px solid var(--qz-line-subtle);
}

.rail-slots-block {
  padding: 14px 22px 16px;
  border-bottom: 1px solid var(--qz-line-subtle);
}

.rail-slots-block .fswap-groups {
  margin-top: 0;
}

.slate-kicker {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  margin-bottom: 10px;
}

.slate-epsc {
  font: 600 12px/1 var(--qz-font-mono);
  letter-spacing: .04em;
  color: var(--qz-color-accent);
  white-space: nowrap;
  flex: none;
}

.slate-sep {
  color: var(--qz-color-fg-6);
  font-size: 12px;
  line-height: 1;
  flex: none;
}

.slate-loc {
  font: 400 12.5px/1.2 var(--qz-font-sans);
  color: var(--qz-color-fg-3);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.slate-pos {
  margin-left: auto;
  flex: none;
  font: 400 11.5px/1 var(--qz-font-mono);
  color: var(--qz-color-fg-4);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.slate-title-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.slate-id {
  font: 400 48px/.84 var(--qz-font-display);
  letter-spacing: .01em;
  transform: skewX(-8deg);
  transform-origin: left bottom;
  margin-left: -2px;
  display: inline-block;
  color: var(--qz-color-fg);
  white-space: nowrap;
  min-width: 0;
}

.slate-id.mid {
  font-size: 38px;
}

.slate-id.sm {
  font-size: 28px;
}

.slate-id.swap {
  animation: swap .38s var(--ease) both;
}

.slate-copy {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 8px;
  margin-bottom: 2px;
  flex: none;
  background: transparent;
  border: 1px solid var(--qz-line-subtle);
  border-radius: var(--qz-radius-none);
  color: var(--qz-color-fg-4);
  font: 400 11.5px/1 var(--qz-font-sans);
  white-space: nowrap;
  transition: border-color .14s, color .14s, background .14s;
}

.slate-copy:hover {
  border-color: var(--qz-accent-35);
  background: var(--qz-accent-06);
  color: var(--qz-color-accent);
}

.rail-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 14px;
}

.rail-link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px;
  background: var(--qz-color-surface);
  border: 1px solid var(--qz-line-strong);
  border-radius: var(--qz-radius-none);
  color: var(--qz-color-fg-2);
  font: var(--qz-weight-regular) 12px/1 var(--qz-font-sans);
  letter-spacing: .04em;
  white-space: nowrap;
  text-decoration: none;
  transition: background .14s, border-color .14s, color .14s;
}

.rail-link-btn:hover:not(:disabled) {
  background: var(--qz-accent-09);
  border-color: var(--qz-color-accent);
  color: var(--qz-color-accent);
}

.rail-link-btn.rail-rush-btn:not(:disabled) {
  border-color: var(--qz-accent-35);
  color: var(--qz-color-accent);
  background: var(--qz-accent-06);
}

.rail-link-btn.rail-rush-btn:hover:not(:disabled) {
  background: var(--qz-accent-16);
  border-color: var(--qz-color-accent);
}

.rail-link-btn.rail-rush-btn[aria-pressed="true"]:not(:disabled) {
  background: var(--qz-color-accent);
  border-color: var(--qz-color-accent);
  color: var(--qz-color-on-accent);
  font-weight: var(--qz-weight-bold);
}

.rail-link-btn:disabled {
  opacity: .34;
  cursor: default;
  color: var(--qz-color-fg-4);
}

/* 3-Band Workflow Grouped Slot Switcher (BG / AI FF / Manual · Final) */
.fswap-groups {
  display: flex;
  flex-direction: column;
  background: var(--qz-color-bg);
  border: 1px solid var(--qz-line);
  border-radius: var(--qz-radius-none);
  margin-top: 14px;
}

.fswap-grp {
  padding: 7px 8px 8px;
  border-bottom: 1px solid var(--qz-line-subtle);
}

.fswap-grp:last-child {
  border-bottom: 0;
}

.fswap-lbl {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font: 400 10.5px/1 var(--qz-font-mono);
  letter-spacing: .08em;
  color: var(--qz-color-fg-4);
  margin: 0 0 6px;
}

.fswap-lbl .fswap-cnt {
  font-size: 10px;
  color: var(--qz-color-fg-5);
  font-variant-numeric: tabular-nums;
}

.fswap-row {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.fswap-row button {
  font-size: 11.5px;
  line-height: 1.2;
  padding: 5px 8px;
  border-radius: var(--qz-radius-none);
  border: 1px solid var(--qz-line-subtle);
  background: var(--qz-color-surface);
  color: var(--qz-color-fg-2);
  white-space: nowrap;
  transition: background .14s, color .14s, border-color .14s;
}

.fswap-row button:hover:not(:disabled) {
  border-color: var(--qz-accent-45);
  background: var(--qz-color-surface-hover);
  color: var(--qz-color-fg);
}

.fswap-row button[aria-pressed="true"] {
  background: var(--qz-accent-16);
  border-color: var(--qz-color-accent);
  color: var(--qz-color-accent);
  box-shadow: inset 0 -2px 0 var(--qz-color-accent);
  font-weight: var(--qz-weight-bold);
}

.fswap-row button:disabled {
  background: transparent;
  border-color: transparent;
  color: var(--qz-color-fg-5);
  opacity: .26;
  cursor: default;
}

.block {
  padding: 18px 24px;
  border-bottom: 1px solid var(--qz-line-subtle);
}

.block:last-child {
  border-bottom: 0;
}

.block h2 {
  font-size: 12px;
  font-weight: var(--qz-weight-bold);
  color: var(--qz-color-accent);
  margin: 0 0 11px;
  letter-spacing: .08em;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 3-col Square Production Facts Grid (qizhi-ds StatGrid hairline cells) */
.kstat {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin: 0;
  background: var(--qz-line);
  border: 1px solid var(--qz-line);
  border-radius: var(--qz-radius-none);
  overflow: hidden;
}

.kstat > div {
  background: var(--qz-color-bg);
  padding: 8px 8px 9px;
  min-width: 0;
}

.kstat dt {
  font: 400 10px/1.25 var(--qz-font-sans);
  color: var(--qz-color-fg-5);
  letter-spacing: .02em;
  overflow-wrap: break-word;
}

.kstat dd {
  margin: 5px 0 0;
  font: 400 14.5px/1.2 var(--qz-font-display);
  letter-spacing: .02em;
  overflow-wrap: anywhere;
  color: var(--qz-color-fg);
}

.kstat dd.nil {
  color: var(--qz-color-fg-5);
  font-family: var(--qz-font-sans);
  font-size: 13px;
}

.kstat dd.c-accent { color: var(--qz-color-accent); }
.kstat dd.c-amber { color: var(--qz-warn); }
.kstat dd.c-err { color: var(--qz-err); }

/* ==========================================================================
   Right Stage + Adaptive Compare Bar (Floats cleanly on Stage in Single Mode)
   ========================================================================== */
.main {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
}

.stage {
  position: relative;
  overflow: hidden;
  background: var(--qz-color-bg-deep);
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.stage.dragging {
  cursor: grabbing;
}

.stage-canvas {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.stage-transform {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-origin: center center;
  will-change: transform;
}

.stage-frame {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stage-frame img {
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
}

.stage-frame.enter img {
  animation: focusIn .36s var(--ease) both;
}

/* Curtain Compare Layer inside dark stage */
.curtain-stage {
  position: relative;
  width: 100%;
  height: 100%;
}

.curtain-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.curtain-layer img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
}

.curtain-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--qz-color-accent);
  box-shadow: 0 0 12px rgba(0, 0, 0, .9);
  z-index: 6;
  cursor: ew-resize;
  transform: translateX(-1px);
}

.curtain-divider::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -9px;
  right: -9px;
}

.curtain-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 30px;
  height: 36px;
  border-radius: var(--qz-radius-none);
  background: var(--qz-color-bg);
  border: 2px solid var(--qz-color-accent);
  color: var(--qz-color-accent);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .85);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: var(--qz-weight-bold);
  letter-spacing: -1px;
}

.curtain-tag {
  position: absolute;
  top: 14px;
  z-index: 5;
  padding: 5px 9px 4px;
  border-radius: var(--qz-radius-none);
  background: rgba(8, 9, 10, .86);
  border: 1px solid var(--qz-line-strong);
  font: 400 11px/1 var(--qz-font-mono);
  letter-spacing: .08em;
  color: var(--qz-color-fg);
  pointer-events: none;
}

.curtain-tag-a {
  left: 16px;
  border-color: var(--qz-accent-60);
  color: var(--qz-color-accent);
}

.curtain-tag-b {
  right: 16px;
  border-color: var(--qz-line-strong);
}

/* Transparent Overlay (叠画) Compare inside dark stage */
.overlay-stage {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--qz-color-bg-deep);
}

.overlay-stack {
  isolation: isolate;
}

.overlay-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
}

.overlay-img-b {
  mix-blend-mode: normal;
  will-change: opacity;
}

.overlay-img-b.is-diff {
  mix-blend-mode: difference;
}

/* Side-by-Side Compare inside dark stage */
.side-stage {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  background: var(--qz-line);
}

.side-pane {
  position: relative;
  overflow: hidden;
  background: var(--qz-color-bg-deep);
}

.side-pane-inner {
  position: absolute;
  inset: 0;
  transform-origin: center center;
  will-change: transform;
}

.side-pane-inner img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
}

/* Inline Google Drive Rush Video Preview inside Viewer Stage & Side-by-Side
   Size-container math guarantees exact 1:1 16:9 / 9:16 dimensions with sibling still images */
.stage-rush-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  container-type: size;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--qz-color-bg-deep);
}

.stage-rush-iframe {
  width: min(100cqw, calc(100cqh * 16 / 9));
  height: min(100cqh, calc(100cqw * 9 / 16));
  border: 0;
  display: block;
  background: #000;
}

.stage-rush-wrap.is-portrait-rush .stage-rush-iframe {
  width: min(100cqw, calc(100cqh * 9 / 16));
  height: min(100cqh, calc(100cqw * 16 / 9));
}

.stage.is-rush-single,
.stage.is-rush-both {
  cursor: default;
}

.stage.is-rush-single .zoom,
.stage.is-rush-both .zoom,
.stage.is-rush-single .hud-frame,
.stage.is-rush-both .hud-frame,
.stage.is-rush-left .hud-frame,
.stage.is-rush-right .hud-frame {
  display: none;
}

.stage.is-rush-right .zoom {
  right: auto;
  left: 16px;
}

/* HUD corner brackets & Zoombar */
.hud-frame {
  position: absolute;
  inset: 14px;
  pointer-events: none;
  z-index: 4;
}

.hud-frame::before,
.hud-frame::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--qz-accent-35);
}

.hud-frame::before {
  left: 0;
  top: 0;
  border-right: 0;
  border-bottom: 0;
}

.hud-frame::after {
  right: 0;
  bottom: 0;
  border-left: 0;
  border-top: 0;
}

.stage-hud-top {
  position: absolute;
  left: 16px;
  top: 14px;
  z-index: 5;
  padding: 5px 9px 4px;
  border-radius: var(--qz-radius-none);
  background: rgba(8, 9, 10, .82);
  border: 1px solid var(--qz-accent-30);
  font: 400 11px/1 var(--qz-font-mono);
  letter-spacing: .08em;
  color: var(--qz-color-accent);
  pointer-events: none;
}

.zoom {
  position: absolute;
  right: 16px;
  bottom: 14px;
  z-index: 7;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.zoombar {
  display: flex;
  align-items: center;
  background: rgba(8, 9, 10, .88);
  border: 1px solid var(--qz-line-strong);
  border-radius: var(--qz-radius-none);
  overflow: hidden;
}

.zoombar button {
  width: 34px;
  height: 32px;
  display: grid;
  place-items: center;
  color: var(--qz-color-fg-3);
}

.zoombar button:hover:not(:disabled) {
  background: var(--qz-accent-10);
  color: var(--qz-color-accent);
}

.zoombar button:disabled {
  opacity: .3;
  cursor: default;
  pointer-events: none;
}

.zoombar button.zoom-val {
  width: auto;
  min-width: 54px;
  padding: 0 7px;
  font: 400 12.5px/1 var(--qz-font-mono);
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: var(--qz-color-accent);
}

.zoombar button.zoom-fs .fs-ico-exit {
  display: none;
}

.zoombar button.zoom-fs[aria-pressed="true"] {
  background: var(--qz-accent-16);
  color: var(--qz-color-accent);
  box-shadow: inset 0 -2px 0 var(--qz-color-accent);
}

.zoombar button.zoom-fs[aria-pressed="true"] .fs-ico-enter {
  display: none;
}

.zoombar button.zoom-fs[aria-pressed="true"] .fs-ico-exit {
  display: block;
}

.zoombar button.zoom-lossless {
  width: auto;
  padding: 0 11px;
  font: var(--qz-weight-regular) 11.5px/1 var(--qz-font-sans);
  letter-spacing: .06em;
  color: var(--qz-color-fg-3);
}

.zoombar button.zoom-lossless[aria-pressed="true"] {
  background: var(--qz-accent-16);
  color: var(--qz-color-accent);
  box-shadow: inset 0 -2px 0 var(--qz-color-accent);
  font-weight: var(--qz-weight-bold);
}

/* Cinema Fullscreen Mode (works with native Fullscreen API + iOS/CSS fallback) */
body.is-stage-fullscreen .bar,
body.is-stage-fullscreen .rail,
body.is-stage-fullscreen .strip,
body.is-stage-fullscreen .mobile-tabbar,
body.is-stage-fullscreen .viewer-mbar,
body.is-stage-fullscreen .viewer-mactions {
  display: none !important;
}

body.is-stage-fullscreen .app {
  position: fixed;
  inset: 0;
  height: 100vh;
  height: 100dvh;
  grid-template-columns: minmax(0, 1fr) !important;
  z-index: 800;
  background: var(--qz-color-bg-deep);
}

body.is-stage-fullscreen .main {
  height: 100%;
  grid-template-rows: minmax(0, 1fr) auto !important;
}

.zoombar .sep {
  width: 1px;
  align-self: stretch;
  background: var(--qz-line);
}

.stage-scan {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  overflow: hidden;
}

.stage-scan::before,
.rush-scan::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(163, 255, 18, 0.025) 64%,
    rgba(163, 255, 18, 0.13) 97%,
    rgba(163, 255, 18, 0.72) 99%,
    transparent 100%
  );
  transform: translateY(-100%);
  will-change: transform;
  animation: qscan-v 1.35s linear infinite;
}

.stage-scan-pill {
  position: absolute;
  left: 16px;
  bottom: 16px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px 4px;
  background: rgba(8, 9, 10, 0.84);
  border: 1px solid var(--qz-accent-35);
  border-radius: var(--qz-radius-none);
  font: 400 11px/1 var(--qz-font-mono);
  letter-spacing: .08em;
  color: var(--qz-color-accent);
}

.stage-scan-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  background: var(--qz-color-accent);
  animation: pulse 1.1s ease-in-out infinite;
}

.stage.is-loading .stage-frame img,
.stage.is-loading .curtain-layer img,
.stage.is-loading .overlay-img,
.stage.is-loading .side-pane-inner img {
  transition: opacity .16s ease;
}

.stage-msg {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  text-align: center;
  color: var(--qz-color-fg-3);
  padding: 24px;
  z-index: 5;
  pointer-events: none;
}

.stage-msg.on {
  display: grid;
}

.stage-msg > div {
  background: var(--qz-color-surface);
  border: 1px solid var(--qz-line-strong);
  border-radius: var(--qz-radius-none);
  padding: 16px 22px;
  font-size: 13px;
}

/* Adaptive Stage Compare Bar: Floats bottom-left in Single Mode, expands cleanly in Compare Mode */
.tools {
  display: flex;
  align-items: center;
  gap: 6px;
  height: var(--tools);
  padding: 0 12px;
  border-top: 1px solid var(--qz-line-subtle);
  background: var(--qz-color-surface);
  overflow-x: auto;
  white-space: nowrap;
  min-width: 0;
}

.tools:not(.is-comparing) {
  position: absolute;
  left: 16px;
  bottom: 14px;
  z-index: 7;
  height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: visible;
  pointer-events: none;
}

.tools:not(.is-comparing) .tools-seg {
  pointer-events: auto;
  background: rgba(8, 9, 10, .88);
  backdrop-filter: blur(8px);
  border-color: var(--qz-line-strong);
  padding: 2px;
  height: 34px;
  align-items: stretch;
}

.tools:not(.is-comparing) .tools-seg button {
  padding: 0 10px;
  font-size: 11.5px;
  display: inline-flex;
  align-items: center;
}

.tools:not(.is-comparing) .gap,
.tools:not(.is-comparing) .tools-keys {
  display: none;
}

.tools-seg button {
  padding: 4px 8px;
  font-size: 11.5px;
}

.tools .gap {
  flex: 1 0 8px;
}

.tools .vsep {
  width: 1px;
  height: 20px;
  background: var(--qz-line-strong);
  margin: 0 1px;
  flex: none;
}

.compare-pickers {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 1 auto;
  min-width: 0;
}

.cmp-pick {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: none;
}

.cmp-pick .dsel-xs {
  max-width: 148px;
  font-size: 11.5px;
  padding-left: 6px;
  padding-right: 18px;
}

.compare-pickers .ib {
  width: 22px;
  height: 24px;
  flex: none;
}

.cmp-tag {
  width: 16px;
  height: 16px;
  border-radius: var(--qz-radius-none);
  font: 700 10px/1 var(--qz-font-mono);
  display: grid;
  place-items: center;
  flex: none;
}

.cmp-a {
  background: var(--qz-color-accent);
  color: var(--qz-color-on-accent);
}

.cmp-b {
  background: transparent;
  border: 1px solid var(--qz-accent-45);
  color: var(--qz-color-accent);
}

.overlay-ctrls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
}

.ov-locked-pair {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.ov-slot-lbl {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  background: var(--qz-color-bg);
  border: 1px solid var(--qz-line-strong);
  border-radius: var(--qz-radius-none);
  font: 400 11.5px/1 var(--qz-font-mono);
  color: var(--qz-color-fg-2);
  letter-spacing: .02em;
}

.ov-slider-wrap {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 26px;
  padding: 0 8px;
  background: var(--qz-color-bg);
  border: 1px solid var(--qz-line-strong);
  border-radius: var(--qz-radius-none);
}

.ov-range {
  -webkit-appearance: none;
  appearance: none;
  width: 88px;
  height: 4px;
  background: var(--qz-color-numeral-dim);
  border-radius: var(--qz-radius-none);
  outline: none;
  cursor: pointer;
  margin: 0;
}

.ov-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 10px;
  height: 14px;
  background: var(--qz-color-accent);
  border: 0;
  border-radius: var(--qz-radius-none);
  cursor: ew-resize;
}

.ov-range::-moz-range-thumb {
  width: 10px;
  height: 14px;
  background: var(--qz-color-accent);
  border: 0;
  border-radius: var(--qz-radius-none);
  cursor: ew-resize;
}

.ov-range::-moz-range-track {
  height: 4px;
  background: var(--qz-color-numeral-dim);
  border-radius: var(--qz-radius-none);
}

.ov-val {
  min-width: 28px;
  text-align: right;
  font: 400 11px/1 var(--qz-font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--qz-color-accent);
}

.ov-diff-btn {
  height: 26px;
  padding: 0 7px;
  border-radius: var(--qz-radius-none);
  border: 1px solid var(--qz-line-strong);
  background: var(--qz-color-bg);
  color: var(--qz-color-fg-3);
  font-size: 11px;
  letter-spacing: .04em;
  transition: background .12s, border-color .12s, color .12s;
}

.ov-diff-btn:hover {
  border-color: var(--qz-accent-45);
  color: var(--qz-color-fg);
}

.ov-diff-btn[aria-pressed="true"] {
  border-color: var(--qz-color-accent);
  background: var(--qz-color-accent);
  color: var(--qz-color-on-accent);
  font-weight: var(--qz-weight-bold);
}

.tools-keys {
  font-size: 11.5px;
  color: var(--qz-color-fg-5);
}

.tools.is-comparing .gap,
.tools.is-comparing .tools-keys {
  display: none;
}

/* Desktop Left-Rail Unified Viewer Mode & Compare Controls (.tools.is-in-rail) */
.tools.is-in-rail,
.tools.is-in-rail:not(.is-comparing) {
  position: static;
  left: auto;
  bottom: auto;
  z-index: auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  height: auto;
  padding: 14px 22px;
  border-top: 0;
  background: transparent;
  overflow: visible;
  white-space: normal;
  pointer-events: auto;
}

.tools.is-in-rail .vsep,
.tools.is-in-rail .gap,
.tools.is-in-rail .tools-keys {
  display: none !important;
}

.tools.is-in-rail .tools-seg,
.tools.is-in-rail:not(.is-comparing) .tools-seg {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  width: 100%;
  height: auto;
  padding: 2px;
  background: var(--qz-color-bg);
  border: 1px solid var(--qz-line);
  backdrop-filter: none;
}

.tools.is-in-rail .tools-seg button,
.tools.is-in-rail:not(.is-comparing) .tools-seg button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  padding: 0 4px;
  font-size: 12px;
}

.tools.is-in-rail .compare-pickers {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px;
  grid-template-rows: auto auto;
  gap: 6px;
  width: 100%;
}

.tools.is-in-rail .compare-pickers .cmp-pick {
  width: 100%;
  min-width: 0;
  gap: 6px;
}

.tools.is-in-rail .compare-pickers .cmp-pick:first-of-type {
  grid-column: 1;
  grid-row: 1;
}

.tools.is-in-rail .compare-pickers .cmp-pick:last-of-type {
  grid-column: 1;
  grid-row: 2;
}

.tools.is-in-rail .compare-pickers .ib {
  grid-column: 2;
  grid-row: 1 / 3;
  width: 28px;
  height: 100%;
  background: var(--qz-color-bg);
}

.tools.is-in-rail .cmp-tag {
  width: 18px;
  height: 18px;
}

.tools.is-in-rail .cmp-pick .qsel-xs,
.tools.is-in-rail .cmp-pick .dsel-xs {
  width: auto;
  max-width: none;
  flex: 1 1 auto;
  min-width: 0;
  height: 28px;
}

.tools.is-in-rail .overlay-ctrls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 6px;
  width: 100%;
}

.tools.is-in-rail .ov-locked-pair {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.tools.is-in-rail .ov-slot-lbl {
  flex: 1 1 0;
  min-width: 0;
  justify-content: center;
  height: 26px;
  padding: 0 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tools.is-in-rail .ov-locked-pair .ib {
  width: 26px;
  height: 26px;
  background: var(--qz-color-bg);
  flex: none;
}

.tools.is-in-rail .ov-slider-wrap {
  width: 100%;
  min-width: 0;
  height: 28px;
}

.tools.is-in-rail .ov-range {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
}

.tools.is-in-rail .ov-diff-btn {
  height: 28px;
  padding: 0 9px;
  font-size: 11.5px;
}

/* ==========================================================================
   Bottom 108px Filmstrip
   ========================================================================== */
.strip {
  display: flex;
  align-items: stretch;
  border-top: 1px solid var(--qz-line-subtle);
  background: var(--qz-color-surface);
  min-width: 0;
}

.strip-side {
  flex: none;
  width: 204px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 10px 10px 10px 12px;
  border-right: 1px solid var(--qz-line-subtle);
}

.strip-scene {
  display: flex;
  align-items: center;
  gap: 2px;
}

.strip-scene .lbl {
  flex: 1;
  text-align: center;
  font: 400 15px/1 var(--qz-font-display);
  letter-spacing: .05em;
  text-box-trim: trim-both;
  text-box-edge: cap alphabetic;
  padding: 6px 4px;
  border-radius: var(--qz-radius-none);
  color: var(--qz-color-accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.strip-scene .lbl:hover {
  background: var(--qz-accent-07);
}

.strip-scene .nb {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: var(--qz-radius-none);
  color: var(--qz-color-fg-3);
}

.strip-scene .nb:hover {
  background: var(--qz-color-surface-hover);
  color: var(--qz-color-accent);
}

.strip-scene .nb:disabled {
  opacity: .24;
  pointer-events: none;
}

.strip-tabs {
  display: flex;
  gap: 2px;
  background: var(--qz-color-bg);
  border: 1px solid var(--qz-line);
  border-radius: var(--qz-radius-none);
  padding: 2px;
}

.strip-tabs button {
  flex: 1;
  font-size: 11.5px;
  padding: 4px;
  border-radius: var(--qz-radius-none);
  color: var(--qz-color-fg-4);
  white-space: nowrap;
}

.strip-tabs button b {
  font: 400 11.5px/1 var(--qz-font-mono);
  margin-left: 3px;
}

.strip-tabs button[aria-pressed="true"] {
  background: var(--qz-accent-16);
  color: var(--qz-color-accent);
}

.strip-scroll {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0 12px;
  overscroll-behavior-x: contain;
}

.frame {
  position: relative;
  flex: none;
  width: 114px;
  height: 64px;
  border-radius: var(--qz-radius-none);
  overflow: hidden;
  background: var(--qz-color-bg-deep);
}

.frame img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: grayscale(1) brightness(.48);
  transition: filter .24s var(--ease), transform .4s var(--ease), opacity .16s ease;
}

.frame.is-loading img {
  opacity: 0;
}

.frame.is-loading::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(163, 255, 18, 0.03) 62%,
    rgba(163, 255, 18, 0.14) 97%,
    rgba(163, 255, 18, 0.72) 99%,
    transparent 100%
  );
  transform: translateY(-100%);
  will-change: transform;
  animation: qscan-v 1.35s linear infinite;
}

.frame:hover img {
  filter: grayscale(.12) brightness(.9);
  transform: scale(1.05);
}

.frame.cur img {
  filter: none;
}

.frame::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--qz-radius-none);
  box-shadow: inset 0 0 0 1px var(--qz-line-subtle);
  pointer-events: none;
}

.frame.cur::after {
  box-shadow: inset 0 0 0 2px var(--qz-color-accent);
}

.frame .fid {
  position: absolute;
  left: 7px;
  bottom: 5px;
  font: 400 13.5px/1 var(--qz-font-display);
  letter-spacing: .03em;
  transform: skewX(-8deg);
  color: var(--qz-color-fg);
  text-shadow: 0 1px 8px rgba(0, 0, 0, .95);
}

.frame.cur .fid {
  color: var(--qz-color-accent);
}

/* ==========================================================================
   Slide-Over Sheet & Rush Video Preview Modal
   ========================================================================== */
.rush-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0, 0, 0, .84);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fade .16s ease both;
}

.rush-card {
  width: min(1040px, 94vw);
  max-height: 92vh;
  background: var(--qz-color-surface);
  border: 1px solid var(--qz-line-strong);
  border-top: 2px solid var(--qz-color-accent);
  border-radius: var(--qz-radius-none);
  box-shadow: 0 28px 72px rgba(0, 0, 0, .86);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.rush-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--qz-line-subtle);
  background: var(--qz-color-bg);
}

.rush-head-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.rush-title {
  margin: 0;
  font: 400 14px/1.2 var(--qz-font-mono);
  letter-spacing: .04em;
  color: var(--qz-color-fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rush-head-acts {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.rush-ext-btn {
  text-decoration: none;
}

.rush-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: calc(92vh - 64px);
  background: var(--qz-color-bg-deep);
}

.rush-modal.is-portrait-rush .rush-card {
  width: min(460px, 92vw);
}

.rush-modal.is-portrait-rush .rush-stage {
  aspect-ratio: 9 / 16;
  max-height: calc(92vh - 64px);
}

/* Portrait (9:16) & Anamorphic Vertical Shot Adaptation */
.half.is-portrait,
.csheet-tile.is-portrait,
.frame.is-portrait,
.half.is-portrait-desqueeze,
.csheet-tile.is-portrait-desqueeze,
.frame.is-portrait-desqueeze {
  background: #000000;
}

.half.is-portrait img,
.csheet-tile.is-portrait img,
.frame.is-portrait img,
.gs-pic.is-portrait img {
  object-fit: contain;
}

.gs-pic.is-portrait-desqueeze {
  position: relative;
  background: #000000;
}

.half.is-portrait-desqueeze,
.csheet-tile.is-portrait-desqueeze,
.frame.is-portrait-desqueeze,
.gs-pic.is-portrait-desqueeze,
.stage-frame,
.stage-transform,
.overlay-stack,
.side-pane-inner {
  container-type: size;
}

img.is-portrait-desqueeze {
  position: absolute !important;
  inset: 0 !important;
  margin: auto !important;
  width: min(100cqw, calc(100cqh * 9 / 16)) !important;
  height: min(100cqh, calc(100cqw * 16 / 9)) !important;
  max-width: none !important;
  max-height: none !important;
  object-fit: fill !important;
}

.half.is-portrait:hover img,
.half.is-portrait-desqueeze:hover img {
  transform: scale(1.03);
}

.rush-stage iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: var(--qz-color-bg-deep);
}

.rush-scan {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.36);
}

.rush-scan .stage-scan-pill {
  left: 16px;
  bottom: 16px;
}

.rush-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  color: var(--qz-color-fg-3);
  font-size: 13px;
}

.sheet {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, .76);
  backdrop-filter: blur(3px);
  display: none;
}

.sheet.on {
  display: block;
  animation: fade .18s ease both;
}

.sheet-panel {
  position: absolute;
  inset: 0 0 0 auto;
  width: min(860px, 100%);
  background: var(--qz-color-surface);
  border-left: 1px solid var(--qz-line-strong);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  animation: slide .26s var(--ease) both;
}

.sheet-head {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 20px 24px 0;
}

.tabs {
  display: flex;
  gap: 24px;
}

.tab {
  font: 400 28px/1 var(--qz-font-display);
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--qz-color-fg-4);
  transform: skewX(-8deg);
  padding: 4px 0 10px;
  border-bottom: 2px solid transparent;
}

.tab span {
  font: var(--qz-weight-regular) 13.5px/1 var(--qz-font-sans);
  letter-spacing: .05em;
  margin-left: 8px;
  transform: skewX(8deg);
  display: inline-block;
}

.tab[aria-selected="true"] {
  color: var(--qz-color-accent);
  border-color: var(--qz-color-accent);
}

.tab[aria-selected="true"] span {
  color: var(--qz-color-fg);
}

.close {
  margin-left: auto;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: var(--qz-radius-none);
  color: var(--qz-color-fg-3);
}

.close:hover {
  background: var(--qz-color-surface-hover);
  color: var(--qz-color-accent);
}

.sheet-subbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 24px;
  border-top: 1px solid var(--qz-line-subtle);
  border-bottom: 1px solid var(--qz-line-subtle);
}

.sheet-subtext {
  font-size: 12.5px;
  color: var(--qz-color-fg-4);
}

.sheet-subacts {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sheet-body {
  min-height: 0;
  overflow: hidden;
  padding: 16px 24px 20px;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   Toast & Animations
   ========================================================================== */
.toast {
  max-width: min(640px, calc(100vw - 32px));
  word-break: break-all;
  text-align: center;
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 10px);
  background: var(--qz-color-accent);
  color: var(--qz-color-on-accent);
  padding: 8px 14px;
  border-radius: var(--qz-radius-none);
  font-size: 13px;
  font-weight: var(--qz-weight-bold);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s, transform .22s var(--ease);
  z-index: 80;
}

.toast.on {
  opacity: 1;
  transform: translate(-50%, 0);
}

.spin {
  width: 18px;
  height: 18px;
  border-radius: var(--qz-radius-pill);
  border: 2px solid var(--qz-line-strong);
  border-top-color: var(--qz-color-accent);
  animation: spin .75s linear infinite;
  display: inline-block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .35; }
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slide {
  from { transform: translateX(48px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

@keyframes swap {
  from { transform: skewX(-8deg) translateY(20px); opacity: 0; }
  to { transform: skewX(-8deg); opacity: 1; }
}

@keyframes focusIn {
  0% { opacity: 0; filter: blur(10px) brightness(1.12); transform: scale(1.02); }
  100% { opacity: 1; filter: none; transform: none; }
}

/* ==========================================================================
   Frame-0 Auth Lock (Zero Flash), Top Load Bar & Qizhi DS Initial Skeleton
   ========================================================================== */
body[data-auth-locked="1"] .bar,
body[data-auth-locked="1"] .lib,
body[data-auth-locked="1"] .csheet,
body[data-auth-locked="1"] .app,
body[data-auth-locked="1"] .strip,
body[data-auth-locked="1"] .mobile-tabbar,
body[data-auth-locked="1"] .mobile-menu-sheet,
body[data-auth-locked="1"] .mobile-slot-sheet,
body[data-auth-locked="1"] #topLoadBar {
  display: none !important;
}

body[data-auth-locked="1"] #authGate {
  display: flex !important;
}

@keyframes qscan-v {
  0% { transform: translateY(-100%); }
  100% { transform: translateY(100%); }
}

@keyframes qscan-h {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(250%); }
}

.top-load-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 150;
  pointer-events: none;
  background: var(--qz-accent-10);
  overflow: hidden;
  opacity: 0;
  transition: opacity .2s ease;
}

.top-load-bar.is-active {
  opacity: 1;
}

.top-load-bar.is-active::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 38%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(163, 255, 18, 0.25) 60%,
    var(--qz-color-accent) 95%,
    transparent 100%
  );
  will-change: transform;
  animation: qscan-h 1.15s linear infinite;
}

.sk-bar,
.sk-half {
  position: relative;
  overflow: hidden;
  background: var(--qz-color-surface);
  border-radius: var(--qz-radius-none);
}

.sk-bar::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 45%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(163, 255, 18, 0.08) 55%,
    rgba(163, 255, 18, 0.34) 94%,
    transparent 100%
  );
  transform: translateX(-100%);
  will-change: transform;
  animation: qscan-h 1.4s linear infinite;
}

.sk-half::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(163, 255, 18, 0.03) 62%,
    rgba(163, 255, 18, 0.14) 97%,
    rgba(163, 255, 18, 0.65) 99%,
    transparent 100%
  );
  transform: translateY(-100%);
  will-change: transform;
  animation: qscan-v 1.35s linear infinite;
}

.admin-scan-row td {
  padding: 12px !important;
}

.admin-scan-bars {
  display: grid;
  grid-template-columns: 2fr 1.2fr 0.8fr 0.7fr 1fr 1.4fr;
  gap: 12px;
  align-items: center;
}

.admin-scan-bars .sk-bar {
  width: 100%;
  height: 11px;
}

.sk-tree {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 6px 4px;
}

.sk-tree-ep,
.sk-tree-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sk-tree-ep {
  padding: 5px 6px;
  margin-top: 4px;
}

.sk-tree-ep .sk-bar {
  height: 11px;
}

.sk-tree-row {
  padding: 5px 6px 5px 18px;
}

.sk-tree-row .sk-bar {
  height: 10px;
}

.sk-scene-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transform: skewX(-8deg);
}

.sk-h-ep {
  width: 58px;
  height: 22px;
  display: inline-block;
  border: 1px solid var(--qz-accent-20);
}

.sk-h-sc {
  width: 84px;
  height: 22px;
  display: inline-block;
  border: 1px solid var(--qz-line-subtle);
}

.sk-shot {
  pointer-events: none;
}

.sk-half {
  border: 1px solid var(--qz-line-subtle);
}

.sk-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 24px;
}

.sk-meta .sk-bar {
  height: 11px;
}

.sk-bar {
  display: inline-block;
  height: 10px;
}

.sk-w-14 { width: 14%; }
.sk-w-16 { width: 16%; }
.sk-w-22 { width: 24%; }
.sk-w-36 { width: 36%; }
.sk-w-40 { width: 40%; }
.sk-w-44 { width: 44%; }
.sk-w-46 { width: 46%; }
.sk-w-48 { width: 48%; }
.sk-w-52 { width: 52%; }
.sk-w-56 { width: 56%; }

@media (prefers-reduced-motion: reduce) {
  .top-load-bar::after,
  .sk-bar::after,
  .sk-half::after,
  .half.is-loading::before,
  .csheet-tile.is-loading::before,
  .frame.is-loading::before,
  .stage-scan::before,
  .rush-scan::before,
  .stage-scan-pill::before {
    animation: none;
  }
}

/* ==========================================================================
   Qizhi DS Full-Screen Access Gate
   ========================================================================== */
.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 120;
  background-color: var(--qz-color-bg);
  background-image:
    linear-gradient(var(--qz-accent-06) 1px, transparent 1px),
    linear-gradient(90deg, var(--qz-accent-06) 1px, transparent 1px),
    radial-gradient(60% 50% at 50% 42%, var(--qz-accent-10) 0%, transparent 70%);
  background-size: 42px 42px, 42px 42px, 100% 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: min(380px, 100%);
  background: var(--qz-color-surface);
  border: 1px solid var(--qz-line-strong);
  border-top: 2px solid var(--qz-color-accent);
  border-radius: var(--qz-radius-none);
  padding: 28px 26px 26px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, .82);
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-oauth {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: -8px;
}

.auth-or {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--qz-color-fg-5);
  font: 400 11.5px/1 var(--qz-font-sans);
  letter-spacing: .06em;
}

.auth-or::before,
.auth-or::after {
  content: "";
  flex: 1 1 0;
  height: 1px;
  background: var(--qz-line-subtle);
}

.auth-feishu-btn {
  width: 100%;
  height: 40px;
  gap: 8px;
  background: var(--qz-color-bg);
  border-color: var(--qz-line-strong);
  color: var(--qz-color-fg);
  font-size: 13px;
  font-weight: var(--qz-weight-medium);
  letter-spacing: .03em;
}

.auth-feishu-btn:hover {
  border-color: var(--qz-color-accent);
  background: var(--qz-accent-07);
  color: var(--qz-color-accent);
}

.auth-feishu-ico {
  color: #3370ff;
  flex: none;
  transition: color .14s;
}

.auth-feishu-btn:hover .auth-feishu-ico {
  color: var(--qz-color-accent);
}

.auth-input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  background: var(--qz-color-bg);
  border: 1px solid var(--qz-line-strong);
  border-radius: var(--qz-radius-none);
  color: var(--qz-color-fg);
  font: 400 14px var(--qz-font-mono);
  letter-spacing: .06em;
  outline: none;
  transition: border-color .14s;
}

.auth-input::placeholder {
  font-family: var(--qz-font-sans);
  letter-spacing: .04em;
  color: var(--qz-color-fg-5);
}

.auth-input:focus {
  border-color: var(--qz-color-accent);
}

.auth-otp-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.auth-code-input {
  letter-spacing: .24em;
  font-variant-numeric: tabular-nums;
}

.auth-otp-btn {
  height: 40px;
  padding: 0 14px;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  min-width: 104px;
}

.auth-info {
  padding: 8px 10px;
  background: var(--qz-accent-09);
  border: 1px solid var(--qz-accent-35);
  border-radius: var(--qz-radius-none);
  color: var(--qz-color-accent);
  font-size: 12.5px;
  line-height: 1.4;
}

.auth-error {
  padding: 8px 10px;
  background: var(--qz-err-bg);
  border: 1px solid var(--qz-err-line);
  border-radius: var(--qz-radius-none);
  color: var(--qz-err);
  font-size: 12.5px;
  line-height: 1.4;
}

.auth-submit {
  width: 100%;
  height: 38px;
  font-size: 13.5px;
  letter-spacing: .1em;
}

/* ==========================================================================
   Admin Button & Slide-Over Admin Sheet (Qizhi DS · strictly is_admin only)
   ========================================================================== */
.navbtn-admin {
  border-color: var(--qz-accent-35);
  background: var(--qz-accent-07);
  color: var(--qz-color-accent);
}

.navbtn-admin:hover:not(:disabled) {
  border-color: var(--qz-color-accent);
  background: var(--qz-accent-16);
  color: var(--qz-color-accent);
}

.admin-sheet-panel {
  width: min(940px, 100%);
}

.admin-body {
  overflow-y: auto;
  gap: 18px;
  padding: 18px 24px 28px;
}

.admin-error {
  padding: 9px 12px;
  background: var(--qz-err-bg);
  border: 1px solid var(--qz-err-line);
  border-radius: var(--qz-radius-none);
  color: var(--qz-err);
  font-size: 12.5px;
  line-height: 1.45;
  flex: none;
}

.admin-sec {
  background: var(--qz-color-bg);
  border: 1px solid var(--qz-line-strong);
  border-radius: var(--qz-radius-none);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: none;
}

.admin-sec-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.admin-sec-h h3 {
  margin: 0;
  font: var(--qz-weight-bold) 13px/1 var(--qz-font-sans);
  letter-spacing: .08em;
  color: var(--qz-color-fg);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.admin-sec-h h3::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--qz-color-accent);
  display: inline-block;
}

.admin-pass-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-pill {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border: 1px solid var(--qz-line-strong);
  border-radius: var(--qz-radius-none);
  font: 400 11px/1 var(--qz-font-mono);
  color: var(--qz-color-fg-3);
  background: var(--qz-color-surface);
}

.admin-pill.is-set {
  border-color: var(--qz-accent-45);
  color: var(--qz-color-accent);
  background: var(--qz-accent-09);
}

.admin-ts,
.admin-sec-cnt {
  font: 400 11.5px/1 var(--qz-font-mono);
  color: var(--qz-color-fg-4);
}

.admin-input {
  height: 34px;
  padding: 0 10px;
  background: var(--qz-color-surface);
  border: 1px solid var(--qz-line-strong);
  border-radius: var(--qz-radius-none);
  color: var(--qz-color-fg);
  font: 400 12.5px/1 var(--qz-font-mono);
  outline: none;
  min-width: 0;
  transition: border-color .14s;
}

.admin-input::placeholder {
  font-family: var(--qz-font-sans);
  color: var(--qz-color-fg-5);
}

.admin-input:focus {
  border-color: var(--qz-color-accent);
}

.admin-pass-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.admin-pass-row .admin-input {
  flex: 1 1 220px;
}

.admin-pass-row .btn,
.admin-pass-row .btn-accent {
  height: 34px;
}

.admin-revoke-chk {
  margin: 0 4px;
}

.admin-pass-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  background: var(--qz-accent-09);
  border: 1px solid var(--qz-color-accent);
  border-radius: var(--qz-radius-none);
}

.admin-pass-banner-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.admin-pass-banner-lbl {
  font-size: 11.5px;
  color: var(--qz-color-fg-3);
  letter-spacing: .04em;
}

.admin-pass-code {
  font: 700 15px/1.2 var(--qz-font-mono);
  letter-spacing: .08em;
  color: var(--qz-color-accent);
  word-break: break-all;
}

.admin-pass-banner-acts {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}

.admin-add-form {
  display: grid;
  grid-template-columns: minmax(190px, 1.5fr) minmax(90px, 0.8fr) minmax(150px, 1.1fr) auto;
  gap: 8px;
  align-items: center;
}

.admin-add-form .btn-accent {
  height: 34px;
  padding: 0 16px;
}

.admin-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--qz-line);
  background: var(--qz-color-surface);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.admin-table th {
  text-align: left;
  padding: 9px 10px;
  font: var(--qz-weight-regular) 11px/1 var(--qz-font-sans);
  letter-spacing: .06em;
  color: var(--qz-color-fg-4);
  background: var(--qz-color-bg);
  border-bottom: 1px solid var(--qz-line-strong);
  white-space: nowrap;
}

.admin-table th.col-acts {
  text-align: right;
}

.admin-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--qz-line-subtle);
  color: var(--qz-color-fg-2);
  vertical-align: middle;
}

.admin-table tr:last-child td {
  border-bottom: 0;
}

.admin-table tr.is-disabled td {
  opacity: .56;
}

.admin-table tr.is-editing td {
  background: var(--qz-color-surface-raise);
}

.admin-email-cell {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font: 400 12.5px/1.2 var(--qz-font-mono);
  color: var(--qz-color-fg);
  white-space: nowrap;
}

.admin-badge-admin {
  display: inline-flex;
  align-items: center;
  height: 17px;
  padding: 0 5px;
  background: var(--qz-color-accent);
  color: var(--qz-color-on-accent);
  border-radius: var(--qz-radius-none);
  font: 700 10px/1 var(--qz-font-mono);
  letter-spacing: .06em;
}

.admin-note-cell {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--qz-color-fg-3);
}

.admin-tag {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--qz-radius-none);
  font-size: 11px;
  white-space: nowrap;
}

.admin-tag-team {
  border: 1px solid var(--qz-line);
  color: var(--qz-color-fg-4);
  background: var(--qz-color-bg);
}

.admin-tag-personal {
  border: 1px solid var(--qz-accent-45);
  color: var(--qz-color-accent);
  background: var(--qz-accent-09);
}

.admin-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  white-space: nowrap;
}

.admin-status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: var(--qz-radius-pill);
  display: inline-block;
}

.admin-status-on {
  color: var(--qz-mint);
}

.admin-status-on::before {
  background: var(--qz-color-accent);
}

.admin-status-off {
  color: var(--qz-warn);
}

.admin-status-off::before {
  background: var(--qz-warn);
}

.admin-login-ts {
  font: 400 11.5px/1 var(--qz-font-mono);
  color: var(--qz-color-fg-4);
  white-space: nowrap;
}

.admin-row-acts {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  white-space: nowrap;
}

.admin-act-btn {
  height: 24px;
  padding: 0 7px;
  border: 1px solid var(--qz-line-strong);
  border-radius: var(--qz-radius-none);
  background: var(--qz-color-bg);
  color: var(--qz-color-fg-3);
  font-size: 11.5px;
  transition: border-color .12s, color .12s, background .12s;
}

.admin-act-btn:hover:not(:disabled) {
  border-color: var(--qz-accent-45);
  color: var(--qz-color-accent);
  background: var(--qz-accent-07);
}

.admin-act-btn.is-active {
  border-color: var(--qz-color-accent);
  color: var(--qz-color-accent);
  background: var(--qz-accent-16);
}

.admin-act-btn.is-danger:hover:not(:disabled) {
  border-color: var(--qz-err-line);
  color: var(--qz-err);
  background: var(--qz-err-bg);
}

.admin-act-btn.is-confirming,
.btn.is-confirming,
.btn-accent.is-confirming {
  border-color: var(--qz-err) !important;
  background: var(--qz-err-bg) !important;
  color: var(--qz-err) !important;
  font-weight: var(--qz-weight-bold);
}

.admin-edit-row td {
  padding: 10px 12px;
  background: var(--qz-color-bg);
  border-top: 1px solid var(--qz-accent-30);
  border-bottom: 1px solid var(--qz-accent-30);
}

.admin-inline-editor {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.admin-inline-lbl {
  font: 400 11.5px/1 var(--qz-font-mono);
  color: var(--qz-color-accent);
  white-space: nowrap;
}

.admin-inline-editor .admin-input {
  flex: 1 1 200px;
  height: 30px;
}

.admin-empty-td {
  text-align: center;
  padding: 20px 10px !important;
  color: var(--qz-color-fg-4);
}

.admin-events-fold {
  background: var(--qz-color-bg);
  border: 1px solid var(--qz-line);
  border-radius: var(--qz-radius-none);
  flex: none;
}

.admin-events-fold summary {
  padding: 11px 16px;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--qz-color-fg-2);
  user-select: none;
}

.admin-events-fold summary::-webkit-details-marker {
  display: none;
}

.admin-events-fold summary:hover {
  color: var(--qz-color-accent);
}

.admin-events-list {
  border-top: 1px solid var(--qz-line-subtle);
  max-height: 240px;
  overflow-y: auto;
  padding: 6px 0;
}

.admin-event-item {
  display: grid;
  grid-template-columns: 96px 120px minmax(140px, 1fr) minmax(120px, 1.2fr);
  gap: 10px;
  align-items: center;
  padding: 6px 16px;
  border-bottom: 1px solid var(--qz-line-subtle);
  font-size: 11.5px;
}

.admin-event-item:last-child {
  border-bottom: 0;
}

.admin-ev-ts {
  font-family: var(--qz-font-mono);
  color: var(--qz-color-fg-5);
  white-space: nowrap;
}

.admin-ev-type {
  font-family: var(--qz-font-mono);
  color: var(--qz-color-accent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-ev-type.is-fail {
  color: var(--qz-err);
}

.admin-ev-email {
  font-family: var(--qz-font-mono);
  color: var(--qz-color-fg-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-ev-detail {
  color: var(--qz-color-fg-4);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-events-empty {
  padding: 14px 16px;
  font-size: 12px;
  color: var(--qz-color-fg-5);
}

/* ==========================================================================
   Shared Grouped Slot Picker (Desktop Popover > 768px · Mobile Bottom Sheet <= 768px)
   ========================================================================== */
.mobile-slot-sheet {
  display: flex;
  flex-direction: column;
  position: fixed;
  width: 452px;
  max-width: calc(100vw - 24px);
  max-height: 70dvh;
  z-index: 85;
  background: #0c0f0d;
  border: 1px solid var(--qz-accent-45);
  border-top: 2px solid var(--qz-color-accent);
  box-shadow: 0 20px 56px rgba(0, 0, 0, 0.84);
}

.mobile-slot-sheet .mslot-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 40px;
  padding: 0 8px 0 14px;
  background: var(--qz-color-bg);
  border-bottom: 1px solid var(--qz-line-subtle);
  flex: none;
}

.mslot-sheet-head .drawer-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: var(--qz-weight-bold) 12.5px/1 var(--qz-font-sans);
  letter-spacing: .06em;
  color: var(--qz-color-fg);
}

.mslot-sheet-head .close {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  color: var(--qz-color-fg-3);
}

.mslot-sheet-head .close:hover {
  color: var(--qz-color-accent);
}

.mslot-sheet-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 10px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.mslot-sheet-sec {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.mslot-sheet-sec-lbl {
  font: 400 10px/1 var(--qz-font-mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--qz-color-fg-5);
}

.mslot-sheet-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

.mslot-sheet-opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 36px;
  padding: 0 10px;
  background: var(--qz-color-surface);
  border: 1px solid var(--qz-line);
  border-radius: var(--qz-radius-none);
  color: var(--qz-color-fg-2);
  font-size: 12.5px;
  font-weight: var(--qz-weight-regular);
  text-align: left;
  min-width: 0;
  transition: background .12s, border-color .12s, color .12s;
}

.mslot-sheet-opt:hover {
  background: var(--qz-color-surface-hover);
  border-color: var(--qz-accent-45);
  color: var(--qz-color-fg);
}

.mslot-sheet-opt.is-full {
  grid-column: 1 / -1;
}

.mslot-sheet-opt.is-empty {
  opacity: .42;
}

.mslot-sheet-opt[aria-pressed="true"] {
  background: var(--qz-accent-16);
  border-color: var(--qz-color-accent);
  color: var(--qz-color-accent);
  font-weight: var(--qz-weight-bold);
  opacity: 1;
}

.mslot-sheet-opt-lbl {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.mslot-sheet-opt-cnt {
  font: 400 11px/1 var(--qz-font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--qz-color-fg-4);
  flex: none;
}

.mslot-sheet-opt[aria-pressed="true"] .mslot-sheet-opt-cnt {
  color: var(--qz-color-accent);
}

/* ==========================================================================
   Mobile-Only Structural Defaults (Hidden on Desktop > 768px / 900px)
   ========================================================================== */
.mobile-search-btn,
.mobile-menu-btn,
.mobile-tabbar,
.mobile-menu-sheet,
.mcol-seg,
.mcol-toggle-btn,
.lib-slot-mob-btn,
.gsearch-close,
.drawer-head,
.lib-filter-btn,
.csheet-filter-btn,
.viewer-mbar,
.viewer-mactions,
.mobile-backdrop,
.qsel-sheet-head {
  display: none;
}

.mobile-search-btn {
  position: relative;
}

.mobile-dot {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 6px;
  height: 6px;
  background: var(--qz-color-accent);
  border-radius: var(--qz-radius-none);
}

.ov-blink-btn {
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

@keyframes sheetUp {
  from {
    transform: translateY(28px);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

/* ==========================================================================
   Responsive (Desktop Compact -> Tablet -> Phone Portrait & Landscape)
   ========================================================================== */
@media (max-width: 1440px) {
  .lib-top-meta,
  .csheet-bar { padding-left: 20px; padding-right: 20px; }
  .scene { padding-left: 20px; padding-right: 20px; }
  .pipe-btn { padding: 0 8px; font-size: 12px; }
}

@media (max-width: 1360px) {
  :root { --rail: 316px; }
  .mode { padding: 0 10px; }
  .nav-sep { margin: 0 6px; }
  .gsearch { width: 196px; }
  .nav-user-txt { max-width: 112px; }
  .slate, .block, .rail-slots-block, .tools.is-in-rail { padding-left: 16px; padding-right: 16px; }
  .lib-top-meta,
  .csheet-bar { padding-left: 16px; padding-right: 16px; }
  .scene { padding-left: 16px; padding-right: 16px; }
  .lib-banner { margin-left: 16px; margin-right: 16px; }
  .qsel-sm { max-width: 142px; }
  .qsel-xs { width: 132px; }
  .cols-range { width: 108px; }
  .pipe-btn { padding: 0 7px; gap: 4px; font-size: 12px; }
  .pipe-sep { margin: 0 4px; }
  .tools-seg button { padding: 4px 5px; font-size: 10.5px; }
  .cmp-pick .dsel-xs { max-width: 132px; font-size: 11px; }
}

@media (max-width: 1220px) {
  :root { --rail: 304px; }
  .gsearch { width: 176px; }
  .nav-user-txt { max-width: 92px; }
  .tools-keys { display: none; }
  .lib-top-meta .lib-count { display: none; }
}

/* ── Tablet Landscape / Compact Desktop (<= 1060px) ── */
@media (max-width: 1060px) {
  :root { --rail: 280px; }
  .bar {
    gap: 12px;
    padding: 0 14px;
  }
  .mark-en { font-size: 20px; }
  .mode {
    padding: 0 10px;
    font-size: 13px;
  }
  .mode span { font-size: 13px; }
  .gsearch { width: 168px; padding: 0 8px 0 9px; }
  .gsearch kbd { display: none; }
  .navbtn:not(.navbtn-icon) { padding: 0 8px; }
  .lib-scope { display: none; }
  .lib-slot-mob-btn { display: inline-flex; }
  .nav-user-txt { max-width: 76px; }
  body.mode-lib .lib { grid-template-columns: 252px minmax(0, 1fr); }
  .lib-filter { padding: 14px; gap: 12px; }
  .tree-heading { padding: 12px 14px 6px; }
  .cols-range { width: 88px; }
  .strip-side { width: 184px; padding: 8px; }
  .frame { width: 108px; height: 61px; }
}

/* ── Tablet Portrait & Mobile Shared Drawer / Single-Column Stage (<= 900px) ── */
@media (max-width: 900px) {
  .bar {
    gap: 10px;
    padding: 0 12px;
  }

  .mark-en {
    font-size: 19px;
  }

  .mode {
    padding: 0 10px;
    font-size: 13px;
    gap: 4px;
  }

  .gsearch {
    width: 136px;
  }

  .user-menu-btn {
    padding: 0 6px 0 4px;
    gap: 4px;
  }

  .nav-user-txt {
    display: none;
  }

  .mobile-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 60;
    background: rgba(0, 0, 0, 0.74);
    backdrop-filter: blur(3px);
    animation: fade .16s ease both;
  }

  .drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex: none;
    height: 48px;
    padding: 0 10px 0 16px;
    background: var(--qz-color-bg);
    border-bottom: 1px solid var(--qz-line-strong);
  }

  .drawer-title {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font: var(--qz-weight-bold) 13.5px/1 var(--qz-font-sans);
    letter-spacing: .06em;
    color: var(--qz-color-fg);
  }

  .drawer-head .close {
    width: 38px;
    height: 38px;
  }

  /* Library: Left Slide-Over Filter & Scene Drawer */
  body.mode-lib .lib {
    grid-template-columns: minmax(0, 1fr);
  }

  .lib-nav {
    display: flex;
    position: fixed;
    inset: 0 auto 0 0;
    width: min(332px, 88vw);
    max-width: 100vw;
    z-index: 65;
    border-right: 1px solid var(--qz-accent-35);
    box-shadow: 24px 0 64px rgba(0, 0, 0, 0.86);
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    transform: translateX(-104%);
    visibility: hidden;
    pointer-events: none;
    transition: transform .24s var(--ease), visibility .24s;
  }

  .lib-nav.is-open {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
  }

  .lib-nav .lib-filter {
    max-height: 56%;
    padding: 14px 16px;
  }

  .lib-nav .ftile {
    padding: 10px;
  }

  .lib-nav .sc-b {
    min-height: 36px;
    padding: 8px 10px 8px 18px;
  }

  .lib-nav .ep-h {
    min-height: 38px;
  }

  .lib-filter-btn {
    display: inline-flex;
    height: 32px;
    padding: 0 10px;
    gap: 6px;
    flex: none;
    background: var(--qz-color-surface);
  }

  .lib-filter-btn.has-active {
    border-color: var(--qz-accent-45);
    background: var(--qz-accent-09);
    color: var(--qz-color-accent);
  }

  .lib-filter-btn .nav-badge,
  .csheet-filter-btn .nav-badge {
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    font-size: 10px;
  }

  .qsel-jump {
    display: inline-flex;
    flex: 0 1 164px;
    min-width: 110px;
    max-width: 180px;
  }

  /* Single-Row Horizontal Scrollable Pipeline Bar (Library & Sheet) */
  .pipe-bar {
    -webkit-overflow-scrolling: touch;
    gap: 1px;
  }

  .lib-top-pipe,
  .csheet-pipe {
    padding-top: 0;
    padding-bottom: 0;
  }

  .scene-h {
    position: static;
    padding: 18px 0 12px;
    margin-bottom: 10px;
  }

  .scene-h h2 {
    font-size: 36px;
  }

  .scene-h .scene-loc {
    font-size: 17px;
    padding-bottom: 3px;
  }

  /* Viewer: Full-Width Stage + Slide-Over Shot Inspector Drawer */
  .app {
    grid-template-columns: minmax(0, 1fr);
  }

  .main {
    grid-template-rows: auto minmax(0, 1fr) auto auto;
  }

  .rail {
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 0 0 auto;
    width: min(372px, 92vw);
    max-width: 100vw;
    z-index: 65;
    border-right: 0;
    border-left: 1px solid var(--qz-accent-35);
    box-shadow: -24px 0 64px rgba(0, 0, 0, 0.88);
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    transform: translateX(104%);
    visibility: hidden;
    pointer-events: none;
    transition: transform .24s var(--ease), visibility .24s;
  }

  .rail.is-open {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
  }

  .rail .rail-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .rail .slate {
    padding: 16px 16px 14px;
  }

  .rail .rail-slots-block {
    padding: 14px 16px;
  }

  .rail .slate-id {
    font-size: 40px;
  }

  .rail .slate-id.mid {
    font-size: 32px;
  }

  .rail .slate-id.sm {
    font-size: 26px;
  }

  .rail .fswap-row button {
    min-height: 32px;
    padding: 6px 10px;
    font-size: 12px;
  }

  .rail .rail-link-btn {
    height: 36px;
  }

  /* Viewer Mobile Compact Shot Header Bar */
  .viewer-mbar {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 44px;
    padding: 0 12px 0 6px;
    background: var(--qz-color-bg);
    border-bottom: 1px solid var(--qz-line-subtle);
    min-width: 0;
  }

  .vmbar-back {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    flex: none;
    color: var(--qz-color-fg-2);
    border-radius: var(--qz-radius-none);
  }

  .vmbar-back:active {
    background: var(--qz-color-surface-hover);
    color: var(--qz-color-accent);
  }

  .vmbar-shot {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
    flex: 1 1 auto;
    height: 34px;
    padding: 0 2px;
    text-align: left;
    overflow: hidden;
  }

  .vmbar-shot b {
    font: 400 20px/1 var(--qz-font-display);
    letter-spacing: .02em;
    transform: skewX(-8deg);
    display: inline-flex;
    align-items: center;
    text-box-trim: trim-both;
    text-box-edge: cap alphabetic;
    color: var(--qz-color-fg);
    white-space: nowrap;
    flex: none;
  }

  .vmbar-scene {
    font: 400 11.5px/1 var(--qz-font-mono);
    color: var(--qz-color-accent);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .vmbar-idx {
    font-style: normal;
    font: 400 11px/1 var(--qz-font-mono);
    color: var(--qz-color-fg-4);
    white-space: nowrap;
    flex: none;
  }

  .vmbar-acts {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: none;
  }

  .vmbar-rush {
    height: 30px;
    padding: 0 10px;
    border-color: var(--qz-accent-45);
    background: var(--qz-accent-09);
    color: var(--qz-color-accent);
    font-size: 11.5px;
    line-height: 1;
  }

  .vmbar-rush[aria-pressed="true"] {
    background: var(--qz-color-accent);
    border-color: var(--qz-color-accent);
    color: var(--qz-color-on-accent);
    font-weight: var(--qz-weight-bold);
  }

  .vmbar-info-btn {
    height: 30px;
    padding: 0 10px;
    background: var(--qz-color-surface);
    color: var(--qz-color-fg);
    font-size: 12px;
    line-height: 1;
  }

  /* Viewer Unified Mobile Bottom Action Bar (1-Tap Slots + Pinned Compare Toggle) */
  .viewer-mactions {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 40px;
    padding: 0 8px;
    background: var(--qz-color-bg);
    border-top: 1px solid var(--qz-line-subtle);
    min-width: 0;
  }

  .viewer-mslots {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    gap: 4px;
    height: 100%;
    padding-right: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    min-width: 0;
    -webkit-mask-image: linear-gradient(to right, #000 0%, #000 92%, transparent 100%);
    mask-image: linear-gradient(to right, #000 0%, #000 92%, transparent 100%);
  }

  .viewer-mslots::-webkit-scrollbar {
    display: none;
  }

  .vmact-cmp-btn {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 28px;
    padding: 0 9px;
    background: var(--qz-color-surface);
    border: 1px solid var(--qz-line-strong);
    color: var(--qz-color-fg-2);
    font-size: 11.5px;
    line-height: 1;
    white-space: nowrap;
  }

  .vmact-cmp-btn[aria-pressed="true"] {
    border-color: var(--qz-color-accent);
    background: var(--qz-accent-16);
    color: var(--qz-color-accent);
    font-weight: var(--qz-weight-bold);
  }

  .vmact-cmp-btn:disabled {
    opacity: .3;
    pointer-events: none;
  }

  /* On Tablet/Phone, hide .tools completely in Single mode (Compare button toggles it on demand) */
  .tools:not(.is-comparing) {
    display: none !important;
  }

  .tools.is-comparing {
    position: static;
    pointer-events: auto;
  }

  .mslot-btn {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 28px;
    padding: 0 10px;
    border: 1px solid var(--qz-line-subtle);
    border-radius: var(--qz-radius-none);
    background: var(--qz-color-surface);
    color: var(--qz-color-fg-2);
    font-size: 11.5px;
    font-weight: var(--qz-weight-regular);
    line-height: 1;
    white-space: nowrap;
    transition: background .12s, border-color .12s, color .12s;
  }

  .mslot-btn[aria-pressed="true"] {
    background: var(--qz-accent-16);
    border-color: var(--qz-color-accent);
    color: var(--qz-color-accent);
    box-shadow: inset 0 -2px 0 var(--qz-color-accent);
    font-weight: var(--qz-weight-bold);
  }

  .mslot-btn.is-cmp {
    border-color: var(--qz-accent-35);
    color: var(--qz-color-fg);
  }

  .mslot-ab {
    display: inline-grid;
    place-items: center;
    width: 14px;
    height: 14px;
    font: 700 9.5px/1 var(--qz-font-mono);
    border-radius: var(--qz-radius-none);
  }

  .mslot-ab.is-a {
    background: var(--qz-color-accent);
    color: var(--qz-color-on-accent);
  }

  .mslot-ab.is-b {
    border: 1px solid var(--qz-accent-60);
    color: var(--qz-color-accent);
  }

  /* Bigger Curtain Touch Target */
  .curtain-divider::before {
    left: -22px;
    right: -22px;
  }

  .curtain-handle {
    width: 34px;
    height: 42px;
    font-size: 13px;
  }

  /* Admin Form Responsive */
  .admin-add-form {
    grid-template-columns: 1fr;
  }

  .admin-event-item {
    grid-template-columns: 86px 1fr;
  }
}

/* ── Phone Layout (<= 768px) ── */
@media (max-width: 768px) {
  body {
    grid-template-rows: auto minmax(0, 1fr) auto;
  }

  body.mode-lib .lib,
  body.mode-sheet .csheet {
    grid-row: 2 / 3;
  }

  /* Viewer on Phone: single clean top shot bar + persistent Bottom Tab Bar below filmstrip */
  body:not(.mode-lib):not(.mode-sheet) {
    grid-template-rows: minmax(0, 1fr) auto auto;
  }

  body:not(.mode-lib):not(.mode-sheet) .bar {
    display: none !important;
  }

  body:not(.mode-lib):not(.mode-sheet) .app {
    grid-row: 1 / 2;
  }

  body:not(.mode-lib):not(.mode-sheet) .strip {
    grid-row: 2 / 3;
    padding-bottom: 0;
  }

  body:not(.mode-lib):not(.mode-sheet) .mobile-tabbar {
    grid-row: 3 / 4;
  }

  body:not(.mode-lib):not(.mode-sheet) .viewer-mbar {
    padding-top: env(safe-area-inset-top, 0px);
    height: calc(46px + env(safe-area-inset-top, 0px));
    background: var(--qz-color-surface);
    border-bottom: 1px solid var(--qz-line);
  }

  /* Prevent iOS Safari input auto-zoom */
  input[type="text"],
  input[type="search"],
  input[type="email"],
  input[type="password"] {
    font-size: 16px;
  }

  /* Ultra-Clean Single-Row 48px Mobile App Header (Library & Sheet) */
  .bar {
    position: relative;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 4px;
    height: calc(48px + env(safe-area-inset-top, 0px));
    padding: env(safe-area-inset-top, 0px) 10px 0 12px;
    border-bottom: 1px solid var(--qz-line-subtle);
  }

  .bar nav {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    flex: none;
  }

  .mark {
    height: 48px;
    gap: 8px;
    padding: 0;
    min-width: 0;
  }

  .qz-reel-mark {
    width: 8px;
    height: 8px;
  }

  .mark-en {
    font-size: 19px;
    letter-spacing: .02em;
  }

  /* Desktop header controls moved cleanly to Bottom Tab Bar & Mobile Menu Sheet */
  .bar .modes,
  .bar .nav-sep,
  .bar .lang-seg,
  .bar .user-menu-wrap,
  .bar .gsearch {
    display: none;
  }

  .mobile-search-btn,
  .mobile-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    color: var(--qz-color-fg-2);
    border: 1px solid transparent;
    border-radius: var(--qz-radius-none);
    flex: none;
  }

  .mobile-search-btn:active,
  .mobile-menu-btn:active,
  .mobile-menu-btn[aria-expanded="true"] {
    background: var(--qz-color-surface-hover);
    border-color: var(--qz-accent-45);
    color: var(--qz-color-accent);
  }

  .mobile-search-btn.has-query {
    color: var(--qz-color-accent);
  }

  .mmenu-btn-avatar {
    width: 26px;
    height: 26px;
  }

  /* Native Mobile Bottom Tab Bar (Library / Sheet / Viewer) */
  .mobile-tabbar {
    display: grid;
    grid-row: 3;
    grid-template-columns: repeat(3, 1fr);
    background: var(--qz-color-surface);
    border-top: 1px solid var(--qz-line-strong);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    z-index: 15;
  }

  .mtab {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 52px;
    color: var(--qz-color-fg-4);
    font: var(--qz-weight-regular) 11px/1 var(--qz-font-sans);
    letter-spacing: .05em;
    transition: color .14s, background .14s;
  }

  .mtab svg {
    flex: none;
  }

  .mtab:active {
    background: var(--qz-color-surface-hover);
  }

  .mtab[aria-pressed="true"] {
    color: var(--qz-color-accent);
    background: var(--qz-accent-06);
    font-weight: var(--qz-weight-bold);
  }

  .mtab[aria-pressed="true"]::before {
    content: "";
    position: absolute;
    top: 0;
    left: 22%;
    right: 22%;
    height: 2px;
    background: var(--qz-color-accent);
  }

  /* Qizhi DS Mobile Menu Bottom Sheet */
  .mobile-menu-sheet {
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 70;
    max-height: 80dvh;
    background: #0c0f0d;
    border-top: 2px solid var(--qz-color-accent);
    box-shadow: 0 -18px 54px rgba(0, 0, 0, 0.86);
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    animation: sheetUp .2s var(--ease) both;
  }

  .mmenu-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 8px 14px 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .mmenu-account {
    padding: 10px 12px;
    background: var(--qz-color-surface);
    border: 1px solid var(--qz-line-strong);
  }

  .mmenu-account-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
  }

  .mmenu-email {
    flex: 1 1 auto;
    min-width: 0;
    font: 500 14.5px/1.25 var(--qz-font-sans);
    letter-spacing: .02em;
    color: var(--qz-color-fg);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mmenu-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 46px;
    padding: 8px 12px;
    background: var(--qz-color-surface);
    border: 1px solid var(--qz-line);
  }

  .mmenu-row-lbl {
    font-size: 13.5px;
    font-weight: var(--qz-weight-regular);
    color: var(--qz-color-fg-2);
  }

  .mmenu-lang-seg {
    height: 32px;
  }

  .mmenu-lang-seg button {
    padding: 0 12px;
    font-size: 12px;
  }

  .mmenu-action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    min-height: 48px;
    padding: 0 12px;
    background: var(--qz-color-surface);
    border: 1px solid var(--qz-line);
    color: var(--qz-color-fg);
    font-size: 13.5px;
    font-weight: var(--qz-weight-regular);
    text-align: left;
    transition: background .12s, border-color .12s, color .12s;
  }

  .mmenu-action:active:not(:disabled) {
    background: var(--qz-color-surface-hover);
    border-color: var(--qz-accent-45);
  }

  .mmenu-action:disabled {
    opacity: .5;
  }

  .mmenu-action.is-loading .sync-svg {
    animation: spin .85s linear infinite;
    color: var(--qz-color-accent);
  }

  .mmenu-act-left {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
  }

  .mmenu-act-meta {
    font: 400 11.5px/1 var(--qz-font-mono);
    color: var(--qz-color-fg-4);
    flex: none;
  }

  .mmenu-action-admin {
    border-color: var(--qz-accent-30);
    background: var(--qz-accent-06);
  }

  .mmenu-action-admin .mmenu-act-left svg {
    color: var(--qz-color-accent);
  }

  .mmenu-chev {
    color: var(--qz-color-fg-4);
    flex: none;
  }

  .mmenu-action-logout {
    color: var(--qz-err);
    border-color: var(--qz-err-line);
    background: var(--qz-err-bg);
  }

  /* Mobile Grouped Slot Picker Bottom Sheet (Overrides Desktop Popover) */
  .mobile-slot-sheet {
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    bottom: 0 !important;
    width: 100% !important;
    max-width: 100vw !important;
    max-height: 76dvh;
    z-index: 70;
    border: 0;
    border-top: 2px solid var(--qz-color-accent);
    box-shadow: 0 -18px 54px rgba(0, 0, 0, 0.86);
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    animation: sheetUp .2s var(--ease) both;
  }

  .mslot-sheet-opt {
    min-height: 40px;
  }

  /* Mobile Full-Width Search Overlay inside Header */
  .bar.is-search-open .gsearch {
    display: flex;
    position: absolute;
    top: env(safe-area-inset-top, 0px);
    left: 0;
    right: 0;
    height: 48px;
    width: auto;
    margin: 0;
    padding: 0 6px 0 12px;
    z-index: 30;
    background: var(--qz-color-surface);
    border: 0;
    border-bottom: 2px solid var(--qz-color-accent);
    color: var(--qz-color-fg-2);
  }

  .bar.is-search-open .gsearch input {
    font-size: 16px;
  }

  .bar.is-search-open .gsearch-close {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    flex: none;
    color: var(--qz-color-fg-3);
  }

  .bar.is-search-open .gsearch-close:active {
    color: var(--qz-color-accent);
  }

  .gs-pop {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 52px);
    left: 8px;
    right: 8px;
    width: auto;
    max-height: min(62dvh, 460px);
    z-index: 75;
    padding: 6px;
  }

  .gs-item {
    min-height: 54px;
    padding: 8px 10px;
    gap: 10px;
  }

  .gs-pic {
    width: 68px;
    height: 38px;
  }

  /* Library Single Unified Mobile Control Bar: Filter | Slot Picker | Scene Jump | 1/2 Col Toggle */
  .lib-top-meta {
    padding: 6px 10px;
    gap: 6px;
    min-height: 44px;
  }

  .lib-top-meta .lib-count {
    display: none;
  }

  .lib-filter-btn {
    height: 32px;
    padding: 0 9px;
    font-size: 12px;
    flex: none;
  }

  .lib-slot-mob-btn {
    display: inline-flex;
    flex: 1 1 0;
    min-width: 78px;
    max-width: 148px;
    height: 32px;
    padding: 0 8px;
    justify-content: space-between;
    font-size: 12px;
  }

  .qsel-jump {
    flex: 1.15 1 0;
    min-width: 92px;
    max-width: none;
    height: 32px;
  }

  /* Replace desktop +/- column slider with 1-tap Mobile Column Toggles */
  .cols-ctrl {
    display: none;
  }

  .mcol-toggle-btn {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 32px;
    padding: 0;
    background: var(--qz-color-surface);
    border: 1px solid var(--qz-line-strong);
    color: var(--qz-color-fg-2);
    flex: none;
  }

  .mcol-toggle-btn:active {
    border-color: var(--qz-color-accent);
    background: var(--qz-accent-10);
    color: var(--qz-color-accent);
  }

  .mcol-toggle-btn.is-single {
    border-color: var(--qz-accent-45);
    background: var(--qz-accent-09);
    color: var(--qz-color-accent);
  }

  .mcol-seg {
    display: inline-flex;
    align-items: stretch;
    height: 30px;
    padding: 2px;
    gap: 2px;
    background: var(--qz-color-surface);
    border: 1px solid var(--qz-line-strong);
    flex: none;
  }

  .mcol-seg button {
    width: 24px;
    height: 100%;
    padding: 0;
    display: grid;
    place-items: center;
    color: var(--qz-color-fg-4);
    font: 400 11.5px/1 var(--qz-font-mono);
  }

  .lib-banner {
    margin: 10px 10px 0;
    padding: 8px 10px;
    font-size: 12px;
  }

  .scene {
    padding: 0 10px 24px;
  }

  .scene-h {
    padding: 14px 0 9px;
    margin-bottom: 10px;
    gap: 10px;
    align-items: baseline;
  }

  .scene-h h2 {
    font-size: 28px;
  }

  .scene-h .scene-loc {
    font-size: 14px;
    padding-bottom: 0;
  }

  .scene-h .meta {
    font-size: 11.5px;
    gap: 8px;
    padding-bottom: 0;
  }

  .scene-h .meta b {
    font-size: 14px;
  }

  .shots {
    grid-template-columns: repeat(var(--lib-cols, 2), minmax(0, 1fr));
    gap: 12px 8px;
  }

  .shot-meta {
    margin-top: 6px;
    gap: 5px;
  }

  .shot-meta b {
    font-size: 12.5px;
  }

  .mtag {
    font-size: 9.5px;
    padding: 2px 4px;
  }

  .lib-main[data-cols-tier="normal"] .shots {
    gap: 14px 10px;
  }

  /* Disable sticky hover zoom on touch */
  .half:hover img {
    transform: none;
  }

  .lib-empty {
    padding: 48px 16px;
  }

  /* Sheet Mode Single Unified Control Bar on Phone: Filter | Slot Picker | 2/3/4 | Labels */
  .csheet-bar {
    padding: 6px 10px;
    gap: 6px;
    min-height: 44px;
  }

  .csheet-vsep,
  .csheet-count {
    display: none;
  }

  .csheet-slot-btn {
    flex: 1 1 0;
    min-width: 78px;
    max-width: none;
    height: 30px;
    padding: 0 8px;
    justify-content: space-between;
    font-size: 12px;
  }

  .csheet-slot-btn .slot-pick-tag,
  .csheet-slot-btn .slot-pick-cnt {
    display: none;
  }

  .csheet-filter-btn {
    display: inline-flex;
    height: 30px;
    padding: 0 8px;
    gap: 4px;
    background: var(--qz-color-surface);
    flex: none;
  }

  .csheet-filter-btn.has-active {
    border-color: var(--qz-accent-45);
    background: var(--qz-accent-09);
    color: var(--qz-color-accent);
  }

  .csheet-acts {
    gap: 5px;
    margin-left: 0;
  }

  .csheet-tog {
    height: 30px;
    padding: 0 7px;
    font-size: 11px;
  }

  .csheet-filters {
    display: none;
  }

  .csheet-top.is-filters-open .csheet-filters {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
    padding-top: 6px;
    border-top: 1px solid var(--qz-line-subtle);
    order: 20;
  }

  .csheet-top.is-filters-open .csheet-filters .qsel-sm {
    max-width: none;
    width: 100%;
  }

  .csheet-top.is-filters-open .csheet-reset {
    width: 100%;
    height: 32px;
  }

  .csheet-lbl {
    padding: 2px 5px;
    font-size: 10px;
  }

  .csheet-lbl-full {
    display: none;
  }

  .csheet-lbl-short {
    display: inline;
  }

  /* Compact Stepper Columns Control on Phone */
  .cols-ctrl {
    height: 30px;
    padding: 0 4px;
    gap: 2px;
  }

  .cols-step-btn {
    width: 26px;
    height: 26px;
  }

  .cols-readout {
    min-width: 34px;
    text-align: center;
    font-size: 11px;
  }

  /* Viewer Stage & HUD on Phone (hide corner brackets to prevent HUD border collision) */
  .hud-frame {
    display: none;
  }

  .stage-hud-top {
    left: 12px;
    top: 10px;
    max-width: calc(100% - 24px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 5px 8px 4px;
    font-size: 10.5px;
  }

  .curtain-tag {
    top: 10px;
    padding: 5px 8px 4px;
    font-size: 10px;
    max-width: 44%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .curtain-tag-a { left: 12px; }
  .curtain-tag-b { right: 12px; }

  .zoom {
    right: 12px;
    bottom: 10px;
  }

  .zoombar button {
    width: 32px;
    height: 30px;
  }

  .zoombar button.zoom-val {
    min-width: 44px;
    padding: 0 5px;
    font-size: 11px;
  }

  .zoombar button.zoom-lossless {
    padding: 0 9px;
    font-size: 11px;
  }

  .stage-scan-pill {
    left: 10px;
    bottom: 10px;
    font-size: 10px;
    padding: 4px 8px 3px;
  }

  .stage-msg {
    padding: 16px;
  }

  .stage-msg > div {
    padding: 12px 16px;
    font-size: 12.5px;
  }

  /* Viewer Compare Toolbar on Phone (Clean 2-Row Adaptive) */
  .tools {
    height: auto;
    min-height: 40px;
    padding: 6px 8px;
    flex-wrap: wrap;
    gap: 6px;
    overflow-x: visible;
    white-space: normal;
  }

  .tools .vsep,
  .tools .gap,
  .tools-keys {
    display: none !important;
  }

  .tools-seg {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2px;
  }

  .tools-seg button {
    padding: 7px 4px;
    font-size: 12px;
    text-align: center;
  }

  .compare-pickers {
    width: 100%;
    flex: 0 0 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
  }

  .cmp-pick {
    flex: 1 1 0;
    min-width: 0;
    gap: 4px;
  }

  .cmp-pick .qsel-xs {
    width: auto;
    flex: 1 1 auto;
    height: 32px;
  }

  .cmp-pick .qsel-xs .qsel-btn {
    padding: 0 8px;
    font-size: 12px;
  }

  .compare-pickers .ib {
    width: 30px;
    height: 32px;
    font-size: 13px;
  }

  .cmp-tag {
    width: 18px;
    height: 18px;
    font-size: 10.5px;
  }

  .overlay-ctrls {
    width: 100%;
    flex: 0 0 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
  }

  .ov-locked-pair {
    width: 100%;
    justify-content: center;
    gap: 6px;
  }

  .ov-slot-lbl {
    height: 26px;
    padding: 0 8px;
    font-size: 11px;
    max-width: 38%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .ov-locked-pair .ib {
    width: 28px;
    height: 26px;
  }

  .ov-slider-wrap {
    flex: 1 1 130px;
    height: 32px;
    padding: 0 10px;
    gap: 8px;
  }

  .ov-range {
    flex: 1 1 auto;
    width: auto;
    height: 5px;
  }

  .ov-range::-webkit-slider-thumb {
    width: 16px;
    height: 22px;
  }

  .ov-range::-moz-range-thumb {
    width: 16px;
    height: 22px;
  }

  .ov-val {
    min-width: 32px;
    font-size: 11.5px;
  }

  .ov-diff-btn {
    height: 32px;
    padding: 0 10px;
    font-size: 12px;
  }

  /* Bottom Filmstrip on Phone: Single Compact Horizontal Row (Side Anchor + Thumbnails) */
  .strip {
    flex-direction: row;
    align-items: stretch;
    height: 60px;
    padding-bottom: 0;
  }

  .strip-side {
    width: 104px;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: 3px;
    padding: 4px 5px;
    border-right: 1px solid var(--qz-line-subtle);
    border-bottom: 0;
  }

  .strip-scene {
    flex: none;
    max-width: none;
    gap: 0;
  }

  .strip-scene .nb {
    width: 18px;
    height: 22px;
  }

  .strip-scene .lbl {
    font-size: 11.5px;
    padding: 2px 1px;
    letter-spacing: .01em;
  }

  .strip-tabs {
    flex: none;
    padding: 0;
    border: 0;
    background: transparent;
  }

  .strip-tabs button {
    font-size: 10px;
    padding: 3px 4px;
    border: 1px solid var(--qz-line-strong);
    background: var(--qz-color-bg);
  }

  .strip-tabs button:not([aria-pressed="true"]) {
    display: none;
  }

  .strip-tabs button b {
    font-size: 10px;
    margin-left: 2px;
  }

  .strip-scroll {
    height: 60px;
    padding: 4px 6px;
    gap: 4px;
  }

  .frame {
    width: 88px;
    height: 50px;
  }

  .frame .fid {
    left: 5px;
    bottom: 3px;
    font-size: 11.5px;
  }

  /* Auth Gate on Phone */
  .auth-gate {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    align-items: safe center;
    padding: max(16px, env(safe-area-inset-top, 0px)) 14px max(20px, env(safe-area-inset-bottom, 0px));
  }

  .auth-card {
    padding: 22px 18px 20px;
    gap: 18px;
  }

  .auth-input,
  .auth-otp-btn,
  .auth-submit,
  .auth-feishu-btn {
    min-height: 44px;
  }

  .auth-otp-btn {
    min-width: 96px;
    padding: 0 11px;
  }

  /* Rush Video Modal on Phone */
  .rush-modal {
    padding: max(8px, env(safe-area-inset-top, 0px)) 8px max(8px, env(safe-area-inset-bottom, 0px));
  }

  .rush-card {
    width: 100%;
    max-height: calc(100dvh - 16px);
  }

  .rush-head {
    padding: 8px 10px;
    gap: 8px;
  }

  .rush-title {
    font-size: 12.5px;
  }

  .rush-head .close {
    width: 34px;
    height: 34px;
  }

  .rush-stage {
    max-height: calc(100dvh - 68px);
  }

  /* Admin Sheet on Phone */
  .sheet-panel,
  .admin-sheet-panel {
    width: 100%;
    border-left: 0;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .sheet-head {
    padding: 14px 14px 0;
  }

  .tab {
    font-size: 23px;
  }

  .sheet-subbar {
    padding: 10px 14px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .admin-body {
    padding: 12px 12px 24px;
    gap: 14px;
  }

  .admin-sec {
    padding: 12px;
    gap: 12px;
  }

  .admin-sec-h {
    flex-wrap: wrap;
    gap: 6px;
  }

  .admin-pass-row .admin-input {
    flex: 1 1 100%;
    height: 40px;
  }

  .admin-pass-row .btn,
  .admin-pass-row .btn-accent,
  .admin-add-form .btn-accent {
    height: 38px;
  }

  .admin-add-form .admin-input {
    height: 40px;
  }

  .admin-pass-banner {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 10px 12px;
  }

  .admin-pass-banner-acts {
    justify-content: flex-end;
  }

  /* Admin Table -> Mobile Qizhi DS Card Stack */
  .admin-table-wrap {
    overflow-x: visible;
    border: 0;
    background: transparent;
  }

  .admin-table,
  .admin-table tbody {
    display: block;
    width: 100%;
  }

  .admin-table thead {
    display: none;
  }

  .admin-table tr[data-admin-row] {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    padding: 11px 12px;
    margin-bottom: 8px;
    background: var(--qz-color-surface);
    border: 1px solid var(--qz-line-strong);
  }

  .admin-table tr[data-admin-row]:last-child {
    margin-bottom: 0;
  }

  .admin-table tr[data-admin-row] td {
    display: block;
    padding: 0;
    border: 0;
  }

  .admin-table td.admin-td-email {
    flex: 1 1 100%;
    min-width: 0;
  }

  .admin-email-cell {
    max-width: 100%;
    flex-wrap: wrap;
    white-space: normal;
    word-break: break-all;
    font-size: 13px;
  }

  .admin-table td.admin-td-note {
    flex: 1 1 100%;
  }

  .admin-note-cell {
    max-width: none;
    white-space: normal;
    font-size: 12px;
  }

  .admin-table td.admin-td-acts {
    flex: 1 1 100%;
    padding-top: 6px;
    margin-top: 2px;
    border-top: 1px solid var(--qz-line-subtle);
  }

  .admin-row-acts {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 6px;
  }

  .admin-act-btn {
    height: 30px;
    padding: 0 10px;
    font-size: 12px;
  }

  .admin-table tr.admin-edit-row {
    display: block;
    margin: -8px 0 8px;
  }

  .admin-table tr.admin-edit-row td {
    display: block;
    padding: 10px 12px;
  }

  .admin-inline-editor .admin-input {
    flex: 1 1 100%;
    height: 38px;
  }

  .admin-inline-editor .btn,
  .admin-inline-editor .btn-accent {
    height: 32px;
  }

  .admin-event-item {
    grid-template-columns: auto 1fr;
    gap: 4px 8px;
    padding: 8px 12px;
  }

  .admin-ev-email,
  .admin-ev-detail {
    grid-column: 1 / -1;
  }

  /* Toast safe area & clear of bottom tabbar / viewer filmstrip */
  .toast {
    bottom: calc(64px + env(safe-area-inset-bottom, 0px));
    font-size: 12.5px;
    padding: 8px 12px;
  }

  body:not(.mode-lib):not(.mode-sheet) .toast {
    bottom: calc(124px + env(safe-area-inset-bottom, 0px));
  }
}

/* ── Portrait Mobile: Vertical Stack for Side-by-Side (Full 16:9 Width!) ── */
@media (max-width: 768px) and (orientation: portrait) {
  .side-stage {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
  }

  .stage.is-rush-right .zoom {
    display: none;
  }
}

/* ── Phone Compact Controls & QSelect Bottom Sheet (<= 640px) ── */
@media (max-width: 640px) {
  .cols-range {
    display: none;
  }

  .cols-ctrl .cols-step-btn:first-of-type {
    order: 1;
  }

  .cols-ctrl .cols-readout {
    order: 2;
    min-width: 34px;
    padding: 0 2px;
    text-align: center;
  }

  .cols-ctrl .cols-step-btn:last-of-type {
    order: 3;
  }

  .lib-count-scenes,
  .csheet-count-slot {
    display: none;
  }

  .qsel-menu.is-sheet {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    top: auto !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100vw !important;
    max-height: 64dvh !important;
    z-index: 900;
    border: 0;
    border-top: 2px solid var(--qz-color-accent);
    background: #0c0f0d;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: sheetUp .2s var(--ease) both;
  }

  .qsel-menu.is-sheet .qsel-sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex: none;
    height: 44px;
    padding: 0 8px 0 16px;
    background: var(--qz-color-bg);
    border-bottom: 1px solid var(--qz-line-strong);
  }

  .qsel-sheet-title {
    font: var(--qz-weight-bold) 13px/1 var(--qz-font-sans);
    letter-spacing: .05em;
    color: var(--qz-color-fg);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .qsel-sheet-close {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    color: var(--qz-color-fg-3);
  }

  .qsel-sheet-close:active {
    color: var(--qz-color-accent);
  }

  .qsel-sheet-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 4px 0 calc(8px + env(safe-area-inset-bottom, 0px));
  }

  .qsel-menu.is-sheet .qsel-opt {
    min-height: 44px;
    padding: 10px 16px;
    font-size: 14px;
  }
}

/* ── Small Phone Refinements (<= 440px) ── */
@media (max-width: 440px) {
  .lib-count-unit {
    display: none;
  }
}

/* ── Small Phone Refinements (<= 400px) ── */
@media (max-width: 400px) {
  .mark {
    padding: 0;
    gap: 6px;
  }

  .mark-en {
    font-size: 18px;
  }

  .lib-top-meta,
  .csheet-bar {
    padding: 6px 8px;
    gap: 5px;
  }

  .lib-filter-btn,
  .csheet-filter-btn {
    padding: 0 7px;
    font-size: 11.5px;
  }

  .cols-readout {
    min-width: 28px;
    font-size: 10.5px;
  }

  .cols-step-btn {
    width: 24px;
    height: 24px;
  }

  .csheet-tog {
    padding: 0 6px;
    font-size: 10.5px;
  }

  .shot-meta {
    gap: 3px;
  }

  .shot-meta b {
    font-size: 11.5px;
    flex-shrink: 0;
  }

  .mtag {
    font-size: 9px;
    padding: 1.5px 3px;
    letter-spacing: .02em;
  }

  .sdots {
    gap: 2.5px;
  }

  .sdot {
    width: 4.5px;
    height: 4.5px;
  }

  .vmbar-shot b {
    font-size: 18px;
  }

  .vmbar-scene {
    font-size: 10.5px;
  }

  .zoombar button {
    width: 28px;
    height: 28px;
  }

  .zoombar button.zoom-val {
    min-width: 38px;
    padding: 0 4px;
    font-size: 10.5px;
  }

  .zoombar button.zoom-lossless {
    padding: 0 7px;
    font-size: 10.5px;
  }
}

/* ── Landscape Phone Cinema Mode (short viewport height <= 500px) ── */
@media (max-height: 500px) and (max-width: 960px) {
  body {
    grid-template-rows: auto minmax(0, 1fr) auto;
  }

  /* Immersive Landscape Viewer: hide global topbar & bottom tabbar for maximum 16:9 stage */
  body:not(.mode-lib):not(.mode-sheet) {
    grid-template-rows: minmax(0, 1fr) auto;
  }

  body:not(.mode-lib):not(.mode-sheet) .bar,
  body:not(.mode-lib):not(.mode-sheet) .mobile-tabbar {
    display: none !important;
  }

  body:not(.mode-lib):not(.mode-sheet) .app {
    grid-row: 1 / 2;
  }

  body:not(.mode-lib):not(.mode-sheet) .strip {
    grid-row: 2 / 3;
  }

  body:not(.mode-lib):not(.mode-sheet) .viewer-mbar {
    height: 34px;
    padding: 0 max(10px, env(safe-area-inset-right, 0px)) 0 max(4px, env(safe-area-inset-left, 0px));
    background: var(--qz-color-surface);
    border-bottom: 1px solid var(--qz-line);
  }

  body:not(.mode-lib):not(.mode-sheet) .vmbar-back {
    width: 30px;
    height: 30px;
  }

  body:not(.mode-lib):not(.mode-sheet) .vmbar-shot {
    align-items: center;
    height: 30px;
  }

  body:not(.mode-lib):not(.mode-sheet) .vmbar-shot b {
    font-size: 17px;
    line-height: 1;
  }

  body:not(.mode-lib):not(.mode-sheet) .vmbar-info-btn,
  body:not(.mode-lib):not(.mode-sheet) .vmbar-rush {
    height: 24px;
    padding: 0 8px;
    font-size: 11px;
  }

  body:not(.mode-lib):not(.mode-sheet) .viewer-mactions {
    height: 30px;
    padding: 0 8px;
  }

  body:not(.mode-lib):not(.mode-sheet) .mslot-btn,
  body:not(.mode-lib):not(.mode-sheet) .vmact-cmp-btn {
    height: 22px;
    padding: 0 8px;
    font-size: 11px;
  }

  body:not(.mode-lib):not(.mode-sheet) .tools {
    flex-wrap: nowrap;
    overflow-x: auto;
    min-height: 32px;
    padding: 3px 8px;
  }

  body:not(.mode-lib):not(.mode-sheet) .tools-seg {
    width: auto;
    display: inline-flex;
    flex: none;
  }

  body:not(.mode-lib):not(.mode-sheet) .tools-seg button {
    padding: 4px 8px;
    font-size: 11px;
  }

  body:not(.mode-lib):not(.mode-sheet) .compare-pickers,
  body:not(.mode-lib):not(.mode-sheet) .overlay-ctrls {
    width: auto;
    flex: 0 0 auto;
    flex-wrap: nowrap;
  }

  body:not(.mode-lib):not(.mode-sheet) .ov-locked-pair {
    width: auto;
  }

  body:not(.mode-lib):not(.mode-sheet) .strip {
    flex-direction: row;
    height: 46px;
    padding-bottom: 0;
  }

  body:not(.mode-lib):not(.mode-sheet) .strip-side {
    width: 148px;
    flex-direction: column;
    gap: 2px;
    padding: 2px 6px;
    border-bottom: 0;
    border-right: 1px solid var(--qz-line-subtle);
  }

  body:not(.mode-lib):not(.mode-sheet) .strip-tabs {
    display: none;
  }

  body:not(.mode-lib):not(.mode-sheet) .strip-scroll {
    height: 46px;
    padding: 3px 6px;
  }

  body:not(.mode-lib):not(.mode-sheet) .frame {
    width: 72px;
    height: 40px;
  }

  body:not(.mode-lib):not(.mode-sheet) .frame .fid {
    font-size: 10.5px;
    left: 4px;
    bottom: 2px;
  }
}
