/* =========================================================
   旭光國小音樂教室 - Vibrant Music Classroom Stylesheet
   Designed for 1920x1080 screens, Interactive Whiteboard & Mobile
   ========================================================= */

:root {
  --bg-primary: #121929;        /* 活力夜空靛藍 (Joyful Deep Indigo) */
  --bg-secondary: #1a2236;      /* 教室柔和板塊深藍 */
  --bg-card: #202b45;           /* 卡片底色 (Vibrant Card Navy) */
  --bg-card-hover: #293757;
  
  --gold-accent: #f59e0b;       /* 旭日活力陽光澄金 (Warm Sunshine Amber) */
  --gold-bright: #fbbf24;       /* 晨曦金黃高光 */
  --gold-dim: rgba(245, 158, 11, 0.22);
  --gold-glow: rgba(251, 191, 36, 0.45);

  --music-cyan: #38bdf8;        /* 活潑晴空青藍 */
  --music-pink: #f472b6;        /* 活潑音符亮粉 */
  --music-green: #4ade80;       /* 活力薄荷翠綠 */
  --music-purple: #c084fc;      /* 創意薰衣草紫 */
  
  --text-main: #f8fafc;         /* 清新明亮白文字 */
  --text-muted: #cbd5e1;        /* 柔和次要文字 (Clear Slate) */
  --text-faint: #94a3b8;        /* 標籤輔助文字 */

  --in-tune-color: #4ade80;     /* 答對翡翠綠 */
  --in-tune-glow: rgba(74, 222, 128, 0.4);
  --flat-color: #60a5fa;        /* 晴空藍 */
  --sharp-color: #f87171;       /* 暖珊瑚紅 */
  
  --border-card: 1px solid rgba(245, 158, 11, 0.25);
  --border-radius-lg: 18px;
  --border-radius-md: 12px;
  --border-radius-sm: 8px;

  --font-serif: "Playfair Display", "Songti SC", "Noto Serif TC", "Baskerville", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang TC", "Microsoft JhengHei", sans-serif;
  --font-mono: "SF Mono", "Roboto Mono", "Courier New", monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-sans);
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  background-image: 
    radial-gradient(circle at 20% 15%, rgba(56, 189, 248, 0.12) 0%, transparent 50%),
    radial-gradient(circle at 80% 25%, rgba(245, 158, 11, 0.15) 0%, transparent 60%),
    radial-gradient(circle at 50% 90%, rgba(192, 132, 252, 0.08) 0%, transparent 50%);
  user-select: none;
  -webkit-user-select: none;
  overflow-x: hidden;
}

.app-container {
  width: 100%;
  max-width: 680px;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 12px 16px 20px 16px;
  gap: 14px;
}

/* ================= HEADER ================= */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-secondary);
  border-radius: var(--border-radius-md);
  border: var(--border-card);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #1e3a8a, #0f172a);
  border: 1.5px solid var(--gold-accent);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold-bright);
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.25);
  transition: transform 0.2s ease;
}
.logo-icon:hover {
  transform: scale(1.05) rotate(-3deg);
}
.logo-icon svg {
  width: 32px;
  height: 32px;
}

.title-group h1 {
  font-family: var(--font-sans);
  font-size: 1.35rem;
  letter-spacing: 0.5px;
  color: #ffffff;
  font-weight: 800;
  line-height: 1.2;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.title-group .subtitle {
  font-size: 0.78rem;
  color: var(--music-cyan);
  letter-spacing: 0.6px;
  font-weight: 600;
}

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

.icon-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(212, 175, 55, 0.08);
  border: 1px solid rgba(212, 175, 55, 0.3);
  color: var(--gold-bright);
  padding: 6px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-btn svg {
  width: 14px;
  height: 14px;
}

.icon-btn.wake-active {
  background: rgba(74, 222, 128, 0.15);
  border-color: rgba(74, 222, 128, 0.4);
  color: #4ade80;
}

.install-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  background: linear-gradient(135deg, var(--gold-accent), #a88421);
  color: #1a1614;
  font-weight: 700;
  font-size: 0.75rem;
  border: none;
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(212, 175, 55, 0.35);
}
.install-badge svg {
  width: 14px;
  height: 14px;
}

/* ================= NAV TABS ================= */
.nav-tabs {
  display: flex;
  gap: 8px;
  background: var(--bg-secondary);
  padding: 4px;
  border-radius: var(--border-radius-md);
  border: 1px solid rgba(212, 175, 55, 0.15);
}

.nav-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: all 0.25s ease;
}

.nav-tab svg {
  width: 18px;
  height: 18px;
}

.nav-tab.active {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.25), rgba(56, 189, 248, 0.2));
  color: #ffffff;
  border-bottom: 2px solid var(--gold-bright);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35), inset 0 0 0 1px rgba(251, 191, 36, 0.35);
}

/* ================= MAIN CONTENT & PANELS ================= */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.view-panel {
  display: none;
  flex-direction: column;
  gap: 14px;
}

.view-panel.active {
  display: flex;
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Grids for responsive multi-column layouts */
.tuner-main-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.metronome-main-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.metro-controls-column {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ================= CLASSICAL CARD COMMON ================= */
.classical-card {
  background: var(--bg-card);
  border-radius: var(--border-radius-lg);
  border: var(--border-card);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  padding: 16px;
  position: relative;
  overflow: hidden;
}

.classical-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold-dim), transparent);
}

/* ================= TUNER SPECIFICS ================= */
.config-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 16px;
}

.config-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.config-item label {
  font-size: 0.76rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pitch-stepper {
  display: flex;
  align-items: center;
  background: var(--bg-secondary);
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-radius: 6px;
  padding: 2px 6px;
}

.pitch-stepper input {
  width: 48px;
  background: transparent;
  border: none;
  color: var(--gold-bright);
  font-size: 1.05rem;
  font-weight: 700;
  text-align: center;
  outline: none;
  -moz-appearance: textfield;
}
.pitch-stepper input::-webkit-outer-spin-button,
.pitch-stepper input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.step-mini-btn {
  background: none;
  border: none;
  color: var(--gold-accent);
  font-size: 1.1rem;
  padding: 2px 6px;
  cursor: pointer;
  font-weight: bold;
}

.quick-pills {
  display: flex;
  gap: 4px;
}

.pill-btn {
  background: rgba(212, 175, 55, 0.08);
  border: 1px solid rgba(212, 175, 55, 0.2);
  color: var(--text-muted);
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 0.72rem;
  cursor: pointer;
  transition: all 0.15s;
}

.pill-btn:hover, .pill-btn.active {
  background: var(--gold-accent);
  color: #1a1614;
  font-weight: 700;
}

.toggle-switch-group {
  display: flex;
  background: var(--bg-secondary);
  border-radius: 6px;
  padding: 2px;
  border: 1px solid rgba(212, 175, 55, 0.2);
}

.toggle-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 5px 12px;
  font-size: 0.8rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.toggle-btn.active {
  background: var(--gold-accent);
  color: #1a1614;
  font-weight: 700;
}

/* Gauge Card */
.gauge-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 20px 14px 16px 14px;
}

