:root {
  color-scheme: dark;
  --bg: #080b14;
  --bg-card: #0e1426;
  --bg-card-2: #131d38;
  --gold: #e8b84b;
  --gold-light: #f5d17a;
  --gold-dim: rgba(232, 184, 75, 0.12);
  --violet: #7c3aed;
  --violet-mid: #9455f4;
  --violet-light: #a78bfa;
  --violet-dim: rgba(124, 58, 237, 0.18);
  --white: #f2f4f8;
  --muted: #8892a4;
  --border: rgba(232, 184, 75, 0.14);
  --danger: #f87171;
  --success: #34d399;
  --link-blue: #8ab4ff;
  --link-blue-hover: #a8c7ff;
  --tile-size: clamp(68px, 19vw, 92px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  min-height: 100%;
  background-color: var(--bg);
}

body {
  font-family: 'Inter', sans-serif;
  color: var(--white);
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(900px 480px at 18% -8%, rgba(124, 58, 237, 0.24), transparent 62%),
    radial-gradient(760px 420px at 86% 2%, rgba(232, 184, 75, 0.1), transparent 60%),
    linear-gradient(160deg, #070a13 0%, #0a1020 52%, #080b14 100%);
  background-color: var(--bg);
}

body.telegram-practice-entry {
  background-color: var(--bg);
}

.telegram-practice-entry .app {
  padding-top: max(24px, var(--tg-safe-area-inset-top, env(safe-area-inset-top)));
  padding-right: max(16px, var(--tg-safe-area-inset-right, env(safe-area-inset-right)));
  padding-bottom: max(24px, var(--tg-safe-area-inset-bottom, env(safe-area-inset-bottom)));
  padding-left: max(16px, var(--tg-safe-area-inset-left, env(safe-area-inset-left)));
}

.telegram-access-panel {
  max-width: 640px;
  margin-inline: auto;
  text-align: center;
}

.app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.hero {
  max-width: 640px;
  margin: 0 auto 24px;
  text-align: center;
}

.app-logo {
  display: block;
  width: 100%;
  max-width: 280px;
  height: auto;
  margin: 4px auto 12px;
}

.app-logo.app-logo-compact {
  max-width: 200px;
}

.eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
}

h1 {
  margin: 0;
  font-family: 'Poppins', 'Inter', sans-serif;
  font-size: clamp(1.8rem, 4.2vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

h2 {
  font-family: 'Poppins', 'Inter', sans-serif;
  font-weight: 700;
  margin-bottom: 8px;
}

h3 {
  color: var(--gold);
  margin: 8px 0;
  font-family: 'Poppins', 'Inter', sans-serif;
}

.subtitle {
  color: var(--muted);
  margin-bottom: 12px;
}

.hero-title {
  width: fit-content;
  max-width: 350px;
  margin: 0 auto 8px;
  font-size: clamp(1rem, 5vw, 1.3rem);
  line-height: 1.12;
  letter-spacing: 0;
  white-space: nowrap;
}

.hero-title span {
  display: inline;
}

.hero-subtitle {
  font-size: 1.02rem;
  line-height: 1.45;
  max-width: 44ch;
  margin-left: auto;
  margin-right: auto;
}

.connected-students-indicator,
.teacher-room-code-indicator {
  display: inline-block;
  margin: 0;
  padding: 0.26rem 0.72rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--gold-dim);
  color: var(--gold-light);
  font-size: 0.84rem;
  font-weight: 600;
}

.teacher-status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 14px auto 0;
  max-width: 760px;
  width: 100%;
}

@media (max-width: 560px) {
  .teacher-status-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .connected-students-indicator,
  .teacher-room-code-indicator {
    box-sizing: border-box;
    text-align: center;
    width: 100%;
  }
}

.panel {
  background: rgba(16, 22, 41, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 24px;
  margin: 16px 0;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 14px 40px rgba(6, 9, 18, 0.45);
}

.top-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.9rem;
}

label {
  color: var(--muted);
  font-size: 0.9rem;
  display: block;
  margin-bottom: 0.4rem;
}

input[type="text"],
select {
  width: 100%;
  background: var(--bg-card-2);
  color: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.52rem 0.8rem;
  font-size: 0.9rem;
}

select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 2.1rem;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--gold-light) 50%),
    linear-gradient(135deg, var(--gold-light) 50%, transparent 50%);
  background-position:
    calc(100% - 1rem) calc(50% - 2px),
    calc(100% - 0.7rem) calc(50% - 2px);
  background-size: 0.3rem 0.3rem, 0.3rem 0.3rem;
  background-repeat: no-repeat;
}

select:focus,
input[type="text"]:focus {
  outline: none;
  border-color: var(--gold-light);
  box-shadow: 0 0 0 2px rgba(232, 184, 75, 0.18);
}

input[type="range"] {
  accent-color: var(--gold);
  width: 100%;
  margin-bottom: 0.7rem;
}

.metric-options {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-top: 0.25rem;
}

.compare-config-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: stretch;
  gap: 0.7rem;
  max-width: 1100px;
  margin: 0 auto;
  margin-bottom: 0.8rem;
}

.compare-config-block {
  min-width: 0;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.compare-config-block-wide {
  grid-column: auto;
}

.compare-config-block input[type="range"] {
  margin-bottom: 0;
}

@media (max-width: 1050px) {
  .compare-config-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: 760px;
  }
}

@media (max-width: 640px) {
  .compare-config-grid {
    grid-template-columns: 1fr;
    max-width: 100%;
  }
}

.choice-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 1fr));
  gap: 0.55rem;
  max-width: 760px;
  margin: 0.2rem auto 0.85rem;
}

.exercise-mode-cards {
  grid-template-columns: repeat(2, minmax(280px, 360px));
  justify-content: center;
  gap: 12px;
}

@media (max-width: 760px) {
  .exercise-mode-cards {
    grid-template-columns: 1fr;
  }
}

.choice-cards-compact {
  grid-template-columns: repeat(2, minmax(120px, 1fr));
}

.choice-radio {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.choice-card {
  background: linear-gradient(145deg, var(--bg-card-2) 0%, var(--bg-card) 100%);
  border: 1px solid var(--border);
  color: var(--gold);
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 800;
  text-align: center;
  padding: 0.66rem 0.58rem;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.exercise-mode-card {
  position: relative;
  text-align: left;
  padding: 14px;
  border-radius: 18px;
  color: var(--white);
  display: grid;
  gap: 6px;
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.08), rgba(16, 22, 41, 0.78));
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 8px 22px rgba(5, 8, 18, 0.3);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease, background .2s ease;
}

.exercise-mode-card:hover {
  transform: translateY(-2px);
  border-color: rgba(167, 139, 250, 0.55);
  box-shadow: 0 14px 28px rgba(124, 58, 237, 0.22);
}

.mode-icon {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: linear-gradient(150deg, rgba(124, 58, 237, 0.3), rgba(124, 58, 237, 0.08));
  display: inline-block;
  position: relative;
}

.mode-icon::before,
.mode-icon::after {
  content: "";
  position: absolute;
  background: var(--gold-light);
}

.mode-icon-pitch::before {
  width: 16px;
  height: 2px;
  top: 9px;
  left: 7px;
  transform: rotate(-18deg);
}

.mode-icon-pitch::after {
  width: 16px;
  height: 2px;
  top: 18px;
  left: 7px;
  transform: rotate(18deg);
}

.mode-icon-interval::before {
  width: 2px;
  height: 14px;
  top: 8px;
  left: 10px;
}

.mode-icon-interval::after {
  width: 2px;
  height: 10px;
  top: 12px;
  left: 18px;
}

.mode-icon-chord::before {
  width: 18px;
  height: 2px;
  left: 6px;
  top: 10px;
}

.mode-icon-chord::after {
  width: 18px;
  height: 2px;
  left: 6px;
  top: 18px;
}

.mode-icon-meter::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  left: 8px;
  top: 8px;
}

.mode-icon-meter::after {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  left: 16px;
  top: 16px;
}

.mode-icon-order::before {
  width: 14px;
  height: 2px;
  left: 7px;
  top: 10px;
}

.mode-icon-order::after {
  width: 14px;
  height: 2px;
  left: 7px;
  top: 18px;
}

.mode-icon-harmony::before {
  width: 2px;
  height: 14px;
  left: 10px;
  top: 8px;
}

.mode-icon-harmony::after {
  width: 2px;
  height: 14px;
  left: 18px;
  top: 8px;
}

.mode-title {
  display: block;
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--white);
}

.mode-description {
  display: block;
  font-size: 0.84rem;
  line-height: 1.35;
  color: #b8c3d8;
}

.choice-radio:checked+.choice-card {
  border-color: var(--gold-light);
  box-shadow: 0 0 0 2px rgba(232, 184, 75, 0.28);
  background: var(--gold-dim);
}

.choice-radio:checked+.exercise-mode-card {
  border-color: var(--gold-light);
  background: linear-gradient(165deg, rgba(245, 209, 122, 0.16), rgba(124, 58, 237, 0.18));
  box-shadow:
    0 0 0 2px rgba(232, 184, 75, 0.26),
    0 14px 32px rgba(124, 58, 237, 0.24);
}

.choice-radio:checked+.exercise-mode-card::after {
  content: "✓";
  position: absolute;
  top: 10px;
  right: 10px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--gold-light);
  color: #231b08;
  font-weight: 800;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.choice-radio:disabled+.choice-card {
  opacity: 0.55;
  cursor: not-allowed;
}

.metric-options label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

#screenTeacherStart {
  max-width: 780px;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

#screenTeacherStart label {
  text-align: center;
}

