:root {
  --bg: #0f1115;
  --panel: #1a1d24;
  --panel-2: #232732;
  --text: #e6e9ef;
  --muted: #8b93a3;
  --accent: #6aa9ff;
  --accent-dark: #3d7bd8;
  --ok: #4cd083;
  --bad: #f06e6e;
  --warn: #f5b042;
  --pending: #c08bff;
  --border: #2a2f3a;
  --radius: 10px;
}

* { box-sizing: border-box; }

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

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

.topbar {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 0.6rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.8rem;
}
.brand {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}
.brand-logo {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.brand span { line-height: 1; }
/* ── Nav: pills op desktop ── */
.nav-toggle { display: none; }

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  margin-left: auto;
}
.nav a {
  display: inline-block;
  padding: 0.28rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--muted);
  font-size: 0.88rem;
  white-space: nowrap;
  text-decoration: none;
  transition: background 120ms, color 120ms, border-color 120ms;
}
.nav a:hover { background: #2c3140; color: var(--text); text-decoration: none; }
.nav .nav-alert { border-color: var(--warn); color: var(--warn); }
.nav .nav-admin  { border-color: var(--warn); color: var(--warn); }
.nav .nav-logout { border-color: var(--bad);  color: var(--bad); }
.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bad);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  min-width: 1.1rem;
  height: 1.1rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  vertical-align: middle;
  line-height: 1.4;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.2rem;
}

.footer {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--muted);
  font-size: 0.85rem;
}

h1 { margin-top: 0; }
h2 { margin-top: 2rem; border-bottom: 1px solid var(--border); padding-bottom: 0.4rem; }

.muted { color: var(--muted); }

/* Flashes */
.flashes { margin-bottom: 1rem; display: grid; gap: 0.5rem; }
.flash {
  padding: 0.7rem 1rem;
  border-radius: var(--radius);
  border-left: 4px solid var(--muted);
  background: var(--panel);
}
.flash-success { border-color: var(--ok); }
.flash-error   { border-color: var(--bad); }
.flash-warning { border-color: var(--warn); }

/* Auth card */
.auth-card {
  max-width: 380px;
  margin: 2rem auto;
  background: var(--panel);
  padding: 1.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

/* Forms */
.stack { display: grid; gap: 0.9rem; }
label { display: block; font-weight: 500; }
input[type=text], input[type=password], input[type=number], input[type=file],
input[type=email], input[type=search], input:not([type]), textarea, select {
  width: 100%;
  margin-top: 0.3rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 6px;
  font: inherit;
}
textarea { resize: vertical; min-height: 3rem; }
input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

fieldset.radios, fieldset.choices {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.7rem;
  display: grid;
  gap: 0.4rem;
}
fieldset.radios label, fieldset.choices label {
  font-weight: normal;
  cursor: pointer;
}
.choices label.choice {
  padding: 0.6rem 0.8rem;
  border-radius: 6px;
  background: var(--panel-2);
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.choices label.choice:hover { background: #2c3140; }
.choices input[type=radio] { width: auto; margin: 0; }

.opt-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.4rem;
}
.opt-row input[type=radio] { width: auto; margin: 0; }

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.55rem 1rem;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  text-decoration: none;
  transition: background 120ms;
}
.btn:hover { background: #2c3140; text-decoration: none; }
.btn.primary { background: var(--accent-dark); border-color: var(--accent); color: white; }
.btn.primary:hover { background: var(--accent); }
.btn.warn { background: transparent; border-color: var(--warn); color: var(--warn); }
.btn.warn:hover { background: rgba(245,176,66,0.12); }
.btn.small { padding: 0.3rem 0.6rem; font-size: 0.85rem; }

.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.actions form { display: inline; }

/* Question card */
.qcard {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin: 1rem 0;
}
.qcard.done { opacity: 0.85; }
.qhead {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.6rem;
}
.qhead .qslot { color: var(--accent); font-weight: 600; }
.qhead .qcat { background: var(--panel-2); padding: 0.05rem 0.5rem; border-radius: 10px; }
.qhead .qpts { margin-left: auto; }
.qtext { font-size: 1.05rem; margin: 0.4rem 0 0.8rem; }

.opts { list-style: none; padding: 0; margin: 0.5rem 0; display: grid; gap: 0.35rem; }
.opts li {
  padding: 0.4rem 0.7rem;
  background: var(--panel-2);
  border-radius: 6px;
  font-size: 0.95rem;
}
.opts li.correct { border-left: 3px solid var(--ok); }
.opts li.chosen  { outline: 1px dashed var(--accent); }

.tag {
  display: inline-block;
  font-size: 0.72rem;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  margin-left: 0.4rem;
  background: var(--panel-2);
}
.tag.ok { background: rgba(76,208,131,0.15); color: var(--ok); }

.ok      { color: var(--ok); font-weight: 600; }
.bad     { color: var(--bad); font-weight: 600; }
.pending { color: var(--pending); font-weight: 600; }

.result-badge {
  display: inline-block;
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 0.6rem;
  border: 1px solid transparent;
}
.result-badge.ok      { background: rgba(76,208,131,0.15);  color: var(--ok);      border-color: var(--ok); }
.result-badge.bad     { background: rgba(240,110,110,0.15); color: var(--bad);     border-color: var(--bad); }
.result-badge.pending { background: rgba(192,139,255,0.15); color: var(--pending); border-color: var(--pending); }

.empty {
  text-align: center;
  padding: 2rem 1rem;
  background: var(--panel);
  border-radius: var(--radius);
  border: 1px dashed var(--border);
}

.sep { border: none; border-top: 1px dashed var(--border); margin: 2rem 0; }

.report summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 0.6rem;
}
.report[open] summary { color: var(--warn); }
.report .stack { margin-top: 0.5rem; }

.report-msg {
  background: var(--panel-2);
  border-left: 3px solid var(--warn);
  padding: 0.5rem 0.8rem;
  margin: 0.5rem 0;
  font-style: italic;
}

/* Stats grid */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.6rem;
  margin: 1rem 0 1.5rem;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.8rem;
  text-align: center;
}
.stat .num { display: block; font-size: 1.8rem; font-weight: 700; color: var(--accent); }
.stat .lbl { color: var(--muted); font-size: 0.8rem; }

