/* Grundlayout */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: var(--bg);
  color: var(--text);
}

:root {
  --bg: #181a1c;
  --panel: #25282c;
  --panel-strong: #2c3035;
  --input-bg: #2f3338;
  --input-border: #99d9e3;
  --accent: #3b82f6;
  --accent-hover: #60a5fa;
  --text: #f3f4f6;
  --text-mid: #aeb4bb;
  --text-muted: #7d8288;
  --table-head: #2c3035;
  --table-row-odd: #25282c;
  --table-row-even: #2f3338;
  --table-hover: #2c3035;
  --shadow: rgba(153, 217, 227, 0.35);
}

.light-mode {
  --bg: #ffffff;
  --panel: #e3e6eb;
  --panel-strong: #dadddf;
  --input-bg: #ffffff;
  --input-border: #99d9e3;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --text: #1f2933;
  --text-mid: #374151;
  --text-muted: #6b7280;
  --table-head: #e0e2e7;
  --table-row-odd: #f0f2f5;
  --table-row-even: #e8eaed;
  --table-hover: #d9dce1;
  --shadow: rgba(0, 0, 0, 0.18);
}

body {
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
}

.app-container {
  width: 100%;
  max-width: 1100px;
}

/* Top-Bar / Header */

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.top-left h1 {
  margin: 0;
  font-size: 2.1rem;
  font-weight: 600;
  padding: 0.4rem 0.9rem;
  border-radius: 12px;
  border: 2px solid var(--input-border);
  background: var(--panel-strong);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: "Arial Black", "Segoe UI", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  position: relative;
  line-height: 1.1;
}
.top-left h1::after {
  content: "";
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  background: url("img/quizzonelogo.png") no-repeat center center;
  background-size: contain;
}
.brand-row {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}
.brand-logo {
  height: 48px;
  width: auto;
  display: block;
}

.top-left p {
  margin: 0.7rem 0 0 0.15rem;
  font-size: 0.95rem;
  color: var(--text-mid);
}

.top-right {
  display: flex;
  flex-direction: row;
  gap: 0.75rem;
  align-items: center;
}

/* Karten */

.card {
  background: var(--panel);
  border-radius: 14px;
  padding: 1.2rem 1.4rem;
  margin-bottom: 1rem;
  box-shadow: 0 12px 30px var(--shadow);
  border: 1px solid var(--input-border);
}

/* Start-Bereich Styling */

#startSection {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

#startSection .field-group {
  margin: 0;
  position: relative;
}

#startSection input[type="text"] {
  height: 2.6rem;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--text);
  padding-left: 0.75rem;
  caret-color: var(--text);
  pointer-events: auto;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#playerName:focus:placeholder-shown {
  animation: name-input-pulse 1.2s ease-in-out infinite;
  border-color: #6366f1;
}

#nameFieldGroup {
  margin-bottom: 0.4rem;
}

#startSection .mode-row {
  padding: 0;
  background: transparent;
  border: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  align-items: flex-start;
}

#startSection .mode-row label {
  padding: 0.5rem 0.65rem;
  border-radius: 10px;
  border: 1px solid var(--input-border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  caret-color: transparent;
  color: var(--text);
}

#startSection .mode-row label:hover {
  border-color: #334155;
  background: rgba(51, 65, 85, 0.08);
  box-shadow: 0 6px 14px rgba(51, 65, 85, 0.25);
}

#startSection .mode-row input[type="radio"] {
  display: none;
}

#startSection .mode-row label.active {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.18), rgba(59, 130, 246, 0.08));
  color: var(--text);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.25);
}
.light-mode #startSection .mode-row label.active {
  background: #e8edff;
  color: #1f2933;
  border-color: var(--accent);
  box-shadow: 0 6px 14px rgba(59, 130, 246, 0.25);
}

#startSection .field-group label {
  margin-bottom: 0.6rem;
}

#modeFieldGroup label {
  margin-bottom: 0;
  display: none;
}

#modeFieldGroup .mode-row {
  margin-top: 0.35rem;
}