#screenTeacherStart #teacherName,
#screenTeacherStart #roomName {
  width: min(300px, 100%);
  max-width: 300px;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

#screenTeacherStart h2 {
  font-size: 20px;
}

#screenTeacherStart #teacherName::placeholder,
#screenTeacherStart #roomName::placeholder {
  text-align: center;
}

#screenTeacherStart .buttons {
  justify-content: center;
}

#screenStudentJoin {
  max-width: 780px;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

#screenStudentJoin h2 {
  font-size: 20px;
}

#screenStudentJoin label {
  text-align: center;
}

#screenStudentJoin #studentName,
#screenStudentJoin #studentCodeInput {
  width: min(300px, 100%);
  max-width: 300px;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

#screenStudentJoin #studentName::placeholder,
#screenStudentJoin #studentCodeInput::placeholder {
  text-align: center;
}

#screenStudentJoin #studentCodeInput {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 800;
  color: var(--gold-light);
}

#screenStudentJoin .buttons {
  justify-content: center;
}

#screenStudentWaiting {
  text-align: center;
}

#screenStudentWaiting p,
#screenStudentWaiting h2,
#screenStudentWaiting strong {
  text-align: center;
}

#screenStudentWaiting .buttons {
  justify-content: center;
}

#screenTeacherExerciseMode {
  text-align: center;
}

#screenTeacherExerciseMode .buttons {
  justify-content: center;
}

#exerciseModeSelectionView,
#exerciseModeConfigView {
  width: 100%;
}

#exerciseModeConfigView {
  max-width: 900px;
  margin: 0 auto;
}

.exercise-config-back-row {
  margin: 0 0 8px;
  text-align: left;
}

.ghost-back-btn {
  background: transparent;
  color: var(--gold-light);
  border: 1px solid rgba(232, 184, 75, 0.35);
  border-radius: 12px;
  padding: 8px 12px;
  box-shadow: none;
}

.ghost-back-btn:hover:not(:disabled) {
  transform: none;
  box-shadow: none;
  border-color: rgba(232, 184, 75, 0.62);
  filter: none;
}

#exerciseModeConfigView>.subtitle {
  margin-bottom: 14px;
}

.exercise-config-description {
  max-width: 52ch;
  margin: -4px auto 14px;
  color: #c2cce0;
}

#sequenceMetricsGroup,
#comparePitchConfigGroup,
#identifyChordConfigGroup,
#intervalDictationConfigGroup,
#harmonicDictationConfigGroup {
  margin: 10px auto;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(19, 29, 56, 0.42);
  box-shadow: 0 8px 18px rgba(5, 8, 18, 0.22);
}

.help-accordion {
  margin-top: 10px;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(16, 22, 41, 0.5);
}

.help-accordion summary {
  cursor: pointer;
  color: var(--gold-light);
  font-weight: 600;
  margin-bottom: 8px;
}

.help-accordion[open] summary {
  margin-bottom: 10px;
}

.compare-config-section {
  margin-bottom: 14px;
}

.compare-config-section h3 {
  margin-bottom: 10px;
  font-size: 0.95rem;
  color: var(--gold-light);
  text-align: left;
}

.compare-config-grid-music {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

#exerciseModeConfigView .compare-config-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

#exerciseModeConfigView .intensity-config-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

#exerciseModeConfigView .duration-config-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

#exerciseModeConfigView #harmonicDictationConfigGrid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  max-width: 1100px;
}

#durationSequenceLengthGroup:not(.hidden) + .duration-questions-card {
  grid-column: 2;
}

.compare-option-card {
  position: relative;
  text-align: left;
  border-radius: 16px;
  padding: 14px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.08), rgba(16, 22, 41, 0.72));
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 8px 18px rgba(5, 8, 18, 0.24);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  column-gap: 8px;
}

.compare-option-card:hover {
  transform: translateY(-1px);
  border-color: rgba(167, 139, 250, 0.5);
  box-shadow: 0 12px 24px rgba(124, 58, 237, 0.2);
}

.compare-option-card label {
  display: block;
  margin-bottom: 0;
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
}

.compare-option-card select {
  grid-column: 1 / -1;
  margin-top: 8px;
  font-size: 1rem;
  font-weight: 700;
}

.compare-option-card input[type="range"] {
  grid-column: 1 / -1;
  margin: 8px 0 0;
}

.compare-option-card > .interval-options-title {
  margin-bottom: 0;
  white-space: nowrap;
}

.compare-option-card > .interval-options-grid {
  grid-column: 1 / -1;
  margin-top: 8px;
}

.compare-option-icon {
  width: 22px;
  height: 22px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(124, 58, 237, 0.22);
  display: inline-block;
  margin-bottom: 0;
  position: relative;
}

.compare-option-icon::before,
.compare-option-icon::after {
  content: "";
  position: absolute;
  background: var(--gold-light);
}

.compare-option-icon-questions::before {
  width: 12px;
  height: 2px;
  left: 5px;
  top: 7px;
}

.compare-option-icon-questions::after {
  width: 12px;
  height: 2px;
  left: 5px;
  top: 13px;
}

.compare-option-icon-speed::before {
  width: 2px;
  height: 10px;
  left: 10px;
  top: 5px;
}

.compare-option-icon-speed::after {
  width: 8px;
  height: 2px;
  left: 10px;
  top: 9px;
}

.compare-option-icon-difficulty::before {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  left: 5px;
  top: 5px;
}

.compare-option-icon-difficulty::after {
  width: 6px;
  height: 2px;
  left: 14px;
  top: 14px;
  transform: rotate(40deg);
}

.compare-option-icon-execution::before {
  width: 13px;
  height: 2px;
  left: 5px;
  top: 8px;
}

.compare-option-icon-execution::after {
  width: 13px;
  height: 2px;
  left: 5px;
  top: 14px;
}

#exerciseModeConfigView .buttons.config-launch-row {
  margin-top: 32px;
  display: flex;
  justify-content: center;
  align-items: stretch;
}

#exerciseModeConfigView .config-launch-row button {
  width: min(300px, 100%);
  min-height: 54px;
  font-size: 1.05rem;
  border-radius: 18px;
}

#exerciseModeConfigView #saveExerciseModeBtn {
  box-shadow: 0 10px 26px rgba(236, 191, 74, .24);
}

#exerciseModeConfigView #saveExerciseModeBtn:hover:not(:disabled) {
  box-shadow: 0 14px 30px rgba(236, 191, 74, .34);
}

@media (max-width: 560px) {
  #exerciseModeConfigView .config-launch-row button {
    width: 100%;
  }
}

@media (max-width: 760px) {
  #exerciseModeConfigView .compare-config-grid {
    grid-template-columns: 1fr;
  }

  #sequenceMetricsGroup.order-sequence-config .metric-mode-options-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
  }

  #durationSequenceLengthGroup:not(.hidden) + .duration-questions-card {
    grid-column: auto;
  }

  #exerciseModeConfigView #harmonicDictationConfigGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: 440px;
  }

  .compare-config-grid-music {
    grid-template-columns: 1fr;
  }
}

#screenTeacherLobby {
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
  text-align: left;
}

#screenTeacherLobby h2 {
  font-size: 20px;
  text-align: center;
}

#screenTeacherLobby .buttons {
  justify-content: center;
}

.teacher-lobby-code-card,
.teacher-lobby-share-card {
  margin-top: 14px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(19, 29, 56, 0.44);
}

.teacher-lobby-code-card {
  text-align: center;
  border-color: rgba(232, 184, 75, 0.3);
  background: linear-gradient(165deg, rgba(245, 209, 122, 0.12), rgba(19, 29, 56, 0.58));
}

.teacher-lobby-code-label {
  margin: 0;
  color: var(--gold-light);
  letter-spacing: 0.16em;
  font-size: 0.78rem;
  font-weight: 800;
}

.teacher-lobby-access-row {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(140px, 1fr);
  gap: 14px;
  align-items: stretch;
  margin-top: 12px;
}

@media (max-width: 640px) {
  .teacher-lobby-access-row {
    grid-template-columns: minmax(0, 1fr);
  }
}

