/* ==========================================================================
   Noten-Buchstaben-Raetsel - gemeinsames Stylesheet
   Wird von index.html, notennamen.html, impressum.html und datenschutz.html
   eingebunden. Die Druck- und Download-Ansicht bringt ihr eigenes CSS mit
   (siehe buildPrintContent in index.html) und ist hiervon unabhaengig.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;

  /* Flaechen */
  --page-bg: #FDFDFB;          /* nahezu Weiss, nur eine Spur warm            */
  --bg:      #FFFFFF;          /* Karten, Notenblatt, Navigationsleiste       */
  --bg2:     #F5F6F2;          /* Eingabefelder                                */

  /* Schrift - leicht ins Gruene gezogenes Schwarz, harmoniert mit dem Grund */
  --text:  #1A2016;
  --text2: #55604D;
  --text3: #8B9484;

  /* Linien */
  --border:  rgba(26,32,22,0.13);
  --border2: rgba(26,32,22,0.24);
  --radius: 10px;
  --shadow: 0 1px 2px rgba(26,32,22,.05), 0 4px 14px rgba(26,32,22,.07);

  /* Akzente - Leitfarbe Gruen, damit sie mit dem Hintergrund harmoniert.
     Wer lieber das fruehere Violett moechte, ersetzt nur diese drei Zeilen:
     --accent: #6B4EE6;  --accent-dark: #4B32B8;  --accent-soft: #EEE9FF;   */
  --accent:      #2F7D4F;      /* Gruen  - Buttons, aktive Navigation */
  --accent-dark: #1E5C39;
  --accent-soft: #DDEEDF;
  --warm:        #C2600F;      /* Orange - Hervorhebungen             */
  --warm-soft:   #FBEEDD;
  --teal:        #0E7C86;      /* Blaugruen - Zahlen                  */
  --teal-soft:   #E0F1F3;
  --rose:        #B0446A;
  --rose-soft:   #FBEAF0;

  /* Von den SVG-Noten verwendet - Noten bleiben bewusst schwarz */
  --note-text:  #000000;
  --multi-text: #1B1A17;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page-bg: #161814;
    --bg:      #1D221A;
    --bg2:     #272D23;
    --text:    #E7EBE0;
    --text2:   #A3AB9B;
    --text3:   #6C7365;
    --border:  rgba(255,255,255,0.10);
    --border2: rgba(255,255,255,0.20);
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 14px rgba(0,0,0,.3);

    --accent:      #6FBF8B;
    --accent-dark: #9BD9B0;
    --accent-soft: #21402C;
    --warm:        #E8A86B;
    --warm-soft:   #3A2C1B;
    --teal:        #63C7D1;
    --teal-soft:   #12333A;
    --rose:        #E896B0;
    --rose-soft:   #3A1F29;

    --note-text:  #FFFFFF;
    --multi-text: #EDE9E1;
  }
}

body {
  font-family: var(--font);
  background: var(--page-bg);
  color: var(--text);
  min-height: 100vh;
  padding: 0 20px 72px;
  line-height: 1.6;
}

.wrap { margin: 0; }
body.page-app  .wrap { max-width: 1400px; }
body.page-text .wrap { max-width: 700px; }

/* ── Navigationsleiste ─────────────────────────────────────────────────── */

