/* Vale — gruvbox-dark, laid-back editorial.
   Warm dark canvas (#282828), soft cream ink (#ebdbb2), one warm orange accent.
   Softer than the old ivory system: gentle rounding, calm hovers, clear
   affordances (only real buttons/links look interactive). Sans display +
   serif-italic accent word + uppercase mono micro-labels remain the signature. */

:root {
  /* gruvbox dark */
  --bg:        #282828;
  --bg-hard:   #1d2021;
  --surface:   #32302f;
  --surface-2: #3c3836;
  --line-2:    #504945;
  --fg:        #ebdbb2;
  --fg-dim:    #a89984;
  --fg-faint:  #7c6f64;
  --accent:    #d3869b;  /* gruvbox purple — Vale's default accent */
  --accent-2:  #b37284;  /* hover/darker */
  --aqua:      #8ec07c;
  --yellow:    #fabd2f;
  --green:     #b8bb26;  /* success / ready */
  --red:       #fb4934;  /* danger */
  --accent-tint: rgba(211, 134, 155, 0.10);
  --hair:        rgba(235, 219, 178, 0.10);
  --hair-strong: rgba(235, 219, 178, 0.22);

  --sans: "Inter", "Helvetica Neue", Arial, sans-serif;
  --serif: "Instrument Serif", Georgia, "Times New Roman", serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --pad: clamp(20px, 4vw, 56px);
  --round: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Links are the ONE thing that looks clickable in text: warm accent, and they
   underline on hover. Status text never uses this color. */
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

::selection { background: var(--accent); color: var(--bg-hard); }

/* ---- shared type ---------------------------------------------------------- */
.display {
  font-family: var(--sans); font-weight: 600;
  letter-spacing: -0.02em; line-height: 1.05; margin: 0;
  font-size: clamp(28px, 3vw, 40px);
}
.display--lg { font-size: clamp(34px, 5vw, 60px); }
.serif {
  font-family: var(--serif); font-style: italic; font-weight: 400;
  letter-spacing: 0; color: var(--accent);
}
.mono-label {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--fg-dim);
  display: inline-flex; align-items: center; gap: 8px;
}
.mono-meta {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--fg-dim); margin: 0;
}
.dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); display: inline-block; flex: 0 0 auto;
}

/* ---- top bar -------------------------------------------------------------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px var(--pad); border-bottom: 1px solid var(--hair);
}
.wordmark {
  font-family: var(--sans); font-weight: 600; font-size: 20px;
  letter-spacing: -0.02em; color: var(--fg);
  display: inline-flex; align-items: center; gap: 5px;
}
.wordmark:hover { text-decoration: none; }
/* "The Horizon" mark — half-disc sun resting on the horizon line, in the accent.
   Masked so it recolors with the theme; one shape shared with the favicon. */
.wordmark::before {
  content: ""; flex: 0 0 auto; width: 26px; height: 11px; margin-right: 3px; background: var(--accent);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='2 11 28 12'%3E%3Cpath d='M9 19 A7 7 0 0 1 23 19 Z'/%3E%3Crect x='3' y='19' width='26' height='3' rx='1.5'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='2 11 28 12'%3E%3Cpath d='M9 19 A7 7 0 0 1 23 19 Z'/%3E%3Crect x='3' y='19' width='26' height='3' rx='1.5'/%3E%3C/svg%3E") center/contain no-repeat;
}
.dot--wordmark { width: 7px; height: 7px; align-self: flex-end; margin-bottom: 3px; }
.topbar-right { gap: 16px; color: var(--fg-dim); }
.topbar-right .who { color: var(--accent); }
/* the item-count is status, not a link */
#count-label { color: var(--fg-faint); }

