@font-face { font-family: "Righteous"; src: url("/s/_/fonts/righteous-latin.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Bricolage"; src: url("/s/_/fonts/bricolage-latin.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }

:root {
  --bg: #0F0E17;
  --panel: #1A1828;
  --panel2: #242136;
  --line: #2E2A45;
  --text: #ECEAF6;
  --muted: #A29DBF;
  --accent: #8A73F2;
  --accent-strong: #5B3FD9;
  --danger: #E5677B;
  --head: "Bricolage", system-ui, -apple-system, "Segoe UI", sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --row: 220px;
  color-scheme: dark;
}
@media (max-width: 700px) { :root { --row: 112px; } }

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 var(--body); }
body { min-height: 100vh; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

/* --- login --- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login form { width: min(360px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 24px; padding: 28px; display: grid; gap: 14px; }
.login svg { width: 76px; justify-self: center; }
.login h1 { font: 400 34px/1 Righteous, var(--head); margin: 0 0 6px; text-align: center; }
.login label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.field { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; outline: none; }
.field:focus { border-color: var(--accent); }
.btn { border: 0; border-radius: 999px; padding: 10px 18px; background: var(--accent-strong); color: #fff; font-weight: 600; }
.btn:hover { background: #6B50E8; }
.btn.ghost { background: var(--panel2); color: var(--text); }
.btn.danger { background: var(--danger); }
.error { color: var(--danger); font-size: 14px; min-height: 1em; }

/* --- frame --- */
header.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 10px 20px; background: rgba(15,14,23,.86); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.brand svg { width: 34px; }
.brand span { font: 400 24px/1 Righteous, var(--head); }
nav.main { display: flex; gap: 4px; }
nav.main a { text-decoration: none; padding: 7px 13px; border-radius: 999px; color: var(--muted); font-weight: 600; }
nav.main a.on, nav.main a:hover { color: var(--text); background: var(--panel2); }
.search { flex: 1; max-width: 460px; margin-left: auto; position: relative; }
.search input { width: 100%; padding: 9px 14px 9px 38px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); outline: none; }
.search input:focus { border-color: var(--accent); }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; color: var(--muted); }
.icon-btn { border: 0; background: transparent; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--text); }
.icon-btn:hover { background: var(--panel2); }
.icon-btn svg { width: 22px; height: 22px; }
main { padding: 8px 20px 120px; }
@media (max-width: 700px) {
  header.top { flex-wrap: wrap; padding: 8px 12px; gap: 8px; }
  .brand { margin-right: auto; }
  nav.main { order: 3; width: 100%; overflow-x: auto; }
  .search { order: 2; max-width: none; margin: 0; flex-basis: 100%; }
  main { padding: 4px 4px 120px; }
}

h2.title { font: 700 28px/1.2 var(--head); margin: 18px 4px 4px; }
.sub { color: var(--muted); margin: 0 4px 14px; }
.empty { color: var(--muted); text-align: center; padding: 80px 20px; }