#uiModeLabel {
  display: none;
}

@keyframes name-input-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4);
    border-color: #6366f1;
  }
  50% {
    box-shadow: 0 0 0 6px rgba(99, 102, 241, 0);
    border-color: #4f46e5;
  }
  100% {
    box-shadow: 0 0 0 0 rgba(99, 102, 241, 0);
    border-color: #263247;
  }
}

#startSection input[type="text"]:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
  outline: none;
}

#startSection input[type="text"]:hover {
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.15);
}

#startSection input[type="text"]:focus {
  caret-color: transparent;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.35);
  outline: none;
}
.light-mode #startSection input[type="text"] {
  background: #ffffff;
  color: #1f2933;
  caret-color: #1f2933;
  border: 1px solid var(--input-border);
}

#startSection .primary-button#startButton {
  align-self: flex-start;
  padding: 0.65rem 1.6rem;
  box-shadow: 0 12px 20px rgba(79, 70, 229, 0.25);
}

/* Sprachumschalter */

.lang-switch {
  display: inline-flex;
  background: #020617;
  border-radius: 999px;
  padding: 0.15rem;
  border: 1px solid #1f2937;
}

.lang-btn {
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: 0.85rem;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  cursor: pointer;
}

.lang-btn:hover {
  color: #e5e7eb;
}

.lang-btn.active-lang {
  background: #4f46e5;
  color: #f9fafb;
}

#uiLeaderboardTitle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

#uiLeaderboardTitle::after {
  content: "🏆";
  font-size: 1.5rem;
  color: #fbbf24;
  filter: drop-shadow(0 0 6px rgba(251, 191, 36, 0.4));
}

/* Admin-Button oben rechts */

.admin-button {
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--text-mid);
  font-size: 0.85rem;
  padding: 0.3rem 0.9rem;
  border-radius: 999px;
  cursor: pointer;
}

.admin-button:hover {
  border-color: var(--accent-hover);
  color: var(--text);
}

/* Eingabefelder / Formular */

.field-group {
  margin-bottom: 0.8rem;
}

.admin-quiz-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}

.admin-quiz-settings {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.admin-save-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.admin-question-list {
  width: 100%;
  max-width: 100%;
  height: 2.6rem;
  display: block;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

#adminQuestionList,
#adminQuizSelect {
  width: 100%;
  max-width: 100%;
  height: 2.6rem;
}

.field-group label,
.field-group span {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 0.2rem;
}

input[type="text"],
input[type="password"],
textarea,
select {
  width: 100%;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--text);
  font-size: 0.9rem;
}
.light-mode input[type="text"],
.light-mode input[type="password"],
.light-mode textarea,
.light-mode select {
  background: #ffffff;
  color: #1f2933;
  border: 1px solid var(--input-border);
}

input[type="text"]::placeholder,
input[type="password"]::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

textarea {
  resize: vertical;
}

/* Modus-Row */

.mode-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.mode-row label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.9rem;
}

/* Buttons */

.primary-button,
.secondary-button,
.admin-button,
.danger-button {
  border-radius: 999px;
  padding: 0.5rem 1.2rem;
  font-size: 0.95rem;
  cursor: pointer;
  border: none;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.primary-button {
  background: var(--accent);
  color: var(--text);
}

.primary-button:hover,
.primary-button:focus {
  background: var(--accent-hover);
  color: #fff;
}

.secondary-button {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--text);
}
.secondary-button:hover,
.secondary-button:focus {
  color: var(--text);
  border-color: var(--accent-hover);
  text-decoration: none;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.15);
}
.light-mode .secondary-button {
  color: #1f2933;
}
.light-mode .secondary-button:hover,
.light-mode .secondary-button:focus {
  color: #0f172a;
}

a.secondary-button {
  text-decoration: none;
}

.secondary-button:hover {
  border-color: #6366f1;
}

.small {
  font-size: 0.8rem;
  padding: 0.3rem 0.8rem;
}

/* Hinweise */

.hint {
  font-size: 0.8rem;
  color: var(--text-mid);
}