/* ---- upload band ---------------------------------------------------------- */
.uploadband {
  position: relative;
  display: flex; align-items: center; justify-content: space-between;
  gap: 32px; flex-wrap: wrap;
  padding: clamp(28px, 5vw, 52px) var(--pad);
  border-bottom: 1px solid var(--hair);
  transition: background 200ms ease, box-shadow 200ms ease;
}
.uploadband.dragging {
  background: var(--accent-tint);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.uploadband-left { max-width: 60ch; }
.uploadband-left .mono-label { margin-top: 16px; }
.uploadband-right {
  display: flex; align-items: center; gap: 22px; flex-wrap: wrap;
}

.pill {
  font-family: var(--sans); font-weight: 600; font-size: 15px;
  color: var(--bg-hard); background: var(--accent);
  border: none; border-radius: 999px;
  padding: 13px 26px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
  transition: transform 120ms ease, background 150ms ease, opacity 150ms ease;
}
.pill svg.i { width: 16px; height: 16px; vertical-align: middle; }
.pill:hover { background: var(--yellow); text-decoration: none; }
.pill:active { transform: translateY(1px); }
.pill:disabled { opacity: 0.5; cursor: default; }

/* ---- expiry slider (replaces the old dropdown) ---------------------------- */
.expiry-field { display: flex; flex-direction: column; gap: 8px; width: 240px; flex: none; }
.expiry-field > .mono-label { color: var(--fg-faint); }
.slider-wrap { display: flex; align-items: center; gap: 14px; }
/* Fixed width so changing the label ("1 HOUR" -> "12 HOURS") never resizes the
   track — that reflow was making the thumb jitter while dragging. */
.slider-out {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--accent);
  flex: 0 0 74px; width: 74px; text-align: right;
}
input[type="range"].expiry-range {
  -webkit-appearance: none; appearance: none;
  flex: 1 1 auto; height: 22px; background: transparent; cursor: pointer; margin: 0;
}
/* track */
input[type="range"].expiry-range::-webkit-slider-runnable-track {
  height: 3px; border-radius: 3px; background: var(--line-2);
}
input[type="range"].expiry-range::-moz-range-track {
  height: 3px; border-radius: 3px; background: var(--line-2);
}
/* thumb */
input[type="range"].expiry-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--bg);
  margin-top: -7px; box-shadow: 0 0 0 1px var(--accent);
  transition: transform 120ms ease;
}
input[type="range"].expiry-range::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--bg);
  box-shadow: 0 0 0 1px var(--accent);
}
input[type="range"].expiry-range:hover::-webkit-slider-thumb { transform: scale(1.12); }
input[type="range"].expiry-range:focus { outline: none; }
input[type="range"].expiry-range:focus::-webkit-slider-thumb { box-shadow: 0 0 0 3px var(--accent-tint), 0 0 0 1px var(--accent); }

/* rotating stamp motif — subtle, decorative, never competes */
.stamp {
  position: absolute; top: 50%; right: var(--pad);
  width: 84px; height: 84px; transform: translateY(-50%);
  opacity: 0.14; pointer-events: none; animation: spin 34s linear infinite;
}
.stamp-text {
  font-family: var(--mono); font-size: 15px; letter-spacing: 0.14em;
  fill: none; stroke: var(--accent); stroke-width: 0.4px; text-transform: uppercase;
}
@keyframes spin { to { transform: translateY(-50%) rotate(360deg); } }
@media (max-width: 900px) { .stamp { display: none; } }
@media (prefers-reduced-motion: reduce) { .stamp { animation: none; } }

/* ---- active upload progress ---------------------------------------------- */
.uploads { padding: 0 var(--pad); }
.uploads:not(:empty) { padding-top: 22px; }
.upload-row {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 0; border-bottom: 1px solid var(--hair);
}
.upload-row .name {
  font-weight: 500; font-size: 14px; flex: 0 1 auto;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40ch;
}
.upload-row .bar { flex: 1 1 120px; height: 3px; border-radius: 3px; background: var(--line-2); position: relative; overflow: hidden; }
.upload-row .bar > i { position: absolute; inset: 0 auto 0 0; width: 0%; background: var(--accent); transition: width 200ms ease; }
.upload-row .pct {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em;
  color: var(--accent); min-width: 5ch; text-align: right;
}

