/* Photos are the content; chrome stays out of the way. Near-black canvas so
   colour in the images reads true, warm amber accent for anything interactive. */

:root {
  --bg: #0b0b0d;
  --surface: #141418;
  --surface-2: #1d1d23;
  --line: #2a2a32;
  --text: #ecebe8;
  --muted: #8f8d99;
  --accent: #f0a04b;
  --accent-ink: #1a1206;
  --danger: #f2705f;
  --radius: 10px;
  --bar-h: 56px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }
code, pre { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 13px; }
pre { background: var(--surface-2); padding: 12px; border-radius: var(--radius); overflow-x: auto; }

.muted { color: var(--muted); }
.error { color: var(--danger); margin: 0 0 4px; }

/* ---------- centred card (index / join) ---------- */

.centered {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.card {
  width: min(400px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.brand {
  margin: 0 0 4px;
  font-size: 22px;
  letter-spacing: -0.02em;
}

label { font-size: 13px; color: var(--muted); margin-top: 6px; }

input[type="text"], input[type="password"], input:not([type]) {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--text);
  font: inherit;
  width: 100%;
}
input:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button {
  font: inherit;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  padding: 9px 14px;
  cursor: pointer;
}
button:hover:not(:disabled) { border-color: #3b3b46; }
button:disabled { opacity: .45; cursor: default; }

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  margin-top: 14px;
  padding: 11px 14px;
}

/* ---------- top bar ---------- */

.bar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--bar-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: rgba(11, 11, 13, .82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.bar h1 { font-size: 15px; margin: 0; font-weight: 600; letter-spacing: -0.01em; }
.bar .spacer { flex: 1; }
.bar .who { color: var(--muted); font-size: 13px; }

select {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  max-width: 46vw;
}

/* ---------- grid ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 4px;
  padding: 4px;
}
@media (min-width: 900px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px; padding: 6px; }
}

.tile {
  position: relative;
  aspect-ratio: 1;
  background: var(--surface-2);
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
}
.tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity .25s ease, transform .15s ease;
}
.tile img.loaded { opacity: 1; }

.tile .who-tag {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 18px 8px 6px;
  font-size: 11px;
  color: #fff;
  background: linear-gradient(transparent, rgba(0,0,0,.65));
  opacity: 0;
  transition: opacity .15s;
  pointer-events: none;
}
.tile:hover .who-tag { opacity: 1; }

/* A video tile is a poster frame, so it needs to say so. Always visible, not
   hover-revealed - on a phone there is no hover, and "will this play?" is the
   one thing you need to know before tapping. */
.tile .play-badge {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 40px; height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(0, 0, 0, .5);
  border: 1.5px solid rgba(255, 255, 255, .85);
  color: #fff;
  font-size: 14px;
  padding-left: 3px; /* optical centring: the glyph is left-heavy */
  pointer-events: none;
  transition: transform .15s ease;
}
.tile.is-video:hover .play-badge { transform: translate(-50%, -50%) scale(1.08); }
.tile.selected .play-badge { opacity: .35; }

.tile .pick {
  position: absolute;
  top: 6px; left: 6px;
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.85);
  background: rgba(0,0,0,.3);
  display: grid;
  place-items: center;
  font-size: 13px;
  color: var(--accent-ink);
  opacity: 0;
  transition: opacity .15s;
}
.tile:hover .pick, .tile.selected .pick, body.picking .pick { opacity: 1; }
.tile.selected .pick { background: var(--accent); border-color: var(--accent); }
.tile.selected img { transform: scale(.9); border-radius: 6px; }
.tile.selected { outline: 2px solid var(--accent); }

.date-head {
  grid-column: 1 / -1;
  padding: 22px 6px 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.empty { padding: 80px 24px; text-align: center; color: var(--muted); }

/* ---------- selection action bar ---------- */

.selbar {
  position: fixed;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  transform: translate(-50%, 150%);
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 10px 40px rgba(0,0,0,.55);
  transition: transform .22s cubic-bezier(.2,.8,.3,1);
}
.selbar.show { transform: translate(-50%, 0); }
.selbar .count { font-size: 13px; color: var(--muted); padding-left: 6px; }

/* ---------- uploader ---------- */

.drop-hint {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  place-items: center;
  background: rgba(11,11,13,.85);
  border: 3px dashed var(--accent);
  font-size: 18px;
}
body.dragging .drop-hint { display: grid; }

.uploads {
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 40;
  width: min(340px, calc(100vw - 24px));
  max-height: 45vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  display: none;
}
.uploads.show { display: block; }
.uploads header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  margin-bottom: 8px;
}
.uploads header .spacer { flex: 1; }

.up-row { font-size: 12px; padding: 5px 0; }
.up-row .name {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--muted);
}
.up-row .track {
  height: 3px;
  background: var(--surface-2);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 4px;
}
.up-row .fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width .2s;
}
.up-row.done .fill { background: #5bbd7a; }
.up-row.failed .name { color: var(--danger); }
.up-row.failed .fill { background: var(--danger); width: 100%; }

/* ---------- lightbox ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: #000;
  display: none;
  flex-direction: column;
}
.lightbox.show { display: flex; }
.lightbox .lb-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  padding-top: max(10px, env(safe-area-inset-top));
  color: var(--text);
  font-size: 13px;
}
.lightbox .lb-bar .spacer { flex: 1; }
.lightbox .stage {
  flex: 1;
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  touch-action: pan-y;
}
.lightbox img,
.lightbox video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  user-select: none;
}
/* Native controls sit at the bottom of the video, where the prev/next arrows
   are vertically centred - so the video gets a little inset to keep the two
   from overlapping on narrow screens. */
.lightbox video {
  width: auto;
  outline: none;
}
.lightbox video[hidden], .lightbox img[hidden] { display: none; }
.lightbox .nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px; height: 64px;
  background: rgba(0,0,0,.35);
  border: 0;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  border-radius: 8px;
}
.lightbox .nav.prev { left: 8px; }
.lightbox .nav.next { right: 8px; }
@media (hover: none) { .lightbox .nav { display: none; } }

.sentinel { height: 1px; }
.spinner { padding: 28px; text-align: center; color: var(--muted); font-size: 13px; }
