.vw {
  --vw-bg: #fbf8f9;
  --vw-text: #1a1a1a;
  --vw-sub: #7a7478;
  --vw-pill: rgba(255, 255, 255, 0.8);
  --vw-line: rgba(0, 0, 0, 0.09);
  --vw-hover: rgba(184, 116, 143, 0.14);
  --vw-accent: #b8748f;
  --vw-paper: #ffffff;
  --vw-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 28px 70px -28px rgba(70, 30, 50, 0.4);
  position: fixed; inset: 0; z-index: 100000;
  display: none; overflow: hidden;
  color: var(--vw-text); font-family: var(--font-main);
  overscroll-behavior: contain; -webkit-tap-highlight-color: transparent;
}
.vw[data-theme="dark"] {
  --vw-bg: #0f0e10;
  --vw-text: #f2eef0;
  --vw-sub: #a199a0;
  --vw-pill: rgba(30, 28, 32, 0.74);
  --vw-line: rgba(255, 255, 255, 0.13);
  --vw-hover: rgba(255, 255, 255, 0.1);
  --vw-paper: #1a181c;
  --vw-shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 30px 80px -24px rgba(0, 0, 0, 0.9);
}
.vw.is-mounted { display: block; }
.vw:focus { outline: none; }

html.vw-lock { overflow: hidden; padding-right: var(--sbw, 0px); }

.vw-backdrop { position: absolute; inset: 0; background: var(--vw-bg); opacity: 0; transition: opacity 0.55s var(--ease-out), background-color 0.4s ease; }
.vw.is-open .vw-backdrop { opacity: var(--vw-dim, 1); }
.vw.is-dragging .vw-backdrop { transition: none; }

