/* ============================================================
   Arbeitsblätter — gemeinsame Stile
   Designprinzip: ruhig, warm, würdevoll. Keine kindliche Optik.
   ============================================================ */

:root {
  --bg: #fbf6ef;
  --paper: #ffffff;
  --ink: #2a2622;
  --muted: #6b6258;
  --line: #e6dccd;
  --line-strong: #c9bda9;
  --accent: #0d6e6e;
  --accent-soft: #d8ebea;
  --good: #4f8a3b;
  --good-soft: #e2f0d8;
  --bad: #b94d2a;
  --bad-soft: #fae4d6;
  --warm: #b58849;

  /* Die drei "Knöpfe für Bernd" — auswendig erkennbar */
  --grun: #3f8a36;       /* Neuer Zettel */
  --grun-dark: #2f6a28;
  --blau: #2c5f8a;       /* Meine Zettel */
  --blau-dark: #1f456a;
  --orange: #d9742a;     /* Speichern & zeigen */
  --orange-dark: #b75a18;

  --shadow: 0 1px 0 rgba(0,0,0,0.04), 0 12px 32px rgba(60,40,20,0.08);
  --shadow-strong: 0 2px 0 rgba(0,0,0,0.05), 0 16px 40px rgba(60,40,20,0.14);
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 22px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 18px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }
a:hover { text-decoration: underline; }

.page {
  max-width: 920px;
  margin: 0 auto;
  padding: 32px 24px 96px;
}

/* ----- Topbar -------------------------------------------------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.topbar .brand {
  font-weight: 600;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
}
.topbar .brand .emoji { margin-right: 8px; }
.topbar .nav-right { display: flex; gap: 10px; }

/* ----- Buttons ------------------------------------------------- */
.btn {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: var(--paper);
  color: var(--ink);
  padding: 10px 16px;
  font: inherit;
  font-size: 0.95rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all .15s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn:hover { background: #fff8ec; border-color: var(--warm); }
.btn.primary {
  background: var(--accent); color: #fff; border-color: var(--accent);
}
.btn.primary:hover { background: #0a5959; }
.btn.ghost { background: transparent; }

/* Die "großen Knöpfe" für die Startseite */
.big-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 48px 24px;
  border-radius: var(--radius-lg);
  border: none;
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  box-shadow: var(--shadow-strong);
  transition: transform .15s ease, box-shadow .15s ease;
  min-height: 240px;
}
.big-button:hover { transform: translateY(-3px); }
.big-button .ic {
  font-size: 4.5rem;
  line-height: 1;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.18));
}
.big-button .sub {
  font-size: 1rem;
  font-weight: 400;
  opacity: 0.85;
  font-style: italic;
}

.big-button.grun {
  background: linear-gradient(180deg, var(--grun) 0%, var(--grun-dark) 100%);
}
.big-button.blau {
  background: linear-gradient(180deg, var(--blau) 0%, var(--blau-dark) 100%);
}
.big-button.orange {
  background: linear-gradient(180deg, var(--orange) 0%, var(--orange-dark) 100%);
  color: #fff;
}

/* Inline "Speichern & zeigen"-Knopf im Sheet */
.btn.speichern {
  background: var(--orange); color: #fff; border-color: var(--orange);
  font-weight: 600; font-size: 1.05rem; padding: 12px 22px;
}
.btn.speichern:hover { background: var(--orange-dark); border-color: var(--orange-dark); }