/* Quiz-Auswahl */

#quizSelectSection {
  display: block;
}

.quiz-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.quiz-id-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.quiz-id-row input {
  flex: 1 1 200px;
}
.quiz-id-field {
  margin-top: 0.75rem;
}

.quiz-button {
  border-radius: 999px;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--text);
  padding: 0.3rem 0.9rem;
  font-size: 0.85rem;
  cursor: pointer;
}
.light-mode .quiz-button {
  color: #1f2933;
}

.quiz-button:hover {
  border-color: var(--accent-hover);
}

.quiz-button-active {
  background: var(--accent);
  color: #f9fafb;
  border-color: var(--accent);
}
.light-mode .quiz-button-active {
  color: #ffffff;
}
.active-quiz-name {
  color: #34d399;
  font-weight: 700;
  font-size: 1rem;
}

/* Quiz-Bereich */

.quiz-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.7rem;
}

.question-meta {
  font-size: 0.9rem;
  color: #9ca3af;
  display: flex;
  flex-direction: column;
}

.timer-area {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 160px;
}

.timer-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: #e5e7eb;
}
.light-mode .timer-label {
  color: #1f2933;
}

.light-mode .question-meta {
  color: #1f2933;
}

.timer-bar-wrapper {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: #020617;
  overflow: hidden;
}

.timer-bar {
  height: 100%;
  width: 100%;
  background: #22c55e;
  transition: width 0.25s linear, background-color 0.3s linear;
}

/* Frage + Optionen */

.question-text {
  margin-top: 0.3rem;
  margin-bottom: 0.35rem;
  font-size: 1.05rem;
  color: var(--text);
}

.question-type-hint {
  margin-top: 0;
  margin-bottom: 0.6rem;
  font-size: 0.8rem;
  color: var(--text-mid);
}

.options-container {
  margin-bottom: 0.75rem;
}

/* Optionen untereinander, klickbar */

.option-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.6rem;
  margin-bottom: 0.25rem;
  border-radius: 8px;
  cursor: pointer;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
}

.option-row:hover {
  border-color: var(--accent-hover);
  background: var(--panel-strong);
}



/* Textfeld-Antwort */

.text-answer-input {
  width: 100%;
}

/* Übungsmodus Feedback */

.practice-feedback {
  margin-top: 0.8rem;
}

.practice-feedback-correct,
.practice-feedback-incorrect {
  padding: 0.55rem 0.8rem;
  border-radius: 8px;
  margin-top: 0.4rem;
  font-weight: 500;
  font-size: 0.9rem;
}

.practice-feedback-correct {
  background-color: #e8f8ec;
  border-left: 4px solid #22c55e;
  color: #14532d;
}

.practice-feedback-incorrect {
  background-color: #fde8ea;
  border-left: 4px solid #ef4444;
  color: #7f1d1d;
}

/* Quiz-Footer */

.quiz-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.quiz-footer-right {
  display: flex;
  gap: 0.5rem;
}

/* Ergebnis */

#resultContent p {
  margin: 0.2rem 0;
}

.result-actions {
  display: flex;
  justify-content: flex-start;
  margin-top: 0.8rem;
}

