/* Header */
.app-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 12px;
  min-height: 72px;
  padding: 8px 10px 8px 8px;
  background: color-mix(in srgb, var(--panel-bg, rgba(8, 28, 48, 0.55)) 88%, transparent);
  border: 1px solid color-mix(in srgb, var(--teal-bright, #00beb4) 22%, transparent);
  border-radius: 22px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(10px);
  overflow: visible;
}

.header-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1 1 auto;
  min-width: 0;
  justify-content: flex-end;
}

html[data-theme="light"] .app-header {
  position: relative;
  background: linear-gradient(180deg, var(--accent-teal-wash) 0%, var(--surface-panel) 42%);
  border-color: var(--teal);
  box-shadow: var(--shadow-soft);
  overflow: visible;
}

html[data-theme="light"] .app-header::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 4px;
  background: var(--accent-rainbow-bar);
  pointer-events: none;
}

html[data-theme="light"] .logo-mark {
  background: transparent;
  box-shadow: none;
}

html[data-theme="light"] .logo-pad {
  box-shadow:
    0 2px 0 rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
  outline: 1px solid rgba(0, 0, 0, 0.18);
  outline-offset: 0;
  border-radius: 3px;
}

html[data-theme="light"] .logo-pad--yellow {
  background: linear-gradient(160deg, #ffc933, var(--yellow-pad) 50%, #b87800 100%);
  outline: 2px solid var(--yellow-pad-edge);
  box-shadow:
    0 3px 0 rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    0 0 0 1px rgba(255, 255, 255, 0.25);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.brand-byline {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  line-height: 1.2;
}

.logo-mark {
  width: 72px;
  height: 72px;
  border-radius: 0;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #ffffff;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

.logo-mark--pads {
  font-size: 0;
}

.logo-pads {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  width: 52px;
  height: 14px;
  align-items: center;
}

.logo-pad {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 3px;
  transform-origin: center bottom;
  box-shadow:
    0 2px 0 rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.logo-pad--red {
  background: linear-gradient(160deg, #ff7a6e, #e23131 55%, #b81e1e);
}

.logo-pad--blue {
  background: linear-gradient(160deg, #6eb8ff, #2f7de8 55%, #1a57b8);
}

.logo-pad--yellow {
  background: linear-gradient(160deg, #ffe56b, #f0c21a 55%, #d4a017);
}

@media (prefers-reduced-motion: no-preference) {
  .logo-pad--red {
    animation: logoPadPress 2.4s ease-in-out infinite;
  }
  .logo-pad--blue {
    animation: logoPadPress 2.4s ease-in-out infinite;
    animation-delay: 0.8s;
  }
  .logo-pad--yellow {
    animation: logoPadPress 2.4s ease-in-out infinite;
    animation-delay: 1.6s;
  }
}

@keyframes logoPadPress {
  0%,
  10%,
  100% {
    transform: translateY(0) scale(1);
    filter: brightness(1);
    box-shadow:
      0 3px 0 rgba(0, 0, 0, 0.28),
      inset 0 1px 0 rgba(255, 255, 255, 0.35);
  }
  4%,
  8% {
    transform: translateY(3px) scale(0.86);
    filter: brightness(1.18);
    box-shadow:
      0 0 0 rgba(0, 0, 0, 0.2),
      inset 0 2px 4px rgba(0, 0, 0, 0.35),
      0 0 10px rgba(255, 255, 255, 0.35);
  }
}

html[data-theme="light"] .logo-pad--red {
  outline: 1px solid rgba(0, 0, 0, 0.25);
}

html[data-theme="light"] .logo-pad--blue {
  outline: 1px solid rgba(0, 0, 0, 0.2);
}

html[data-theme="light"] .mode-card[aria-pressed="true"][data-mode="free"],
html[data-theme="light"] .mode-card[aria-pressed="true"][data-mode="keep"] {
  background: #eaf3fc;
  border: 2px solid #2476b9;
  box-shadow: 0 4px 14px rgba(11, 46, 92, 0.06);
}

.brand-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.85rem, 4vw, 2.75rem);
  font-weight: 800;
  color: var(--text-primary);
  white-space: nowrap;
  text-shadow: none;
  line-height: 1.05;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.theme-switch {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--theme-switch-border);
  border-radius: var(--radius-pill);
  background: var(--theme-switch-bg);
  overflow: hidden;
  padding: 3px;
  gap: 2px;
  box-shadow: var(--shadow-soft);
  box-sizing: border-box;
  max-width: 100%;
  flex-shrink: 1;
  min-width: 0;
}

.theme-btn {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  min-height: 40px;
  min-width: 0;
  flex: 1 1 0;
  max-width: 50%;
  box-sizing: border-box;
  padding: 0 10px;
  border-radius: var(--radius-pill);
  font-weight: 700;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.theme-btn[aria-pressed="true"],
.theme-btn.is-active {
  background: var(--theme-btn-active-bg);
  color: var(--theme-btn-active-text);
  box-shadow: var(--theme-btn-active-shadow);
}

html[data-theme="light"] .theme-btn[aria-pressed="true"] .icon {
  color: #ffffff;
}

.theme-btn .icon {
  font-size: 14px;
  line-height: 1;
}

/* Activity mode cards */
.mode-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(14px, 2vw, 24px);
}

.mode-chooser {
  display: flex;
  flex-direction: column;
  gap: clamp(12px, 2vh, 20px);
  padding: 4px 0 8px;
}

.mode-chooser .hero--menu {
  text-align: center;
}

.mode-grid--chooser {
  gap: 20px;
  max-width: 560px;
  margin: 0 auto;
  width: 100%;
}

.mode-card--launch {
  min-height: clamp(120px, 18vh, 176px);
  cursor: pointer;
}

.mode-card--launch .mode-check {
  display: none;
}

.back-to-chooser {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 8px;
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid #c9d5e3;
  background: #ffffff;
  color: #0b2e5c;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
}
.back-to-chooser:hover {
  border-color: #2476b9;
}

.mode-setup {
  display: flex;
  flex-direction: column;
  gap: clamp(22px, 3.2vh, 36px);
}

.mode-setup[hidden],
.mode-chooser[hidden] {
  display: none !important;
}

.mode-card {
  position: relative;
  min-height: clamp(94px, 13vh, 125px);
  border-radius: var(--radius-md);
  border: 1.5px solid transparent;
  background: var(--mode-card-bg);
  color: var(--mode-card-text);
  text-align: left;
  padding: clamp(14px, 2vh, 22px) 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 10px 28px rgba(12, 53, 70, 0.08);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 120ms ease;
  overflow: hidden;
}

.mode-card .mode-icon {
  width: 72px;
  height: 72px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 22px;
  flex: 0 0 auto;
  background: transparent;
  overflow: hidden;
  padding: 0;
}

.mode-icon__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.mode-card[data-mode="free"] {
  border-color: rgba(0, 169, 157, 0.45);
}

.mode-card[data-mode="free"] .mode-icon {
  color: var(--teal-bright);
  box-shadow: inset 0 0 0 1px rgba(0, 221, 208, 0.35);
}

.mode-card[data-mode="keep"] {
  border-color: rgba(240, 90, 24, 0.55);
}

.mode-card[data-mode="keep"] .mode-icon {
  color: var(--orange);
  box-shadow: inset 0 0 0 1px rgba(240, 90, 24, 0.4);
}

.mode-card[aria-pressed="true"][data-mode="free"] {
  border-color: var(--teal-bright);
  border-width: 2px;
  box-shadow: 0 10px 30px rgba(0, 158, 150, 0.15), 0 0 28px var(--glow-teal);
  background: rgba(0, 80, 78, 0.28);
}

.mode-card[aria-pressed="true"][data-mode="keep"] {
  border-color: #ff7a3d;
  box-shadow: 0 0 26px var(--glow-orange);
  background: rgba(90, 35, 12, 0.28);
}

/* Light mode: white cards, color in border/icon only */
html[data-theme="light"] .mode-card {
  background: var(--mode-card-bg);
  color: var(--text-primary);
  box-shadow: 0 10px 28px rgba(12, 53, 70, 0.08);
}

html[data-theme="light"] .mode-card[data-mode="free"] {
  border: 1.5px solid var(--teal);
  background: linear-gradient(145deg, var(--accent-teal-wash) 0%, var(--surface-panel) 55%);
}

html[data-theme="light"] .mode-card[data-mode="free"] .mode-icon {
  background: var(--teal-pale);
  color: var(--teal-dark);
  box-shadow: 0 0 14px var(--glow-teal);
}

html[data-theme="light"] .mode-card[data-mode="keep"] {
  border: 1.5px solid var(--orange);
  box-shadow: 0 10px 28px rgba(240, 90, 24, 0.12);
  background: linear-gradient(145deg, var(--accent-orange-wash) 0%, var(--surface-panel) 55%);
}

html[data-theme="light"] .mode-card[data-mode="keep"] .mode-icon {
  background: var(--orange-pale);
  color: var(--orange);
  box-shadow: 0 0 14px var(--glow-orange);
}

html[data-theme="light"] .mode-card::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 50%;
  width: 78px;
  height: 44px;
  transform: translateY(-50%);
  opacity: 0.14;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 30% 50%, currentColor 0 1.5px, transparent 2px),
    radial-gradient(ellipse at 50% 35%, currentColor 0 1.5px, transparent 2px),
    radial-gradient(ellipse at 70% 55%, currentColor 0 1.5px, transparent 2px),
    repeating-linear-gradient(
      95deg,
      transparent 0 5px,
      currentColor 5px 6px,
      transparent 6px 12px
    );
  mask-image: radial-gradient(ellipse at center, #000 10%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at center, #000 10%, transparent 75%);
}

html[data-theme="light"] .mode-card[data-mode="free"]::after {
  color: var(--teal);
}

html[data-theme="light"] .mode-card[data-mode="keep"]::after {
  color: var(--orange);
}

.mode-check {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: none;
  place-items: center;
  background: var(--teal);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  z-index: 1;
}

.mode-card[aria-pressed="true"] .mode-check {
  display: grid;
}

.mode-copy b {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 1.8vw, 1.25rem);
  font-weight: 800;
  margin-bottom: 4px;
  color: var(--mode-card-text);
}

.mode-copy span {
  display: block;
  color: var(--mode-card-desc);
  font-size: 14px;
  font-weight: 500;
}

html[data-theme="light"] .mode-copy b {
  color: var(--text-primary);
}

html[data-theme="light"] .mode-copy span {
  color: var(--text-secondary);
}

/* Setup selectors */
.setup-panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  box-shadow: var(--shadow-panel);
}

.setup-panel .setup-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  row-gap: clamp(10px, 1.6vh, 16px);
  column-gap: clamp(22px, 3vw, 44px);
}

.setup-check {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-width: 0;
}

.setup-choice-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  grid-column: 1 / -1;
}

