:root {
  --primary: #0ea5e9; --primary-glow: rgba(14, 165, 233, 0.5);
  --secondary: #3b82f6; --bg-dark: #020617;
  --surface: rgba(15, 23, 42, 0.85); --surface-border: rgba(255, 255, 255, 0.1);
  --text-main: #f8fafc; --text-muted: #94a3b8; --danger: #ef4444; --success: #4ade80;
}

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

html, body {
  width: 100%; max-width: 100%; overflow-x: hidden !important;
  background-color: var(--bg-dark);
  
  /* Poza aplicată direct pe body, cu un strat subtil de 22% întuneric pentru a-i da 78% opacitate */
  background-image: linear-gradient(rgba(2, 6, 23, 0.22), rgba(2, 6, 23, 0.22)), url('bg.jpg');
  background-size: cover; 
  /* ANCORAREA SALVATOARE: ține logo-ul tău mereu vizibil pe ecran lat */
  background-position: right bottom; 
  background-attachment: fixed;
  
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text-main); min-height: 100vh; display: flex; justify-content: center; align-items: flex-start; padding: 15px 10px;
}

/* =========================================
   BACKGROUND OVERLAY
   ========================================= */
.bg-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: radial-gradient(circle at center, rgba(2, 6, 23, 0.75) 0%, rgba(2, 6, 23, 0.98) 100%);
  z-index: -1; backdrop-filter: blur(10px);
}

/* =========================================
   LOGO NOVIS DIN COD (Ascuns)
   ========================================= */
.novis-logo-container {
  display: none !important;
}

/* =========================================
   ANIMAȚII SLIDE INTERFEȚE 
   ========================================= */
