/* Scrolling Notes Trainer */

:root {
  --page-bg-1: #f4f6ff;
  --page-bg-2: #e8eafb;
  --panel-bg: rgba(255, 255, 255, 0.92);
  --text: #1f2937;
  --muted: #6b7280;
  --accent: #4f46e5;
  --accent-dark: #3730a3;
  --danger: #dc2626;
  --border: #d1d5db;
  --shadow: 0 24px 70px rgba(15, 23, 42, 0.14);
  --staff-top: 42px;
  --staff-step: 28px;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background: linear-gradient(135deg, var(--page-bg-1), var(--page-bg-2));
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  transition: background 600ms ease;
}

body.level-transition {
  transition: background 1000ms ease;
}

.app {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.app-header {
  text-align: center;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1;
}

.subtitle {
  margin: 12px auto 0;
  max-width: 640px;
  color: var(--muted);
  font-size: 1rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stat-card {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--panel-bg);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
  text-align: center;
}

.stat-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stat-card strong {
  font-size: 1.7rem;
}

#errorValue {
  color: var(--danger);
}

.game-panel {
  padding: 20px;
  border-radius: 24px;
  background: var(--panel-bg);
  box-shadow: var(--shadow);
}

.staff {
  position: relative;
  width: 100%;
  height: 260px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #ffffff;
}

.staff-lines {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.staff-lines span {
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background: #111827;
}

.staff-lines span:nth-child(1) { top: var(--staff-top); }
.staff-lines span:nth-child(2) { top: calc(var(--staff-top) + var(--staff-step)); }
.staff-lines span:nth-child(3) { top: calc(var(--staff-top) + var(--staff-step) * 2); }
.staff-lines span:nth-child(4) { top: calc(var(--staff-top) + var(--staff-step) * 3); }
.staff-lines span:nth-child(5) { top: calc(var(--staff-top) + var(--staff-step) * 4); }

.measures-container {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  will-change: transform;
}

.measure {
  position: absolute;
  top: 0;
  height: 100%;
  border-right: 2px solid #111827;
}

.clef {
  position: absolute;
  left: 18px;
  top: 44px;
  z-index: 10;
  color: #111827;
  font-family: "Times New Roman", serif;
  font-size: 126px;
  line-height: 1;
  pointer-events: none;
}
.clef-symbol {
  font-size: 126px;
}

.clef-dots {
  font-size: 50px;
  margin-left: 4px;
  vertical-align: middle;
}
.note {
  position: absolute;
  width: 42px;
  height: 30px;
  border-radius: 50%;
  background: #111827;
  transform: rotate(-18deg);
}

.controls {
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 12px;
  align-items: center;
  margin-top: 18px;
}

button {
  min-width: 120px;
  padding: 12px 18px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease;
}

button:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

button.secondary {
  background: #e5e7eb;
  color: #111827;
}

button.secondary:hover {
  background: #d1d5db;
}

.instructions {
  color: var(--muted);
  font-size: 0.92rem;
}

.instructions p {
  margin: 3px 0;
}

@media (max-width: 720px) {
  .app {
    width: min(100% - 20px, 1100px);
    padding: 20px 0;
  }

  .stats {
    grid-template-columns: 1fr;
  }

  .game-panel {
    padding: 12px;
  }

  .staff {
    height: 220px;
  }

  .clef {
    font-size: 96px;
    top: 22px;
  }

  .note {
    width: 34px;
    height: 24px;
  }

  .controls {
    grid-template-columns: 1fr;
  }

  button {
    width: 100%;
  }
}
