/* ==========================================================
   PLUS — styles-phase3.css
   Phase 3 : Carré (x²), Puissance de 2, DevMenu, Musique
   ========================================================== */

/* ─────────────────────────────────────────────────────────
   1. SUPERSCRIPT DANS LES QUESTIONS (x², 2ⁿ)
   vertical-align n'a aucun effet en flexbox — on utilise
   align-self: flex-start pour faire monter l'exposant en haut
   ───────────────────────────────────────────────────────── */
.op-sup {
  font-size: clamp(.7rem, 3vw, 1.4rem);
  font-weight: 900;
  color: var(--plus-gold);
  align-self: flex-start;   /* monte en haut de la ligne flex */
  margin-top: 0.1em;        /* léger décalage vers le haut    */
  line-height: 1;
  letter-spacing: .02em;
}

/* ─────────────────────────────────────────────────────────
   2. ÉCRAN CARRÉ (x²) — Niveau 4
   ───────────────────────────────────────────────────────── */
#screen-square {
  background: linear-gradient(180deg, #1a1040 0%, #050510 100%);
  flex-direction: column;
  padding: 12px 16px 16px;
  gap: 0;
}

#square-question {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: flex-end;    /* nombres bas-alignés, exposant remonte via align-self */
  justify-content: center;
  gap: clamp(4px, 2vw, 16px);
  margin-bottom: 8px;
  flex-shrink: 0;
  min-height: 80px;
}

#canvas-square {
  position: relative;
  z-index: 10;
  width: 100%;
  flex: 1;
  min-height: 0;
  max-height: 38vh;
  border-radius: var(--plus-radius);
}
#canvas-square.shake {
  animation: canvas-shake .5s cubic-bezier(.36,.07,.19,.97) both;
}

#square-answers {
  position: relative;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(8px, 2.5vw, 14px);
  width: 100%;
  max-width: 460px;
  margin-top: 10px;
  flex-shrink: 0;
}

#square-feedback {
  position: absolute;
  top: 8%; right: 5%;
  z-index: 20;
  font-size: clamp(2rem, 8vw, 3.5rem);
  font-weight: 900;
  pointer-events: none;
}

#square-level-badge {
  position: absolute;
  top: 10px; left: 14px;
  z-index: 20;
  background: rgba(180, 80, 255, .18);
  border: 1px solid rgba(180, 80, 255, .4);
  border-radius: 8px;
  padding: 3px 10px;
  font-size: .78rem;
  color: var(--plus-muted);
  letter-spacing: .04em;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
#square-level-badge.levelup {
  animation: badge-levelup 2s ease both;
  color: var(--plus-gold);
  border-color: var(--plus-gold);
  background: rgba(255, 215, 64, .15);
}

#square-world-bar {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: rgba(255,255,255,.08);
}
#square-world-fill {
  height: 100%;
  background: linear-gradient(90deg, #b450ff, var(--plus-gold));
  width: 0;
  transition: width .9s ease;
  border-radius: 2px;
}

#square-world-decos {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

/* ─────────────────────────────────────────────────────────
   3. ÉCRAN PUISSANCE DE 2 (2ⁿ) — Niveau 5
   ───────────────────────────────────────────────────────── */
#screen-power {
  background: linear-gradient(180deg, #0a1f3a 0%, #050510 100%);
  flex-direction: column;
  padding: 12px 16px 16px;
  gap: 0;
}

#power-question {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: flex-end;    /* nombres bas-alignés, exposant remonte via align-self */
  justify-content: center;
  gap: clamp(4px, 2vw, 16px);
  margin-bottom: 8px;
  flex-shrink: 0;
  min-height: 80px;
}

#canvas-power {
  position: relative;
  z-index: 10;
  width: 100%;
  flex: 1;
  min-height: 0;
  max-height: 38vh;
  border-radius: var(--plus-radius);
}
#canvas-power.shake {
  animation: canvas-shake .5s cubic-bezier(.36,.07,.19,.97) both;
}

#power-answers {
  position: relative;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(8px, 2.5vw, 14px);
  width: 100%;
  max-width: 460px;
  margin-top: 10px;
  flex-shrink: 0;
}

