:root {
  --bg-1: #f1f5f9;
  --bg-2: #e2e8f0;
  --bg-3: #1e3a8a;
  --ink: #0f172a;
  --ink-soft: #64748b;
  --ink-on-dark: #f1f5f9;
  --paper: #ffffff;
  --paper-alt: #f1f5f9;
  --line: #cbd5e1;
  --border-strong: #94a3b8;
  --line-dark: #2563eb;
  --accent: #f59e0b;
  --accent-light: #fbbf24;
  --accent-dark: #b45309;
  --accent-2: #0ea5e9;
  --ok: #10b981;
  --ok-bg: rgba(16, 185, 129, 0.14);
  --warn: #e11d48;
  --warn-bg: rgba(225, 29, 72, 0.12);
  --pending: #f59e0b;
  --pending-bg: rgba(245, 158, 11, 0.14);
  --star: #d97706;
  font-size: 20px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: linear-gradient(160deg, var(--bg-1) 0%, var(--bg-2) 60%, #cbd5e1 100%);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-user-select: none;
  user-select: none;
}

h1, h2, h3 { margin: 0; }

h1, .measure-title, .listen-btn, .check-btn, .level-card-title,
.tempo-btn, .feedback {
  font-weight: 800;
}

.level-card-number, .count-in-number, .points-popup-value {
  font-family: ui-monospace, "Cascadia Code", "Roboto Mono", Consolas, monospace;
}

/* Die Noten-/Pausen-SVGs (Palette, platzierte Noten, Level-Kacheln) sind
   fest dunkel gefüllt (#1a1a1a) - auf dem jetzt hellen Kartengrund von
   Natur aus gut lesbar, kein Filtertrick mehr nötig (anders als in der
   ersten, dunklen Testversion). */

/* ---------- Toolbar ---------- */

.toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 24px;
  background: var(--bg-3);
  color: var(--ink-on-dark);
  position: sticky;
  top: 0;
  z-index: 20;
  flex-wrap: wrap;
  border-bottom: 4px solid var(--line-dark);
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.35);
}

.toolbar h1 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent-light);
  white-space: nowrap;
}

/* Führt immer zurück zur App-Übersicht (eigenes Repo) - bewusst getrennt
   vom In-App-"Level wählen"-Knopf (der nur zum vorherigen Bildschirm
   INNERHALB der App führt) und deshalb ganz links, dauerhaft sichtbar. */
.toolbar-home-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.1;
  text-decoration: none;
  color: var(--accent-light);
  padding: 4px 10px;
  border-radius: 10px;
  flex: none;
  margin-left: auto;
}
.toolbar-home-link:hover { background: rgba(255, 255, 255, 0.1); }
.toolbar-home-arrow { font-size: 1.3rem; }
.toolbar-home-label { font-size: 0.62rem; font-weight: 700; margin-top: 1px; }

.toolbar-progress {
  display: flex;
  gap: 16px;
  font-size: 1rem;
  font-weight: 600;
  flex: 1 1 auto;
  justify-content: center;
  flex-wrap: wrap;
}

/* Dunkler "Chip"-Knopf, bewusst unabhängig davon, ob er gerade in der
   dunklen Toolbar oder unten über dem hellen Seiteninhalt sitzt - so
   bleibt der Amber-auf-Dunkel-Kontrast überall gleich gut lesbar (Amber
   auf Weiß wäre zu blass). */
.btn {
  font-size: 1.05rem;
  font-weight: 700;
  padding: 10px 18px;
  border: 2px solid var(--line-dark);
  border-radius: 12px;
  background: var(--bg-3);
  color: var(--accent-light);
  cursor: pointer;
  min-height: 44px;
  transition: transform 0.12s ease, background 0.15s;
}
.btn:hover { background: #1d4ed8; }
.btn:active { transform: scale(0.96); }

.btn-secondary { background: var(--bg-3); }

/* ---------- Level-Auswahl ---------- */

.level-select-hint {
  text-align: center;
  color: var(--ink-soft);
  font-weight: 600;
  margin: 22px 0 4px;
}

.level-select-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  padding: 4px 0 24px;
}

/* Jede Level-Karte bekommt einen eigenen Farbakzent aus einer festen Palette
   (reihum, nicht zufällig) - macht die Übersicht bunter/lebendiger, ohne dass
   die Farbe irgendetwas über den Schwierigkeitsgrad aussagen soll. */
