/* =========================================================
   MATEMÁTICAS MÁGICAS 3D · responsive.css
   Ajustes para celulares (vertical y horizontal) y pantallas pequeñas.
   ========================================================= */

/* ---------- Lista de portales (celular vertical) ---------- */
.portal-list {
  position: absolute; left: 12px; right: 12px; top: 118px;
  display: flex; flex-direction: column; gap: 12px; transition: opacity .3s;
}
.portal-list #mn-cont { position: static; translate: none; width: 100%; white-space: normal; font-size: .85em; }
.portal-row {
  pointer-events: auto; cursor: pointer; display: flex; align-items: center; gap: 12px; width: 100%;
  background: rgba(255,255,255,.96); border: 5px solid var(--c); border-radius: 24px; padding: 10px 14px;
  box-shadow: 0 6px 0 rgba(0,0,0,.18), var(--shadow); text-align: left; color: var(--ink); font-family: inherit;
}
.portal-row:active { transform: translateY(3px); }
.portal-row .pi { font-size: 1.7em; line-height: 1; flex: 0 0 auto; }
.portal-row .pt { flex: 1; display: flex; flex-direction: column; line-height: 1.1; }
.portal-row .pt b { color: var(--c); font-size: 1.25em; }
.portal-row .pt small { font-weight: 700; font-size: .85em; }
.portal-row .pt em { font-style: normal; font-weight: 800; font-size: .7em; opacity: .8; margin-top: 2px; }
.portal-row .go { font-size: 1.6em; color: var(--c); font-weight: 800; }

/* ---------- Celular vertical y pantallas angostas ---------- */
@media (max-width: 600px) {
  :root { --fs: 15px; --radius: 20px; }
  #topbar { top: 6px; left: 6px; right: 6px; gap: 4px; }
  .chip-btn { min-height: 36px; padding: .2em .55em; }
  .stat { min-height: 36px; padding: .1em .6em .1em .4em; }
  .panel { padding: 12px 14px; border-width: 3px; }
  .btn.big { font-size: 1.25em; min-height: 54px; padding: .4em 1.1em; }
  .btn.small { min-height: 40px; }

  /* inicio */
  #scr-start .school .s1 { font-size: 14px; }
  #scr-start .center { top: 17vh; }
  #scr-start .play .btn.big { font-size: 26px; padding: 14px 34px; }

  /* menú */
  #scr-menu .menu-title { top: 54px; }
  #scr-menu .menu-title h2 { font-size: 24px; }
  #scr-menu .menu-title p { font-size: 13px; }
  #scr-menu .menu-bottom { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; bottom: 10px; }
  #scr-menu .menu-bottom .btn { font-size: .85em; padding: .5em .4em; min-height: 46px; }

  /* juego */
  .g-top { top: 50px; left: 6px; right: 6px; gap: 6px; flex-wrap: nowrap; }
  .g-info { padding: 4px 10px; border-radius: 16px; min-width: 0; }
  .g-info .gname { font-size: .85em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 42vw; }
  .g-info .glevel { display: none; }
  .g-actions { display: flex; gap: 4px; }
  .g-actions .btn.small { font-size: .72em; padding: .3em .6em; min-height: 36px; }
  .g-actions .lg { display: none; }
  .g-score { font-size: .8em; }
  .g-score .pts { font-size: 1.4em; }
  .question { top: 100px; font-size: clamp(16px, 4.6vw, 22px); padding: 8px 12px; max-width: 94vw; width: max-content; }
  .question .qvis svg { height: 64px; }
  .hint-bar { bottom: 82px; font-size: .78em; padding: 5px 12px; max-width: 94vw; width: max-content; }
  .answer-bar { bottom: 10px; gap: 8px; padding: 0 6px; }
  .answer-bar .btn { min-width: 60px; font-size: 1.2em; }
  .answer-bar .btn.big { font-size: 1.15em; }
  .counter-badge { font-size: .8em; }
  .palette { gap: 6px; padding: 4px 8px; }
  .palette .sw { width: 34px; height: 34px; border-width: 3px; }
  .tag.big { font-size: 1.4em; padding: 0 12px; }
  .tag.choice { font-size: 1.25em; padding: 2px 10px; min-width: 52px; }
  .tag.choice svg { height: 54px; }
  .tag.choice .txt { max-width: 110px; }
  .equation-pop { font-size: 42px; }
  .toast { font-size: 20px; padding: 8px 18px; }

  /* mapa */
  .map-wrap { inset: 52px 8px 8px; }
  .map-head h2 { font-size: 20px; }
  .map-head .btn { font-size: .8em; padding: .4em .8em; }
  .map-worlds { overflow: auto; }
  .world-card { padding: 10px; border-radius: 22px; }
  .path { min-height: 150px; }
  .node { width: 54px; height: 54px; border-width: 4px; }
  .node .nm { font-size: .55em; }

  /* ventanas, profesor y resultados */
  .modal-back { padding: 6px; }
  .modal h2 { font-size: 24px; }
  .modal .wiz { font-size: 42px; }
  .modal .row { gap: 8px; margin-top: 10px; }
  .modal .btn.big { font-size: 1.05em; min-height: 48px; padding: .4em .9em; }
  .teacher .t-head { flex-direction: column; gap: 4px; }
  .teacher .t-head h2 { font-size: 18px; }
  .teacher .steps i { width: 24px; height: 9px; }
  .teacher .stage { height: 30vh; margin: 6px 0; }
  .teacher .say { font-size: 15px; min-height: 0; padding: 8px 10px; }
  .teacher .say .wz { font-size: 1.6em; }
  .center-wrap { padding: 52px 8px 8px; overflow: auto; align-items: flex-start; }
  .results .stars { font-size: 44px; }

  /* exposición */
  .expo-parts { top: 52px; left: 6px; right: 6px; justify-content: center; }
  .expo-parts .btn { font-size: .7em; padding: 5px 9px; min-height: 34px; }
  .expo-big { top: 96px; width: 94vw; }
  .expo-big .eqbig { font-size: 40px; }
  .part-tags span { font-size: 12px; }
  .expo-panel { padding: 10px 12px; bottom: 8px; }
  .expo-panel h2 { font-size: 20px; }
  .expo-panel .txt { font-size: 15px; }
  .expo-panel .row { gap: 6px; }
  .expo-panel .row .btn { font-size: 12px; padding: 7px 10px; }

  /* práctica y progreso */
  .prac-choose { justify-content: center; padding: 56px 10px 10px; align-items: flex-start; overflow: auto; }
  .prac-choose .panel { max-width: 96vw; }
  .prac-panel { width: 96vw; right: 2vw; top: 52px; }
  .prac-panel .pvis svg { height: 120px; }
  .prog-wrap { inset: 52px 8px 8px; }
  .badges { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }
}

