:root {
  --bg: #faf7f2;
  --card: #ffffff;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e7e1d8;
  --accent: #9a3412;
  --accent-soft: #fde8dc;
  --ok: #15803d;
  --ok-soft: #dcfce7;
  --bad: #b91c1c;
  --bad-soft: #fee2e2;
  --warn: #b45309;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.05);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17140f; --card: #221e18; --ink: #ede7dd; --muted: #a8a093; --line: #3a332a;
    --accent: #fb923c; --accent-soft: #3b2416; --ok: #4ade80; --ok-soft: #14301f;
    --bad: #f87171; --bad-soft: #3a1a1a; --warn: #fbbf24;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 16px/1.5 system-ui, "Segoe UI", Roboto, sans-serif; }
h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; line-height: 1.2; }
h1 { font-size: 1.7rem; margin: 0 0 .3rem; }
h2 { font-size: 1.3rem; margin: 1.6rem 0 .7rem; }
h3 { font-size: 1.05rem; margin: 1.2rem 0 .5rem; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

header.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--card);
}
header.top .brand { font-family: Georgia, serif; font-weight: 700; color: var(--accent); font-size: 1.15rem; }
main { max-width: 860px; margin: 0 auto; padding: 20px 16px 60px; }
main.wide { max-width: 1100px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card + .card { margin-top: 14px; }
.grid { display: grid; gap: 12px; }
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.stat .v { font-size: 1.6rem; font-weight: 700; }
.stat .l { font-size: .82rem; color: var(--muted); }

button, .btn {
  font: inherit; cursor: pointer; border: 1px solid var(--line); background: var(--card); color: var(--ink);
  padding: 9px 16px; border-radius: 10px; transition: transform .05s, background .15s;
}
button:hover { background: var(--accent-soft); }
button:active { transform: translateY(1px); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.primary:hover { filter: brightness(1.08); background: var(--accent); }
button.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
button.bad { background: var(--bad); border-color: var(--bad); color: #fff; }
button.big { padding: 14px 22px; font-size: 1.05rem; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.link { border: none; background: none; color: var(--accent); padding: 4px 6px; }

input[type=text], input[type=password], input[type=email], input[type=time], input[type=date], select, textarea {
  font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; width: 100%;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { min-height: 220px; font-family: ui-monospace, Consolas, monospace; font-size: .9rem; }
label { display: block; font-size: .9rem; color: var(--muted); margin: 10px 0 4px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }

table.list { width: 100%; border-collapse: collapse; font-size: .93rem; }
table.list th { text-align: left; color: var(--muted); font-weight: 500; font-size: .82rem; padding: 6px 8px; border-bottom: 1px solid var(--line); }
table.list td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list tr.click { cursor: pointer; }
table.list tr.click:hover td { background: var(--accent-soft); }
.scroll-x { overflow-x: auto; }

.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .8rem; font-weight: 600; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.warn { background: #fef3c7; color: #92400e; }
.pill.neutral { background: var(--accent-soft); color: var(--accent); }

.bar { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--ok); }

.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.tabs button { border: none; border-bottom: 3px solid transparent; border-radius: 0; background: none; padding: 10px 14px; color: var(--muted); }
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

.msg { padding: 10px 14px; border-radius: 10px; margin: 10px 0; }
.msg.err { background: var(--bad-soft); color: var(--bad); }
.msg.ok { background: var(--ok-soft); color: var(--ok); }
.msg.warn { background: #fef3c7; color: #92400e; }

/* Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-wrap .card { width: 100%; max-width: 380px; }

/* Lektionsauswahl */
.lesson { color: var(--ink); font-size: 1rem; margin: 0; display: flex; gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.lesson + .lesson { margin-top: 8px; }
.lesson:hover { background: var(--accent-soft); }
.lesson input { width: 20px; height: 20px; accent-color: var(--accent); }
.lesson .t { font-weight: 600; }
.lesson .info { flex: 1; min-width: 0; }

/* Karteikarte */
.flash { text-align: center; padding: 34px 18px; min-height: 260px; display: flex; flex-direction: column; justify-content: center; gap: 14px; }
.flash .dir { font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.flash .prompt { font-family: Georgia, serif; font-size: clamp(1.5rem, 5vw, 2.2rem); }
.flash .answer { font-size: 1.3rem; color: var(--accent); font-weight: 600; }
.flash .note { font-size: .9rem; color: var(--muted); }
.kbd { font-size: .75rem; color: var(--muted); }

.test-input { font-size: 1.25rem !important; text-align: center; max-width: 460px; margin: 0 auto; }
.result-item { display: grid; grid-template-columns: 26px 1fr; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.result-item .mark { font-weight: 700; }
.result-item .mark.ok { color: var(--ok); }
.result-item .mark.bad { color: var(--bad); }

.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; z-index: 10; }
.modal { background: var(--card); border-radius: var(--radius); padding: 20px; width: 100%; max-width: 720px; }

@media (max-width: 600px) {
  .hide-sm { display: none; }
  main { padding-top: 14px; }
}