/* ---- gallery -------------------------------------------------------------- */
.gallery {
  display: grid; gap: clamp(24px, 2.4vw, 38px) clamp(16px, 1.8vw, 26px);
  grid-template-columns: repeat(4, 1fr);
  padding: clamp(28px, 4vw, 48px) var(--pad); min-height: 40vh;
  align-items: start;
}
@media (max-width: 1000px) { .gallery { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px)  { .gallery { grid-template-columns: 1fr; } }

.card { position: relative; display: flex; flex-direction: column; }
.card-media {
  position: relative; aspect-ratio: 4 / 3; overflow: hidden;
  background: var(--bg-hard); border: 1px solid var(--hair);
  border-radius: var(--round); display: block; cursor: pointer;
  transition: border-color 160ms ease;
}
/* contain, not cover: show the whole frame (letterboxed on the near-black tile)
   rather than cropping — owner prefers the full thumbnail over edge-to-edge. */
.card-media img { width: 100%; height: 100%; object-fit: contain; display: block; }
/* calm hover: warm border + brightness, no jumpy zoom */
.card-media:hover { border-color: var(--accent); }
.card-media img { transition: filter 200ms ease; }
.card-media:hover img { filter: brightness(1.06); }

/* typographic placeholder for thumbless items */
.card-media.placeholder {
  display: grid; place-items: center; background: var(--surface);
}
.card-media.placeholder .ghost-index {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--mono); font-weight: 700;
  font-size: clamp(48px, 7vw, 90px); color: rgba(235,219,178,0.06);
  letter-spacing: -0.04em; user-select: none;
}
.card-media.placeholder .ghost-ext {
  position: relative; font-family: var(--serif); font-style: italic;
  font-size: clamp(30px, 4vw, 46px); color: var(--fg);
}

/* video / file badges */
.badge {
  position: absolute; left: 10px; top: 10px;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--bg-hard); background: var(--yellow);
  padding: 3px 7px; border-radius: 5px;
}
.play-badge {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
  width: 46px; height: 46px; border-radius: 50%;
  background: rgba(29,32,33,0.62); display: grid; place-items: center;
  color: var(--fg); font-size: 16px;
  pointer-events: none; transition: background 160ms ease;
}
.card-media:hover .play-badge { background: color-mix(in srgb, var(--accent) 85%, transparent); color: var(--bg-hard); }

/* the ↗ affordance circle — "open public", clearly a button, top-right */
.arrow-circle {
  position: absolute; right: 10px; top: 10px;
  width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--hair-strong); color: var(--fg);
  display: grid; place-items: center; font-size: 14px;
  background: rgba(29,32,33,0.55); backdrop-filter: blur(2px);
  opacity: 0; transition: opacity 180ms ease, background 150ms ease, color 150ms ease, border-color 150ms ease;
  cursor: pointer; z-index: 2;
}
.card-media:hover .arrow-circle, .arrow-circle:focus-visible { opacity: 1; }
.arrow-circle:hover { background: var(--accent); border-color: var(--accent); color: var(--bg-hard); }

.card-body { padding-top: 14px; display: flex; flex-direction: column; gap: 6px; }
.card-index { font-family: var(--mono); font-size: 12px; color: var(--accent); letter-spacing: 0.06em; }
.card-name {
  display: block; color: var(--fg); font-weight: 500; font-size: 15px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card-name:hover { color: var(--accent); text-decoration: none; }
.card-meta {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--fg-dim);
  display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-top: 2px;
}
.card-meta .status { color: var(--fg-faint); }
.card-meta .act, .card-meta .del {
  cursor: pointer; border: 1px solid var(--hair-strong); background: none;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em;
  text-transform: uppercase; padding: 4px 9px; border-radius: 6px;
  transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
}
.card-meta .copy { color: var(--accent); margin-left: auto; }
.card-meta .copy:hover { background: var(--accent); color: var(--bg-hard); border-color: var(--accent); }
.card-meta .del { color: var(--fg-dim); }
.card-meta .del:hover { background: var(--red); color: var(--bg-hard); border-color: var(--red); }

.empty { grid-column: 1 / -1; text-align: center; padding: 60px 0; color: var(--fg-faint); }

/* ---- gallery filter ------------------------------------------------------- */
.gallery-tools { padding: 18px var(--pad) 0; }
.gallery-search {
  width: 100%; max-width: 340px; background: var(--surface);
  border: 1px solid var(--hair); border-radius: var(--round);
  color: var(--fg); font-family: var(--mono); font-size: 12px;
  letter-spacing: 0.04em; padding: 9px 13px; outline: none;
  transition: border-color 150ms ease;
}
.gallery-search::placeholder { color: var(--fg-faint); text-transform: uppercase; letter-spacing: 0.06em; }
.gallery-search:focus { border-color: var(--accent); }

