:root {
  color-scheme: dark;
  --accent: #e50914;
  --accent-hover: #f6121d;
  --bg: #141414;
  --bg-elevated: #1f1f1f;
  --text: #ffffff;
  --text-muted: #a3a3a3;
  --border: #333333;
}

* {
  box-sizing: border-box;
}

/* Muss vor allen anderen Regeln stehen: verhindert, dass spätere
   `display: ...`-Deklarationen (z.B. auf .result-overlay, #step-play)
   das [hidden]-Attribut aushebeln. */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}

#site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 2rem;
  background: linear-gradient(to bottom, rgba(20, 20, 20, 0.95), rgba(20, 20, 20, 0.75));
  backdrop-filter: blur(4px);
  border-bottom: 1px solid var(--border);
}

#site-header h1 {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--accent);
  text-transform: uppercase;
}

#site-header p:not(.profile-badge) {
  display: none;
}

.profile-badge {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.9rem 0.35rem 0.35rem;
}

#profile-badge:hover {
  background: #2a2a2a;
  border-color: var(--text-muted);
}

.profile-badge::before {
  content: attr(data-initials);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: var(--avatar-color, var(--accent));
  color: white;
  font-size: 0.75rem;
  font-weight: 800;
}

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 2.5rem 2rem 4rem;
}

.wizard-step {
  background: transparent;
  border: none;
  padding: 0;
}

.wizard-progress {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.netflix-title {
  margin: 0 0 1.5rem;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.netflix-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.netflix-title-row .netflix-title {
  margin-bottom: 0;
}

form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-weight: 600;
  color: var(--text-muted);
}

input[type="text"] {
  padding: 0.65rem 0.85rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: #333333;
  color: var(--text);
  font-size: 1rem;
}

input[type="text"]:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

button {
  padding: 0.65rem 1.25rem;
  border-radius: 4px;
  border: none;
  background: var(--accent);
  color: white;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease;
}

button:hover {
  background: var(--accent-hover);
}

.wizard-back,
.btn-secondary {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.wizard-back:hover,
.btn-secondary:hover {
  background: var(--bg-elevated);
  color: var(--text);
}

.wizard-back {
  margin-top: 1.5rem;
}

.wizard-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.25rem 0;
}

#profile-status,
#taskset-status {
  color: var(--text-muted);
  min-height: 1.2em;
}

/* --- Profil-Auswahl ("Wer spielt?"), angelehnt an Netflix' Profilwahl --- */
.profile-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.profile-tile {
  all: unset;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  width: 120px;
}

.profile-tile-avatar {
  position: relative;
  width: 110px;
  height: 110px;
  border-radius: 12px;
  background: var(--avatar-color, var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  font-weight: 800;
  color: white;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  border: 2px solid transparent;
}

/* "Profile verwalten"-Modus: Stift-Badge zeigt an, dass ein Klick jetzt
   bearbeitet statt auswählt. */
.profile-grid.is-editing .profile-tile:not(.profile-tile-add) .profile-tile-avatar {
  border-color: var(--text-muted);
  opacity: 0.85;
}

.profile-grid.is-editing .profile-tile:not(.profile-tile-add) .profile-tile-avatar::after {
  content: "✎";
  position: absolute;
  bottom: 6px;
  right: 6px;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

.profile-tile:hover .profile-tile-avatar,
.profile-tile:focus-visible .profile-tile-avatar {
  transform: scale(1.06);
  border-color: var(--text);
}

.profile-tile-name {
  font-weight: 600;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.profile-tile-points {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: -0.4rem;
}

.profile-tile-add .profile-tile-avatar {
  background: transparent;
  border: 2px dashed var(--border);
  color: var(--text-muted);
}

.profile-tile-add:hover .profile-tile-avatar,
.profile-tile-add:focus-visible .profile-tile-avatar {
  border-color: var(--accent);
  color: var(--accent);
}

.profile-form {
  max-width: 320px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  margin-top: 0.5rem;
}

.profile-form-actions {
  display: flex;
  gap: 0.5rem;
}

.profile-form-actions button {
  flex: 1;
}

/* --- Aufgabenset-/Spielauswahl als Karten-Reihe --- */
.card-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.card-row button {
  all: unset;
  cursor: pointer;
  position: relative;
  width: 190px;
  height: 110px;
  border-radius: 6px;
  background: var(--card-gradient, linear-gradient(135deg, #333, #1a1a1a));
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.card-row button:hover,
.card-row button:focus-visible {
  transform: scale(1.06);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  z-index: 1;
}

.card-row button::before {
  content: attr(data-icon);
  position: absolute;
  top: 0.5rem;
  right: 0.6rem;
  font-size: 1.6rem;
  opacity: 0.85;
}

.card-row button .card-label {
  display: block;
  width: 100%;
  padding: 0.6rem 0.7rem;
  font-weight: 700;
  font-size: 0.92rem;
  color: white;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0));
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

.card-row button .card-progress {
  position: absolute;
  top: 0.5rem;
  left: 0.6rem;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  letter-spacing: 0.02em;
}

/* Schritt 4: Spiel füllt den gesamten Browser aus, kein Karten-Look mehr. */
body.is-fullscreen-step #site-header {
  display: none;
}

body.is-fullscreen-step main {
  max-width: none;
  padding: 0;
}

#step-play.wizard-step-fullscreen {
  position: relative;
  min-height: 100vh;
  border: none;
  border-radius: 0;
  padding: 1rem;
  padding-top: 0.75rem;
  background: #020617;
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0.75rem;
}

#game-container {
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.result-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
}

.result-card {
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
  max-width: 90vw;
}

.result-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 1rem;
}