.slide-down-anim { animation: slideDown 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.slide-up-anim { animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards; opacity: 0; }
.slide-left-anim { animation: slideInLeft 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards; opacity: 0; }
.slide-right-anim { animation: slideInRight 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards; opacity: 0; }

.home-card:nth-child(odd) { animation: slideInLeft 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards; opacity: 0; }
.home-card:nth-child(even) { animation: slideInRight 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards; opacity: 0; }
.home-card:nth-child(1) { animation-delay: 0.05s; }
.home-card:nth-child(2) { animation-delay: 0.15s; }
.home-card:nth-child(3) { animation-delay: 0.25s; }
.home-card:nth-child(4) { animation-delay: 0.35s; }
.home-card:nth-child(5) { animation-delay: 0.45s; }

@keyframes slideDown { from { opacity: 0; transform: translateY(-30px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInLeft { from { opacity: 0; transform: translateX(-50px); } to { opacity: 1; transform: translateX(0); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(50px); } to { opacity: 1; transform: translateX(0); } }

/* =========================================
   ELEMENTE UI EXISTENTE 
   ========================================= */
.app-container { width: 100%; max-width: 500px; background: var(--surface); border: 1px solid var(--surface-border); border-radius: 24px; padding: 20px; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7); overflow: hidden; position: relative; z-index: 1; }

.brand-header { text-align: center; margin-bottom: 20px; }
.brand-badge { display: inline-block; font-size: 10px; font-weight: 800; letter-spacing: 2px; color: var(--primary); background: rgba(14, 165, 233, 0.15); padding: 5px 12px; border-radius: 20px; border: 1px solid rgba(14, 165, 233, 0.3); margin-bottom: 8px; box-shadow: 0 0 10px var(--primary-glow); }
.brand-header h1 { font-size: 20px; font-weight: 700; background: linear-gradient(to right, #fff, #94a3b8); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent; }

.welcome-banner { margin-bottom: 16px; text-align: left; }
.welcome-banner h2 { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.home-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.home-card { background: rgba(255,255,255,0.03); border: 1px solid var(--surface-border); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; cursor: pointer; transition: all 0.2s ease; position: relative; }
.home-card:hover { background: rgba(255,255,255,0.08); border-color: var(--primary); transform: translateY(-2px); }
.card-icon { font-size: 20px; background: rgba(255,255,255,0.05); width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; border: 1px solid rgba(255,255,255,0.05); }
.card-text h3 { font-size: 13px; font-weight: 600; }
.card-text p { font-size: 10.5px; color: var(--text-muted); margin-top: 2px; }
.card-arrow { color: var(--primary); font-size: 16px; position: absolute; top: 12px; right: 12px; }

@media (max-width: 380px) { .home-cards { grid-template-columns: 1fr; } }

.controls-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.control-group { display: flex; flex-direction: column; gap: 4px; }
label { font-size: 10.5px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; }
select { width: 100%; height: 42px; background: rgba(0,0,0,0.4); border: 1px solid rgba(255,255,255,0.15); border-radius: 10px; color: #fff; padding: 0 10px; font-size: 14px; outline: none; transition: border-color 0.2s; }
select:focus { border-color: var(--primary); }

.primary-btn, .back-btn, .answer-btn { width: 100%; height: 44px; border-radius: 10px; border: none; font-size: 14px; font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.15s ease; }
.primary-btn { background: linear-gradient(135deg, var(--primary), var(--secondary)); color: #fff; box-shadow: 0 4px 15px var(--primary-glow); margin-bottom: 12px; }
.primary-btn:active { transform: scale(0.97); }
.back-btn { background: transparent; color: var(--text-muted); border: 1px solid var(--surface-border); height: 36px; margin-bottom: 16px; font-size: 13px;}
.back-btn:hover { background: rgba(255,255,255,0.05); color: #fff; }

.info-badge { background: rgba(0,0,0,0.5); border: 1px solid var(--primary); border-radius: 10px; padding: 12px; font-size: 13px; font-weight: 600; color: #fff; text-align: center; margin-bottom: 12px; line-height: 1.5; box-shadow: inset 0 0 10px rgba(14,165,233,0.1); }
.formula-text { font-size: 11.5px; color: #38bdf8; display: block; margin-top: 4px; font-family: monospace; font-weight: bold; background: rgba(14, 165, 233, 0.1); padding: 4px; border-radius: 6px; }

.inversions-wrapper { margin-top: 15px; }
.section-subtitle { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; margin-bottom: 10px; }
.inversions-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.inv-card { background: rgba(255,255,255,0.03); border: 1px solid var(--surface-border); border-radius: 10px; padding: 10px; text-align: center; cursor: pointer; }
.inv-card.active-inv { border-color: var(--primary); background: rgba(14, 165, 233, 0.1); }
.inv-card h4 { font-size: 11.5px; margin-bottom: 4px; }
.inv-card .notes-list { font-size: 12px; color: var(--primary); font-weight: 700; }

.staff-container { background: #f8fafc; border-radius: 12px; padding: 25px 15px; margin-bottom: 12px; display: flex; justify-content: center; }
.staff-box { position: relative; width: 100%; max-width: 300px; height: 80px; }
.staff-lines { display: flex; flex-direction: column; justify-content: space-between; height: 100%; }
.line { width: 100%; height: 2px; background: #0f172a; }

/* CHEIA SOL AJUSTATĂ - spirala pe a doua linie de jos */
.clef-g { 
  position: absolute; 
  left: 0; 
  top: -4px; 
  font-size: 85px; 
  color: #0f172a; 
  font-family: serif; 
  user-select: none; 
  z-index: 10; 
}

.staff-note { position: absolute; width: 22px; height: 16px; background: #ef4444; border-radius: 50%; left: 55%; transform: translate(-50%, -50%); transition: top 0.2s; box-shadow: 2px 2px 5px rgba(0,0,0,0.4); }
.ledger-line { display: none; position: absolute; width: 34px; height: 2px; background: #0f172a; top: 50%; left: -6px; transform: translateY(-50%); }
.staff-note.has-ledger .ledger-line { display: block; }

.validation-box { background: rgba(255,255,255,0.05); border: 1px solid var(--surface-border); border-radius: 10px; padding: 12px; text-align: center; font-size: 13.5px; font-weight: 600; margin-bottom: 12px; min-height: 45px; display: flex; align-items: center; justify-content: center; }
.valid-correct { background: rgba(74, 222, 128, 0.15); border-color: var(--success); color: var(--success); }
.valid-wrong { background: rgba(239, 68, 68, 0.15); border-color: var(--danger); color: var(--danger); }

.quiz-box { text-align: center; }
.quiz-score { font-size: 14px; font-weight: 700; color: var(--primary); background: rgba(14, 165, 233, 0.1); padding: 8px 16px; border-radius: 12px; display: inline-block; margin-bottom: 16px; }
.quiz-answers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.answer-btn { background: rgba(255,255,255,0.05); border: 1px solid var(--surface-border); color: #fff; }
.answer-btn:active { background: var(--primary); border-color: var(--primary); }

.piano-wrapper { margin-top: 15px; }
.piano-scroll-box { width: 100%; overflow-x: auto; background: #000; padding: 12px 6px; border-radius: 14px; box-shadow: inset 0 5px 15px rgba(0,0,0,0.8); scroll-behavior: smooth; }
.piano-scroll-box::-webkit-scrollbar { height: 0; }
.piano { display: flex; position: relative; height: 140px; width: max-content; }
.key { position: relative; cursor: pointer; user-select: none; flex-shrink: 0; touch-action: pan-x; }
.key.white { width: 40px; height: 100%; background: linear-gradient(to bottom, #fff 0%, #e2e8f0 100%); border: 1px solid #94a3b8; border-top: none; border-radius: 0 0 6px 6px; z-index: 1; }
.key.black { width: 24px; height: 60%; background: linear-gradient(to bottom, #1e293b 0%, #020617 100%); border: 1px solid #000; border-top: none; border-radius: 0 0 4px 4px; z-index: 2; margin-left: -12px; margin-right: -12px; }

/* -----------------------------------------
   SEPARARE CLARĂ PENTRU CLAPELE ACTIVE
   ----------------------------------------- */
.key.white.active {
  background: var(--primary) !important;
  border-color: #0369a1 !important; 
  box-shadow: inset 0 0 10px rgba(0,0,0,0.3) !important; 
}

.key.black.active {
  background: var(--secondary) !important;
  border-color: #000 !important;
  box-shadow: inset 0 0 8px rgba(0,0,0,0.6), 0 0 10px var(--primary-glow) !important;
}

.piano-hint { font-size: 11px; color: var(--text-muted); text-align: center; margin-top: 8px; }