/* ---- Ear Training ---- */
.tool-page:has(.et-exercise-box) { min-height: auto !important; }
#ph-ear-train, #ph-staff-practice {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 0 0 auto;
}

/* Exercise box — groups question + answers + score */
.et-exercise-box {
  border: 1.5px solid #2a2d3a;
  border-radius: 10px;
  background: radial-gradient(circle at 50% 40%, #1a1d27, #12141c);
  padding: 24px;
  width: 540px;
  max-width: calc(100vw - 2rem);
  box-sizing: border-box;
  height: 460px;
  max-height: 460px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  margin-bottom: 18px;
  box-sizing: border-box;
  overflow: hidden;
}

.et-exercise-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 1.2rem;
  flex-wrap: wrap;
  justify-content: center;
}
.et-exercise-tab {
  padding: 6px 14px;
  border: 1.5px solid #2a2d3a;
  border-radius: 10px;
  background: #1a1d27;
  color: #666;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.et-exercise-tab:hover { border-color: #555; color: #aaa; }
.et-exercise-tab.active { background: #2a2d3a; border-color: #3a3d4a; color: #ccc; }

.et-panel { display: none; width: 100%; max-width: 540px; flex-direction: column; align-items: stretch; }
.et-panel.active { display: flex; }

.et-prompt {
  font-size: 1.1rem;
  color: #aaa;
  margin-bottom: 1rem;
  text-align: center;
}

/* Exercise title */
.et-exercise-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: #fff;
  text-align: center;
}

/* Round play button (matches metronome) */
.et-play-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}
.et-play-round {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #2a6cb0;
  border: 2px solid #4a8cd0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.1s;
}
.et-play-round:hover { background: #3580cc; }
.et-play-round:active { transform: scale(0.93); }
.et-play-round svg { width: 22px; height: 22px; fill: #fff; }

/* Bottom actions (skip + next) — sits right below the box */
.et-bottom-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 1rem;
  justify-content: center;
  width: 100%;
}

/* Answer grid — always 2 columns */
.et-answer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 0;
  width: 100%;
  max-width: 340px;
  margin-left: auto;
  margin-right: auto;
}
.et-answer-btn {
  padding: 10px 8px;
  border: 1.5px solid #2a2d3a;
  border-radius: 10px;
  background: #1a1d27;
  color: #ccc;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}
.et-answer-btn:hover { border-color: #555; color: #fff; background: #252836; }
.et-answer-btn:active { transform: scale(0.95); }
.et-answer-btn.correct {
  background: #1a3a1a !important;
  border-color: #4caf50 !important;
  color: #6fd06f !important;
}
.et-answer-btn.wrong {
  background: #3a1a1a !important;
  border-color: #f44336 !important;
  color: #ff8a8a !important;
}
.et-answer-btn.reveal {
  background: #1a3a1a;
  border-color: #4caf50;
  color: #6fd06f;
}
.et-answer-btn:disabled { opacity: 0.5; cursor: default; }

.et-feedback {
  font-size: 1.2rem;
  font-weight: 700;
  text-align: center;
}
.et-feedback:empty { display: none; }
.et-feedback.correct { color: #4caf50; }
.et-feedback.wrong { color: #f44336; }

.et-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 1rem;
  justify-content: center;
  width: 100%;
}
.et-action-btn {
  padding: 8px 16px;
  border: 1.5px solid #2a2d3a;
  border-radius: 10px;
  background: #1a1d27;
  color: #ccc;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}
.et-action-btn:hover { background: #252836; border-color: #555; color: #fff; }
.et-action-btn svg { width: 14px; height: 14px; fill: currentColor; }

.et-score {
  font-size: 0.85rem;
  color: #888;
  font-weight: 600;
  margin-bottom: 1rem;
  text-align: center;
  width: 100%;
}
.et-score b { color: #7cb8ff; }

.et-difficulty {
  display: flex;
  gap: 4px;
  margin-bottom: 1rem;
  justify-content: center;
}
.et-diff-btn {
  padding: 5px 12px;
  border: 1.5px solid #2a2d3a;
  border-radius: 10px;
  background: #1a1d27;
  color: #666;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.et-diff-btn:hover { border-color: #555; color: #aaa; }
.et-diff-btn.active { background: #2a2d3a; border-color: #3a3d4a; color: #ccc; }

/* ---- Functions Tab ---- */
.fn-prompt-big {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.6;
  text-align: center;
  margin-bottom: 0.5rem;
  min-height: 1.6em;
}
.fn-prompt-context {
  font-size: 0.85rem;
  color: #888;
  margin-bottom: 1rem;
  text-align: center;
  line-height: 1.6;
  min-height: 1.6em;
}
.fn-prompt-context:empty { display: none; }
.fn-options {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 0;
}
.fn-opt-btn {
  padding: 8px 16px;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  border: 1.5px solid #2a2d3a;
  background: #1a1d27;
  color: #ccc;
  min-width: 90px;
  text-align: center;
  transition: all 0.15s;
}
.fn-opt-btn:hover { border-color: #555; color: #fff; background: #252836; }
.fn-opt-btn:active { transform: scale(0.95); }
.fn-feedback {
  text-align: center;
}
.fn-feedback:empty { display: none; }
.fn-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  justify-content: center;
}
.fn-score {
  font-size: 0.85rem;
  color: #888;
  font-weight: 600;
  margin-bottom: 0.6rem;
  text-align: center;
  width: 100%;
}
.fn-score b { color: #7cb8ff; }

.fn-options.shake {
  animation: et-shake 0.45s ease;
}
.fn-options.shake .fn-opt-btn {
  border-color: #ff9800 !important;
  color: #ffb74d !important;
}

/* ---- Rhythm Training ---- */
.et-rhythm-ts {
  font-size: 1.8rem;
  font-weight: 700;
  color: #7cb8ff;
  text-align: center;
  margin-bottom: 1rem;
}
.et-rhythm-grid {
  grid-template-columns: 1fr 1fr !important;
  max-width: 380px !important;
  margin-left: auto !important;
  margin-right: auto !important;
}
.et-rhythm-option {
  display: flex !important;
  align-items: center;
  gap: 12px;
  text-align: left !important;
  padding: 12px 16px !important;
}
.et-rhythm-play {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #2a6cb0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.et-rhythm-play:hover { background: #3580cc; }
.et-rhythm-play:active { transform: scale(0.9); }
.et-rhythm-play svg { fill: #fff; }
.et-rhythm-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: #ccc;
}
/* Correct/wrong states for rhythm play icon */
.et-rhythm-option.correct .et-rhythm-play { background: #4caf50; }
.et-rhythm-option.wrong .et-rhythm-play { background: #f44336; }
.et-rhythm-option.reveal .et-rhythm-play { background: #4caf50; }

/* ---- Shake animation (Next pressed without answer) ---- */
@keyframes et-shake {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-5px); }
  30% { transform: translateX(5px); }
  45% { transform: translateX(-4px); }
  60% { transform: translateX(3px); }
  75% { transform: translateX(-2px); }
}
.et-answer-grid.shake {
  animation: et-shake 0.45s ease;
}
.et-answer-grid.shake .et-answer-btn {
  border-color: #ff9800 !important;
  color: #ffb74d !important;
}
