:root {
  color-scheme: dark;
  --bg: #141414;
  --bg-soft: #0b0b0b;
  --surface: #181818;
  --surface-raised: #222222;
  --text: #f5f5f1;
  --muted: #b3b3b3;
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.2);
  --accent: #e50914;
  --accent-strong: #f40612;
  --accent-soft: rgba(229, 9, 20, 0.18);
  --cyan: #e50914;
  --gold: #f5f5f1;
  --danger: #e50914;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.46);
}

body.theme-colorful {
  color-scheme: light;
  --bg: #f3f4f5;
  --bg-soft: #e7e9eb;
  --surface: #ffffff;
  --surface-raised: #f8f8f9;
  --text: #28282b;
  --muted: #74747b;
  --line: rgba(40, 40, 43, 0.14);
  --line-strong: rgba(40, 40, 43, 0.28);
  --accent: #f05f9b;
  --accent-strong: #d94783;
  --accent-soft: rgba(240, 95, 155, 0.14);
  --cyan: #f05f9b;
  --gold: #47474c;
  --danger: #d9366e;
  --shadow: 0 18px 42px rgba(35, 35, 40, 0.12);
  background:
    linear-gradient(90deg, rgba(240, 95, 155, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(40, 40, 43, 0.045) 1px, transparent 1px),
    linear-gradient(135deg, #ffffff 0%, #f2f3f4 52%, #f9edf2 100%);
  background-size: 48px 48px, 48px 48px, auto;
  background-attachment: fixed;
}

body.theme-mint {
  --accent: #63b99a;
  --accent-strong: #439c7c;
  --accent-soft: rgba(99, 185, 154, 0.15);
  --cyan: #63b99a;
  --gold: #46534e;
  --danger: #d85478;
  background:
    linear-gradient(90deg, rgba(99, 185, 154, 0.1) 1px, transparent 1px),
    linear-gradient(rgba(40, 40, 43, 0.045) 1px, transparent 1px),
    linear-gradient(135deg, #ffffff 0%, #f1f4f3 52%, #edf8f3 100%);
  background-size: 48px 48px, 48px 48px, auto;
  background-attachment: fixed;
}

body.theme-blue {
  --accent: #4f91d8;
  --accent-strong: #3579c3;
  --accent-soft: rgba(79, 145, 216, 0.15);
  --cyan: #4f91d8;
  --gold: #46515d;
  --danger: #d85478;
  background:
    linear-gradient(90deg, rgba(79, 145, 216, 0.1) 1px, transparent 1px),
    linear-gradient(rgba(40, 40, 43, 0.045) 1px, transparent 1px),
    linear-gradient(135deg, #ffffff 0%, #f1f3f5 52%, #edf5fc 100%);
  background-size: 48px 48px, 48px 48px, auto;
  background-attachment: fixed;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.86) 0, rgba(20, 20, 20, 0) 360px),
    var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

button,
input {
  font: inherit;
}

main,
section,
input,
button,
.app-shell,
.tools-panel,
.library-panel,
.section-header,
.library-actions,
.bulk-actions,
.archive-controls,
.scan-row,
.upload-grid,
.video-list {
  min-width: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  min-height: 40px;
  border: 0;
  border-radius: 4px;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  font-weight: 700;
  padding: 0 16px;
  transition: background 160ms ease, transform 160ms ease, border-color 160ms ease;
}

button:hover {
  background: var(--accent-strong);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

button:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

body.import-busy button:disabled,
body.import-busy input:disabled {
  cursor: progress;
}

button:disabled:hover {
  background: var(--accent);
  transform: none;
}

button.danger {
  background: rgba(255, 255, 255, 0.08);
  color: #f5f5f1;
  border: 1px solid rgba(255, 255, 255, 0.24);
}

button.danger:hover {
  background: rgba(229, 9, 20, 0.92);
  border-color: rgba(229, 9, 20, 0.92);
  color: #ffffff;
}

input[type="text"],
input[type="search"] {
  width: 100%;
  max-width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.58);
  color: var(--text);
  outline: none;
  padding: 0 13px;
}

input[type="text"]::placeholder,
input[type="search"]::placeholder {
  color: #777777;
}

input[type="text"]:focus,
input[type="search"]:focus {
  border-color: rgba(229, 9, 20, 0.78);
  box-shadow: 0 0 0 3px rgba(229, 9, 20, 0.18);
}

.app-shell {
  width: min(1520px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 22px 0 40px;
}

body.player-open {
  overflow: hidden;
}

body.manual-player-fullscreen {
  overflow: hidden;
}

body.audio-mode .player-frame video {
  opacity: 0;
  pointer-events: none;
}

body.audio-mode .player-frame::after {
  content: "♪";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 56px;
  color: rgba(255, 255, 255, 0.18);
  pointer-events: none;
}

body.visitor-locked {
  overflow: hidden;
}

body.visitor-locked .app-shell {
  pointer-events: none;
  user-select: none;
  filter: blur(2px);
  opacity: 0.48;
}

body.visitor-locked .mobile-now-playing-bar,
body.visitor-locked .mobile-share-status {
  display: none;
}

.visitor-gate {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(8px);
}

body:not(.visitor-locked) .visitor-gate {
  display: none;
}

.visitor-gate-panel {
  width: min(420px, 100%);
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.72);
  padding: 22px;
}

body.theme-colorful .visitor-gate {
  background:
    linear-gradient(90deg, rgba(240, 95, 155, 0.12) 1px, transparent 1px),
    linear-gradient(rgba(40, 40, 43, 0.06) 1px, transparent 1px),
    rgba(239, 240, 242, 0.92);
  background-size: 40px 40px;
}

body.theme-colorful .visitor-gate-panel {
  border-color: rgba(40, 40, 43, 0.2);
  border-top: 5px solid var(--accent);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 12px 12px 0 rgba(40, 40, 43, 0.1), 0 24px 64px rgba(35, 35, 40, 0.14);
}

body.theme-colorful .visitor-gate-panel h1 {
  background: none;
  color: var(--text);
}

body.theme-colorful button:not(.player-backdrop):not(.visitor-history-backdrop) {
  border-radius: 3px;
}

body.theme-colorful .tools-panel,
body.theme-colorful .library-panel,
body.theme-colorful .visitor-history-panel {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.94);
}

body.theme-colorful input[type="text"],
body.theme-colorful input[type="search"] {
  border-color: var(--line-strong);
  border-radius: 2px;
  background: #ffffff;
  color: var(--text);
}

body.theme-colorful input[type="text"]::placeholder,
body.theme-colorful input[type="search"]::placeholder {
  color: #96969c;
}

body.theme-colorful .dropzone:hover,
body.theme-colorful .video-item:hover,
body.theme-colorful .video-item.active,
body.theme-colorful .video-item.selected {
  background: #fff3f8;
}

body.theme-colorful .video-item {
  border-color: var(--line);
  border-radius: 2px;
  box-shadow: 6px 6px 0 rgba(40, 40, 43, 0.08);
}

body.theme-colorful .video-item:hover {
  border-color: rgba(240, 95, 155, 0.5);
  box-shadow: 10px 12px 28px rgba(73, 47, 60, 0.2);
}

body.theme-colorful .video-item:hover .video-title,
body.theme-colorful .folder-breadcrumb button.active {
  color: var(--text);
}

body.theme-colorful .folder-breadcrumb button:hover {
  color: var(--accent-strong);
}

body.theme-colorful .breadcrumb-separator {
  color: rgba(40, 40, 43, 0.32);
}

body.theme-colorful .folder-item::before {
  border-color: rgba(217, 71, 131, 0.45);
  background: linear-gradient(180deg, #f58ab7, #e6518e);
}

body.theme-colorful .folder-item::after {
  border-color: rgba(217, 71, 131, 0.38);
  background: linear-gradient(180deg, #f487b5 0%, #e25390 58%, #c93c77 100%);
}

body.theme-colorful .folder-item:hover::before,
body.theme-colorful .folder-item:focus-visible::before {
  background: linear-gradient(180deg, #ffa8cb, #f05f9b);
}

body.theme-colorful .folder-item:hover::after,
body.theme-colorful .folder-item:focus-visible::after {
  border-color: rgba(217, 71, 131, 0.56);
  background: linear-gradient(180deg, #f998bf 0%, #e95d99 58%, #cf417c 100%);
}

body.theme-colorful .folder-item .folder-title {
  color: #ffffff;
}

body.theme-colorful .folder-item .folder-meta {
  color: #ffe7f1;
}

body.theme-colorful .visitor-history-head,
body.theme-colorful .visitor-history-day-nav,
body.theme-colorful .visitor-history-stat,
body.theme-colorful .visitor-history-empty,
body.theme-colorful .visitor-history-row {
  border-color: var(--line);
  background: #ffffff;
}

body.theme-colorful .visitor-history-list,
body.theme-colorful .visitor-history-stats {
  background: var(--line);
}

body.theme-mint .visitor-gate {
  background:
    linear-gradient(90deg, rgba(99, 185, 154, 0.14) 1px, transparent 1px),
    linear-gradient(rgba(40, 40, 43, 0.06) 1px, transparent 1px),
    rgba(239, 243, 241, 0.92);
  background-size: 40px 40px;
}

body.theme-mint .dropzone:hover,
body.theme-mint .video-item:hover,
body.theme-mint .video-item.active,
body.theme-mint .video-item.selected {
  background: #effaf5;
}

body.theme-mint .video-item:hover {
  border-color: rgba(67, 156, 124, 0.5);
  box-shadow: 10px 12px 28px rgba(47, 76, 65, 0.18);
}

body.theme-mint .folder-item::before {
  border-color: rgba(67, 156, 124, 0.45);
  background: linear-gradient(180deg, #98d9bf, #58ad8e);
}

body.theme-mint .folder-item::after {
  border-color: rgba(67, 156, 124, 0.38);
  background: linear-gradient(180deg, #8fd4b8 0%, #58ad8e 58%, #398c70 100%);
}

body.theme-mint .folder-item:hover::before,
body.theme-mint .folder-item:focus-visible::before {
  background: linear-gradient(180deg, #b9ead6, #69c2a1);
}

body.theme-mint .folder-item:hover::after,
body.theme-mint .folder-item:focus-visible::after {
  border-color: rgba(67, 156, 124, 0.56);
  background: linear-gradient(180deg, #a7dfc8 0%, #62b898 58%, #419476 100%);
}

body.theme-mint .folder-item .folder-meta {
  color: #e4fff3;
}

body.theme-blue .visitor-gate {
  background:
    linear-gradient(90deg, rgba(79, 145, 216, 0.14) 1px, transparent 1px),
    linear-gradient(rgba(40, 40, 43, 0.06) 1px, transparent 1px),
    rgba(238, 242, 246, 0.92);
  background-size: 40px 40px;
}

body.theme-blue .dropzone:hover,
body.theme-blue .video-item:hover,
body.theme-blue .video-item.active,
body.theme-blue .video-item.selected {
  background: #eff6fd;
}

body.theme-blue .video-item:hover {
  border-color: rgba(53, 121, 195, 0.5);
  box-shadow: 10px 12px 28px rgba(43, 66, 91, 0.18);
}

body.theme-blue .folder-item::before {
  border-color: rgba(53, 121, 195, 0.45);
  background: linear-gradient(180deg, #8fc1ee, #4f91d8);
}

body.theme-blue .folder-item::after {
  border-color: rgba(53, 121, 195, 0.38);
  background: linear-gradient(180deg, #84b9e9 0%, #4b8bd0 58%, #316cae 100%);
}

body.theme-blue .folder-item:hover::before,
body.theme-blue .folder-item:focus-visible::before {
  background: linear-gradient(180deg, #b2d7f5, #66a6e2);
}

body.theme-blue .folder-item:hover::after,
body.theme-blue .folder-item:focus-visible::after {
  border-color: rgba(53, 121, 195, 0.56);
  background: linear-gradient(180deg, #9bc9ef 0%, #5798d8 58%, #3978b9 100%);
}

body.theme-blue .folder-item .folder-meta {
  color: #e4f3ff;
}


.visitor-gate-panel h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.1;
}

.visitor-gate-panel p {
  margin: 0;
  color: var(--muted);
}

.visitor-gate-input {
  min-height: 44px;
}

.visitor-gate-error {
  min-height: 20px;
  color: #ff8c8c;
}

.sc-font-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.sc-font-label input[type="checkbox"] {
  width: 15px;
  height: 15px;
  min-height: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

body.sc-font {
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", "Source Han Sans SC", system-ui, sans-serif;
}

.section-header h2,
.section-header p,
.now-playing h2,
.now-playing p {
  margin: 0;
}

.player-overlay[hidden] {
  display: none;
}

.player-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
}

.player-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: rgba(0, 0, 0, 0.78);
  cursor: zoom-out;
  padding: 0;
  will-change: opacity;
}

.player-backdrop:hover,
.player-backdrop:active {
  background: rgba(0, 0, 0, 0.82);
  transform: none;
}

.player-modal {
  position: relative;
  z-index: 1;
  display: block;
  width: min(1180px, calc(100vw - 48px), calc((100vh - 190px) * 16 / 9));
  max-height: calc(100vh - 48px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #000000;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.78);
  transform-origin: top left;
  will-change: opacity;
}

.player-frame {
  position: relative;
  min-width: 0;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #000000;
  touch-action: manipulation;
}

video {
  display: block;
  width: 100%;
  height: 100%;
  background: #000000;
  pointer-events: none;
  touch-action: manipulation;
}

.pdf-viewer {
  display: none;
  width: 100%;
  height: 100%;
  border: 0;
  overflow: auto;
  background: #3a3a3a;
  padding: 12px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

body.document-mode .player-modal {
  width: min(1180px, calc(100vw - 48px));
}

body.document-mode .player-frame {
  aspect-ratio: auto;
  height: min(82vh, calc(100vh - 132px));
  min-height: 480px;
  background: #2a2a2a;
}

body.document-mode .player-frame video,
body.document-mode .player-controls {
  display: none;
}

body.document-mode .pdf-viewer {
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 12px;
}

.pdf-viewer-status {
  display: grid;
  width: min(100%, 420px);
  min-height: 160px;
  place-items: center;
  border-radius: 4px;
  background: #f5f5f5;
  color: #222222;
  font-weight: 800;
  text-align: center;
  padding: 20px;
}

.pdf-viewer-status.error {
  color: #9d1118;
}

.pdf-page {
  flex: 0 0 auto;
  max-width: 100%;
  overflow: hidden;
  border-radius: 2px;
  background: #ffffff;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.38);
}

.pdf-page-canvas {
  display: block;
  max-width: 100%;
  height: auto;
  background: #ffffff;
}

.player-frame:fullscreen,
.player-frame:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  aspect-ratio: auto;
}

.player-frame:fullscreen video,
.player-frame:-webkit-full-screen video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

body.manual-player-fullscreen .player-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: block;
  width: 100vw;
  height: 100vh;
  height: 100svh;
  height: 100dvh;
  padding: 0;
  background: #000000;
  box-shadow: none;
}

body.manual-player-fullscreen .player-modal {
  display: block;
  width: 100vw;
  height: 100vh;
  height: 100svh;
  height: 100dvh;
  max-height: none;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: #000000;
  box-shadow: none;
}

body.manual-player-fullscreen .player-frame {
  width: 100vw;
  height: 100vh;
  height: 100svh;
  height: 100dvh;
  aspect-ratio: auto;
}

body.manual-player-fullscreen .player-frame video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

body.manual-player-fullscreen .now-playing,
body.manual-player-fullscreen .mobile-now-playing-bar,
body.manual-player-fullscreen .mobile-share-status {
  display: none;
}

.now-playing {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 12px 18px 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.92), var(--surface) 56%),
    var(--surface);
}

.now-playing-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 16px;
}

.now-playing-header h2 {
  max-width: 100%;
  font-size: clamp(22px, 2.4vw, 34px);
  font-weight: 900;
  line-height: 1.12;
  overflow-wrap: anywhere;
}

.player-controls {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 5;
  display: grid;
  gap: 2px;
  padding: 8px 10px 7px;
  background: rgba(0, 0, 0, 0.78);
  opacity: 1;
  pointer-events: auto;
  transform: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.player-controls.controls-visible {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

.player-controls:not(.controls-visible) {
  opacity: 0;
  pointer-events: none;
  transform: translateY(calc(100% + 2px));
}

@media (min-width: 821px) {
  body.player-open:not(.manual-player-fullscreen):not(.landscape-player-open) {
    --desktop-player-controls-height: 57px;
    --desktop-player-controls-gap: 1px;
    --desktop-player-width: min(1180px, calc(100vw - 48px), calc((100vh - 247px) * 16 / 9));
  }

  body.player-open:not(.manual-player-fullscreen):not(.landscape-player-open) .player-modal {
    width: var(--desktop-player-width);
  }

  body.player-open:not(.manual-player-fullscreen):not(.landscape-player-open) .player-frame:not(:fullscreen):not(:-webkit-full-screen) {
    overflow: visible;
    margin-bottom: calc(var(--desktop-player-controls-height) + var(--desktop-player-controls-gap));
  }

  body.player-open:not(.manual-player-fullscreen):not(.landscape-player-open) .player-frame:not(:fullscreen):not(:-webkit-full-screen) .player-controls {
    top: calc(100% + var(--desktop-player-controls-gap));
    bottom: auto;
    gap: 0;
    height: var(--desktop-player-controls-height);
    padding: 5px 8px 6px;
  }

  body.player-open:not(.manual-player-fullscreen):not(.landscape-player-open) .player-frame:not(:fullscreen):not(:-webkit-full-screen) .player-control-row {
    gap: 6px;
  }

  body.player-open:not(.manual-player-fullscreen):not(.landscape-player-open) .player-frame:not(:fullscreen):not(:-webkit-full-screen) .player-time-text {
    min-width: 104px;
    font-size: 14px;
  }

  body.player-open:not(.manual-player-fullscreen):not(.landscape-player-open) .player-frame:not(:fullscreen):not(:-webkit-full-screen) .player-icon-button {
    width: 34px;
    min-width: 34px;
    min-height: 34px;
    font-size: 18px;
  }

  body.player-open:not(.manual-player-fullscreen):not(.landscape-player-open) .player-frame:not(:fullscreen):not(:-webkit-full-screen) .player-seek {
    height: 12px;
    background-size: 100% 3px;
  }

  body.player-open:not(.manual-player-fullscreen):not(.landscape-player-open) .player-frame:not(:fullscreen):not(:-webkit-full-screen) .player-seek::-webkit-slider-runnable-track {
    height: 3px;
  }

  body.player-open:not(.manual-player-fullscreen):not(.landscape-player-open) .player-frame:not(:fullscreen):not(:-webkit-full-screen) .player-seek::-webkit-slider-thumb {
    width: 12px;
    height: 12px;
    margin-top: -4.5px;
  }

  body.player-open:not(.manual-player-fullscreen):not(.landscape-player-open) .player-frame:not(:fullscreen):not(:-webkit-full-screen) .player-seek::-moz-range-track {
    height: 3px;
  }

  body.player-open:not(.manual-player-fullscreen):not(.landscape-player-open) .player-frame:not(:fullscreen):not(:-webkit-full-screen) .player-seek::-moz-range-thumb {
    width: 12px;
    height: 12px;
  }
}

.player-control-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.player-control-spacer {
  flex: 1 1 auto;
  min-width: 8px;
}

.player-time-text {
  flex: 0 0 auto;
  min-width: 116px;
  color: #ffffff;
  font-size: 16px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.player-icon-button {
  display: inline-grid;
  place-items: center;
  width: 40px;
  min-width: 40px;
  min-height: 40px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #ffffff;
  font-size: 20px;
  line-height: 1;
  padding: 0;
}

.player-icon-button.primary {
  background: rgba(255, 255, 255, 0.08);
}

.player-icon-button:hover {
  background: rgba(255, 255, 255, 0.14);
  transform: none;
}

.player-icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.player-icon-button.active {
  background: rgba(229, 9, 20, 0.22);
  color: #ffffff;
}

.player-seek {
  appearance: none;
  width: 100%;
  height: 16px;
  margin: 0;
  background: linear-gradient(
    90deg,
    var(--accent) 0%,
    var(--accent) var(--seek-progress, 0%),
    rgba(255, 255, 255, 0.34) var(--seek-progress, 0%),
    rgba(255, 255, 255, 0.34) 100%
  );
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 4px;
  border-radius: 999px;
  cursor: pointer;
}

.player-seek::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 999px;
}

.player-seek::-webkit-slider-thumb {
  appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -5px;
  border: 0;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3);
}

.player-seek::-moz-range-track {
  height: 4px;
  border-radius: 999px;
  background: transparent;
}

.player-seek::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 0;
  border-radius: 50%;
  background: #ffffff;
}

.player-seek:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.icon-close {
  width: 42px;
  min-width: 42px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font-size: 28px;
  line-height: 1;
  padding: 0;
}

.icon-close:hover {
  background: rgba(255, 255, 255, 0.18);
}

.now-playing p {
  color: var(--muted);
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.share-status {
  min-height: 22px;
  color: var(--muted);
}

.now-playing .share-status:empty {
  display: none;
}

.mobile-now-playing-bar,
.mobile-share-status {
  display: none;
}

.library-panel {
  margin-top: 22px;
}

.tools-panel {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(24, 24, 24, 0.82);
  padding: 18px;
}

.section-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.section-header h2 {
  font-size: 22px;
  font-weight: 900;
  line-height: 1.2;
}

.section-header p,
.message {
  color: var(--muted);
}

.upload-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.dropzone {
  position: relative;
  display: grid;
  gap: 6px;
  min-width: 0;
  min-height: 92px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-raised);
  cursor: pointer;
  padding: 18px;
  text-align: left;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.dropzone::before {
  content: "";
  width: 38px;
  height: 4px;
  border-radius: 999px;
  background: var(--accent);
}

.dropzone:hover {
  border-color: rgba(229, 9, 20, 0.64);
  background: #2a2a2a;
  transform: translateY(-2px);
}

body.import-busy .dropzone {
  cursor: progress;
  opacity: 0.62;
}

body.import-busy .dropzone:hover {
  border-color: var(--line);
  background: var(--surface-raised);
  transform: none;
}

body.remote-client #pickFilesButton,
body.remote-client #pickFolderButton {
  display: none;
}

.dropzone input {
  display: none;
}

.dropzone-title {
  font-weight: 900;
}

.dropzone-subtitle {
  color: var(--muted);
  font-size: 13px;
}

.scan-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 12px;
  margin-top: 0;
}

.scan-row + .upload-grid {
  margin-top: 12px;
}

.scan-row > *,
.upload-grid > *,
.visitor-greeting,
.library-actions > *,
.bulk-actions > *,
.archive-controls > * {
  min-width: 0;
}

.progress-wrap {
  display: grid;
  grid-template-columns: 1fr 48px;
  gap: 10px;
  align-items: center;
  margin-top: 14px;
}

.progress-wrap[hidden] {
  display: none;
}

.progress-bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

#progressFill {
  width: 0%;
  height: 100%;
  background: var(--cyan);
  transition: width 150ms ease;
}

.message {
  min-height: 22px;
  margin: 12px 0 0;
  line-height: 1.4;
}

.library-header {
  align-items: center;
  padding: 0 2px;
}

.library-heading {
  display: none;
}

.library-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  min-width: min(100%, 680px);
}

.library-actions > input[type="search"] {
  width: min(38vw, 320px);
  min-width: 220px;
}

.visitor-greeting {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

.visitor-greeting[hidden] {
  display: none;
}

.bulk-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.bulk-actions button {
  min-height: 34px;
  padding: 0 12px;
}

.visitor-history-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
}

.visitor-history-button[hidden] {
  display: none;
}

.visitor-history-button svg {
  width: 19px;
  height: 19px;
  fill: currentColor;
}

.archive-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.archive-controls[hidden] {
  display: none;
}

.visitor-history-dialog[hidden] {
  display: none;
}

.visitor-history-dialog {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
}

.visitor-history-backdrop {
  position: absolute;
  inset: 0;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: rgba(0, 0, 0, 0.68);
  padding: 0;
}

.visitor-history-backdrop:hover,
.visitor-history-backdrop:active {
  background: rgba(0, 0, 0, 0.68);
  transform: none;
}

.visitor-history-panel {
  position: relative;
  z-index: 1;
  width: min(860px, 100%);
  max-height: min(92vh, calc(100vh - 24px));
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: #181818;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}

.visitor-history-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  background: #222;
}

.visitor-history-head h2 {
  margin: 0;
  font-size: 22px;
}

.visitor-history-head p {
  margin: 4px 0 0;
  color: var(--muted);
}

.visitor-history-day-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  background: #1d1d1d;
}

.visitor-history-day-nav button {
  min-height: 30px;
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.05);
}

.visitor-history-day-nav button:hover,
.visitor-history-day-nav button:active {
  background: rgba(255, 255, 255, 0.1);
}

.visitor-history-day-nav button.active,
.visitor-history-day-nav button.active:hover {
  border-color: var(--cyan);
  background: rgba(30, 111, 214, 0.32);
}

.visitor-history-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: rgba(255, 255, 255, 0.12);
}

.visitor-history-stat,
.visitor-history-empty {
  background: #181818;
  padding: 12px 16px;
}

.visitor-history-stat strong {
  display: block;
  font-size: 18px;
}

.visitor-history-stat span,
.visitor-history-empty {
  color: var(--muted);
}

.visitor-history-list {
  display: grid;
  gap: 1px;
  max-height: min(430px, 52vh);
  overflow: auto;
  background: rgba(255, 255, 255, 0.12);
}

.visitor-history-row {
  display: grid;
  grid-template-areas:
    "body traffic"
    "time time";
  grid-template-columns: 1fr auto;
  gap: 4px 16px;
  align-items: start;
  background: #181818;
  padding: 12px 16px;
}

.visitor-history-row > :first-child {
  grid-area: time;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.visitor-history-row > :nth-child(2) {
  grid-area: body;
}

.visitor-history-row > :nth-child(3) {
  grid-area: traffic;
}

.visitor-history-title {
  font-weight: 900;
  overflow-wrap: anywhere;
}

.visitor-history-meta {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.visitor-history-traffic {
  color: var(--text);
  font-weight: 900;
  text-align: right;
}

.archive-controls input {
  width: 180px;
  min-height: 34px;
  font-size: 13px;
}

.archive-controls button {
  width: 72px;
  min-width: 72px;
}

.folder-breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 2px 14px;
  color: var(--muted);
}

.folder-breadcrumb:empty {
  display: none;
}

.folder-breadcrumb button {
  min-height: 24px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  padding: 0 2px;
  transition: color 160ms ease, font-size 160ms ease, background 160ms ease;
}

.folder-breadcrumb button.active {
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
}

.folder-breadcrumb button:hover {
  background: transparent;
  color: #7f7f7f;
  font-size: 12px;
}

.breadcrumb-separator {
  color: rgba(255, 255, 255, 0.32);
  font-weight: 900;
}

.video-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr));
  gap: 18px;
  padding: 14px 4px 40px;
}

.video-empty {
  grid-column: 1 / -1;
  min-height: 150px;
  border: 1px dashed var(--line-strong);
  border-radius: 4px;
  color: var(--muted);
  display: grid;
  place-items: center;
  padding: 24px;
}

.folder-item {
  position: relative;
  display: grid;
  align-content: end;
  min-height: 214px;
  overflow: hidden;
  border: 0;
  border-radius: 8px;
  background: transparent;
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.34);
  cursor: pointer;
  padding: 92px 16px 16px;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.folder-item:hover,
.folder-item:focus-visible {
  outline: none;
  transform: translateY(-5px) scale(1.02);
}

.folder-item::before {
  content: "";
  position: absolute;
  left: 18px;
  top: 20px;
  z-index: 0;
  width: 92px;
  height: 34px;
  border: 1px solid rgba(0, 122, 204, 0.48);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(180deg, #1f9cf0 0%, #007acc 100%);
}

.folder-item::after {
  content: "";
  position: absolute;
  inset: 48px 0 0;
  z-index: 0;
  border: 1px solid rgba(0, 122, 204, 0.36);
  border-radius: 0 8px 8px 8px;
  background:
    linear-gradient(180deg, rgba(120, 190, 240, 0.2), rgba(255, 255, 255, 0) 38%),
    linear-gradient(180deg, #007acc 0%, #005a9e 54%, #003f6b 100%);
}

.folder-item:hover::before,
.folder-item:focus-visible::before {
  background: linear-gradient(180deg, #45b2ff 0%, #008be8 100%);
}

.folder-item:hover::after,
.folder-item:focus-visible::after {
  border-color: rgba(64, 173, 255, 0.56);
  background:
    linear-gradient(180deg, rgba(148, 210, 255, 0.24), rgba(255, 255, 255, 0) 38%),
    linear-gradient(180deg, #0b8ee2 0%, #006bb3 54%, #004c80 100%);
}

.folder-icon {
  display: none;
}

.folder-title {
  position: relative;
  z-index: 1;
  color: var(--text);
  font-size: 18px;
  font-weight: 900;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.folder-meta {
  position: relative;
  z-index: 1;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  margin-top: 7px;
}

.video-item {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  background: var(--surface-raised);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.34);
  cursor: grab;
  transform-origin: center top;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.video-item:hover {
  border-color: rgba(255, 255, 255, 0.18);
  background: #2a2a2a;
  transform: translateY(-18px) scale(1.16);
  z-index: 6;
  box-shadow: 0 24px 62px rgba(0, 0, 0, 0.72);
}

body.selection-mode .video-list {
  cursor: crosshair;
}

body.selection-mode .video-item {
  cursor: pointer;
}

body.selection-mode .video-item:hover {
  transform: none;
  z-index: 1;
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.34);
}

body.selection-dragging {
  user-select: none;
}

.selection-marquee {
  position: fixed;
  z-index: 10000;
  pointer-events: none;
  border: 1px solid rgba(90, 167, 255, 0.95);
  background: rgba(90, 167, 255, 0.18);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.16) inset;
}

.video-item.active,
.video-item.selected {
  border-color: rgba(255, 255, 255, 0.18);
  background: #2a2a2a;
}

.video-item.selected {
  border-color: rgba(229, 9, 20, 0.82);
  box-shadow: 0 0 0 3px rgba(229, 9, 20, 0.22), 0 18px 38px rgba(0, 0, 0, 0.34);
}

.audio-item .video-thumbnail::after {
  content: "♪";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 32px;
  color: rgba(255, 255, 255, 0.5);
  pointer-events: none;
  background: rgba(0, 0, 0, 0.35);
}

.document-item .video-thumbnail::before {
  content: "PDF";
  position: absolute;
  left: 12px;
  bottom: 10px;
  z-index: 3;
  color: #ffffff;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  background: rgba(209, 25, 42, 0.9);
  border-radius: 3px;
  padding: 3px 6px;
}

.video-item.dragging {
  opacity: 0.46;
  cursor: grabbing;
  transform: scale(0.98);
}

.video-item.drag-over {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(229, 9, 20, 0.22), 0 18px 38px rgba(0, 0, 0, 0.34);
}

.video-item.drag-over::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--accent);
  z-index: 2;
}

.video-item.drag-over.drag-after::before {
  inset: 0 0 0 auto;
}

.video-main {
  display: grid;
  min-width: 0;
}

.video-thumbnail {
  position: relative;
  display: block;
  width: 100%;
  min-height: 0;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 0;
  background:
    linear-gradient(135deg, rgba(229, 9, 20, 0.32), rgba(20, 20, 20, 0.92)),
    #111111;
  padding: 0;
  cursor: pointer;
  transform: none;
}

.video-thumbnail:hover,
.video-thumbnail:active {
  background:
    linear-gradient(135deg, rgba(229, 9, 20, 0.32), rgba(20, 20, 20, 0.92)),
    #111111;
  transform: none;
}

.video-thumbnail:focus-visible {
  outline: 3px solid rgba(229, 9, 20, 0.88);
  outline-offset: -3px;
}

.video-thumbnail::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 42%, rgba(0, 0, 0, 0.58));
  pointer-events: none;
}

