:root {
  --bg: #0e0e11;
  --surface: #17171c;
  --surface-2: #21212a;
  --line: #2b2b34;
  --text: #f4f4f5;
  --muted: #a3a3ad;
  --accent: #f15a37;
  --accent-strong: #ff7a54;
  --accent-ink: #111111;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
}

h1, h2, h3 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 500;
  margin: 0;
}

img { max-width: 100%; }

.hidden { display: none !important; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

/* Header */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top));
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.brand { display: inline-flex; align-items: center; text-decoration: none; }
.brand img { height: 46px; width: auto; display: block; max-width: 220px; object-fit: contain; }
.brandword { color:#fff; font-weight:800; font-size:20px; letter-spacing:-.03em; margin-left:9px; }
.brandtext {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.iconbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.iconbtn svg { width: 22px; height: 22px; }
.iconbtn:hover { background: var(--surface-2); border-color: var(--accent); color: var(--accent-strong); }
.iconbtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.iconbtn:active { transform: translateY(1px); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 20px;
  border-radius: 12px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-strong); color: var(--accent-ink); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-strong); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Album head */
.wrap { padding-bottom: calc(120px + env(safe-area-inset-bottom)); }

.coverhero {
  max-height: 320px;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}
.coverhero img { width: 100%; height: 100%; object-fit: cover; display: block; }

.albumnote {
  margin: 12px auto 0;
  max-width: 520px;
  color: var(--accent-strong);
  font-size: 0.88rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 16px;
}

.albumfoot {
  text-align: center;
  padding: 28px 16px 8px;
}
.albumfoot a { color: var(--muted); font-size: 0.82rem; text-decoration: none; }
.albumfoot a:hover { color: var(--accent-strong); }

/* Formular parola album */
.passform { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.passform input {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  font: inherit;
  padding: 12px 14px;
  text-align: center;
}
.passform input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.passerror { color: #e07a7a; font-size: 0.9rem; margin: 0 0 4px; }

/* Modal nume invitat */
.frow-guest { margin-bottom: 12px; }
.frow-guest input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  font: inherit;
  padding: 11px 12px;
}
.frow-guest input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.guestterms {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 16px;
  cursor: pointer;
}
.guestterms input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); }
#guestGo { width: 100%; }

.albumhead { padding: 26px 16px 18px; text-align: center; }
.albumhead h1 { font-size: clamp(1.5rem, 5vw, 2.2rem); }
.albummeta { margin: 8px 0 0; color: var(--muted); font-size: 0.92rem; }

/* Grid */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 0 8px;
}
@media (min-width: 640px) { .grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(5, 1fr); gap: 8px; padding: 0 16px; } }
@media (min-width: 1280px) { .grid { grid-template-columns: repeat(6, 1fr); } }

.ph {
  position: relative;
  padding: 0;
  border: 0;
  background: var(--surface);
  aspect-ratio: 1;
  overflow: hidden;
  cursor: pointer;
  border-radius: 12px;
}
.ph img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.25s ease, opacity 0.3s ease;
}
.ph:hover img { transform: scale(1.04); }
.ph:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; z-index: 1; }

#sentinel { height: 1px; }

