/* ==================================================================
   SWEEZY QUIZ-BOARD - Neon Gaming Theme
   ================================================================== */

:root {
  --bg-0: #05060f;
  --bg-1: #0a0d1c;
  --bg-2: #111528;
  --panel: rgba(17, 21, 40, 0.82);
  --border: rgba(124, 255, 244, 0.16);
  --border-strong: rgba(124, 255, 244, 0.42);

  --neon-cyan: #38f0e0;
  --neon-magenta: #ff3ea5;
  --neon-violet: #8b5cff;
  --neon-lime: #b6ff3d;
  --neon-amber: #ffb43d;

  --text: #e9f1ff;
  --text-dim: #8ea0c4;
  --danger: #ff4d6d;
  --ok: #3dffa2;

  --radius: 14px;
  --radius-sm: 9px;
  --glow-cyan: 0 0 18px rgba(56, 240, 224, 0.45);
  --glow-magenta: 0 0 18px rgba(255, 62, 165, 0.45);

  --font: 'Segoe UI', 'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Bahnschrift', 'Segoe UI Semibold', 'Impact', var(--font);

  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 700px at 12% -10%, rgba(139, 92, 255, 0.22), transparent 60%),
    radial-gradient(1000px 600px at 105% 8%, rgba(255, 62, 165, 0.18), transparent 58%),
    radial-gradient(900px 600px at 50% 115%, rgba(56, 240, 224, 0.14), transparent 60%),
    var(--bg-0);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* dezentes Scanline-Raster */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.015) 0 1px,
    transparent 1px 3px
  );
  z-index: 1;
  mix-blend-mode: overlay;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  letter-spacing: 0.04em;
  margin: 0;
}

a {
  color: var(--neon-cyan);
}

/* ------------------------------------------------------------------ */
/* Layout                                                              */
/* ------------------------------------------------------------------ */

.app {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 22px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(10, 13, 28, 0.95), rgba(10, 13, 28, 0.6));
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 30;
}

.brand {
  font-family: var(--font-display);
  font-size: 20px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #fff;
  text-shadow: var(--glow-cyan);
  white-space: nowrap;
}

.brand span {
  color: var(--neon-magenta);
  text-shadow: var(--glow-magenta);
}

.topbar .spacer {
  flex: 1;
}

.layout {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  padding: 18px 22px 26px;
  align-items: start;
}

.layout.solo {
  grid-template-columns: minmax(0, 1fr);
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  backdrop-filter: blur(8px);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

.panel + .panel {
  margin-top: 16px;
}

.panel-title {
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--neon-cyan);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-title::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--neon-cyan);
  box-shadow: var(--glow-cyan);
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.muted {
  color: var(--text-dim);
  font-size: 13px;
}

/* ------------------------------------------------------------------ */
/* Buttons & Inputs                                                    */
/* ------------------------------------------------------------------ */

button,
.btn {
  font-family: var(--font);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--text);
  background: linear-gradient(180deg, rgba(56, 240, 224, 0.16), rgba(56, 240, 224, 0.06));
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 9px 15px;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.18s ease, background 0.18s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

button:hover:not(:disabled),
.btn:hover {
  box-shadow: var(--glow-cyan);
  transform: translateY(-1px);
}

button:active:not(:disabled) {
  transform: translateY(0);
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

button.primary {
  background: linear-gradient(135deg, var(--neon-magenta), var(--neon-violet));
  border-color: transparent;
  color: #fff;
}

button.primary:hover:not(:disabled) {
  box-shadow: var(--glow-magenta);
}

button.ghost {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.14);
}

button.danger {
  background: rgba(255, 77, 109, 0.15);
  border-color: rgba(255, 77, 109, 0.5);
  color: #ffd2da;
}

button.small {
  padding: 6px 10px;
  font-size: 12px;
}

input,
textarea,
select {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: rgba(5, 6, 15, 0.7);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--neon-cyan);
  box-shadow: 0 0 0 3px rgba(56, 240, 224, 0.12);
}

textarea {
  resize: vertical;
  min-height: 74px;
  line-height: 1.5;
}

label {
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  display: block;
  margin-bottom: 6px;
}

