/* === Reset & Variablen === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Das HTML-Attribut `hidden` muss gegen jedes `display`-CSS gewinnen,
   sonst zeigen Track/Vote/Join sich gegenseitig immer alle an. */
[hidden] { display: none !important; }

:root {
  --bg: #0e0e0e;
  --bg-card: #1a1a1a;
  --fg: #f5f5f5;
  --fg-muted: #999;
  --accent: #1db954;
  --accent-hover: #1ed760;
  --accent-soft: rgba(29, 185, 84, 0.15);
  --error: #e74c3c;
  --radius: 16px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f5f5;
    --bg-card: #ffffff;
    --fg: #1a1a1a;
    --fg-muted: #666;
    --accent-soft: rgba(29, 185, 84, 0.12);
  }
}

/* === Body / Layout === */
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  background: var(--bg);
  color: var(--fg);
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    calc(env(safe-area-inset-top, 0px) + 16px)
    16px
    calc(env(safe-area-inset-bottom, 0px) + 16px);
  -webkit-tap-highlight-color: transparent;
}

main {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* === Header === */
header {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.brand {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--fg);
  line-height: 1;
}

.brand-accent { color: var(--accent); }

.brand-tag {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.32em;
  color: var(--fg-muted);
  margin-top: 6px;
}

.party-id {
  font-size: 12px;
  color: var(--fg-muted);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: 0.1em;
  margin-top: 2px;
  text-transform: uppercase;
}

/* === Track-Karte === */
.track {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 28px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.track .state {
  font-size: 11px;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: 4px;
}

.track .cover {
  width: 140px;
  height: 140px;
  object-fit: cover;
  border-radius: 12px;
  margin: 4px 0 12px 0;
  box-shadow: 0 10px 24px rgba(0,0,0,0.35);
  background: rgba(255,255,255,0.04);
}

.track .title {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.25;
}

.track .artists {
  font-size: 15px;
  color: var(--fg-muted);
}

.track .remaining {
  font-size: 13px;
  color: var(--fg-muted);
  margin-top: 8px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

/* === Vote-Bereich === */
.vote {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

#skip-button {
  width: 100%;
  height: 64px;
  font-size: 20px;
  font-weight: 700;
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  transition: background 100ms ease, transform 100ms ease;
}

#skip-button:hover:not(:disabled) { background: var(--accent-hover); }
#skip-button:active:not(:disabled) { transform: scale(0.98); }

#skip-button:disabled {
  background: var(--bg-card);
  color: var(--fg-muted);
  cursor: not-allowed;
}

.counter {
  font-size: 14px;
  color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
}

/* === Beitritts-Formular === */
.join {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 32px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.join-prompt {
  color: var(--fg-muted);
  font-size: 14px;
}

#join-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#join-input {
  width: 100%;
  height: 56px;
  font-size: 22px;
  font-weight: 600;
  text-align: center;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid rgba(127, 127, 127, 0.25);
  border-radius: var(--radius);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  -webkit-appearance: none;
  appearance: none;
}

#join-input::placeholder {
  color: var(--fg-muted);
  letter-spacing: 0.1em;
  font-weight: 400;
}

#join-input:focus {
  outline: none;
  border-color: var(--accent);
}

#join-form button {
  height: 56px;
  font-size: 18px;
  font-weight: 700;
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  transition: background 100ms ease, transform 100ms ease;
}

#join-form button:hover { background: var(--accent-hover); }
#join-form button:active { transform: scale(0.98); }

/* === Status === */
footer {
  text-align: center;
  font-size: 12px;
  color: var(--fg-muted);
  min-height: 1em;
}

footer.error { color: var(--error); }
