:root {
  --night: #0d0a17;
  --night-2: #17112a;
  --card: #1d1533;
  --card-edge: #2e2350;
  --pumpkin: #ff7a1a;
  --pumpkin-deep: #e85d04;
  --ember: #ffb347;
  --slime: #9be564;
  --blood: #d7263d;
  --bone: #f4ecdf;
  --mist: #a99fc2;
  --radius: 18px;
  --display: "Creepster", "Chiller", fantasy;
  --body: "Nunito", system-ui, -apple-system, sans-serif;
  color-scheme: dark;
}

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

html { background: var(--night); }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--body);
  color: var(--bone);
  background:
    radial-gradient(circle at 85% -5%, rgba(255, 230, 170, .35) 0 60px, rgba(255, 200, 120, .12) 61px 140px, transparent 260px),
    radial-gradient(ellipse at 50% 120%, rgba(120, 60, 200, .35), transparent 60%),
    linear-gradient(180deg, #120c22 0%, var(--night) 60%);
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
}

/* Vleermuizen die langzaam over het scherm fladderen */
.bats { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.bat {
  position: absolute;
  width: 34px;
  fill: #000;
  opacity: .75;
  animation: fly linear infinite;
}
.bat:nth-child(1) { top: 12%; animation-duration: 22s; }
.bat:nth-child(2) { top: 30%; width: 22px; animation-duration: 30s; animation-delay: -12s; }
.bat:nth-child(3) { top: 6%; width: 18px; animation-duration: 26s; animation-delay: -5s; }
@keyframes fly {
  0% { transform: translate(-60px, 0) scaleY(1); }
  25% { transform: translate(25vw, 30px) scaleY(.6); }
  50% { transform: translate(50vw, -10px) scaleY(1); }
  75% { transform: translate(75vw, 25px) scaleY(.6); }
  100% { transform: translate(calc(100vw + 60px), 0) scaleY(1); }
}

.wrap { position: relative; z-index: 1; max-width: 1100px; margin: 0 auto; padding: 16px 16px 120px; }

header.top { text-align: center; padding: 28px 0 8px; }
.top h1 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.4rem, 9vw, 4.4rem);
  line-height: 1;
  margin: 0;
  color: var(--pumpkin);
  letter-spacing: 2px;
  text-shadow: 0 0 18px rgba(255, 122, 26, .55), 0 4px 0 #6b1d00;
}
.top p { margin: 10px 0 0; color: var(--mist); }

