/* Great Tests — Ear training quiz UI.
   Base tokens/reset from great-apps/framework.css via CDN. */

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.exercise-select {
  padding: 7px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
}

/* ── Quiz body ─────────────────────────── */
.quiz-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
}

/* ── Score row ─────────────────────────── */
.score-row {
  display: flex;
  gap: 10px;
}

.stat {
  flex: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 8px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

/* ── Play zone ─────────────────────────── */
.play-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.play-big {
  width: 132px;
  height: 132px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: radial-gradient(circle at 50% 40%, var(--bg-active), var(--bg-surface));
  color: var(--accent);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none; /* no long-press callout menu in Hold mode */
  -webkit-user-select: none;
  user-select: none;           /* no text selection when holding the button */
  touch-action: none; /* let Hold-mode pointer gestures work without scroll/zoom */
  transition: transform 0.1s, box-shadow 0.2s, border-color 0.2s;
  box-shadow: 0 0 0 0 rgba(124, 111, 255, 0.4);
}

.play-big:hover { box-shadow: 0 0 28px 2px rgba(124, 111, 255, 0.25); }
.play-big:active { transform: scale(0.96); }

.play-big .ico-play { margin-left: 6px; }

.play-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text);
}

.play-hint {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
  max-width: 260px;
}

/* ── Answer grid ───────────────────────── */
.answer-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.answer-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.answer-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }

.answer-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 12px 6px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  transition: background 0.12s, border-color 0.12s, transform 0.06s;
}

.answer-btn:hover:not(:disabled) { background: var(--bg-hover); border-color: var(--accent); }
.answer-btn:active:not(:disabled) { transform: scale(0.97); }
.answer-btn:disabled { cursor: default; opacity: 0.85; }

.ans-name { font-size: 0.86rem; font-weight: 500; }
.ans-short { font-size: 0.68rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.answer-btn.correct {
  background: rgba(46, 160, 87, 0.18);
  border-color: #2ea057;
  opacity: 1;
}
.answer-btn.correct .ans-short { color: #4cc47a; }

.answer-btn.wrong {
  background: rgba(210, 60, 70, 0.18);
  border-color: #d23c46;
  opacity: 1;
}

/* ── Feedback ──────────────────────────── */
.feedback {
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 0.95rem;
  text-align: center;
  border: 1px solid var(--border);
}
.feedback.ok { background: rgba(46, 160, 87, 0.15); border-color: rgba(46, 160, 87, 0.4); }
.feedback.no { background: rgba(210, 60, 70, 0.15); border-color: rgba(210, 60, 70, 0.4); }
.feedback.warn { background: rgba(214, 158, 46, 0.15); border-color: rgba(214, 158, 46, 0.45); }
.feedback .ratio {
  display: inline-block;
  margin-left: 6px;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.next-btn {
  align-self: center;
  padding: 12px 32px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s, transform 0.06s;
}
.next-btn:hover { background: var(--accent-dim); }
.next-btn:active { transform: scale(0.97); }

/* ── Settings drawer ───────────────────── */
.settings-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 50;
  display: flex;
  justify-content: flex-end;
}

.settings-panel {
  width: min(400px, 88vw);
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  padding-top: calc(14px + env(safe-area-inset-top, 0px));
  border-bottom: 1px solid var(--border);
}
.settings-head h2 { font-size: 1.1rem; font-weight: 600; }

.settings-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.setting-block h3 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 10px;
  font-weight: 600;
}

.seg-control {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}
.seg-btn {
  flex: 1;
  padding: 9px 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 0.82rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.12s, border-color 0.12s, background 0.12s;
}
.seg-btn.active { color: #fff; background: var(--accent-dim); border-color: var(--accent); }

/* Score-scope selector sits tight under the score row. */
.scope-control { margin-top: -10px; margin-bottom: 0; }
.scope-control .seg-btn { padding: 7px 6px; font-size: 0.78rem; }

/* Small sub-label inside a settings block. */
.setting-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 4px 0 6px;
}

.setting-val {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

/* ── Range slider ──────────────────────── */
.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 24px;
  margin: 0 0 6px;
  background: transparent;
  cursor: pointer;
}
.slider::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 3px;
  background: var(--bg-active);
}
.slider::-moz-range-track {
  height: 6px;
  border-radius: 3px;
  background: var(--bg-active);
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  margin-top: -7px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-surface);
  box-shadow: 0 0 6px rgba(124, 111, 255, 0.5);
}
.slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-surface);
  box-shadow: 0 0 6px rgba(124, 111, 255, 0.5);
}

/* ── Instrument picker ─────────────────── */
.inst-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.inst-btn {
  padding: 9px 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.12s, border-color 0.12s, background 0.12s;
}
.inst-btn:hover { border-color: var(--accent); }
.inst-btn.active { color: #fff; background: var(--accent-dim); border-color: var(--accent); }

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.9rem;
  padding: 6px 0;
}
.toggle-row input { width: 20px; height: 20px; accent-color: var(--accent); }

.preset-row { display: flex; gap: 6px; margin-bottom: 12px; }.preset-btn {
  flex: 1;
  padding: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.82rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.preset-btn:hover { border-color: var(--accent); }

.check-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 14px;
}
.check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  cursor: pointer;
}
.check-item input { width: 18px; height: 18px; accent-color: var(--accent); }

.settings-foot {
  padding: 12px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
}
.ghost-btn {
  flex: 1;
  width: 100%;
  padding: 10px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 0.88rem;
  cursor: pointer;
}
.ghost-btn:hover { color: var(--text); border-color: var(--accent); }

/* ── Stats panel ───────────────────────── */
.stats-summary {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.stats-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.88rem;
  padding: 6px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.stats-k { color: var(--text-muted); }
.stats-v { font-weight: 600; font-variant-numeric: tabular-nums; }

.stats-items {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.stats-item {
  display: grid;
  grid-template-columns: 5.5rem 1fr 2.6rem;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
}
.si-name { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.si-bar {
  height: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.si-fill {
  display: block;
  height: 100%;
  background: var(--accent);
  transition: width 0.25s;
}
.si-val {
  text-align: right;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* ── Mobile ────────────────────────────── */
@media (max-width: 768px) {
  .answer-btn { min-height: 60px; padding: 10px 4px; }
}
@media (max-width: 380px) {
  .answer-grid.cols-3 { grid-template-columns: repeat(2, 1fr); }
}
