:root {
  --bg: #14100c;
  --bg2: #1e1812;
  --card: #241d15;
  --card2: #2c2419;
  --line: #3a2f21;
  --amber: #f5a623;
  --amber2: #ffc355;
  --amber-dim: rgba(245, 166, 35, 0.14);
  --text: #f2e9dc;
  --muted: #a89a85;
  --green: #6fca6f;
  --red: #e5695f;
  --radius: 16px;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-size: 16px;
  min-height: 100%;
}

body {
  background: radial-gradient(1200px 500px at 50% -200px, #2a2013 0%, var(--bg) 60%);
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}

#app { max-width: 560px; margin: 0 auto; padding: 16px 16px 8px; }

h1 { font-size: 1.5rem; margin: 8px 0 4px; letter-spacing: 0.3px; }
h2 { font-size: 1.12rem; margin: 22px 0 10px; }
h3 { font-size: 1rem; margin: 0 0 4px; }
p { line-height: 1.5; }
.muted { color: var(--muted); font-size: 0.88rem; }
.small { font-size: 0.8rem; }
a { color: var(--amber2); }

/* ---------- Karten ---------- */
.card {
  background: linear-gradient(180deg, var(--card) 0%, var(--bg2) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.card.accent { border-color: rgba(245, 166, 35, 0.45); }
.card .row { display: flex; align-items: center; gap: 12px; }
.card .grow { flex: 1; min-width: 0; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  background: var(--amber-dim);
  color: var(--amber2);
}
.badge.green { background: rgba(111, 202, 111, 0.15); color: var(--green); }
.badge.grey { background: rgba(168, 154, 133, 0.15); color: var(--muted); }
.badge.red { background: rgba(229, 105, 95, 0.14); color: var(--red); }

/* ---------- Buttons ---------- */
button {
  font: inherit;
  border: none;
  cursor: pointer;
  border-radius: 12px;
  transition: transform 0.08s ease, filter 0.15s ease;
}
button:active { transform: scale(0.97); }
.btn {
  display: block;
  width: 100%;
  padding: 14px;
  font-size: 1rem;
  font-weight: 600;
  background: linear-gradient(180deg, var(--amber2), var(--amber));
  color: #241800;
  margin-top: 10px;
}
.btn:disabled { filter: grayscale(0.7) brightness(0.6); cursor: default; }
.btn.secondary {
  background: var(--card2);
  color: var(--text);
  border: 1px solid var(--line);
}
.btn.danger { background: none; border: 1px solid var(--red); color: var(--red); }
.btn.small { width: auto; display: inline-block; padding: 8px 14px; font-size: 0.85rem; margin-top: 0; }
.btn.ghost { background: none; color: var(--amber2); border: 1px dashed var(--line); }

/* ---------- Formulare ---------- */
input, select {
  font: inherit;
  width: 100%;
  padding: 13px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg2);
  color: var(--text);
  margin-top: 8px;
}
input:focus, select:focus { outline: 2px solid rgba(245, 166, 35, 0.5); border-color: var(--amber); }
label { display: block; margin-top: 12px; font-size: 0.85rem; color: var(--muted); }

/* ---------- Flaschen-Rating ---------- */
.bottles { display: inline-flex; gap: 3px; vertical-align: middle; }
.bottles svg { width: 20px; height: 20px; }
.bottles.big svg { width: 40px; height: 40px; }
.bottles.pick svg { width: 46px; height: 46px; cursor: pointer; transition: transform 0.1s; }
.bottles.pick svg:active { transform: scale(1.2); }
.bottle-off { opacity: 0.22; }

/* ---------- Countdown ---------- */
.countdown { display: flex; gap: 10px; margin: 14px 0 6px; }
.countdown div {
  flex: 1;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 12px;
  text-align: center;
  padding: 10px 4px;
}
.countdown b { display: block; font-size: 1.45rem; color: var(--amber2); font-variant-numeric: tabular-nums; }
.countdown span { font-size: 0.68rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }

/* ---------- Kandidaten / Listen ---------- */
.cand { position: relative; overflow: hidden; }
.cand .bar {
  position: absolute; inset: 0;
  background: linear-gradient(90deg, var(--amber-dim), transparent);
  width: 0; transition: width 0.5s ease;
}
.cand .inner { position: relative; }
.cand.voted { border-color: var(--amber); }
.votecount {
  min-width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--bg2);
  border: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1.1rem;
}
.votecount span { font-size: 0.6rem; color: var(--muted); font-weight: 400; }
.cand.voted .votecount { background: var(--amber); color: #241800; border-color: var(--amber); }
.cand.voted .votecount span { color: #5c4200; }

.listitem { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.listitem:last-child { border-bottom: none; }

/* ---------- Teilnehmer-Chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg2); border: 1px solid var(--line);
  padding: 6px 12px 6px 6px; border-radius: 999px; font-size: 0.85rem;
}
.chip .avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--amber-dim); color: var(--amber2);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700;
}

/* ---------- Fotos ---------- */
.photogrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 10px; }
.photogrid .ph { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.photogrid img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photogrid .del {
  position: absolute; top: 4px; right: 4px;
  background: rgba(0, 0, 0, 0.6); color: #fff;
  width: 26px; height: 26px; border-radius: 50%; font-size: 0.9rem; line-height: 1;
}

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(0, 0, 0, 0.92);
  display: flex; align-items: center; justify-content: center;
}
.lightbox img { max-width: 96vw; max-height: 88vh; border-radius: 8px; }

/* ---------- Bottom-Navigation ---------- */
nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  background: rgba(20, 16, 12, 0.92);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  display: flex;
  padding-bottom: env(safe-area-inset-bottom);
}
nav a {
  flex: 1; text-align: center; padding: 10px 0 8px;
  color: var(--muted); text-decoration: none; font-size: 0.66rem;
}
nav a svg { width: 24px; height: 24px; display: block; margin: 0 auto 3px; }
nav a.active { color: var(--amber2); }

/* ---------- Toast / Modal ---------- */
#toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%);
  background: var(--card2); border: 1px solid var(--amber);
  color: var(--text); padding: 12px 20px; border-radius: 12px;
  box-shadow: var(--shadow); z-index: 70;
  opacity: 0; pointer-events: none; transition: opacity 0.25s;
  max-width: 90vw; text-align: center;
}
#toast.show { opacity: 1; }
#toast.error { border-color: var(--red); }

.modal-bg {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0, 0, 0, 0.6);
  display: flex; align-items: flex-end; justify-content: center;
}
.modal {
  background: var(--card);
  border: 1px solid var(--line); border-bottom: none;
  border-radius: 20px 20px 0 0;
  width: 100%; max-width: 560px;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  max-height: 85vh; overflow-y: auto;
  animation: slideup 0.22s ease;
}
@keyframes slideup { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Login ---------- */
.login-hero { text-align: center; padding: 40px 0 10px; }
.login-hero .logo { font-size: 4rem; }
.tabs { display: flex; gap: 8px; margin: 18px 0 6px; }
.tabs button {
  flex: 1; padding: 10px; background: var(--bg2);
  border: 1px solid var(--line); color: var(--muted); font-weight: 600;
}
.tabs button.active { background: var(--amber-dim); color: var(--amber2); border-color: var(--amber); }

.center { text-align: center; }
.spin {
  width: 26px; height: 26px; margin: 24px auto;
  border: 3px solid var(--line); border-top-color: var(--amber);
  border-radius: 50%; animation: rot 0.8s linear infinite;
}
@keyframes rot { to { transform: rotate(360deg); } }

.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

.divider { border: none; border-top: 1px solid var(--line); margin: 16px 0; }

/* Flaschen-Buttons (a11y) */
.bottle-btn { background: none; border: none; padding: 0; line-height: 0; }

/* Reduzierte Bewegung respektieren */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