.teacher-lobby-access-item {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.teacher-lobby-qr-link {
  width: min(220px, 100%);
  aspect-ratio: 1 / 1;
  display: block;
  padding: 10px;
  border-radius: 18px;
  border: 1px solid rgba(232, 184, 75, 0.34);
  background: rgba(9, 14, 28, 0.48);
  box-shadow: 0 10px 24px rgba(6, 9, 18, 0.35);
}

.teacher-lobby-qr-image {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 12px;
  background: #fff;
}

.teacher-lobby-qr-hint {
  margin: 10px 0 0;
  color: #c2cce0;
  font-size: 0.9rem;
  line-height: 1.35;
}

.teacher-lobby-manual-code {
  min-height: 180px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(232, 184, 75, 0.34);
  background: rgba(9, 14, 28, 0.38);
  box-shadow: 0 10px 24px rgba(6, 9, 18, 0.24);
}

.teacher-lobby-code-title {
  margin: 0;
  color: #c2cce0;
  font-size: 0.86rem;
  font-weight: 700;
}

.teacher-lobby-code-view {
  margin: 10px 0 0;
  color: #fff5cf;
  font-family: "Poppins", "Inter", sans-serif;
  font-size: clamp(1.8rem, 7vw, 3rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.08em;
  overflow-wrap: anywhere;
}

.teacher-lobby-code-copy-btn {
  margin-top: 12px;
  padding: 0.7rem 1rem;
  border-radius: 12px;
  background: rgba(232, 184, 75, 0.16);
  color: var(--gold-light);
  border: 1px solid rgba(232, 184, 75, 0.42);
  box-shadow: none;
  font-size: 0.92rem;
}

.teacher-lobby-code-copy-btn:hover:not(:disabled) {
  border-color: rgba(232, 184, 75, 0.76);
  box-shadow: none;
  filter: none;
}

.teacher-lobby-host {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.teacher-lobby-code-actions {
  margin-top: 12px;
  justify-content: center;
}

.teacher-lobby-share-card h3 {
  margin-top: 0;
}

.teacher-lobby-share-card {
  border-color: rgba(138, 180, 255, 0.25);
  text-align: center;
}

.teacher-lobby-share-actions {
  margin-top: 10px;
  justify-content: center;
}

.teacher-lobby-secondary-btn {
  background: transparent;
  color: var(--gold-light);
  border: 1px solid rgba(232, 184, 75, 0.4);
  box-shadow: none;
}

.teacher-lobby-secondary-btn:hover:not(:disabled) {
  box-shadow: none;
  filter: none;
  border-color: rgba(232, 184, 75, 0.72);
}

.teacher-lobby-share-feedback {
  min-height: 20px;
  margin-top: 8px;
  margin-bottom: 0;
}

.teacher-lobby-share-feedback.is-ok {
  color: #7ce4be;
}

.teacher-lobby-share-feedback.is-error {
  color: #fca5a5;
}

.teacher-lobby-empty-state {
  margin: 8px 0 0;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  background: rgba(10, 15, 30, 0.45);
}

.teacher-lobby-empty-state p {
  margin: 0;
  color: #c2cce0;
  font-size: 0.92rem;
  line-height: 1.35;
}

.teacher-lobby-empty-state p+p {
  margin-top: 4px;
  color: var(--muted);
}

.teacher-lobby-students-list {
  margin-top: 10px;
}

.teacher-lobby-students-list li {
  list-style: none;
  margin-bottom: 8px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(19, 29, 56, 0.36);
}

.teacher-lobby-final-action {
  margin-top: 18px;
  justify-content: center;
}

#screenTeacherLobby #goConfigBtn {
  width: min(460px, 100%);
  min-height: 54px;
  font-size: 1.05rem;
  border-radius: 18px;
  box-shadow: 0 10px 26px rgba(236, 191, 74, 0.24);
}

@media (max-width: 760px) {
  .teacher-lobby-share-actions {
    justify-content: center;
  }

  .teacher-lobby-share-actions button {
    width: 100%;
  }
}

#screenTeacherExerciseMode #comparePitchConfigGroup>.subtitle {
  text-align: center;
}

#identifyMetricQuestionsCount {
  width: 100%;
  margin-left: 0;
  margin-right: 0;
}

.metric-mode-options-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 1rem;
  margin: 1rem auto 0;
}

#identifyMetricQuestionsGroup {
  display: contents;
}

.identify-metric-config-item {
  display: grid;
  gap: 0.45rem;
  flex: 1 1 220px;
  max-width: 300px;
}

.rhythm-tempo-config-item {
  display: grid;
  gap: 0.45rem;
  width: min(460px, 100%);
  margin: 1rem auto 0;
}

.rhythm-tempo-config-item input {
  width: 100%;
}

.teacher-metronome-config {
  display: grid;
  gap: 0.45rem;
  margin-top: 1rem;
}

.teacher-metronome-config select {
  width: 100%;
}

.teacher-metronome-config .subtitle {
  margin: 0;
  text-align: left;
}

#orderSequenceBarsCount {
  width: 100px;
  margin-left: auto;
  margin-right: auto;
}

#orderSequenceRoundsCount {
  width: 100px;
  margin-left: auto;
  margin-right: auto;
}

#screenTeacherConfig .controls {
  text-align: center;
}

#screenTeacherConfig .controls .buttons {
  justify-content: center;
}

#screenGame.compare-mode #gameTitle,
#screenGame.intensity-mode #gameTitle {
  text-align: center;
}

#screenGame.compare-mode.student-role .game,
#screenGame.intensity-mode.student-role .game,
#screenGame.interval-mode.student-role .game {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

#screenGame.compare-mode.student-role #gameTitle,
#screenGame.compare-mode.student-role #gameSubtitle,
#screenGame.compare-mode.student-role #pianoStatus,
#screenGame.intensity-mode.student-role #gameTitle,
#screenGame.intensity-mode.student-role #gameSubtitle,
#screenGame.intensity-mode.student-role #pianoStatus,
#screenGame.interval-mode.student-role #gameTitle,
#screenGame.interval-mode.student-role #gameSubtitle,
#screenGame.interval-mode.student-role #pianoStatus {
  text-align: center;
}

#screenGame.compare-mode.student-role #exerciseProgressHeader,
#screenGame.intensity-mode.student-role #exerciseProgressHeader,
#screenGame.interval-mode.student-role #exerciseProgressHeader {
  order: 1;
}

#screenGame.compare-mode.student-role #gameTitle,
#screenGame.intensity-mode.student-role #gameTitle,
#screenGame.interval-mode.student-role #gameTitle {
  order: 2;
  margin-bottom: 0;
}

#screenGame.compare-mode.student-role #gameSubtitle,
#screenGame.intensity-mode.student-role #gameSubtitle,
#screenGame.interval-mode.student-role #gameSubtitle {
  order: 3;
  margin-bottom: 0.2rem;
}

#screenGame.compare-mode.student-role .game>.buttons,
#screenGame.intensity-mode.student-role .game>.buttons,
#screenGame.interval-mode.student-role .game>.buttons {
  order: 4;
}

#screenGame.compare-mode.student-role #comparePitchBoard,
#screenGame.intensity-mode.student-role #compareIntensityBoard,
#screenGame.interval-mode.student-role #identifyIntervalBoard {
  order: 5;
}

#screenGame.compare-mode.student-role #pianoStatus,
#screenGame.intensity-mode.student-role #pianoStatus,
#screenGame.interval-mode.student-role #pianoStatus {
  order: 6;
  margin-left: auto;
  margin-right: auto;
}

#screenGame.compare-mode .game>.buttons,
#screenGame.intensity-mode .game>.buttons {
  justify-content: center;
}

#screenGame.identify-mode #gameTitle,
#screenGame.identify-mode #gameSubtitle {
  text-align: center;
}

#screenGame.identify-mode .game>.buttons {
  justify-content: center;
}

#screenGame.chord-mode #gameTitle,
#screenGame.chord-mode #gameSubtitle {
  text-align: center;
}

#screenGame.interval-mode #gameTitle,
#screenGame.interval-mode #gameSubtitle,
#screenGame.interval-mode #pianoStatus {
  text-align: center;
}

#screenGame.harmonic-mode #gameTitle,
#screenGame.harmonic-mode #gameSubtitle {
  text-align: center;
}

#screenGame.order-mode #gameTitle {
  text-align: center;
}

#screenGame.order-mode #gameSubtitle {
  text-align: center;
}

#screenGame.order-mode .game>.buttons {
  justify-content: center;
}

#screenGame.order-mode.student-role #gameTitle,
#screenGame.order-mode.student-role #gameSubtitle {
  text-align: center;
}

#screenGame.order-mode.student-role .game>.buttons {
  justify-content: center;
}

#screenGame.chord-mode .game>.buttons {
  justify-content: center;
}

#screenGame.interval-mode .game>.buttons {
  justify-content: center;
}

#screenGame.harmonic-mode .game>.buttons {
  justify-content: center;
}

button {
  border: none;
  border-radius: 16px;
  padding: 14px 18px;
  cursor: pointer;
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  color: #15120a;
  font-weight: 700;
  transition: transform 0.18s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(232, 184, 75, 0.25);
  filter: brightness(1.02);
}

button:focus-visible {
  outline: 2px solid var(--gold-light);
  outline-offset: 2px;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#stopBtn {
  background: #dc2626;
  color: #fff;
}

#saveExerciseModeBtn,
#goConfigBtn,
#compareNextBtn,
#chordNextBtn,
#intervalNextBtn,
#nextHarmonicExerciseBtn,
#newRoundBtn {
  color: #1a1306;
  background: linear-gradient(180deg, #f2cf69, #e5b948);
}

#checkBtn {
  background: var(--violet);
  color: #fff;
}

/* === Bienvenida SaaS: selector de rol + guía === */
.welcome-panel {
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}

.welcome-panel .role-selector > .welcome-kicker,
.welcome-panel .role-selector > h2 {
  text-align: center;
}

.welcome-kicker {
  color: var(--gold-light);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 8px;
}

.role-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 16px;
}

.role-card-btn {
  width: 100%;
  text-align: left;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.1), rgba(19, 29, 56, 0.4));
  color: var(--white);
  box-shadow: 0 8px 26px rgba(6, 9, 18, 0.32);
}

.role-card-btn:hover:not(:disabled),
.role-card-btn:focus-visible:not(:disabled) {
  border-color: rgba(167, 139, 250, 0.6);
  box-shadow: 0 10px 28px rgba(124, 58, 237, 0.24);
}

.role-card-btn.is-disabled {
  opacity: 0.62;
  cursor: not-allowed;
  transition: none;
}

.role-icon {
  --icon-size: 40px;
  display: inline-flex;
  width: var(--icon-size);
  height: var(--icon-size);
  border-radius: 12px;
  margin-bottom: 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.18), transparent 55%),
    rgba(124, 58, 237, 0.18);
  position: relative;
}

.role-icon::before,
.role-icon::after {
  content: "";
  position: absolute;
}

.role-icon-teacher::before {
  width: 18px;
  height: 14px;
  border-radius: 4px;
  border: 2px solid var(--gold-light);
  top: 10px;
  left: 10px;
}