.topnav {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg);
  display: flex; flex-wrap: wrap; gap: 2px 4px;
  margin: 0 -20px 26px; padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 6px rgba(27,26,23,.05);
}
.topnav a {
  font-size: 13px; line-height: 20px; font-weight: 500;
  color: var(--text2); text-decoration: none;
  padding: 5px 11px; border-radius: 999px; white-space: nowrap;
  transition: background .12s, color .12s;
}
.topnav a:hover { background: var(--accent-soft); color: var(--accent-dark); }
.topnav a[aria-current="page"] { background: var(--accent); color: #fff; }

[id] { scroll-margin-top: 78px; }

/* ── Typografie ────────────────────────────────────────────────────────── */

h1 {
  font-size: 27px; font-weight: 700; line-height: 1.25;
  color: var(--accent-dark); margin-bottom: 8px;
  letter-spacing: -.01em;
}
h2 {
  font-size: 18px; font-weight: 600; margin: 30px 0 10px;
  color: var(--text);
}
h3 { font-size: 15px; font-weight: 600; margin: 20px 0 6px; color: var(--warm); }
p  { font-size: 15px; color: var(--text); margin-bottom: 12px; }
.lead { font-size: 15px; color: var(--text2); margin-bottom: 26px; }
.subtitle { font-size: 13px; color: var(--text2); margin-bottom: 20px; }
ul { margin: 0 0 12px 20px; }
li { font-size: 15px; margin-bottom: 5px; }
a  { color: var(--accent-dark); }

/* ── Karten und Hinweisboxen ───────────────────────────────────────────── */

.card, .box {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; margin: 16px 0;
  box-shadow: var(--shadow);
}
.box { background: var(--warm-soft); border-color: transparent; }
.tip {
  background: var(--accent-soft); border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 13px 16px; margin: 16px 0;
}
/* ── Formularelemente ──────────────────────────────────────────────────── */

.controls { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 14px; }
.sidebar  { display: flex; flex-direction: column; gap: 9px; }

textarea, input[type="text"], input[type="number"], select {
  font-family: var(--font); font-size: 15px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border2); border-radius: var(--radius);
  padding: 10px 12px;
}
textarea { flex: 1; min-width: 260px; resize: vertical; min-height: 74px; }
.field { width: 100%; margin-top: 3px; padding: 7px 11px; font-size: 14px; }
.field-label { display: block; font-size: 12px; font-weight: 500; color: var(--text2); }
select   { font-size: 14px; padding: 8px 12px; cursor: pointer; }
textarea:focus, input:focus, select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.btn {
  padding: 9px 16px; font-family: var(--font); font-size: 14px; font-weight: 600;
  background: var(--accent); color: #fff;
  border: 1px solid var(--accent); border-radius: var(--radius);
  cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-ghost { background: var(--bg); color: var(--accent-dark); border-color: var(--border2); }
.btn-ghost:hover { background: var(--accent-soft); border-color: var(--accent); }

/* ── Auswertungszeile ──────────────────────────────────────────────────── */

.stats { display: flex; gap: 6px; margin: 12px 0 28px 62px; flex-wrap: wrap; }
@media (max-width: 640px) { .stats { margin-left: 0; } }
.stat {
  display: flex; align-items: baseline; gap: 5px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 4px 10px;
  font-size: 11px; color: var(--text2); white-space: nowrap;
}
.stat b { font-size: 14px; font-weight: 700; line-height: 1.3; }
.stat:nth-child(1) b { color: var(--teal); }
.stat:nth-child(2) b { color: var(--accent); }
.stat:nth-child(3) b { color: var(--warm); }
.stat:nth-child(4) b { color: var(--rose); }
.stat:nth-child(n+5) b { color: var(--text2); }

/* ── Notenblatt ────────────────────────────────────────────────────────── */

#score { overflow-x: auto; }
#score > div { overflow-x: auto; }
#score svg {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.row-side {
  width: 56px; flex-shrink: 0;
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
}
.row-play {
  font-size: 11px; line-height: 1; padding: 5px 9px; cursor: pointer;
  color: var(--accent-dark); background: var(--accent-soft);
  border: 1px solid transparent; border-radius: 999px;
}
.row-play:hover { background: var(--accent); color: #fff; }
.clef-check {
  display: flex; align-items: center; gap: 4px;
  flex-shrink: 0;
  font-size: 11px; color: var(--text3); white-space: nowrap;
}
.pnote { cursor: pointer; }
.pnote:hover { fill: var(--accent) !important; }

/* ── Beispielkacheln ───────────────────────────────────────────────────── */

.examples { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.examples a {
  display: block; text-decoration: none; color: var(--text);
  background: var(--bg); border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius); padding: 13px 15px;
  box-shadow: var(--shadow);
  transition: transform .12s, box-shadow .12s;
}
.examples a:hover { transform: translateY(-2px); box-shadow: 0 4px 18px rgba(27,26,23,.12); }
.examples a:nth-child(6n+2) { border-left-color: var(--warm); }
.examples a:nth-child(6n+3) { border-left-color: var(--teal); }
.examples a:nth-child(6n+4) { border-left-color: var(--rose); }
.examples a:nth-child(6n+5) { border-left-color: var(--accent-dark); }
.examples a:nth-child(6n+6) { border-left-color: var(--warm); }
.examples strong { font-size: 14px; }
.examples span { display: block; font-size: 13px; color: var(--text2); margin-top: 4px; line-height: 1.5; }

/* ── Feedback ──────────────────────────────────────────────────────────── */

#feedback-section {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px;
  margin-top: 36px; max-width: 640px; box-shadow: var(--shadow);
}
#feedback-section h2 { margin-top: 0; }

/* ── Tabellen ──────────────────────────────────────────────────────────── */