.video-thumbnail img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 160ms ease;
}

.video-preview {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.video-item.previewing .video-preview {
  opacity: 1;
}

.video-item.previewing .video-thumbnail img {
  opacity: 0;
}

.thumbnail-missing .video-thumbnail::before {
  content: "MP4";
  position: absolute;
  left: 12px;
  bottom: 10px;
  z-index: 3;
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
}

.video-title,
.video-meta {
  overflow: hidden;
  text-overflow: ellipsis;
}

.video-title {
  min-height: 52px;
  padding: 12px 12px 0;
  color: var(--text);
  font-size: 16px;
  font-weight: 900;
  line-height: 1.25;
  overflow-wrap: anywhere;
  transition: color 160ms ease, font-size 160ms ease, font-weight 160ms ease;
}

.video-item:hover .video-title {
  color: #b8b8b8;
  font-size: 15px;
  font-weight: 800;
}

.video-meta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  padding: 6px 12px 0;
  white-space: nowrap;
}

@media (max-width: 1120px) {
  .player-modal {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }

  .now-playing {
    padding: 24px;
  }
}

@media (max-width: 820px) {
  body {
    overflow-x: hidden;
    font-size: 120%;
  }

  body.player-open {
    --portrait-controls-height: 64px;
    overflow-x: hidden;
    overflow-y: auto;
  }

  main {
    display: flex;
    flex-direction: column;
  }

  .player-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 80;
    display: block;
    width: 100vw;
    height: calc(100vw * 9 / 16);
    margin: 0;
    padding: 0;
    background: #000000;
    box-shadow: 0 12px 26px rgba(0, 0, 0, 0.62);
  }

  .player-modal {
    display: block;
    width: 100vw;
    height: 100%;
    max-height: none;
    overflow: visible;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .player-backdrop {
    display: none;
  }

  .player-frame {
    position: relative;
    width: 100vw;
    height: 100%;
    aspect-ratio: 16 / 9;
  }

  .player-controls {
    padding: 6px 8px 5px;
  }

  .player-control-row {
    gap: 3px;
  }

  .player-control-spacer {
    min-width: 4px;
  }

  .player-time-text {
    min-width: 86px;
    font-size: 15px;
  }

  .player-icon-button {
    width: 32px;
    min-width: 32px;
    min-height: 32px;
    font-size: 20px;
  }

  .player-seek {
    height: 16px;
  }

  .now-playing {
    display: none;
  }

  .now-playing .eyebrow,
  .now-playing h2,
  #playerMeta {
    display: none;
  }

  .now-playing-header {
    display: block;
  }

  #shareStatus {
    display: none;
  }

  body.player-open .mobile-now-playing-bar {
    position: fixed;
    top: calc(100vw * 9 / 16 + var(--portrait-controls-height));
    right: 0;
    left: 0;
    z-index: 86;
    display: block;
    align-items: center;
    gap: 10px;
    width: 100vw;
    min-height: 46px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    background: #000000;
    color: #ffffff;
    padding: 6px 10px;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.42);
  }

  .mobile-now-playing-title {
    display: block;
    min-width: 0;
    width: 100%;
    overflow: hidden;
    color: #ffffff;
    font-size: 16px;
    font-weight: 800;
    line-height: 1.25;
    padding: 0 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.player-open .mobile-share-status {
    position: fixed;
    top: calc(100vw * 9 / 16 + var(--portrait-controls-height) + 50px);
    right: auto;
    left: 10px;
    z-index: 86;
    display: block;
    max-width: min(250px, calc(100vw - 24px));
    min-height: 0;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.68);
    color: #ffffff;
    font-size: 14px;
    line-height: 1.35;
    padding: 6px 8px;
  }

  body.player-open .mobile-share-status:empty {
    display: none;
  }

  .icon-close {
    display: none;
  }

  .app-shell {
    width: calc(100vw - 20px);
    max-width: 355px;
    margin-left: 10px;
    margin-right: auto;
    padding: 12px 0 28px;
    overflow-x: hidden;
  }

  body.player-open .app-shell {
    padding-top: calc(100vw * 9 / 16 + var(--portrait-controls-height) + 60px);
  }

  /* Portrait windowed: move the controls below the video instead of over it. */
  body.player-open:not(.landscape-player-open):not(.manual-player-fullscreen) .player-overlay {
    height: calc(100vw * 9 / 16 + var(--portrait-controls-height));
  }

  body.player-open:not(.landscape-player-open):not(.manual-player-fullscreen) .player-modal {
    position: relative;
    height: calc(100vw * 9 / 16 + var(--portrait-controls-height));
    overflow: visible;
  }

  body.player-open:not(.landscape-player-open):not(.manual-player-fullscreen) .player-frame {
    position: static;
    height: calc(100vw * 9 / 16);
    aspect-ratio: auto;
    overflow: hidden;
  }

  body.player-open:not(.landscape-player-open):not(.manual-player-fullscreen) .player-controls {
    position: absolute;
    top: calc(100vw * 9 / 16);
    right: 0;
    bottom: auto;
    left: 0;
    height: var(--portrait-controls-height);
    box-sizing: border-box;
    opacity: 1;
    transform: none;
    pointer-events: auto;
    background: #000000;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
  }

  body.document-mode.player-open {
    overflow: hidden;
  }

  body.document-mode.player-open:not(.landscape-player-open):not(.manual-player-fullscreen) .player-overlay {
    inset: 0;
    height: 100vh;
    height: 100svh;
    height: 100dvh;
    box-shadow: none;
  }

  body.document-mode.player-open:not(.landscape-player-open):not(.manual-player-fullscreen) .player-modal {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
  }

  body.document-mode.player-open:not(.landscape-player-open):not(.manual-player-fullscreen) .player-frame {
    position: relative;
    order: 2;
    flex: 1 1 auto;
    width: 100vw;
    height: auto;
    min-height: 0;
    aspect-ratio: auto;
    overflow: hidden;
    background: #f5f5f5;
  }

  body.document-mode.player-open:not(.landscape-player-open):not(.manual-player-fullscreen) .now-playing {
    display: block;
    order: 1;
    flex: 0 0 auto;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    background: #000000;
    padding: max(8px, env(safe-area-inset-top)) 10px 8px;
  }

  body.document-mode.player-open:not(.landscape-player-open):not(.manual-player-fullscreen) .now-playing-header {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  body.document-mode.player-open:not(.landscape-player-open):not(.manual-player-fullscreen) .now-playing h2 {
    display: block;
    min-width: 0;
    overflow: hidden;
    color: #ffffff;
    font-size: 16px;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.document-mode.player-open:not(.landscape-player-open):not(.manual-player-fullscreen) .icon-close {
    display: inline-grid;
    place-items: center;
    width: 38px;
    min-width: 38px;
    min-height: 38px;
    font-size: 24px;
  }

  body.document-mode.player-open .app-shell {
    padding-top: 12px;
  }

  body.document-mode.player-open .mobile-now-playing-bar,
  body.document-mode.player-open .mobile-share-status {
    display: none;
  }

  .tools-panel {
    order: 2;
    margin-top: 22px;
    overflow: hidden;
    display: none;
  }

  .library-panel {
    order: 1;
    margin-top: 0;
  }

  .section-header {
    align-items: stretch;
    flex-direction: column;
  }

  .section-header h2 {
    font-size: 26px;
  }

  .section-header p,
  .message {
    font-size: 19px;
  }

  .dropzone-subtitle,
  .archive-controls input,
  .folder-breadcrumb button,
  .folder-breadcrumb button.active {
    font-size: 16px;
  }

  .folder-breadcrumb button:hover {
    font-size: 14px;
  }

  .library-actions {
    align-items: stretch;
    justify-content: flex-start;
    min-width: 0;
  }

  .library-actions > input[type="search"] {
    width: 100%;
    min-width: 0;
  }

  .visitor-greeting {
    width: 100%;
    min-width: 0;
  }

  .archive-controls {
    width: 100%;
  }

  .bulk-actions {
    width: 100%;
  }

  .bulk-actions button {
    flex: 1 1 auto;
  }

  .visitor-history-button {
    flex: 0 0 auto;
  }

  .visitor-history-dialog {
    padding: 10px;
  }

  .visitor-history-panel {
    max-height: calc(100vh - 20px);
  }

  .visitor-history-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .visitor-history-row {
    grid-template-areas:
      "body"
      "traffic"
      "time";
    grid-template-columns: 1fr;
  }

  .visitor-history-traffic {
    text-align: left;
  }

  .archive-controls input {
    flex: 1;
    width: auto;
  }

  .player-frame,
  .video-thumbnail {
    aspect-ratio: 16 / 9;
  }

  .upload-grid,
  .scan-row {
    grid-template-columns: 1fr;
  }

  .now-playing-header h2 {
    font-size: 36px;
  }

  .video-list {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    grid-template-columns: repeat(2, minmax(0, calc((100% - 12px) / 2)));
    gap: 12px;
    padding-inline: 0;
  }

  .folder-item {
    align-content: end;
    gap: 6px;
    min-width: 0;
    min-height: 148px;
    padding: 54px 12px 12px;
  }

  .folder-item::before {
    left: 12px;
    top: 11px;
    width: 64px;
    height: 24px;
    border-radius: 7px 7px 0 0;
  }

  .folder-item::after {
    inset: 31px 0 0;
    border-radius: 0 7px 7px 7px;
  }

  .folder-icon {
    display: none;
  }

  .folder-title {
    font-size: 19px;
    overflow: hidden;
  }

  .folder-meta {
    font-size: 14px;
  }

  .thumbnail-missing .video-thumbnail::before {
    font-size: 14px;
  }

  .video-title {
    min-height: 62px;
    font-size: 19px;
  }

  .video-item:hover .video-title {
    font-size: 18px;
  }

  .video-meta {
    font-size: 16px;
  }

  .video-item,
  .video-empty {
    grid-column: 1 / -1;
    min-width: 0;
  }

  .video-item:hover {
    transform: translateY(-6px) scale(1.03);
  }

}

body.landscape-player-open {
  overflow: hidden;
}

body.landscape-player-open .player-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: block;
  width: 100vw;
  height: 100vh;
  height: 100svh;
  height: 100dvh;
  padding: 0;
  background: #000000;
  box-shadow: none;
}