/* ---- account storage meter ------------------------------------------------ */
.storage-meter { margin-top: 14px; max-width: 360px; display: flex; flex-direction: column; gap: 9px; }
.storage-bar { height: 6px; border-radius: 4px; background: var(--line-2); overflow: hidden; }
.storage-bar > i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 4px; transition: width 300ms ease; }

/* ---- footer --------------------------------------------------------------- */
.footer {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 22px var(--pad); border-top: 1px solid var(--hair); color: var(--fg-faint);
}
.footer span { display: inline-flex; align-items: center; gap: 8px; color: var(--fg-faint); }  /* status only; gap keeps the dot off the text */

/* ---- toast ---------------------------------------------------------------- */
.toast-wrap {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 10px; z-index: 40; align-items: center;
}
.toast {
  background: var(--surface-2); color: var(--fg); border: 1px solid var(--line-2);
  border-radius: var(--round);
  padding: 12px 18px; display: flex; align-items: center; gap: 16px;
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.04em;
  animation: rise 220ms ease; max-width: 90vw;
}
.toast .link { color: var(--aqua); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 46ch; }
.toast .copy {
  color: var(--accent); cursor: pointer; text-transform: uppercase;
  letter-spacing: 0.08em; background: none; border: none; font-family: var(--mono); font-size: 12px;
}
.toast .copy:hover { color: var(--yellow); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }


/* ---- drop overlay --------------------------------------------------------- */
.drop-overlay { position: fixed; inset: 0; z-index: 30; display: none; pointer-events: none; }
body.dragging .drop-overlay { display: block; box-shadow: inset 0 0 0 2px var(--accent); background: var(--accent-tint); }

/* ---- viewer page ---------------------------------------------------------- */
.viewer { min-height: 100vh; display: flex; }
.viewer-wrap {
  margin: auto; padding: clamp(30px, 6vw, 80px) var(--pad);
  width: 100%; max-width: 1100px;
  display: flex; flex-direction: column; align-items: center; gap: 30px;
}
.viewer-media { width: 100%; display: flex; justify-content: center; }

/* non-video media */
.media { max-width: 100%; max-height: 80vh; display: block; background: var(--bg-hard); border-radius: var(--round); }
img.media { object-fit: contain; }
.media--audio { width: min(560px, 100%); }
.media--file {
  font-family: var(--mono); font-size: 14px; letter-spacing: 0.06em;
  text-transform: uppercase; padding: 40px 30px; border: 1px solid var(--hair-strong);
  border-radius: var(--round); color: var(--fg);
}

/* ---- custom resizable media player --------------------------------------- */
.player {
  position: relative; width: min(820px, 100%); max-width: 100%;
  background: var(--bg-hard); border: 1px solid var(--line-2);
  border-radius: var(--round); overflow: hidden; line-height: 0;
}
.player video, .player img { width: 100%; height: auto; display: block; max-height: 82vh; object-fit: contain; }
.player.is-image { cursor: default; }
/* Real fullscreen: fill the whole screen (override the drag-resize inline width
   with !important), center the video on black, let it use the full height. */
.player:fullscreen, .player:-webkit-full-screen {
  width: 100vw !important; height: 100vh !important; max-width: none; border: none; border-radius: 0;
  display: flex; align-items: center; justify-content: center; background: #000;
}
.player:fullscreen video, .player:-webkit-full-screen video {
  width: 100%; height: 100%; max-height: 100vh;
}