/* --- photo grid: justified rows per day --- */
.day { content-visibility: auto; contain-intrinsic-size: auto 400px; }
.day h3 { font: 600 15px/1 var(--head); margin: 22px 4px 10px; color: var(--text); }
.day h3 small { color: var(--muted); font-weight: 400; margin-left: 8px; }
.row { display: flex; gap: 4px; margin-bottom: 4px; }
.tile { position: relative; flex: 0 0 auto; height: var(--h); width: var(--w); border-radius: 6px; overflow: hidden; background: var(--panel2); cursor: pointer; }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity .25s; }
.tile img.in { opacity: 1; }
.tile .badge { position: absolute; right: 6px; bottom: 6px; font-size: 12px; background: rgba(0,0,0,.55); padding: 1px 7px 1px 5px; border-radius: 999px; display: flex; align-items: center; gap: 3px; }
.tile .badge svg { width: 13px; }
.tile .fav { position: absolute; left: 6px; bottom: 6px; width: 16px; color: #fff; filter: drop-shadow(0 1px 2px #000); }
.tile .check { position: absolute; left: 6px; top: 6px; width: 24px; height: 24px; border-radius: 50%; border: 2px solid #fff; background: rgba(0,0,0,.25); opacity: 0; transition: opacity .15s; display: grid; place-items: center; }
.tile:hover .check, .selecting .tile .check { opacity: 1; }
.tile.sel .check { background: var(--accent); border-color: var(--accent); }
.tile.sel .check::after { content: ""; width: 10px; height: 5px; border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(-45deg) translate(1px, -1px); }
.tile.sel img { transform: scale(.9); border-radius: 10px; transition: transform .15s; }

/* --- cards: albums, people --- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; padding: 4px; }
.card { text-decoration: none; display: grid; gap: 8px; }
.card .cover { aspect-ratio: 1; border-radius: 18px; overflow: hidden; background: var(--panel2); }
.card .cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card b { font-family: var(--head); font-size: 16px; }
.card span { color: var(--muted); font-size: 13px; margin-top: -6px; }
.people { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.people .cover { border-radius: 50%; }
.people .card { text-align: center; }
.people .unnamed { color: var(--accent); font-weight: 600; }
.person-head { display: flex; align-items: center; gap: 16px; margin: 16px 4px; }
.person-head img { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; }
.person-head input { font: 700 26px/1.2 var(--head); background: transparent; border: 0; border-bottom: 2px solid transparent; outline: none; padding: 2px 0; width: min(420px, 100%); }
.person-head input:focus { border-color: var(--accent); }

/* --- selection bar, toasts --- */
.selbar { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 30; display: flex; align-items: center; gap: 6px; padding: 8px 10px 8px 18px; background: var(--panel2); border: 1px solid var(--line); border-radius: 999px; box-shadow: 0 10px 40px rgba(0,0,0,.5); white-space: nowrap; }
.selbar b { margin-right: 8px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; background: #2C2842; border: 1px solid var(--line); padding: 11px 18px; border-radius: 14px; box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.toast button { margin-left: 14px; background: none; border: 0; color: var(--accent); font-weight: 700; }
.drop { position: fixed; inset: 0; z-index: 70; background: rgba(91,63,217,.25); border: 3px dashed var(--accent); display: grid; place-items: center; font: 700 26px var(--head); pointer-events: none; }

/* --- dialogs --- */
.dialog-back { position: fixed; inset: 0; z-index: 80; background: rgba(0,0,0,.55); display: grid; place-items: center; padding: 20px; }
.dialog { width: min(420px, 100%); max-height: 80vh; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 22px; padding: 22px; display: grid; gap: 12px; }
.dialog h3 { margin: 0; font: 700 20px var(--head); }
.dialog .list button { display: flex; width: 100%; align-items: center; gap: 12px; text-align: left; background: none; border: 0; padding: 8px; border-radius: 12px; }
.dialog .list button:hover { background: var(--panel2); }
.dialog .list img { width: 46px; height: 46px; border-radius: 10px; object-fit: cover; background: var(--panel2); }
.dialog .row-end { display: flex; justify-content: flex-end; gap: 8px; }

/* --- viewer --- */
.viewer { position: fixed; inset: 0; z-index: 50; background: #000; display: flex; }
.viewer .stage { position: relative; flex: 1; display: grid; place-items: center; overflow: hidden; }
.viewer .stage img, .viewer .stage video { max-width: 100%; max-height: 100vh; object-fit: contain; user-select: none; }
.viewer .bar { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 4px; padding: 10px 12px; background: linear-gradient(rgba(0,0,0,.6), transparent); z-index: 2; }
.viewer .bar .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; margin-left: 6px; }
.viewer .arrow { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; width: 52px; height: 52px; border-radius: 50%; border: 0; background: rgba(255,255,255,.12); color: #fff; display: grid; place-items: center; }
.viewer .arrow:hover { background: rgba(255,255,255,.22); }
.viewer .arrow svg { width: 26px; }
.viewer .arrow.prev { left: 16px; }
.viewer .arrow.next { right: 16px; }
.viewer .arrow:disabled { opacity: 0; }
.viewer .icon-btn.on { color: #FF6B8A; }
.viewer aside { width: 340px; background: var(--panel); border-left: 1px solid var(--line); padding: 22px; overflow-y: auto; }
.viewer aside h4 { margin: 18px 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.viewer aside p { margin: 0; }
.viewer aside textarea { width: 100%; min-height: 70px; resize: vertical; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 10px; color: var(--text); font: inherit; }
.viewer aside .faces { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.viewer aside .faces a { display: grid; justify-items: center; gap: 4px; font-size: 12px; text-decoration: none; width: 64px; text-align: center; }
.viewer aside .faces img { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; }
@media (max-width: 900px) { .viewer aside { position: absolute; inset: auto 0 0 0; width: auto; max-height: 55vh; z-index: 3; border-left: 0; border-top: 1px solid var(--line); border-radius: 20px 20px 0 0; } .viewer .arrow { display: none; } }
