:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --text: #1c2430;
  --muted: #5b6676;
  --border: #d9dee5;
  --accent: #0b5cad;
  --accent-text: #ffffff;
  --danger: #b42318;
  --ok: #18794e;
  --warn: #9a6700;
  --radius: 8px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.5; }
a { color: var(--accent); }
h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 0 0 .5rem; }
small, .muted { color: var(--muted); }
code { background: #eef1f5; padding: 1px 5px; border-radius: 4px; font-size: .9em; }

button, .btn {
  display: inline-flex; align-items: center; gap: .4rem;
  font: inherit; font-weight: 600; cursor: pointer;
  padding: .55rem 1rem; border-radius: var(--radius);
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-text);
  text-decoration: none;
}
button:disabled { opacity: .45; cursor: not-allowed; }
.btn-secondary { background: var(--surface); color: var(--accent); }
.btn-danger { background: var(--danger); border-color: var(--danger); }
.btn-small { padding: .25rem .6rem; font-size: .875rem; }

input[type=text], input[type=number], input[type=password], input[type=url], select, textarea {
  font: inherit; width: 100%; padding: .5rem .6rem; border: 1px solid var(--border);
  border-radius: 6px; background: #fff; color: var(--text);
}
textarea { min-height: 6rem; resize: vertical; }
label { font-weight: 600; display: block; margin: .75rem 0 .25rem; }
label.inline { display: inline-flex; gap: .4rem; align-items: center; font-weight: 500; margin: .25rem 1.25rem .25rem 0; }
.hint { font-size: .85rem; color: var(--muted); margin-top: .2rem; }

