/* Gemeinsames Design für alle Seiten des Raspberry-Pi-Lernportals */
:root {
  --bg: #e9f0f3;
  --card: #ffffff;
  --navy: #17223b;
  --blue: #2f7dc0;
  --blue-dark: #1f5f97;
  --teal: #5b9aa6;
  --red: #b83a55;
  --yellow: #f5c542;
  --green: #3fa36b;
  --text: #17223b;
  --muted: #5b6b7d;
  --ok: #d4f5e0;
  --bad: #fbd6dc;
  --radius: 14px;
  --link: #1f5f97;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1726;
    --card: #1a2438;
    --navy: #0b1220;
    --text: #e8eef7;
    --muted: #a9b6c8;
    --ok: #1f4d35;
    --bad: #5a2430;
    --link: #8fc3f0;
  }
}

:root[data-theme="dark"] {
  --bg: #0f1726;
  --card: #1a2438;
  --navy: #0b1220;
  --text: #e8eef7;
  --muted: #a9b6c8;
  --ok: #1f4d35;
  --bad: #5a2430;
  --link: #8fc3f0;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Open Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}

h1, h2, h3, .display {
  font-family: "Oswald", "Arial Narrow", Impact, sans-serif;
  letter-spacing: .3px;
  line-height: 1.15;
  margin: .3em 0 .4em;
}

h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.1rem); }
h3 { font-size: 1.3rem; }

a { color: var(--link); }

/* Kopfzeile */
.topbar {
  background: var(--navy);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar .inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  align-items: center;
  justify-content: space-between;
}
.brand { font-family: "Oswald", Impact, sans-serif; font-size: 1.25rem; color: #fff; text-decoration: none; }
.topbar nav { display: flex; flex-wrap: wrap; gap: 8px; }
.topbar nav a {
  color: #fff; text-decoration: none; padding: 6px 12px;
  border-radius: 999px; background: rgba(255,255,255,.12); font-size: .95rem;
}
.topbar nav a:hover, .topbar nav a.active { background: var(--blue); }

main { max-width: 1100px; margin: 0 auto; padding: 24px 16px 80px; }

/* Hero-Bereich im Prezi-Stil */
.hero {
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-dark) 100%);
  color: #fff;
  border-radius: 22px;
  padding: 36px 28px;
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
}
.hero h1 { color: #fff; margin-top: 0; }
.hero p { max-width: 720px; margin: 0; opacity: .95; }
.hero .tag {
  display: inline-block; background: var(--yellow); color: var(--navy);
  font-weight: 700; padding: 4px 12px; border-radius: 6px; margin-bottom: 12px; font-size: .9rem;
}

/* Kacheln */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin: 20px 0 30px;
}
.tile {
  background: var(--blue);
  color: #fff;
  border-radius: var(--radius);
  padding: 20px 18px;
  text-decoration: none;
  min-height: 110px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform .15s ease, box-shadow .15s ease;
  box-shadow: 0 4px 0 rgba(0,0,0,.12);
}
.tile:hover { transform: translateY(-3px); box-shadow: 0 8px 0 rgba(0,0,0,.12); }
.tile.teal { background: var(--teal); }
.tile.red { background: var(--red); }
.tile.green { background: var(--green); }
.tile.yellow { background: var(--yellow); color: var(--navy); }
.tile.navy { background: var(--navy); }
.tile.disabled { opacity: .45; pointer-events: none; }
.tile .big { font-family: "Oswald", Impact, sans-serif; font-size: 1.45rem; text-transform: uppercase; }
.tile small { opacity: .9; }

/* Karten */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 22px 22px;
  margin: 18px 0;
  box-shadow: 0 2px 10px rgba(0,0,0,.06);
}
.card.accent { border-left: 6px solid var(--blue); }
.card.warn { border-left: 6px solid var(--yellow); }
.card.good { border-left: 6px solid var(--green); }
.muted { color: var(--muted); }

code, pre, kbd {
  font-family: "Fira Code", Consolas, "Courier New", monospace;
  font-size: .92rem;
}
pre {
  background: #0d1424;
  color: #d7f5e1;
  padding: 12px 14px;
  border-radius: 10px;
  overflow-x: auto;
  margin: 10px 0;
}
:not(pre) > code {
  background: rgba(47,125,192,.12);
  padding: 1px 6px;
  border-radius: 6px;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: .95rem;
  display: block;
  overflow-x: auto;
}
th, td { padding: 9px 10px; border-bottom: 1px solid rgba(127,140,160,.25); text-align: left; vertical-align: top; }
th { background: rgba(47,125,192,.12); font-family: "Oswald", sans-serif; font-weight: 500; }

/* Buttons und Eingaben */
button, .btn {
  font: inherit;
  cursor: pointer;
  border: 0;
  border-radius: 10px;
  padding: 9px 16px;
  background: var(--blue);
  color: #fff;
  font-weight: 600;
  transition: background .15s ease, transform .05s ease;
}
button:hover { background: var(--blue-dark); }
button:active { transform: translateY(1px); }
button.secondary { background: var(--teal); }
button.ghost { background: transparent; color: var(--text); border: 2px solid var(--blue); }
button.small { padding: 4px 10px; font-size: .9rem; }
button:disabled { opacity: .5; cursor: not-allowed; }

