* { box-sizing: border-box; }
body { margin: 0; font-family: Arial, Helvetica, sans-serif; background: #050816; color: #fff; }
.page-shell { min-height: 100vh; background: radial-gradient(circle at top left, rgba(0,130,255,.18), transparent 35%), radial-gradient(circle at bottom right, rgba(0,200,255,.12), transparent 35%), #050816; }
.hero { padding: 90px 8% 40px; text-align: center; }
.section-kicker { color: #4db8ff; text-transform: uppercase; letter-spacing: 3px; font-size: .85rem; font-weight: 700; margin-bottom: 10px; }
.hero h1, .upload-gallery-header h2 { font-size: clamp(2.2rem, 6vw, 4.5rem); margin: 0 0 16px; background: linear-gradient(90deg, #fff, #55c7ff); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.hero p, .upload-gallery-header p { max-width: 760px; margin: 0 auto; color: #b8c7dd; line-height: 1.7; font-size: 1.05rem; }
.server-gallery-section { padding: 60px 8% 90px; }
.upload-gallery-header { max-width: 780px; margin: 0 auto 40px; text-align: center; }
.upload-form { max-width: 900px; margin: 0 auto; }
.admin-password-box { margin: 0 auto 22px; }
.admin-password-box label { display: block; margin-bottom: 8px; color: #d9ecff; font-weight: 700; }
.admin-password-box input { width: 100%; padding: 15px 18px; border-radius: 16px; border: 1px solid rgba(77,184,255,.35); background: rgba(255,255,255,.08); color: #fff; outline: none; font-size: 1rem; }
.drop-zone { width: 100%; min-height: 260px; border: 2px dashed rgba(77,184,255,.55); border-radius: 28px; background: linear-gradient(145deg, rgba(255,255,255,.06), rgba(255,255,255,.02)), rgba(10,20,40,.82); display: flex; align-items: center; justify-content: center; text-align: center; padding: 35px; cursor: pointer; transition: .25s; }
.drop-zone.drag-over { border-color: #78d6ff; transform: scale(1.015); box-shadow: 0 0 35px rgba(77,184,255,.28); }
.drop-zone input[type="file"] { position: absolute; left: -9999px; opacity: 0; }
.drop-icon { width: 72px; height: 72px; margin: 0 auto 18px; border-radius: 50%; display: grid; place-items: center; font-size: 2rem; background: rgba(77,184,255,.15); border: 1px solid rgba(77,184,255,.35); color: #7ed8ff; }
.drop-zone h3 { font-size: 1.7rem; margin-bottom: 8px; }
.drop-zone p { color: #b8c7dd; margin-bottom: 20px; }
.fake-upload-btn, .upload-btn, .view-gallery-link { border: none; border-radius: 999px; padding: 13px 24px; font-weight: 800; cursor: pointer; transition: .25s; text-decoration: none; display: inline-block; }
.fake-upload-btn, .upload-btn { background: linear-gradient(135deg, #168cff, #55d7ff); color: #fff; box-shadow: 0 10px 30px rgba(0,140,255,.32); }
.view-gallery-link { background: rgba(255,255,255,.08); color: #fff; border: 1px solid rgba(255,255,255,.15); }
.upload-btn:hover, .view-gallery-link:hover, .fake-upload-btn:hover { transform: translateY(-2px); }
.selected-files { margin-top: 18px; margin-bottom: 0 !important; color: #78d6ff !important; font-weight: 700; }
.gallery-actions { margin: 28px auto 35px; display: flex; justify-content: flex-end; gap: 12px; flex-wrap: wrap; }
.upload-status { text-align: center; color: #78d6ff; font-weight: 700; margin: 20px 0; }
.debug-box { max-width: 900px; min-height: 120px; margin: 0 auto 35px; padding: 18px; border-radius: 18px; background: rgba(0,0,0,.45); border: 1px solid rgba(77,184,255,.22); color: #d9ecff; overflow: auto; white-space: pre-wrap; font-size: .9rem; }
.custom-gallery-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.custom-gallery-item { position: relative; height: 270px; border-radius: 22px; overflow: hidden; background: #101827; border: 1px solid rgba(77,184,255,.22); box-shadow: 0 20px 45px rgba(0,0,0,.35); }
.custom-gallery-item img { width: 100%; height: 100%; object-fit: cover; cursor: pointer; transition: .45s; }
.custom-gallery-item:hover img { transform: scale(1.08); filter: brightness(.75); }
.image-preview-modal { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; padding: 30px; background: rgba(0,0,0,.9); z-index: 9999; }
.image-preview-modal.active { display: flex; }
.image-preview-modal img { max-width: 92%; max-height: 86vh; border-radius: 20px; border: 1px solid rgba(77,184,255,.35); box-shadow: 0 0 45px rgba(77,184,255,.32); }
.modal-close-btn { position: absolute; top: 24px; right: 34px; background: none; border: none; color: #fff; font-size: 3rem; cursor: pointer; }
.modal-close-btn:hover { color: #4db8ff; }
@media (max-width: 950px) { .custom-gallery-grid { grid-template-columns: repeat(2, 1fr); } .custom-gallery-item { height: 240px; } }
@media (max-width: 620px) { .hero, .server-gallery-section { padding-left: 6%; padding-right: 6%; } .custom-gallery-grid { grid-template-columns: 1fr; } .custom-gallery-item { height: 230px; } .gallery-actions { justify-content: center; } }

/* Simple admin landing page */
.admin-home {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.admin-home-card {
  width: min(720px, 100%);
  text-align: center;
  padding: 48px 28px;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(77, 184, 255, 0.25);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
}

.admin-home-card h1 {
  margin: 0 0 12px;
  font-size: clamp(2rem, 6vw, 3.5rem);
  background: linear-gradient(90deg, #fff, #55c7ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.admin-home-card p {
  margin: 0 0 30px;
  color: #b8c7dd;
  font-size: 1.08rem;
}

.admin-home-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.admin-home-btn {
  min-width: 190px;
  border-radius: 999px;
  padding: 15px 26px;
  font-weight: 800;
  text-decoration: none;
  background: linear-gradient(135deg, #168cff, #55d7ff);
  color: #fff;
  box-shadow: 0 10px 30px rgba(0,140,255,.32);
  transition: .25s;
}

.admin-home-btn.secondary {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.16);
}

.admin-home-btn:hover {
  transform: translateY(-2px);
}

/* Secure login / FTP folder picker additions */
.login-card { max-width: 520px; }
.secure-form { display: grid; gap: 18px; margin-top: 26px; }
.secure-form label { display: grid; gap: 8px; color: #d9ecff; font-weight: 800; text-align: left; }
.secure-form input, .secure-form select {
  width: 100%; padding: 14px 16px; border-radius: 14px;
  border: 1px solid rgba(77,184,255,.35); background: rgba(255,255,255,.08);
  color: #fff; outline: none; font-size: 1rem;
}
.secure-form select option { color: #111; }
.wide-form { max-width: 900px; margin: 0 auto; }
.folder-filter { max-width: 900px; margin: 0 auto 22px; grid-template-columns: 1fr auto; align-items: end; }
.form-error, .form-message { padding: 14px 16px; border-radius: 14px; line-height: 1.5; }
.form-error, .form-message.error { background: rgba(255,80,100,.13); border: 1px solid rgba(255,80,100,.35); color: #ffb8c2; }
.form-message.success { background: rgba(70,255,160,.12); border: 1px solid rgba(70,255,160,.35); color: #b7ffd7; }
.form-message.info { background: rgba(77,184,255,.12); border: 1px solid rgba(77,184,255,.32); color: #d9ecff; }
@media (max-width: 720px) { .folder-filter { grid-template-columns: 1fr; } }

/* Speed-up gallery additions */
.custom-gallery-grid a.custom-gallery-item { display: block; color: inherit; text-decoration: none; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 30px 0 8px; flex-wrap: wrap; }
.page-indicator { color: #d8f2ff; font-weight: 800; opacity: .95; }
.gallery-count { margin: 18px 0 20px; }

/* Gallery click-to-open slider */
.gallery-slider-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 30px 82px;
  background: rgba(0, 0, 0, .92);
  z-index: 10000;
}
.gallery-slider-modal.active { display: flex; }
.gallery-slider-frame {
  margin: 0;
  width: min(1120px, 100%);
  max-height: 88vh;
  display: grid;
  place-items: center;
  gap: 14px;
}
.gallery-slider-frame img {
  max-width: 100%;
  max-height: 78vh;
  border-radius: 20px;
  border: 1px solid rgba(77,184,255,.35);
  box-shadow: 0 0 45px rgba(77,184,255,.32);
  object-fit: contain;
  background: rgba(255,255,255,.04);
}
.gallery-slider-frame figcaption {
  max-width: 100%;
  color: #d9ecff;
  font-weight: 800;
  text-align: center;
  overflow-wrap: anywhere;
}
.gallery-slider-close,
.gallery-slider-arrow {
  position: absolute;
  border: 1px solid rgba(255,255,255,.2);
  background: rgba(255,255,255,.1);
  color: #fff;
  cursor: pointer;
  transition: .2s;
  backdrop-filter: blur(8px);
}
.gallery-slider-close:hover,
.gallery-slider-arrow:hover { transform: scale(1.06); background: rgba(77,184,255,.22); }
.gallery-slider-close {
  top: 22px;
  right: 28px;
  width: 52px;
  height: 52px;
  border-radius: 999px;
  font-size: 2.3rem;
  line-height: 1;
}
.gallery-slider-arrow {
  top: 50%;
  transform: translateY(-50%);
  width: 58px;
  height: 72px;
  border-radius: 18px;
  font-size: 2.2rem;
}
.gallery-slider-arrow:hover { transform: translateY(-50%) scale(1.06); }
.gallery-slider-prev { left: 20px; }
.gallery-slider-next { right: 20px; }
body.slider-open { overflow: hidden; }
@media (max-width: 720px) {
  .gallery-slider-modal { padding: 80px 16px 28px; }
  .gallery-slider-arrow { width: 48px; height: 58px; font-size: 1.8rem; }
  .gallery-slider-prev { left: 8px; }
  .gallery-slider-next { right: 8px; }
  .gallery-slider-close { top: 14px; right: 14px; }
}

/* Gallery slider preview filmstrip upgrade */
.gallery-slider-content {
  width: min(1180px, 100%);
  max-height: 92vh;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  justify-items: center;
}
.gallery-slider-content .gallery-slider-frame {
  width: 100%;
  max-height: 74vh;
}
.gallery-slider-content .gallery-slider-frame img {
  max-height: 64vh;
}
.gallery-slider-strip-wrap {
  width: min(1040px, 100%);
  padding: 12px;
  border-radius: 20px;
  border: 1px solid rgba(77,184,255,.25);
  background: rgba(255,255,255,.08);
  box-shadow: 0 18px 40px rgba(0,0,0,.35);
  overflow: hidden;
}
.gallery-slider-thumbs {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 2px 10px;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}
.gallery-slider-thumb {
  flex: 0 0 104px;
  height: 74px;
  padding: 0;
  border-radius: 14px;
  border: 2px solid rgba(255,255,255,.18);
  background: rgba(0,0,0,.35);
  overflow: hidden;
  cursor: pointer;
  opacity: .68;
  transition: .18s;
  scroll-snap-align: center;
}
.gallery-slider-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.gallery-slider-thumb:hover,
.gallery-slider-thumb:focus,
.gallery-slider-thumb.active {
  opacity: 1;
  transform: translateY(-2px);
  border-color: rgba(85,215,255,.95);
  box-shadow: 0 0 22px rgba(77,184,255,.42);
  outline: none;
}
@media (max-width: 720px) {
  .gallery-slider-content { max-height: 90vh; gap: 12px; }
  .gallery-slider-content .gallery-slider-frame img { max-height: 56vh; }
  .gallery-slider-strip-wrap { padding: 10px; }
  .gallery-slider-thumb { flex-basis: 82px; height: 62px; }
}


/* Photo + video gallery support */
.custom-gallery-item video,
.custom-gallery-item img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.gallery-video-item { position: relative; }
.video-play-badge,
.thumb-video-badge {
  position: absolute;
  display: grid;
  place-items: center;
  color: #fff;
  background: rgba(0,0,0,.58);
  border: 1px solid rgba(255,255,255,.28);
  box-shadow: 0 10px 24px rgba(0,0,0,.35);
  pointer-events: none;
}
.video-play-badge {
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  width: 54px;
  height: 54px;
  border-radius: 999px;
  font-size: 1.45rem;
}
.gallery-slider-media {
  width: 100%;
  display: grid;
  place-items: center;
}
.gallery-slider-media img,
.gallery-slider-media video {
  max-width: 100%;
  max-height: 64vh;
  border-radius: 20px;
  border: 1px solid rgba(77,184,255,.35);
  box-shadow: 0 0 45px rgba(77,184,255,.32);
  object-fit: contain;
  background: rgba(255,255,255,.04);
}
.gallery-slider-thumb { position: relative; }
.gallery-slider-thumb video,
.gallery-slider-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.thumb-video-badge {
  right: 8px;
  bottom: 8px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  font-size: .8rem;
}
@media (max-width: 720px) {
  .gallery-slider-media img,
  .gallery-slider-media video { max-height: 56vh; }
}

/* Always-visible Admin filmstrip media viewer */
.admin-media-viewer {
  margin: 24px 0 34px;
  padding: 22px;
  border-radius: 28px;
  border: 1px solid rgba(77,184,255,.24);
  background: linear-gradient(145deg, rgba(255,255,255,.07), rgba(255,255,255,.025));
  box-shadow: 0 24px 70px rgba(0,0,0,.35);
}
.admin-media-window-wrap {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
}
.admin-media-window {
  margin: 0;
  min-height: 440px;
  border-radius: 26px;
  border: 1px solid rgba(77,184,255,.28);
  background: radial-gradient(circle at center, rgba(77,184,255,.13), rgba(2,8,20,.84) 58%);
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  place-items: center;
  overflow: hidden;
}
.admin-media-stage {
  width: 100%;
  min-height: 390px;
  display: grid;
  place-items: center;
  padding: 18px;
}
.admin-media-stage img,
.admin-media-stage video {
  max-width: 100%;
  max-height: 70vh;
  border-radius: 20px;
  border: 1px solid rgba(77,184,255,.34);
  box-shadow: 0 0 45px rgba(77,184,255,.25);
  object-fit: contain;
  background: rgba(0,0,0,.28);
}
.admin-media-window figcaption {
  width: 100%;
  padding: 12px 16px 16px;
  color: #d9ecff;
  text-align: center;
  font-weight: 800;
  overflow-wrap: anywhere;
}
.admin-viewer-arrow {
  width: 50px;
  height: 70px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 18px;
  background: rgba(255,255,255,.08);
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
  transition: .2s;
}
.admin-viewer-arrow:hover {
  transform: translateY(-2px);
  background: rgba(77,184,255,.22);
  box-shadow: 0 0 22px rgba(77,184,255,.25);
}
.admin-filmstrip-wrap {
  margin-top: 16px;
  padding: 12px;
  border-radius: 20px;
  background: rgba(0,0,0,.25);
  border: 1px solid rgba(255,255,255,.1);
  overflow: hidden;
}
.admin-filmstrip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 2px 10px;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}
.admin-filmstrip-thumb {
  flex: 0 0 112px;
  height: 78px;
  padding: 0;
  position: relative;
  border-radius: 15px;
  border: 2px solid rgba(255,255,255,.16);
  background: rgba(0,0,0,.38);
  overflow: hidden;
  opacity: .68;
  cursor: pointer;
  transition: .18s;
  scroll-snap-align: center;
}
.admin-filmstrip-thumb img,
.admin-filmstrip-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.admin-filmstrip-thumb:hover,
.admin-filmstrip-thumb:focus,
.admin-filmstrip-thumb.active,
.custom-gallery-item.active {
  opacity: 1;
  transform: translateY(-2px);
  border-color: rgba(85,215,255,.95);
  box-shadow: 0 0 22px rgba(77,184,255,.42);
  outline: none;
}
.admin-viewer-help {
  margin: 12px 4px 0;
  color: #b8c7dd;
  text-align: center;
  line-height: 1.5;
}
.admin-gallery-list-title {
  margin: 30px 0 16px;
  color: #d9ecff;
  font-size: 1.2rem;
}
.custom-gallery-item video,
.custom-gallery-item img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.custom-gallery-item.active {
  border-width: 2px;
}
@media (max-width: 760px) {
  .admin-media-viewer { padding: 14px; }
  .admin-media-window-wrap { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-media-window { order: 1; grid-column: 1 / -1; min-height: 310px; }
  .admin-viewer-arrow { width: 100%; height: 46px; font-size: 1.5rem; }
  .admin-viewer-prev { order: 2; grid-column: 1; }
  .admin-viewer-next { order: 3; grid-column: 2; }
  .admin-media-stage { min-height: 260px; padding: 12px; }
  .admin-media-stage img,
  .admin-media-stage video { max-height: 54vh; }
  .admin-filmstrip-thumb { flex-basis: 84px; height: 62px; }
}

/* Responsive polish added for desktop, tablets, and phones */
html { -webkit-text-size-adjust: 100%; }
img, video, svg { max-width: 100%; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
input, select, textarea, button { font: inherit; }
.page-shell { overflow-x: hidden; }
.hero { padding-top: clamp(46px, 8vw, 90px); }
.server-gallery-section { width: min(1320px, 100%); margin-inline: auto; }
.secure-form input,
.secure-form select,
.admin-password-box input { min-height: 48px; font-size: 16px; }
.fake-upload-btn,
.upload-btn,
.view-gallery-link,
.admin-home-btn { min-height: 48px; display: inline-flex; align-items: center; justify-content: center; text-align: center; }
.gallery-actions { align-items: center; }
.custom-gallery-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.custom-gallery-item { aspect-ratio: 4 / 3; height: auto; min-height: 190px; }
.admin-media-viewer { width: min(1180px, 100%); margin-inline: auto; }
.admin-media-stage img,
.admin-media-stage video,
.gallery-slider-media img,
.gallery-slider-media video { width: auto; height: auto; }
.admin-filmstrip,
.gallery-slider-thumbs { overscroll-behavior-inline: contain; -webkit-overflow-scrolling: touch; }
.admin-filmstrip-thumb,
.gallery-slider-thumb { touch-action: manipulation; }
.pagination .view-gallery-link { min-width: 120px; }

@media (min-width: 1200px) {
  .custom-gallery-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .admin-media-stage { min-height: 430px; }
}

@media (max-width: 980px) {
  .hero { padding-left: 5%; padding-right: 5%; }
  .server-gallery-section { padding: 42px 5% 72px; }
  .custom-gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .folder-filter { max-width: 100%; }
  .admin-media-window-wrap { gap: 10px; }
  .admin-viewer-arrow { width: 44px; height: 62px; }
  .admin-home-card { padding: 40px 24px; }
}

@media (max-width: 720px) {
  .hero { padding: 38px 18px 24px; }
  .hero h1,
  .upload-gallery-header h2 { font-size: clamp(2rem, 12vw, 3.1rem); line-height: 1; }
  .hero p,
  .upload-gallery-header p { font-size: .98rem; }
  .section-kicker { font-size: .72rem; letter-spacing: 2px; }
  .server-gallery-section { padding: 28px 14px 56px; }
  .secure-form { gap: 14px; }
  .folder-filter { grid-template-columns: 1fr; }
  .folder-filter .upload-btn { width: 100%; }
  .gallery-actions { display: grid; grid-template-columns: 1fr; gap: 10px; margin: 20px auto 26px; }
  .gallery-actions > * { width: 100%; }
  .custom-gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .custom-gallery-item { min-height: 150px; border-radius: 16px; }
  .admin-media-viewer { padding: 12px; border-radius: 20px; margin: 18px 0 28px; }
  .admin-media-window-wrap { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-media-window { grid-column: 1 / -1; min-height: 300px; border-radius: 20px; }
  .admin-media-stage { min-height: 230px; padding: 10px; }
  .admin-media-stage img,
  .admin-media-stage video { max-height: 48vh; border-radius: 15px; }
  .admin-media-window figcaption { padding: 10px 12px 14px; font-size: .9rem; }
  .admin-viewer-arrow { width: 100%; height: 46px; border-radius: 14px; }
  .admin-viewer-prev { grid-column: 1; }
  .admin-viewer-next { grid-column: 2; }
  .admin-filmstrip-wrap { padding: 9px; border-radius: 16px; }
  .admin-filmstrip-thumb { flex-basis: 82px; height: 60px; border-radius: 12px; }
  .admin-viewer-help { font-size: .92rem; }
  .drop-zone { min-height: 210px; padding: 24px 16px; border-radius: 22px; }
  .drop-icon { width: 60px; height: 60px; }
  .drop-zone h3 { font-size: 1.35rem; }
  .upload-form, .wide-form { width: 100%; }
  .admin-home { padding: 24px 14px; align-items: stretch; }
  .admin-home-card { padding: 32px 18px; border-radius: 22px; margin-block: auto; }
  .admin-home-actions { display: grid; grid-template-columns: 1fr; gap: 12px; }
  .admin-home-btn { width: 100%; min-width: 0; }
  .login-card { max-width: 100%; }
  .pagination { display: grid; grid-template-columns: 1fr; gap: 10px; }
  .page-indicator { text-align: center; }
}

@media (max-width: 430px) {
  .hero { padding-left: 12px; padding-right: 12px; }
  .server-gallery-section { padding-left: 10px; padding-right: 10px; }
  .custom-gallery-grid { grid-template-columns: 1fr; }
  .custom-gallery-item { min-height: 210px; }
  .admin-filmstrip-thumb { flex-basis: 72px; height: 54px; }
  .thumb-video-badge { width: 23px; height: 23px; right: 5px; bottom: 5px; }
  .form-message, .form-error { font-size: .94rem; }
}

@media (orientation: landscape) and (max-height: 520px) {
  .hero { padding-top: 24px; }
  .admin-media-window { min-height: 240px; }
  .admin-media-stage { min-height: 180px; }
  .admin-media-stage img,
  .admin-media-stage video { max-height: 56vh; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .001ms !important; }
}


/* Center-focused filmstrip slider behavior */
.admin-filmstrip {
  --filmstrip-side-pad: 0px;
  padding-left: var(--filmstrip-side-pad);
  padding-right: var(--filmstrip-side-pad);
  scroll-behavior: smooth;
}
.admin-filmstrip::before,
.admin-filmstrip::after {
  content: "";
  flex: 0 0 0;
}
.admin-filmstrip-thumb {
  transform-origin: center center;
}
.admin-filmstrip-thumb.active {
  transform: translateY(-2px) scale(1.08);
}
.admin-filmstrip-thumb:not(.active) {
  transform: scale(.94);
}
.admin-viewer-help strong {
  color: #dff4ff;
}


/* Reliable video thumbnails for protected FTP videos */
.video-thumb-placeholder {
  width: 100%;
  height: 100%;
  min-height: inherit;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 35% 25%, rgba(85, 215, 255, .28), transparent 34%),
    linear-gradient(135deg, rgba(20, 40, 80, .96), rgba(2, 8, 20, .96));
}
.video-thumb-placeholder::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: inherit;
  border: 1px solid rgba(255,255,255,.12);
}
.video-thumb-play {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  padding-left: 3px;
  background: rgba(77,184,255,.9);
  color: #fff;
  font-size: 1.25rem;
  box-shadow: 0 0 24px rgba(77,184,255,.38);
  z-index: 2;
}
.video-thumb-label {
  position: absolute;
  left: 8px;
  bottom: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(0,0,0,.62);
  color: #dff4ff;
  font-size: .68rem;
  font-weight: 900;
  letter-spacing: .08em;
  z-index: 2;
}
.admin-filmstrip-thumb .video-thumb-play {
  width: 34px;
  height: 34px;
  font-size: 1rem;
}
.admin-filmstrip-thumb .video-thumb-label {
  font-size: .56rem;
  left: 6px;
  bottom: 6px;
  padding: 3px 6px;
}
.video-grid-placeholder {
  min-height: 100%;
}


/* Keep prev/next buttons beside each other below the preview on smaller screens */
@media (max-width: 760px) {
  .admin-viewer-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}


/* Strong video thumbnail fallback: no browser-generated video frame needed */
.admin-filmstrip-thumb.video-thumb,
.custom-gallery-item.gallery-video-item {
  background: linear-gradient(135deg, rgba(13, 27, 53, .98), rgba(0, 113, 206, .58));
}

.video-poster-thumb {
  width: 100% !important;
  height: 100% !important;
  min-height: 100% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-direction: column !important;
  gap: 6px !important;
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  background:
    radial-gradient(circle at 30% 20%, rgba(85, 215, 255, .40), transparent 32%),
    radial-gradient(circle at 80% 75%, rgba(22, 140, 255, .26), transparent 34%),
    linear-gradient(135deg, #061224, #123763 55%, #050816);
}

.video-poster-thumb::before {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.16);
  pointer-events: none;
}

.video-poster-icon {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  padding-left: 3px;
  background: linear-gradient(135deg, #168cff, #55d7ff);
  color: white;
  font-size: 1rem;
  line-height: 1;
  box-shadow: 0 0 26px rgba(85,215,255,.55);
  z-index: 2;
}

.video-poster-text {
  color: #e7f8ff;
  font-size: .62rem;
  font-weight: 900;
  letter-spacing: .14em;
  z-index: 2;
  text-shadow: 0 2px 8px rgba(0,0,0,.45);
}

.video-poster-grid .video-poster-icon {
  width: 68px;
  height: 68px;
  font-size: 1.7rem;
}

.video-poster-grid .video-poster-text {
  font-size: .85rem;
}

.admin-filmstrip-thumb.video-thumb img,
.admin-filmstrip-thumb.video-thumb video,
.custom-gallery-item.gallery-video-item > video {
  display: none !important;
}

@media (max-width: 720px) {
  .video-poster-icon {
    width: 32px;
    height: 32px;
    font-size: .88rem;
  }
  .video-poster-text {
    font-size: .54rem;
  }
  .video-poster-grid .video-poster-icon {
    width: 58px;
    height: 58px;
    font-size: 1.4rem;
  }
}

/* Fallback tiles for photo formats browsers may not preview directly (HEIC/HEIF/TIFF, etc.) */
.gallery-file-item,
.admin-filmstrip-thumb.file-thumb {
  background: linear-gradient(135deg, rgba(13, 27, 53, .98), rgba(58, 95, 150, .58));
}

.file-thumb-placeholder {
  width: 100%;
  height: 100%;
  min-height: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  background:
    radial-gradient(circle at 30% 20%, rgba(85, 215, 255, .28), transparent 32%),
    radial-gradient(circle at 80% 75%, rgba(22, 140, 255, .18), transparent 34%),
    linear-gradient(135deg, #061224, #1b3558 55%, #050816);
  color: #e7f8ff;
  text-align: center;
}

.file-thumb-placeholder::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.16);
  pointer-events: none;
}

.file-thumb-icon {
  font-size: 2rem;
  z-index: 2;
}

.file-thumb-label,
.thumb-file-badge,
.gallery-file-badge {
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(77,184,255,.92);
  color: #fff;
  font-size: .78rem;
  font-weight: 900;
  letter-spacing: .08em;
  z-index: 2;
}

.file-thumb-note {
  color: #dff4ff;
  font-size: .78rem;
  font-weight: 700;
  z-index: 2;
}

.admin-filmstrip-thumb.file-thumb {
  display: grid;
  place-items: center;
  color: #fff;
}

.gallery-file-fallback {
  max-width: 520px;
  margin: auto;
  padding: 32px;
  border-radius: 22px;
  border: 1px solid rgba(255,255,255,.16);
  background:
    radial-gradient(circle at 30% 20%, rgba(85, 215, 255, .20), transparent 32%),
    linear-gradient(135deg, rgba(6,18,36,.98), rgba(20,52,90,.98));
  color: #e7f8ff;
  text-align: center;
  box-shadow: 0 18px 50px rgba(0,0,0,.35);
}

.gallery-file-fallback strong {
  display: block;
  margin-top: 14px;
  overflow-wrap: anywhere;
}

.gallery-file-fallback p {
  color: #b8c7dd;
  margin: 10px 0 18px;
}

.gallery-file-fallback a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 16px;
  border-radius: 999px;
  background: linear-gradient(135deg, #168cff, #55d7ff);
  color: #fff;
  text-decoration: none;
  font-weight: 800;
}




/* Selected-file actions live in the large admin display, not on thumbnails */
.admin-selected-actions {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  padding: 0 16px 18px;
}

.selected-media-form {
  margin: 0;
}

.selected-media-form[hidden] {
  display: none !important;
}

.convert-media-btn,
.delete-media-btn {
  border-radius: 999px;
  padding: 11px 16px;
  font-weight: 900;
  cursor: pointer;
  transition: .2s;
}

.convert-media-btn {
  border: 1px solid rgba(85, 215, 255, .55);
  background: rgba(77, 184, 255, .18);
  color: #dff7ff;
}

.convert-media-btn:hover,
.convert-media-btn:focus {
  transform: translateY(-2px);
  background: rgba(77, 184, 255, .28);
  border-color: rgba(85, 215, 255, .9);
}

@media (max-width: 620px) {
  .admin-selected-actions,
  .selected-media-form,
  .convert-media-btn,
  .delete-media-btn {
    width: 100%;
  }
}

/* Website editor dashboard */
.admin-dashboard {
  min-height: 100vh;
  padding: 32px min(4vw, 48px) 56px;
  display: block;
}

.admin-editor-header {
  width: min(1500px, 100%);
  margin: 0 auto 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  flex-wrap: wrap;
}

.admin-editor-brand {
  display: flex;
  align-items: center;
  gap: 18px;
}

.admin-editor-brand img {
  width: 82px;
  height: 82px;
  object-fit: contain;
  filter: drop-shadow(0 0 24px rgba(77,184,255,.3));
}

.admin-editor-brand h1 {
  margin: 0 0 8px;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1;
  background: linear-gradient(90deg, #fff, #55c7ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.admin-editor-subtitle {
  margin: 0;
  color: #b8c7dd;
  line-height: 1.6;
}

.admin-editor-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.admin-home-btn.compact {
  min-width: auto;
  padding: 11px 18px;
  font-size: .92rem;
}

.editor-overview-grid {
  width: min(1500px, 100%);
  margin: 0 auto 22px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.editor-stat-card,
.editor-panel,
.editor-main-area,
.preview-panel {
  border: 1px solid rgba(77,184,255,.24);
  background: linear-gradient(145deg, rgba(255,255,255,.08), rgba(255,255,255,.03)), rgba(8, 16, 32, .86);
  box-shadow: 0 24px 70px rgba(0,0,0,.32);
  backdrop-filter: blur(14px);
}

.editor-stat-card {
  min-height: 128px;
  border-radius: 24px;
  padding: 20px;
}

.editor-stat-card span {
  display: block;
  color: #78d6ff;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: .72rem;
  font-weight: 900;
  margin-bottom: 8px;
}

.editor-stat-card strong {
  display: block;
  font-size: 1.65rem;
  margin-bottom: 8px;
}

.editor-stat-card p,
.editor-help {
  margin: 0;
  color: #b8c7dd;
  line-height: 1.55;
}

.admin-editor-layout {
  width: min(1500px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 330px minmax(0, 1.2fr) minmax(360px, .8fr);
  gap: 18px;
  align-items: start;
}

.editor-sidebar {
  display: grid;
  gap: 16px;
}

.editor-panel,
.editor-main-area,
.preview-panel {
  border-radius: 26px;
  padding: 20px;
}

.editor-panel h2,
.editor-main-area h2,
.preview-panel h2 {
  margin: 0 0 12px;
}

.editor-label {
  display: grid;
  gap: 8px;
  margin: 14px 0;
  color: #d9ecff;
  font-weight: 900;
  text-align: left;
}

.editor-select,
.editor-input {
  width: 100%;
  padding: 13px 15px;
  border-radius: 14px;
  border: 1px solid rgba(77,184,255,.34);
  background: rgba(255,255,255,.08);
  color: #fff;
  outline: none;
  font-size: 1rem;
}

.editor-select option {
  color: #111;
}

.editor-input:focus,
.editor-select:focus,
.source-editor:focus {
  border-color: rgba(120,214,255,.75);
  box-shadow: 0 0 0 4px rgba(77,184,255,.13);
}

.short-area {
  min-height: 90px;
  resize: vertical;
}

.medium-area {
  min-height: 130px;
  resize: vertical;
}

.editor-button-stack {
  display: grid;
  gap: 11px;
  margin-top: 16px;
}

.editor-status {
  margin-top: 16px;
  padding: 13px 14px;
  border-radius: 15px;
  line-height: 1.5;
  color: #d9ecff;
  border: 1px solid rgba(77,184,255,.28);
  background: rgba(77,184,255,.1);
  overflow-wrap: anywhere;
}

.editor-status.success {
  color: #caffdf;
  border-color: rgba(70,255,160,.38);
  background: rgba(70,255,160,.1);
}

.editor-status.error {
  color: #ffbdc7;
  border-color: rgba(255,80,100,.38);
  background: rgba(255,80,100,.1);
}

.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.editor-toolbar .section-kicker {
  margin-bottom: 6px;
}

.editor-toolbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.source-editor {
  width: 100%;
  min-height: 720px;
  resize: vertical;
  padding: 18px;
  border-radius: 20px;
  border: 1px solid rgba(77,184,255,.3);
  background: rgba(0,0,0,.42);
  color: #ecfbff;
  font: 14px/1.55 Consolas, Monaco, 'Courier New', monospace;
  tab-size: 2;
  outline: none;
}

.preview-toolbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  flex-wrap: wrap;
}

.preview-size-btn {
  min-height: 40px;
  padding: 9px 12px;
  border-radius: 999px;
  border: 1px solid rgba(77,184,255,.28);
  background: rgba(255,255,255,.07);
  color: #d9ecff;
  font-weight: 900;
  cursor: pointer;
  transition: .18s;
}

.preview-size-btn:hover,
.preview-size-btn:focus,
.preview-size-btn.active {
  transform: translateY(-1px);
  border-color: rgba(85,215,255,.85);
  background: rgba(77,184,255,.2);
  color: #fff;
  outline: none;
}

.preview-resolution-label {
  margin: -4px 0 14px;
  color: #b8c7dd;
  line-height: 1.5;
  font-size: .93rem;
}

.preview-frame-wrap {
  width: 100%;
  min-height: 520px;
  overflow: hidden;
  border: 1px solid rgba(77,184,255,.24);
  border-radius: 20px;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.04);
}

.preview-frame-wrap.preview-fit-mode {
  min-height: 760px;
  overflow: auto;
}

.preview-frame {
  display: block;
  width: 1440px;
  height: 1100px;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: #fff;
  transform-origin: 0 0;
}

.disabled-panel {
  opacity: .58;
}

.disabled-panel .editor-help::after {
  content: ' Quick edits are available for HTML files only.';
  color: #78d6ff;
}

@media (max-width: 1250px) {
  .admin-editor-layout {
    grid-template-columns: 320px minmax(0, 1fr);
  }
  .preview-panel {
    grid-column: 1 / -1;
  }
  .preview-frame-wrap {
    min-height: 520px;
  }
}

@media (max-width: 900px) {
  .editor-overview-grid,
  .admin-editor-layout {
    grid-template-columns: 1fr;
  }
  .admin-editor-brand {
    align-items: flex-start;
  }
  .admin-editor-brand img {
    width: 64px;
    height: 64px;
  }
  .source-editor,
  .preview-frame-wrap {
    min-height: 520px;
  }
}

@media (max-width: 620px) {
  .admin-dashboard {
    padding: 22px 14px 44px;
  }
  .admin-editor-header,
  .admin-editor-nav,
  .editor-toolbar,
  .editor-toolbar-actions {
    align-items: stretch;
    justify-content: stretch;
  }
  .admin-editor-nav,
  .editor-toolbar-actions,
  .preview-toolbar-actions {
    width: 100%;
    display: grid;
  }
  .admin-home-btn.compact,
  .admin-home-btn,
  .preview-size-btn {
    width: 100%;
  }
}


/* iPhone / small-screen admin editor fixes */
html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

.admin-dashboard,
.admin-editor-header,
.editor-overview-grid,
.admin-editor-layout,
.editor-main-area,
.preview-panel,
.editor-panel {
  max-width: 100%;
}

.admin-editor-brand,
.admin-editor-brand > div,
.editor-toolbar,
.preview-toolbar-actions,
.admin-editor-nav {
  min-width: 0;
}

.admin-editor-subtitle,
.editor-help,
.editor-status,
.editor-label,
.editor-stat-card p,
.preview-resolution-label {
  overflow-wrap: anywhere;
}

.source-editor {
  max-width: 100%;
  overflow: auto;
}

.preview-panel {
  overflow: hidden;
}

.preview-frame-wrap {
  max-width: 100%;
}

@media (max-width: 760px) {
  .admin-dashboard {
    padding: 16px 10px 32px;
  }

  .admin-editor-header {
    display: grid;
    gap: 16px;
    margin-bottom: 16px;
  }

  .admin-editor-brand {
    display: grid;
    justify-items: center;
    text-align: center;
    gap: 10px;
  }

  .admin-editor-brand img {
    width: 58px;
    height: 58px;
  }

  .admin-editor-brand h1 {
    font-size: clamp(1.75rem, 11vw, 2.55rem);
    line-height: 1.05;
  }

  .admin-editor-subtitle {
    font-size: .95rem;
    line-height: 1.45;
  }

  .admin-editor-nav,
  .editor-toolbar-actions,
  .preview-toolbar-actions,
  .editor-button-stack,
  .admin-home-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
    gap: 10px;
  }

  .admin-home-btn,
  .admin-home-btn.compact,
  .preview-size-btn {
    width: 100%;
    min-width: 0;
    justify-content: center;
    text-align: center;
    white-space: normal;
  }

  .editor-overview-grid {
    gap: 10px;
    margin-bottom: 14px;
  }

  .editor-stat-card {
    min-height: auto;
    padding: 14px;
    border-radius: 18px;
  }

  .editor-stat-card strong {
    font-size: 1.25rem;
  }

  .admin-editor-layout {
    gap: 12px;
  }

  .editor-panel,
  .editor-main-area,
  .preview-panel {
    padding: 14px;
    border-radius: 18px;
  }

  .editor-toolbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .editor-main-area h2,
  .preview-panel h2,
  .editor-panel h2 {
    font-size: 1.25rem;
  }

  .editor-select,
  .editor-input {
    font-size: 16px; /* prevents iPhone zoom-on-focus */
    padding: 12px 13px;
  }

  .source-editor {
    min-height: 360px;
    font-size: 13px;
    line-height: 1.5;
    padding: 13px;
    border-radius: 14px;
    white-space: pre;
  }

  .preview-resolution-label {
    font-size: .85rem;
  }

  .preview-frame-wrap,
  .preview-frame-wrap.preview-fit-mode {
    min-height: 420px;
    border-radius: 14px;
  }
}

@media (max-width: 430px) {
  .admin-dashboard {
    padding-left: 8px;
    padding-right: 8px;
  }

  .admin-editor-brand h1 {
    font-size: 2rem;
  }

  .section-kicker {
    letter-spacing: 1.8px;
    font-size: .7rem;
  }

  .editor-stat-card span {
    letter-spacing: 1.4px;
  }

  .preview-frame-wrap,
  .preview-frame-wrap.preview-fit-mode {
    min-height: 390px;
  }
}