.role-icon-teacher::after {
  width: 12px;
  height: 2px;
  background: var(--gold-light);
  border-radius: 999px;
  bottom: 9px;
  left: 14px;
}

.role-icon-student::before {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--gold-light);
  top: 8px;
  left: 8px;
}

.role-icon-student::after {
  width: 8px;
  height: 8px;
  border: 2px solid var(--gold-light);
  border-radius: 50%;
  top: 14px;
  left: 14px;
}

.role-icon-practice::before {
  width: 18px;
  height: 18px;
  border: 2px solid var(--gold-light);
  border-radius: 50%;
  top: 9px;
  left: 9px;
}

.role-icon-practice::after {
  width: 10px;
  height: 2px;
  background: var(--gold-light);
  border-radius: 999px;
  top: 18px;
  left: 14px;
  box-shadow: 0 -5px 0 rgba(251, 191, 36, 0.8), 0 5px 0 rgba(251, 191, 36, 0.8);
}

.role-title {
  display: block;
  font-family: 'Poppins', 'Inter', sans-serif;
  font-size: 1.06rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.role-description {
  display: block;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.role-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  margin-top: 14px;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(251, 191, 36, 0.14);
  border: 1px solid rgba(251, 191, 36, 0.34);
  color: var(--gold-light);
  font-weight: 700;
  font-size: 0.88rem;
}

.role-card-status {
  display: inline-flex;
  margin-top: 14px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  color: var(--white);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.auth-page {
  max-width: 620px;
}

.auth-hero {
  padding-bottom: 8px;
}

.auth-panel {
  margin-inline: auto;
  width: min(100%, 520px);
  text-align: center;
}

.auth-panel h1 {
  font-family: "Poppins", sans-serif;
  font-size: clamp(1rem, 6vw, 1.75rem);
  margin-bottom: 8px;
  white-space: nowrap;
}

.auth-form {
  display: grid;
  gap: 10px;
  margin-top: 24px;
}

.auth-form input[type="email"],
.auth-form input[type="password"] {
  width: 100%;
  min-height: 44px;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card-2);
  color: var(--white);
  caret-color: var(--gold-light);
  font: inherit;
  cursor: text;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.auth-form input[type="email"]:hover:not(:disabled),
.auth-form input[type="password"]:hover:not(:disabled) {
  border-color: var(--gold);
}

.auth-form input[type="email"]:focus,
.auth-form input[type="email"]:focus-visible,
.auth-form input[type="password"]:focus,
.auth-form input[type="password"]:focus-visible {
  border-color: var(--gold-light);
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  box-shadow: 0 0 0 2px var(--gold-dim);
}

.auth-form input[type="email"]:disabled,
.auth-form input[type="password"]:disabled {
  background: var(--bg-card);
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.65;
}

.auth-form input[type="email"]:user-invalid,
.auth-form input[type="password"]:user-invalid {
  border-color: var(--danger);
}

@supports not selector(input:user-invalid) {
  .auth-form input[type="email"]:invalid:not(:focus),
  .auth-form input[type="password"]:invalid:not(:focus) {
    border-color: var(--danger);
  }
}

.auth-form input[type="email"]:-webkit-autofill,
.auth-form input[type="email"]:-webkit-autofill:hover,
.auth-form input[type="email"]:-webkit-autofill:active,
.auth-form input[type="password"]:-webkit-autofill,
.auth-form input[type="password"]:-webkit-autofill:hover,
.auth-form input[type="password"]:-webkit-autofill:active,
.auth-form input[type="email"]:autofill,
.auth-form input[type="password"]:autofill {
  border-color: var(--border);
  background: var(--bg-card-2);
  color: var(--white);
  caret-color: var(--gold-light);
  -webkit-text-fill-color: var(--white);
  -webkit-box-shadow: 0 0 0 1000px var(--bg-card-2) inset;
  box-shadow: 0 0 0 1000px var(--bg-card-2) inset;
}

.auth-form input[type="email"]:-webkit-autofill:focus,
.auth-form input[type="password"]:-webkit-autofill:focus,
.auth-form input[type="email"]:autofill:focus,
.auth-form input[type="password"]:autofill:focus {
  border-color: var(--gold-light);
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.auth-form button {
  margin-top: 12px;
}

.auth-message {
  border-radius: 12px;
  margin-top: 18px;
  padding: 12px 14px;
}

.auth-message.error {
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(248, 113, 113, 0.45);
  color: #fecaca;
}

.auth-back-link {
  margin-top: 22px;
  text-align: center;
}

.auth-back-link a,
.auth-back-link a:visited {
  color: var(--gold);
}

.auth-back-link a:hover {
  color: var(--gold-light);
}

.auth-back-link a:focus-visible {
  color: var(--gold-light);
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.auth-back-link a:active {
  color: var(--gold);
}

.teacher-account-bar {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: center;
  margin: 0 auto 12px;
  max-width: 1180px;
  padding-inline: 4px;
  text-align: center;
}

.teacher-account-bar p {
  margin: 0;
}

.teacher-account-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.teacher-account-actions form {
  margin: 0;
}

.teacher-account-bar button {
  padding: 8px 12px;
}

#headerTeacherRoomsBtn:hover:not(:disabled) {
  color: var(--gold-light);
}

#headerTeacherRoomsBtn:focus-visible {
  outline: 2px solid var(--gold-light);
  outline-offset: 2px;
}

#headerTeacherRoomsBtn:active:not(:disabled) {
  border-color: var(--gold);
  color: var(--gold);
  transform: translateY(0);
}

@media (max-width: 640px) {
  .teacher-account-bar {
    align-items: center;
    flex-direction: column;
  }

  .teacher-account-actions {
    max-width: 100%;
  }
}

.welcome-steps {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.steps-list {
  list-style: none;
  display: grid;
  gap: 10px;
  color: #d7dfef;
  font-size: 0.93rem;
}

.steps-list li {
  display: flex;
  align-items: center;
  gap: 10px;
}

.step-chip {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(124, 58, 237, 0.26);
  border: 1px solid rgba(167, 139, 250, 0.5);
  color: var(--gold-light);
  font-weight: 700;
  font-size: 0.78rem;
  flex: 0 0 auto;
}

/* === Formularios de acceso inicial === */
#screenTeacherStart,
#screenStudentJoin,
#screenPracticePlaceholder {
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

#screenTeacherStart label,
#screenStudentJoin label {
  text-align: left;
  max-width: 420px;
  margin: 0 auto 8px;
}

#screenTeacherStart #teacherName,
#screenTeacherStart #roomName,
#screenStudentJoin #studentName,
#screenStudentJoin #studentCodeInput {
  width: 100%;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
  padding: 14px 16px;
  border-radius: 16px;
}

#screenTeacherStart .buttons,
#screenStudentJoin .buttons,
#screenPracticePlaceholder .buttons {
  justify-content: center;
}

#createSessionBtn,
#joinSessionBtn,
#repeatPracticeBtn,
#backFromPracticeBtn {
  width: min(420px, 100%);
  min-height: 50px;
}

#screenTeacherStart .subtitle {
  max-width: 420px;
  margin: 0 auto 24px;
}

#screenPracticePlaceholder .subtitle {
  max-width: 430px;
  margin: 0 auto 24px;
}

.practice-result-line {
  display: block;
  margin: 6px 0;
}

#screenTeacherStart #teacherName,
#screenTeacherStart #roomName {
  margin-bottom: 20px;
}

#screenTeacherStart .buttons {
  margin-top: 8px;
  margin-bottom: 16px;
}

#createSessionBtn {
  width: 100%;
  max-width: 420px;
  padding: 14px 24px;
  font-size: 18px;
  font-weight: 700;
  border-radius: 18px;
  background: linear-gradient(180deg, #F2CF69, #E5B948);
  box-shadow: 0 8px 24px rgba(236, 191, 74, 0.25);
  transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
}

#createSessionBtn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(236, 191, 74, 0.35);
  filter: brightness(1.03);
}

#createSessionBtn:active:not(:disabled) {
  transform: scale(.98);
}

#createSessionBtn[data-loading="true"] {
  position: relative;
  color: rgba(21, 18, 10, 0.92);
}

#createSessionBtn[data-loading="true"]::after {
  content: "";
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(21, 18, 10, 0.25);
  border-top-color: rgba(21, 18, 10, 0.9);
  display: inline-block;
  vertical-align: middle;
  margin-left: 10px;
  animation: spin 0.75s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (min-width: 760px) {
  .role-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

#finishRoundBtn,
#finishHarmonicSeriesBtn {
  background: #dc2626;
  color: #fff;
}

.identify-board {
  margin-top: 0.9rem;
  padding: 0.7rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-card-2);
}

.identify-label {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 0.55rem;
}

.identify-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(72px, 1fr));
  gap: 0.55rem;
}

#identifyMetricBoard {
  text-align: center;
}

#identifyMetricBoard .identify-options {
  grid-template-columns: repeat(2, minmax(140px, 160px));
  justify-content: center;
}

#identifyIntervalBoard .identify-options {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.7rem;
}

#identifyIntervalBoard .interval-answer-option {
  width: 100%;
}

.identify-option {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.08), rgba(16, 22, 41, 0.72));
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--gold);
  border-radius: 14px;
  font-size: 1.06rem;
  font-weight: 800;
  padding: 1.15rem 0.95rem;
  min-height: 104px;
  transition: transform 0.2s ease, box-shadow 0.22s ease, border-color 0.22s ease, background 0.22s ease;
}

