:root {
  color-scheme: dark;
  background: #1a1720;
  color: #fbf5ff;
  font: 100%/1.55 system-ui, sans-serif;
  --surface: #26212e;
  --border: #53485f;
  --muted: #c2b6ce;
  --accent: #edc9fb;
}
* { box-sizing: border-box; }
body { max-width: 66rem; margin: auto; padding: 1.25rem clamp(1rem, 4vw, 2.5rem) 3rem; }
[hidden] { display: none !important; }
.header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .4rem 0 1.5rem; }
h1 { margin: 0; font-size: clamp(1.125rem, 4vw, 1.8rem); line-height: 1.3; letter-spacing: .025em; }
button, .button {
  border: 1px solid var(--border);
  background: var(--surface);
  color: inherit;
  border-radius: .65rem;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 2.75rem;
  padding: .55rem .85rem;
  font: inherit;
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.primary { background: var(--accent); color: #30193b; border-color: transparent; }
button:disabled { opacity: .55; cursor: wait; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.stage { border: 1px solid var(--border); border-radius: 1rem; background: #0f0d14; position: relative; overflow: hidden; height: clamp(18rem, 66svh, 43rem); }
.stage video { width: 100%; height: 100%; object-fit: contain; }
.cover { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: .65rem; text-align: center; padding: 1rem; background: #160f1bd9; }
.cover p { margin: 0; color: var(--muted); }
.play-mark { width: 3.5rem; height: 3.5rem; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 50%; color: var(--accent); }
.controls { display: flex; align-items: center; gap: .5rem; margin-top: .75rem; }
.controls progress { flex: 1; min-width: 2rem; height: .5rem; }
.controls input { width: clamp(3rem, 12vw, 7rem); }
input, progress { accent-color: var(--accent); }
.form { max-width: 40rem; display: grid; gap: .75rem; }
.form input[type=file], .form input[type=password], fieldset {
  width: 100%;
  min-width: 0;
  padding: .75rem;
  color: inherit;
  font: inherit;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: .65rem;
}
input[type=file]::file-selector-button { font: inherit; margin-right: .65rem; }
.check { display: flex; align-items: center; gap: .6rem; min-height: 2.75rem; cursor: pointer; }
.check input { width: 1.25rem; height: 1.25rem; }
.muted, .message { color: var(--muted); margin: 0; }
.form video { width: 100%; max-height: 48svh; background: #0f0d14; border-radius: .65rem; }
fieldset { display: grid; gap: .5rem; margin: 0; }
.videos { padding: 0; list-style: none; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); }
.videos li { background: var(--surface); border-radius: .75rem; padding: .75rem; display: grid; gap: .5rem; }
.videos video { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: #0f0d14; }

.site-title { font-size: clamp(.75rem, 4vw, 1.8rem); white-space: nowrap; }
.add-video {
  position: fixed;
  left: 50%;
  bottom: max(1.25rem, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: 3.5rem;
  height: 3.5rem;
  padding: 0;
  border-radius: 50%;
  box-shadow: 0 .25rem 1.25rem #100b18b3;
}
body:has(.add-video) { padding-bottom: 6rem; }
body:has(dialog[open]) { overflow: hidden; }
.upload-dialog {
  width: min(38rem, calc(100% - 2rem));
  max-height: calc(100dvh - 2rem);
  padding: clamp(1rem, 4vw, 1.6rem);
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: #201a28;
  color: inherit;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.upload-dialog::backdrop { background: #100c17c9; }
.upload-dialog h2 { margin: 0 0 1rem; font-size: 1.3rem; }
.upload-dialog .form video { height: clamp(8rem, 29dvh, 15rem); object-fit: contain; }
.form-field { display: grid; gap: .4rem; }
.form-actions, .trim-controls { display: flex; align-items: center; gap: .5rem; justify-content: space-between; }
.form-actions { justify-content: end; }
.message:empty { display: none; }
#trim { padding: .75rem .65rem .65rem; }
#trim-hint { font-size: .875rem; }
.trim-controls { font-size: .875rem; font-variant-numeric: tabular-nums; }
.timeline {
  --start: 0%;
  --end: 0%;
  --position: 0%;
  position: relative;
  height: 3.75rem;
  margin: .25rem 1.6rem;
  touch-action: none;
  user-select: none;
}
.timeline-strip, .timeline-track { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: .4rem; }
.timeline-strip { background: #403647; pointer-events: none; }
.timeline-track {
  cursor: crosshair;
  background: linear-gradient(to right, #111015a6 var(--start), transparent var(--start) var(--end), #111015a6 var(--end));
}
.timeline-selection {
  position: absolute;
  left: var(--start);
  right: calc(100% - var(--end));
  inset-block: 0;
  border-block: 2px solid var(--accent);
  cursor: grab;
}
.trim-handle {
  position: absolute;
  z-index: 1;
  inset-block: 0;
  width: 1.6rem;
  padding: 0;
  border: 0;
  background: var(--accent);
  color: #30193b;
  cursor: ew-resize;
}
.trim-handle::before { content: ''; width: 2px; height: 1rem; border-radius: 2px; background: currentColor; }
.trim-start { left: var(--start); transform: translateX(-100%); border-radius: .35rem 0 0 .35rem; }
.trim-end { left: var(--end); border-radius: 0 .35rem .35rem 0; }
.timeline-playhead {
  position: absolute;
  left: var(--position);
  inset-block: -.2rem;
  width: 2px;
  background: #fff;
  box-shadow: 0 0 2px #18111f;
  pointer-events: none;
}