.level-card {
  --card-accent: var(--accent);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 18px 20px;
  background: var(--paper);
  color: var(--ink);
  border: 2px solid var(--line);
  border-top: 6px solid var(--card-accent);
  border-radius: 20px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.15);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.level-card:nth-child(1) { --card-accent: #d97706; }
.level-card:nth-child(2) { --card-accent: #0284c7; }
.level-card:nth-child(3) { --card-accent: #0d9488; }
.level-card:nth-child(4) { --card-accent: #e11d48; }
.level-card:nth-child(5) { --card-accent: #7c3aed; }
.level-card:nth-child(6) { --card-accent: #059669; }

.level-card:hover { transform: translateY(-4px); box-shadow: 0 14px 28px rgba(15, 23, 42, 0.22); }
.level-card:active { transform: translateY(-1px) scale(0.99); }
.level-card.is-done { background: var(--ok-bg); }

.level-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}
.level-card-number {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--card-accent);
}
.level-card-check {
  color: var(--ok);
  font-weight: 700;
  font-size: 1.2rem;
}

.level-card-title {
  font-size: 1.15rem;
  font-weight: 700;
}

.level-card-icons {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.level-card-icon {
  width: 20px;
  height: 24px;
}
.level-card-icon svg { width: 100%; height: 100%; display: block; }

.level-card-meter {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-soft);
}

/* ---------- Fortschritt im Level (Sterne-Reihe) ---------- */

.round-progress {
  display: flex;
  justify-content: center;
  padding: 16px 24px 0;
}

.round-dots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
}

.round-dot {
  font-size: 1.3rem;
  line-height: 1;
  color: var(--line);
}

.round-dot.is-done {
  color: var(--star);
  text-shadow: 0 1px 3px rgba(15, 23, 42, 0.25);
}

/* ---------- Ziel-Rhythmus anhören ---------- */

.listen-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 18px 24px 4px;
}

.listen-btn {
  padding: 18px 36px;
  border: 2px solid var(--accent-dark);
  border-radius: 999px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--bg-3);
  background: linear-gradient(135deg, var(--accent-light) 0%, var(--accent) 100%);
  box-shadow: 0 10px 22px rgba(245, 158, 11, 0.4);
  cursor: pointer;
  min-height: 60px;
  transition: transform 0.12s ease;
}
.listen-btn:hover { transform: translateY(-2px); }
.listen-btn:active { transform: scale(0.97); }

.listen-btn:disabled {
  opacity: 0.6;
  cursor: default;
  transform: none;
}

.listen-hint {
  margin: 0;
  font-size: 0.8rem;
  color: var(--ink-soft);
  text-align: center;
}

.tempo-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.tempo-btn {
  padding: 9px 16px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s, border-color 0.15s;
}
.tempo-btn:hover { border-color: var(--accent); transform: translateY(-1px); }
.tempo-btn.is-selected {
  border-color: var(--accent-dark);
  background: linear-gradient(135deg, var(--accent-light) 0%, var(--accent) 100%);
  color: var(--bg-3);
}

/* Einzähler-Overlay: schwebt transparent über der ganzen Takt-Karte, solange
   "Rhythmus anhören" vorzählt - bewusst kein Hintergrund, damit das Raster
   dahinter sichtbar bleibt (gleiche Lösung wie im Rhythmus-Generator). */
.count-in-overlay {
  position: absolute;
  inset: 0;
  z-index: 7;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 4px 0 28px;
  pointer-events: none;
}
.count-in-overlay[hidden] { display: none; }

.count-in-number {
  font-size: 6rem;
  font-weight: 700;
  color: var(--accent-dark);
  opacity: 0.9;
  line-height: 1;
}
.count-in-number.bounce { animation: countInBounce 0.25s ease-out; }
@keyframes countInBounce {
  0% { transform: scale(1.4); opacity: 1; }
  100% { transform: scale(1); opacity: 0.9; }
}

.count-in-dots { display: flex; gap: 8px; }
.count-in-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--line);
  transition: background 0.15s;
}
.count-in-dot.active { background: var(--accent); }

/* ---------- Takt-Karte (Versuch des Kindes) ---------- */

