/* Offene Fragen: additions to the handout stylesheet for the online version.
   Colours come from the tokens the handout template defines on :root. */

.of-bar {
  position: sticky; top: 0; z-index: 10;
  display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; align-items: center;
  padding: 0.6rem 16px;
  background: var(--ground, #fff);
  border-bottom: 1px solid var(--border, #ddd);
  font-family: var(--f-body, system-ui, sans-serif);
  font-size: 0.82rem;
}
.of-bar .of-user { color: var(--muted, #666); }
.of-bar .of-spacer { flex: 1; }
.of-bar a { color: var(--accent, #493b71); }
.of-status::before { content: "●"; margin-right: 0.35rem; }
.of-status.ok { color: #2e7d4f; }
.of-status.busy { color: var(--muted, #666); }
.of-status.err { color: var(--crit, #a33a3a); font-weight: 600; }
#of-progress { color: var(--muted, #666); }

/* options as checkboxes */
/* the handout draws a printed tick box before each option; online the real checkbox replaces it */
ul.opts li:has(.of-opt)::before { content: none; }
ul.opts li:has(.of-opt) { padding-left: 0.6rem; margin-left: -0.6rem; padding-top: 0.35rem; padding-bottom: 0.35rem; border-radius: 4px; }
ul.opts li.rec:has(.of-opt) { padding-left: 0.6rem; border-radius: 0 4px 4px 0; }
ul.opts li .of-opt { display: flex; gap: 0.6rem; align-items: flex-start; cursor: pointer; }
.of-opt input[type="checkbox"] {
  flex: none; width: 1.15rem; height: 1.15rem; margin-top: 0.2rem;
  accent-color: var(--accent, #493b71); cursor: pointer;
}
.of-opt input:focus-visible { outline: 2px solid var(--accent, #493b71); outline-offset: 2px; }
ul.opts li:has(input:checked) { background: color-mix(in srgb, var(--accent, #493b71) 16%, transparent); }
.choice .of-other { display: inline-flex; gap: 0.6rem; align-items: center; cursor: pointer; }

/* free text */
textarea[data-key] {
  width: 100%; box-sizing: border-box;
  font: inherit; font-size: 0.95rem; line-height: 1.5;
  color: inherit; background: var(--ground, #fff);
  border: 1px solid var(--border-strong, #ccc); border-radius: 6px;
  padding: 0.55rem 0.7rem; resize: vertical; min-height: 2.4rem;
}
textarea.of-note { min-height: 5.5rem; margin-top: 0.3rem; }
textarea[data-key]:focus { outline: 2px solid var(--accent, #493b71); outline-offset: 1px; border-color: transparent; }
td textarea.of-short { min-width: 12rem; }

.of-flash { animation: of-flash 1.5s ease-out; }
@keyframes of-flash { from { background: color-mix(in srgb, #f5c542 45%, transparent); } }

.of-meta { font-size: 0.75rem; color: var(--muted, #666); margin: 0.6rem 0 0; }
article.q.of-done .q-no::after { content: " ✓"; color: #2e7d4f; }

.of-conflict {
  margin: 0.5rem 0; padding: 0.7rem 0.9rem;
  border: 1px solid var(--crit, #a33a3a); border-radius: 6px;
  background: color-mix(in srgb, var(--crit, #a33a3a) 7%, transparent);
  font-size: 0.88rem;
}
.of-conflict blockquote { margin: 0.4rem 0 0.6rem; padding-left: 0.7rem; border-left: 3px solid var(--crit, #a33a3a); white-space: pre-wrap; }
.of-conflict button, .of-login-box button {
  font: inherit; font-size: 0.85rem; padding: 0.4rem 0.8rem; border-radius: 5px; cursor: pointer;
  border: 1px solid var(--accent, #493b71); background: var(--accent, #493b71); color: #fff;
}
.of-conflict button[data-a="theirs"] { background: transparent; color: var(--accent, #493b71); }

/* the page stays greyed out until the saved answers are loaded */
body:not(.of-ready) [data-key] { opacity: 0.4; pointer-events: none; }

@media print {
  .of-bar, .of-conflict { display: none; }
  textarea[data-key] { border: none; border-bottom: 1px solid #999; border-radius: 0; resize: none; }
}

/* ------------------------------------------------------------------ login */
body.of-login {
  margin: 0; min-height: 100vh; display: grid; place-items: center;
  background: #f6f4f9; color: #1b1a24;
  font-family: "IBM Plex Sans", system-ui, sans-serif;
}
.of-login-box {
  width: min(26rem, calc(100vw - 32px)); box-sizing: border-box;
  padding: 2rem; background: #fff; border-radius: 10px; box-shadow: 0 1px 12px rgba(0, 0, 0, .08);
}
.of-login-box h1 { margin: 0.2rem 0 0.8rem; font-size: 1.6rem; }
.of-eyebrow { margin: 0; font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: #6c6679; }
.of-login-box label { display: block; margin: 0.9rem 0 0; font-size: 0.85rem; color: #6c6679; }
.of-login-box input {
  display: block; width: 100%; box-sizing: border-box; margin-top: 0.3rem;
  font: inherit; font-size: 1rem; padding: 0.55rem 0.7rem; border: 1px solid #ccc; border-radius: 6px;
}
.of-login-box button { margin-top: 1.2rem; width: 100%; padding: 0.65rem; font-size: 1rem; }
.of-error { color: var(--crit, #a33a3a); font-weight: 600; }
@media (prefers-color-scheme: dark) {
  body.of-login { background: #15141b; color: #ece9f3; }
  .of-login-box { background: #1f1d27; }
  .of-login-box input { background: #15141b; color: inherit; border-color: #444; }
}

.of-hint { font-size: 0.88rem; color: var(--muted, #666); border-left: 3px solid var(--accent, #493b71); padding-left: 0.8rem; margin: 1.5rem 0; }