.note-hero-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 8px;
}

.note-sub-wrapper {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 2px;
}

.main-note-display {
  font-family: var(--font-serif);
  font-size: 4.8rem;
  line-height: 1;
  font-weight: 800;
  color: var(--text-main);
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.7);
  letter-spacing: -2px;
  min-width: 140px;
  transition: color 0.15s ease;
}

.main-note-display.in-tune {
  color: var(--in-tune-color);
  text-shadow: 0 0 25px var(--in-tune-glow);
}

.octave-display {
  font-size: 2rem;
  color: var(--gold-accent);
  font-weight: 600;
}

.cents-status-box {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-secondary);
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: 20px;
  padding: 4px 14px;
  margin-top: 4px;
}

.cents-value {
  font-size: 1.15rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-main);
}

.cents-unit {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.target-details {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 6px;
}

/* Gauge Canvas */
.gauge-container {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  margin-top: -6px;
}

#gauge-canvas {
  width: 100%;
  max-width: 360px;
  height: 190px;
}

.gauge-labels {
  width: 90%;
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-faint);
  margin-top: -10px;
}

.gauge-labels .in-tune-label {
  color: var(--gold-accent);
  font-weight: 600;
}

.tuner-action-strip {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}

.realtime-freq-box {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 8px;
  padding: 6px 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px dashed rgba(212, 175, 55, 0.2);
}

.freq-label {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.freq-number {
  font-size: 1.25rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--gold-bright);
}

.freq-unit {
  font-size: 0.75rem;
  color: var(--text-faint);
}

.classical-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, #c79e2e, #97741d);
  color: #171412;
  font-size: 1rem;
  font-weight: 700;
  padding: 12px 28px;
  border-radius: 30px;
  border: 1px solid #ffd874;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(212, 175, 55, 0.35);
  transition: all 0.2s ease;
  width: 100%;
  max-width: 320px;
}

.classical-action-btn svg {
  width: 18px;
  height: 18px;
}

.classical-action-btn:active {
  transform: scale(0.98);
}

.classical-action-btn.active {
  background: linear-gradient(135deg, #b91c1c, #991b1b);
  border-color: #f87171;
  color: #fff;
  box-shadow: 0 4px 18px rgba(185, 28, 28, 0.4);
}

/* 30s Chart Card */
.chart-card {
  padding: 14px 16px;
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.chart-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gold-bright);
}

.chart-title svg {
  width: 16px;
  height: 16px;
}

.clear-chart-btn {
  background: transparent;
  border: 1px solid rgba(212, 175, 55, 0.2);
  color: var(--text-muted);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 0.72rem;
  cursor: pointer;
}

.chart-wrapper {
  position: relative;
  width: 100%;
}

#pitch-chart-canvas {
  width: 100%;
  height: 200px;
  border-radius: 10px;
  background: #110f0e;
  border: 1px solid rgba(212, 175, 55, 0.35);
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.6);
  display: block;
}

.chart-timeline-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-faint);
  margin-top: 4px;
  padding: 0 4px;
}

/* ================= METRONOME SPECIFICS ================= */
.metro-visual-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px 20px 16px;
  gap: 16px;
}

.tempo-hero-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.tempo-number {
  font-family: var(--font-serif);
  font-size: 4.8rem;
  line-height: 1;
  font-weight: 800;
  color: var(--gold-bright);
  text-shadow: 0 2px 14px rgba(212, 175, 55, 0.25);
}

.tempo-unit {
  font-size: 0.85rem;
  color: var(--text-muted);
  letter-spacing: 2px;
  font-weight: 600;
}

.tempo-term {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 2px;
}

/* Visual Centered Beat Lights */
.visual-strip-container {
  width: 100%;
  max-width: 420px;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 48px;
  padding: 8px 0;
}

.beat-indicators {
  display: flex;
  gap: 16px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  min-height: 36px;
}

.beat-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #2a2520;
  border: 2px solid rgba(212, 175, 55, 0.35);
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.5);
  transition: transform 0.06s cubic-bezier(0.1, 1, 0.1, 1), background-color 0.06s ease, box-shadow 0.06s ease;
  position: relative;
}

.beat-dot.accent-indicator::after {
  content: "★";
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: var(--gold-bright);
}

.beat-dot.active {
  background: var(--gold-bright);
  border-color: #fff;
  box-shadow: 0 0 20px var(--gold-bright), 0 0 8px #fff;
  transform: scale(1.35);
}

.beat-dot.active.accent {
  background: #f87171;
  border-color: #fecaca;
  box-shadow: 0 0 24px #f87171, 0 0 10px #fecaca;
  transform: scale(1.45);
}

.metro-main-trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: linear-gradient(135deg, #c79e2e, #97741d);
  color: #171412;
  font-size: 1.15rem;
  font-weight: 800;
  padding: 14px 40px;
  border-radius: 35px;
  border: 2px solid #ffd874;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(212, 175, 55, 0.4);
  transition: all 0.2s ease;
  width: 100%;
  max-width: 280px;
}

.metro-main-trigger svg {
  width: 22px;
  height: 22px;
}

.metro-main-trigger.playing {
  background: linear-gradient(135deg, #991b1b, #7f1d1d);
  border-color: #fca5a5;
  color: #fff;
  box-shadow: 0 6px 20px rgba(185, 28, 28, 0.45);
}

/* Tempo Control Card */
.tempo-control-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.slider-wrapper {
  padding: 0 8px;
}

input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  background: var(--bg-secondary);
  border-radius: 5px;
  outline: none;
  border: 1px solid rgba(212, 175, 55, 0.25);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff2be, #d4af37, #856417);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  border: 1px solid #ffd874;
}

