:root {
  --bg: #121212;
  --card: #1e1e1e;
  --text: #eee;
  --muted: #999;
  --accent: #4f8cff;
  --danger: #e5484d;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body { margin: 0; background: var(--bg); color: var(--text); }
h1 { margin: 0; font-size: 1.3rem; }
.muted { color: var(--muted); }
.error { color: var(--danger); min-height: 1.2em; margin: 0; }
.center { text-align: center; }

input, button {
  font: inherit;
  padding: .7rem .9rem;
  border-radius: 8px;
  border: 1px solid #333;
  background: #2a2a2a;
  color: var(--text);
}
button { background: var(--accent); border-color: var(--accent); cursor: pointer; font-weight: 600; }
button:disabled { opacity: .5; cursor: default; }
button.ghost { background: transparent; border-color: #444; font-weight: 400; }

.card { background: var(--card); border-radius: 12px; padding: 1.2rem; }

.screen { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
#login-form { display: flex; flex-direction: column; gap: .8rem; width: 100%; max-width: 360px; }

header { display: flex; align-items: center; gap: .6rem; padding: .8rem 16px; flex-wrap: wrap; }
.spacer { flex: 1; }

.upload { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin: 0 16px 1rem; }
.upload #name { flex: 1 1 180px; }
.upload #upload-status { flex-basis: 100%; margin: 0; }
.file { position: relative; flex: 2 1 200px; }
.file input { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }
.file span {
  display: block; padding: .7rem .9rem; border: 1px dashed #555; border-radius: 8px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

#grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
  padding: 0 16px 16px;
}
body.presenter #grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

.tile { position: relative; aspect-ratio: 1; background: #222; border-radius: 8px; overflow: hidden; cursor: zoom-in; animation: fadein .4s; }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .name {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 1.2rem .5rem .35rem;
  font-size: .85rem; background: linear-gradient(transparent, rgba(0,0,0,.75));
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tile .del {
  position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; padding: 0;
  border-radius: 50%; border: none; background: rgba(0,0,0,.55); color: #fff;
  font-size: 18px; line-height: 28px; font-weight: 400;
}
.tile .del:hover { background: var(--danger); }
@keyframes fadein { from { opacity: 0; transform: scale(.96); } }

#lightbox { position: fixed; inset: 0; background: #000; z-index: 10; display: flex; align-items: center; justify-content: center; }
#lb-img { max-width: 100%; max-height: 100%; object-fit: contain; }
#lb-caption { position: absolute; bottom: 12px; left: 0; right: 0; text-align: center; text-shadow: 0 1px 3px #000; }
#lightbox button { position: absolute; background: rgba(255,255,255,.1); border: none; color: #fff; font-size: 2rem; line-height: 1; font-weight: 300; }
#lb-close { top: 12px; right: 12px; width: 48px; height: 48px; padding: 0; border-radius: 50%; }
.lb-nav { top: 50%; transform: translateY(-50%); width: 56px; height: 80px; padding: 0; }
#lb-prev { left: 12px; }
#lb-next { right: 12px; }