/* Navbar jos, stil aplicatie mobila */
.bottombar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--line);
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.35);
}
.bb-item {
  flex: 1;
  max-width: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 56px;
  padding: 8px 6px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.bb-item svg { width: 24px; height: 24px; }
.bb-item:hover { background: var(--surface-2); color: var(--accent-strong); }
.bb-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.bb-item:active { transform: translateY(1px); }
.bb-primary { background: var(--accent); color: var(--accent-ink); }
.bb-primary:hover { background: var(--accent-strong); color: var(--accent-ink); }

/* Empty state */
.empty {
  text-align: center;
  padding: 64px 24px;
  color: var(--muted);
}
.empty svg { width: 72px; height: 72px; opacity: 0.5; }
.empty h2 { color: var(--text); font-size: 1.4rem; margin: 16px 0 8px; }
.empty p { margin: 0 0 20px; }

/* 404 */
.page-404 { display: grid; place-items: center; min-height: 100vh; }
.notfound { text-align: center; padding: 32px 24px; max-width: 420px; }
.notfound .brand img { height: 42px; margin-bottom: 28px; }
.notfound h1 { font-size: 1.7rem; margin-bottom: 10px; }
.notfound p { color: var(--muted); margin: 0 0 24px; }

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(5, 5, 7, 0.97);
  display: flex;
  flex-direction: column;
  touch-action: pan-y;
}
.lb-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  padding-top: calc(10px + env(safe-area-inset-top));
}
.lb-counter { color: var(--muted); font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.lb-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 0 8px;
}
.lb-stage img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}
.lb-bottom {
  display: flex;
  justify-content: center;
  padding: 14px 16px;
  padding-bottom: calc(14px + env(safe-area-inset-bottom));
}
.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: 64px;
  display: none;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 12px;
  background: rgba(23, 23, 28, 0.7);
  color: var(--text);
  cursor: pointer;
}
.lb-nav svg { width: 26px; height: 26px; }
.lb-nav:hover { color: var(--accent-strong); }
.lb-prev { left: 10px; }
.lb-next { right: 10px; }
@media (min-width: 900px) { .lb-nav { display: inline-flex; } }
#lbSize { font-weight: 400; opacity: 0.75; margin-left: 6px; }

/* Upload sheet */
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 55;
  background: var(--surface);
  border-top: 1px solid var(--line);
  border-radius: 18px 18px 0 0;
  max-height: 62vh;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.45);
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 8px;
}
.upbar {
  height: 6px;
  margin: 0 16px;
  border-radius: 4px;
  background: var(--surface-2);
  overflow: hidden;
}
.upbar-fill {
  height: 100%;
  width: 0;
  border-radius: 4px;
  background: var(--accent);
  transition: width 0.2s ease;
}
.upsummary { margin: 8px 16px; color: var(--muted); font-size: 0.88rem; }
.uplist { overflow-y: auto; padding: 0 16px 16px; }
.uprow {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.88rem;
}
.uprow:last-child { border-bottom: 0; }
.upname {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.upstate { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.upstate.ok { color: #7fc97f; }
.upstate.err { color: #e07a7a; }
.upretry {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--accent-strong);
  border-radius: 8px;
  padding: 4px 10px;
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}
.upretry:hover { border-color: var(--accent); }

/* Modals */
.modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(5, 5, 7, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.modal-head h2 { font-size: 1.25rem; }
.modal-hint { color: var(--muted); font-size: 0.9rem; margin: 8px 0 16px; }
.sharerow { display: flex; gap: 8px; margin-bottom: 18px; }
.sharerow input {
  flex: 1;
  min-width: 0;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  padding: 10px 12px;
}
.sharerow input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.qrbox {
  display: flex;
  justify-content: center;
  padding: 14px;
  background: #fff;
  border-radius: 14px;
  margin-bottom: 14px;
}
.qrbox img { display: block; width: 208px; height: 208px; image-rendering: pixelated; }
#shareNative { width: 100%; }
#zipParts { display: flex; flex-direction: column; gap: 10px; }
#zipParts .btn { width: 100%; }

/* Pagina Gaseste albumul */
.findbox { max-width: 480px; margin: 0 auto; padding: 0 16px; text-align: center; }
.findbox > .btn { width: 100%; }
.findstatus { margin: 14px 0; font-size: 0.92rem; }
.findresults { display: flex; flex-direction: column; gap: 14px; text-align: left; }
.findcard {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px 20px;
}
.findcard h2 { font-size: 1.2rem; }
.findmeta { color: var(--muted); font-size: 0.85rem; margin: 4px 0 12px; }
.findlink { width: 100%; margin-top: 8px; }

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(104px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 80;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 0.9rem;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  max-width: calc(100vw - 40px);
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