input[type="range"]::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff2be, #d4af37, #856417);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  border: 1px solid #ffd874;
}

/* Stepper Grid */
.stepper-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.step-btn {
  background: var(--bg-secondary);
  border: 1px solid rgba(212, 175, 55, 0.25);
  color: var(--text-main);
  padding: 8px 0;
  border-radius: var(--border-radius-sm);
  font-size: 0.88rem;
  font-weight: 700;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}

.step-btn:hover {
  background: rgba(212, 175, 55, 0.15);
  border-color: var(--gold-accent);
}

.step-btn:active {
  transform: scale(0.92);
}

.tap-tempo-btn {
  background: rgba(212, 175, 55, 0.15);
  color: var(--gold-bright);
  font-size: 0.72rem;
  font-family: var(--font-sans);
  border-color: rgba(212, 175, 55, 0.45);
}

/* Settings Grid Card */
.settings-grid-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid rgba(212, 175, 55, 0.08);
}

.setting-row:last-child {
  border-bottom: none;
}

.setting-row label {
  font-size: 0.9rem;
  color: var(--text-main);
  font-weight: 500;
}

.classical-select {
  background: var(--bg-secondary);
  color: var(--gold-bright);
  border: 1px solid rgba(212, 175, 55, 0.3);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
}

/* Custom Switch */
.switch-container {
  display: flex;
  align-items: center;
}

.custom-switch {
  display: none;
}

.switch-label {
  display: block;
  width: 44px;
  height: 24px;
  background: #38322c;
  border-radius: 14px;
  position: relative;
  cursor: pointer;
  border: 1px solid rgba(212, 175, 55, 0.3);
  transition: background 0.25s;
}

.switch-label::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #b8b0a2;
  transition: transform 0.25s, background 0.25s;
}

.custom-switch:checked + .switch-label {
  background: var(--gold-accent);
}

.custom-switch:checked + .switch-label::after {
  transform: translateX(20px);
  background: #171514;
}

