/* ═══════════════════════════════════════════════════════════════════════════
   SECTION COACH — Premium Peacock Mascot
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Disable auto-popup checkbox ──────────────────────────────────────────── */
.coach-disable-wrap {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(196, 147, 63, 0.15);
  cursor: pointer;
}

.coach-disable-wrap input[type="checkbox"] {
  flex-shrink: 0;
  margin-top: 2px;
  accent-color: #c4933f;
  cursor: pointer;
}

.coach-disable-wrap span {
  color: rgba(232, 220, 200, 0.45);
  font-size: 11px;
  line-height: 1.5;
  font-family: inherit;
}

/* ── Popup overlay ─────────────────────────────────────────────────────────── */
.coach-popup {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 32px;
  z-index: 9990;
  pointer-events: none;
}

/* ── Card ──────────────────────────────────────────────────────────────────── */
.coach-card {
  position: relative;
  background: linear-gradient(140deg, #0f1929 0%, #090e18 100%);
  border: 1px solid rgba(196, 147, 63, 0.38);
  border-radius: 18px;
  box-shadow:
    0 28px 72px rgba(0, 0, 0, 0.72),
    0 0 0 1px rgba(196, 147, 63, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  padding: 18px 22px 18px 14px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  max-width: 520px;
  width: min(520px, calc(100vw - 32px));
  min-width: 300px;
  pointer-events: all;
  will-change: transform, opacity;
}

/* ── Close button ──────────────────────────────────────────────────────────── */
.coach-close-btn {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  color: rgba(196, 147, 63, 0.5);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 5px;
  border-radius: 4px;
  transition: color 0.18s, background 0.18s;
  z-index: 1;
  font-family: inherit;
}
.coach-close-btn:hover {
  color: #c4933f;
  background: rgba(196, 147, 63, 0.1);
}

/* ── Mascot wrapper ────────────────────────────────────────────────────────── */
.coach-mascot-wrap {
  flex-shrink: 0;
  width: 108px;
  height: 128px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: visible;
}

.coach-mascot-wrap svg {
  width: 108px;
  height: 128px;
  overflow: visible;
}

/* ── Content ───────────────────────────────────────────────────────────────── */
.coach-content {
  flex: 1;
  min-width: 0;
  padding-right: 18px;
}

/* ── Header row ────────────────────────────────────────────────────────────── */
.coach-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
  flex-wrap: wrap;
}

.coach-mascot-name {
  color: #c4933f;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  font-family: inherit;
}

.coach-score-badge {
  color: rgba(232, 220, 200, 0.55);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

/* ── Report header ─────────────────────────────────────────────────────────── */
.coach-report-header {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 6px;
}

.coach-refresh-btn {
  background: none;
  border: 1px solid rgba(196, 147, 63, 0.3);
  border-radius: 7px;
  color: rgba(196, 147, 63, 0.7);
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  padding: 3px 10px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.coach-refresh-btn:hover:not(:disabled) {
  color: #c4933f;
  border-color: rgba(196, 147, 63, 0.6);
  background: rgba(196, 147, 63, 0.08);
}
.coach-refresh-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

/* ── Teacher note ──────────────────────────────────────────────────────────── */
.coach-teacher-note {
  margin: 0 0 5px;
  color: #ede4d4;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.35;
  font-family: inherit;
}

/* ── Observation ───────────────────────────────────────────────────────────── */
.coach-observation {
  margin: 0 0 10px;
  color: rgba(232, 220, 200, 0.75);
  font-size: 12px;
  line-height: 1.5;
  font-family: inherit;
}

/* ── Mastery bars ──────────────────────────────────────────────────────────── */
.coach-mastery-block {
  margin-bottom: 8px;
}

.coach-mastery-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
}

.coach-mastery-label-wrap {
  display: flex;
  flex-direction: column;
  width: 90px;
  flex-shrink: 0;
}

.coach-mastery-label {
  color: rgba(232, 220, 200, 0.75);
  font-size: 10.5px;
  font-family: inherit;
}

.coach-mastery-subtitle {
  color: rgba(232, 220, 200, 0.35);
  font-size: 8.5px;
  font-family: inherit;
  line-height: 1.3;
  margin-top: 1px;
}

.coach-mastery-bar {
  color: #c4933f;
  font-size: 10px;
  letter-spacing: 1px;
  flex: 1;
  font-family: 'Courier New', monospace;
}

.coach-mastery-val {
  color: rgba(232, 220, 200, 0.7);
  font-size: 10.5px;
  width: 24px;
  text-align: right;
  flex-shrink: 0;
  font-family: inherit;
}

/* ── Divider ───────────────────────────────────────────────────────────────── */
.coach-divider {
  border: none;
  border-top: 1px solid rgba(196, 147, 63, 0.2);
  margin: 8px 0;
}

/* ── Action block ──────────────────────────────────────────────────────────── */
.coach-action-label {
  margin: 0 0 6px;
  color: rgba(232, 220, 200, 0.45);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: inherit;
}

.coach-action-btn {
  width: 100%;
  background: linear-gradient(135deg, #c4933f 0%, #9e6b1a 100%);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  padding: 10px 14px;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.15s, transform 0.12s;
  text-align: center;
}

.coach-action-btn:hover  { opacity: 0.88; transform: translateY(-1px); }
.coach-action-btn:active { opacity: 0.95; transform: translateY(0); }

.coach-practiced-btn {
  margin-top: 8px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
  color: rgba(232,220,200,0.85);
}

.coach-ladder-detail {
  font-size: 0.85em;
  line-height: 1.5;
  margin: 0 0 10px;
  color: rgba(232,220,200,0.9);
}

.coach-loop-banner {
  background: rgba(196,147,63,0.18);
  border: 1.5px solid rgba(196,147,63,0.45);
  border-radius: 8px;
  padding: 8px 12px;
  margin: 0 0 12px;
  font-size: 0.82em;
  line-height: 1.45;
  color: #e8c868;
  text-align: center;
}
.coach-practiced-btn:hover { background: rgba(255,255,255,0.13); opacity: 1; }

.coach-practiced-nudge {
  margin: 10px 0 6px;
  font-size: 13px;
  color: rgba(232,220,200,0.85);
  text-align: center;
}

.coach-predicted-gain {
  margin: 6px 0 0;
  color: rgba(232, 220, 200, 0.5);
  font-size: 10.5px;
  text-align: center;
  font-family: inherit;
}

/* ── 1-minute plan ─────────────────────────────────────────────────────────── */
.coach-plan-details {
  margin-top: 4px;
}

.coach-plan-details summary {
  color: rgba(196, 147, 63, 0.65);
  font-size: 11px;
  cursor: pointer;
  font-family: inherit;
  user-select: none;
}

.coach-plan-list {
  margin: 6px 0 0 14px;
  padding: 0;
  color: rgba(232, 220, 200, 0.65);
  font-size: 11.5px;
  line-height: 1.6;
  font-family: inherit;
}

/* ── Tabs ──────────────────────────────────────────────────────────────────── */
.coach-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 10px;
  border-bottom: 1px solid rgba(196, 147, 63, 0.2);
  padding-bottom: 6px;
}

.coach-tab {
  background: none;
  border: none;
  border-radius: 8px;
  color: rgba(232, 220, 200, 0.45);
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  text-transform: uppercase;
  transition: color 0.15s, background 0.15s;
}

.coach-tab:hover {
  color: rgba(232, 220, 200, 0.8);
  background: rgba(196, 147, 63, 0.08);
}

.coach-tab.active {
  color: #c4933f;
  background: rgba(196, 147, 63, 0.12);
}

/* ── Panes ─────────────────────────────────────────────────────────────────── */
.coach-pane {
  max-height: 52vh;
  overflow-y: auto;
  padding-right: 4px;
}

/* ── Song guide ────────────────────────────────────────────────────────────── */
.coach-guide-loading {
  color: rgba(232, 220, 200, 0.45);
  font-size: 12px;
  text-align: center;
  padding: 18px 0;
  font-family: inherit;
}

.coach-guide-section {
  margin-bottom: 10px;
}

.coach-guide-label {
  color: rgba(196, 147, 63, 0.75);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 3px;
  font-family: inherit;
}

.coach-guide-text {
  color: rgba(232, 220, 200, 0.82);
  font-size: 12px;
  line-height: 1.55;
  font-family: inherit;
  margin: 0;
}

.coach-guide-list {
  margin: 3px 0 0 14px;
  padding: 0;
  color: rgba(232, 220, 200, 0.75);
  font-size: 12px;
  line-height: 1.6;
  font-family: inherit;
}

/* ── Scale button ──────────────────────────────────────────────────────────── */
.coach-scale-btn {
  display: inline-block;
  margin-top: 7px;
  background: rgba(196, 147, 63, 0.12);
  border: 1px solid rgba(196, 147, 63, 0.4);
  border-radius: 8px;
  color: #e8b86d;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  padding: 5px 12px;
  cursor: pointer;
  transition: background 0.15s, transform 0.12s;
}
.coach-scale-btn:hover  { background: rgba(196, 147, 63, 0.22); transform: translateY(-1px); }
.coach-scale-btn:active { transform: translateY(0); }

/* ── Symbol rows ───────────────────────────────────────────────────────────── */
.coach-symbol-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.coach-symbol-img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 6px;
  background: rgba(196, 147, 63, 0.08);
  padding: 4px;
}

.coach-symbol-img--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: rgba(196, 147, 63, 0.6);
}