.compare-answer-option,
.intensity-answer-option,
.duration-answer-option,
.chord-answer-option,
.chord-inversion-answer-option {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.08), rgba(16, 22, 41, 0.72));
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--gold);
  border-radius: 14px;
  font-size: 1.06rem;
  font-weight: 800;
  padding: 1.15rem 0.95rem;
  min-height: 104px;
  transition: transform 0.2s ease, box-shadow 0.22s ease, border-color 0.22s ease, background 0.22s ease;
}

.chord-answer-option {
  font-size: 0.98rem;
  padding: 0.9rem 0.7rem;
  min-height: 76px;
}

.interval-answer-option {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.08), rgba(16, 22, 41, 0.72));
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--gold);
  border-radius: 14px;
  font-size: 0.98rem;
  font-weight: 800;
  padding: 0.9rem 0.7rem;
  min-height: 76px;
  transition: transform 0.2s ease, box-shadow 0.22s ease, border-color 0.22s ease, background 0.22s ease;
}

.chord-inversion-answer-option {
  font-size: 0.85rem;
  padding: 0.82rem 0.58rem;
  min-height: 76px;
}

.identify-option.selected {
  border-color: var(--gold-light);
  box-shadow: 0 0 0 2px rgba(232, 184, 75, 0.28), 0 12px 24px rgba(8, 12, 24, 0.26);
  background: var(--gold-dim);
  transform: translateY(-1px);
  animation: compare-answer-pulse 0.2s ease;
}

.identify-option:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: rgba(232, 184, 75, 0.58);
  box-shadow: 0 12px 24px rgba(8, 12, 24, 0.28);
}

.identify-option:focus-visible {
  outline: 2px solid rgba(232, 184, 75, 0.7);
  outline-offset: 2px;
}

.compare-answer-option.selected,
.intensity-answer-option.selected,
.duration-answer-option.selected,
.chord-answer-option.selected,
.chord-inversion-answer-option.selected {
  border-color: var(--gold-light);
  box-shadow: 0 0 0 2px rgba(232, 184, 75, 0.28), 0 12px 24px rgba(8, 12, 24, 0.26);
  background: var(--gold-dim);
  transform: translateY(-1px);
  animation: compare-answer-pulse 0.2s ease;
}

.compare-answer-option:hover:not(:disabled),
.intensity-answer-option:hover:not(:disabled),
.duration-answer-option:hover:not(:disabled),
.chord-answer-option:hover:not(:disabled),
.chord-inversion-answer-option:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: rgba(232, 184, 75, 0.58);
  box-shadow: 0 12px 24px rgba(8, 12, 24, 0.28);
}

.compare-answer-option:focus-visible,
.intensity-answer-option:focus-visible,
.duration-answer-option:focus-visible,
.chord-answer-option:focus-visible,
.chord-inversion-answer-option:focus-visible {
  outline: 2px solid rgba(232, 184, 75, 0.7);
  outline-offset: 2px;
}

@keyframes compare-answer-pulse {
  from {
    transform: scale(0.985);
  }

  to {
    transform: scale(1);
  }
}

.interval-answer-option.selected {
  border-color: var(--gold-light);
  box-shadow: 0 0 0 2px rgba(232, 184, 75, 0.28), 0 12px 24px rgba(8, 12, 24, 0.26);
  background: var(--gold-dim);
  transform: translateY(-1px);
  animation: compare-answer-pulse 0.2s ease;
}

.compare-options {
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 0.7rem;
}

.compare-options .compare-answer-option {
  width: 100%;
  justify-self: center;
}

.compare-options .intensity-answer-option {
  width: 100%;
  justify-self: center;
}

.compare-options .duration-answer-option {
  width: 100%;
  justify-self: center;
}

.duration-sequence-workspace {
  width: min(820px, 100%);
  margin-inline: auto;
  text-align: center;
}

.duration-sequence-slots,
.duration-sequence-sources {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.7rem;
}

.duration-sequence-slot,
.duration-sequence-source {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 82px;
  min-height: 76px;
  padding: 0.8rem;
  border-radius: 14px;
  border: 1px dashed rgba(232, 184, 75, 0.54);
  background: rgba(255, 255, 255, 0.035);
  color: var(--gold);
  font-weight: 800;
}

.duration-sequence-slot.filled {
  border-style: solid;
  background: var(--gold-dim);
}

.duration-sequence-source[draggable="true"],
.duration-sequence-slot.filled[draggable="true"] {
  -webkit-user-drag: element;
}

.duration-sequence-slot.drop-over {
  border-color: var(--gold-light);
  box-shadow: 0 0 0 3px rgba(232, 184, 75, 0.2);
  transform: translateY(-2px);
}

.duration-sequence-slot.is-playing {
  border-color: var(--violet-light);
  background: var(--violet-dim);
  box-shadow: 0 0 0 2px rgba(167, 139, 250, 0.2);
}

.duration-sequence-help {
  margin: 1rem auto 0.75rem;
  color: var(--muted);
  text-align: center;
}

.duration-sequence-source {
  min-width: 132px;
  border-style: solid;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.08), rgba(16, 22, 41, 0.72));
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.duration-sequence-slot.filled {
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.duration-sequence-source:active {
  cursor: grabbing;
}

.duration-sequence-source.selected {
  border-color: var(--gold-light);
  background: var(--gold-dim);
  box-shadow: 0 0 0 3px rgba(232, 184, 75, 0.2);
}

.duration-sequence-source.pointer-active,
.duration-sequence-slot.pointer-active {
  border-color: var(--gold-light);
  box-shadow: 0 0 0 3px rgba(232, 184, 75, 0.22);
}

.duration-sequence-source.pointer-dragging,
.duration-sequence-slot.pointer-dragging {
  opacity: 0.45;
}

.duration-sequence-workspace.pointer-dragging {
  user-select: none;
  -webkit-user-select: none;
}

.duration-sequence-drag-ghost {
  position: fixed;
  z-index: 10000;
  min-width: 96px;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--gold-light);
  border-radius: 14px;
  background: var(--bg-card);
  color: var(--gold-light);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.34);
  font-weight: 800;
  text-align: center;
  pointer-events: none;
  user-select: none;
  transform: translate(-50%, -65%);
}

#screenGame.duration-mode .game,
#screenGame.duration-mode #durationComparisonBoard,
#screenGame.duration-mode .game-header,
#screenGame.duration-mode .game-controls,
#screenGame.duration-mode .feedback,
#screenGame.duration-mode .answer-review,
#screenGame.duration-mode #gameTitle,
#screenGame.duration-mode #gameSubtitle,
#screenGame.duration-mode #durationPrompt {
  text-align: center;
  margin-left: auto;
  margin-right: auto;
}

#screenGame.duration-mode .game-controls,
#screenGame.duration-mode .buttons,
#screenGame.duration-mode .compare-options {
  justify-content: center;
}

#screenGame.duration-mode #durationComparisonBoard {
  width: min(860px, 100%);
}

#screenGame.duration-mode .compare-options {
  width: min(620px, 100%);
  margin-left: auto;
  margin-right: auto;
}

#screenGame.order-mode .game,
#screenGame.identify-mode .game,
#screenGame.compare-mode .game,
#screenGame.intensity-mode .game,
#screenGame.duration-mode .game,
#screenGame.chord-mode .game,
#screenGame.interval-mode .game,
#screenGame.harmonic-mode .game {
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

#screenGame.identify-mode #identifyMetricBoard,
#screenGame.order-mode #orderSequenceBoard,
#screenGame.compare-mode #comparePitchBoard,
#screenGame.intensity-mode #compareIntensityBoard,
#screenGame.chord-mode #identifyChordBoard,
#screenGame.interval-mode #identifyIntervalBoard {
  width: min(760px, 100%);
  margin: 0.9rem auto 0;
  padding: 18px;
  border-radius: 18px;
  background: rgba(19, 29, 56, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 18px rgba(5, 8, 18, 0.22);
}

#screenGame.identify-mode #identifyMetricBoard>.identify-label,
#screenGame.order-mode #orderSequenceBoard>.identify-label,
#screenGame.compare-mode #comparePitchBoard>.identify-label,
#screenGame.intensity-mode #compareIntensityBoard>.identify-label,
#screenGame.chord-mode #identifyChordBoard>.identify-label,
#screenGame.interval-mode #identifyIntervalBoard>.identify-label {
  text-align: center;
}

#screenGame.order-mode .deck-panel {
  width: min(760px, 100%);
  margin-left: auto;
  margin-right: auto;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  background: rgba(19, 29, 56, 0.42);
  box-shadow: 0 8px 18px rgba(5, 8, 18, 0.22);
}

.interval-answer-option:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: rgba(232, 184, 75, 0.58);
  box-shadow: 0 12px 24px rgba(8, 12, 24, 0.28);
}

.interval-answer-option:focus-visible {
  outline: 2px solid rgba(232, 184, 75, 0.7);
  outline-offset: 2px;
}

.exercise-progress-track {
  width: 100%;
  height: 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
  margin: -2px 0 12px;
}

.exercise-progress-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #f2cf69, #e5b948);
  transition: width 0.24s ease;
}

.exercise-progress-header {
  width: min(680px, 100%);
  margin: 0 auto 0.1rem;
}

.exercise-progress-header .identify-label {
  text-align: center;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.compare-secondary-actions {
  justify-content: center;
  margin-top: 0.55rem;
}

#exerciseFlowBtn {
  min-height: 52px;
  min-width: min(320px, 100%);
  font-size: 1rem;
}

#exerciseFlowBtn.danger {
  background: #dc2626;
  color: #fff;
}

.chord-options {
  grid-template-columns: 1fr;
}

.chord-answer-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  align-items: start;
}