/* ------------------------------------------------------------------ */
/* Quiz-Board                                                          */
/* ------------------------------------------------------------------ */

.board {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

@media (max-width: 860px) {
  .board {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.board-cat {
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-align: center;
  padding: 14px 8px;
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, rgba(139, 92, 255, 0.35), rgba(139, 92, 255, 0.12));
  border: 1px solid rgba(139, 92, 255, 0.45);
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: center;
  word-break: break-word;
  color: #fff;
}

.tile {
  font-family: var(--font-display);
  font-size: clamp(18px, 2.4vw, 30px);
  letter-spacing: 0.04em;
  min-height: 76px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: linear-gradient(180deg, rgba(56, 240, 224, 0.13), rgba(10, 13, 28, 0.85));
  color: var(--neon-cyan);
  text-shadow: 0 0 12px rgba(56, 240, 224, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  position: relative;
  overflow: hidden;
  width: 100%;
  padding: 0;
}

.tile.clickable {
  cursor: pointer;
}

.tile.clickable:hover {
  box-shadow: 0 0 22px rgba(56, 240, 224, 0.4), inset 0 0 26px rgba(56, 240, 224, 0.12);
  transform: translateY(-2px);
}

/* gespielte Frage: ausgegraut & deaktiviert */
.tile.used {
  background: rgba(255, 255, 255, 0.02);
  border-color: rgba(255, 255, 255, 0.07);
  color: rgba(142, 160, 196, 0.32);
  text-shadow: none;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.tile.used::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.03) 0 6px,
    transparent 6px 12px
  );
}

/* aktuell offene Frage */
.tile.active {
  border-color: var(--neon-magenta);
  color: #fff;
  background: linear-gradient(180deg, rgba(255, 62, 165, 0.35), rgba(139, 92, 255, 0.18));
  box-shadow: var(--glow-magenta);
  animation: pulse 1.8s ease-in-out infinite;
}

.tile.empty {
  color: rgba(142, 160, 196, 0.5);
  border-style: dashed;
}

@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 14px rgba(255, 62, 165, 0.35);
  }
  50% {
    box-shadow: 0 0 30px rgba(255, 62, 165, 0.75);
  }
}

/* ------------------------------------------------------------------ */
/* Frage-Bühne                                                         */
/* ------------------------------------------------------------------ */

.stage {
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: linear-gradient(160deg, rgba(139, 92, 255, 0.2), rgba(5, 6, 15, 0.92));
  padding: 26px;
  min-height: 260px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 0 60px rgba(139, 92, 255, 0.2) inset;
}

.stage-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.pill {
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: rgba(56, 240, 224, 0.1);
  color: var(--neon-cyan);
  white-space: nowrap;
}

.pill.value {
  background: linear-gradient(135deg, var(--neon-magenta), var(--neon-violet));
  border-color: transparent;
  color: #fff;
}

.pill.round {
  background: rgba(182, 255, 61, 0.12);
  border-color: rgba(182, 255, 61, 0.42);
  color: var(--neon-lime);
}

.question-text {
  font-family: var(--font-display);
  font-size: clamp(22px, 3vw, 40px);
  line-height: 1.32;
  color: #fff;
  text-shadow: 0 0 26px rgba(56, 240, 224, 0.28);
  flex: 1;
  display: flex;
  align-items: center;
}

.answer-box {
  border-radius: var(--radius-sm);
  border: 1px solid rgba(61, 255, 162, 0.45);
  background: rgba(61, 255, 162, 0.08);
  padding: 14px 16px;
  font-size: 18px;
  color: var(--ok);
}

.answer-box.hidden-answer {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-dim);
  font-style: italic;
}

.stage-media {
  max-height: 260px;
  border-radius: var(--radius-sm);
  align-self: flex-start;
}

/* ------------------------------------------------------------------ */
/* Spieler / Cams                                                      */
/* ------------------------------------------------------------------ */

.players {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.player-card {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(5, 6, 15, 0.55);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.player-card.active {
  border-color: var(--neon-magenta);
  box-shadow: var(--glow-magenta);
  background: linear-gradient(90deg, rgba(255, 62, 165, 0.16), rgba(5, 6, 15, 0.55));
}

.player-card.offline {
  opacity: 0.45;
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-strong);
  background: var(--bg-2);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--neon-cyan);
}