/* control bar */
.player-bar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 3;
  display: flex; align-items: center; gap: 12px; padding: 10px 14px 12px;
  background: linear-gradient(transparent, rgba(29,32,33,0.55) 30%, rgba(29,32,33,0.9));
  opacity: 0; transform: translateY(6px); transition: opacity 200ms ease, transform 200ms ease;
  line-height: normal;
}
.player:hover .player-bar, .player.paused .player-bar, .player:focus-within .player-bar { opacity: 1; transform: none; }
.player-btn {
  background: none; border: none; color: var(--fg); cursor: pointer;
  width: 30px; height: 30px; display: grid; place-items: center; padding: 0;
  border-radius: 6px; font-size: 15px; transition: color 140ms ease, background 140ms ease;
}
.player-btn:hover { color: var(--accent); background: rgba(235,219,178,0.08); }
.player-time { font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em; color: var(--fg-dim); white-space: nowrap; }
.player-scrub { flex: 1 1 auto; display: flex; align-items: center; }
.player-scrub input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 16px; background: none; cursor: pointer; margin: 0;
}
.player-scrub input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 3px; background: var(--track, var(--line-2)); }
.player-scrub input[type="range"]::-moz-range-track { height: 4px; border-radius: 3px; background: var(--line-2); }
.player-scrub input[type="range"]::-moz-range-progress { height: 4px; border-radius: 3px; background: var(--accent); }
.player-scrub input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 13px; height: 13px; border-radius: 50%;
  background: var(--accent); margin-top: -4.5px; border: 2px solid var(--bg-hard);
}
.player-scrub input[type="range"]::-moz-range-thumb { width: 13px; height: 13px; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg-hard); }
.player-vol { width: 76px; display: flex; align-items: center; }
/* Same slider look as the seek bar: accent thumb, bg-hard ring, 4px track. */
.player-vol input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 16px; background: none; cursor: pointer; margin: 0; }
.player-vol input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 3px; background: var(--line-2); }
.player-vol input[type="range"]::-moz-range-track { height: 4px; border-radius: 3px; background: var(--line-2); }
.player-vol input[type="range"]::-moz-range-progress { height: 4px; border-radius: 3px; background: var(--accent); }
.player-vol input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 13px; height: 13px; border-radius: 50%; background: var(--accent); margin-top: -4.5px; border: 2px solid var(--bg-hard); }
.player-vol input[type="range"]::-moz-range-thumb { width: 13px; height: 13px; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg-hard); }

/* big center play affordance when paused */
.player-play-big {
  position: absolute; inset: 0; display: grid; place-items: center; z-index: 2;
  border: none; background: none; cursor: pointer; color: var(--fg);
  transition: opacity 160ms ease;
}
.player-play-big span {
  width: 68px; height: 68px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(29,32,33,0.5); font-size: 24px; padding-left: 4px; transition: background 160ms ease, transform 160ms ease;
}
.player:not(.paused) .player-play-big { opacity: 0; pointer-events: none; }
.player-play-big:hover span { background: color-mix(in srgb, var(--accent) 90%, transparent); color: var(--bg-hard); transform: scale(1.05); }

/* drag-to-resize handle (bottom-right) */
.player-resize {
  position: absolute; right: 0; bottom: 0; width: 20px; height: 20px; z-index: 4;
  cursor: nwse-resize; opacity: 0.55; transition: opacity 150ms ease;
  background:
    linear-gradient(135deg, transparent 46%, var(--fg-dim) 46%, var(--fg-dim) 54%, transparent 54%),
    linear-gradient(135deg, transparent 66%, var(--fg-dim) 66%, var(--fg-dim) 74%, transparent 74%);
}
.player:hover .player-resize { opacity: 0.9; }

.viewer-meta { text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.viewer-meta .display { font-size: clamp(26px, 3.4vw, 44px); }
.viewer-meta .mono-label { justify-content: center; }

/* live countdown (streamable feel) — mono, orange, clearly status not a link */
.mono-count {
  font-family: var(--mono); font-size: 13px; letter-spacing: 0.06em;
  color: var(--accent); text-transform: uppercase; margin: 0;
  display: inline-flex; align-items: center; gap: 8px;
}
.mono-count::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); display: inline-block; }

/* admin user switcher tabs */
.user-tabs { display: flex; gap: 22px; padding: 16px var(--pad); border-bottom: 1px solid var(--hair); }
.user-tab { display: inline-flex; align-items: center; gap: 8px; color: var(--fg-faint); }
.user-tab:hover { color: var(--fg); text-decoration: none; }
.user-tab .dot { opacity: 0; transition: opacity 150ms ease; }
.user-tab.active { color: var(--fg); }
.user-tab.active .dot { opacity: 1; }