.chord-answer-column {
  min-width: 0;
}

#identifyChordBoard.quality-only .chord-answer-columns {
  grid-template-columns: 1fr;
}

#identifyChordBoard.quality-only .chord-options {
  grid-template-columns: repeat(2, minmax(180px, 1fr));
}

.chord-column-label {
  margin-bottom: 0.45rem;
}

.chord-inversion-options {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.chord-inversion-options .chord-inversion-answer-option[data-inversion="2"] {
  grid-column: 2;
}

#identifyChordConfigGroup .metric-options.chord-inversion-config-options {
  grid-template-columns: repeat(3, minmax(120px, max-content));
}

#identifyChordConfigGroup .metric-options.chord-inversion-config-options .inversion-state-two {
  grid-column: 2;
}

@media (max-width: 760px) {
  .chord-answer-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
  }

  .chord-column-label {
    font-size: 0.82rem;
    margin-bottom: 0.35rem;
  }

  .chord-answer-option,
  .chord-inversion-answer-option,
  .interval-answer-option {
    font-size: 0.86rem;
    padding: 0.68rem 0.42rem;
    border-radius: 10px;
    min-height: 64px;
  }

  #identifyChordBoard .identify-options {
    gap: 0.42rem;
  }

  #identifyChordBoard.quality-only .chord-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #identifyIntervalBoard .identify-options {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.42rem;
  }
}

.compare-help {
  margin-top: 0.6rem;
  padding: 0.65rem 0.7rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  text-align: left;
}

#harmonicDictationConfigGrid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 0.7rem 1rem;
  max-width: 820px;
  margin: 0 auto 0.75rem;
}

@media (max-width: 980px) {
  #harmonicDictationConfigGrid {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
    max-width: 440px;
  }
}

@media (max-width: 560px) {
  #harmonicDictationConfigGrid {
    grid-template-columns: 1fr;
    max-width: 180px;
  }
}

.harmonic-config-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
}

.harmonic-config-item label {
  margin-bottom: 0;
  text-align: center;
}

#harmonicRoundsCount,
#harmonicTonalityMode,
#harmonicBarsCount,
#harmonicSpeedSelect {
  width: 100%;
}

#screenTeacherExerciseMode #comparePitchConfigGroup .compare-help,
#screenTeacherExerciseMode #comparePitchConfigGroup .compare-help p {
  text-align: left !important;
}

#sequenceMetricsGroup #orderSequenceConfigGrid {
  display: contents;
}

#sequenceMetricsGroup #orderSequenceRoundsConfigGroup,
#sequenceMetricsGroup #orderSequenceBarsConfigGroup {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 0.3rem 0.5rem;
  flex: 1 1 220px;
  max-width: 300px;
}

.metric-mode-options-row #metronomeSubdivisionGroup {
  flex: 1 1 220px;
  width: auto;
  max-width: 300px;
  margin: 0;
}

.metric-mode-options-row #rhythmTempoGroup {
  flex: 1 1 220px;
  width: auto;
  max-width: 300px;
  margin: 0;
}

.metric-mode-options-row select {
  width: 100%;
}

#sequenceMetricsGroup #orderSequenceRoundsConfigGroup label,
#sequenceMetricsGroup #orderSequenceBarsConfigGroup label {
  margin-bottom: 0;
  text-align: left;
}

#sequenceMetricsGroup .metric-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(96px, max-content));
  justify-content: center;
  align-items: center;
  justify-items: stretch;
  gap: 0.38rem 0.85rem;
  margin: 0.08rem auto 0.3rem;
  width: fit-content;
  max-width: 100%;
}

#metricsGroupHelp.identify-metric-help {
  margin-top: 20px;
}

#metricsGroupHelp.order-sequence-help {
  margin-top: 20px;
}

#sequenceMetricsGroup .metric-options label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 1.75rem;
  margin: 0;
}

#sequenceMetricsGroup .metric-options .metric-config-chip {
  display: block;
  min-height: 0;
  width: 100%;
}

#sequenceMetricsGroup .metric-options .metric-config-chip input[type="checkbox"] {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

#sequenceMetricsGroup .metric-options .metric-config-chip-label,
#identifyChordConfigGroup .metric-options .chord-config-chip-label,
#intervalDictationConfigGroup .metric-options .chord-config-chip-label,
#harmonicDictationConfigGroup .metric-options .chord-config-chip-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 1.95rem;
  padding: 0.44rem 0.72rem;
  border-radius: 12px;
  border: 1px solid var(--gold);
  background: linear-gradient(145deg, #122a57 0%, #0d1f45 100%);
  color: var(--gold);
  font-size: 0.8rem;
  font-weight: 800;
  text-align: center;
  line-height: 1.2;
  cursor: pointer;
  user-select: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease, color 0.12s ease;
}

#sequenceMetricsGroup .metric-options .metric-config-chip input[type="checkbox"]:checked+.metric-config-chip-label,
#identifyChordConfigGroup .metric-options .chord-config-chip input[type="checkbox"]:checked+.chord-config-chip-label,
#intervalDictationConfigGroup .metric-options .chord-config-chip input[type="checkbox"]:checked+.chord-config-chip-label,
#harmonicDictationConfigGroup .metric-options .chord-config-chip input[type="checkbox"]:checked+.chord-config-chip-label {
  background: var(--gold);
  color: #102448;
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(232, 184, 75, 0.18);
}

#sequenceMetricsGroup .metric-options .metric-config-chip input[type="checkbox"]:focus-visible+.metric-config-chip-label,
#identifyChordConfigGroup .metric-options .chord-config-chip input[type="checkbox"]:focus-visible+.chord-config-chip-label,
#intervalDictationConfigGroup .metric-options .chord-config-chip input[type="checkbox"]:focus-visible+.chord-config-chip-label,
#harmonicDictationConfigGroup .metric-options .chord-config-chip input[type="checkbox"]:focus-visible+.chord-config-chip-label {
  box-shadow: 0 0 0 3px rgba(232, 184, 75, 0.22);
}

#sequenceMetricsGroup .metric-options .metric-config-chip input[type="checkbox"]:disabled+.metric-config-chip-label,
#identifyChordConfigGroup .metric-options .chord-config-chip input[type="checkbox"]:disabled+.chord-config-chip-label,
#intervalDictationConfigGroup .metric-options .chord-config-chip input[type="checkbox"]:disabled+.chord-config-chip-label,
#harmonicDictationConfigGroup .metric-options .chord-config-chip input[type="checkbox"]:disabled+.chord-config-chip-label {
  opacity: 0.45;
  cursor: not-allowed;
}

#sequenceMetricsGroup .metric-options .metric-config-chip:active .metric-config-chip-label,
#identifyChordConfigGroup .metric-options .chord-config-chip:active .chord-config-chip-label,
#intervalDictationConfigGroup .metric-options .chord-config-chip:active .chord-config-chip-label,
#harmonicDictationConfigGroup .metric-options .chord-config-chip:active .chord-config-chip-label {
  transform: translateY(1px);
}

#intervalDictationConfigGroup .subtitle {
  margin: 0.14rem 0 0.24rem;
}

#intervalDictationOptionsGrid {
  display: grid;
  gap: 0.42rem;
  justify-content: center;
  margin: 8px auto 0;
  width: 100%;
  max-width: 100%;
}

#intervalDictationConfigGroup .interval-options-card {
  grid-column: 1 / -1;
  justify-self: center;
  width: min(520px, 100%);
  text-align: center;
}

#intervalDictationConfigGroup .interval-options-row {
  display: grid;
  align-items: center;
  justify-items: stretch;
  gap: 0.42rem;
  margin: 0;
  width: 100%;
  max-width: 100%;
}

#intervalDictationConfigGroup .interval-options-row-top {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

#intervalDictationConfigGroup .interval-options-row-bottom {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

#intervalDictationConfigGroup .interval-options-row .chord-config-chip {
  display: block;
  min-height: 0;
  width: 100%;
}

#intervalDictationConfigGroup .interval-options-row .chord-config-chip input[type="checkbox"] {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

#intervalDictationConfigGroup .interval-options-row label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 1.75rem;
  margin: 0;
}

#intervalDictationConfigGroup .metric-options .chord-config-chip-label {
  width: 100%;
  padding: 0.42rem 0.5rem;
  text-align: center;
}

#intervalDictationConfigGroup .interval-options-title {
  display: block;
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

#identifyChordConfigGroup .metric-options {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, max-content));
  justify-content: center;
  align-items: center;
  justify-items: stretch;
  gap: 0.38rem 0.85rem;
  margin: 0.08rem auto 0.3rem;
  width: fit-content;
  max-width: 100%;
}

#identifyChordConfigGroup .subtitle {
  margin: 0.14rem 0 0.24rem;
}

#identifyChordConfigGroup .metric-options+.subtitle {
  margin-top: 0;
}

#identifyChordConfigGroup .chord-types-title {
  margin-top: 20px;
  margin-bottom: 20px;
}

#identifyChordConfigGroup .metric-options + .chord-inversions-title {
  margin-top: 30px;
  margin-bottom: 20px;
}

#identifyChordConfigGroup .metric-options label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 1.75rem;
  margin: 0;
}

#identifyChordConfigGroup .metric-options .chord-config-chip {
  display: block;
  min-height: 0;
  width: 100%;
}

#identifyChordConfigGroup .metric-options .chord-config-chip input[type="checkbox"] {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

#harmonicDictationConfigGroup .harmonic-degrees-title {
  margin: 0.2rem 0 0.24rem;
}

#harmonicDictationConfigGroup .harmonic-tonality-title {
  margin: 0.75rem 0 0.35rem;
  text-align: center;
}

