:root {
  --bg: #f5f3ee;
  --surface: #ffffff;
  --surface-2: #faf8f3;
  --border: #e2ddd1;
  --text: #2a2722;
  --text-dim: #6f685c;
  --accent: #7a5c2e;      /* gedämpftes Gold/Braun */
  --accent-soft: #efe6d4;
  --good: #3f7d4f;
  --soft: #b0812a;
  --fail: #a6453b;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.04);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1915;
    --surface: #24211c;
    --surface-2: #2b271f;
    --border: #39342b;
    --text: #ece7dc;
    --text-dim: #9d9485;
    --accent: #c9a567;
    --accent-soft: #3a3226;
    --good: #6fae7d;
    --soft: #d4ad5a;
    --fail: #d98478;
    --shadow: 0 1px 3px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }
a { color: var(--accent); }

/* Layout */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 14px;
  padding: 12px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar .brand {
  font-family: var(--serif);
  font-size: 22px; letter-spacing: .5px;
  display: flex; align-items: center; gap: 10px;
}
.topbar .brand .mark { color: var(--accent); font-size: 20px; }
.topbar .spacer { flex: 1; }
.container { max-width: 980px; margin: 0 auto; padding: 24px 20px 80px; }

/* Buttons */
.btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 8px 14px; border-radius: 8px;
  font-size: 14px; font-weight: 500;
  transition: background .12s, border-color .12s, transform .05s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn.danger { color: var(--fail); }
.btn:disabled { opacity: .4; cursor: default; }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 16px;
}
.card.clickable { cursor: pointer; transition: transform .08s, box-shadow .12s; }
.card.clickable:hover { transform: translateY(-1px); box-shadow: 0 2px 6px rgba(0,0,0,.08), 0 12px 32px rgba(0,0,0,.08); }

.row { display: flex; align-items: center; gap: 12px; }
.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--text-dim); }
.small { font-size: 13px; }
h1,h2,h3 { font-family: var(--serif); font-weight: 600; }
h1 { font-size: 26px; margin: 0 0 4px; }
h2 { font-size: 20px; margin: 0; }
h3 { font-size: 17px; margin: 0; }
.eyebrow { text-transform: uppercase; letter-spacing: 1.5px; font-size: 11px; color: var(--accent); font-weight: 700; }

/* Progress */
.bar { height: 7px; background: var(--accent-soft); border-radius: 99px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.pill { font-size: 12px; padding: 2px 9px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.pill.due { background: color-mix(in srgb, var(--fail) 18%, transparent); color: var(--fail); }

/* Forms */
input[type=text], input[type=password], textarea, select {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface-2); color: var(--text);
  font-family: inherit; font-size: 15px;
}
textarea { resize: vertical; min-height: 120px; line-height: 1.55; }
textarea.serif { font-family: var(--serif); font-size: 16px; }
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 5px; font-weight: 600; }

/* Two-column EN/DE */
.bilingual { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 720px) { .bilingual { grid-template-columns: 1fr; } }
.col-label { font-size: 12px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--text-dim); margin-bottom: 6px; }

/* Learn surface */
.learn-text {
  font-family: var(--serif);
  font-size: 23px; line-height: 1.85;
  letter-spacing: .2px;
}
.learn-text .masked {
  color: transparent;
  border-bottom: 2px solid var(--accent);
  border-radius: 1px;
  user-select: none;
}
.learn-text .firstletter { color: var(--text-dim); }
.learn-text .line { display: block; margin: 2px 0; }
.learn-text .line.hidden { visibility: hidden; }
.learn-text .line.current { background: var(--accent-soft); border-radius: 6px; }

.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.segmented button { border: none; background: var(--surface); padding: 7px 13px; font-size: 13px; color: var(--text-dim); }
.segmented button.active { background: var(--accent); color: #fff; font-weight: 600; }

.ratings { display: flex; gap: 10px; }
.ratings .btn { flex: 1; }
.rate-good { border-color: var(--good) !important; color: var(--good); }
.rate-soft { border-color: var(--soft) !important; color: var(--soft); }
.rate-fail { border-color: var(--fail) !important; color: var(--fail); }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: flex-start; justify-content: center; padding: 48px 16px; z-index: 50; overflow-y: auto; }
.modal { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); width: 100%; max-width: 640px; padding: 24px; }

/* Login */
.login-wrap { max-width: 360px; margin: 14vh auto 0; text-align: center; }
.login-wrap .mark { font-size: 40px; color: var(--accent); }

.empty { text-align: center; padding: 60px 20px; color: var(--text-dim); }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 99px; font-size: 14px; z-index: 100; box-shadow: var(--shadow); }
.breadcrumb { font-size: 13px; color: var(--text-dim); margin-bottom: 6px; }
.breadcrumb a { cursor: pointer; }
.grid-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px,1fr)); gap: 10px; margin: 14px 0; }
.stat { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; text-align: center; }
.stat .n { font-size: 24px; font-family: var(--serif); font-weight: 600; }
.stat .l { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-dim); }