/* High Volume Boost Row */
.volume-boost-row {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.vol-label-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.boost-badge {
  background: rgba(212, 175, 55, 0.15);
  color: var(--gold-bright);
  border: 1px solid rgba(212, 175, 55, 0.3);
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 700;
  font-family: var(--font-mono);
}

.vol-slider-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.vol-slider-wrap svg {
  width: 20px;
  height: 20px;
  color: var(--gold-accent);
}

.boost-max-tag {
  font-size: 0.7rem;
  color: #f87171;
  font-weight: 700;
  white-space: nowrap;
}

/* ================= FOOTER ================= */
.app-footer {
  text-align: center;
  padding: 10px 0;
  font-size: 0.72rem;
  color: var(--text-faint);
  letter-spacing: 0.3px;
}

/* ================= RESPONSIVE & MOBILE PWA ADJUSTMENTS ================= */
@media (max-width: 480px) {
  .app-container {
    padding: 8px 10px 14px 10px;
    gap: 10px;
  }

  .main-note-display {
    font-size: 4rem;
  }

  .tempo-number {
    font-size: 4rem;
  }

  .stepper-grid {
    gap: 4px;
  }

  .step-btn {
    font-size: 0.8rem;
    padding: 7px 0;
  }
}

/* ================= UPDATE BANNER ================= */
.notification-banner {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 540px;
  background: linear-gradient(135deg, #2c251e, #1c1815);
  border: 1px solid var(--gold-accent);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7), 0 0 15px rgba(212, 175, 55, 0.25);
  border-radius: var(--border-radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 10000;
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
  from { opacity: 0; transform: translate(-50%, 25px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.banner-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.banner-content svg {
  width: 28px;
  height: 28px;
  color: var(--gold-bright);
  flex-shrink: 0;
  animation: rotateSpin 6s linear infinite;
}

@keyframes rotateSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.banner-text {
  display: flex;
  flex-direction: column;
}

.banner-text strong {
  font-size: 0.9rem;
  color: var(--gold-bright);
}

.banner-text span {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.banner-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.banner-action-btn {
  border: none;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.banner-action-btn.primary {
  background: linear-gradient(135deg, #c79e2e, #97741d);
  color: #1a1614;
  border: 1px solid #ffd874;
}

.banner-action-btn.secondary {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid rgba(212, 175, 55, 0.25);
}

/* ================= INSTALL MODAL ================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 8, 7, 0.78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 9999;
  animation: fadeIn 0.25s ease;
}

.modal-dialog {
  background: linear-gradient(145deg, #28231f, #1b1715);
  border: 1px solid var(--gold-accent);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.8), 0 0 25px rgba(212, 175, 55, 0.2);
  border-radius: var(--border-radius-lg);
  width: 100%;
  max-width: 440px;
  overflow: hidden;
  animation: modalPop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.15);
  position: relative;
}

.modal-icon-badge {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--gold-accent);
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.modal-app-icon {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.modal-title-wrap {
  flex: 1;
}

.modal-title {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  color: var(--gold-bright);
}

.modal-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.modal-close-x {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
}

.modal-body {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-desc {
  font-size: 0.88rem;
  color: var(--text-main);
  line-height: 1.6;
}

.modal-features-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--border-radius-sm);
  padding: 10px 14px;
  border: 1px dashed rgba(212, 175, 55, 0.2);
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.feature-item svg {
  width: 16px;
  height: 16px;
  color: #4ade80;
  flex-shrink: 0;
}

.ios-guide-box {
  background: rgba(212, 175, 55, 0.08);
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-radius: var(--border-radius-sm);
  padding: 12px;
}

.ios-guide-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.84rem;
  color: var(--gold-bright);
  margin-bottom: 8px;
}

.ios-guide-title svg {
  width: 16px;
  height: 16px;
}

.ios-steps {
  margin-left: 18px;
  font-size: 0.8rem;
  color: var(--text-main);
  line-height: 1.7;
}

.inline-svg {
  width: 14px;
  height: 14px;
  vertical-align: middle;
  color: var(--gold-bright);
}

.modal-footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 20px 18px 20px;
}

.modal-btn-confirm {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--gold-accent), #97741d);
  color: #171412;
  font-weight: 800;
  font-size: 0.95rem;
  padding: 12px;
  border-radius: 25px;
  border: 1px solid #ffd874;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(212, 175, 55, 0.35);
  transition: all 0.2s ease;
}

.modal-btn-confirm svg {
  width: 18px;
  height: 18px;
}

.modal-btn-confirm:active {
  transform: scale(0.98);
}

.modal-btn-dismiss {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.82rem;
  cursor: pointer;
  padding: 6px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* =========================================================
   DESKTOP (1024px ~ 1920x1080 Full HD) RESPONSIVE DESIGN
   Large, ultra-crisp typography, comfortable side-by-side layout
   ========================================================= */
@media (min-width: 992px) {
  .app-container {
    max-width: 1680px;
    width: 96%;
    padding: 24px 32px 36px 32px;
    gap: 20px;
  }

  /* Header on Desktop */
  .app-header {
    padding: 14px 24px;
    border-radius: var(--border-radius-lg);
  }

  .logo-icon {
    width: 44px;
    height: 44px;
  }
  .logo-icon svg {
    width: 26px;
    height: 26px;
  }

  .title-group h1 {
    font-size: 1.65rem;
    letter-spacing: 1px;
  }

  .title-group .subtitle {
    font-size: 0.88rem;
  }

  .icon-btn {
    font-size: 0.88rem;
    padding: 8px 16px;
  }

  /* Navigation Tabs on Desktop */
  .nav-tabs {
    padding: 6px;
  }

  .nav-tab {
    font-size: 1.15rem;
    padding: 14px 24px;
    gap: 10px;
  }
  .nav-tab svg {
    width: 22px;
    height: 22px;
  }

  /* Classical Card Padding & Margins on Desktop */
  .classical-card {
    padding: 24px;
    border-radius: 20px;
  }

  /* Config Bar on Desktop */
  .config-bar {
    padding: 16px 24px;
  }
  .config-item label {
    font-size: 0.95rem;
    font-weight: 600;
  }
  .pitch-stepper input {
    font-size: 1.25rem;
    width: 64px;
  }
  .step-mini-btn {
    font-size: 1.35rem;
    padding: 4px 10px;
  }
  .pill-btn {
    font-size: 0.88rem;
    padding: 4px 12px;
  }
  .toggle-btn {
    font-size: 0.95rem;
    padding: 7px 18px;
  }

  /* TUNER VIEW - 2-Column Side-by-Side on Desktop */
  .tuner-main-grid {
    display: grid;
    grid-template-columns: 1fr 1.15fr;
    gap: 20px;
    align-items: stretch;
  }

  .gauge-card {
    padding: 28px 24px;
    justify-content: space-between;
  }

  .main-note-display {
    font-size: 6rem;
    min-width: 170px;
  }

  .octave-display {
    font-size: 2.6rem;
  }

  .cents-status-box {
    padding: 6px 20px;
    margin-top: 8px;
  }
  .cents-value {
    font-size: 1.45rem;
  }
  .cents-unit {
    font-size: 0.92rem;
  }

  .target-details {
    font-size: 1.05rem;
    margin-top: 10px;
  }

  .gauge-container {
    max-width: 480px;
  }

  #gauge-canvas {
    max-width: 460px;
    height: 220px;
  }

  .gauge-labels {
    font-size: 0.95rem;
  }

  .realtime-freq-box {
    padding: 8px 24px;
    gap: 12px;
  }
  .freq-label {
    font-size: 0.95rem;
  }
  .freq-number {
    font-size: 1.6rem;
  }
  .freq-unit {
    font-size: 0.95rem;
  }

  .classical-action-btn {
    font-size: 1.15rem;
    padding: 16px 36px;
    max-width: 380px;
  }

  /* 30s Chart on Desktop */
  .chart-card {
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }
  .chart-title {
    font-size: 1.08rem;
    gap: 8px;
  }
  .chart-title svg {
    width: 20px;
    height: 20px;
  }
  .clear-chart-btn {
    font-size: 0.85rem;
    padding: 4px 12px;
  }
  #pitch-chart-canvas {
    height: 280px;
  }
  .chart-timeline-labels {
    font-size: 0.85rem;
  }

  /* METRONOME VIEW - 2-Column Side-by-Side on Desktop */
  .metronome-main-grid {
    display: grid;
    grid-template-columns: 1fr 1.25fr;
    gap: 20px;
    align-items: stretch;
  }

  .metro-visual-card {
    padding: 32px 24px;
    justify-content: space-between;
  }

  .tempo-number {
    font-size: 6.2rem;
  }
  .tempo-unit {
    font-size: 1.1rem;
    letter-spacing: 3px;
  }
  .tempo-term {
    font-size: 1.25rem;
    margin-top: 6px;
  }

  .beat-indicators {
    gap: 20px;
  }
  .beat-dot {
    width: 30px;
    height: 30px;
  }
  .beat-dot.accent-indicator::after {
    font-size: 14px;
    top: -20px;
  }

  .metro-main-trigger {
    font-size: 1.3rem;
    padding: 16px 48px;
    max-width: 320px;
  }
  .metro-main-trigger svg {
    width: 26px;
    height: 26px;
  }

  .metro-controls-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
  }

  .tempo-control-card {
    padding: 24px;
    gap: 20px;
  }
  input[type="range"] {
    height: 10px;
  }
  input[type="range"]::-webkit-slider-thumb {
    width: 28px;
    height: 28px;
  }
  input[type="range"]::-moz-range-thumb {
    width: 28px;
    height: 28px;
  }

  .stepper-grid {
    gap: 10px;
  }
  .step-btn {
    font-size: 1.15rem;
    padding: 12px 0;
  }
  .tap-tempo-btn {
    font-size: 0.95rem;
  }

  .settings-grid-card {
    padding: 24px;
    gap: 16px;
  }
  .setting-row {
    padding: 12px 0;
  }
  .setting-row label {
    font-size: 1.05rem;
    font-weight: 600;
  }
  .classical-select {
    font-size: 1.02rem;
    padding: 8px 16px;
  }

  .boost-badge {
    font-size: 0.92rem;
    padding: 3px 12px;
  }
  .boost-max-tag {
    font-size: 0.85rem;
  }
  .vol-slider-wrap svg {
    width: 24px;
    height: 24px;
  }

  .app-footer {
    font-size: 0.88rem;
    padding: 16px 0;
  }
}

/* =========================================================
   STAFF VIEW & QUIZ STYLING (旭光國小音樂教室)
   Optimized for 1920x1080 screens and touch displays
   ========================================================= */

/* Staff Top Toolbar */
.staff-top-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
}

.submode-switch-group {
  display: flex;
  background: rgba(0, 0, 0, 0.35);
  padding: 4px;
  border-radius: 12px;
  border: 1px solid rgba(212, 175, 55, 0.25);
  gap: 4px;
}

.submode-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 0.96rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
}

.submode-tab svg {
  width: 18px;
  height: 18px;
}

.submode-tab:hover {
  color: var(--gold-bright);
}

.submode-tab.active {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.28), rgba(212, 175, 55, 0.12));
  color: var(--gold-bright);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3), inset 0 0 0 1px rgba(212, 175, 55, 0.4);
}

