:root {
  color-scheme: light;
  --bg: #f2f3f6;
  --surface: rgba(255, 255, 255, .82);
  --surface-solid: #fff;
  --ink: #17191f;
  --muted: #696d78;
  --line: rgba(29, 34, 47, .11);
  --accent: #1769f5;
  --accent-dark: #1254c8;
  --accent-soft: rgba(23, 105, 245, .1);
  --danger: #d53b3b;
  --shadow: 0 24px 70px rgba(34, 40, 58, .13);
}

* { box-sizing: border-box }
html { min-height: 100%; background: var(--bg) }
body { margin: 0; min-height: 100vh; font-family: Inter, -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif; color: var(--ink); background: linear-gradient(145deg, #f8f8fa 0%, #eff1f5 55%, #f6f6f8 100%); overflow-x: hidden }
button, input { font: inherit }
button { color: inherit }
.hidden { display: none !important }
.ambient { position: fixed; border-radius: 50%; filter: blur(12px); pointer-events: none; opacity: .62 }
.ambient-blue { width: 520px; height: 520px; background: radial-gradient(circle, rgba(29, 105, 255, .22), transparent 68%); top: -240px; left: -180px }
.ambient-cyan { width: 500px; height: 500px; background: radial-gradient(circle, rgba(0, 190, 232, .17), transparent 67%); right: -210px; top: 17vh }
.ambient-orange { width: 590px; height: 590px; background: radial-gradient(circle, rgba(255, 118, 0, .13), transparent 67%); left: 27vw; bottom: -330px }
.surface { background: var(--surface); border: 1px solid rgba(255, 255, 255, .88); box-shadow: var(--shadow); backdrop-filter: blur(28px); -webkit-backdrop-filter: blur(28px) }

.topbar { height: 78px; display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(18px, 4vw, 60px); position: relative; z-index: 10 }
.brand { border: 0; background: transparent; display: flex; align-items: center; gap: 11px; font-weight: 780; font-size: 18px; letter-spacing: -.02em; cursor: pointer; padding: 0 }
.brand-icon { width: 38px; height: 38px; border-radius: 10px; box-shadow: 0 7px 17px rgba(36, 47, 80, .13) }
.account-actions { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px }
.icon-button { width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 50%; background: rgba(255,255,255,.7); cursor: pointer; box-shadow: 0 8px 24px rgba(33, 42, 68, .08) }
main { position: relative; z-index: 1 }

.auth-layout { min-height: 100vh; display: grid; place-items: center; padding: 48px 20px }
.login-shell { width: min(430px, 100%); display: flex; flex-direction: column; align-items: center }
.login-app-icon { width: 104px; height: 104px; border-radius: 25px; margin-bottom: 24px; box-shadow: 0 18px 45px rgba(30, 50, 95, .18) }
.referral-invite { width: 100%; border-radius: 30px; padding: 32px; margin-bottom: 20px; text-align: center }
.referral-invite h1 { font-size: 30px; letter-spacing: -.04em; margin: 0 0 10px }
.referral-invite > p:not(.eyebrow), .referral-invite > small { color: var(--muted); line-height: 1.5 }
.referral-invite > small { display: block; font-size: 11px }
.referral-code { display: block; margin: 18px 0; font-size: 25px; letter-spacing: .16em; color: var(--accent) }
.referral-actions { display: grid; gap: 7px; margin-bottom: 15px }
.referral-open-app { text-decoration: none }
.login-card { width: 100%; border-radius: 30px; padding: 38px; display: flex; flex-direction: column; gap: 21px }
.login-heading { text-align: center; margin-bottom: 2px }
.login-heading h1 { font-size: 35px; letter-spacing: -.045em; margin: 0 0 7px }
.eyebrow { font-size: 10px; font-weight: 820; letter-spacing: .18em; color: var(--accent); margin: 0 0 12px }
.muted { color: var(--muted); margin: 0 }
.login-card label { font-size: 13px; font-weight: 720; display: flex; flex-direction: column; gap: 8px }
.login-card input, .search-box input { border: 1px solid var(--line); background: rgba(250, 251, 253, .88); color: var(--ink); outline: none }
.login-card input { height: 53px; border-radius: 15px; padding: 0 16px }
.login-card input:focus, .search-box:focus-within { border-color: rgba(23,105,245,.55); box-shadow: 0 0 0 4px rgba(23,105,245,.09) }
.primary-button, .secondary-button { border: 0; cursor: pointer; font-weight: 760 }
.primary-button { height: 54px; border-radius: 16px; background: linear-gradient(135deg, var(--accent), #5b4cf4); color: #fff; padding: 0 20px; display: flex; align-items: center; justify-content: space-between; box-shadow: 0 13px 28px rgba(23,105,245,.24) }
.primary-button:disabled { opacity: .55; cursor: wait }
.privacy-copy { font-size: 11px; line-height: 1.5; text-align: center; color: var(--muted); margin: 0 }
.privacy-copy a { color: var(--accent); font-weight: 680; text-underline-offset: 3px }
.error { padding: 12px 14px; border-radius: 12px; background: rgba(198,48,48,.09); color: #ad3030; font-size: 13px; margin: 0 }

.center-layout { min-height: 100vh; display: grid; place-items: center; padding: 40px 24px }
.pairing-card { width: min(900px,100%); border-radius: 32px; padding: clamp(28px,5vw,56px); display: grid; grid-template-columns: 1fr 320px; gap: 58px; align-items: center }
.pairing-icon { width: 70px; height: 70px; border-radius: 18px; margin-bottom: 22px; box-shadow: 0 12px 28px rgba(30,50,95,.14) }
.pairing-card h2 { font-size: 38px; letter-spacing: -.045em; margin: 0 0 9px }
.pairing-copy > p:not(.eyebrow) { line-height: 1.6; color: var(--muted) }
.pairing-copy ol { padding-left: 22px; line-height: 2; color: var(--muted) }
.text-button { border: 0; background: transparent; padding: 8px 0; color: var(--accent); font-weight: 720; cursor: pointer }
.qr-wrap { text-align: center }
.qr-wrap img, .qr-placeholder { display: block; width: 280px; height: 280px; margin: auto; border-radius: 24px; background: #fff; padding: 16px; box-shadow: 0 16px 45px rgba(34,43,70,.12) }
.qr-placeholder { display: grid; place-items: center }
.spinner { width: 36px; height: 36px; border: 3px solid #dbe1ec; border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite }
@keyframes spin { to { transform: rotate(360deg) } }
#pairing-status { font-size: 13px; color: var(--muted); margin: 16px 0 0 }

.dashboard { max-width: 1600px; margin: auto; padding: 22px clamp(16px,3.5vw,54px) 100px; display: grid; grid-template-columns: 260px minmax(0,1fr); gap: 28px; align-items: start }
.sidebar { position: sticky; top: 20px; border-radius: 25px; padding: 13px; display: flex; flex-direction: column; gap: 4px }
.sidebar nav { display: flex; flex-direction: column; gap: 4px }
.nav-item { width: 100%; border: 0; background: transparent; display: flex; align-items: center; gap: 11px; text-align: left; padding: 12px 13px; border-radius: 13px; font-weight: 680; cursor: pointer }
.nav-item > span { width: 22px; color: var(--muted); font-size: 18px; text-align: center }
.nav-item:hover { background: rgba(23,105,245,.06) }
.nav-item.active { background: var(--accent-soft); color: var(--accent) }
.nav-item.active > span { color: var(--accent) }
.nav-item small { margin-left: auto; color: var(--accent); font-size: 9px; letter-spacing: .08em; background: var(--accent-soft); padding: 4px 6px; border-radius: 7px }
.sidebar-divider { height: 1px; background: var(--line); margin: 9px 7px }
.sidebar-label { font-size: 9px; font-weight: 820; letter-spacing: .15em; color: var(--muted); margin: 4px 13px 6px; text-transform: uppercase }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; cursor: pointer }
.setting-row > span { display: flex; flex-direction: column; gap: 3px }
.setting-row strong { font-size: 12px }
.setting-row small { color: var(--muted); font-size: 10px }
.setting-row input { appearance: none; width: 38px; height: 22px; border-radius: 99px; background: #cfd3dc; position: relative; flex: 0 0 auto; transition: .2s }
.setting-row input::after { content: ""; width: 18px; height: 18px; border-radius: 50%; background: #fff; position: absolute; left: 2px; top: 2px; box-shadow: 0 2px 5px rgba(0,0,0,.18); transition: .2s }
.setting-row input:checked { background: var(--accent) }
.setting-row input:checked::after { transform: translateX(16px) }
.content-column { min-width: 0 }
.gallery-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 28px; margin: 18px 0 31px }
.gallery-heading h1 { font-size: clamp(40px,5vw,66px); line-height: 1; letter-spacing: -.058em; margin: 0 0 10px }
.search-box { height: 48px; width: min(310px,100%); border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.72); display: flex; align-items: center; gap: 8px; padding: 0 14px; transition: .2s }
.search-box input { border: 0; background: transparent; min-width: 0; flex: 1 }

.albums-section { margin-bottom: 34px }
.section-heading { display: flex; justify-content: space-between; align-items: end; margin-bottom: 14px }
.section-heading h2 { font-size: 28px; letter-spacing: -.035em; margin: 0 }
.count-pill { color: var(--muted); font-size: 12px; background: rgba(255,255,255,.7); border: 1px solid var(--line); padding: 7px 10px; border-radius: 99px }
.album-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px }
.album-card { border: 1px solid var(--line); background: rgba(255,255,255,.74); border-radius: 19px; padding: 16px; display: flex; align-items: center; gap: 13px; text-align: left; cursor: pointer; min-width: 0 }
.album-card:hover { border-color: rgba(23,105,245,.35); box-shadow: 0 12px 28px rgba(35,47,80,.08) }
.album-card > img { width: 48px; height: 48px; flex: 0 0 auto; border-radius: 14px; object-fit: cover }
.album-card.loaded .album-icon { display: none }
.album-icon { width: 48px; height: 48px; flex: 0 0 auto; border-radius: 14px; display: grid; place-items: center; background: linear-gradient(145deg, rgba(23,105,245,.13), rgba(255,118,0,.11)); color: var(--accent); font-size: 21px }
.album-copy { min-width: 0; display: flex; flex-direction: column; gap: 4px }
.album-copy strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.album-copy small { color: var(--muted) }
.compact-empty { border: 1px dashed var(--line); border-radius: 18px; padding: 22px; color: var(--muted); display: flex; flex-direction: column; gap: 5px }

.gallery-grid { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); grid-auto-flow: dense; gap: 6px }
.gallery-entry {
  position: relative;
  min-width: 0;
  content-visibility: auto;
  contain-intrinsic-size: auto 220px;
}
.gallery-sentinel { grid-column: 1 / -1; height: 1px }
.gallery-grid.dynamic .gallery-entry.featured { grid-column: span 2; grid-row: span 2 }
.photo-card { width: 100%; height: 100%; position: relative; aspect-ratio: 1; overflow: hidden; border: 0; border-radius: 11px; background: #e1e4eb; cursor: pointer; padding: 0; color: #fff }
.gallery-entry.featured .photo-card { aspect-ratio: 1 }
.photo-card img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s, opacity .25s }
.photo-card:hover img { transform: scale(1.035) }
.photo-card .skeleton { position: absolute; inset: 0; background: linear-gradient(110deg,#e0e3ea 20%,#f0f1f5 35%,#e0e3ea 50%); background-size: 220% 100%; animation: shimmer 1.4s infinite }
@keyframes shimmer { to { background-position-x: -220% } }
.photo-card.loaded .skeleton { display: none }
.photo-card.thumbnail-unavailable::after { content: "Vorschau nicht verfügbar"; position: absolute; inset: 0; display: grid; place-items: center; padding: 14px; color: #747986; background: #dfe2e9; font-size: 12px; font-weight: 650; text-align: center }
.photo-card .card-overlay { position: absolute; inset: auto 0 0; padding: 34px 10px 9px; background: linear-gradient(transparent,rgba(0,0,0,.5)); display: flex; align-items: flex-end; opacity: 0; transition: .2s }
.photo-card:hover .card-overlay { opacity: 1 }
.card-overlay small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.video-badge, .stack-badge { position: absolute; top: 8px; padding: 5px 8px; border-radius: 9px; background: rgba(0,0,0,.56); font-size: 11px; font-weight: 760; backdrop-filter: blur(8px) }
.video-badge { right: 8px }
.stack-badge { left: 8px }
.empty-state { text-align: center; padding: 100px 20px; color: var(--muted) }
.empty-state > span { font-size: 46px }

.viewer { width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none; margin: 0; border: 0; padding: 0; overflow: hidden; background: rgba(10,11,15,.95); color: #fff }
.viewer[open] { display: grid; grid-template-rows: minmax(0,1fr) auto }
.viewer::backdrop { background: rgba(10,11,15,.62) }
.viewer-close { position: fixed; right: 22px; top: 18px; width: 46px; height: 46px; border-radius: 50%; border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.1); color: #fff; font-size: 28px; cursor: pointer; z-index: 2 }
.viewer-stage { min-width: 0; min-height: 0; display: grid; place-items: center; overflow: hidden; padding: 30px }
.viewer-stage img, .viewer-stage video { display: block; width: 100%; height: 100%; min-width: 0; min-height: 0; object-fit: contain }
.viewer-loader { display: flex; flex-direction: column; align-items: center; gap: 14px; color: #b8bcc6 }
.viewer-bar { min-height: 92px; border-top: 1px solid rgba(255,255,255,.12); display: flex; align-items: center; padding: 16px clamp(22px,5vw,70px) }
.viewer-bar > div:first-child { display: flex; flex-direction: column; gap: 5px; min-width: 0 }
.viewer-bar strong, .viewer-bar small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.viewer-bar small { color: #aeb2bc }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: #20232d; color: #fff; padding: 13px 18px; border-radius: 14px; box-shadow: var(--shadow); z-index: 30; font-size: 13px }
.toast.error-toast { background: #8b3030 }

@media(max-width: 1120px) {
  .dashboard { grid-template-columns: 220px minmax(0,1fr) }
  .gallery-grid { grid-template-columns: repeat(4,1fr) }
  .album-grid { grid-template-columns: repeat(2,1fr) }
}
@media(max-width: 780px) {
  .topbar { height: 68px; padding-inline: 16px }
  .dashboard { display: block; padding-top: 6px }
  .sidebar { position: static; margin-bottom: 24px }
  .sidebar nav { flex-direction: row }
  .sidebar nav .nav-item { justify-content: center }
  .sidebar-label, .sidebar-divider { display: none }
  .nav-item.protected, .setting-row { margin-top: 4px }
  .gallery-heading { align-items: stretch; flex-direction: column }
  .search-box { width: 100% }
  .gallery-grid { grid-template-columns: repeat(3,1fr); gap: 4px }
  .album-grid { grid-template-columns: 1fr }
  .photo-card { border-radius: 7px }
  .pairing-card { grid-template-columns: 1fr; gap: 30px; text-align: center }
  .pairing-copy ol { text-align: left; display: inline-block }
  .viewer-bar { min-height: 92px }
  .viewer-stage { height: auto }
}
@media(max-width: 480px) {
  .login-card { padding: 30px 24px }
  .login-app-icon { width: 88px; height: 88px }
  .gallery-grid { grid-template-columns: repeat(2,1fr) }
  .sidebar nav { flex-direction: column }
}