#power-feedback {
  position: absolute;
  top: 8%; right: 5%;
  z-index: 20;
  font-size: clamp(2rem, 8vw, 3.5rem);
  font-weight: 900;
  pointer-events: none;
}

#power-level-badge {
  position: absolute;
  top: 10px; left: 14px;
  z-index: 20;
  background: rgba(0, 180, 255, .15);
  border: 1px solid rgba(0, 180, 255, .35);
  border-radius: 8px;
  padding: 3px 10px;
  font-size: .78rem;
  color: var(--plus-muted);
  letter-spacing: .04em;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
#power-level-badge.levelup {
  animation: badge-levelup 2s ease both;
  color: var(--plus-gold);
  border-color: var(--plus-gold);
  background: rgba(255, 215, 64, .15);
}

#power-world-bar {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: rgba(255,255,255,.08);
}
#power-world-fill {
  height: 100%;
  background: linear-gradient(90deg, #00b4ff, var(--plus-gold));
  width: 0;
  transition: width .9s ease;
  border-radius: 2px;
}

#power-world-decos {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

/* ─────────────────────────────────────────────────────────
   4. THÈMES SKINS POUR NOUVEAUX ÉCRANS
   ───────────────────────────────────────────────────────── */
#plus-app[data-skin="jungle"] #screen-square,
#plus-app[data-skin="jungle"] #screen-power {
  background: linear-gradient(180deg, #0d2e0d 0%, #071407 100%);
}
#plus-app[data-skin="jungle"] #square-level-badge {
  background: rgba(46, 204, 64, .15);
  border-color: rgba(46, 204, 64, .4);
}
#plus-app[data-skin="jungle"] #power-level-badge {
  background: rgba(46, 204, 64, .12);
  border-color: rgba(46, 204, 64, .35);
}

#plus-app[data-skin="ocean"] #screen-square,
#plus-app[data-skin="ocean"] #screen-power {
  background: linear-gradient(180deg, #00243a 0%, #001422 100%);
}
#plus-app[data-skin="ocean"] #square-level-badge {
  background: rgba(0, 153, 204, .15);
  border-color: rgba(0, 153, 204, .4);
}
#plus-app[data-skin="ocean"] #power-level-badge {
  background: rgba(0, 153, 204, .12);
  border-color: rgba(0, 153, 204, .35);
}

/* ─────────────────────────────────────────────────────────
   5. BOUTON MUSIQUE (visible partout sauf landing)
   ───────────────────────────────────────────────────────── */
#plus-music-btn {
  position: fixed;
  bottom: 14px; left: 14px;
  z-index: 40;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 50%;
  width: 32px; height: 32px;
  font-size: 1rem;
  color: rgba(255,255,255,.35);
  cursor: pointer;
  padding: 0;
  display: none;
  align-items: center;
  justify-content: center;
  transition: color .25s, background .25s;
  touch-action: manipulation;
}
#plus-music-btn.visible   { display: flex; }
#plus-music-btn:hover     { color: rgba(255,255,255,.8); background: rgba(255,255,255,.12); }
#plus-music-btn:focus-visible { outline: 2px solid var(--plus-accent2); }

/* ─────────────────────────────────────────────────────────
   6. BOUTON ENGRENAGE (accès menu discret)
   ───────────────────────────────────────────────────────── */
#devmenu-gear {
  position: fixed;
  bottom: 14px; right: 14px;
  z-index: 40;
  background: transparent;
  border: none;
  width: 24px; height: 24px;
  font-size: .75rem;
  color: rgba(255,255,255,.12);
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color .3s, transform .3s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
#devmenu-gear:hover   { color: rgba(255,255,255,.55); transform: rotate(30deg); }
#devmenu-gear:focus-visible { outline: 2px solid var(--plus-accent2); border-radius: 4px; }

/* ─────────────────────────────────────────────────────────
   7. OVERLAY & PANEL DU MENU DÉVELOPPEUR
   ───────────────────────────────────────────────────────── */
#devmenu-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, .78);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease;
}
#devmenu-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

#devmenu-panel {
  background: #0d0d24;
  border: 1px solid rgba(124, 77, 255, .38);
  border-radius: 20px;
  padding: 26px 22px 20px;
  width: min(360px, 90vw);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 18px;
  box-shadow: 0 12px 50px rgba(0,0,0,.7), 0 0 0 1px rgba(124,77,255,.12);
  max-height: 90dvh;
  overflow-y: auto;
}