/* Tables */
.grid {
  width: 100%;
  border-collapse: collapse;
  margin: 0.5rem 0 1.5rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.grid th, .grid td {
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.grid th { background: var(--panel-2); color: var(--muted); font-weight: 600; }
.grid tr:last-child td { border-bottom: none; }
.grid tr.used td { opacity: 0.55; }
.grid td.num { font-variant-numeric: tabular-nums; text-align: right; }
.grid td.qcell { max-width: 30rem; }

.scroll-x { overflow-x: auto; }
.matrix th, .matrix td { white-space: nowrap; }
.matrix th:not(:first-child),
.matrix td:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }

.admin-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
}

.grade-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: end;
}
.grade-row input { width: auto; min-width: 8rem; }
.grade-row label { display: grid; }

.day { margin-top: 1.5rem; }
.day h2 { color: var(--accent); }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.tab {
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--panel-2);
  color: var(--muted);
  border: 1px solid var(--border);
  border-bottom: none;
}
.tab.active {
  background: var(--panel);
  color: var(--accent);
  font-weight: 600;
}
.tab:hover { text-decoration: none; color: var(--text); }

fieldset.members {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.7rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.3rem;
}
fieldset.members label {
  font-weight: normal;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
fieldset.members input { width: auto; margin: 0; }

.back-link { margin: 0 0 0.5rem; }
.back-link a { color: var(--muted); font-size: 0.9rem; }
.back-link a:hover { color: var(--accent); }

.card.danger { border-color: var(--bad); }
.danger-h { color: var(--bad); border-color: var(--bad); }

.errors {
  background: var(--panel);
  border-left: 3px solid var(--bad);
  padding: 0.7rem 1rem;
  border-radius: var(--radius);
}

.resp { list-style: none; padding: 0; margin: 0.5rem 0; display: grid; gap: 0.3rem; }
.resp li {
  background: var(--panel-2);
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
}

/* ── Hamburger menu op mobiel ── */
.nav-toggle {
  display: none;
  margin-left: auto;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 1.2rem;
  line-height: 1;
  padding: 0.35rem 0.65rem;
  cursor: pointer;
}

@media (max-width: 700px) {
  .nav-toggle { display: block; }
  .nav {
    display: none;
    width: 100%;
    order: 3;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
    padding: 0.5rem 0 0.3rem;
    border-top: 1px solid var(--border);
    margin-top: 0.4rem;
    margin-left: 0;
  }
  .nav.open { display: flex; }
  .nav a { width: 100%; padding: 0.5rem 1rem; border-radius: 8px; }
  .topbar { flex-wrap: wrap; }
  .container { padding: 0.8rem; }
  .qhead { font-size: 0.78rem; }
  .stat .num { font-size: 1.4rem; }
  .grid th, .grid td { padding: 0.4rem 0.5rem; }
  .brand-logo { display: none; }
}

/* -- Foto-rondes -- */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.9rem;
  margin: 1rem 0;
}
.photo-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 4/3;
  overflow: hidden;
  border-radius: 8px;
  background: var(--panel);
}
.photo-frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-frame-lg { max-width: 500px; aspect-ratio: 4/3; }