/* owner tag on admin cross-user cards */
.owner-tag {
  position: absolute; right: 10px; bottom: 10px; z-index: 2;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--bg-hard); background: var(--accent);
  padding: 2px 6px; border-radius: 5px;
}

/* in-app viewer actions */
.viewer-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; align-items: center; margin-top: 8px; }
.viewer-actions .expiry-field { min-width: 260px; }
.act-btn {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--fg);
  border: 1px solid var(--hair-strong); background: var(--surface);
  padding: 10px 16px; cursor: pointer; border-radius: 7px;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
}
.act-btn svg.i { width: 14px; height: 14px; }
.act-btn:hover { background: var(--accent); color: var(--bg-hard); border-color: var(--accent); text-decoration: none; }
.act-btn.danger:hover { background: var(--red); border-color: var(--red); }

/* ---- auth pages ---------------------------------------------------------- */
.auth-wrap {
  margin: auto; width: 100%; max-width: 460px;
  padding: clamp(30px, 8vh, 90px) var(--pad); display: flex; flex-direction: column; gap: 14px;
}
.auth-mark { font-size: 22px; margin-bottom: 18px; }
.auth .display { font-size: clamp(30px, 5vw, 46px); }
.auth-form { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }
.auth-form label { margin-top: 10px; }
.auth-form input, .account-form input {
  font-family: var(--sans); font-size: 15px; color: var(--fg);
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 8px;
  padding: 12px 14px; outline: none; transition: border-color 150ms ease;
}
.auth-form input:focus, .account-form input:focus { border-color: var(--accent); }
.auth-form .pill, .account-form .pill { margin-top: 16px; align-self: flex-start; }
.form-error { color: var(--red); min-height: 14px; margin: 4px 0 0; }
.auth-alt { margin-top: 18px; }
.auth-alt a { font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; }

/* ---- account page -------------------------------------------------------- */
.account-wrap { max-width: 620px; margin: 0 auto; padding: clamp(28px, 5vw, 56px) var(--pad); display: flex; flex-direction: column; gap: 14px; }
.account-card { border-top: 1px solid var(--hair); padding-top: 22px; margin-top: 14px; }
.account-form { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.account-form label { margin-top: 10px; }
.account-form .expiry-field { align-self: stretch; margin-top: 8px; max-width: 360px; }

/* ---- inline icons --------------------------------------------------------- */
.i { width: 1em; height: 1em; vertical-align: -0.14em; display: inline-block; flex: none; }
.player-btn svg { width: 18px; height: 18px; display: block; }
.player-play-big span svg { width: 26px; height: 26px; display: block; }
/* the play triangle's mass leans left, so a 1px right nudge optically centers
   it in the circle (the old 3px padding + 2px margin pushed it visibly right). */
.play-badge svg { width: 15px; height: 15px; margin-left: 1px; }
.arrow-circle svg { width: 15px; height: 15px; }

/* back-link (top-left nav on the clip + account pages) */
.back-link {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--fg-dim);
}
.back-link:hover { color: var(--accent); text-decoration: none; }
.back-link svg { width: 16px; height: 16px; }

/* viewer with a top header + centered content (was flex-row, awkward). Applies
   to the in-app viewer (Gallery back-link) and the public clip page (Vale home). */
.viewer[data-view="inapp"], .viewer[data-view="pub"] { flex-direction: column; }
.viewer-topbar {
  width: 100%; padding: 18px var(--pad);
  display: flex; align-items: center; border-bottom: 1px solid var(--hair);
}
.viewer[data-view="inapp"] .viewer-wrap, .viewer[data-view="pub"] .viewer-wrap { margin: auto; }

/* embeds on/off switch */
.toggle { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; margin-top: 6px; align-self: flex-start; }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-track {
  width: 42px; height: 24px; border-radius: 999px; background: var(--line-2);
  position: relative; transition: background 160ms ease; flex: none;
}
.toggle-thumb {
  position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--fg); transition: transform 160ms ease;
}
.toggle input:checked + .toggle-track { background: var(--accent); }
.toggle input:checked + .toggle-track .toggle-thumb { transform: translateX(18px); background: var(--bg-hard); }
.toggle input:focus-visible + .toggle-track { box-shadow: 0 0 0 3px var(--accent-tint); }
.toggle-label { font-size: 14px; color: var(--fg); }

