/* Brand: dark graphite + neon cyan/blue, taken from the course logo */
:root {
  --bg: #0a0e13;
  --bg-2: #0f151c;
  --card: #141b23;
  --card-2: #19222c;
  --line: rgba(110, 200, 255, 0.12);
  --line-strong: rgba(80, 225, 255, 0.35);
  --text: #e7f2f8;
  --muted: #8ea3b0;
  --cyan: #3fe3ff;
  --blue: #3a8dff;
  --grad: linear-gradient(135deg, #3fe3ff 0%, #3a8dff 100%);
  --glow: 0 0 0 1px rgba(63, 227, 255, 0.25), 0 0 22px rgba(63, 227, 255, 0.18);
  --ok: #3ddc97;
  --warn: #ffc857;
  --bad: #ff6b7a;
  --radius: 16px;
  --font-head: "Exo 2", "Segoe UI", system-ui, sans-serif;
  --font: "Inter", -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.6 var(--font);
  min-height: 100vh;
  background:
    radial-gradient(1200px 500px at 50% -200px, rgba(58, 141, 255, 0.10), transparent 70%),
    var(--bg);
  overflow-wrap: anywhere;
}
#app { max-width: 760px; margin: 0 auto; padding: 0 14px calc(92px + env(safe-area-inset-bottom)); }
h1, h2, h3, .head { font-family: var(--font-head); letter-spacing: 0.2px; }
a { color: var(--cyan); }
button { font: inherit; color: inherit; }
.hidden { display: none !important; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  margin: 0 -14px; padding: 10px 14px;
  background: rgba(10, 14, 19, 0.86);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar img { width: 34px; height: 34px; border-radius: 10px; box-shadow: var(--glow); }
.topbar .brand { font-family: var(--font-head); font-weight: 700; font-size: 15px; line-height: 1.15; }
.topbar .brand span { display: block; font-weight: 500; font-size: 11px; color: var(--muted); letter-spacing: 2px; }
.topbar .spacer { flex: 1; }
.chip-btn {
  border: 1px solid var(--line); background: var(--card); border-radius: 999px;
  padding: 5px 12px; font-size: 13px; cursor: pointer;
}

/* ---------- Bottom tabs ---------- */
#tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: center; gap: 4px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: rgba(10, 14, 19, 0.92);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
#tabs button {
  flex: 1; max-width: 140px; border: 0; background: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 4px; border-radius: 12px; color: var(--muted); font-size: 11px;
}
#tabs button .ico { font-size: 20px; line-height: 1; filter: grayscale(0.6); }
#tabs button.active { color: var(--cyan); background: rgba(63, 227, 255, 0.08); }
#tabs button.active .ico { filter: none; }

/* ---------- Cards ---------- */
.card {
  background: linear-gradient(180deg, var(--card) 0%, var(--bg-2) 100%);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin: 14px 0;
}
.card.glow { border-color: var(--line-strong); box-shadow: var(--glow); }
.card h2 { margin: 0 0 8px; font-size: 19px; }
.card h3 { margin: 0 0 6px; font-size: 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------- Hero / banner ---------- */
.hero {
  position: relative; margin: 14px 0; border-radius: 22px; overflow: hidden;
  border: 1px solid var(--line-strong); box-shadow: var(--glow);
  aspect-ratio: 590 / 380; background: #0b0f14 url("img/banner.jpg") center 42% / cover no-repeat;
}
.hero::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 45%, rgba(8, 11, 15, 0.92) 100%);
}
.hero .hero-info { position: absolute; left: 16px; right: 16px; bottom: 14px; z-index: 1; }
.hero .hero-day { font-family: var(--font-head); font-weight: 700; font-size: 20px; }
.progress { height: 8px; border-radius: 99px; background: rgba(255, 255, 255, 0.08); overflow: hidden; margin-top: 8px; }
.progress > div { height: 100%; background: var(--grad); box-shadow: 0 0 12px rgba(63, 227, 255, 0.6); border-radius: 99px; }