.photo-mc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.9rem;
  margin: 0.75rem 0;
}
.photo-mc-btn {
  background: none;
  border: 3px solid transparent;
  padding: 0;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
}
.photo-mc-btn:hover { border-color: var(--accent); transform: scale(1.02); }
.photo-mc-option { border: 3px solid transparent; border-radius: 10px; overflow: hidden; }
.photo-mc-option.chosen  { border-color: var(--bad); }
.photo-mc-option.correct { border-color: var(--ok); }

.photo-admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
.photo-admin-item { display: flex; flex-direction: column; }
.focal-wrap { position: relative; cursor: crosshair; border-radius: 8px; overflow: hidden; flex-shrink: 0; }
.focal-wrap img { display: block; width: 100%; height: auto; }
.focal-dot {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(255,200,0,0.85);
  border: 2px solid #fff;
  transform: translate(-50%,-50%);
  pointer-events: none;
  box-shadow: 0 0 5px rgba(0,0,0,0.8);
}

.photo-mc-select-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
  margin: 0.5rem 0 1rem;
}
.photo-mc-select-item {
  cursor: pointer;
  border: 3px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  transition: border-color 0.15s;
  display: flex;
  flex-direction: column;
}
.photo-mc-select-item input[type=radio] { margin: 0.4rem auto 0; }
.photo-mc-select-item .photo-frame { border-radius: 0; }
.photo-mc-select-item.selected { border-color: var(--ok); }
.photo-mc-select-item:hover { border-color: var(--accent); }

.radio-card {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: var(--panel);
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: border-color 0.15s;
}
.radio-card:has(input:checked) { border-color: var(--accent); }
.radio-card input { margin-top: 0.2rem; flex-shrink: 0; }

/* Foto zoom-dialog */
dialog.photo-zoom-dialog::backdrop { background: rgba(0,0,0,0.75); }
.photo-zoomable img { cursor: zoom-in; transition: opacity 0.15s; }
.photo-zoomable img:hover { opacity: 0.88; }

/* Photo-history details toggle */
details.photo-history-round > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}
details.photo-history-round > summary::before { content: "? "; font-size:0.7em; }
details.photo-history-round[open] > summary::before { content: "? "; }

/* Mobiel: foto's kleiner */
@media (max-width: 600px) {
  .photo-grid { grid-template-columns: repeat(2, 1fr); gap: 0.4rem; }
  .photo-frame { aspect-ratio: 1/1; }
  .photo-mc-grid { grid-template-columns: repeat(2, 1fr); gap: 0.4rem; }
  .photo-frame-lg { max-width: 100%; }
}

/* ── Tutorial overlay ── */
.tutorial-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}
.tutorial-card {
  background: var(--panel);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 1.5rem;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.tutorial-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.8rem;
}
.tutorial-badge {
  font-size: 0.78rem;
  color: var(--accent);
  font-weight: 600;
  background: rgba(106,169,255,0.12);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--accent);
}
.tutorial-title {
  margin: 0 0 0.6rem;
  font-size: 1.15rem;
}
.tutorial-body {
  color: var(--muted);
  margin: 0 0 1.2rem;
  line-height: 1.6;
}
.tutorial-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
}

/* ── Feedback FAB ── */
.feedback-fab {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--accent-dark);
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  box-shadow: 0 3px 12px rgba(0,0,0,0.4);
  z-index: 900;
  transition: transform 0.15s;
}
.feedback-fab:hover { transform: scale(1.1); }

.feedback-panel {
  position: fixed;
  bottom: 5rem;
  right: 1.5rem;
  width: 300px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  z-index: 901;
  box-shadow: 0 6px 24px rgba(0,0,0,0.4);
}
.feedback-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.8rem;
}

@media (max-width: 700px) {
  .feedback-panel { right: 0.5rem; left: 0.5rem; width: auto; }
  .feedback-fab   { bottom: 1rem; right: 1rem; }
}
