:root {
  --bg: #0b0b0d;
  --surface: #17171a;
  --surface-2: #202024;
  --border: #2c2c31;
  --text: #f3f2ef;
  --text-dim: #9c9ca3;
  --accent: #e8c78a;
  --danger: #f87171;
  --radius: 14px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; text-decoration: none; }
button, input, textarea { font-family: inherit; }
img, video { max-width: 100%; display: block; }
.hidden { display: none !important; }

/* ---------- Hero ---------- */
.hero {
  padding: calc(48px + var(--safe-top)) 24px 32px;
  text-align: center;
  max-width: 640px;
  margin: 0 auto;
}
.hero h1 { font-size: 26px; margin: 0 0 6px; letter-spacing: 0.5px; }
.hero p.tagline { color: var(--text-dim); font-size: 15px; margin: 0 0 20px; }
.social-links { display: flex; justify-content: center; gap: 18px; }
.social-links a {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 19px;
}

/* ---------- Album grid ---------- */
.section-wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px 60px; }
.year-heading {
  font-size: 14px; letter-spacing: 2px; text-transform: uppercase;
  color: var(--text-dim); margin: 36px 0 14px; padding-left: 2px;
}
.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.album-card {
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
}
.album-cover {
  aspect-ratio: 4/3;
  background: var(--surface-2);
  overflow: hidden;
  position: relative;
}
.album-cover img, .album-cover video { width: 100%; height: 100%; object-fit: cover; }
.album-cover .play-badge {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 30px; color: #fff; background: rgba(0,0,0,0.15);
}
.album-meta { padding: 12px 14px; }
.album-meta .title { font-weight: 600; font-size: 15px; }
.album-meta .date { color: var(--text-dim); font-size: 12px; margin-top: 2px; }

/* ---------- Album detail ---------- */
.album-header { max-width: 1080px; margin: 0 auto; padding: calc(20px + var(--safe-top)) 16px 10px; }
.back-link { color: var(--text-dim); font-size: 14px; margin-bottom: 10px; display: inline-block; cursor: pointer; }
.album-header h2 { margin: 4px 0 4px; font-size: 22px; }
.album-header .date { color: var(--text-dim); font-size: 13px; }
.album-header .desc { color: var(--text-dim); font-size: 14px; margin-top: 8px; max-width: 640px; }

.media-grid {
  max-width: 1080px; margin: 20px auto 60px; padding: 0 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
}
.media-tile {
  aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--surface-2);
  cursor: pointer; position: relative;
}
.media-tile img, .media-tile video { width: 100%; height: 100%; object-fit: cover; }
.media-tile .play-badge { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 24px; color: #fff; background: rgba(0,0,0,0.1); pointer-events: none; }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,0.94); z-index: 50;
  display: flex; align-items: center; justify-content: center;
}
.lightbox .lb-media { max-width: 94vw; max-height: 86vh; }
.lightbox .lb-close, .lightbox .lb-prev, .lightbox .lb-next {
  position: absolute; background: none; border: none; color: #fff; font-size: 28px;
  padding: 14px; cursor: pointer;
}
.lightbox .lb-close { top: calc(6px + var(--safe-top)); right: 6px; }
.lightbox .lb-prev { left: 4px; top: 50%; transform: translateY(-50%); font-size: 36px; }
.lightbox .lb-next { right: 4px; top: 50%; transform: translateY(-50%); font-size: 36px; }

.empty-state { text-align: center; color: var(--text-dim); padding: 60px 20px; }

/* ================= ADMIN ================= */
.admin-topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(14px + var(--safe-top)) 18px 14px;
  background: rgba(11,11,13,0.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.admin-topbar h1 { font-size: 17px; margin: 0; }
.admin-topbar .icon-btn { background: none; border: none; color: var(--text-dim); font-size: 19px; padding: 6px; }
.admin-main { max-width: 820px; margin: 0 auto; padding: 18px 16px 60px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 6px; }
.field input, .field textarea {
  width: 100%; padding: 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text);
}
.field textarea { min-height: 70px; resize: vertical; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-radius: var(--radius); padding: 13px 20px; font-size: 15px;
  font-weight: 600; cursor: pointer; width: 100%;
}
.btn-primary { background: var(--accent); color: #201705; }
.btn-secondary { background: var(--surface-2); color: var(--text); }
.btn-danger { background: transparent; color: var(--danger); }
.btn-sm { width: auto; padding: 8px 14px; font-size: 13px; }
.fab-row { display: flex; gap: 10px; }

.admin-album-row { display: flex; align-items: center; gap: 12px; cursor: pointer; padding: 10px 0; border-bottom: 1px solid var(--border); }
.admin-album-row:last-child { border-bottom: none; }
.admin-album-row .thumb { width: 56px; height: 56px; border-radius: 8px; background: var(--surface-2); overflow: hidden; flex-shrink: 0; }
.admin-album-row .thumb img { width: 100%; height: 100%; object-fit: cover; }
.admin-album-row .info { flex: 1; min-width: 0; }
.admin-album-row .info .t { font-weight: 600; }
.admin-album-row .info .d { color: var(--text-dim); font-size: 12px; }

.upload-zone {
  border: 2px dashed var(--border); border-radius: var(--radius); padding: 22px;
  text-align: center; color: var(--text-dim); margin-bottom: 14px; cursor: pointer;
}
.admin-media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; margin-bottom: 14px; }
.admin-media-tile { aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--surface-2); position: relative; }
.admin-media-tile img, .admin-media-tile video { width: 100%; height: 100%; object-fit: cover; }
.admin-media-tile .del-media {
  position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,0.6); color: #fff; border: none;
  border-radius: 50%; width: 22px; height: 22px; font-size: 12px; cursor: pointer;
}
.admin-media-tile .cover-badge {
  position: absolute; bottom: 4px; left: 4px; background: rgba(0,0,0,0.6); color: var(--accent);
  font-size: 10px; padding: 2px 6px; border-radius: 6px;
}

.upload-progress-list { margin-bottom: 14px; }
.upload-progress-item { font-size: 12px; color: var(--text-dim); margin-bottom: 8px; }
.progress-bar { height: 4px; background: var(--surface-2); border-radius: 2px; overflow: hidden; margin-top: 4px; }
.progress-bar .fill { height: 100%; background: var(--accent); width: 0%; }

/* ---------- Login (shared with admin) ---------- */
.login-screen {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px; padding-top: calc(24px + var(--safe-top));
}
.login-card { width: 100%; max-width: 360px; text-align: center; }
.login-card h1 { font-size: 22px; margin-bottom: 4px; }
.login-card p.sub { color: var(--text-dim); font-size: 14px; margin-bottom: 28px; }
.login-card input[type="password"] {
  width: 100%; padding: 16px; font-size: 20px; letter-spacing: 2px; text-align: center;
  border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); color: var(--text);
  margin-bottom: 14px;
}
.remember-row { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--text-dim); font-size: 14px; margin-bottom: 18px; }
.error-msg { color: var(--danger); font-size: 14px; min-height: 20px; margin-bottom: 10px; }