.splash {
  margin: 0 -14px; height: 46vh; min-height: 260px;
  background: #0b0f14 url("img/splash.jpg") center 52% / cover no-repeat;
  position: relative;
}
.splash::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, var(--bg) 100%); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 12px; padding: 12px 18px; cursor: pointer;
  font-weight: 600; font-size: 15px; background: var(--card-2); border: 1px solid var(--line);
}
.btn.primary { background: var(--grad); color: #04121a; border: 0; box-shadow: 0 6px 22px rgba(58, 141, 255, 0.35); }
.btn.ok { background: rgba(61, 220, 151, 0.15); color: var(--ok); border-color: rgba(61, 220, 151, 0.4); }
.btn.bad { background: rgba(255, 107, 122, 0.12); color: var(--bad); border-color: rgba(255, 107, 122, 0.4); }
.btn.block { width: 100%; }
.btn.sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.btn:disabled { opacity: 0.5; cursor: default; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row > .grow { flex: 1; }

/* ---------- Day list ---------- */
.day {
  display: flex; align-items: center; gap: 12px; padding: 12px;
  border: 1px solid var(--line); border-radius: 14px; margin: 8px 0;
  background: var(--card); cursor: pointer;
}
.day.locked { opacity: 0.45; cursor: default; }
.day.current { border-color: var(--line-strong); box-shadow: var(--glow); }
.day .num {
  flex: none; width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center; font-family: var(--font-head); font-weight: 700;
  background: rgba(63, 227, 255, 0.08); color: var(--cyan); border: 1px solid var(--line);
}
.day.done .num { background: rgba(61, 220, 151, 0.12); color: var(--ok); }
.day .info { flex: 1; min-width: 0; }
.day .title { font-weight: 600; line-height: 1.3; }
.day .meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.tag {
  font-size: 11px; padding: 2px 8px; border-radius: 99px;
  background: rgba(255, 255, 255, 0.06); color: var(--muted); border: 1px solid var(--line);
}
.tag.ok { color: var(--ok); border-color: rgba(61, 220, 151, 0.35); }
.tag.warn { color: var(--warn); border-color: rgba(255, 200, 87, 0.35); }
.tag.bad { color: var(--bad); border-color: rgba(255, 107, 122, 0.35); }
.tag.cyan { color: var(--cyan); border-color: var(--line-strong); }

/* ---------- Lesson content ---------- */
.lesson h1 { font-size: 23px; line-height: 1.25; margin: 6px 0 10px; }
.lesson h2 {
  font-size: 19px; margin: 30px 0 10px; padding-top: 14px; border-top: 1px solid var(--line);
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lesson h3 { font-size: 16px; margin: 22px 0 6px; }
.lesson hr { display: none; }
.lesson p { margin: 8px 0; }
.lesson li { margin: 4px 0; }
.lesson code {
  font-family: var(--mono); font-size: 13px; background: rgba(63, 227, 255, 0.08);
  color: #bdf4ff; padding: 1px 6px; border-radius: 6px;
}
.lesson pre {
  position: relative; background: #070a0e; border: 1px solid var(--line);
  border-radius: 12px; padding: 14px; overflow-x: auto; overflow-wrap: normal;
}
.lesson pre code { background: none; padding: 0; color: #d6e6ef; }
.lesson blockquote {
  position: relative; margin: 12px 0; padding: 12px 14px 12px 14px;
  background: rgba(63, 227, 255, 0.05); border: 1px solid var(--line);
  border-left: 3px solid var(--cyan); border-radius: 12px;
}
.lesson blockquote p { margin: 4px 0; }
.lesson .prompt-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--cyan); margin-bottom: 4px;
}
.copy-btn {
  border: 1px solid var(--line-strong); background: rgba(63, 227, 255, 0.1); color: var(--cyan);
  border-radius: 8px; padding: 3px 10px; font-size: 12px; cursor: pointer; text-transform: none; letter-spacing: 0;
}
.lesson pre .copy-btn { position: absolute; top: 8px; right: 8px; }
.table-wrap { overflow-x: auto; margin: 12px 0; border-radius: 12px; border: 1px solid var(--line); }
.lesson table { border-collapse: collapse; min-width: 100%; font-size: 13.5px; }
.lesson th, .lesson td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
.lesson th { background: var(--card-2); font-weight: 600; }
.lesson details { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; margin: 12px 0; }
.lesson summary { cursor: pointer; font-weight: 600; color: var(--cyan); }
.lesson input[type="checkbox"] { accent-color: var(--cyan); transform: scale(1.15); margin-right: 6px; }

/* ---------- Quiz ---------- */
.question { margin: 16px 0; }
.question .q { font-weight: 600; margin-bottom: 8px; }
.option {
  display: block; width: 100%; text-align: left; cursor: pointer;
  border: 1px solid var(--line); background: var(--card-2); border-radius: 12px;
  padding: 10px 12px; margin: 6px 0;
}
.option.selected { border-color: var(--cyan); background: rgba(63, 227, 255, 0.10); }
.option.right { border-color: var(--ok); background: rgba(61, 220, 151, 0.12); }
.option.wrong { border-color: var(--bad); background: rgba(255, 107, 122, 0.10); }
.option .letter { font-family: var(--font-head); font-weight: 700; color: var(--cyan); margin-right: 8px; }
.score { font-family: var(--font-head); font-size: 28px; font-weight: 700; }

/* ---------- Forms ---------- */
input[type="text"], input[type="number"], input[type="search"], textarea, select {
  width: 100%; font: inherit; color: var(--text);
  background: #0b1016; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
}
textarea { min-height: 96px; resize: vertical; }
textarea.code { font-family: var(--mono); font-size: 13px; min-height: 320px; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(63, 227, 255, 0.15); }
label.field { display: block; margin: 12px 0 4px; font-size: 13px; color: var(--muted); }
.file-pick {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-top: 8px;
  border: 1px dashed var(--line-strong); border-radius: 12px; cursor: pointer; color: var(--muted);
}
.file-pick input { display: none; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; }

/* ---------- Prompts ---------- */
.prompt-card .ptext {
  white-space: pre-wrap; font-size: 14px; background: #0b1016; border: 1px solid var(--line);
  border-radius: 12px; padding: 12px; margin-top: 8px;
}
.filters { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 8px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filters button { flex: none; }
.filters .on { border-color: var(--cyan); color: var(--cyan); background: rgba(63, 227, 255, 0.1); }

/* ---------- Stats ---------- */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 14px 0; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.tile .v { font-family: var(--font-head); font-size: 24px; font-weight: 700; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tile .l { font-size: 12px; color: var(--muted); }
.bar-row { display: flex; align-items: center; gap: 8px; font-size: 13px; margin: 4px 0; }
.bar-row .bar { flex: 1; height: 8px; border-radius: 99px; background: rgba(255, 255, 255, 0.06); overflow: hidden; }
.bar-row .bar div { height: 100%; background: var(--grad); }

/* ---------- Admin ---------- */
.subtabs { display: flex; gap: 6px; overflow-x: auto; margin: 12px 0 4px; scrollbar-width: none; }
.subtabs::-webkit-scrollbar { display: none; }
.subtabs button { flex: none; }
.qedit { border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin: 10px 0; background: #0b1016; }
.qedit .opt { display: flex; gap: 8px; align-items: center; margin: 6px 0; }
.qedit .opt input[type="radio"] { accent-color: var(--ok); width: 18px; height: 18px; flex: none; }
.preview-img { max-width: 100%; border-radius: 12px; margin-top: 8px; border: 1px solid var(--line); }

/* ---------- Toast & loading ---------- */
#toast {
  position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px);
  background: #0d141b; border: 1px solid var(--line-strong); box-shadow: var(--glow);
  padding: 10px 16px; border-radius: 12px; opacity: 0; transition: 0.25s; z-index: 50; pointer-events: none;
  max-width: 90vw; text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.loader { display: grid; place-items: center; padding: 60px 0; }
.loader img { width: 84px; height: 84px; border-radius: 22px; box-shadow: var(--glow); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 1px rgba(63, 227, 255, 0.5), 0 0 38px rgba(63, 227, 255, 0.45); transform: scale(1.04); } }
.center { text-align: center; }

/* ---------- Protection of the course content ---------- */
.lesson, .prompt-card .ptext, #taskCard .lesson {
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.allow-copy, input, textarea { -webkit-user-select: text; user-select: text; }
#watermark {
  position: fixed; inset: -50%; z-index: 15; pointer-events: none;
  display: flex; flex-wrap: wrap; gap: 70px 90px; align-content: flex-start;
  transform: rotate(-24deg); opacity: 0.075; padding: 40px;
  font: 600 13px var(--font); color: #ffffff; white-space: nowrap; overflow: hidden;
}
.copyright { text-align: center; font-size: 11px; color: var(--muted); opacity: 0.8; margin: 26px 0 8px; line-height: 1.5; }

/* ---------- Terms, payment ---------- */
.check { display: flex; gap: 10px; align-items: flex-start; margin: 14px 0 4px; cursor: pointer; }
.check input { width: 20px; height: 20px; flex: none; accent-color: var(--cyan); margin-top: 2px; }
.check.shake { animation: shake 0.4s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
details.terms, details.pay-box {
  background: var(--card-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin: 10px 0;
}
details.terms summary, details.pay-box summary { cursor: pointer; font-weight: 600; }
details.terms[open] > div { max-height: 260px; overflow-y: auto; margin-top: 8px; }
.pay-btn { margin-top: 10px; }
.price { display: flex; align-items: baseline; justify-content: space-between; margin: 6px 0 2px; }
.kv { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.kv > span:first-child { width: 120px; }
.kv > span.allow-copy { flex: 1; font-family: var(--mono); font-size: 13px; }
.pay-row { padding: 10px 0; border-bottom: 1px solid var(--line); }

/* ---------- Step-by-step quiz: explanation after each answer ---------- */
.explain { margin-top: 12px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--card-2); }
.explain.ok { border-color: rgba(61, 220, 151, 0.45); background: rgba(61, 220, 151, 0.08); }
.explain.bad { border-color: rgba(255, 107, 122, 0.45); background: rgba(255, 107, 122, 0.08); }

/* ---------- Live exam room ---------- */
.exam-feed { display: flex; flex-direction: column; gap: 10px; padding: 6px 0 16px; }
.bubble {
  max-width: 82%; align-self: flex-start; padding: 8px 12px; border-radius: 14px 14px 14px 4px;
  background: var(--card-2); border: 1px solid var(--line); white-space: normal;
}
.bubble.mine { align-self: flex-end; border-radius: 14px 14px 4px 14px; background: rgba(58, 141, 255, 0.18); border-color: rgba(58, 141, 255, 0.35); }
.bubble .who { font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.exam-q { background: var(--card); border: 1px solid var(--line-strong); border-radius: 14px; padding: 12px; box-shadow: var(--glow); }
.exam-q .q { font-weight: 600; margin-bottom: 8px; }
.exam-system { align-self: center; font-size: 12px; color: var(--muted); padding: 4px 12px; border: 1px solid var(--line); border-radius: 99px; }
.exam-input {
  position: sticky; bottom: 0; z-index: 20; display: flex; gap: 8px; align-items: flex-end;
  margin: 0 -14px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: rgba(10, 14, 19, 0.95); border-top: 1px solid var(--line);
}
.exam-input textarea { min-height: 44px; max-height: 120px; resize: none; }
.exam-input .btn { height: 44px; width: 52px; padding: 0; }

.copyright details.impressum { margin-top: 6px; }
.copyright details.impressum summary { cursor: pointer; text-decoration: underline; }
.copyright details.impressum div { text-align: left; margin-top: 6px; }

.mini-table { border-collapse: collapse; width: 100%; font-size: 13px; }
.mini-table th, .mini-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.mini-table th { color: var(--muted); font-weight: 600; }
.diagram { margin: 14px 0 18px; padding: 12px 10px 8px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg-2); }
.diagram svg { display: block; width: 100%; max-width: 420px; height: auto; margin: 0 auto; font-family: Inter, system-ui, sans-serif; }
.diagram figcaption { text-align: center; font-size: 11px; color: var(--muted); letter-spacing: 1px; margin-top: 6px; text-transform: uppercase; }

.confirm-box { margin-top: 10px; padding: 10px; border: 1px dashed var(--line-strong); border-radius: 12px; background: var(--bg-2); }
.pick-q { padding: 10px 0; border-bottom: 1px solid var(--line); }
.pick-q:last-of-type { border-bottom: 0; }
.pick-right { color: #5be3a0; font-weight: 600; }
.open-answer { width: 100%; min-height: 70px; }