#harmonicDictationConfigGroup .harmonic-degree-options {
  display: grid;
  grid-template-columns: repeat(4, minmax(96px, max-content));
  justify-content: center;
  align-items: center;
  justify-items: stretch;
  gap: 0.38rem 0.85rem;
  margin: 0.08rem auto 0.3rem;
  width: fit-content;
  max-width: 100%;
}

#harmonicDictationConfigGroup .harmonic-degree-options label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 1.75rem;
  margin: 0;
}

#harmonicDictationConfigGroup .harmonic-degree-options .chord-config-chip {
  display: block;
  min-height: 0;
  width: 100%;
}

#harmonicDictationConfigGroup .harmonic-degree-options .chord-config-chip input[type="checkbox"] {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

#harmonicDictationConfigGroup {
  margin-bottom: 20px;
}

#identifyChordConfigGroup .chord-inline-controls,
#intervalDictationConfigGroup .chord-inline-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
  align-items: end;
  margin-top: 0.2rem;
}

#identifyChordConfigGroup .chord-inline-control,
#intervalDictationConfigGroup .chord-inline-control {
  min-width: 0;
}

#intervalDictationConfigGroup .chord-inline-controls {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-width: 780px;
  margin-left: auto;
  margin-right: auto;
}

@media (max-width: 640px) {
  #sequenceMetricsGroup .metric-options {
    grid-template-columns: repeat(3, minmax(80px, 1fr));
    width: min(320px, 100%);
    gap: 0.42rem;
  }

  #identifyChordConfigGroup .metric-options {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
    width: min(320px, 100%);
  }

  #identifyChordConfigGroup .metric-options.chord-inversion-config-options {
    grid-template-columns: repeat(3, minmax(96px, 1fr));
  }

  #harmonicDictationConfigGroup .harmonic-degree-options {
    grid-template-columns: repeat(2, minmax(96px, 1fr));
    width: min(320px, 100%);
  }

  #intervalDictationConfigGroup .interval-options-row-top,
  #intervalDictationConfigGroup .interval-options-row-bottom {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: min(320px, 100%);
  }

  #identifyChordConfigGroup .chord-inline-controls {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  #intervalDictationConfigGroup .chord-inline-controls {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.compare-help p+p {
  margin-top: 0.35rem;
}

.slots-board {
  --slots-cols: 2;
  display: grid;
  grid-template-columns: repeat(var(--slots-cols), var(--tile-size));
  gap: 0.7rem;
  justify-content: center;
  margin-top: 0.7rem;
}

.slots-board.count-4,
.slots-board.count-8,
.slots-board.count-16 {
  --slots-cols: 4;
}

.slot {
  position: relative;
  width: var(--tile-size);
  height: var(--tile-size);
  border: 2px dashed rgba(232, 184, 75, 0.25);
  border-radius: 22px;
  background: var(--bg-card-2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.22s ease, background 0.22s ease, box-shadow 0.22s ease;
}

.slot.drop-over {
  border-color: var(--gold);
  background: var(--gold-dim);
}

.slot.is-playing {
  border-color: var(--violet-mid);
  background: var(--violet-dim);
}

.slot-index {
  position: absolute;
  top: 0.35rem;
  left: 0.45rem;
  font-size: 0.72rem;
  color: var(--muted);
}

.metric-card {
  width: 100%;
  height: 100%;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: linear-gradient(145deg, var(--bg-card-2) 0%, var(--bg-card) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1.3rem, 2vw, 1.7rem);
  font-weight: 800;
  color: var(--gold);
  cursor: grab;
  user-select: none;
  touch-action: none;
  transition: transform 0.2s ease, box-shadow 0.22s ease, border-color 0.22s ease, background 0.22s ease, opacity 0.2s ease;
}

.metric-card:hover:not(.is-locked) {
  transform: translateY(-2px);
  border-color: rgba(232, 184, 75, 0.58);
  box-shadow: 0 12px 24px rgba(8, 12, 24, 0.28);
}

.metric-card.is-locked {
  cursor: default;
  opacity: 0.58;
}

.metric-card.dragging {
  opacity: 0.45;
}

.deck {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  min-height: calc(var(--tile-size) + 0.5rem);
}

.deck .metric-card {
  width: var(--tile-size);
  height: var(--tile-size);
}

.deck.drop-over {
  background: var(--gold-dim);
}

.feedback {
  min-height: 1.4rem;
  margin-top: 0.9rem;
  font-weight: 700;
}

.feedback.ok {
  color: var(--success);
}

.feedback.error {
  color: var(--danger);
}

.piano-status {
  margin-top: 0.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.22rem 0.62rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.78rem;
  font-weight: 700;
}

.piano-status.loading {
  color: var(--muted);
}

.piano-status.ready {
  color: var(--success);
  border-color: rgba(52, 211, 153, 0.52);
  background: rgba(52, 211, 153, 0.12);
}

.piano-status.error {
  color: var(--danger);
  border-color: rgba(248, 113, 113, 0.48);
  background: rgba(248, 113, 113, 0.1);
}

.piano-status.loading {
  border-color: rgba(232, 184, 75, 0.34);
  background: rgba(232, 184, 75, 0.08);
}

@media (max-width: 760px) {
  .compare-options {
    grid-template-columns: 1fr;
  }

  .compare-answer-option {
    min-height: 86px;
    padding: 0.95rem 0.8rem;
    font-size: 0.98rem;
  }

  .intensity-answer-option {
    min-height: 86px;
    padding: 0.95rem 0.8rem;
    font-size: 0.98rem;
  }

  .duration-answer-option {
    min-height: 86px;
    padding: 0.95rem 0.8rem;
    font-size: 0.98rem;
  }

  .duration-sequence-slots {
    gap: 0.5rem;
  }

  .duration-sequence-slot {
    min-width: 64px;
    min-height: 64px;
    padding: 0.6rem;
  }

  .duration-sequence-source {
    min-width: 112px;
    min-height: 68px;
  }
}

.answer-review {
  margin-top: 0.7rem;
  padding: 0.65rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.review-row+.review-row {
  margin-top: 0.55rem;
}

.review-title {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 0.34rem;
}

.mini-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 0.42rem;
}

.mini-card {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 46px;
  height: 34px;
  padding: 0 0.4rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: linear-gradient(145deg, var(--bg-card-2) 0%, var(--bg-card) 100%);
  color: var(--gold);
  font-size: 0.92rem;
  font-weight: 800;
}

.mini-card.error {
  border-color: rgba(248, 113, 113, 0.6);
  color: #fecaca;
}

.mini-card.correct {
  border-color: rgba(52, 211, 153, 0.65);
  color: #6ee7b7;
}

.mini-card.partial {
  border-color: rgba(251, 146, 60, 0.68);
  color: #fdba74;
}

.mini-card-empty {
  color: var(--muted);
  font-weight: 700;
}

.simple-list {
  list-style: none;
  margin-top: 0.4rem;
}

.simple-list li {
  padding: 0.22rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.6rem;
}

.results-table th,
.results-table td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  padding: 0.45rem;
  text-align: left;
  vertical-align: top;
}

.results-table .mini-cards {
  gap: 0.3rem;
}

.results-table .mini-card {
  min-width: 38px;
  height: 28px;
  font-size: 0.78rem;
  border-radius: 8px;
}

.leaderboard-list {
  display: grid;
  gap: 0.65rem;
  margin-top: 0.75rem;
}

.leaderboard-card {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  padding: 0.72rem 0.85rem;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.08), rgba(16, 22, 41, 0.72));
  box-shadow: 0 6px 16px rgba(5, 8, 18, 0.2);
}

.leaderboard-card-top {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.65rem;
}

.leaderboard-rank {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 32px;
  padding: 0.2rem 0.52rem;
  border-radius: 999px;
  border: 1px solid rgba(232, 184, 75, 0.28);
  background: rgba(232, 184, 75, 0.08);
  color: var(--gold-light);
  font-weight: 800;
}

.leaderboard-rank span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.leaderboard-name {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.leaderboard-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.42rem;
  margin-top: 0.5rem;
}

.leaderboard-metrics p {
  margin: 0;
  min-width: 0;
  padding: 0.45rem 0.58rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.45rem;
}

.leaderboard-metrics strong {
  font-size: 1rem;
  line-height: 1.1;
  white-space: nowrap;
}

.leaderboard-metric-score strong {
  color: var(--gold-light);
}

.metric-label {
  color: var(--muted);
  font-size: 0.76rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 700;
}

.leaderboard-outcomes {
  margin-top: 0.52rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.34rem 0.42rem;
}

.leaderboard-outcome {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0.18rem 0.52rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.79rem;
  font-weight: 700;
}

.leaderboard-outcome.is-correct {
  border-color: rgba(52, 211, 153, 0.55);
  background: rgba(52, 211, 153, 0.09);
}

.leaderboard-outcome.is-wrong {
  border-color: rgba(248, 113, 113, 0.5);
  background: rgba(248, 113, 113, 0.08);
}

.leaderboard-outcome-empty,
.leaderboard-empty {
  color: var(--muted);
  margin: 0;
}

#screenResults {
  width: min(980px, 100%);
  margin-left: auto;
  margin-right: auto;
}

#screenResults h2 {
  text-align: center;
  margin-bottom: 0.35rem;
}

#screenResults .buttons {
  justify-content: center;
  margin-top: 1.1rem;
}

.results-actions {
  flex-direction: column;
  align-items: center;
}

.results-download-control {
  width: min(440px, 100%);
}

.results-download-control label {
  margin-bottom: 0.55rem;
  color: var(--gold-light);
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
}