.coach-symbol-img--clickable {
  cursor: zoom-in;
  transition: transform 0.15s, box-shadow 0.15s;
}
.coach-symbol-img--clickable:hover {
  transform: scale(1.12);
  box-shadow: 0 0 0 2px rgba(196, 147, 63, 0.5);
  border-radius: 6px;
}

/* ── Reset confirm dialog ──────────────────────────────────────────────────── */
.coach-reset-confirm {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  opacity: 0;
  transition: opacity 0.18s;
  padding: 24px;
}

.coach-reset-confirm--open {
  opacity: 1;
}

.coach-reset-card {
  background: linear-gradient(140deg, #0f1929 0%, #090e18 100%);
  border: 1px solid rgba(196, 147, 63, 0.4);
  border-radius: 16px;
  padding: 24px;
  max-width: 300px;
  width: 100%;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.8);
  transform: scale(0.93);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.coach-reset-confirm--open .coach-reset-card {
  transform: scale(1);
}

.coach-reset-title {
  color: #e8b86d;
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  margin-bottom: 10px;
}

.coach-reset-body {
  color: rgba(232, 220, 200, 0.75);
  font-size: 13px;
  line-height: 1.55;
  font-family: inherit;
  margin-bottom: 18px;
}

.coach-reset-btns {
  display: flex;
  gap: 10px;
}

.coach-reset-cancel {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  color: rgba(232, 220, 200, 0.7);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  padding: 9px;
  cursor: pointer;
  transition: background 0.15s;
}
.coach-reset-cancel:hover { background: rgba(255, 255, 255, 0.1); }

.coach-reset-confirm-btn {
  flex: 1;
  background: linear-gradient(135deg, #c0392b, #922b21);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  padding: 9px;
  cursor: pointer;
  transition: opacity 0.15s;
}
.coach-reset-confirm-btn:hover { opacity: 0.88; }

/* ── Symbol lightbox ───────────────────────────────────────────────────────── */
.coach-symbol-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  opacity: 0;
  transition: opacity 0.2s;
  padding: 24px;
}

.coach-symbol-lightbox--open {
  opacity: 1;
}

.coach-symbol-lightbox-card {
  position: relative;
  background: linear-gradient(140deg, #0f1929 0%, #090e18 100%);
  border: 1px solid rgba(196, 147, 63, 0.4);
  border-radius: 18px;
  padding: 28px 28px 24px;
  max-width: 340px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.8);
  transform: scale(0.92);
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.coach-symbol-lightbox--open .coach-symbol-lightbox-card {
  transform: scale(1);
}

.coach-symbol-lightbox-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  color: rgba(196, 147, 63, 0.5);
  font-size: 20px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
  font-family: inherit;
  line-height: 1;
}
.coach-symbol-lightbox-close:hover {
  color: #c4933f;
  background: rgba(196, 147, 63, 0.1);
}

.coach-symbol-lightbox-img {
  width: 140px;
  height: 140px;
  object-fit: contain;
  border-radius: 10px;
  background: rgba(196, 147, 63, 0.07);
  padding: 10px;
}

.coach-symbol-lightbox-placeholder {
  width: 140px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 64px;
  color: rgba(196, 147, 63, 0.7);
  background: rgba(196, 147, 63, 0.07);
  border-radius: 10px;
}

.coach-symbol-lightbox-name {
  color: #e8b86d;
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  text-align: center;
}

.coach-symbol-lightbox-desc {
  color: rgba(232, 220, 200, 0.82);
  font-size: 13px;
  line-height: 1.6;
  font-family: inherit;
  text-align: center;
}

.coach-symbol-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.coach-symbol-name {
  color: #e8b86d;
  font-size: 12px;
  font-weight: 700;
  font-family: inherit;
}

.coach-symbol-desc {
  color: rgba(232, 220, 200, 0.75);
  font-size: 12px;
  line-height: 1.5;
  font-family: inherit;
}

/* ── Encouragement ─────────────────────────────────────────────────────────── */
.coach-encouragement {
  margin: 8px 0 0;
  color: rgba(232, 220, 200, 0.55);
  font-size: 11.5px;
  line-height: 1.5;
  font-style: italic;
  font-family: inherit;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Card entrance (spring-in from below) ──────────────────────────────────── */
@keyframes coachCardIn {
  0%   { opacity: 0; transform: translateY(24px) scale(0.93); }
  58%  { opacity: 1; transform: translateY(-5px) scale(1.015); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Card exit ─────────────────────────────────────────────────────────────── */
@keyframes coachCardOut {
  0%   { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(14px) scale(0.95); }
}

.coach-card--entering {
  animation: coachCardIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.coach-card--exiting {
  animation: coachCardOut 0.28s ease-in forwards;
}

/* ── Mascot entrance hop (the bird "hops onto screen") ──────────────────────── */
@keyframes coachMascotIn {
  0%   { opacity: 0; transform: scale(0.78) translateY(22px); }
  55%  { opacity: 1; transform: scale(1.09) translateY(-11px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

.coach-mascot-wrap--entering {
  animation: coachMascotIn 0.62s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* ── Idle breathing loop ───────────────────────────────────────────────────── */
@keyframes coachBreathe {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-2px); }
}

.coach-mascot-wrap--idle {
  animation: coachBreathe 2.5s ease-in-out infinite;
}

/* ── Success hop ───────────────────────────────────────────────────────────── */
@keyframes coachSuccessHop {
  0%   { transform: translateY(0) scale(1); }
  22%  { transform: translateY(-15px) scale(1.05, 0.96); }
  42%  { transform: translateY(0) scale(0.97, 1.03); }
  58%  { transform: translateY(-6px) scale(1.02, 0.98); }
  76%  { transform: translateY(0) scale(1); }
  100% { transform: translateY(0) scale(1); }
}

.coach-mascot-wrap--hopping {
  animation: coachSuccessHop 0.52s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* ── Tail ruffle ───────────────────────────────────────────────────────────── */
@keyframes coachTailRuffle {
  0%   { transform: scale(1); }
  35%  { transform: scaleX(1.09) scaleY(1.05); }
  65%  { transform: scaleX(1.04) scaleY(1.02); }
  100% { transform: scale(1); }
}

#peacock-tail {
  transform-box: fill-box;
  transform-origin: 50% 100%;
}

#peacock-tail.coach-ruffling {
  animation: coachTailRuffle 0.36s ease-in-out forwards;
}

/* ── Head tilt (thinking / advice state) ───────────────────────────────────── */
@keyframes coachThink {
  0%   { transform: rotate(0deg); }
  22%  { transform: rotate(-8deg); }
  60%  { transform: rotate(6deg); }
  100% { transform: rotate(0deg); }
}

#peacock-head {
  transform-box: fill-box;
  transform-origin: 50% 82%;
}

#peacock-head.coach-thinking {
  animation: coachThink 1.1s ease-in-out forwards;
}

/* ── Sparkles ──────────────────────────────────────────────────────────────── */
@keyframes coachSparkle {
  0%   { opacity: 0; transform: scale(0) rotate(0deg); }
  28%  { opacity: 1; transform: scale(1.25) rotate(80deg); }
  72%  { opacity: 0.7; transform: scale(0.85) rotate(180deg); }
  100% { opacity: 0; transform: scale(0) rotate(260deg); }
}

#peacock-sparkles .coach-spark {
  transform-box: fill-box;
  transform-origin: center;
}

#peacock-sparkles.coach-sparkling .coach-spark:nth-child(1) { animation: coachSparkle 0.48s 0.04s ease-out forwards; }
#peacock-sparkles.coach-sparkling .coach-spark:nth-child(2) { animation: coachSparkle 0.48s 0.10s ease-out forwards; }
#peacock-sparkles.coach-sparkling .coach-spark:nth-child(3) { animation: coachSparkle 0.48s 0.16s ease-out forwards; }
#peacock-sparkles.coach-sparkling .coach-spark:nth-child(4) { animation: coachSparkle 0.48s 0.22s ease-out forwards; }
#peacock-sparkles.coach-sparkling .coach-spark:nth-child(5) { animation: coachSparkle 0.36s 0.07s ease-out forwards; }
#peacock-sparkles.coach-sparkling .coach-spark:nth-child(6) { animation: coachSparkle 0.36s 0.13s ease-out forwards; }
#peacock-sparkles.coach-sparkling .coach-spark:nth-child(7) { animation: coachSparkle 0.36s 0.19s ease-out forwards; }
#peacock-sparkles.coach-sparkling .coach-spark:nth-child(8) { animation: coachSparkle 0.36s 0.25s ease-out forwards; }

/* ── Reduced motion fallback ─────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .coach-card--entering,
  .coach-card--exiting,
  .coach-mascot-wrap--entering,
  .coach-mascot-wrap--idle,
  .coach-mascot-wrap--hopping,
  #peacock-tail.coach-ruffling,
  #peacock-head.coach-thinking,
  #peacock-sparkles.coach-sparkling .coach-spark {
    animation: none !important;
  }
  .coach-card--entering { opacity: 1; }
  .coach-card--exiting  { opacity: 0; }
}

/* ── Musicality mode banner ──────────────────────────────────────────────── */
.coach-musicality-banner {
  background: linear-gradient(135deg, rgba(61,212,172,0.12) 0%, rgba(14,144,112,0.08) 100%);
  border: 1px solid rgba(61,212,172,0.25);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 12px;
  color: #3dd4ac;
  margin-bottom: 10px;
  line-height: 1.5;
}