.player-meta {
  flex: 1;
  min-width: 0;
}

.player-name {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-score {
  font-family: var(--font-display);
  font-size: 19px;
  color: var(--neon-lime);
  text-shadow: 0 0 14px rgba(182, 255, 61, 0.4);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  flex-shrink: 0;
}

.dot.on {
  background: var(--ok);
  box-shadow: 0 0 10px var(--ok);
}

/* Webcam-Leiste */
.cams {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.cam {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 2px solid var(--border);
  background: #000;
}

.cam.active {
  border-color: var(--neon-magenta);
  box-shadow: var(--glow-magenta);
}

.cam video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #000;
  transform: scaleX(-1); /* Spiegelbild wie gewohnt */
}

.cam .cam-label {
  position: absolute;
  left: 6px;
  bottom: 6px;
  right: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 3px 7px;
  border-radius: 6px;
  background: rgba(5, 6, 15, 0.78);
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cam .cam-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 12px;
  text-align: center;
  padding: 10px;
}

/* ------------------------------------------------------------------ */
/* Login / Join                                                        */
/* ------------------------------------------------------------------ */

.center-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  z-index: 2;
}

.card {
  width: 100%;
  max-width: 460px;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  padding: 30px;
  backdrop-filter: blur(14px);
  box-shadow: 0 0 70px rgba(139, 92, 255, 0.25);
}

.card h1 {
  font-size: 27px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-align: center;
  margin-bottom: 6px;
  color: #fff;
  text-shadow: var(--glow-cyan);
}

.card .sub {
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  margin-bottom: 24px;
}

.avatar-picker {
  display: flex;
  align-items: center;
  gap: 14px;
}

.avatar-preview {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  border: 2px dashed var(--border-strong);
  object-fit: cover;
  background: rgba(5, 6, 15, 0.7);
  flex-shrink: 0;
}

.error {
  color: var(--danger);
  font-size: 13px;
  min-height: 18px;
  margin-top: 8px;
}

/* ------------------------------------------------------------------ */
/* Editor                                                              */
/* ------------------------------------------------------------------ */

.editor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 14px;
}

.editor-cat {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  background: rgba(5, 6, 15, 0.5);
}

.editor-q {
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
  padding-top: 10px;
  margin-top: 10px;
}

.editor-q .q-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.tab {
  flex: 1;
}

.tab.active {
  background: linear-gradient(135deg, var(--neon-magenta), var(--neon-violet));
  border-color: transparent;
  color: #fff;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 4, 10, 0.86);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
}

.modal {
  width: min(1100px, 100%);
  max-height: 88vh;
  overflow: auto;
  background: var(--bg-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: 0 0 80px rgba(0, 0, 0, 0.7);
}

.modal-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  position: sticky;
  top: -22px;
  background: var(--bg-1);
  padding: 6px 0 12px;
  z-index: 2;
}

/* Toasts */
.toasts {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 340px;
}

.toast {
  padding: 11px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: rgba(10, 13, 28, 0.96);
  font-size: 13px;
  box-shadow: var(--glow-cyan);
  animation: slide-in 0.2s ease;
}

.toast.warn {
  border-color: rgba(255, 180, 61, 0.6);
  box-shadow: 0 0 18px rgba(255, 180, 61, 0.35);
}

.toast.error {
  border-color: rgba(255, 77, 109, 0.65);
  box-shadow: 0 0 18px rgba(255, 77, 109, 0.4);
}

@keyframes slide-in {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.hidden {
  display: none !important;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-dim);
}

.invite-url {
  font-family: 'Consolas', monospace;
  font-size: 12px;
  word-break: break-all;
  background: rgba(5, 6, 15, 0.8);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  color: var(--neon-cyan);
}

.scoreboard-big {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.score-tile {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(5, 6, 15, 0.6);
  padding: 12px;
  text-align: center;
}

.score-tile.active {
  border-color: var(--neon-magenta);
  box-shadow: var(--glow-magenta);
}

.score-tile .avatar {
  margin: 0 auto 8px;
  width: 54px;
  height: 54px;
}
