:root {
  --bg: #11141a;
  --panel: #1a1f29;
  --panel-2: #222836;
  --text: #e6e9ef;
  --muted: #8b93a5;
  --accent: #4f8cff;
  --accent-2: #3a6fd8;
  --error: #ff6b6b;
  --correct: #4ade80;
  --wrong: #ff6b6b;
  --border: #2c3344;
  --discord: #5865F2;
  --google: #ffffff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  position: relative;
}

.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.1rem; letter-spacing: 0.02em; }
.brand-logo { width: 26px; height: 26px; border-radius: 6px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-weight: 700; font-size: 1.05rem; letter-spacing: 0.03em; }
.brand-sub { color: var(--muted); font-weight: 500; font-size: 0.68rem; letter-spacing: 0.03em; }

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 1.25rem;
  line-height: 1;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
}

nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
nav .divider {
  width: 1px;
  height: 22px;
  background: var(--border);
  margin: 0 6px;
}
nav .nav-link.logout { color: var(--muted); }
nav .nav-link.logout:hover { color: var(--error); border-color: var(--error); }

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}

h1 { font-size: 1.5rem; margin: 0 0 8px; }
.section-title { font-size: 1.15rem; margin: 28px 0 6px; }

.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 0.92rem; }
.error { color: var(--error); margin-top: 10px; }

form { margin-top: 14px; }

input[type="text"],
textarea {
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
}
textarea { resize: vertical; }

input:focus, textarea:focus { outline: none; border-color: var(--accent); }

button {
  padding: 9px 16px;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
  cursor: pointer;
  font-family: inherit;
}
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent-2); border-color: var(--accent-2); }
button:disabled { opacity: 0.6; cursor: not-allowed; }

/* Login */
.login-buttons { display: flex; flex-direction: column; gap: 12px; margin-top: 20px; max-width: 320px; }
.btn-provider {
  display: block;
  text-align: center;
  padding: 12px 16px;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
  font-size: 1rem;
}
.btn-discord { background: var(--discord); color: #fff; }
.btn-discord:hover { filter: brightness(1.1); }
.btn-google { background: var(--google); color: #1f1f1f; border: 1px solid #d0d0d0; }
.btn-google:hover { background: #f2f2f2; }

/* Cards */
.card-list { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-title { font-weight: 600; }

.question {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  margin: 14px 0;
}
.q-prompt { font-weight: 600; margin-bottom: 8px; }

/* Single-question focus */
#quiz-question .question { margin: 8px 0 0; padding: 20px; }
#quiz-question .q-prompt { font-size: 1.2rem; margin-bottom: 16px; }

/* Progress + navigation */
.quiz-progress { display: flex; align-items: center; gap: 12px; margin: 18px 0 2px; }
.progress-track { flex: 1; height: 8px; background: var(--panel-2); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width 0.25s ease; }
.quiz-nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 20px; }

.options { display: flex; flex-direction: column; gap: 6px; }
.opt { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.opt input { accent-color: var(--accent); }

.opt-line { display: block; padding: 2px 0; }
.opt-line.correct { color: var(--correct); }
.opt-line.wrong { color: var(--wrong); }

.answer-text, .reference { margin: 8px 0; }
.reference strong { color: var(--accent); }
.answer-text span { white-space: pre-wrap; }
.explanation {
  margin-top: 8px;
  padding: 8px 10px;
  border-left: 3px solid var(--accent);
  background: var(--panel-2);
  border-radius: 0 6px 6px 0;
  font-size: 0.92rem;
}

.score { font-size: 1.25rem; font-weight: 700; margin: 8px 0; }

/* Invites */
.invite-controls { margin: 16px 0; }
.invite-new-box {
  margin: 12px 0;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--correct);
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.invite-new-box code { word-break: break-all; }

/* Mobile nav */
@media (max-width: 767px) {
  .nav-toggle { display: inline-block; }
  nav {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding-top: 10px;
    margin-top: 8px;
    border-top: 1px solid var(--border);
  }
  nav.open { display: flex; }
  nav .divider { width: 100%; height: 1px; margin: 6px 0; }
  nav button { width: 100%; text-align: left; }
}