body.landscape-player-open .player-modal {
  display: block;
  width: 100vw;
  height: 100vh;
  height: 100svh;
  height: 100dvh;
  max-height: none;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: #000000;
  box-shadow: none;
}

body.landscape-player-open .player-frame {
  width: 100vw;
  height: 100vh;
  height: 100svh;
  height: 100dvh;
  aspect-ratio: auto;
}

body.landscape-player-open .player-frame video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

body.landscape-player-open .now-playing,
body.landscape-player-open .mobile-now-playing-bar,
body.landscape-player-open .mobile-share-status {
  display: none;
}

body.manual-player-fullscreen.player-open,
body.landscape-player-open.player-open {
  overflow: hidden;
  overscroll-behavior: none;
}

body.manual-player-fullscreen .player-overlay,
body.landscape-player-open .player-overlay {
  z-index: 120;
}

body.manual-player-fullscreen .player-modal,
body.landscape-player-open .player-modal {
  overflow: hidden;
}

body.manual-player-fullscreen .app-shell,
body.landscape-player-open .app-shell {
  padding-top: 0;
}

body.manual-player-fullscreen .mobile-now-playing-bar,
body.manual-player-fullscreen .mobile-share-status,
body.landscape-player-open .mobile-now-playing-bar,
body.landscape-player-open .mobile-share-status {
  display: none;
}

.player-frame:fullscreen .player-controls,
.player-frame:-webkit-full-screen .player-controls,
body.manual-player-fullscreen .player-controls,
body.landscape-player-open .player-controls {
  padding-bottom: max(7px, env(safe-area-inset-bottom));
}

@media (max-width: 720px) {
  body.document-mode .player-modal {
    width: 100vw;
    max-height: none;
  }

  body.document-mode .player-frame {
    height: calc(100dvh - 104px);
    min-height: 0;
  }
}