/*stage*/
.vw-stage { position: absolute; inset: 0; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
.vw-track { position: absolute; inset: 0; will-change: transform; }
.vw-pane { position: absolute; inset: 0; will-change: transform; }
.vw-pane.is-empty { visibility: hidden; }
.vw-kb { position: absolute; inset: 0; }
.vw-img {
  position: absolute; left: 50%; top: 50%; max-width: none; max-height: none;
  object-fit: contain; border-radius: 2px;
  transform-origin: 50% 50%; will-change: transform;
  background: var(--vw-paper); box-shadow: var(--vw-shadow);
  -webkit-user-drag: none; user-select: none;
  cursor: zoom-in;
}
.vw.is-zoomed .vw-img { cursor: grab; }
.vw.is-dragging .vw-img { cursor: grabbing; }
.vw.is-idle, .vw.is-idle .vw-img { cursor: none; }

.vw-pane.is-hold .vw-kb { opacity: 0; }                      
.vw-pane.is-appear .vw-kb { animation: vwAppear 0.75s var(--ease-out) both; }
@keyframes vwAppear { from { opacity: 0; transform: scale(0.965); } }

.vw.is-playing .vw-pane.is-current .vw-kb { animation: vwKb var(--vw-interval, 4200ms) ease-out both; }
@keyframes vwKb { from { transform: scale(1); } to { transform: scale(1.055); } }

.vw-spin {
  position: absolute; left: 50%; top: 50%; width: 30px; height: 30px; margin: -15px 0 0 -15px;
  border-radius: 50%; border: 2px solid var(--vw-line); border-top-color: var(--vw-accent);
  opacity: 0; pointer-events: none;
}
.vw-pane.is-loading .vw-spin { animation: vwSpin 0.9s linear infinite, vwFadeIn 0.3s ease 0.6s both; }
@keyframes vwSpin { to { transform: rotate(360deg); } }
@keyframes vwFadeIn { from { opacity: 0; } to { opacity: 1; } }
.vw-pane.is-error::after {
  content: "This picture couldn\2019 t be loaded"; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  font-size: 0.85rem; color: var(--vw-sub);
}

.vw-ghost { position: absolute; z-index: 6; overflow: hidden; pointer-events: none; transform-origin: 0 0; will-change: transform; background: var(--vw-paper); box-shadow: var(--vw-shadow); }
.vw-ghost img { display: block; width: 100%; height: 100%; object-fit: cover; }
.vw-origin { visibility: hidden !important; }               

/* chrome */
.vw-chrome { position: absolute; inset: 0; z-index: 4; pointer-events: none; opacity: 0; transition: opacity 0.5s ease 0.2s; }
.vw.is-open .vw-chrome { opacity: 1; }
.vw.is-idle .vw-chrome { opacity: 0; transition-delay: 0s; }
.vw.is-closing .vw-chrome { opacity: 0; transition: opacity 0.25s ease; }
.vw-btn, .vw-group, .vw-strip, .vw-count, .vw .swatch { pointer-events: auto; }

.vw-top {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: max(14px, env(safe-area-inset-top)) clamp(14px, 2.4vw, 30px) 10px;
  transform: translateY(-16px); transition: transform 0.8s var(--ease-out) 0.15s;
}
.vw.is-open .vw-top { transform: none; }
.vw-bottom {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; flex-direction: column; gap: 10px;
  padding: 10px clamp(14px, 2.4vw, 30px) max(14px, env(safe-area-inset-bottom));
  transform: translateY(20px); transition: transform 0.8s var(--ease-out) 0.2s;
}
.vw.is-open .vw-bottom { transform: none; }
.vw-top::before, .vw-bottom::before { content: ""; position: absolute; z-index: -1; left: 0; right: 0; pointer-events: none; opacity: 0; transition: opacity 0.4s ease; }
.vw-top::before { top: 0; bottom: -28px; background: linear-gradient(to bottom, var(--vw-bg) 25%, transparent); }
.vw-bottom::before { top: -34px; bottom: 0; background: linear-gradient(to top, var(--vw-bg) 30%, transparent); }


.vw-count { display: flex; align-items: baseline; gap: 0.4rem; font-variant-numeric: tabular-nums; font-size: 0.8rem; letter-spacing: 0.06em; color: var(--vw-sub); }
.vw-n { font-size: 1.15rem; font-weight: 500; color: var(--vw-text); }
.vw-slash { opacity: 0.45; }
.vw-tools { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.vw-group {
  display: flex; align-items: center; gap: 2px; padding: 4px; border-radius: 999px;
  background: var(--vw-pill); border: 1px solid var(--vw-line);
  -webkit-backdrop-filter: blur(14px) saturate(1.3); backdrop-filter: blur(14px) saturate(1.3);
  box-shadow: 0 10px 30px -16px rgba(0, 0, 0, 0.3);
}
.vw:not(.is-story) .vw-story-only { display: none; }
.vw.is-single .vw-count { display: none; }

.vw-btn {
  position: relative; width: 40px; height: 40px; flex: none; padding: 0;
  display: inline-grid; place-items: center;
  border: 0; border-radius: 50%; background: transparent; color: var(--vw-text); text-decoration: none; cursor: pointer;
  transition: background-color 0.25s ease, color 0.25s ease, transform 0.5s var(--ease-spring), opacity 0.25s ease;
}
.vw-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; transition: transform 0.5s var(--ease-spring); }
.vw-btn svg .fill { fill: currentColor; stroke: none; }
.vw-btn:hover:not(:disabled) { background: var(--vw-hover); color: var(--vw-accent); }
.vw-btn:active:not(:disabled) { transform: scale(0.9); }
.vw-btn:disabled { opacity: 0.28; pointer-events: none; }
.vw-btn:focus-visible { outline: 2px solid var(--vw-accent); outline-offset: 2px; }
.vw-close:hover svg { transform: rotate(90deg); }
.vw-theme:hover svg { transform: rotate(35deg); }
.vw-speed { width: auto; padding: 0 0.8rem; border-radius: 999px; font-size: 0.74rem; font-weight: 600; letter-spacing: 0.05em; font-variant-numeric: tabular-nums; }
.vw-play { background: var(--vw-accent); color: #fff; }
.vw-play:hover:not(:disabled) { background: #a1607a; color: #fff; }

.vw-arrow {
  position: absolute; top: 50%; width: 52px; height: 52px; margin-top: -26px;
  background: var(--vw-pill); border: 1px solid var(--vw-line);
  -webkit-backdrop-filter: blur(14px) saturate(1.3); backdrop-filter: blur(14px) saturate(1.3);
  box-shadow: 0 12px 32px -14px rgba(0, 0, 0, 0.35);
}
.vw-prev { left: clamp(10px, 2vw, 28px); }
.vw-next { right: clamp(10px, 2vw, 28px); }
.vw-prev:hover:not(:disabled) { transform: translateX(-4px); }
.vw-next:hover:not(:disabled) { transform: translateX(4px); }
.vw.is-zoomed .vw-arrow { opacity: 0.3; }
.vw.is-single .vw-arrow { display: none; }

/* caption + palette */
.vw-caption { display: flex; align-items: flex-end; justify-content: space-between; gap: 1.25rem; min-height: 44px; }
.vw-text { min-width: 0; }
.vw-title { font-size: 1rem; font-weight: 500; letter-spacing: -0.01em; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vw-meta { margin-top: 2px; font-size: 0.78rem; color: var(--vw-sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vw.is-zoomed .vw-title, .vw.is-zoomed .vw-meta, .vw.is-zoomed .vw-count, .vw.is-zoomed .vw-count * { color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.85), 0 0 12px rgba(0,0,0,.6); }
.vw-palette { display: flex; flex: none; gap: 0.5rem; }
.vw .swatch {
  width: 1.5rem; height: 1.5rem; padding: 0; border-radius: 50%; background: var(--c);
  border: 2px solid var(--vw-paper); box-shadow: 0 0 0 1px var(--vw-line), 0 6px 12px -6px rgba(0, 0, 0, 0.45);
  cursor: copy; transition: transform 0.4s var(--ease-spring);
}
.vw .swatch:hover { transform: scale(1.22); }
.vw.is-open .vw-palette .swatch { animation: swatchPop 0.7s var(--ease-spring) both; animation-delay: calc(450ms + var(--i, 0) * 60ms); }

/* filmstrip */
.vw-strip {
  display: flex; gap: 8px; padding: 4px 2px;
  overflow-x: auto; overflow-y: hidden; scrollbar-width: none; touch-action: pan-x; overscroll-behavior: contain;
}
.vw-strip::-webkit-scrollbar { display: none; }
.vw.is-single .vw-strip { display: none; }
.vw-strip .vw-th:first-child { margin-left: auto; }
.vw-strip .vw-th:last-child { margin-right: auto; }
.vw-th {
  position: relative; flex: none; height: 50px; width: calc(50px * var(--r, 1.5));
  padding: 0; border: 0; border-radius: 5px; overflow: hidden; background: var(--vw-line); cursor: pointer;
  opacity: 0.5; transition: opacity 0.3s ease, transform 0.5s var(--ease-spring), box-shadow 0.3s ease;
}
.vw-th img { display: block; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.vw-th:hover { opacity: 1; transform: translateY(-3px); }
.vw-th.is-active { opacity: 1; box-shadow: 0 0 0 2px var(--vw-bg), 0 0 0 4px var(--vw-accent); }
.vw.is-story .vw-th::after { content: attr(data-n); position: absolute; left: 5px; bottom: 3px; font-size: 0.6rem; font-weight: 600; color: #fff; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7); }
.vw-th:focus-visible { outline: 2px solid var(--vw-accent); outline-offset: 2px; }

/* autoplay progress */
.vw-progress { position: absolute; top: 0; left: 0; right: 0; z-index: 7; height: 3px; opacity: 0; transition: opacity 0.3s ease; background: rgba(0, 0, 0, 0.06); }
.vw.is-playing .vw-progress { opacity: 1; }
.vw-progress span { display: block; height: 100%; background: var(--vw-accent); transform: scaleX(0); transform-origin: left center; animation: vwProg var(--vw-interval, 4200ms) linear forwards; }
@keyframes vwProg { to { transform: scaleX(1); } }

/* one-time hint */
.vw-hint {
  position: absolute; left: 50%; top: calc(max(14px, env(safe-area-inset-top)) + 12px); z-index: 5;
  width: max-content; max-width: calc(100vw - 28px); padding: 0.55rem 1.1rem; border-radius: 999px; text-align: center;
  background: var(--vw-pill); border: 1px solid var(--vw-line);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  font-size: 0.74rem; letter-spacing: 0.03em; color: var(--vw-sub);
  opacity: 0; transform: translate(-50%, -10px); pointer-events: none;
  transition: opacity 0.5s ease, transform 0.8s var(--ease-spring);
}
.vw-hint.show { opacity: 1; transform: translate(-50%, 0); }
.vw-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* small screens */
@media (hover: none) { .vw-arrow { display: none; } }
@media (max-width: 720px) {
  .vw-hint { top: calc(max(14px, env(safe-area-inset-top)) + 62px); }
  .vw-btn { width: 38px; height: 38px; }
  .vw-arrow { display: none; }
  .vw-top { gap: 0.5rem; }
  .vw-th { height: 42px; width: calc(42px * var(--r, 1.5)); }
  .vw .swatch { width: 1.3rem; height: 1.3rem; }
  .vw-title { font-size: 0.92rem; }
}
@media (max-width: 560px) {
  .vw.is-story .vw-zoomgrp, .vw-speed { display: none; }
}
