:root {
  color-scheme: light;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --bg: #f7f8fc;
  --card: #ffffff;
  --text: #1a1d29;
  --subtle: #566079;
  --accent: #5d66ff;
  --good: #31a56f;
  --warn: #f4a41d;
  --error: #d64545;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}
.app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
}
header h1 { margin-bottom: 0.25rem; }
header p { margin-top: 0; color: var(--subtle); }
.card {
  background: var(--card);
  border-radius: 14px;
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
  box-shadow: 0 6px 25px rgba(15, 29, 57, 0.09);
}
.upload input { display: none; }
.upload span {
  display: inline-block;
  background: var(--accent);
  color: white;
  border-radius: 8px;
  padding: 0.6rem 0.9rem;
  cursor: pointer;
}
.hint { color: var(--subtle); }
.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.4rem 0.8rem;
  margin-bottom: 0.8rem;
}
.controls {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 0.8rem;
}
button {
  border: none;
  border-radius: 8px;
  padding: 0.6rem 0.95rem;
  background: #242b3f;
  color: white;
  cursor: pointer;
}
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
#scoreCanvas {
  width: 100%;
  height: auto;
  border: 1px solid #d4d9e6;
  border-radius: 8px;
  background: #fbfcff;
}
#staffContainer {
  width: 100%;
  min-height: 220px;
  border: 1px solid #d4d9e6;
  border-radius: 8px;
  background: #ffffff;
  margin-top: 0.6rem;
  position: relative;
  overflow: hidden;
}

.staff-empty {
  color: #7b8397;
  padding: 0.9rem;
}

.staff-cursor {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #ed5f5f;
  transform: translateX(-1px);
  pointer-events: none;
}
.countdown {
  font-size: 2.6rem;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 0.6rem;
}
.hidden { display: none; }

.measure-controls {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.6rem;
}

#measureScroll {
  width: 100%;
}

#measureWindowLabel {
  color: var(--subtle);
  font-weight: 600;
  text-align: right;
  min-width: 72px;
}

.legend {
  color: var(--subtle);
  margin-bottom: 0.6rem;
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}
.swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
}
.swatch.expected { background: #9ab0ff; }
.swatch.current { background: #ed5f5f; }
.swatch.played { background: #31a56f; }
.results {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}
.metric {
  background: #f2f5ff;
  border-radius: 10px;
  padding: 0.8rem;
}
.metric span {
  display: block;
  color: var(--subtle);
}
.metric strong {
  font-size: 1.8rem;
}
.feedback-list {
  margin: 0;
  padding-left: 1.2rem;
  max-height: 200px;
  overflow-y: auto;
}
.error {
  color: white;
  background: var(--error);
  padding: 0.6rem;
  border-radius: 8px;
  margin-bottom: 0.8rem;
}
