:root {
  --ink: #23201c;
  --mut: #7d766c;
  --faint: #a9a196;
  --bg: #f6f3ee;
  --card: #fffdfa;
  --line: #e4ded4;
  --accent: #2f6f4f;
  --accent-soft: #e8f0ea;
  --danger: #a8412f;
  --shadow: 0 1px 2px rgba(35,32,28,.05), 0 8px 24px -12px rgba(35,32,28,.18);
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #ece7df; --mut: #9b948a; --faint: #6f685f;
    --bg: #171513; --card: #201d1a; --line: #322d28;
    --accent: #6fbf92; --accent-soft: #24352c;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px -12px rgba(0,0,0,.6);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }

/* ---------- login ---------- */
.login-wrap {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 36px 32px 30px;
  text-align: center;
}
.login .mark {
  width: 46px; height: 46px; margin: 0 auto 18px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid; place-items: center;
}
.login h1 { font-size: 21px; margin: 0 0 6px; letter-spacing: -.01em; }
.login p { color: var(--mut); font-size: 14px; margin: 0 0 24px; }
input[type=password], input[type=text] {
  width: 100%;
  padding: 12px 14px;
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
}
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  transition: filter .15s;
}
@media (prefers-color-scheme: dark) { .btn { color: #10221a; } }
.btn:hover { filter: brightness(1.07); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.full { width: 100%; margin-top: 14px; }
.btn.ghost {
  background: transparent; color: var(--ink); border-color: var(--line);
  font-weight: 500;
}
.btn.ghost:hover { background: var(--bg); filter: none; }
.btn.sm { padding: 7px 13px; font-size: 14px; }
.btn.danger { background: transparent; color: var(--danger); border-color: var(--line); }
.err {
  margin-top: 14px; font-size: 14px; color: var(--danger);
  min-height: 20px;
}

/* ---------- chrome ---------- */
header.top {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 22px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; letter-spacing: -.02em; font-size: 17px; }
.brand em { color: var(--accent); font-style: normal; }
.spacer { flex: 1; }
.navlink {
  padding: 7px 12px; border-radius: 8px; font-size: 14px; color: var(--mut); font-weight: 500;
}
.navlink:hover { background: var(--card); color: var(--ink); }
.navlink.on { background: var(--accent-soft); color: var(--accent); }

main { max-width: 1200px; margin: 0 auto; padding: 30px 22px 90px; }
.page-head { margin-bottom: 26px; }
.page-head h1 { font-size: 27px; margin: 0 0 4px; letter-spacing: -.02em; }
.page-head .sub { color: var(--mut); font-size: 14.5px; }
.back {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 14px; color: var(--mut); margin-bottom: 12px;
}
.back:hover { color: var(--accent); }

/* ---------- albums ---------- */
.albums {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 20px;
}
.album {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform .18s ease, box-shadow .18s ease;
}
.album:hover { transform: translateY(-3px); box-shadow: 0 4px 8px rgba(35,32,28,.06), 0 18px 36px -16px rgba(35,32,28,.28); }
.album .cover {
  aspect-ratio: 4/3; background: var(--accent-soft); display: block;
  width: 100%; object-fit: cover;
}
.album .cover.empty { display: grid; place-items: center; color: var(--accent); opacity: .5; }
.album .meta { padding: 13px 15px 15px; }
.album .meta h3 { margin: 0 0 3px; font-size: 15.5px; font-weight: 600; }
.album .meta span { color: var(--faint); font-size: 13px; }

/* ---------- photo grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px;
}
.tile {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--line);
  cursor: zoom-in;
}
.tile img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .35s ease;
  background: var(--accent-soft);
}
.tile:hover img { transform: scale(1.05); }
.tile .play {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  background: linear-gradient(transparent 45%, rgba(0,0,0,.45));
  color: #fff;
  pointer-events: none;
}
.tile .dur {
  position: absolute; right: 7px; bottom: 6px;
  font-size: 11.5px; font-weight: 600;
  background: rgba(0,0,0,.6); color: #fff;
  padding: 2px 6px; border-radius: 5px;
  pointer-events: none;
}

/* ---------- lightbox ---------- */
.lb {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(12,10,9,.96);
  display: none;
  flex-direction: column;
}
.lb.open { display: flex; }
.lb-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; color: #ddd7cd; font-size: 14px;
}
.lb-bar .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-bar button, .lb-bar a {
  background: rgba(255,255,255,.09); color: #f2ede5;
  border: none; border-radius: 8px; padding: 7px 12px; font-size: 13.5px;
}
.lb-bar button:hover, .lb-bar a:hover { background: rgba(255,255,255,.18); }
.lb-stage {
  flex: 1; position: relative;
  display: grid; place-items: center;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  padding: 0 12px 12px;
  min-height: 0; min-width: 0; overflow: hidden;
}
#lb-media {
  width: 100%; height: 100%;
  min-width: 0; min-height: 0;
  display: flex; align-items: center; justify-content: center;
}
.lb-stage img, .lb-stage video {
  max-width: 100%; max-height: 100%;
  width: auto; height: auto;
  object-fit: contain;
  border-radius: 6px;
}
.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 46px; height: 46px; border-radius: 50%;
  background: rgba(255,255,255,.1); color: #fff;
  border: none; display: grid; place-items: center;
}
.lb-nav:hover { background: rgba(255,255,255,.22); }
.lb-nav.prev { left: 14px; }
.lb-nav.next { right: 14px; }
.lb-cap {
  padding: 10px 16px 18px; text-align: center;
  color: #b8b1a6; font-size: 14px;
}
.lb-cap input {
  max-width: 520px; margin: 0 auto;
  background: rgba(255,255,255,.07); border-color: rgba(255,255,255,.14); color: #eee;
  text-align: center;
}

/* ---------- upload ---------- */
.drop {
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  background: var(--card);
  padding: 48px 24px;
  text-align: center;
  transition: border-color .15s, background .15s;
}
.drop.hot { border-color: var(--accent); background: var(--accent-soft); }
.drop h3 { margin: 14px 0 6px; font-size: 18px; }
.drop p { margin: 0 0 20px; color: var(--mut); font-size: 14px; }
.drop .picks { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 6px; }
.field .hint { font-size: 13px; color: var(--faint); margin-top: 6px; }

.queue { margin-top: 24px; }
.q-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  margin-bottom: 8px;
  font-size: 14px;
}
.q-row .qn { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-row .qs { color: var(--faint); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.bar { width: 110px; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.q-row.done .qs { color: var(--accent); }
.q-row.fail .qs { color: var(--danger); }

.empty-state { text-align: center; padding: 70px 20px; color: var(--mut); }
.empty-state svg { color: var(--faint); margin-bottom: 14px; }
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px);
  background: var(--ink); color: var(--bg);
  padding: 11px 18px; border-radius: 10px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: all .25s; z-index: 90;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 620px) {
  main { padding: 22px 14px 80px; }
  header.top { padding: 12px 14px; gap: 8px; }
  .navlink { padding: 7px 9px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 6px; }
  .albums { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
  .lb-nav { width: 38px; height: 38px; }
  .page-head h1 { font-size: 22px; }
}
