.rvg, .rvg * { box-sizing: border-box; }
.rvg { width: 100%; max-width: 100%; margin: 1.5em auto; }
.rvg button { cursor: pointer; font: inherit; }
.rvg button:focus-visible { outline: 3px solid #2271b1; outline-offset: 2px; }
.rvg-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.rvg-thumb { position: relative; display: block; overflow: hidden; width: 100%; aspect-ratio: 4 / 3; padding: 0; border: 2px solid transparent; border-radius: 8px; background: #e5e7eb; }
.rvg-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .2s ease; }
.rvg-thumb:hover img { transform: scale(1.04); }
.rvg-video-fallback { display: grid; place-items: center; width: 100%; height: 100%; background: linear-gradient(135deg,#263247,#101827); color: #fff; font: 32px/1 sans-serif; }
.rvg-video-badge { position: absolute; right: 4px; bottom: 4px; padding: 2px 5px; border-radius: 4px; background: rgba(0,0,0,.76); color: #fff; font: 11px/1.3 sans-serif; }
.rvg-thumb.is-active { border-color: #2271b1; }
.rvg--slider .rvg-thumbs { display: flex; gap: 8px; overflow-x: auto; padding: 8px 2px; scrollbar-width: thin; }
.rvg--slider .rvg-thumb { flex: 0 0 88px; width: 88px; height: 66px; aspect-ratio: auto; }
.rvg-stage { position: relative; isolation: isolate; display: flex; justify-content: center; align-items: center; overflow: hidden; width: 100%; height: clamp(250px, 55vw, 620px); border-radius: 12px; background: #e5e7eb; }
.rvg-stage-backdrop, .rvg-lightbox-backdrop { position: absolute; inset: -5%; width: 110%; height: 110%; object-fit: cover; filter: blur(28px) saturate(1.15); opacity: .65; pointer-events: none; }
.rvg-stage-backdrop { z-index: 0; }
.rvg-stage-media { position: relative; z-index: 1; display: flex; width: 100%; height: 100%; align-items: center; justify-content: center; }
.rvg-stage-open { display: flex; width: 100%; height: 100%; align-items: center; justify-content: center; padding: 0; border: 0; background: transparent; }
.rvg-stage-image { display: block; width: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; }
.rvg-stage-video, .rvg-lightbox-video { display: block; width: 100%; height: 100%; max-width: 100%; max-height: 100%; object-fit: contain; background: #111827; }
.rvg-stage-open[hidden], .rvg-stage-video[hidden], .rvg-stage-expand[hidden], .rvg-lightbox-image[hidden], .rvg-lightbox-video[hidden] { display: none !important; }
.rvg-stage-expand { position: absolute; z-index: 4; top: 12px; right: 12px; width: 38px; height: 38px; border: 1px solid rgba(255,255,255,.4); border-radius: 8px; background: rgba(0,0,0,.55); color: #fff; font-size: 22px; line-height: 1; }
.rvg-arrow, .rvg-lightbox-stage > button { display: grid !important; place-items: center; padding: 0 !important; border: 1px solid rgba(255,255,255,.22) !important; border-radius: 10px; background: rgba(28,32,40,.42) !important; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); color: #fff !important; font-family: Arial, sans-serif !important; font-size: 30px !important; font-weight: 400 !important; line-height: 1 !important; text-align: center; box-shadow: 0 4px 18px rgba(0,0,0,.2); }
.rvg-arrow { position: absolute; z-index: 3; top: 50%; width: 42px; height: 52px; transform: translateY(-50%); }
.rvg-prev { left: 10px; }.rvg-next { right: 10px; }
.rvg-stage-caption { min-height: 1.4em; margin: 8px 0 2px; text-align: center; }
.rvg-watermark { position: absolute; z-index: 2; inset: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); align-items: center; justify-items: center; overflow: hidden; pointer-events: none; user-select: none; color: #fff; font: 700 clamp(10px, 1.4vw, 18px)/1.3 sans-serif; text-align: center; text-shadow: 0 1px 3px #000; }
.rvg-watermark span { display: block; max-width: 90%; overflow-wrap: anywhere; transform: rotate(-18deg); }
.rvg-lightbox[hidden] { display: none !important; }
.rvg-lightbox { position: fixed; z-index: 999999; inset: 0; display: grid; place-items: center; padding: 12px; background: rgba(9,13,22,.68); backdrop-filter: blur(22px) saturate(1.2); -webkit-backdrop-filter: blur(22px) saturate(1.2); color: #fff; }
body.rvg-lightbox-open { overflow: hidden; }
.rvg-lightbox-panel { display: grid; grid-template-rows: 44px minmax(0,1fr) auto 78px; gap: 6px; width: min(100%, 1400px); height: min(100%, 980px); min-height: 0; padding: 12px; border: 1px solid rgba(255,255,255,.22); border-radius: 18px; background: rgba(255,255,255,.07); box-shadow: 0 22px 80px rgba(0,0,0,.35); }
.rvg-lightbox-toolbar { display: flex; align-items: center; justify-content: space-between; min-height: 0; }
.rvg-lightbox-actions { display: flex; align-items: center; gap: 8px; }
.rvg-lightbox-actions > button:not(.rvg-close) { min-height: 34px; padding: 5px 11px; border: 1px solid rgba(255,255,255,.26); border-radius: 8px; background: rgba(255,255,255,.12); color: #fff; font-size: 13px; line-height: 1.2; white-space: nowrap; }
.rvg-lightbox-actions > button:not(.rvg-close):hover { background: rgba(255,255,255,.24); }
.rvg-close { display: grid; place-items: center; width: 44px; height: 44px; padding: 0 !important; border: 0 !important; background: transparent !important; color: #fff !important; font-size: 34px !important; line-height: 1 !important; }
.rvg-lightbox-stage { position: relative; isolation: isolate; display: grid; grid-template-columns: 48px minmax(0,1fr) 48px; grid-template-rows: minmax(0,1fr); gap: 6px; overflow: hidden; min-width: 0; min-height: 0; border-radius: 12px; background: rgba(255,255,255,.08); }
.rvg-lightbox-backdrop { z-index: 0; opacity: .38; }
.rvg-lightbox-stage > button { z-index: 3; align-self: center; justify-self: center; width: 44px; height: 54px; }
.rvg-lightbox-prev { grid-column: 1; grid-row: 1; }
.rvg-lightbox-next { grid-column: 3; grid-row: 1; }
.rvg-lightbox-media { position: relative; z-index: 1; grid-column: 2; grid-row: 1; display: flex; align-items: center; justify-content: center; overflow: hidden; min-width: 0; min-height: 0; }
.rvg-lightbox-image { display: block; width: 100%; height: 100%; min-width: 0; min-height: 0; object-fit: contain; }
.rvg-lightbox-caption { min-height: 1.4em; max-height: 3em; overflow: hidden; margin: 0; text-align: center; }
.rvg-lightbox-thumbs { display: flex; align-items: center; gap: 8px; overflow-x: auto; overflow-y: hidden; min-height: 0; padding: 4px 0; scrollbar-width: thin; }
.rvg-lightbox-thumbs button { position: relative; display: block; flex: 0 0 84px; width: 84px; height: 64px; padding: 0 !important; overflow: hidden; border: 2px solid transparent !important; border-radius: 8px; background: rgba(255,255,255,.14) !important; }
.rvg-lightbox-thumbs button.is-active { border-color: #fff !important; }
.rvg-lightbox-thumbs img { display: block; width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 600px) {
  .rvg-thumbs { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .rvg--slider .rvg-thumb { flex-basis: 68px; width: 68px; height: 54px; }
  .rvg-stage { height: clamp(230px, 70vw, 430px); }
  .rvg-arrow { width: 34px; height: 44px; font-size: 26px !important; }
  .rvg-lightbox { padding: 6px; }
  .rvg-lightbox-panel { grid-template-rows: 40px minmax(0,1fr) auto 62px; padding: 7px; border-radius: 12px; }
  .rvg-lightbox-actions { gap: 4px; }
  .rvg-lightbox-actions > button:not(.rvg-close) { min-height: 30px; padding: 4px 6px; font-size: 11px; }
  .rvg-lightbox-stage { grid-template-columns: 34px minmax(0,1fr) 34px; gap: 2px; }
  .rvg-lightbox-stage > button { width: 32px; height: 46px; font-size: 25px !important; }
  .rvg-lightbox-thumbs button { flex-basis: 66px; width: 66px; height: 50px; }
  .rvg-watermark { font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) { .rvg-thumb img { transition: none; } }