main {
  padding: 0 24px 140px;
  max-width: 720px;
  margin: 0 auto;
}

.score {
  padding: 16px 0 4px;
}

.measures {
  display: flex;
  flex-direction: column;
}

.measure {
  position: relative;
  background: var(--paper);
  border: 3px solid var(--line);
  border-radius: 20px;
  padding: 12px 16px 16px;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.15);
  transition: border-color 0.15s, background 0.15s;
}

.measure.status-offen { border-color: var(--pending); background: var(--pending-bg); }
.measure.status-voll { border-color: var(--ok); background: var(--ok-bg); }
.measure.status-uebervoll { border-color: var(--warn); background: var(--warn-bg); }

.measure.status-uebervoll .slot-track {
  -webkit-mask-image: linear-gradient(to right, black 0, black 92%, transparent 100%);
  mask-image: linear-gradient(to right, black 0, black 92%, transparent 100%);
}

.measure-header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.measure-title {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--accent-dark);
}

.measure-clear {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  background: var(--paper-alt);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  white-space: nowrap;
}
.measure-clear:hover { border-color: var(--accent); color: var(--ink); }

.track-column {
  min-width: 0;
}

.slot-track {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 96px;
  width: 100%;
  border: 2px dashed var(--line);
  border-radius: 14px;
  overflow: visible;
}

.beat-tick {
  position: absolute;
  top: 0;
  bottom: 0;
  pointer-events: none;
}

/* Laufender Zeigebalken beim Vorspielen des Ziel-Rhythmus (nach einem
   etwaigen Einzähler) - zusätzliches visuelles Feedback dazu, wo im Takt man
   sich gerade befindet, analog zum Rhythmus-Generator. */
.playhead {
  position: absolute;
  top: -6px;
  bottom: -6px;
  left: 0;
  width: 4px;
  margin-left: -2px;
  background: var(--accent-2);
  border-radius: 2px;
  box-shadow: 0 0 10px rgba(14, 165, 233, 0.6);
  pointer-events: none;
  z-index: 6;
  display: none;
}
.playhead.active { display: block; }

.slot-track.drag-over {
  border-color: var(--accent);
  background-color: rgba(245, 158, 11, 0.12);
}

.measure-warning {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.measure-warning[hidden] { display: none; }
.measure-warning span {
  background: var(--warn);
  color: #ffffff;
  padding: 8px 18px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 1rem;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.3);
}

.beat-labels {
  display: grid;
  margin-top: 4px;
  border: 2px solid transparent;
  font-size: 0.75rem;
  color: var(--ink-soft);
  text-align: center;
}
.beat-labels span:nth-child(odd) { font-weight: 700; color: var(--ink); }

.placed-note {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--paper);
  border: 3px solid var(--border-strong);
  color: var(--ink);
  border-radius: 10px;
  cursor: grab;
  touch-action: none;
  align-self: stretch;
}

.slot-track > .placed-note,
.slot-track > .placed-note-pair {
  position: absolute;
  top: 0;
  bottom: 0;
}

.placed-note .icon,
.insert-preview .icon {
  position: absolute;
  left: calc(var(--anchor-pct, 25) * 1% - 12.2px);
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 40px;
}
.placed-note .icon svg,
.insert-preview .icon svg { width: 100%; height: 100%; display: block; }

.placed-note .delete-btn {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  background: var(--paper);
  color: var(--ink);
  font-size: 0.9rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}
