/* ===========================================================================
   Student Wizzard – modernes Design
   Dunkles, premium-anmutendes Theme mit Verlauf-Akzenten, Glas-Effekt,
   weichen Animationen. Für Projektor (Präsentation) und Handy (Abstimmen).
   =========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

:root {
  /* Flächen */
  --bg-0: #0b0c1a;
  --bg-1: #12132a;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-2: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.18);

  /* Text */
  --text: #f4f5fb;
  --muted: #a3a8c9;

  /* Akzente */
  --accent: #7c6cff;
  --accent-2: #4ad3c8;
  --grad: linear-gradient(135deg, #7c6cff 0%, #a855f7 50%, #4ad3c8 100%);
  --grad-soft: linear-gradient(135deg, rgba(124,108,255,.22), rgba(74,211,200,.18));
  --ok: #34d399;
  --danger: #fb7185;

  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 18px 50px -20px rgba(0, 0, 0, 0.7);
  --ring: 0 0 0 3px rgba(124, 108, 255, 0.35);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
  line-height: 1.55;
  background:
    radial-gradient(1100px 700px at 12% -10%, rgba(124, 108, 255, 0.22), transparent 60%),
    radial-gradient(900px 600px at 100% 0%, rgba(74, 211, 200, 0.16), transparent 55%),
    radial-gradient(800px 800px at 50% 120%, rgba(168, 85, 247, 0.14), transparent 60%),
    linear-gradient(180deg, var(--bg-1), var(--bg-0));
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 940px; margin: 0 auto; padding: 40px 22px 64px; }
.wrap-narrow { max-width: 540px; margin: 0 auto; padding: 28px 20px 56px; }