.status {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 14px; padding: 6px 14px;
  border-radius: 999px;
  background: rgba(155, 229, 100, .12);
  color: var(--slime);
  font-weight: 700; font-size: .9rem;
}
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 10px currentColor; }
.status.closed { background: rgba(215, 38, 61, .15); color: #ff6b7d; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; cursor: pointer;
  font: inherit; font-weight: 800;
  padding: 12px 20px;
  border-radius: 999px;
  color: #2a0d00;
  background: linear-gradient(180deg, var(--ember), var(--pumpkin) 55%, var(--pumpkin-deep));
  box-shadow: 0 4px 0 #8a2e00, 0 10px 24px rgba(255, 122, 26, .25);
  transition: transform .08s, box-shadow .08s;
  text-decoration: none;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #8a2e00; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.ghost { background: transparent; color: var(--bone); box-shadow: inset 0 0 0 2px var(--card-edge); }
.btn.ghost:active { transform: none; }
.btn.danger { background: var(--blood); color: #fff; box-shadow: 0 4px 0 #6d0f1c; }
.btn.small { padding: 8px 14px; font-size: .9rem; }

.add-fab {
  position: fixed; z-index: 5;
  left: 50%; bottom: max(20px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  font-size: 1.1rem; padding: 16px 26px;
  white-space: nowrap;
}
.add-fab:active { transform: translateX(-50%) translateY(3px); }

.notice {
  margin: 18px auto 0; max-width: 560px;
  padding: 12px 16px; border-radius: 14px;
  background: rgba(255, 179, 71, .1);
  border: 1px solid rgba(255, 179, 71, .25);
  color: var(--ember); text-align: center;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  margin-top: 24px;
}
@media (min-width: 700px) { .grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; } }

.card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--card-edge);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: border-color .2s, box-shadow .2s;
}
.card.voted { border-color: var(--pumpkin); box-shadow: 0 0 0 2px var(--pumpkin), 0 0 30px rgba(255, 122, 26, .35); }
.card .photo {
  aspect-ratio: 3 / 4; width: 100%; object-fit: cover; display: block;
  background: #000; cursor: zoom-in;
}
.card .info { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.card .name { font-weight: 800; font-size: 1.02rem; line-height: 1.25; word-break: break-word; }
.card .row { display: flex; flex-direction: column-reverse; align-items: stretch; gap: 6px; margin-top: auto; }
.card .count { color: var(--mist); font-weight: 700; font-size: .85rem; text-align: center; }
.card .count:empty { display: none; }
.card .vote { padding: 10px 12px; white-space: nowrap; }
.card.voted .vote { background: linear-gradient(180deg, #c6ff95, var(--slime)); color: #10300a; box-shadow: 0 4px 0 #3f7a1c; }
.badge {
  position: absolute; top: 10px; left: 10px;
  padding: 4px 10px; border-radius: 999px;
  font-size: .75rem; font-weight: 800;
  background: rgba(13, 10, 23, .8); color: var(--ember);
  backdrop-filter: blur(4px);
}
.menu-btn {
  position: absolute; top: 8px; right: 8px;
  width: 36px; height: 36px; border-radius: 50%;
  border: 0; cursor: pointer; font-size: 1.2rem; line-height: 1;
  background: rgba(13, 10, 23, .8); color: var(--bone);
}

.empty { text-align: center; margin: 60px auto; max-width: 420px; color: var(--mist); }
.empty .ghosty { font-size: 4rem; animation: float 3s ease-in-out infinite; display: inline-block; }
@keyframes float { 50% { transform: translateY(-12px); } }

/* Bottom sheet / dialoog */
dialog {
  border: 1px solid var(--card-edge);
  border-radius: 22px;
  background: var(--night-2);
  color: var(--bone);
  padding: 0;
  width: min(480px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
}
dialog::backdrop { background: rgba(5, 2, 12, .75); backdrop-filter: blur(3px); }
dialog form, dialog .sheet { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
dialog h2 { font-family: var(--display); font-weight: 400; font-size: 2rem; margin: 0; color: var(--pumpkin); letter-spacing: 1px; }
dialog .actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

.photo-pick {
  position: relative;
  display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 6px;
  aspect-ratio: 3 / 4; max-height: 50dvh; width: 100%;
  border: 2px dashed var(--card-edge); border-radius: 16px;
  background: var(--card); color: var(--mist);
  cursor: pointer; overflow: hidden; text-align: center;
}
.photo-pick .big { font-size: 3rem; }
.photo-pick img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo-pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

label.field { display: flex; flex-direction: column; gap: 6px; font-weight: 700; }
input[type=text], input[type=password] {
  font: inherit; font-size: 16px;
  padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--card-edge);
  background: var(--card); color: var(--bone);
}
input[type=text]:focus, input[type=password]:focus { outline: 2px solid var(--pumpkin); outline-offset: 1px; }
.error { color: #ff6b7d; font-weight: 700; margin: 0; }
.hint { color: var(--mist); font-size: .9rem; margin: 0; }

.lightbox { width: auto; max-width: calc(100vw - 24px); background: transparent; border: 0; }
.lightbox img { display: block; max-width: calc(100vw - 24px); max-height: calc(100dvh - 90px); border-radius: 16px; }
.lightbox p { text-align: center; font-weight: 800; margin: 10px 0 0; }

.toast {
  position: fixed; z-index: 20; left: 50%; top: 16px;
  transform: translate(-50%, -150%);
  padding: 12px 18px; border-radius: 999px;
  background: var(--bone); color: var(--night); font-weight: 800;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
  transition: transform .3s;
  max-width: calc(100vw - 32px); text-align: center;
}
.toast.show { transform: translate(-50%, 0); }

footer.foot { text-align: center; color: var(--mist); font-size: .85rem; margin-top: 40px; }
footer.foot a { color: var(--mist); }

/* Wiebel als je stemt */
@keyframes boo { 0%, 100% { transform: scale(1); } 40% { transform: scale(1.05) rotate(-1deg); } 70% { transform: scale(.98) rotate(1deg); } }
.card.pop { animation: boo .45s ease; }

@media (prefers-reduced-motion: reduce) {
  .bat, .empty .ghosty, .card.pop { animation: none; }
  .bat { display: none; }
}