.placed-note .delete-btn:hover { background: var(--warn); color: #ffffff; border-color: var(--warn); }

.placed-note-pair {
  position: relative;
  display: flex;
  background: var(--paper);
  border: 3px solid var(--border-strong);
  border-radius: 10px;
  align-self: stretch;
}

.eighth-half {
  position: relative;
  flex: 0 0 50%;
  cursor: grab;
  touch-action: none;
}

.eighth-half .icon {
  position: absolute;
  left: calc(50% - 12.2px);
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 40px;
}
.eighth-half .icon svg { width: 100%; height: 100%; display: block; }

.eighth-half .delete-btn {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  background: var(--paper);
  color: var(--ink);
  font-size: 0.9rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}
.eighth-half .delete-btn:hover { background: var(--warn); color: #ffffff; border-color: var(--warn); }
.eighth-half .delete-btn-left { right: auto; left: -10px; }

.beam-bar {
  position: absolute;
  top: calc(50% - 20px);
  left: calc(25% + 5.8px);
  width: 50%;
  height: 6px;
  background: var(--ink);
  pointer-events: none;
}

.insert-preview {
  position: absolute;
  top: 0;
  bottom: 0;
  border: 2px dashed var(--accent);
  border-radius: 10px;
  background: rgba(245, 158, 11, 0.14);
  opacity: 0.85;
  z-index: 3;
}
.insert-preview .icon { opacity: 0.7; }

.measure.preview-overfull {
  border-color: var(--warn);
  background: var(--warn-bg);
}
.measure.preview-overfull .insert-preview {
  border-color: var(--warn);
  background: rgba(225, 29, 72, 0.12);
}
.measure.preview-overfull .slot-track {
  -webkit-mask-image: linear-gradient(to right, black 0, black 92%, transparent 100%);
  mask-image: linear-gradient(to right, black 0, black 92%, transparent 100%);
}

.dragging-source {
  display: none !important;
}

/* Feedback nach "Fertig / Prüfen": richtige Noten bekommen einen grünen
   Rahmen und bleiben stehen; falsche fliegen kurz animiert aus dem Raster,
   bevor sie aus dem Zustand entfernt werden (siehe onCheck in script.js). */
.placed-note.note-correct {
  border-color: var(--ok);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.3);
}
.eighth-half.note-correct {
  box-shadow: inset 0 0 0 3px var(--ok), 0 0 0 3px rgba(16, 185, 129, 0.3);
  border-radius: 6px;
}

.placed-note.note-wrong-removing,
.eighth-half.note-wrong-removing {
  animation: noteFlyOut 0.55s ease-in forwards;
  pointer-events: none;
}
@keyframes noteFlyOut {
  0% { transform: translateY(0) scale(1) rotate(0deg); opacity: 1; }
  100% { transform: translateY(-46px) scale(0.6) rotate(-12deg); opacity: 0; }
}

/* Nach 5 Fehlversuchen automatisch eingeblendete Lösungs-Noten - bewusst
   anders markiert als selbst richtig gebaute (gestrichelt/amber statt grün),
   damit klar bleibt, was das Kind selbst geschafft hat. */
.placed-note.note-revealed {
  border-style: dashed;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.25);
}
.eighth-half.note-revealed {
  box-shadow: inset 0 0 0 3px var(--accent), 0 0 0 3px rgba(245, 158, 11, 0.25);
  border-radius: 6px;
}

/* ---------- Palette (Noten/Pausen getrennt, wie im Rhythmus-Generator -
   nur die für das Level erlaubten Karten) ---------- */

.palette {
  padding: 10px 0 4px;
}

.palette-columns {
  display: flex;
  align-items: flex-start;
  gap: 20px;
}

.palette-group {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.palette-group + .palette-group {
  border-left: 2px solid var(--line);
  padding-left: 20px;
}
.palette-group h3 {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}

.palette-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

@media (max-width: 480px) {
  .palette-columns { flex-direction: column; gap: 14px; }
  .palette-group + .palette-group {
    border-left: none;
    padding-left: 0;
    border-top: 2px solid var(--line);
    padding-top: 12px;
  }
}

.note-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  background: var(--paper);
  color: var(--ink);
  border: 3px solid var(--border-strong);
  border-radius: 12px;
  cursor: grab;
  touch-action: none;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.12);
  transition: transform 0.12s ease;
}
.note-card:active { transform: scale(0.96); cursor: grabbing; }

.note-card .icon {
  width: 32px;
  height: 38px;
  flex: none;
}
.note-card .icon svg { width: 100%; height: 100%; display: block; }

