/* ============================================================
   Caixinha musical da Ocarina (instrumento tocável)
   Só age quando <div class="oc-stage"> ganha .open (via JS).
   Estrutura da pauta portada do protótipo do lab (ocarina.html).
   Animar só transform/opacity (lição de performance dos eggs).
   ============================================================ */

.oc-stage{
  position:fixed; inset:0; z-index:1000;
  display:flex; align-items:center; justify-content:center;
  opacity:0; pointer-events:none;
  transition:opacity .45s ease;
}
.oc-stage.open{ opacity:1; pointer-events:auto; }

/* escurece a página atrás da caixinha */
.oc-backdrop{
  position:absolute; inset:0;
  background:rgba(0,0,0,.72);
  backdrop-filter:blur(2px);
}

/* ============ A CAIXINHA (a pauta) ============ */
.oc-box{
  position:relative;
  width:440px; max-width:92vw;
  background-color:rgba(0,0,0,.82);
  border:1px solid rgba(255,255,255,.08);
  border-radius:24px;
  padding:22px 22px 18px;
  box-shadow:0 24px 70px rgba(0,0,0,.55);
  transform:translateY(14px) scale(.96);
  transition:transform .45s cubic-bezier(.22,.61,.36,1);
  display:flex; flex-direction:column; gap:16px;
}
.oc-stage.open .oc-box{ transform:translateY(0) scale(1); }

.oc-box.flash{ animation:oc-flash .7s ease; }
@keyframes oc-flash{
  0%{ box-shadow:0 0 0 0 rgba(242,90,1,0) inset, 0 24px 70px rgba(0,0,0,.55); }
  30%{ box-shadow:0 0 70px 0 rgba(242,90,1,.45) inset, 0 24px 70px rgba(0,0,0,.55); }
  100%{ box-shadow:0 0 0 0 rgba(242,90,1,0) inset, 0 24px 70px rgba(0,0,0,.55); }
}

/* botão de fechar */
.oc-close{
  position:absolute; top:10px; right:12px; z-index:3;
  width:30px; height:30px; border:none; border-radius:50%;
  background:rgba(255,255,255,.08); color:#e8eefc;
  font-size:20px; line-height:1; cursor:pointer;
  transition:background .12s ease, transform .08s ease;
}
.oc-close:hover{ background:rgba(255,255,255,.18); }
.oc-close:active{ transform:scale(.9); }

/* ============ "Você tocou <música>" (aparece ao reconhecer a canção) ============ */
.oc-played{
  min-height:1.4em;                 /* reserva o espaço p/ o box não pular */
  padding:2px 34px 0;               /* clareia o botão de fechar */
  text-align:center;
  font-family:ui-sans-serif, system-ui, "Segoe UI", Roboto, sans-serif;
  font-size:15px; font-weight:600; letter-spacing:.3px;
  color:#eef3ff;
  opacity:0; transform:translateY(-4px);
  transition:opacity .35s ease, transform .35s ease;
}
.oc-played.show{ opacity:1; transform:translateY(0); }
.oc-played .oc-song{ font-weight:700; }   /* nome da música — cor vem inline por canção */

/* ============ a pauta em si ============ */
.oc-staff{
  position:relative; height:120px; border-radius:16px;
  background:rgba(255,255,255,.03);
  overflow:hidden;
}
.oc-slots{ position:absolute; top:8px; right:14px; font-size:11px; color:#fff; opacity:.35; }

.oc-lines{ height:50px; position:absolute; left:24px; right:24px; bottom:24px; }
.oc-lines div{ background-color:#9b180b; width:100%; height:2px; margin-bottom:14px; }
.oc-lines div:last-child{ margin-bottom:0; }

.oc-clef{ position:absolute; height:70px; left:36px; bottom:14px; pointer-events:none; }
.oc-clef path{ fill:#f25a01; }

.oc-notes{ height:50px; position:absolute; left:84px; right:24px; bottom:24px; }
.oc-note{
  width:24px; margin-top:-12px; position:absolute;
  transition:left .26s cubic-bezier(.22,.61,.36,1), opacity .24s ease;
  will-change:left;
}
.oc-note svg{ width:100%; height:auto; display:block; filter:drop-shadow(0 1px 3px rgba(0,0,0,.5)); }
.oc-note.enter{ animation:oc-drop .26s cubic-bezier(.22,.61,.36,1); }
@keyframes oc-drop{ from{ opacity:.2; } }
.oc-note.leaving{ opacity:0; }

/* posições verticais = clave de Sol */
.oc-note.re-2{ top:0; }
.oc-note.do-2{ top:8px; }
.oc-note.si  { top:16px; }
.oc-note.la  { top:24px; }
.oc-note.sol { top:32px; }
.oc-note.fa  { top:40px; }
.oc-note.mi  { top:48px; }
.oc-note.re  { top:56px; }
.oc-note.do  { top:64px; }

/* ============ teclado de notas (toque/mobile) ============ */
.oc-pad{ display:flex; align-items:flex-start; justify-content:center; gap:10px; }
.oc-btn{
  width:48px; height:48px; border:none; background:transparent; cursor:pointer;
  padding:0; transition:transform .08s ease, filter .08s ease; outline:none;
  -webkit-tap-highlight-color:transparent;
}
.oc-btn:active, .oc-btn.down{ transform:translateY(2px) scale(.93); filter:brightness(1.25); }
.oc-btn:disabled{ opacity:.4; cursor:default; }   /* toque bloqueado durante a apresentação */
.oc-btn svg{ width:100%; height:100%; display:block; filter:drop-shadow(0 3px 7px rgba(0,0,0,.5)); }

/* ============ controles: switch + dica ============ */
.oc-controls{
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  color:#e8eefc; font-family:ui-sans-serif, system-ui, "Segoe UI", Roboto, sans-serif;
}
.oc-switch{ display:flex; align-items:center; gap:10px; cursor:pointer; user-select:none; }
.oc-switch input{ position:absolute; opacity:0; width:0; height:0; }
.oc-track{
  position:relative; width:44px; height:24px; border-radius:999px;
  background:#3a6b2e; transition:background .2s ease;
  flex:0 0 auto;
}
.oc-thumb{
  position:absolute; top:3px; left:3px; width:18px; height:18px; border-radius:50%;
  background:#fff; transition:transform .2s cubic-bezier(.22,.61,.36,1);
}
.oc-switch input:checked + .oc-track{ background:#3a6b2e; }        /* ligado = verde */
.oc-switch input:checked + .oc-track .oc-thumb{ transform:translateX(20px); }
.oc-switch input:not(:checked) + .oc-track{ background:#555; }     /* livre = cinza */
.oc-switch input:disabled + .oc-track{ opacity:.55; }
.oc-switch.locked{ cursor:not-allowed; }

.oc-switch-label{ font-size:12.5px; font-weight:600; white-space:nowrap; }

/* respeita quem pediu menos animação */
@media (prefers-reduced-motion: reduce){
  .oc-stage, .oc-box, .oc-note, .oc-thumb{ transition:none; }
  .oc-note.enter, .oc-box.flash{ animation:none; }
}

@media (max-width:480px){
  .oc-box{ padding:18px 14px 14px; }
  .oc-btn{ width:44px; height:44px; }
}

/* Fim do efeito de Fase A: força o fade (opacity 0) mantendo a classe do efeito ligada,
   pra a cor/sentido do giro NÃO voltarem ao padrão no meio da transição (o "snap"). */
html.oc-fxout .song-fx,
html.oc-fxout .saria-swirl-fx,
html.oc-fxout .storm-swirl-fx,
html.oc-fxout .epona-notes{ opacity:0 !important; }