.clef-toggle-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toolbar-label {
  font-size: 0.92rem;
  color: var(--text-muted);
  font-weight: 600;
}

.clef-symbol {
  font-size: 1.25rem;
  line-height: 1;
  display: inline-block;
  margin-right: 4px;
}

/* Staff Controls Card (Note types & labels) */
.staff-controls-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px 20px;
  margin-top: 14px;
}

.control-row-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.control-group-title {
  font-size: 0.92rem;
  color: var(--text-muted);
  min-width: 80px;
  font-weight: 600;
}

.staff-pills-row, .staff-labels-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1;
}

.staff-type-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(40, 36, 33, 0.85);
  border: 1px solid rgba(212, 175, 55, 0.25);
  color: var(--text-main);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.staff-type-pill .note-sym {
  font-size: 1.15rem;
}

.staff-type-pill:hover, .staff-label-btn:hover {
  border-color: var(--gold-bright);
  color: var(--gold-bright);
  background: rgba(212, 175, 55, 0.12);
}

.staff-type-pill.active {
  background: linear-gradient(135deg, #d4af37, #b89128);
  color: #171514;
  font-weight: 700;
  border-color: #f3cf65;
  box-shadow: 0 2px 10px rgba(212, 175, 55, 0.35);
}

.staff-label-btn {
  background: rgba(40, 36, 33, 0.85);
  border: 1px solid rgba(212, 175, 55, 0.25);
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.86rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.staff-label-btn.active {
  background: rgba(212, 175, 55, 0.22);
  color: var(--gold-bright);
  border-color: var(--gold-bright);
  font-weight: 600;
  box-shadow: inset 0 0 8px rgba(212, 175, 55, 0.25);
}

/* Staff Sheet Card (SVG Presentation) */
.staff-sheet-card {
  margin-top: 14px;
  padding: 20px 24px;
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  border: 1.5px solid rgba(245, 158, 11, 0.4);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 10px;
}

.sheet-title-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.sheet-icon {
  font-size: 1.4rem;
}

.sheet-heading {
  font-family: var(--font-sans);
  font-size: 1.25rem;
  color: #ffffff;
  font-weight: 800;
}

.sheet-hint {
  font-size: 0.84rem;
  color: var(--music-cyan);
  font-weight: 500;
}

.sheet-play-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border: none;
  color: #ffffff;
  padding: 7px 18px;
  border-radius: 20px;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 3px 12px rgba(245, 158, 11, 0.35);
}

.sheet-play-btn svg {
  width: 14px;
  height: 14px;
}

.sheet-play-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 18px rgba(245, 158, 11, 0.5);
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
}

.staff-sheet-container {
  width: 100%;
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, #1e293b 0%, #0f172a 100%);
  border-radius: 14px;
  border: 1.5px solid rgba(56, 189, 248, 0.25);
  padding: 10px 0;
  overflow-x: auto;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.5);
}

.staff-svg {
  width: 100%;
  max-width: 1000px;
  height: auto;
  display: block;
  user-select: none;
}

.note-interactive-group {
  transition: transform 0.15s ease, filter 0.2s ease;
}

.note-interactive-group:hover ellipse {
  filter: drop-shadow(0 0 8px rgba(243, 207, 101, 0.8));
}

.note-interactive-group.note-active ellipse {
  filter: drop-shadow(0 0 12px rgba(243, 207, 101, 0.9));
}

/* Staff Detail Information Grid Card */
.staff-detail-card {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  padding: 18px 24px;
  margin-top: 14px;
  background: var(--bg-card);
}

.detail-item-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.detail-item-col .col-title {
  font-size: 0.78rem;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.detail-item-col.hero-col {
  border-right: 1px solid rgba(212, 175, 55, 0.2);
  padding-right: 12px;
}

.hero-solfege {
  font-family: var(--font-serif);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--gold-bright);
  line-height: 1.1;
}

.hero-letter {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-muted);
}

.col-value {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-main);
}

.bopomofo-val {
  font-size: 1.3rem;
  color: #38bdf8;
}

.highlight-val {
  color: var(--gold-bright);
}

.pos-val {
  color: #a78bfa;
}

.freq-val {
  font-family: var(--font-mono);
  color: #4ade80;
}

.type-val {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 1rem;
}

/* ================= QUIZ ARENA ================= */
.quiz-config-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  margin-top: 14px;
  background: var(--bg-card);
}

.quiz-config-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.quiz-config-item label {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 600;
}

.pill-btn.danger {
  background: rgba(248, 113, 113, 0.15);
  border-color: rgba(248, 113, 113, 0.4);
  color: #f87171;
  margin-left: auto;
}

.pill-btn.danger:hover {
  background: #f87171;
  color: #171514;
}

.quiz-arena-card {
  margin-top: 14px;
  padding: 24px 28px;
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  border: 1.5px solid rgba(245, 158, 11, 0.4);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
}

.quiz-status-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.quiz-scores-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.quiz-score-badge {
  background: rgba(74, 222, 128, 0.2);
  border: 1px solid rgba(74, 222, 128, 0.6);
  color: #4ade80;
  font-size: 1.05rem;
  font-weight: 700;
  padding: 6px 16px;
  border-radius: 20px;
}

.quiz-streak-badge {
  background: rgba(245, 158, 11, 0.2);
  border: 1px solid rgba(245, 158, 11, 0.6);
  color: var(--gold-bright);
  font-size: 1.05rem;
  font-weight: 700;
  padding: 6px 16px;
  border-radius: 20px;
}

.next-q-btn {
  padding: 10px 26px;
  font-size: 1.05rem;
  border-radius: 24px;
  background: linear-gradient(135deg, #f59e0b, #eab308);
  color: #0f172a;
  font-weight: 800;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.45);
  transition: all 0.2s ease;
}

.next-q-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(251, 191, 36, 0.65);
}

