:root {
    --bg: #1e1e2e;
    --panel: #27293d;
    --text: #e8e8f0;
    --muted: #a6a6b8;
    --accent: #7aa2f7;
    --good: #9ece6a;
    --bad: #f7768e;
    --border: #3a3d52;
  }
  * { box-sizing: border-box; }
  body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", system-ui, sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
  }
  .container { width: 100%; max-width: 640px; padding: 24px; }

  header h1 { font-size: 1.3rem; margin: 0 0 4px; }
  header p { color: var(--muted); margin: 0 0 16px; font-size: .9rem; }

  .progress-label {
    display: flex; justify-content: space-between; align-items: baseline;
    color: var(--muted); font-size: .85rem; margin-bottom: 6px; gap: 12px;
  }
  .run-label { color: var(--muted); font-size: .85rem; }
  .quiz-header {
    display: flex; justify-content: space-between; align-items: baseline;
    margin-bottom: 10px; gap: 12px;
  }
  .test-name { color: var(--accent); font-weight: 600; font-size: .9rem; text-align: right; }
  .progress-bar {
    height: 10px; border-radius: 5px; background: var(--border); overflow: hidden;
  }
  .progress-bar > div {
    height: 100%; width: 0; background: var(--good);
    transition: width .4s ease;
  }

  #menuView h2 { margin: 24px 0 0; color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: 1px; }
  .test-list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
  .test-entry {
    display: flex; align-items: center; justify-content: space-between;
    background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
    padding: 16px 18px; color: var(--text); cursor: pointer; text-align: left;
    transition: all .15s ease; width: 100%;
  }
  .test-entry:hover { border-color: var(--accent); transform: translateX(3px); }
  .test-name-row { font-weight: 600; font-size: 1rem; }
  .test-progress { color: var(--muted); font-size: .8rem; margin-top: 3px; }
  .test-completed { color: var(--good); font-size: .8rem; margin-top: 3px; font-weight: 600; }
  .test-arrow { color: var(--muted); font-size: 1.2rem; margin-left: 12px; }

  .card {
    margin-top: 24px; background: var(--panel);
    border: 1px solid var(--border); border-radius: 12px; padding: 28px;
    min-height: 260px; display: flex; flex-direction: column; gap: 16px;
  }
  .label { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: 1px; }
  .text { font-size: 1.35rem; line-height: 1.5; margin: 0; }
  .grammar {
    color: var(--accent); font-size: .9rem;
    display: flex; flex-direction: column; gap: 4px;
  }
  .grammar-link {
    display: block; width: 100%; text-align: left;
    background: none; border: none; color: var(--accent); cursor: pointer;
    font-size: .9rem; padding: 0; text-decoration: underline;
  }
  .grammar-link:hover { color: var(--text); }
  .grammar-plain { display: block; color: var(--muted); font-size: .9rem; }

  .btn {
    border: none; border-radius: 8px; padding: 14px 20px;
    font-size: 1rem; cursor: pointer; color: var(--text);
    background: var(--accent); transition: filter .15s;
  }
  .btn:hover { filter: brightness(1.1); }
  .btn.good { background: var(--good); color: #1e1e2e; }
  .btn.bad { background: var(--bad); color: #1e1e2e; }
  .btn-row { display: flex; gap: 12px; margin-top: auto; }
  .btn-row .btn { flex: 1; }
  .kbd { font-size: .75rem; opacity: .7; }
  .version { color: var(--muted); font-size: .9rem; font-weight: 400; margin-left: 8px; }
  .hint { color: var(--accent); font-style: italic; font-size: .95rem; margin: 0; }

  .hidden { display: none !important; }

  /* Anmeldung */
  .login-panel { margin-top: 24px; max-width: 380px; width: 100%; }
  #loginView { display: flex; justify-content: center; }
  .login-hint { color: var(--muted); font-size: .9rem; margin: 0 0 16px; }
  .login-error { color: var(--bad); font-size: .9rem; margin: 12px 0 0; }
  .token-input {
    width: 100%; padding: 14px; font-size: 1.2rem; letter-spacing: 4px;
    text-transform: uppercase; background: var(--bg); color: var(--text);
    border: 1px solid var(--border); border-radius: 8px; margin-bottom: 14px;
  }
  .token-input:focus { outline: none; border-color: var(--accent); }

  #userBar {
    display: flex; justify-content: space-between; align-items: baseline;
    margin-top: 12px; color: var(--muted); font-size: .9rem;
  }

  .site-footer { margin-top: 24px; text-align: center; color: var(--muted); font-size: .85rem; }
  .site-footer a { color: var(--muted); }
  .link-btn {
    background: none; border: none; color: var(--accent);
    cursor: pointer; font-size: .85rem; padding: 0; margin-top: 4px;
    text-decoration: underline;
  }
  .link-btn:hover { color: var(--text); }

  .case-table { width: 100%; border-collapse: collapse; margin: 12px 0; }
  .case-table th, .case-table td {
    text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border);
    font-size: .95rem;
  }
  .case-table th {
    color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: 1px;
  }
  .case-table .russ { font-weight: 700; }
  .case-note { color: var(--muted); font-size: .9rem; font-style: italic; }

  .case-q { color: var(--muted); font-size: .7rem; font-weight: 400; display: block; }
  .noun-table tr.active td { background: rgba(122,162,247,.18); }
  .overlay .panel h3 { margin: 18px 0 6px; font-size: .95rem; }

  #feedback { font-weight: 600; text-align: center; min-height: 1.5em; }

  .footer { margin-top: 16px; text-align: right; }
  .footer button {
    background: none; border: none; color: var(--muted);
    cursor: pointer; font-size: .85rem; text-decoration: underline;
  }
  .footer button:hover { color: var(--text); }

  /* Overlays (Statistik und Fall-Tabelle) */
  .overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.6);
    display: flex; align-items: center; justify-content: center; z-index: 10;
  }
  .overlay .panel {
    background: var(--panel); border: 1px solid var(--border);
    border-radius: 12px; padding: 24px; max-width: 560px; width: 90%;
    max-height: 80vh; overflow: auto;
  }
  .overlay h2 { margin: 0 0 12px; }
  .stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 16px; }
  .stat-grid div {
    background: var(--bg); border-radius: 8px; padding: 10px 14px;
  }
  .stat-grid .num { font-size: 1.2rem; font-weight: 700; display: block; }
  .stat-grid .cap { font-size: .75rem; color: var(--muted); text-transform: uppercase; }
  .hardest { list-style: none; margin: 0; padding: 0; }
  .hardest li {
    padding: 8px 0; border-bottom: 1px solid var(--border);
    font-size: .9rem;
  }
  .hardest .wrong { color: var(--bad); font-weight: 700; }

  .runs { list-style: none; margin: 0; padding: 0; }
  .runs li {
    padding: 8px 0; border-bottom: 1px solid var(--border);
    font-size: .9rem;
  }
  .runs .runs-status { color: var(--muted); font-style: italic; }
  .runs .runs-status.current { color: var(--good); font-style: normal; font-weight: 600; }

  .close-btn { margin-top: 16px; width: 100%; }
  .done h2 { color: var(--good); }
  .done .btn { margin-top: 12px; align-self: flex-start; }
  .done .btn:disabled { opacity: .5; cursor: default; }
