:root {
  --bg: #0b0d12;
  --bg-2: #0f1218;
  --card: #161a22;
  --card-2: #1b2029;
  --line: #262c38;
  --fg: #eef1f6;
  --muted: #9aa3b2;
  --accent: #5b8cff;
  --accent-2: #7a5cff;
  --danger: #ff5d5d;
  --ok: #38d39f;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--fg);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(122, 92, 255, .15), transparent 60%),
    radial-gradient(1000px 500px at -10% 0%, rgba(91, 140, 255, .15), transparent 55%),
    var(--bg);
  background-attachment: fixed;
}

/* Header */
header {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(11, 13, 18, .7);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  gap: 12px;
}
header h1 {
  font-size: 18px;
  margin: 0;
  font-weight: 700;
  letter-spacing: .2px;
  background: linear-gradient(90deg, #fff, #c7d2ff);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

main { max-width: 1120px; margin: 0 auto; padding: 24px; }

/* Dezente Aktionen im Header (Galerie: Hochladen / Schließen) */
.head-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  line-height: 1;
  text-transform: none;
  letter-spacing: 0;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.head-btn:hover { color: var(--fg); border-color: #3a4356; background: rgba(255, 255, 255, .04); filter: none; }
button.head-btn { transform: none; }

/* Cards */
.card {
  background: linear-gradient(180deg, var(--card), var(--card-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.card > strong { font-size: 16px; letter-spacing: .2px; }

/* Inputs */
label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  margin: 14px 0 6px;
  text-transform: uppercase;
  letter-spacing: .4px;
}
input {
  width: 100%;
  padding: 13px 14px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: #0e1116;
  color: var(--fg);
  font-size: 16px;
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder { color: #5c6577; }
input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(91, 140, 255, .22);
}

/* Buttons */
button {
  appearance: none;
  border: none;
  border-radius: 11px;
  padding: 12px 18px;
  background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 82%, #000));
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .08s, filter .15s, background .15s;
}
button:hover { filter: brightness(1.08); }
button:active { transform: translateY(1px) scale(.99); }
button.secondary {
  background: #232936;
  border: 1px solid var(--line);
}
button.secondary:hover { background: #2a3140; }
button.danger { background: linear-gradient(180deg, #ff6b6b, #e84a4a); }
button:disabled { opacity: .5; cursor: default; filter: none; transform: none; }

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* Highlighted result box */
#createResult {
  background: linear-gradient(180deg, rgba(91,140,255,.10), rgba(122,92,255,.06)) !important;
  border: 1px solid rgba(91, 140, 255, .35);
}
#createResult b { color: #cbd7ff; }

/* Session list rows */
.session-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0e1116;
  margin-bottom: 10px;
  transition: border-color .15s, background .15s;
}
.session-row:hover { border-color: #34405a; background: #11151c; }
.session-row .pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: #1a2230;
  border: 1px solid var(--line);
  letter-spacing: 1px;
}

/* Scrollable list (sessions / users) from 4+ entries */
.scrollable {
  max-height: 252px;
  overflow-y: auto;
  padding-right: 6px;
  -webkit-overflow-scrolling: touch;
}

/* Three-dot menu in session rows */
.menu-wrap { position: relative; }
.menu-btn { padding: 12px 14px; font-size: 18px; line-height: 1; }
.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 20;
  min-width: 250px;
  background: linear-gradient(180deg, var(--card), var(--card-2));
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 6px;
  box-shadow: var(--shadow);
}
.menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border-radius: 8px;
  padding: 11px 12px;
  font-size: 14px;
  font-weight: 500;
}
.menu button:hover { background: #232936; filter: none; }
.menu a {
  display: block;
  color: var(--fg);
  text-decoration: none;
  border-radius: 8px;
  padding: 11px 12px;
  font-size: 14px;
  font-weight: 500;
}
.menu a:hover { background: #232936; }
.menu-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.menu a.active { color: var(--accent); }

/* Hamburger-Nav rechts im Header */
.nav-wrap { margin-left: 12px; }
.nav-wrap .head-btn { font-size: 17px; width: 40px; padding: 0; }
.nav-wrap .menu { min-width: 210px; }

/* Dezentes Inline-Bearbeiten (Fotobox-Name / -Besitzer) */
.inline-edit {
  width: auto;
  max-width: 200px;
  padding: 5px 9px;
  font-size: 15px;
  font-weight: 600;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--fg);
}
.inline-edit:hover { border-color: var(--line); background: rgba(255, 255, 255, .03); }
.inline-edit:focus { outline: none; background: #0e1116; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(91, 140, 255, .22); }
select.inline-edit { font-weight: 500; font-size: 12.5px; color: var(--muted); cursor: pointer; padding: 3px 6px; }

/* Fotobox-Zeile: schlanke Meta-Angaben rechts */
.box-row { padding: 12px 14px; }
.box-meta { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.box-meta .head-btn { height: 30px; width: 34px; font-size: 15px; }
.menu button.menu-danger { color: var(--danger); }
.menu button.menu-danger:hover { background: rgba(255, 93, 93, .12); }

/* Photo grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}
.tile {
  position: relative;
  aspect-ratio: 1;
  border-radius: 14px;
  overflow: hidden;
  background: #000;
  border: 1px solid var(--line);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .3);
}
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s; }
.tile:hover img { transform: scale(1.04); }
.tile .badge {
  position: absolute; top: 8px; left: 8px;
  font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 999px;
  background: rgba(0, 0, 0, .65); backdrop-filter: blur(4px);
}
.tile.deleted { outline: 2px solid var(--danger); outline-offset: -2px; }
.tile .actions {
  position: absolute; bottom: 0; left: 0; right: 0;
  display: flex; gap: 6px; padding: 8px;
  background: linear-gradient(transparent, rgba(0, 0, 0, .8));
}
.tile .actions button { padding: 7px 10px; font-size: 12px; }

.muted { color: var(--muted); font-size: 13px; }
.error { color: var(--danger); font-size: 13px; margin-top: 10px; }
.hidden { display: none !important; }
code { background: #0e1116; padding: 2px 6px; border-radius: 6px; border: 1px solid var(--line); }

/* ---- Online gallery (full width) ---- */
#galleryView { padding: 18px 24px 80px; }
.gallery-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.btn-like {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 11px;
  padding: 12px 18px;
  background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 82%, #000));
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: filter .15s, transform .08s;
}
.btn-like:hover { filter: brightness(1.08); }
.btn-like:active { transform: translateY(1px) scale(.99); }
.btn-like.secondary { background: #232936; border: 1px solid var(--line); text-decoration: none; }
.btn-like.secondary:hover { background: #2a3140; filter: none; }

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 2px;
}
.g-tile {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #000;
  cursor: pointer;
}
.g-tile img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s; }
.g-tile:hover img { transform: scale(1.05); }
.g-tile .badge {
  position: absolute; top: 8px; left: 8px; z-index: 1;
  font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 999px;
  background: rgba(0, 0, 0, .65); backdrop-filter: blur(4px);
}
.g-tile.deleted { outline: 2px solid var(--danger); outline-offset: -2px; }

/* ---- Permanent QR (bottom right) ---- */
#qrBox {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 60;
  background: rgba(22, 26, 34, .92);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  display: flex;
  gap: 14px;
}
#qrBox .qr-item { text-align: center; }
#qrBox .qr-cap { font-size: 12px; font-weight: 600; margin-bottom: 8px; }
#qrBox .qr-code { display: inline-block; background: #fff; padding: 6px; border-radius: 8px; line-height: 0; }
#qrBox .qr-code img, #qrBox .qr-code canvas { display: block; }

/* ---- Lightbox ---- */
.lb {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(5, 7, 11, .94);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.lb-img {
  max-width: 92vw;
  max-height: 82vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
}
.lb-close, .lb-nav, .lb-icon {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(26, 29, 36, .8);
  color: #fff;
  cursor: pointer;
  border-radius: 999px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background .15s, transform .08s;
}
.lb-close {
  position: absolute;
  top: 20px;
  right: 24px;
  width: 44px;
  height: 44px;
  font-size: 18px;
}
.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 54px;
  height: 54px;
  font-size: 30px;
  line-height: 1;
}
.lb-prev { left: 20px; }
.lb-next { right: 20px; }
.lb-close:hover, .lb-nav:hover, .lb-icon:hover { background: #2a3140; }
.lb-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: linear-gradient(transparent, rgba(0, 0, 0, .75));
}
.lb-actions { display: flex; align-items: center; gap: 12px; }
.lb-speed {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(26, 29, 36, .8);
  border: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
}
.lb-speed input[type="range"] { width: 84px; height: 18px; accent-color: var(--accent); cursor: pointer; }
/* QR-Box innerhalb der Vollbild-Diashow: über dem Bild verankert */
.lb #qrBox { position: absolute; right: 18px; bottom: 18px; z-index: 10; }

/* Laufende Diashow: pure Bilder, keine Bedienelemente, kein Cursor, bildschirmfüllend */
.lb.slideshow .lb-bar, .lb.slideshow .lb-nav, .lb.slideshow .lb-close { opacity: 0; pointer-events: none; transition: opacity .4s; }
.lb.slideshow { cursor: none; background: #000; backdrop-filter: none; }
.lb.slideshow .lb-img {
  max-width: 100vw;
  max-height: 100vh;
  width: 100vw;
  height: 100vh;
  border-radius: 0;
  box-shadow: none;
  transition: opacity .35s;
}
.lb-speed #lbSpeedVal { min-width: 26px; text-align: right; color: #fff; }
.lb-icon { width: 48px; height: 48px; font-size: 18px; text-decoration: none; }
.lb-icon.danger-icon:hover { background: var(--danger); border-color: var(--danger); }
.lb-new {
  height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(26, 29, 36, .8);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
}
.lb-new:hover { background: #2a3140; color: #fff; filter: none; }
/* Aktiver LIVE-Modus: roter "On Air"-Indikator mit pulsierendem Punkt */
.lb-new.active {
  background: #c62828;
  border-color: #c62828;
  color: #fff;
}
.lb-new.active::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  margin-right: 7px;
  animation: livePulse 1.2s ease-in-out infinite;
}
@keyframes livePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .25; }
}

/* ---- Confirm modal ---- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 110;
  background: rgba(5, 7, 11, .7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-card {
  background: linear-gradient(180deg, var(--card), var(--card-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 360px;
  width: 90vw;
  box-shadow: var(--shadow);
}

/* ---- "Neue Fotos"-Pill (Twitter-Style) ---- */
#newPill {
  position: fixed;
  top: 74px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 70;
  padding: 10px 20px;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .45);
  animation: pillIn .25s ease-out;
}
#newPill:hover { filter: brightness(1.08); }
@keyframes pillIn { from { transform: translate(-50%, -12px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

/* ---- Gallery admin overlay ---- */
.adm { position: fixed; inset: 0; z-index: 120; background: rgba(7,9,13,.85); backdrop-filter: blur(10px); display: flex; align-items: flex-start; justify-content: center; padding: 32px 16px; overflow: auto; }
.adm.hidden { display: none; }
.adm-inner { position: relative; width: min(560px, 96vw); }
.adm-close { position: absolute; top: 14px; right: 14px; }
.adm-tabs { display: flex; gap: 6px; margin: 8px 0 16px; }
.adm-tab { background: #232936; border: 1px solid var(--line); color: var(--muted); padding: 9px 14px; border-radius: 10px; font-size: 14px; }
.adm-tab.active { background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 82%, #000)); color: #fff; border-color: transparent; }
.adm-page label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; margin: 0 0 6px; }
.adm-page > button { display: block; width: 100%; margin-top: 8px; }
.adm-page .row button { margin-top: 0; }
.adm-page input[type="number"] { max-width: 140px; }
.color-swatch { width: 56px; min-width: 56px; height: 44px; padding: 3px; flex: 0 0 auto; }
.adm-qr { display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }
.adm-qr .chk { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--fg); margin: 0; cursor: pointer; }
.adm-qr .chk input { width: 18px; height: 18px; flex: 0 0 auto; accent-color: var(--accent); }
.adm-del-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; margin-top: 10px; }
.adm-del { position: relative; aspect-ratio: 16/9; border-radius: 8px; overflow: hidden; background: #000; outline: 2px solid var(--danger); outline-offset: -2px; }
.adm-del img { width: 100%; height: 100%; object-fit: cover; }
.adm-del button { position: absolute; inset: auto 4px 4px 4px; padding: 5px 0; font-size: 11px; }
.adm-info { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 6px; }
.adm-info td { padding: 7px 8px; border-bottom: 1px solid var(--line); }
.adm-info td:first-child { color: var(--muted); width: 45%; }
.adm-info td:last-child { font-weight: 600; user-select: all; }