table { border-collapse: collapse; width: 100%; font-size: 14px; margin: 8px 0 16px; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--border); }
th { font-size: 12px; color: var(--text2); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
td.note { font-weight: 700; white-space: nowrap; color: var(--accent-dark); }

/* ── Fussbereich ───────────────────────────────────────────────────────── */

footer {
  margin-top: 52px; padding-top: 16px; border-top: 1px solid var(--border);
  font-size: 12px; color: var(--text3);
  display: flex; gap: 16px; flex-wrap: wrap;
}
footer a { color: var(--text3); text-decoration: none; }
footer a:hover { color: var(--accent-dark); }

/* ── Uebungsseiten: Gehoerbildung und Notenwerte ───────────────────────── */

.opt-grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}
.trainer {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin: 18px 0 26px;
  box-shadow: var(--shadow);
}
.play-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.btn-big   { font-size: 16px; padding: 13px 30px; }
.btn-small { font-size: 12px; padding: 6px 12px; }

.question { font-size: 16px; font-weight: 600; margin-bottom: 12px; }
.display {
  display: flex; justify-content: center; align-items: center;
  min-height: 104px; margin-bottom: 18px; overflow-x: auto;
  color: var(--text);
}
.big-note { color: var(--text); }

.answer-grid {
  display: grid; gap: 9px;
  grid-template-columns: repeat(auto-fill, minmax(178px, 1fr));
  margin-bottom: 14px;
}
.answer { text-align: center; font-weight: 500; }
.glyph-answer {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 10px 8px;
}
.glyph-answer span { font-size: 12px; }

.answer.right {
  background: var(--accent-soft); border-color: var(--accent);
  color: var(--accent-dark); font-weight: 600;
}
.answer.wrong {
  background: var(--rose-soft); border-color: var(--rose); color: var(--rose);
}

.feedback { min-height: 22px; font-size: 14px; color: var(--text2); margin-bottom: 10px; }
.feedback.ok  { color: var(--accent-dark); font-weight: 600; }
.feedback.bad { color: var(--rose); font-weight: 600; }

.next-row { margin-bottom: 18px; }
.trainer .stats { margin-left: 0; }

.cell-note { width: 54px; color: var(--text); }

/* -- Startseite: Eingabe, Klappfelder ----------------------------------- */

.composer { margin-bottom: 18px; max-width: 1022px; }
.composer textarea {
  width: 100%; min-height: 92px; font-size: 16px;
  border-width: 2px; border-color: var(--border2);
}
.composer textarea:focus { border-color: var(--accent); }
.composer-foot {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; margin-top: 8px;
}
.pick { font-size: 12px; font-weight: 500; color: var(--text2); }
.pick select { display: block; margin-top: 3px; min-width: 240px; }
.counter { font-size: 11px; color: var(--text3); }

.panel {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 10px;
}
.panel > summary {
  list-style: none; cursor: pointer; padding: 13px 16px;
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px;
  position: relative; padding-right: 40px;
}
.panel > summary::-webkit-details-marker { display: none; }
.panel > summary::after {
  content: ""; position: absolute; right: 18px; top: 18px;
  width: 8px; height: 8px; border-right: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent); transform: rotate(45deg);
  transition: transform .15s;
}
.panel[open] > summary::after { transform: rotate(-135deg); top: 21px; }
.panel > summary:hover { background: var(--accent-soft); border-radius: var(--radius); }
.panel > summary strong { font-size: 15px; color: var(--text); }
.panel > summary span { font-size: 13px; color: var(--text2); }
.panel[open] > summary span { display: none; }
.panel-body { padding: 4px 16px 18px; }
.panel-body p { font-size: 14px; margin-bottom: 10px; }
.panel-body p:last-child { margin-bottom: 0; }
.box p:last-child, .tip p:last-child { margin-bottom: 0; }

#ueber {
  max-width: 700px; margin-top: 38px; padding-top: 30px;
  border-top: 1px solid var(--border);
}

.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text2); cursor: pointer; }
.check input { width: 15px; height: 15px; cursor: pointer; }
.check-row { display: flex; gap: 20px; flex-wrap: wrap; margin: 12px 0; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.hint { font-size: 12px; color: var(--text2); }

/* ── Druck ─────────────────────────────────────────────────────────────── */

@media print {
  .topnav, .no-print, .print-hide, .clef-check, footer { display: none !important; }
  body { padding: 8px; background: #fff; line-height: 1.4; }
  .wrap { max-width: 100%; }
  #score svg { border: none; box-shadow: none; }
}