.quiz-prompt-banner {
  background: rgba(15, 23, 42, 0.85);
  border: 1.5px solid rgba(56, 189, 248, 0.35);
  border-radius: 14px;
  padding: 16px 20px;
  margin-bottom: 20px;
  text-align: center;
}

.quiz-prompt-text {
  font-size: 1.25rem;
  color: var(--text-main);
  line-height: 1.6;
}

.quiz-clef-badge {
  display: inline-block;
  background: rgba(212, 175, 55, 0.2);
  color: var(--gold-bright);
  padding: 3px 10px;
  border-radius: 8px;
  font-size: 1.05rem;
  font-weight: 700;
  margin-left: 8px;
}

.quiz-target-note-badge {
  display: inline-block;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #171514;
  font-size: 1.8rem;
  font-weight: 800;
  padding: 4px 20px;
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4);
  margin: 0 8px;
  vertical-align: middle;
}

.quiz-interactive-board {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.quiz-staff-preview {
  background: radial-gradient(ellipse at center, #1e293b 0%, #0f172a 100%);
  border-radius: 14px;
  border: 1.5px solid rgba(56, 189, 248, 0.3);
  padding: 12px 10px;
  display: flex;
  justify-content: center;
}

.quiz-tip-text {
  text-align: center;
  color: var(--music-cyan);
  font-size: 0.98rem;
  letter-spacing: 0.5px;
  font-weight: 600;
}

/* Quiz 4 Options Grid */
.quiz-options-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 10px;
}

.quiz-opt-btn {
  background: linear-gradient(180deg, #24304d 0%, #172138 100%);
  border: 2px solid rgba(56, 189, 248, 0.35);
  color: #ffffff;
  padding: 18px 12px;
  font-size: 1.55rem;
  font-weight: 700;
  font-family: var(--font-sans);
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.quiz-opt-btn:hover:not(:disabled) {
  border-color: var(--gold-bright);
  background: linear-gradient(180deg, #334155 0%, #1e293b 100%);
  color: var(--gold-bright);
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.35);
}

.quiz-opt-btn.opt-correct {
  background: linear-gradient(135deg, #15803d, #166534) !important;
  border-color: #4ade80 !important;
  color: #f0fdf4 !important;
  box-shadow: 0 0 20px rgba(74, 222, 128, 0.5) !important;
}

.quiz-opt-btn.opt-wrong {
  background: linear-gradient(135deg, #b91c1c, #991b1b) !important;
  border-color: #f87171 !important;
  color: #fef2f2 !important;
  box-shadow: 0 0 20px rgba(248, 113, 113, 0.5) !important;
}

/* Feedback Box */
.quiz-feedback-box {
  margin-top: 20px;
}

.feedback-badge {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border-radius: 12px;
}

.feedback-badge .fb-icon {
  font-size: 2rem;
}

.feedback-badge .fb-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.feedback-badge .fb-text strong {
  font-size: 1.15rem;
}

.feedback-badge .fb-text span {
  font-size: 0.95rem;
  opacity: 0.9;
}

.feedback-success {
  background: rgba(34, 197, 94, 0.16);
  border: 1px solid rgba(74, 222, 128, 0.5);
  color: #4ade80;
}

.feedback-error {
  background: rgba(239, 68, 68, 0.16);
  border: 1px solid rgba(248, 113, 113, 0.5);
  color: #f87171;
}

/* 1920x1080 Full HD Large Screen Optimization */
@media (min-width: 1400px) {
  .staff-sheet-card {
    padding: 28px 36px;
  }
  .staff-sheet-container {
    min-height: 340px;
  }
  .sheet-heading {
    font-size: 1.4rem;
  }
  .sheet-hint {
    font-size: 0.95rem;
  }
  .staff-type-pill {
    padding: 8px 18px;
    font-size: 0.98rem;
  }
  .staff-label-btn {
    padding: 8px 18px;
    font-size: 0.96rem;
  }
  .quiz-opt-btn {
    padding: 24px 16px;
    font-size: 1.85rem;
  }
  .quiz-prompt-text {
    font-size: 1.45rem;
  }
  .hero-solfege {
    font-size: 2.8rem;
  }
}

@media (max-width: 768px) {
  .quiz-options-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .staff-top-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .submode-switch-group {
    width: 100%;
    justify-content: center;
  }
  .clef-toggle-wrap {
    justify-content: center;
  }
}

/* =========================================================
   RECORDER, KEYBOARD & COMPOSER EXPANSION STYLES
   Optimized for 1920x1080 Interactive Displays
   ========================================================= */

/* =========================================================
   RECORDER, KEYBOARD & COMPOSER EXPANSION STYLES
   Optimized for 1920x1080 Interactive Displays & Whiteboards
   ========================================================= */

.section-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.section-card-header .header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.section-card-header .header-icon {
  font-size: 2.2rem;
  line-height: 1;
}

.section-card-header .header-title {
  font-size: 1.38rem;
  font-weight: 800;
  color: #ffffff;
  margin: 0;
  letter-spacing: 0.5px;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.section-card-header .header-subtitle {
  font-size: 0.92rem;
  color: var(--music-cyan);
  margin: 4px 0 0 0;
  font-weight: 600;
}

.teaching-companion-grid {
  display: grid;
  grid-template-columns: 520px 1fr;
  gap: 18px;
  align-items: stretch;
  margin-top: 10px;
}

@media (max-width: 1300px) {
  .teaching-companion-grid {
    grid-template-columns: 1fr;
  }
}

/* 1. RECORDER CARD */
.recorder-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: linear-gradient(180deg, rgba(24, 32, 54, 0.95) 0%, rgba(18, 25, 41, 0.98) 100%);
}

.recorder-type-toggle {
  display: inline-flex;
  background: rgba(0, 0, 0, 0.45);
  padding: 4px;
  border-radius: 24px;
  border: 1px solid rgba(245, 158, 11, 0.35);
  gap: 4px;
}

.recorder-prompt-strip {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
  padding: 12px 16px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.85);
  border: 1.5px solid rgba(56, 189, 248, 0.35);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.rec-note-tag {
  color: #fbbf24;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.rec-tip-tag {
  color: #e2e8f0;
  font-size: 0.96rem;
  font-weight: 600;
  line-height: 1.5;
  background: rgba(30, 41, 59, 0.7);
  padding: 6px 12px;
  border-radius: 6px;
  border-left: 3px solid #38bdf8;
}

.recorder-accidentals-strip {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
  padding: 10px 14px;
  background: rgba(15, 23, 42, 0.75);
  border-radius: 12px;
  border: 1px solid rgba(245, 158, 11, 0.3);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.acc-strip-label {
  font-size: 0.88rem;
  font-weight: 700;
  color: #fbbf24;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.acc-chips-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.acc-note-pill {
  background: rgba(30, 41, 59, 0.85);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 18px;
  padding: 5px 12px;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.acc-note-pill:hover {
  background: rgba(56, 189, 248, 0.25);
  border-color: #38bdf8;
  color: #ffffff;
  transform: translateY(-1.5px);
  box-shadow: 0 4px 10px rgba(56, 189, 248, 0.25);
}

.acc-note-pill.active {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border-color: #fef3c7;
  color: #0f172a;
  font-weight: 900;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.65), 0 2px 6px rgba(0, 0, 0, 0.4);
  transform: scale(1.04);
}

.recorder-chart-svg-wrap {
  width: 100%;
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  background: radial-gradient(circle at center, rgba(30, 41, 59, 0.4) 0%, rgba(15, 23, 42, 0.85) 100%);
  border-radius: 14px;
  padding: 12px;
  min-height: 520px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.recorder-svg {
  width: 100%;
  max-width: 520px;
  height: auto;
  max-height: 560px;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.5));
}

.recorder-unsupported-msg {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 50px 24px;
  color: #cbd5e1;
  gap: 16px;
  font-size: 1.15rem;
  line-height: 1.6;
}

/* 2. RAINBOW KEYBOARD CARD */
.keyboard-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: linear-gradient(180deg, rgba(24, 32, 54, 0.95) 0%, rgba(18, 25, 41, 0.98) 100%);
}

.instrument-selector-group {
  display: flex;
  background: rgba(0, 0, 0, 0.45);
  padding: 4px;
  border-radius: 14px;
  border: 1px solid rgba(245, 158, 11, 0.35);
  gap: 4px;
}

.inst-btn {
  background: transparent;
  color: #cbd5e1;
  border: none;
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s ease;
}

.inst-btn.active {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #0f172a;
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.5);
}

.rainbow-keyboard-container {
  width: 100%;
  overflow-x: auto;
  padding: 24px 12px;
  background: radial-gradient(circle at center, rgba(30, 41, 59, 0.7) 0%, rgba(15, 23, 42, 0.95) 100%);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.6);
}

.rainbow-keyboard {
  position: relative;
  display: flex;
  height: 290px;
  user-select: none;
  min-width: 780px;
  justify-content: center;
}

.keyboard-key {
  position: relative;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.06s ease, filter 0.08s ease, box-shadow 0.08s ease;
}

.white-key {
  width: 56px;
  height: 100%;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 82%, #e2e8f0 100%);
  border: 1.5px solid #64748b;
  border-top: none;
  border-radius: 0 0 9px 9px;
  z-index: 1;
  box-shadow: 0 5px 8px rgba(0, 0, 0, 0.4), inset 0 -5px 0 rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding-bottom: 14px;
}

.key-color-bar {
  width: 82%;
  height: 10px;
  border-radius: 5px;
  margin-bottom: 10px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
}

.key-labels {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.key-labels .key-pitch {
  font-size: 0.95rem;
  font-weight: 900;
  color: #0f172a;
}

.key-labels .key-solfege {
  font-size: 0.88rem;
  font-weight: 800;
  color: #334155;
}

.key-labels .key-bopomofo {
  font-size: 0.78rem;
  font-weight: 800;
  color: #0284c7;
}

.black-key {
  width: 36px;
  height: 60%;
  background: linear-gradient(180deg, #334155 0%, #1e293b 80%, #090d16 100%);
  border: 1.5px solid #090d16;
  border-radius: 0 0 6px 6px;
  margin-left: -18px;
  margin-right: -18px;
  z-index: 2;
  box-shadow: 0 6px 10px rgba(0, 0, 0, 0.65), inset 0 -3px 0 rgba(255, 255, 255, 0.15);
  display: flex;
  justify-content: center;
  align-items: flex-end;
  padding-bottom: 10px;
}

.black-key-label {
  font-size: 0.8rem;
  font-weight: 800;
  color: #cbd5e1;
}

.keyboard-key.key-pressed {
  transform: translateY(5px);
  filter: brightness(1.3);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4) !important;
}

.keyboard-key.key-active-synced {
  outline: 4px solid #fbbf24;
  outline-offset: -2px;
  box-shadow: 0 0 24px rgba(251, 191, 36, 0.85) !important;
  filter: brightness(1.18);
}

/* 3. SIGHT-SINGING & COMPOSER SUITE */
.composer-suite-card {
  margin-top: 14px;
  background: linear-gradient(180deg, rgba(24, 32, 54, 0.95) 0%, rgba(18, 25, 41, 0.98) 100%);
}

.composer-split-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

@media (max-width: 1024px) {
  .composer-split-grid {
    grid-template-columns: 1fr;
  }
}

.composer-subcard {
  background: rgba(15, 23, 42, 0.75);
  border: 1.5px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.subcard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.subcard-badge {
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
  border: 1.5px solid rgba(56, 189, 248, 0.45);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 800;
}

.subcard-badge.highlight {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.45);
}

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

.song-notes-flow {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 0;
  max-height: 220px;
  overflow-y: auto;
}

.song-note-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(30, 41, 59, 0.85);
  border: 2px solid #38bdf8;
  border-radius: 10px;
  padding: 8px 14px;
  min-width: 60px;
  transition: all 0.2s ease;
  cursor: pointer;
}

.song-note-chip .chip-bubble {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-bottom: 4px;
}

.song-note-chip .chip-solfege {
  font-size: 1.15rem;
  font-weight: 900;
  color: #ffffff;
}

.song-note-chip .chip-pitch {
  font-size: 0.8rem;
  color: #94a3b8;
  font-weight: 700;
}

.song-note-chip .chip-dur {
  font-size: 0.74rem;
  color: #fbbf24;
  font-weight: 700;
}

.song-note-chip.active-playing {
  transform: scale(1.18) translateY(-5px);
  background: #38bdf8 !important;
  color: #0f172a !important;
  box-shadow: 0 6px 18px rgba(56, 189, 248, 0.85);
}
.song-note-chip.active-playing .chip-solfege,
.song-note-chip.active-playing .chip-pitch,
.song-note-chip.active-playing .chip-dur {
  color: #0f172a !important;
}

.composer-slots-container {
  min-height: 140px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* 創編計數徽章 */
.subcard-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.composer-counter-badge {
  background: rgba(255, 255, 255, 0.08);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 800;
}

/* 1. 一鍵填入音符調色盤區塊 */
.composer-palette-section {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.palette-title-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

/* 時值選擇鈕群組 */
.composer-dur-toggle-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.dur-toggle-label {
  font-size: 0.86rem;
  font-weight: 700;
  color: #94a3b8;
}

.dur-pill-btn {
  background: rgba(30, 41, 59, 0.85);
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  border-radius: 18px;
  color: #cbd5e1;
  font-size: 0.84rem;
  font-weight: 800;
  padding: 5px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.dur-pill-btn:hover {
  background: rgba(56, 189, 248, 0.2);
  border-color: #38bdf8;
  color: #ffffff;
}

.dur-pill-btn.active {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  border-color: #38bdf8;
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(56, 189, 248, 0.4);
}

.composer-utility-btns {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.rest-insert-btn {
  background: rgba(148, 163, 184, 0.15);
  border: 1.5px solid #94a3b8;
  color: #e2e8f0;
  font-weight: 800;
  font-size: 0.84rem;
  padding: 5px 12px;
}
.rest-insert-btn:hover {
  background: #64748b;
  color: #ffffff;
}

.add-current-note-btn {
  background: rgba(56, 189, 248, 0.2);
  border-color: #38bdf8;
  color: #bae6fd;
}
.add-current-note-btn:hover {
  background: #38bdf8;
  color: #0f172a;
}

.measure-title-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  font-weight: 800;
  color: #facc15;
  letter-spacing: 0.5px;
}

.measure-beats-count {
  font-size: 0.72rem;
  color: #94a3b8;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 6px;
  border-radius: 4px;
}

.measure-slots-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 86px;
}

.composer-slot-card {
  position: relative;
  background: rgba(30, 41, 59, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 6px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 86px;
  min-width: 54px;
  flex: 1 1 auto;
  transition: all 0.2s ease;
  user-select: none;
}

/* 依照時值寬度比例微調 */
.composer-slot-card.dur-2 {
  flex: 2 1 110px;
  background: rgba(30, 41, 59, 0.95);
  border-color: rgba(245, 158, 11, 0.4);
}
.composer-slot-card.dur-0_5 {
  flex: 0.6 1 45px;
  padding: 4px 2px;
}

.composer-slot-card .slot-dur-badge {
  font-size: 0.68rem;
  color: #fbbf24;
  font-weight: 800;
  margin-bottom: 2px;
}

/* 休止符/空拍卡片樣式 */
.composer-slot-card.rest-slot {
  background: rgba(15, 23, 42, 0.7);
  border-top: 4px solid #94a3b8;
  border-style: dashed;
}

.slot-rest-symbol {
  font-size: 1.5rem;
  line-height: 1;
  color: #94a3b8;
  margin: 2px 0;
}

.slot-rest-label {
  font-size: 0.7rem;
  color: #94a3b8;
  font-weight: 700;
}

.composer-slot-card.filled-slot {
  border-top: 4px solid #f59e0b;
  cursor: pointer;
}

.composer-slot-card.filled-slot:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  background: rgba(51, 65, 85, 0.95);
}

.composer-slot-card .slot-beat-idx {
  font-size: 0.68rem;
  color: #94a3b8;
  font-weight: 700;
  margin-bottom: 2px;
}

.composer-slot-card .slot-solfege {
  font-size: 1.25rem;
  font-weight: 900;
  line-height: 1.1;
}

.composer-slot-card .slot-pitch {
  font-size: 0.75rem;
  color: #cbd5e1;
  font-weight: 700;
  margin-top: 2px;
}

.composer-slot-card .slot-del-btn {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 4px;
  color: #ef4444;
  font-size: 0.72rem;
  cursor: pointer;
  margin-top: 4px;
  padding: 2px 6px;
  transition: all 0.2s ease;
}
.composer-slot-card .slot-del-btn:hover {
  background: #ef4444;
  color: #ffffff;
}

/* 待填入音符槽位 */
.composer-slot-card.empty-slot {
  background: rgba(15, 23, 42, 0.35);
  border: 1.5px dashed rgba(255, 255, 255, 0.12);
  opacity: 0.65;
}

.composer-slot-card.empty-slot.next-slot-target {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.08);
  opacity: 1;
  animation: pulseSlot 1.5s infinite;
}

@keyframes pulseSlot {
  0%, 100% { border-color: rgba(245, 158, 11, 0.4); box-shadow: 0 0 0 rgba(245, 158, 11, 0); }
  50% { border-color: #facc15; box-shadow: 0 0 8px rgba(245, 158, 11, 0.3); }
}

.empty-slot-icon {
  font-size: 1.1rem;
  color: #94a3b8;
  margin: 4px 0 2px 0;
}

.empty-slot-label {
  font-size: 0.68rem;
  color: #64748b;
  font-weight: 700;
}

.composer-slot-card.empty-slot.next-slot-target .empty-slot-label {
  color: #fbbf24;
  font-weight: 800;
}

.composer-slot-card.active-playing {
  transform: scale(1.15) translateY(-4px);
  background: #f59e0b !important;
  color: #0f172a !important;
  box-shadow: 0 6px 18px rgba(245, 158, 11, 0.85);
  z-index: 5;
}
.composer-slot-card.active-playing .slot-solfege,
.composer-slot-card.active-playing .slot-pitch,
.composer-slot-card.active-playing .slot-beat-idx,
.composer-slot-card.active-playing .slot-del-btn {
  color: #0f172a !important;
}

.pill-btn.sm {
  padding: 6px 14px;
  font-size: 0.88rem;
  font-weight: 700;
}
.classical-action-btn.sm {
  padding: 8px 18px;
  font-size: 0.95rem;
  font-weight: 800;
}
.classical-action-btn.success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  box-shadow: 0 3px 10px rgba(16, 185, 129, 0.4);
}
.classical-action-btn.playing {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #ffffff;
  box-shadow: 0 3px 10px rgba(239, 68, 68, 0.5);
}
.classical-select.sm {
  padding: 6px 14px;
  font-size: 0.95rem;
  font-weight: 700;
}
.sheet-play-btn.sm {
  padding: 8px 16px;
  font-size: 0.92rem;
  font-weight: 700;
}