.setup-choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.setup-letter-groups {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.practice-note {
  margin: 8px 0 0;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted, #6b7c91);
}

.theme-btn--classroom {
  text-decoration: none;
  font-weight: 800;
  white-space: nowrap;
}

.advanced-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding-top: 4px;
}

.advanced-options-heading {
  margin: 0;
  font-size: clamp(0.85rem, 1.7vh, 1rem);
  font-weight: 900;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-primary, #0b2e5c);
}

.advanced-options-toggle {
  align-self: flex-start;
  border: 1px solid var(--input-border, #c9d5e3);
  background: var(--input-bg, #fff);
  color: var(--text-primary, #0b2e5c);
  border-radius: 12px;
  padding: 8px 14px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.advanced-options-toggle[aria-expanded="true"] {
  border-color: var(--teal, #2476b9);
  background: #eaf3fc;
}

.advanced-options-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--input-border, #c9d5e3);
  border-radius: 14px;
  background: var(--surface-panel, #fff);
}

.advanced-options--open .advanced-options-body {
  display: flex;
}

.timing-tolerance {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
}

.timing-tolerance-end {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text-muted, #6b7c91);
  white-space: nowrap;
}

.timing-tolerance-slider {
  width: 100%;
  min-height: 36px;
  accent-color: #2476b9;
}

.range-stepper {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.range-stepper input[type="range"] {
  flex: 1 1 auto;
  min-width: 0;
}

.range-stepper__btn {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 12px;
  border: 1px solid var(--input-border, #c9d5e3);
  background: var(--input-bg, #fff);
  color: var(--text-primary, #0b2e5c);
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}

.range-stepper__btn:hover {
  border-color: var(--teal, #2476b9);
  background: var(--menu-selected-bg, #eaf3fc);
}

.range-stepper__btn:focus-visible {
  outline: 3px solid rgba(36, 118, 185, 0.35);
  outline-offset: 2px;
}

.range-stepper__btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

html[data-theme="dark"] .range-stepper__btn {
  border-color: var(--input-border);
  background: var(--input-bg);
  color: var(--text-primary);
}

.timing-tolerance-readout {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-primary, #0b2e5c);
}

.setup-letter-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--input-border);
  background: color-mix(in srgb, var(--input-bg) 88%, transparent);
}

.setup-letter-group-title {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--text-primary);
}

.setup-letter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.letter-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 52px;
  min-height: 48px;
  padding: 0 12px;
  border-radius: 12px;
  border: 2px solid var(--input-border);
  background: var(--input-bg);
  color: var(--input-text);
  font-weight: 800;
  font-size: 1.05rem;
  cursor: pointer;
  user-select: none;
}

.letter-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--teal);
  cursor: pointer;
}

.letter-check:has(input:checked) {
  border-color: var(--teal);
  background: color-mix(in srgb, var(--teal) 14%, var(--input-bg));
}

html[data-theme="light"] .setup-letter-group {
  background: var(--surface-panel);
  border-radius: 14px;
  padding: 10px 12px;
  border: 1px solid var(--panel-border);
}

html[data-theme="light"] .letter-check {
  background: var(--input-bg);
}

html[data-theme="light"] .letter-check:has(input:checked) {
  background: var(--surface-selected-teal);
  border-color: var(--teal-dark);
  box-shadow: none;
}

.setup-section-title {
  margin: 8px 0 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-primary);
  grid-column: 1 / -1;
}

.radio-pill,
.finger-check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: clamp(46px, 7vh, 52px);
  padding: 0 16px;
  border-radius: 12px;
  border: 2px solid var(--input-border);
  background: var(--input-bg);
  color: var(--input-text);
  font-weight: 700;
  font-size: 0.98rem;
  cursor: pointer;
  user-select: none;
  box-shadow: inset 0 1px 2px rgba(18, 58, 74, 0.04);
}

.radio-pill input,
.finger-check input {
  width: 20px;
  height: 20px;
  accent-color: var(--teal);
  flex: 0 0 auto;
  cursor: pointer;
}

.radio-pill:hover,
.finger-check:hover {
  border-color: color-mix(in srgb, var(--teal-bright, #00beb4) 45%, var(--input-border));
}

.radio-pill:has(input:checked),
.finger-check:has(input:checked) {
  border-color: var(--teal);
  background: color-mix(in srgb, var(--teal) 14%, var(--input-bg));
}

html[data-theme="light"] .radio-pill,
html[data-theme="light"] .finger-check {
  background: var(--input-bg);
}

html[data-theme="light"] .radio-pill:has(input:checked),
html[data-theme="light"] .finger-check:has(input:checked) {
  background: var(--surface-selected-teal);
  border-color: var(--teal-dark);
  box-shadow: none;
}

html[data-theme="light"] .check-pill {
  background: var(--input-bg);
}

html[data-theme="light"] .check-pill:has(input:checked) {
  background: #eaf3fc;
  border-color: #2476b9;
  box-shadow: none;
}

.check-pill {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: clamp(50px, 8vh, 62px);
  padding: 0 16px;
  border-radius: 14px;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--input-text);
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  box-shadow: inset 0 1px 2px rgba(18, 58, 74, 0.04);
}

.check-pill input {
  width: 22px;
  height: 22px;
  accent-color: var(--teal);
  flex: 0 0 auto;
  cursor: pointer;
}

.check-pill:hover {
  border-color: color-mix(in srgb, var(--teal-bright, #00beb4) 45%, var(--input-border));
}

html[data-theme="light"] .setup-panel {
  position: relative;
  background: var(--surface-panel);
  border-color: var(--panel-border);
  overflow: visible;
}

html[data-theme="light"] .setup-panel::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 5px;
  background: var(--accent-rainbow-bar);
  pointer-events: none;
}

html[data-theme="light"] .setup-panel .setup-grid {
  position: relative;
  z-index: 1;
}

.song-preview-field {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-width: 0;
}

.song-preview-btn {
  width: 100%;
  min-height: clamp(50px, 8vh, 62px);
  padding: 0 16px;
  border-radius: 14px;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--input-text);
  font-weight: 750;
  font-size: 1rem;
  text-align: center;
  cursor: pointer;
  box-shadow: inset 0 1px 2px rgba(18, 58, 74, 0.04);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  transition:
    border-color 160ms ease,
    color 160ms ease,
    box-shadow 220ms ease,
    background 220ms ease;
}

.song-preview-btn:hover {
  border-color: color-mix(in srgb, var(--teal-bright, #00beb4) 45%, var(--input-border));
}

.song-preview-btn[aria-pressed="true"],
.song-preview-btn.is-playing {
  border-color: var(--teal);
  color: var(--teal-bright, var(--teal));
  box-shadow:
    inset 0 1px 2px rgba(18, 58, 74, 0.04),
    0 0 0 2px color-mix(in srgb, var(--teal-bright, #00ddd0) 28%, transparent);
  animation: songPreviewPulse 1.1s ease-in-out infinite;
}

.song-preview-btn__label {
  min-width: 0;
}

.song-preview-eq {
  display: inline-flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  height: 18px;
  flex: 0 0 auto;
  opacity: 0.35;
}

.song-preview-eq i {
  display: block;
  width: 3px;
  height: 6px;
  border-radius: 99px;
  background: currentColor;
  transform-origin: bottom center;
}

.song-preview-btn.is-playing .song-preview-eq {
  opacity: 1;
}

.song-preview-btn.is-playing .song-preview-eq i {
  animation: songPreviewBar 0.7s ease-in-out infinite;
}

.song-preview-btn.is-playing .song-preview-eq i:nth-child(1) { animation-delay: 0ms; }
.song-preview-btn.is-playing .song-preview-eq i:nth-child(2) { animation-delay: 90ms; }
.song-preview-btn.is-playing .song-preview-eq i:nth-child(3) { animation-delay: 180ms; }
.song-preview-btn.is-playing .song-preview-eq i:nth-child(4) { animation-delay: 60ms; }
.song-preview-btn.is-playing .song-preview-eq i:nth-child(5) { animation-delay: 140ms; }

.song-preview-btn .song-preview-eq:last-child i:nth-child(1) { animation-delay: 110ms; }
.song-preview-btn .song-preview-eq:last-child i:nth-child(2) { animation-delay: 20ms; }
.song-preview-btn .song-preview-eq:last-child i:nth-child(3) { animation-delay: 160ms; }
.song-preview-btn .song-preview-eq:last-child i:nth-child(4) { animation-delay: 80ms; }
.song-preview-btn .song-preview-eq:last-child i:nth-child(5) { animation-delay: 200ms; }

@keyframes songPreviewBar {
  0%,
  100% { height: 5px; opacity: 0.55; }
  50% { height: 18px; opacity: 1; }
}

@keyframes songPreviewPulse {
  0%,
  100% {
    box-shadow:
      inset 0 1px 2px rgba(18, 58, 74, 0.04),
      0 0 0 2px color-mix(in srgb, var(--teal-bright, #00ddd0) 22%, transparent);
  }
  50% {
    box-shadow:
      inset 0 1px 2px rgba(18, 58, 74, 0.04),
      0 0 0 4px color-mix(in srgb, var(--teal-bright, #00ddd0) 34%, transparent);
  }
}

@media (prefers-reduced-motion: reduce) {
  .song-preview-btn.is-playing,
  .song-preview-btn.is-playing .song-preview-eq i {
    animation: none;
  }

  .song-preview-btn.is-playing .song-preview-eq i:nth-child(odd) {
    height: 14px;
  }

  .song-preview-btn.is-playing .song-preview-eq i:nth-child(even) {
    height: 8px;
  }
}

html[data-theme="light"] .song-preview-btn {
  background: #ffffff;
  border-color: #c9d5e3;
}

html[data-theme="light"] .song-preview-btn.is-playing,
html[data-theme="light"] .song-preview-btn[aria-pressed="true"] {
  background: #eaf3fc;
  color: #175e99;
  border-color: #2476b9;
}

.field-label {
  display: block;
  margin-bottom: 4px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

html[data-theme="light"] .field-label {
  font-size: 16px;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 700;
  color: var(--label-accent);
}

html[data-theme="light"] .setup-section-title {
  color: var(--blue-pad);
}

.custom-select {
  position: relative;
}

.select-trigger {
  width: 100%;
  min-height: clamp(50px, 8vh, 62px);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--input-text);
  text-align: left;
  box-shadow: inset 0 1px 2px rgba(18, 58, 74, 0.04);
}

.select-trigger:hover {
  border-color: var(--panel-border-strong);
}

.select-trigger:focus-visible {
  border-color: var(--teal);
  box-shadow: var(--focus-ring);
  outline: none;
}

.select-icon {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
  color: var(--teal-dark);
  background: var(--teal-pale);
  flex: 0 0 auto;
}

.select-icon--teal {
  color: var(--teal-dark);
  background: var(--teal-pale);
}

.select-icon--blue {
  color: var(--blue-pad);
  background: rgba(38, 127, 217, 0.12);
}

html[data-theme="dark"] .select-icon--blue {
  color: var(--blue-pad-light);
  background: rgba(34, 118, 232, 0.2);
}

.select-value {
  flex: 1;
  font-weight: 700;
  font-size: 17px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--input-text);
}

.select-chevron {
  color: var(--text-primary);
  font-size: 12px;
}

.select-menu {
  position: absolute;
  z-index: 40;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  margin: 0;
  padding: 6px;
  list-style: none;
  border-radius: 14px;
  border: 1px solid #d4e2e7;
  background: var(--menu-bg);
  max-height: 240px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  box-shadow: 0 14px 34px rgba(18, 58, 74, 0.14);
}

.select-menu.is-fixed {
  right: auto;
  /* left/top/width/max-height set in JS so the menu stays on-screen on phones */
}

.select-menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10040;
  border: 0;
  padding: 0;
  margin: 0;
  background: rgba(3, 10, 22, 0.55);
  cursor: pointer;
}

.select-menu.is-sheet {
  border-radius: 18px 18px 14px 14px !important;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.45) !important;
  padding: 10px 8px 12px !important;
}

html.select-menu-open,
html.select-menu-open body {
  overflow: hidden !important;
}

html[data-theme="dark"] .select-menu {
  border-color: var(--panel-border);
  box-shadow: var(--shadow-panel);
}

.select-menu[hidden] {
  display: none !important;
}

.select-option {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text-primary);
  text-align: left;
  min-height: 48px;
  border-radius: 10px;
  padding: 8px 12px;
  font-weight: 650;
  font-size: 16px;
}

.select-group {
  padding: 10px 12px 4px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.6;
}

.select-option:hover {
  background: var(--menu-hover);
}

.select-option[aria-selected="true"] {
  background: var(--menu-selected-bg);
  color: var(--menu-selected-text);
  font-weight: 700;
}

html[data-theme="light"] .select-menu {
  background: #ffffff;
  border-color: #c9d5e3;
  box-shadow: var(--shadow-panel);
}

html[data-theme="light"] .select-trigger {
  background: #ffffff;
  border-color: #c9d5e3;
  color: #0b2e5c;
}

html[data-theme="light"] .select-trigger:hover {
  border-color: #2476b9;
  box-shadow: none;
}

html[data-theme="light"] .select-option {
  color: #0b2e5c;
}

html[data-theme="light"] .select-option:hover {
  background: var(--menu-hover);
}

html[data-theme="light"] .select-option[aria-selected="true"] {
  background: #eaf3fc;
  color: #0b2e5c;
  font-weight: 800;
}

html[data-theme="light"] .preview-panel {
  border: 2px solid transparent;
  background:
    linear-gradient(#ffffff, #ffffff) padding-box,
    var(--preview-border-image) border-box;
  box-shadow: var(--preview-shadow);
}

/* Test Your Sounds Here */
.preview-panel {
  border: 1px solid var(--preview-border);
  background: var(--panel-bg);
  box-shadow: var(--preview-shadow);
  border-radius: 24px;
  padding-bottom: clamp(18px, 2.4vh, 28px);
}

.preview-layout {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
}

.preview-speech {
  margin: 4px 0 0;
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 650;
}

html[data-theme="dark"] .preview-panel {
  border: 1px solid transparent;
  background:
    linear-gradient(var(--panel-bg), var(--panel-bg)) padding-box,
    var(--preview-border-image) border-box;
}

.preview-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: clamp(8px, 1.5vh, 16px);
  text-align: center;
}

.preview-title {
  margin: 0;
  width: 100%;
  font-family: var(--font-display);
  color: var(--text-primary);
  font-weight: 800;
  font-size: clamp(1.4rem, 3vw, 2.1rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  text-align: center;
}

html[data-theme="light"] .preview-title {
  background: none;
  -webkit-background-clip: border-box;
  background-clip: border-box;
  color: #0b2e5c;
}

.pad-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(12px, 2vw, 26px);
  align-items: start;
}

/* Setup "Test Your Sounds" preview pads: equal squares, compact gap. */
.preview-panel .pad-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  justify-content: center;
  align-items: start;
  gap: clamp(10px, 2.2vw, 24px);
  width: 100%;
  max-width: 720px;
  margin-inline: auto;
}

.preview-panel .pad-wrap {
  gap: 6px;
  width: 100%;
  max-width: none;
  min-width: 0;
  flex: none;
}

.preview-panel .pad {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  max-height: none;
}

.pad-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.pad {
  position: relative;
  width: 100%;
  height: var(--pad-h-desktop);
  border: 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  color: #fff;
  isolation: isolate;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  cursor: pointer;
  box-shadow:
    inset 0 0 0 2px var(--pad-border),
    0 4px 12px rgba(11, 46, 92, 0.12);
  transition: transform 160ms ease, filter 160ms ease, box-shadow 160ms ease;
}

.pad::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.3;
  background:
    radial-gradient(circle at 50% 48%, rgba(255, 255, 255, 0.35), transparent 44%),
    repeating-radial-gradient(
      circle at center,
      transparent 0,
      transparent 26px,
      rgba(255, 255, 255, 0.16) 27px,
      transparent 28px
    );
  pointer-events: none;
}

.pad::after {
  content: "";
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow:
    inset 0 0 0 18px rgba(255, 255, 255, 0.03),
    0 0 0 28px rgba(255, 255, 255, 0.035),
    0 0 0 48px rgba(255, 255, 255, 0.03);
  pointer-events: none;
  opacity: 0.85;
}

.pad-dots {
  position: absolute;
  inset: 0;
  opacity: 0.22;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.55) 0.8px, transparent 1.2px);
  background-size: 14px 14px;
  pointer-events: none;
}

.pad[data-color="blue"] {
  background: var(--blue-pad);
  --pad-glow: transparent;
  --pad-outer-shadow: none;
}

.pad[data-color="red"] {
  background: var(--red-pad);
  --pad-glow: transparent;
  --pad-outer-shadow: none;
}

.pad[data-color="yellow"] {
  background: var(--yellow-pad);
  --pad-glow: transparent;
  --pad-outer-shadow: none;
}

.pad[data-color="teal"] {
  background: linear-gradient(160deg, var(--teal-bright), var(--teal) 45%, var(--teal-dark));
  --pad-glow: var(--glow-teal);
}

.pad[data-color="orange"] {
  background: linear-gradient(160deg, var(--orange-light), var(--orange) 45%, #b83d0a);
  --pad-glow: var(--glow-orange);
}

.pad[data-color="purple"] {
  background: linear-gradient(160deg, #9b74ff, var(--purple) 45%, #4f28b8);
  --pad-glow: var(--glow-purple);
}

.pad-label {
  position: relative;
  z-index: 1;
  font-weight: 800;
  font-size: clamp(2.4rem, 6vw, 4.4rem);
  letter-spacing: -0.03em;
  line-height: 1;
  color: #ffffff;
}

.pad-label.is-dark {
  color: var(--pad-label-on-yellow);
  font-size: clamp(1.5rem, 3.6vw, 2.4rem);
  letter-spacing: 0.04em;
}

.pad.is-pressed {
  transform: scale(0.94) translateY(3px);
  filter: saturate(1.05) brightness(0.92);
  box-shadow:
    inset 0 10px 22px rgba(0, 0, 0, 0.28),
    inset 0 0 0 2px rgba(255, 255, 255, 0.35),
    0 2px 8px rgba(0, 0, 0, 0.2);
}

.finger-label {
  margin: 0;
  color: var(--finger-label);
  font-size: 16px;
  font-weight: 600;
  text-align: center;
}

/* Start CTA */
.start-btn {
  width: 100%;
  min-height: clamp(56px, 9vh, 74px);
  border: 0;
  border-radius: 18px;
  color: #ffffff;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.2rem, 2.2vw, 1.75rem);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  padding: 0 22px;
  background: var(--start-gradient);
  box-shadow: var(--start-shadow);
}

html[data-theme="light"] .start-btn {
  background: #e87a1a;
  box-shadow: none;
  border: 2px solid #e87a1a;
  border-radius: 12px;
}

html[data-theme="light"] .start-btn:hover {
  background: #d66c12;
  filter: none;
  box-shadow: none;
}

.start-btn:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(0, 158, 150, 0.28);
}

.start-btn:active {
  transform: translateY(0) scale(0.99);
}

.start-btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring), var(--start-shadow);
}

.start-btn .wave {
  opacity: 0.85;
  font-size: 18px;
  justify-self: start;
}

.start-btn .wave-end {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.start-btn .label {
  justify-self: center;
}

.baseline-link {
  display: block;
  text-align: center;
  color: var(--teal);
  font-weight: 650;
  font-size: 15px;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 4px;
  background: none;
  border: 0;
}

.baseline-link:hover {
  color: var(--teal-dark);
  text-decoration-thickness: 2px;
}

/* ===== Activity comments + session data (V2) ===== */
.tpb-comments {
  position: fixed;
  inset: 0;
  z-index: 200000;
  background: rgba(11, 46, 92, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(12px, 3vh, 28px);
  overflow: auto;
  font-family: "Nunito", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.tpb-comments__card {
  width: min(560px, 100%);
  background: #fff;
  color: #0b2e5c;
  border: 1px solid #2476b9;
  border-radius: 22px;
  box-shadow: 0 8px 28px rgba(11, 46, 92, 0.18);
  padding: clamp(16px, 3vh, 28px) clamp(16px, 4vw, 28px);
}

.tpb-comments__title {
  margin: 0 0 6px;
  font-size: clamp(20px, 3.6vw, 26px);
  font-weight: 900;
  text-align: center;
}

.tpb-comments__summary {
  margin: 0 0 16px;
  text-align: center;
  color: #6b7c91;
  font-weight: 700;
  font-size: 14px;
}

.tpb-comments__analysis {
  margin: 0 0 14px;
  padding: 12px 14px;
  background: #eaf3fc;
  border: 1px solid #c9d5e3;
  border-radius: 14px;
  text-align: left;
}

.tpb-comments__analysis-title {
  margin: 0 0 6px;
  font-weight: 900;
  color: #0b2e5c;
  font-size: 14px;
}

.tpb-comments__analysis-kpi {
  margin: 0 0 8px;
  font-size: 14px;
  color: #0b2e5c;
  font-weight: 700;
}

.tpb-comments__analysis ul {
  margin: 0;
  padding-left: 18px;
  color: #3a516b;
  font-size: 13px;
  font-weight: 700;
}

.tpb-comments__analysis li {
  margin: 3px 0;
}

html[data-theme="dark"] .tpb-comments__analysis {
  background: #16365a;
  border-color: #3a7ec0;
}

html[data-theme="dark"] .tpb-comments__analysis-title,
html[data-theme="dark"] .tpb-comments__analysis-kpi {
  color: #e8f1fb;
}

html[data-theme="dark"] .tpb-comments__analysis ul {
  color: #9db0c6;
}

.tpb-comments__label {
  display: block;
  font-weight: 800;
  color: #2476b9;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 12px 0 6px;
}

.tpb-comments__input,
.tpb-comments__textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #c9d5e3;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 16px;
  font-family: inherit;
  color: #0b2e5c;
  background: #fff;
}

.tpb-comments__textarea {
  resize: vertical;
  min-height: 72px;
}

.tpb-comments__input:focus,
.tpb-comments__textarea:focus {
  outline: none;
  border-color: #2476b9;
  box-shadow: 0 0 0 3px rgba(36, 118, 185, 0.18);
}

.tpb-comments__downloads,
.tpb-comments__actions,
.tpb-session-data__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.tpb-comments__actions {
  margin-top: 18px;
}

.tpb-comments__btn {
  flex: 1 1 auto;
  min-height: 46px;
  border-radius: 12px;
  border: 1px solid #2476b9;
  font-weight: 900;
  font-size: 15px;
  cursor: pointer;
  padding: 10px 16px;
  font-family: inherit;
}

.tpb-comments__btn--primary {
  background: #2476b9;
  color: #fff;
  border-color: #175e99;
}

.tpb-comments__btn--primary:hover {
  background: #175e99;
}

.tpb-comments__btn--secondary {
  background: #eaf3fc;
  color: #0b2e5c;
}

.tpb-comments__btn--secondary:hover {
  background: #d7e8f8;
}

.tpb-comments__btn--ghost {
  background: transparent;
  color: #6b7c91;
  border-color: #c9d5e3;
}

.tpb-comments__btn--ghost:hover {
  background: #f3f6fa;
}

.tpb-session-data {
  margin: 18px auto 8px;
  max-width: 560px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid #c9d5e3;
  border-radius: 16px;
  text-align: center;
}

.tpb-session-data__title {
  margin: 0 0 4px;
  font-weight: 900;
  color: #0b2e5c;
  font-size: 16px;
}

.tpb-session-data__hint {
  margin: 0 0 10px;
  color: #6b7c91;
  font-size: 13px;
  font-weight: 700;
}

html[data-theme="dark"] .tpb-comments__card,
html[data-theme="dark"] .tpb-session-data {
  background: #0f2744;
  color: #e8f1fb;
  border-color: #3a7ec0;
}

html[data-theme="dark"] .tpb-comments__summary,
html[data-theme="dark"] .tpb-session-data__hint,
html[data-theme="dark"] .tpb-comments__btn--ghost {
  color: #9db0c6;
}

html[data-theme="dark"] .tpb-comments__input,
html[data-theme="dark"] .tpb-comments__textarea {
  background: #0a1c33;
  color: #e8f1fb;
  border-color: #3a7ec0;
}

html[data-theme="dark"] .tpb-comments__btn--secondary {
  background: #16365a;
  color: #e8f1fb;
}