/* ---------- Celular horizontal (poca altura) ---------- */
@media (max-height: 500px) {
  :root { --fs: 14px; }
  #topbar { top: 4px; }
  .chip-btn, .stat { min-height: 32px; }
  .btn.big { font-size: 1.1em; min-height: 44px; padding: .3em 1em; }
  .btn.small { min-height: 34px; }
  .panel { padding: 8px 12px; }

  #scr-start .school { top: 8px; }
  #scr-start .center { top: 21vh; }
  #scr-start .title-xl { font-size: 44px; }
  #scr-start .slogan { font-size: 18px; margin-top: 6px; }
  #scr-start .play { bottom: 12px; }
  #scr-start .play .btn.big { font-size: 22px; padding: 10px 30px; }

  #scr-menu .menu-title { top: 44px; }
  #scr-menu .menu-title h2 { font-size: 22px; }
  #scr-menu .menu-title p { display: none; }
  #scr-menu .continue { top: 76px; font-size: .8em; padding: .3em .9em; }
  #scr-menu .menu-bottom { bottom: 6px; gap: 6px; }
  #scr-menu .menu-bottom .btn { font-size: .8em; padding: .35em .8em; min-height: 36px; }
  .portal-card { width: clamp(140px, 21vw, 200px); padding: 4px 8px 6px; border-width: 4px; }
  .portal-card h3 { font-size: 16px; }
  .portal-card p { font-size: .75em; margin: 0 0 2px; }
  .portal-card .prog { display: none; }

  .g-top { top: 42px; }
  .g-info .glevel { display: none; }
  .g-actions .lg { display: none; }
  .g-actions .btn.small { font-size: .75em; min-height: 32px; padding: .25em .7em; }
  .g-score .pts { font-size: 1.2em; }
  .question { top: 84px; font-size: 16px; padding: 4px 14px; max-width: 70vw; width: max-content; }
  .question .qvis svg { height: 48px; }
  .hint-bar { bottom: 58px; font-size: .72em; padding: 3px 12px; }
  .answer-bar { bottom: 6px; gap: 8px; }
  .answer-bar .btn { min-width: 52px; font-size: 1.05em; }
  .palette .sw { width: 30px; height: 30px; border-width: 3px; }
  .tag.big { font-size: 1.3em; }
  .tag.choice { font-size: 1.15em; }
  .tag.choice svg { height: 46px; }
  .equation-pop { font-size: 40px; }
  .toast { font-size: 18px; }

  .map-wrap { inset: 42px 8px 6px; gap: 6px; }
  .map-head h2 { font-size: 18px; }
  .map-head .btn { font-size: .75em; padding: .3em .8em; min-height: 32px; }
  .world-card { padding: 8px; border-radius: 18px; }
  .world-card h3 { font-size: 1em; }
  .path { min-height: 130px; margin-top: 2px; }
  .node { width: 46px; height: 46px; border-width: 3px; }
  .node .nm { display: none; }

  .modal { max-height: 98vh; }
  .modal .wiz { display: none; }
  .modal h2 { font-size: 20px; }
  .modal p { margin: 4px 0; }
  .modal .row { margin-top: 6px; gap: 6px; }
  .modal .btn.big { font-size: 1em; min-height: 40px; }
  .teacher .t-head h2 { font-size: 16px; }
  .teacher .stage { height: 42vh; margin: 4px 0; border-width: 2px; }
  .teacher .say { font-size: 13px; min-height: 0; padding: 4px 10px; }
  .center-wrap { padding: 44px 8px 6px; overflow: auto; align-items: flex-start; }
  .results h2 { font-size: 22px; }
  .results .stars { font-size: 36px; margin: 0; }

  .expo-parts { top: 42px; }
  .expo-parts .btn { font-size: .7em; padding: 4px 9px; min-height: 30px; }
  .expo-big { top: 74px; }
  .expo-big .eqbig { font-size: 36px; }
  .expo-panel { padding: 6px 12px; bottom: 6px; }
  .expo-panel h2 { font-size: 17px; }
  .expo-panel .txt { font-size: 13px; }
  .expo-panel .row { margin-top: 4px; }
  .expo-panel .row .btn { font-size: 11px; padding: 5px 9px; min-height: 30px; }

  .prac-choose { padding: 44px 10px 6px; align-items: flex-start; overflow: auto; }
  .prac-panel { top: 44px; }
  .prac-panel .pvis { min-height: 0; }
  .prac-panel .pvis svg { height: 90px; }
  .prog-wrap { inset: 42px 8px 6px; }
}
/* celular horizontal: los 3 mundos del mapa caben lado a lado */
@media (max-height: 500px) and (min-width: 640px) {
  .map-worlds { grid-template-columns: repeat(3, 1fr); overflow: auto; }
}