/* ------------------------------------------------------------------ admin */
.admin-header {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .75rem 1.5rem; background: var(--surface); border-bottom: 1px solid var(--border);
}
.admin-header nav a { margin-right: 1rem; text-decoration: none; font-weight: 600; }
.admin-main { max-width: 1100px; margin: 0 auto; padding: 1.5rem 1rem 4rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1.25rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.25rem; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 1rem; }
@media (max-width: 760px) { .grid2, .grid4 { grid-template-columns: 1fr; } }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; white-space: nowrap; }
.table-wrap { overflow-x: auto; }
.badge { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .8rem; font-weight: 600; background: #eef1f5; color: var(--muted); }
.badge.ok { background: #dcf3e6; color: var(--ok); }
.badge.warn { background: #fff4d6; color: var(--warn); }
.badge.err { background: #fde4e1; color: var(--danger); }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.actions form { margin: 0; }
.flash { padding: .6rem 1rem; border-radius: var(--radius); background: #dcf3e6; color: var(--ok); margin-bottom: 1rem; font-weight: 600; }
.flash.warn { background: #fdf0d5; color: #7a4b00; font-weight: 500; margin: .5rem 0; }
.error { padding: .6rem 1rem; border-radius: var(--radius); background: #fde4e1; color: var(--danger); margin-bottom: 1rem; }
.linkbox { display: flex; gap: .5rem; }
.linkbox input { font-family: ui-monospace, monospace; font-size: .85rem; }
.qcard { border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; margin-bottom: .75rem; background: #fafbfc; }
.qcard header { display: flex; justify-content: space-between; align-items: center; }
.sticky-save { position: sticky; bottom: 0; background: var(--bg); padding: .75rem 0; border-top: 1px solid var(--border); display: flex; gap: .75rem; align-items: center; }
.progress { height: 8px; background: #e6e9ee; border-radius: 4px; overflow: hidden; margin-top: .5rem; }
.progress > div { height: 100%; background: var(--accent); width: 0; transition: width .2s; }
.login-box { max-width: 380px; margin: 10vh auto; }

/* ------------------------------------------------------------------ participant */
body.participant { background: #111418; color: #f1f3f5; }
.p-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 2rem 1rem 3.5rem; } /* bottom: room for the fixed footer */
.p-panel { background: #fff; color: var(--text); max-width: 760px; width: 100%; border-radius: 12px; padding: 2rem 2.25rem; box-shadow: 0 10px 40px rgba(0,0,0,.35); }
.p-panel h1 { font-size: 1.4rem; }
.p-text { max-height: 55vh; overflow-y: auto; padding-right: .5rem; }
.p-text p:first-child { margin-top: 0; }
.p-text { overflow-wrap: anywhere; }
#scr-welcome .p-text, #instr-text { max-height: none; overflow: visible; }  /* short pages: show everything */
.md-fold { border: 1px solid var(--border); border-radius: 8px; margin: 1rem 0; background: #fafbfc; }
.md-fold > summary { cursor: pointer; padding: .75rem 1rem; font-weight: 600; color: var(--accent); }
.md-fold > summary:hover { text-decoration: underline; }
.md-fold[open] > summary { border-bottom: 1px solid var(--border); }
.md-fold > div { padding: .25rem 1rem .75rem; font-size: .95rem; }
.p-check { display: flex; gap: .75rem; align-items: flex-start; margin: 1.25rem 0; font-weight: 500; }
.p-check input { width: 1.25rem; height: 1.25rem; margin-top: .15rem; flex: none; }
.p-buttons { display: flex; gap: .75rem; justify-content: flex-end; flex-wrap: wrap; margin-top: 1.25rem; }
.p-status { margin-top: 1rem; color: var(--muted); }
.p-status.err { color: var(--danger); font-weight: 600; }

#stage { position: fixed; inset: 0; background: #000; display: none; flex-direction: column; }
#stage.on { display: flex; }
#lecture { flex: 1; width: 100%; min-height: 0; background: #000; }
#controls { display: flex; align-items: center; gap: .75rem; padding: .5rem 1rem; background: #181c22; color: #e6e9ee; }
#controls button { background: transparent; border: 1px solid #3a414b; color: #e6e9ee; padding: .35rem .8rem; }
#controls .time { font-variant-numeric: tabular-nums; min-width: 9rem; }
#seekbar { flex: 1; accent-color: #4d9cf0; }
#seekbar:disabled { opacity: .6; }
#controls select { width: auto; background: #181c22; color: #e6e9ee; border-color: #3a414b; }
#controls input[type=range].vol { width: 90px; accent-color: #4d9cf0; }
.spacer { flex: 1; }

.overlay { position: fixed; inset: 0; background: rgba(8, 10, 14, .82); display: none; align-items: center; justify-content: center; z-index: 10; padding: 1rem; }
.overlay.on { display: flex; }
.probe-q { margin: 1.25rem 0; }
.probe-q .qtext { font-weight: 600; font-size: 1.05rem; margin-bottom: .5rem; }
.probe-opt { display: flex; gap: .6rem; align-items: flex-start; padding: .5rem .75rem; border: 1px solid var(--border); border-radius: 8px; margin: .35rem 0; cursor: pointer; font-weight: 500; }
.probe-opt:hover { background: #f1f5fb; }
.probe-opt input { margin-top: .25rem; flex: none; }
input.probe-other { margin: -.1rem 0 .5rem 2.1rem; width: calc(100% - 2.1rem); }
.banner { position: fixed; top: 0; left: 0; right: 0; z-index: 20; text-align: center; font-weight: 700; padding: .3rem; font-size: .85rem; }
.banner.preview { background: #ffd43b; color: #222; }
.banner.offline { background: #c92a2a; color: #fff; top: auto; bottom: 0; }
.p-cam-hidden { position: fixed; right: 0; bottom: 0; width: 2px; height: 2px; opacity: 0.01; pointer-events: none; }

/* imprint / privacy links: always reachable */
body.participant { padding-bottom: 2.5rem; }
.p-footer { position: fixed; left: 0; right: 0; bottom: 0; padding: .45rem 1rem; text-align: center; font-size: .82rem;
  background: rgba(255, 255, 255, .92); border-top: 1px solid var(--border); color: var(--muted, #667); z-index: 5; }
.p-footer a { color: inherit; }
.p-footer span { margin: 0 .5rem; }
#controls .legal-links { margin-left: auto; font-size: .78rem; opacity: .75; white-space: nowrap; }
#controls .legal-links a { color: #c9cfd8; }
#stage.on ~ .p-footer { display: none; } /* during the lecture the links sit in the player bar */
/* long probe questions on small screens: the panel scrolls instead of being cut off */
.overlay .p-panel { max-height: calc(100vh - 2rem); overflow-y: auto; }
@media (max-height: 760px) {
  .overlay .p-panel { padding: 1.25rem 1.5rem; }
  .probe-q { margin: .6rem 0; }
  .probe-opt { padding: .35rem .6rem; margin: .25rem 0; }
}
.flash.info { background: #e3eefc; color: #0b3d79; font-weight: 500; margin: .5rem 0; }
.flash.info .progress { margin: .4rem 0; }
#controls .icon-btn { display: inline-flex; align-items: center; justify-content: center; padding: .35rem .5rem; line-height: 0; }
#controls .icon-btn svg { display: block; }