/* ----- Home ---------------------------------------------------- */
.greeting {
  text-align: center;
  margin: 24px 0 36px;
}
.greeting h1 {
  font-size: 2.4rem;
  margin: 0 0 8px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.greeting p {
  margin: 0;
  color: var(--muted);
  font-style: italic;
}

.button-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
@media (max-width: 720px) {
  .button-grid { grid-template-columns: 1fr; }
}

.footer-small {
  margin-top: 56px;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}
.footer-small a { color: var(--muted); }

/* ----- Cards / Sektionen --------------------------------------- */
section.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 32px;
  margin: 24px 0;
}
section.card h2 {
  margin: 0 0 4px;
  font-size: 1.45rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
section.card .lead {
  color: var(--muted);
  font-style: italic;
  margin: 0 0 22px;
}

/* ----- Wortbank ------------------------------------------------ */
.wordbank {
  display: flex; flex-wrap: wrap; gap: 10px; padding: 18px;
  background: linear-gradient(180deg, #fbf3e2 0%, #f7ead2 100%);
  border: 1px solid #ecd9b5; border-radius: var(--radius-sm);
  margin-bottom: 22px;
}
.word {
  display: inline-block; padding: 9px 18px;
  background: #fff; border: 1.5px solid var(--line-strong);
  border-radius: 999px; cursor: pointer; font-size: 1.1rem;
  user-select: none; transition: all .12s ease;
}
.word:hover { transform: translateY(-1px); border-color: var(--warm); background: #fffdf6; }
.word.used { opacity: 0.25; pointer-events: none; }
.word.picked { background: var(--accent); border-color: var(--accent); color: #fff; transform: translateY(-1px); }

/* ----- Story / blanks ----------------------------------------- */
.story { font-size: 1.35rem; line-height: 2; color: #1d1a17; }
.blank {
  display: inline-block; min-width: 140px; padding: 2px 14px; margin: 0 2px;
  border-bottom: 2.5px solid var(--line-strong); text-align: center;
  cursor: pointer; color: var(--muted); transition: all .12s ease;
  vertical-align: baseline;
}
.blank::before {
  content: attr(data-placeholder); font-style: italic;
  font-size: 0.95rem; color: #b9ad97;
}
.blank.active {
  background: var(--accent-soft); border-bottom-color: var(--accent);
  border-radius: 6px 6px 0 0;
}
.blank.filled { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.blank.filled::before { content: ""; }
.blank.correct { background: var(--good-soft); border-bottom-color: var(--good); border-radius: 6px 6px 0 0; }
.blank.wrong { background: var(--bad-soft); border-bottom-color: var(--bad); border-radius: 6px 6px 0 0; }

/* ----- W-Fragen ------------------------------------------------ */
.qa-list { list-style: none; padding: 0; margin: 0; }
.qa-list li {
  display: flex; align-items: center; justify-content: space-between;
  gap: 18px; padding: 14px 0; border-bottom: 1px dashed var(--line);
}
.qa-list li:last-child { border-bottom: 0; }
.qa-list .q { font-size: 1.15rem; flex: 1; }
.qa-list .blank { min-width: 180px; }

/* ----- Silben -------------------------------------------------- */
.syllable-tray {
  display: flex; flex-wrap: wrap; gap: 10px; padding: 18px;
  background: #f4ece0; border: 1px solid #e0d2b8;
  border-radius: var(--radius-sm); margin-bottom: 20px;
}
.syllable {
  padding: 12px 22px; background: #fff;
  border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm);
  cursor: pointer; font-size: 1.2rem; font-weight: 500;
  user-select: none; transition: all .12s ease;
}
.syllable:hover { border-color: var(--warm); transform: translateY(-1px); }
.syllable.picked { background: var(--accent); border-color: var(--accent); color: #fff; }
.syllable.used { opacity: 0.18; pointer-events: none; }

.word-builder {
  background: #fafafa; border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-sm); padding: 14px; min-height: 60px;
  display: flex; align-items: center; gap: 10px;
  font-size: 1.25rem; color: var(--muted); margin-bottom: 16px;
}
.word-builder .preview { color: var(--ink); font-weight: 600; }
.word-builder .actions { margin-left: auto; }
.word-builder .actions .btn { padding: 6px 12px; font-size: 0.85rem; }

.built-list { list-style: none; padding: 0; margin: 16px 0 0; display: flex; flex-wrap: wrap; gap: 10px; }
.built-list li {
  padding: 9px 16px; border-radius: 999px; font-size: 1.05rem;
  background: var(--good-soft); border: 1px solid #b8d4a7; color: #2f5b1d;
}
.built-list li.wrong {
  background: var(--bad-soft); border-color: #e5b89c;
  color: var(--bad); text-decoration: line-through;
}

/* ----- Schreibweise ------------------------------------------- */
.spelling-row {
  display: flex; gap: 10px; flex-wrap: wrap;
  padding: 12px 0; border-bottom: 1px dashed var(--line);
}
.spelling-row:last-child { border-bottom: 0; }
.spelling-row .variant {
  padding: 9px 18px; border: 1.5px solid var(--line-strong);
  border-radius: 999px; background: #fff; cursor: pointer;
  font-size: 1.1rem; transition: all .12s ease;
}
.spelling-row .variant:hover { border-color: var(--warm); }
.spelling-row .variant.correct {
  background: var(--good-soft); border-color: var(--good);
  color: #2f5b1d; font-weight: 600;
}
.spelling-row .variant.wrong {
  background: var(--bad-soft); border-color: var(--bad);
  color: var(--bad); text-decoration: line-through;
}

/* ----- Vokale ------------------------------------------------- */
.vowel-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}
.vowel-row { display: flex; align-items: center; gap: 12px; }
.vowel-row .gap-word {
  font-family: "JetBrains Mono", "SF Mono", Menlo, monospace;
  font-size: 1.35rem; letter-spacing: 0.15em;
  padding: 10px 14px; background: #faf4e6;
  border: 1px solid var(--line); border-radius: var(--radius-sm); flex: 1;
}
.vowel-row input {
  width: 200px; padding: 10px 14px;
  border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm);
  font: inherit; font-size: 1.15rem; background: #fff;
}
.vowel-row input.correct { border-color: var(--good); background: var(--good-soft); }
.vowel-row input.wrong { border-color: var(--bad); background: var(--bad-soft); }

/* ----- Wortgitter --------------------------------------------- */
.grid-letters {
  font-family: "JetBrains Mono", "SF Mono", Menlo, monospace;
  font-size: 1.5rem; letter-spacing: 0.18em;
  padding: 24px; background: #faf4e6;
  border: 1.5px solid #e0d2b8; border-radius: var(--radius-sm);
  word-wrap: break-word; line-height: 1.8; text-align: center;
}
.grid-letters span.hit {
  background: var(--good-soft); border-radius: 4px;
  padding: 2px 0; color: #2f5b1d; font-weight: 700;
}
.find-list {
  list-style: none; padding: 0; margin: 18px 0 0;
  display: flex; flex-wrap: wrap; gap: 10px;
}
.find-list li {
  padding: 8px 16px; border: 1.5px solid var(--line-strong);
  border-radius: 999px; background: #fff; cursor: pointer;
  transition: all .12s ease; user-select: none;
}
.find-list li:hover { border-color: var(--warm); }
.find-list li.found {
  background: var(--good-soft); border-color: var(--good);
  text-decoration: line-through; color: #2f5b1d;
}

/* ----- Sektions-Footer ---------------------------------------- */
.section-foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 20px; gap: 12px; flex-wrap: wrap;
}
.feedback { font-style: italic; color: var(--muted); flex: 1; }
.feedback.good { color: var(--good); font-style: normal; font-weight: 600; }
.feedback.bad { color: var(--bad); font-style: normal; }

.celebration {
  display: none; text-align: center; padding: 36px;
  background: linear-gradient(180deg, #fff8e8, #fdeec3);
  border: 1.5px solid #e8c97e; border-radius: var(--radius);
  margin: 28px 0;
}
.celebration.show { display: block; }
.celebration h2 { font-size: 1.6rem; margin: 0 0 8px; }
.celebration p { margin: 0; color: var(--muted); }

.footer-actions {
  display: flex; justify-content: center; gap: 14px;
  margin: 32px 0; flex-wrap: wrap;
}

/* ----- Browse („Meine Zettel") -------------------------------- */
.date-group {
  margin: 32px 0;
}
.date-group h3 {
  font-size: 1.05rem; color: var(--muted); font-weight: 500;
  border-bottom: 1px solid var(--line); padding-bottom: 8px;
  margin: 0 0 14px;
}
.sheet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.sheet-card {
  display: flex; flex-direction: column; gap: 6px;
  padding: 18px; background: var(--paper);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); text-decoration: none; color: var(--ink);
  transition: all .15s ease;
}
.sheet-card:hover {
  transform: translateY(-2px); box-shadow: var(--shadow-strong);
  text-decoration: none; border-color: var(--warm);
}
.sheet-card .em { font-size: 2.4rem; line-height: 1; }
.sheet-card .ti { font-size: 1.15rem; font-weight: 600; }
.sheet-card .meta {
  font-size: 0.85rem; color: var(--muted);
  display: flex; justify-content: space-between;
}
.sheet-card.fertig { border-color: var(--good); background: var(--good-soft); }
.empty-state {
  text-align: center; padding: 60px 20px; color: var(--muted);
  font-style: italic;
}

/* ----- Admin --------------------------------------------------- */
.admin-form {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 24px;
  box-shadow: var(--shadow); margin-bottom: 28px;
}
.admin-form label {
  display: block; font-weight: 500; margin-bottom: 8px; color: var(--muted);
}
.admin-form input[type=text], .admin-form input[type=password] {
  width: 100%; padding: 12px 14px;
  border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm);
  font: inherit; font-size: 1rem; background: #fff; margin-bottom: 14px;
}
.admin-form .row { display: flex; gap: 12px; align-items: center; }
.topic-table { width: 100%; border-collapse: collapse; }
.topic-table th, .topic-table td {
  text-align: left; padding: 12px 8px;
  border-bottom: 1px solid var(--line);
}
.topic-table th { color: var(--muted); font-weight: 500; }
.tag {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 0.8rem; font-weight: 500;
}
.tag.seed     { background: #e3eff5; color: #2c5f8a; }
.tag.generiert { background: #f3e8d5; color: #b58849; }

.flash {
  padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 18px;
}
.flash.ok  { background: var(--good-soft); color: #2f5b1d; border: 1px solid #b8d4a7; }
.flash.err { background: var(--bad-soft); color: var(--bad); border: 1px solid #e5b89c; }

/* ----- Login (PIN für Bernd) ---------------------------------- */
.login-screen {
  max-width: 480px;
  margin: 60px auto;
  text-align: center;
}
.login-screen h1 {
  font-size: 2.2rem;
  margin: 0 0 8px;
  font-weight: 600;
}
.login-screen > p {
  color: var(--muted);
  font-style: italic;
  font-size: 1.15rem;
  margin: 0 0 18px;
}

.pin-display {
  font-family: "JetBrains Mono", "SF Mono", Menlo, monospace;
  font-size: 2.6rem;
  font-weight: 700;
  letter-spacing: 0.35em;
  padding: 22px 0;
  margin: 18px 0 8px;
  background: var(--paper);
  border: 2px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--ink);
  min-height: 80px;
  user-select: none;
}

.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 18px;
}
.pin-btn {
  appearance: none;
  font-family: inherit;
  font-size: 2rem;
  font-weight: 500;
  padding: 22px 0;
  background: var(--paper);
  color: var(--ink);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all .12s ease;
  box-shadow: var(--shadow);
}
.pin-btn:hover {
  background: #fff8ec;
  border-color: var(--warm);
  transform: translateY(-2px);
}
.pin-btn:active {
  transform: translateY(0);
  background: var(--accent-soft);
}
.pin-clear {
  background: var(--bad-soft) !important;
  border-color: var(--bad) !important;
  color: var(--bad);
  font-size: 1.1rem !important;
  font-weight: 600;
}
.pin-ok {
  background: var(--grun) !important;
  border-color: var(--grun-dark) !important;
  color: #fff !important;
  font-size: 1.4rem !important;
  font-weight: 600;
}
.pin-ok:hover {
  background: var(--grun-dark) !important;
}

.login-err {
  background: var(--bad-soft);
  color: var(--bad);
  padding: 14px 18px;
  border-radius: var(--radius);
  border: 1px solid #e5b89c;
  font-style: italic;
  margin: 14px 0;
}

/* ----- Print --------------------------------------------------- */
@media print {
  body { background: #fff; font-size: 12pt; }
  .topbar, .footer-actions, .btn, .actions { display: none !important; }
  section.card {
    box-shadow: none; border: 1px solid #ccc;
    page-break-inside: avoid; margin: 12px 0; padding: 18px 22px;
  }
  .word.used { display: none; }
  .blank::before { content: ""; }
  .blank { border-bottom: 1.5px solid #888; min-width: 120px; }
  .syllable.used { display: none; }
  .greeting h1, section.card h2 { page-break-after: avoid; }
  .page { max-width: none; padding: 0; }
}