/* ---------- ajustes finales para celular ---------- */
@media (max-width: 600px), (max-height: 500px) {
  /* pantallas que pueden desplazarse con el dedo */
  .center-wrap, .prac-choose { pointer-events: auto; -webkit-overflow-scrolling: touch; }
  .g-info { flex: 1 1 auto; }
  .g-score > div:last-child { display: none; }
  .g-score { padding: 2px 10px; }
}
@media (max-width: 600px) {
  .g-info .gname { max-width: 34vw; }
}
@media (max-height: 500px) {
  .results > div:first-child { display: none; }
  .results .res-grid div { padding: 4px; }
  .results .res-grid div b { font-size: 1.3em; }
  .results .unlock-banner { padding: 4px 10px; margin: 4px 0; }
  .results .res-actions { margin-top: 6px; gap: 6px; }
  .results .res-actions .btn { min-height: 38px; }
  .prac-choose .panel > div:first-child { display: none; }
  .prac-choose .title-l { font-size: 24px; }
  .tag.choice { font-size: 1em; min-width: 40px; padding: 2px 8px; }
}
@media (max-width: 600px), (max-height: 500px) {
  .g-actions { flex-wrap: nowrap; flex: 0 0 auto; }
  .g-info { flex: 1 1 0; min-width: 0; }
  .g-info .gname { max-width: none; }
}