/* ---- appearance controls (theme + accent) -------------------------------- */
.expiry-select { display: inline-flex; align-items: center; gap: 4px; align-self: flex-start; margin-top: 4px; }
.expiry-select select {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--accent); background: var(--surface); border: 1px solid var(--line-2); border-radius: 8px;
  padding: 9px 30px 9px 12px; cursor: pointer; -webkit-appearance: none; appearance: none;
}
.expiry-select select:focus { outline: none; border-color: var(--accent); }
.expiry-select .caret { color: var(--accent); margin-left: -24px; pointer-events: none; }
.accent-row { display: inline-flex; align-items: center; gap: 12px; align-self: flex-start; margin-top: 4px; }
.accent-row input[type="color"] {
  width: 46px; height: 34px; padding: 0; border: 1px solid var(--line-2); border-radius: 8px;
  background: var(--surface); cursor: pointer;
}
.accent-row input[type="color"]::-webkit-color-swatch-wrapper { padding: 4px; }
.accent-row input[type="color"]::-webkit-color-swatch { border: none; border-radius: 5px; }
.accent-hex { text-transform: none; letter-spacing: 0.06em; }

/* ---- custom scheme builder ----------------------------------------------- */
.scheme-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 12px 14px; margin: 10px 0 18px;
}
.scheme-slot { display: flex; flex-direction: column; gap: 6px; }
.scheme-slot input[type="color"] {
  width: 100%; height: 34px; padding: 0; border: 1px solid var(--line-2); border-radius: 8px;
  background: var(--surface); cursor: pointer;
}
.scheme-slot input[type="color"]::-webkit-color-swatch-wrapper { padding: 4px; }
.scheme-slot input[type="color"]::-webkit-color-swatch { border: none; border-radius: 5px; }
#scheme-name {
  align-self: flex-start; min-width: 220px; margin-top: 4px;
}
.scheme-swatch {
  display: inline-block; width: 12px; height: 12px; border-radius: 3px;
  margin-right: 8px; vertical-align: -1px; border: 1px solid var(--hair-strong);
}

/* ---- admin block (invites + users) --------------------------------------- */
.invite-actions { display: flex; gap: 14px; align-items: stretch; margin-top: 14px; flex-wrap: wrap; }
/* Align CREATE LINK to the Send-invite pill: same height, same top/bottom edge.
   Neutralize the .account-form .pill margin-top/align-self leak inside this row. */
.invite-actions .pill { margin-top: 0; align-self: stretch; }
.invite-list, .user-list { margin-top: 16px; display: flex; flex-direction: column; }
.admin-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 10px 0; border-bottom: 1px solid var(--hair);
}
.admin-row .mono-meta { overflow: hidden; text-overflow: ellipsis; }
.admin-row .row-actions { display: inline-flex; gap: 8px; flex: none; }
.admin-row.is-resolved { opacity: 0.5; }

/* small status pill (e.g. DISABLED) inline in an admin row */
.pill-badge {
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--bg-hard); background: var(--red);
  padding: 1px 5px; border-radius: 4px; vertical-align: 1px;
}

/* ---- public viewer: report action (muted, footer-like) ------------------- */
.report-line { margin-top: 4px; }
.report-btn {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--fg-dim); background: none; border: none; padding: 4px 6px; cursor: pointer;
  transition: color 150ms ease;
}
.report-btn:hover:not(:disabled) { color: var(--red); }
.report-btn:disabled { color: var(--fg-dim); cursor: default; }

/* ---- house rules page + signup consent ----------------------------------- */
.rules-list {
  margin: 18px 0 6px; padding-left: 18px; display: flex; flex-direction: column; gap: 8px;
  font-family: var(--sans); font-size: 15px; color: var(--fg); line-height: 1.5;
}
.rules-check { align-items: flex-start; margin-top: 16px; }
.rules-check .toggle-track { margin-top: 2px; }
.rules-check .toggle-label { font-size: 13px; line-height: 1.4; }