.note-card .label {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.note-card .label .name {
  font-weight: 700;
  font-size: 0.85rem;
}
.note-card .label .beats {
  font-size: 0.7rem;
  color: var(--ink-soft);
}

/* ---------- Feedback-Banner ---------- */

.feedback {
  margin: 16px auto 0;
  max-width: 480px;
  padding: 14px 20px;
  border-radius: 16px;
  text-align: center;
  font-weight: 700;
  font-size: 1.1rem;
}
.feedback[hidden] { display: none; }
.feedback-correct {
  background: var(--ok-bg);
  color: #047857;
  border: 2px solid var(--ok);
}
.feedback-wrong {
  background: var(--pending-bg);
  color: var(--accent-dark);
  border: 2px solid var(--pending);
}

/* ---------- Bottom-Bar: Einstellungen links neben "Fertig / Prüfen" ---------- */

.bottom-bar {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
}

.check-btn {
  padding: 16px 36px;
  border: 2px solid var(--ok);
  border-radius: 999px;
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
  background: linear-gradient(135deg, #34d399 0%, var(--ok) 100%);
  box-shadow: 0 10px 22px rgba(16, 185, 129, 0.45);
  cursor: pointer;
  min-height: 56px;
  min-width: 220px;
  transition: transform 0.12s ease;
}
.check-btn:hover { transform: translateY(-2px); }
.check-btn:active { transform: scale(0.97); }
.check-btn[hidden] { display: none; }

.bottom-bar .btn-secondary {
  border-radius: 999px;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.25);
}

/* ---------- Einstellungen-Flyout ---------- */

.settings-panel {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 100px;
  background: var(--paper);
  color: var(--ink);
  border: 2px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.28);
  padding: 18px 22px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 14px 28px;
  z-index: 25;
  max-height: 70vh;
  overflow-y: auto;
}
.settings-panel[hidden] { display: none; }

.volume-label {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  font-size: 1rem;
  font-weight: 600;
  flex: 1 1 190px;
  max-width: 260px;
}
.volume-label input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.metronome-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 0 0 auto;
}
.metronome-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
}
.metronome-label input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
}

.reset-btn {
  flex: 0 0 auto;
}

/* Eigene, volle Zeile unten im Einstellungen-Flyout statt zwischen den
   Reglern zu verschwinden - klar als eigener, dauerhaft erreichbarer
   Menüpunkt erkennbar (Zwei-Klick-Regel: Einstellungen -> Impressum). */
.settings-legal-link {
  flex: 1 1 100%;
  text-align: center;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.85rem;
  text-decoration: none;
}
.settings-legal-link:hover { text-decoration: underline; }

/* ---------- Punkte-Overlay nach "Fertig / Prüfen" ---------- */

.points-popup {
  position: fixed;
  top: 32%;
  left: 50%;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 32px;
  background: linear-gradient(135deg, var(--star) 0%, var(--accent) 100%);
  color: var(--bg-3);
  border: 2px solid var(--accent-dark);
  border-radius: 999px;
  box-shadow: 0 18px 36px rgba(245, 158, 11, 0.5);
  font-size: 2rem;
  font-weight: 800;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.5);
  opacity: 0;
}
.points-popup[hidden] { display: none; }
.points-popup.is-animating {
  animation: pointsPopupPop 1.4s ease-out forwards;
}
.points-popup-stars {
  font-size: 1.4rem;
  animation: pointsPopupSpin 1.4s ease-out;
}
@keyframes pointsPopupPop {
  0% { transform: translate(-50%, -50%) scale(0.4); opacity: 0; }
  15% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; }
  30% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  80% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -60%) scale(0.85); opacity: 0; }
}
@keyframes pointsPopupSpin {
  0% { transform: rotate(-20deg) scale(0.6); }
  30% { transform: rotate(20deg) scale(1.2); }
  60% { transform: rotate(-8deg) scale(1); }
  100% { transform: rotate(0deg) scale(1); }
}

/* ---------- Drag ghost ---------- */

.drag-ghost {
  position: fixed;
  z-index: 999;
  pointer-events: none;
  opacity: 0.9;
  transform: translate(calc(-1 * var(--ghost-anchor-x, 50%)), -50%);
}

.drag-ghost .placed-note {
  height: 96px;
  cursor: default;
}

/* ---------- Responsive ---------- */

@media (max-width: 480px) {
  .toolbar { justify-content: center; }
  .toolbar-progress { order: 3; flex-basis: 100%; }
  .points-popup { font-size: 1.5rem; padding: 14px 22px; }
  .check-btn { min-width: 0; padding: 14px 22px; font-size: 1rem; white-space: nowrap; }
  .bottom-bar .btn-secondary { padding: 10px 14px; font-size: 0.95rem; white-space: nowrap; }
}