input[type="text"], input[type="number"], select {
  font: inherit;
  padding: 8px 10px;
  border-radius: 8px;
  border: 2px solid rgba(47,125,192,.35);
  background: var(--card);
  color: var(--text);
  max-width: 100%;
}
input:focus, select:focus, button:focus-visible, a:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 2px;
}

.feedback { font-weight: 700; margin-top: 10px; min-height: 1.5em; }
.feedback.ok { color: var(--green); }
.feedback.bad { color: var(--red); }

/* Quiz */
.quiz-q { font-size: 1.15rem; font-weight: 600; margin: 8px 0 14px; }
.quiz-opts { display: grid; gap: 10px; }
.quiz-opts button {
  background: var(--card);
  color: var(--text);
  border: 2px solid rgba(47,125,192,.3);
  text-align: left;
}
.quiz-opts button:hover:not(:disabled) { border-color: var(--blue); background: rgba(47,125,192,.08); }
.quiz-opts button.right { background: var(--ok); border-color: var(--green); }
.quiz-opts button.wrong { background: var(--bad); border-color: var(--red); }
.progress { height: 10px; background: rgba(127,140,160,.25); border-radius: 999px; overflow: hidden; margin: 10px 0 18px; }
.progress > div { height: 100%; background: var(--green); width: 0; transition: width .3s ease; }

/* Zuordnen */
.match-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px dashed rgba(127,140,160,.35);
}
.match-row .match-label { font-weight: 600; }
.match-row select { width: 100%; }
.match-row .mark { font-size: 1.3rem; min-width: 1.4em; text-align: center; }
@media (max-width: 560px) {
  .match-row { grid-template-columns: 1fr; }
}

/* Verschieben (Reihenfolge) */
.order-list { list-style: none; padding: 0; margin: 10px 0; }
.order-list li {
  display: flex; align-items: center; gap: 10px;
  background: var(--card);
  border: 2px solid rgba(47,125,192,.25);
  border-radius: 10px;
  padding: 8px 10px;
  margin-bottom: 8px;
  cursor: grab;
}
.order-list li.dragging { opacity: .5; }
.order-list li.over { border-color: var(--yellow); border-style: dashed; }
.order-list .num {
  font-family: "Oswald", sans-serif; font-size: 1.1rem; min-width: 1.8em; text-align: center;
  background: var(--blue); color: #fff; border-radius: 8px; padding: 2px 6px;
}
.order-list .txt { flex: 1; }
.order-list .ok { background: var(--ok); }
.order-list .bad { background: var(--bad); }
.order-list .move { display: flex; gap: 4px; }

/* Kreuzworträtsel */
.cw-wrap { overflow-x: auto; }
.cw {
  border-collapse: collapse;
  display: table;
  margin: 10px auto 16px;
  width: auto;
}
.cw td { padding: 0; border: 1px solid #7f8ca0; position: relative; width: 44px; height: 44px; background: var(--card); }
.cw td.block { background: var(--navy); border-color: var(--navy); }
.cw td input {
  width: 100%; height: 100%; border: 0; text-align: center;
  font-family: "Oswald", sans-serif; font-size: 1.25rem; text-transform: uppercase;
  background: transparent; color: var(--text); padding: 0;
}
.cw td .n {
  position: absolute; top: 1px; left: 3px; font-size: .6rem; color: var(--muted); pointer-events: none;
}
.cw td.good input { background: var(--ok); }
.cw td.bad input { background: var(--bad); }
.clues { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.clues ol { padding-left: 20px; margin: 6px 0; }
.clues li { margin-bottom: 6px; }
@media (max-width: 640px) { .clues { grid-template-columns: 1fr; } }

/* Terminal-Simulator */
.term {
  background: #0c1220;
  color: #d9f5e3;
  border-radius: 12px;
  padding: 14px;
  font-family: "Fira Code", Consolas, "Courier New", monospace;
  font-size: .92rem;
  min-height: 240px;
  max-height: 380px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.term .prompt { color: #7fd1ff; }
.term .err { color: #ff9aa9; }
.term-input-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.term-input-row input {
  flex: 1 1 160px; min-width: 0; font-family: "Fira Code", Consolas, monospace;
  background: #0c1220; color: #d9f5e3; border: 2px solid #2f7dc0;
}
.task-list { list-style: none; padding: 0; }
.task-list li {
  padding: 10px 12px; border-radius: 10px; margin-bottom: 8px;
  background: rgba(47,125,192,.08); display: flex; justify-content: space-between; gap: 10px; align-items: center; flex-wrap: wrap;
}
.task-list li.done { background: var(--ok); }
.task-list li.current { box-shadow: 0 0 0 3px var(--yellow); }
.task-list .status { font-weight: 700; }

/* Notenrechner */
.grade-result { font-family: "Oswald", sans-serif; font-size: 2rem; margin: 10px 0 0; }

.footer-note { color: var(--muted); font-size: .9rem; margin-top: 40px; text-align: center; }

.pill { display: inline-block; background: var(--yellow); color: var(--navy); border-radius: 6px; padding: 1px 8px; font-weight: 700; font-size: .85rem; }

@media (max-width: 600px) {
  main { padding: 16px 12px 60px; }
  .hero { padding: 24px 18px; }
  .card { padding: 16px; }
}