.danger-button {
  border-radius: 999px;
  padding: 0.5rem 1.2rem;
  font-size: 0.95rem;
  cursor: pointer;
  border: none;
  background: linear-gradient(135deg, #b91c1c, #dc2626);
  color: #fef2f2;
}

.danger-button:hover {
  background: linear-gradient(135deg, #991b1b, #b91c1c);
}

/* Review-Bereich */

.review-header h2 {
  margin-top: 0;
}

.review-header p {
  font-size: 0.8rem;
  color: #9ca3af;
}

.legend {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 4px;
  margin-right: 0.2rem;
  vertical-align: middle;
}

.correct-box {
  background-color: #bbf7d0;
}

.incorrect-box {
  background-color: #fecaca;
}

.review-container {
  margin-top: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.review-card {
  background: var(--panel);
  border-radius: 10px;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--input-border);
}

.review-card h3 {
  margin: 0 0 0.3rem 0;
  font-size: 0.95rem;
}

.review-body {
  font-size: 0.88rem;
}

/* Review-Optionen (Auswertung) */

.review-option-row {
  display: block;
  padding: 0.35rem 0.6rem;
  margin-bottom: 0.25rem;
  border-radius: 8px;
}

/* Dezentes Grün / Rot, Text gut lesbar */

.review-option-correct {
  background-color: #e8f8ec;
  border-left: 4px solid #22c55e;
  color: #14532d;
}

.review-option-incorrect {
  background-color: #fde8ea;
  border-left: 4px solid #ef4444;
  color: #7f1d1d;
}

/* Review-Textfragen */

.review-text-user {
  margin-bottom: 0.2rem;
}
.review-text-user-incorrect {
  color: #ef4444;
  font-weight: 600;
}

.review-text-correct {
  font-weight: 500;
}

/* Leaderboard */

.table-wrapper {
  overflow-x: auto;
}

#leaderboard {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  color: var(--text);
}

#leaderboard th,
#leaderboard td {
  padding: 0.4rem 0.5rem;
  text-align: left;
}

#leaderboard thead {
  background: var(--table-head);
}

#leaderboard tbody tr:nth-child(odd) {
  background: var(--table-row-odd);
}

#leaderboard tbody tr:nth-child(even) {
  background: var(--table-row-even);
}

#leaderboard tbody tr:hover {
  background: var(--table-hover);
}

#leaderboard tbody td.leaderboard-empty {
  text-align: center;
  padding: 0.8rem;
  color: var(--text-mid);
}

#leaderboard th {
  color: var(--text);
  font-weight: 600;
  background: var(--table-head);
}

#leaderboard .rank-cell {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  min-width: 64px;
}

#leaderboard .rank-trophy {
  font-size: 1rem;
}

#leaderboard .rank-number {
  font-variant-numeric: tabular-nums;
}

/* Admin-Bereich */

.admin-card {
  margin-top: 1rem;
}

.admin-login-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.admin-status {
  font-size: 0.8rem;
  color: #9ca3af;
}

.admin-status.success {
  color: #16a34a;
}

.admin-status.error {
  color: #ef4444;
}

.admin-status.info {
  color: #eab308;
}

.admin-question-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 0.9rem;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.8fr);
  gap: 1rem;
  margin-top: 1rem;
}

.admin-list {
  border-right: 1px solid #1f2937;
  padding-right: 0.8rem;
}

.admin-question-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0;
  max-height: 260px;
  overflow-y: auto;
  font-size: 0.86rem;
}

.admin-question-item {
  padding: 0.35rem 0.4rem;
  border-radius: 6px;
  cursor: pointer;
}

.admin-question-item:hover {
  background: #020617;
}

.admin-question-item.active {
  background: #4f46e5;
  color: #f9fafb;
}

.admin-editor h3 {
  margin-top: 0;
}

/* Admin Optionen */

.admin-options-grid {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.admin-option-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.3rem;
  align-items: center;
}

.admin-option-label {
  font-size: 0.85rem;
  color: #9ca3af;
}

.admin-correct-label {
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

/* Responsive */

@media (max-width: 800px) {
  body {
    padding: 0.6rem;
  }

  .top-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .admin-layout {
    grid-template-columns: 1fr;
  }

  .admin-list {
    border-right: none;
    border-bottom: 1px solid #1f2937;
    padding-right: 0;
    padding-bottom: 0.8rem;
  }
}
#startSection input[name="playerName"].name-blink {
  animation: name-input-pulse 1.2s ease-in-out infinite;
  border-color: #6366f1;
}


.option-row {
  width: 100%;
}
.option-row input {
  pointer-events: none;
  margin: 0.1rem;
}


.option-row.option-correct {
  border-color: #22c55e;
  background: rgba(34, 197, 94, 0.12);
}
.option-row.option-incorrect {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.12);
}

/* Hinweis unten im Leaderboard dezent anzeigen */
#leaderboardSection .legal-note {
  margin-top: 0.6rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