h1 { font-size: 2rem; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 6px; }
h2 { font-size: 1.2rem; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 14px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.center { text-align: center; }

.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 800; letter-spacing: -0.02em;
}
.brand .dot {
  width: 30px; height: 30px; border-radius: 9px; background: var(--grad);
  box-shadow: 0 6px 18px -4px rgba(124, 108, 255, 0.7);
  display: inline-block;
}
.gradient-text {
  background: var(--grad); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.brand-logo {
  height: 38px; width: auto; border-radius: 9px;
  background: #fff; padding: 4px; box-shadow: 0 6px 18px -6px rgba(0,0,0,.6);
}

/* Footer / Copyright */
.site-footer {
  margin-top: 32px; padding-top: 18px; border-top: 1px solid var(--border);
  text-align: center; color: var(--muted); font-size: .85rem;
}

/* Logo + Copyright in der Präsentations-Ansicht */
.present-logo {
  position: fixed; top: 22px; right: 26px; height: 56px; width: auto;
  border-radius: 11px; background: #fff; padding: 6px;
  box-shadow: 0 10px 26px -10px rgba(0,0,0,.7); z-index: 5;
}
.present-footer {
  position: fixed; bottom: 16px; right: 24px;
  color: var(--muted); font-size: .8rem; opacity: .8; z-index: 5;
}

/* --- Karten ------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

/* --- Formularelemente --------------------------------------------------- */
label { display: block; font-weight: 600; font-size: 0.9rem; margin: 14px 0 7px; color: var(--text); }
input[type=text], textarea {
  width: 100%;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 13px 15px;
  font-size: 1rem;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
input[type=text]:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: var(--ring);
}
textarea { min-height: 120px; resize: vertical; line-height: 1.7; }
::placeholder { color: rgba(163, 168, 201, 0.55); }

/* --- Buttons ------------------------------------------------------------ */
button, .btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--grad);
  color: #fff; border: none;
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  font-size: 0.95rem; font-weight: 700; font-family: inherit;
  cursor: pointer; text-decoration: none;
  transition: transform .08s ease, filter .15s, box-shadow .15s;
  box-shadow: 0 10px 26px -12px rgba(124, 108, 255, 0.8);
}
button:hover, .btn:hover { filter: brightness(1.07); transform: translateY(-1px); text-decoration: none; }
button:active, .btn:active { transform: translateY(0); }
.btn-ghost {
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border-strong); box-shadow: none;
}
.btn-ghost:hover { background: rgba(255,255,255,0.12); }
.btn-danger { background: linear-gradient(135deg, #f43f5e, #fb7185); box-shadow: none; }
.btn-ok { background: linear-gradient(135deg, #10b981, #34d399); box-shadow: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.btn-row form { margin: 0; }

/* --- Badges ------------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.72rem; font-weight: 800; letter-spacing: .03em; text-transform: uppercase;
  padding: 4px 11px; border-radius: 999px; vertical-align: middle;
}
.badge-active { background: rgba(52, 211, 153, 0.16); color: #6ee7b7; border: 1px solid rgba(52,211,153,.35); }
.badge-active::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #34d399;
  box-shadow: 0 0 0 0 rgba(52,211,153,.7); animation: pulse 1.8s infinite; }
.badge-closed { background: rgba(255,255,255,0.08); color: var(--muted); border: 1px solid var(--border); }

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(52,211,153,.6); }
  70% { box-shadow: 0 0 0 7px rgba(52,211,153,0); }
  100% { box-shadow: 0 0 0 0 rgba(52,211,153,0); }
}

.qline { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* --- Abstimmen (Teilnehmer) -------------------------------------------- */
.q-title { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.3;
  margin: 0 0 22px; white-space: pre-line; }

/* Frage-Eingabe (mehrzeilig) */
textarea.q-input { min-height: 90px; font-weight: 500; }

/* Bild zur Frage – in weißem "Passepartout"-Rahmen, damit Figuren mit weißem
   Rand (z. B. aus Papers) nahtlos und gewollt auf dem dunklen Design sitzen. */
.q-image {
  display: block; max-width: 100%; max-height: 44vh; width: auto; margin: 0 auto 20px;
  background: #fff; padding: 12px; border-radius: 14px;
  box-shadow: 0 12px 30px -12px rgba(0, 0, 0, 0.6);
}
.present .q-image { max-height: 40vh; margin: 0 auto 3vh; padding: 16px; }

/* Paste-Feld für Copy & Paste von Bildern */
.paste-zone {
  border: 2px dashed var(--border-strong); border-radius: 12px;
  background: rgba(0, 0, 0, 0.2); padding: 16px; text-align: center;
  cursor: pointer; transition: border-color .15s, background .15s;
  outline: none; margin-bottom: 8px;
}
.paste-zone:hover { border-color: var(--accent); }
.paste-zone.active { border-color: var(--accent); background: rgba(124, 108, 255, 0.12); }
.paste-zone .paste-hint { color: var(--muted); font-size: 0.9rem; }
.paste-zone.active .paste-hint::after { content: " — bereit, jetzt einfügen"; color: var(--accent-2); }
.paste-preview {
  display: block; max-height: 160px; width: auto; margin: 12px auto 0;
  background: #fff; padding: 8px; border-radius: 8px;
}
.paste-zone.has-image .paste-hint { color: var(--accent-2); }
.file-input { margin-top: 4px; }

/* Bild-Vorschau / Checkbox im Admin */
.admin-thumb {
  display: block; max-height: 130px; width: auto; margin: 12px 0 4px;
  border-radius: 10px; border: 1px solid var(--border);
}
input[type=file] {
  width: 100%; color: var(--muted); font-size: .9rem;
  background: rgba(0,0,0,.25); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 9px 12px;
}
input[type=file]::file-selector-button {
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: 8px;
  padding: 6px 12px; margin-right: 12px; cursor: pointer; font-weight: 600;
}
.checkbox-line { display: flex; align-items: center; gap: 8px; font-weight: 500; margin-top: 10px; }
.checkbox-line input { width: auto; }

.option-btn {
  display: flex; align-items: center; width: 100%; text-align: left;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  color: var(--text);
  border-radius: 16px; padding: 16px 18px;
  font-size: 1.08rem; font-weight: 500;
  margin-bottom: 13px; cursor: pointer;
  transition: transform .07s, border-color .15s, background .15s, box-shadow .15s;
}
.option-btn:hover { border-color: var(--accent); background: rgba(124,108,255,.12); transform: translateY(-2px); }
.option-btn:active { transform: scale(.99); }
.option-btn:disabled { opacity: .55; cursor: default; transform: none; }
.option-btn.chosen {
  border-color: var(--ok);
  background: linear-gradient(135deg, rgba(16,185,129,.20), rgba(52,211,153,.10));
  box-shadow: 0 0 0 3px rgba(52,211,153,.18);
}
.option-letter {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 11px;
  background: var(--grad); color: #fff; font-weight: 800; font-size: 1.05rem;
  margin-right: 14px; box-shadow: 0 6px 16px -6px rgba(124,108,255,.8);
}
.option-btn.chosen .option-letter { background: linear-gradient(135deg, #10b981, #34d399); }
.option-btn .check { margin-left: auto; opacity: 0; transition: opacity .2s; font-size: 1.3rem; color: var(--ok); }
.option-btn.chosen .check { opacity: 1; }

.status-line { text-align: center; margin-top: 16px; font-weight: 600; min-height: 1.4em; }
.status-ok { color: var(--ok); }

.waiting { text-align: center; padding: 30px 10px; }
.waiting .spinner {
  width: 44px; height: 44px; margin: 0 auto 20px;
  border: 3px solid var(--border-strong); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Ergebnis-Balken ---------------------------------------------------- */
.bar-row { margin-bottom: 18px; }
.bar-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; gap: 12px; }
.bar-label { font-weight: 600; display: flex; align-items: center; gap: 10px; min-width: 0; }
.bar-chip {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; color: #06121f; font-size: .95rem;
}
.bar-pct { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar-track {
  background: rgba(255,255,255,0.06); border: 1px solid var(--border);
  border-radius: 12px; height: 40px; overflow: hidden;
}
.bar-fill {
  height: 100%; border-radius: 11px; min-width: 3px;
  transition: width .6s cubic-bezier(.22,.61,.36,1);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25);
}
.bar-row.leader .bar-track { box-shadow: 0 0 0 2px rgba(255,255,255,.18); }

/* --- Präsentations-Ansicht (Vollbild) ---------------------------------- */
.present { padding: 5vh 6vw; min-height: 100vh; }
.present .q-title { font-size: clamp(2rem, 4.5vw, 3.6rem); margin-bottom: 5vh; line-height: 1.15; }
.present .bar-row { margin-bottom: clamp(16px, 2.4vh, 30px); }
.present .bar-track { height: clamp(50px, 8vh, 92px); border-radius: 16px; }
.present .bar-fill { border-radius: 15px; }
.present .bar-top { font-size: clamp(1.1rem, 2.3vw, 2rem); margin-bottom: 12px; }
.present .bar-chip { width: clamp(34px, 4vw, 52px); height: clamp(34px, 4vw, 52px); border-radius: 12px; }
.present .total {
  font-size: clamp(1rem, 2vw, 1.5rem); color: var(--muted); margin-top: 3vh; font-weight: 600;
}
.present .waiting { font-size: clamp(1.1rem, 2.5vw, 2rem); }

/* --- QR-Code & Links ---------------------------------------------------- */
.qr {
  background: #fff; padding: 16px; border-radius: 18px; display: inline-block;
  box-shadow: 0 20px 50px -20px rgba(0,0,0,.7);
}
.qr img { display: block; width: 230px; height: 230px; }
.url-pill {
  display: inline-block; margin-top: 14px;
  background: rgba(0,0,0,.3); border: 1px solid var(--border-strong);
  border-radius: 999px; padding: 9px 18px;
  font-weight: 700; font-size: 1.05rem; word-break: break-all;
}

/* --- Liste der Optionen im Admin --------------------------------------- */
.opt-list { list-style: none; padding: 0; margin: 12px 0; display: flex; flex-wrap: wrap; gap: 8px; }
.opt-list li {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 5px 14px; font-size: .9rem;
}

@media (max-width: 560px) {
  h1 { font-size: 1.6rem; }
  .wrap { padding: 24px 16px 48px; }
}