#devmenu-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--plus-text);
  letter-spacing: .06em;
  text-align: center;
  opacity: .8;
}

.devmenu-section { display: flex; flex-direction: column; gap: 8px; }

.devmenu-label {
  margin: 0;
  font-size: .7rem;
  color: var(--plus-muted);
  letter-spacing: .08em;
  text-transform: uppercase;
}

.devmenu-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* Boutons de niveau */
.devmenu-lvl-btn {
  flex: 1 1 calc(50% - 4px);
  min-width: 0;
  background: rgba(124, 77, 255, .12);
  border: 1px solid rgba(124, 77, 255, .3);
  border-radius: 10px;
  color: var(--plus-text);
  padding: 11px 8px;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .18s, border-color .18s, transform .1s;
  text-align: center;
  touch-action: manipulation;
}
.devmenu-lvl-btn:hover  { background: rgba(124, 77, 255, .3); border-color: var(--plus-accent); }
.devmenu-lvl-btn:active { transform: scale(.95); }
.devmenu-lvl-btn:focus-visible { outline: 2px solid var(--plus-accent2); }

/* Bouton musique */
#devmenu-mute-btn {
  font-size: 1.4rem;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 10px;
  padding: 9px 20px;
  cursor: pointer;
  color: var(--plus-text);
  transition: background .18s;
  touch-action: manipulation;
}
#devmenu-mute-btn:hover { background: rgba(255,255,255,.16); }
#devmenu-mute-btn:focus-visible { outline: 2px solid var(--plus-accent2); }

/* Bouton fermer */
#devmenu-close {
  position: absolute;
  top: 12px; right: 14px;
  background: none;
  border: none;
  color: var(--plus-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color .18s, background .18s;
  line-height: 1;
}
#devmenu-close:hover { color: var(--plus-text); background: rgba(255,255,255,.1); }
#devmenu-close:focus-visible { outline: 2px solid var(--plus-accent2); }

.devmenu-version {
  font-size: .65rem;
  color: rgba(255,255,255,.18);
  text-align: center;
  margin: 0;
  letter-spacing: .04em;
}

/* ─────────────────────────────────────────────────────────
   9. SIGNE + : canvas remplace le texte HTML
   Le canvas-landing passe au-dessus ; #plus-symbol est une
   zone de clic invisible (mais garde sa taille pour le tap).
   ───────────────────────────────────────────────────────── */
#canvas-landing {
  z-index: 5;          /* au-dessus du fond, en dessous de #plus-symbol */
  pointer-events: none;/* les clics passent au travers vers l'écran */
}

/* Cacher le texte "+" (le + est désormais dessiné sur canvas) */
#plus-symbol,
#plus-app[data-skin] #plus-symbol {
  color:       transparent !important;
  text-shadow: none        !important;
  animation:   none        !important;
  filter:      none        !important;
  /* Agrandir la zone de clic pour correspondre au + canvas */
  width:  clamp(10rem, 42vw, 26rem);
  height: clamp(10rem, 42vw, 26rem);
  z-index: 6;
}
#plus-symbol:hover,
#plus-symbol:active,
#plus-app[data-skin] #plus-symbol:hover {
  filter: none !important;
}
@media (max-width: 600px) {
  #square-answers,
  #power-answers       { gap: 8px; }
  .devmenu-lvl-btn     { flex: 1 1 100%; }
}

@media (max-height: 520px) and (orientation: landscape) {
  #canvas-square,
  #canvas-power        { max-height: 26vh; }
  #square-answers .answer-btn,
  #power-answers .answer-btn { min-height: 44px; padding: 5px 0; }
}

/* Dédicace — landing screen */
.landing-credit {
  position: absolute;
  bottom: 1.4rem;
  left: 0;
  right: 0;
  text-align: center;
  font-size: clamp(0.65rem, 1.8vw, 0.82rem);
  line-height: 1.5;
  color: rgba(255,255,255,0.38);
  letter-spacing: 0.01em;
  pointer-events: none;
  z-index: 10;
}
.landing-credit em {
  font-style: italic;
  color: rgba(255,255,255,0.55);
}