.results-download-fields {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) minmax(170px, 1fr);
  gap: 0.55rem;
}

.results-download-control select {
  height: 52px;
  border-radius: 18px;
}

.results-secondary-actions {
  display: flex;
  width: min(760px, 100%);
  gap: 0.75rem;
}

#screenResults .results-secondary-actions button {
  flex: 1 1 0;
  min-width: 0;
  height: 52px;
}

#screenResults #newRoundBtn {
  min-width: 0;
  height: 52px;
  border-radius: 18px;
  box-shadow: 0 10px 26px rgba(236, 191, 74, 0.24);
}

#screenResults .teacher-lobby-secondary-btn {
  height: 52px;
  border-radius: 18px;
}

.leaderboard-empty {
  padding: 1rem;
  text-align: center;
  border-radius: 16px;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  background: rgba(19, 29, 56, 0.38);
}

@media (max-width: 640px) {
  .leaderboard-card {
    padding: 0.65rem;
  }

  .leaderboard-card-top {
    gap: 0.48rem;
  }

  .leaderboard-metrics {
    gap: 0.3rem;
    margin-top: 0.42rem;
  }

  .leaderboard-metrics p {
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 0.16rem;
    padding: 0.42rem 0.22rem;
    text-align: center;
  }

  .leaderboard-metrics strong {
    font-size: 0.92rem;
  }

  .leaderboard-metrics .metric-label {
    font-size: 0.63rem;
    letter-spacing: 0.02em;
  }

  .leaderboard-outcomes {
    margin-top: 0.45rem;
    gap: 0.3rem;
  }

  .results-download-fields {
    grid-template-columns: 1fr;
  }

  .results-secondary-actions {
    flex-direction: column;
  }

  #screenResults .results-actions button {
    width: 100%;
  }
}

.hidden {
  display: none !important;
}

.harmonic-hud {
  width: min(760px, 100%);
  margin: 0.9rem auto 0;
  padding: 0.8rem 1rem;
  border-radius: 18px 18px 0 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom: 0;
  background: rgba(19, 29, 56, 0.42);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
}

.harmonic-hud p {
  margin: 0;
  color: var(--muted);
}

.harmonic-start-control {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.harmonic-start-control label {
  white-space: nowrap;
}

.harmonic-board {
  width: min(760px, 100%);
  margin: 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0 0 18px 18px;
  padding: 18px;
  background: rgba(19, 29, 56, 0.42);
  box-shadow: 0 8px 18px rgba(5, 8, 18, 0.22);
}

.harmonic-slots {
  display: grid;
  grid-template-columns: repeat(auto-fit, 74px);
  justify-content: center;
  gap: 0.5rem;
}

.harmonic-slot {
  width: 74px;
  height: 74px;
  border-radius: 14px;
  border: 2px dashed rgba(136, 146, 164, 0.45);
  background: rgba(19, 29, 56, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: border-color 0.22s ease, background 0.22s ease, box-shadow 0.22s ease;
}

.harmonic-slot.drop-over {
  border-color: var(--gold);
  background: var(--gold-dim);
}

.harmonic-slot-index {
  position: absolute;
  top: 0.28rem;
  left: 0.35rem;
  font-size: 0.68rem;
  color: var(--muted);
}

.harmonic-slot.is-playing {
  border-color: var(--violet-light);
  box-shadow: 0 0 0 2px rgba(167, 139, 250, 0.2);
}

.harmonic-bank-label {
  margin-top: 0.85rem;
  text-align: center;
}

.harmonic-bank {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

.harmonic-board .identify-label {
  text-align: center;
}

.harmonic-card {
  min-width: 72px;
  min-height: 52px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.05rem;
  padding: 0.35rem 0.5rem;
  cursor: grab;
  user-select: none;
  touch-action: none;
  transition: transform 0.2s ease, box-shadow 0.22s ease, border-color 0.22s ease, filter 0.22s ease;
}

.harmonic-card:hover:not(.feedback-correct):not(.feedback-wrong) {
  transform: translateY(-2px);
  border-color: rgba(232, 184, 75, 0.58);
  box-shadow: 0 12px 24px rgba(8, 12, 24, 0.28);
  filter: brightness(1.06);
}

.harmonic-bank .harmonic-card {
  width: 74px;
  height: 74px;
  min-width: 74px;
  min-height: 74px;
  padding: 0;
}

.harmonic-slot .harmonic-card {
  width: 74px;
  height: 74px;
  min-width: 74px;
  min-height: 74px;
  padding: 0;
}

.harmonic-card.dragging {
  transform: scale(0.96);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.28);
}

.harmonic-card.quality-major {
  background: linear-gradient(145deg, #1f8f43 0%, #2eab52 100%);
  color: #effff4;
}

.harmonic-card.quality-minor {
  background: linear-gradient(145deg, #2563eb 0%, #4f46e5 100%);
  color: #eef4ff;
}

.harmonic-card.quality-diminished {
  background: linear-gradient(145deg, #ea580c 0%, #f59e0b 100%);
  color: #fff7ed;
}

.harmonic-card.feedback-correct {
  background: #16a34a;
  color: #fff;
}

.harmonic-card.feedback-wrong {
  background: #dc2626;
  color: #fff;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.76);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 20;
}

.modal-content {
  width: min(860px, 100%);
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg-card);
  padding: 1rem;
}

.teacher-rooms-panel {
  width: min(1100px, 100%);
}

.teacher-rooms-heading,
.teacher-room-card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.teacher-rooms-top-actions {
  margin-top: 0;
}

.teacher-rooms-section {
  margin-top: 1.5rem;
}

.teacher-rooms-section h3 {
  margin-bottom: 0.45rem;
}

.teacher-rooms-retention-note {
  margin: 0 0 1rem;
  color: var(--muted);
}

.teacher-room-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.teacher-room-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.025);
  overflow: hidden;
}

.teacher-room-card-heading {
  align-items: center;
  cursor: pointer;
  list-style: none;
  padding: 1rem;
}

.teacher-room-card-heading::-webkit-details-marker {
  display: none;
}

.teacher-room-card-heading:focus-visible {
  outline: 2px solid var(--gold-light);
  outline-offset: -3px;
}

.teacher-room-card-summary-meta {
  align-items: center;
  display: flex;
  gap: 0.65rem;
}

.teacher-room-card-toggle {
  width: 0.65rem;
  height: 0.65rem;
  border-right: 2px solid var(--gold-light);
  border-bottom: 2px solid var(--gold-light);
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.18s ease;
}

.teacher-room-card[open] .teacher-room-card-toggle {
  transform: rotate(225deg) translate(-2px, -2px);
}

.teacher-room-card-details {
  border-top: 1px solid var(--border);
  padding: 0 1rem 1rem;
}

.teacher-room-card h4 {
  margin: 0;
  font-size: 1.15rem;
}

.teacher-room-status {
  flex: 0 0 auto;
  border: 1px solid rgba(138, 180, 255, 0.3);
  border-radius: 999px;
  padding: 0.25rem 0.55rem;
  color: var(--link-blue);
  font-size: 0.78rem;
  font-weight: 700;
}

.teacher-room-status-running {
  border-color: rgba(124, 228, 190, 0.38);
  color: #7ce4be;
}

.teacher-room-status-finished {
  border-color: rgba(232, 184, 75, 0.4);
  color: var(--gold-light);
}

.teacher-room-metadata {
  margin: 0.9rem 0;
}

.teacher-room-metadata p {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin: 0.4rem 0;
  color: var(--muted);
}

.teacher-room-metadata strong {
  color: var(--white);
  text-align: right;
}

.teacher-room-actions {
  justify-content: flex-start;
  margin-top: 0.8rem;
}

.teacher-room-actions button {
  min-width: 0;
}

.teacher-rooms-empty {
  grid-column: 1 / -1;
  margin: 0;
  border: 1px dashed var(--border);
  border-radius: 14px;
  padding: 1rem;
  color: var(--muted);
}

button.danger {
  background: #b91c1c;
  color: #fff;
}

button.danger:hover:not(:disabled) {
  background: #dc2626;
}

.delete-room-modal-content,
.replace-results-modal-content {
  width: min(520px, 100%);
}

.replace-results-modal-content .modal-warning {
  margin: 1rem 0 0;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(232, 184, 75, 0.45);
  border-radius: 14px;
  background: rgba(232, 184, 75, 0.08);
  color: var(--gold-light);
}

.results-room-name {
  margin: 0 0 1rem;
  text-align: center;
}

#harmonicFeedbackModal .modal-content,
#submissionFeedbackModal .modal-content {
  text-align: center;
}

#harmonicFeedbackModal .modal-content .mini-cards,
#submissionFeedbackModal .modal-content .mini-cards,
#harmonicFeedbackModal .modal-content .buttons,
#submissionFeedbackModal .modal-content .buttons {
  justify-content: center;
}

@media (max-width: 640px) {
  .teacher-rooms-heading {
    flex-direction: column;
  }

  .teacher-rooms-top-actions,
  .teacher-room-actions {
    width: 100%;
  }

  .teacher-room-actions button {
    width: 100%;
  }

  .teacher-room-metadata p {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.1rem;
  }

  .teacher-room-metadata strong {
    text-align: left;
  }

  #identifyMetricQuestionsCount {
    width: 100%;
  }

  .top-row {
    grid-template-columns: 1fr;
  }

  .app {
    padding: 0.8rem;
  }

  .identify-options {
    grid-template-columns: 1fr;
  }

  .harmonic-hud {
    grid-template-columns: 1fr;
  }

  .harmonic-slots {
    grid-template-columns: repeat(4, minmax(56px, 1fr));
  }
}
