/* t638 ajustes móvil: barra inferior pegada al borde (safe-area), pestaña Lore + Menú abajo, traits, mapa */
@media (max-width: 899.98px), (hover: none) and (pointer: coarse) and (max-height: 600px) {
  html { --aw-mtab-h: 60px; }
  html body .aw-mtabs { position: fixed !important; left: 0 !important; right: 0 !important; bottom: 0 !important; top: auto !important; height: auto !important; min-height: calc(var(--aw-mtab-h) + env(safe-area-inset-bottom, 0px)); padding-bottom: env(safe-area-inset-bottom, 0px) !important; box-sizing: border-box; display: flex !important; align-items: stretch; background-color: rgb(32,30,27); }
  html body .aw-mtabs::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 200px; background: rgb(32,30,27); pointer-events: none; }
  html body .aw-mtabs > .aw-mtab { flex: 1 1 0; min-width: 0; height: var(--aw-mtab-h); padding: 0 1px; }
  html body .aw-mtabs > .aw-mtab > span { font-size: .625rem; }
  html body .aw-mtabs .aw-mico { width: 21px; height: 21px; }
  html body .aw-mtabs > button.aw-mtab { background: transparent; border: 0; color: inherit; font: inherit; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; cursor: pointer; }
  html body .aw-mtabs > button.aw-mtab .aw-mico { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  html.aw-mhere-more .aw-mtabs > .aw-mtab--more { color: #fffaf0; }
  .aw-topbar .aw-mmenu { display: none !important; }
  body.aw { padding-bottom: calc(var(--aw-mtab-h) + env(safe-area-inset-bottom, 0px)) !important; min-height: 100dvh; }
  /* traits: el cuadro de información usa todo el alto libre y hace scroll dentro (no corta la descripción) */
  body.aw-page-traits .tt-side { max-height: calc(100dvh - var(--aw-mtab-h) - env(safe-area-inset-bottom, 0px) - 84px) !important; bottom: calc(var(--aw-mtab-h) + env(safe-area-inset-bottom, 0px) + 6px) !important; display: flex !important; flex-direction: column; overflow: visible !important; }
  body.aw-page-traits .tt-side .aw-detail { flex: 0 1 auto; min-height: 0; max-height: calc(100dvh - var(--aw-mtab-h) - env(safe-area-inset-bottom, 0px) - 84px) !important; height: auto !important; overflow-y: auto !important; -webkit-overflow-scrolling: touch; }
  body.aw-page-traits .tt-side .aw-detail__desc, body.aw-page-traits .tt-side .aw-detail__combo { max-height: none !important; overflow: visible !important; -webkit-line-clamp: unset !important; display: block; }
  /* mapa: barra inferior oculta salvo con la leyenda abierta */
  body.aw.aw-page-map { padding-bottom: 0 !important; }
  html body.aw.aw-page-map .aw-mtabs { transform: translateY(110%) !important; visibility: hidden !important; transition: transform .2s, visibility .2s; }
  html.aw-mleg-open body.aw.aw-page-map #aw-mtabs.aw-mtabs { transform: none !important; visibility: visible !important; }
  body.aw-page-map #aw-wm-legend { right: 10px !important; left: auto !important; top: auto !important; bottom: calc(12px + env(safe-area-inset-bottom, 0px)) !important; }
  html.aw-mleg-open body.aw-page-map #aw-wm-legend { bottom: calc(var(--aw-mtab-h) + env(safe-area-inset-bottom, 0px) + 8px) !important; left: 6px !important; right: 6px !important; width: auto !important; max-width: none !important; max-height: calc(100dvh - var(--aw-mtab-h) - env(safe-area-inset-bottom, 0px) - 70px) !important; }
  body.aw-page-map .aw-map-xy { left: 10px !important; right: auto !important; top: auto !important; bottom: calc(14px + env(safe-area-inset-bottom, 0px)) !important; max-width: calc(100% - 110px); }
  body.aw-page-map #map-zone.map-zone { left: 10px !important; right: auto !important; top: auto !important; bottom: calc(44px + env(safe-area-inset-bottom, 0px)) !important; }
  body.aw-page-map #map-sol.map-sol { left: 10px !important; right: auto !important; top: auto !important; bottom: calc(54px + env(safe-area-inset-bottom, 0px)) !important; }
  body.aw-page-map .map-pinbar { left: 10px !important; right: auto !important; top: auto !important; bottom: calc(122px + env(safe-area-inset-bottom, 0px)) !important; }
  body.aw-page-map .aw-wm-legend .aw-mrep { padding: 8px 10px 4px; }
  body.aw-page-map .aw-wm-legend .aw-mrep .rep-btn { position: static !important; inset: auto !important; transform: none !important; width: 100%; }
  html.aw-mleg-open body.aw-page-map .map-sol, html.aw-mleg-open body.aw-page-map .map-pinbar, html.aw-mleg-open body.aw-page-map .map-zone, html.aw-mleg-open body.aw-page-map .aw-map-xy { visibility: hidden; }
}
/* t638: escritorio — los números azules de previsualización no desplazan el cuadro de estadísticas */
@media (min-width: 900px) and (hover: hover) {
  .aw-char .q span.t { flex-wrap: nowrap !important; align-items: center !important; position: relative; min-width: 0; }
  .aw-char .q .qv { display: inline-block; min-width: 5ch; font-variant-numeric: tabular-nums; }
  .aw-char .q .qb { position: absolute !important; left: 100%; top: 50%; transform: translateY(-50%); margin: 0; pointer-events: none; white-space: nowrap; }
  .aw-char .st .vl { font-variant-numeric: tabular-nums; min-width: 5.6ch; }
  .aw-char .st[data-key="Physical Amplification"] .vl, .aw-char .st[data-key="Magic Amplification"] .vl, .aw-char .st[data-key^="└"] .vl { min-width: 10.5ch; }
  .aw-char .st .bn { flex: 0 0 auto; display: inline-flex; height: 1.2em; align-items: center; }
}
/* t643 móvil: menú «Más» en una columna, sin título ni X; la barra deja solo el botón «Más» a la vista */
@media (max-width: 899.98px), (hover: none) and (pointer: coarse) and (max-height: 600px) {
  html body .aw-mtabs > .aw-mtab, html body .aw-mtabs > .aw-mtab > span { font-size: .6875rem; }
  html body .aw-mtabs > .aw-mtab > span { font-size: .6875rem; }
  html body .aw-mtabs .aw-mico { width: 22px; height: 22px; }
  .aw-mdrawer .aw-mdrawer__head { display: none !important; }
  .aw-mdrawer .aw-mdrawer__panel { left: 0 !important; right: 0 !important; top: 0 !important; width: auto !important; max-width: none !important; bottom: 0 !important; border-left: 0 !important; box-shadow: none !important; overflow-y: auto !important; height: auto !important; max-height: none !important; background: #1b1916 !important; animation: none !important; transform: none !important; -webkit-overflow-scrolling: touch; padding-top: env(safe-area-inset-top, 0px); }
  .aw-mdrawer .aw-mdrawer__nav { display: flex !important; flex-direction: column !important; grid-template-columns: none !important; padding: 0 8px; }
  .aw-mdrawer .aw-mdrawer__row { width: 100% !important; box-sizing: border-box; grid-column: auto !important; }
  html.aw-mdrawer-open body .aw-mtabs > .aw-mtab:not(#aw-mmenu-btn) { visibility: hidden !important; pointer-events: none; }
  html.aw-mdrawer-open body .aw-mtabs { visibility: visible !important; transform: none !important; }
  html.aw-mdrawer-open body .aw-mtabs > #aw-mmenu-btn { visibility: visible !important; color: #fffaf0; }
  /* lore: el rombo y los adornos del marco no tapan el título */
  .aw-lore-band__h, .aw-vx-c2 .aw-lore-band__h { box-sizing: border-box; min-height: 46px; display: flex !important; align-items: center; padding: 6px 28px 6px 56px !important; margin-bottom: 10px; line-height: 1.2; }
  /* traits: la descripción primero y el vídeo después; scroll táctil dentro del cuadro */
  body.aw-page-traits .tt-side, body.aw-page-traits .tt-side .aw-detail { touch-action: pan-y !important; }
  body.aw-page-traits .tt-side .aw-detail:not(.is-empty) { display: flex !important; flex-direction: column; }
  body.aw-page-traits .tt-side .aw-detail > * { flex: 0 0 auto; }
  body.aw-page-traits .tt-side .aw-detail__head { order: 0; }
  body.aw-page-traits .tt-side .aw-detail__desc { order: 1; }
  body.aw-page-traits .tt-side .aw-detail__combo { order: 2; }
  body.aw-page-traits .tt-side .aw-detail__statuses { order: 3; }
  body.aw-page-traits .tt-side .aw-detail__section, body.aw-page-traits .tt-side .aw-detail__hint, body.aw-page-traits .tt-side .aw-detail__choices { order: 4; }
  body.aw-page-traits .tt-side .aw-detail__media { order: 8; }
  body.aw-page-traits .tt-side .aw-detail__media video, body.aw-page-traits .tt-side .aw-detail__media img { max-height: 26vh; object-fit: contain; }
  body.aw-page-traits .tt-side .aw-detail__foot { order: 9; }
}
@media (max-width: 899.98px), (hover: none) and (pointer: coarse) and (max-height: 600px) {
  body.aw-page-map #aw-wm-legend.is-collapsed, body.aw-page-map #aw-wm-legend.is-collapsed * { box-shadow: none !important; backdrop-filter: none !important; -webkit-backdrop-filter: none !important; filter: none !important; text-shadow: none !important; }
  body.aw-page-map #aw-wm-legend.is-collapsed::before, body.aw-page-map #aw-wm-legend.is-collapsed::after { display: none !important; }
}
/* t658: escritorio — panel Personaje más ancho; hueco reservado para los números azules (no se solapan ni desplazan nada) */
@media (min-width: 900px) and (hover: hover) {
  body.aw-page-character .aw-char .main { grid-template-columns: minmax(520px, 1.3fr) minmax(0, 1fr) minmax(0, 1fr) !important; }
  body.aw-page-character .aw-char .main > .left { padding-left: 40px; padding-right: 40px; }
  body.aw-page-character .aw-char .qs { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important; column-gap: 16px !important; }
  body.aw-page-character .aw-char .q { min-width: 0; }
  body.aw-page-character .aw-char .q span.t { padding-right: 6.5ch; }
  body.aw-page-character .aw-char .main > .sec .st .lb { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* t666u: classes.html en móvil — una columna, selector de clase arriba (fila compacta), sin desbordes, respeta el menú inferior fijo. Escritorio intacto. */
@media (max-width: 899.98px), (hover: none) and (pointer: coarse) and (max-height: 600px) {
  html body main.aw-classes-page { overflow-x: hidden !important; min-height: 0 !important; }
  html body main.aw-classes-page .cs.cs--page { padding: 10px 12px calc(var(--aw-mtab-h, 64px) + env(safe-area-inset-bottom, 0px) + 20px) !important; min-height: 0 !important; max-width: 100vw; box-sizing: border-box; }
  html body main.aw-classes-page .cs--page .cs__panel { width: 100% !important; max-width: 100% !important; margin: 0 !important; }
  html body main.aw-classes-page .cs--page .cs__head { gap: 8px 10px !important; padding-bottom: 10px !important; margin-bottom: 12px !important; }
  html body main.aw-classes-page .cs--page .cs__head-tools { display: flex; flex-wrap: wrap; gap: 8px; }
  html body main.aw-classes-page .cs--page .cs__body { display: flex !important; flex-direction: column !important; grid-template-columns: none !important; gap: 14px !important; min-width: 0; }
  html body main.aw-classes-page .cs--page .cs__body > * { min-width: 0; max-width: 100%; grid-column: auto !important; }
  html body main.aw-classes-page .cs--page .cs__classes { order: -1; display: grid !important; grid-template-columns: repeat(4, minmax(0, 1fr)) !important; flex-direction: row !important; gap: 6px !important; width: 100%; padding: 8px 0 4px !important; position: sticky; top: 0; z-index: 5; background: #0d0d0b; }
  html body main.aw-classes-page .cs--page .cs__class { width: 100% !important; height: 72px !important; justify-self: center; }
  html body main.aw-classes-page .cs--page .cs__slot-bg { inset: -6px 0 !important; width: 100% !important; height: calc(100% + 12px) !important; }
  html body main.aw-classes-page .cs--page .cs__slot-deco { inset: 0 !important; width: 100% !important; height: 100% !important; }
  html body main.aw-classes-page .cs--page .cs__diamond, html body main.aw-classes-page .cs--page .cs__class.is-on .cs__diamond { width: 52px !important; height: 52px !important; }
  html body main.aw-classes-page .cs--page .cs__diamond img, html body main.aw-classes-page .cs--page .cs__class.is-on .cs__diamond img { width: 34px !important; height: 34px !important; }
  html body main.aw-classes-page .cs--page .cs__main { padding-top: 0 !important; }
  html body main.aw-classes-page .cs--page .cs__name { font-size: clamp(26px, 8vw, 34px) !important; }
  html body main.aw-classes-page .cs--page .cs__sheet-top > .cs-race { font-size: 18px !important; margin: 2px 0 10px !important; }
  html body main.aw-classes-page .cs--page .cs__sheet-actions { gap: 8px !important; }
  html body main.aw-classes-page .cs--page .cs__weapons { display: grid !important; grid-template-columns: repeat(auto-fit, minmax(72px, 1fr)); gap: 12px 8px !important; justify-items: center; }
  html body main.aw-classes-page .cs--page .cs__weapon { width: auto !important; margin: 4px 0 !important; min-width: 0; }
  html body main.aw-classes-page .cs--page .cs__frame { width: 68px !important; height: 68px !important; }
  html body main.aw-classes-page .cs--page .cs__frame img { width: 48px !important; height: 48px !important; }
  html body main.aw-classes-page .cs--page .cs__wname { font-size: 14px !important; text-align: center; overflow-wrap: anywhere; }
  html body main.aw-classes-page .cs--page .cs__desc, html body main.aw-classes-page .cs--page .cs__traits { max-width: none !important; font-size: 16px !important; overflow-wrap: anywhere; }
  html body main.aw-classes-page .cs--page .cs__traits-line { max-width: 100% !important; }
  html body main.aw-classes-page .cs--page .cs__art { min-height: 0 !important; }
  html body main.aw-classes-page .cs--page .cs__art-img { max-height: 46vh !important; }
  html body main.aw-classes-page .cs--page #cs-stat-sum > * { flex: 1 1 100% !important; }
  html body main.aw-classes-page .cs--page .cs__foot { gap: 10px 16px !important; }
  html body main.aw-classes-page .cs--page img, html body main.aw-classes-page .cs--page table { max-width: 100%; }
}

/* t667u: móvil — nada queda tapado por el menú inferior fijo (alto del menú + safe-area). Menú pegado al borde, sin hueco. Escritorio intacto. */
@media (max-width: 899.98px), (hover: none) and (pointer: coarse) and (max-height: 600px) {
  html { --aw-mbot: calc(var(--aw-mtab-h, 60px) + env(safe-area-inset-bottom, 0px)); scroll-padding-bottom: var(--aw-mbot); }
  html body.aw { padding-bottom: var(--aw-mbot) !important; }
  html body .aw-mtabs { bottom: 0 !important; margin-bottom: 0 !important; }
  /* pantallas de alto completo: restar el menú */
  html body main.aw-char, html body main.aw-char--character, html body main.aw-quest, html body main.aw-craft-screen {
    height: auto !important; max-height: none !important; min-height: calc(100dvh - var(--aw-topbar-h, 62px) - var(--aw-mbot)) !important;
  }
  html body.aw-page-character main.aw-char > #char-info-view { min-height: 0 !important; }
  /* contenedores con scroll propio: último elemento visible por encima del menú */
  html body .aw-craft-rlist, html body .aw-prof-left, html body .eq-list, html body .eq-left, html body .eq-right,
  html body.aw-page-traits .tt-side .aw-detail, html body .tt-info__panel, html body .tt-statuswin,
  html body .aw-char .char-modal__panel, html body .cs:not(.cs--page) .cs__panel, html body .aw-mdrawer .aw-mdrawer__panel {
    scroll-padding-bottom: var(--aw-mbot);
  }
  html body .aw-craft-rlist, html body .aw-prof-left { max-height: calc(100dvh - var(--aw-topbar-h, 62px) - var(--aw-mbot) - 120px) !important; }
  html body .eq-list { max-height: calc(100dvh - var(--aw-topbar-h, 62px) - var(--aw-mbot) - 140px) !important; }
  html body .tt-info__panel, html body .tt-statuswin, html body .aw-char .char-modal__panel {
    max-height: calc(100dvh - var(--aw-topbar-h, 62px) - var(--aw-mbot) - 16px) !important;
  }
  html body .cs:not(.cs--page) .cs__panel { height: auto !important; max-height: calc(100dvh - var(--aw-mbot)) !important; padding-bottom: 24px !important; }
  html body .aw-mdrawer .aw-mdrawer__panel { bottom: var(--aw-mbot) !important; }
  html body .aw-mdrawer .aw-mdrawer__panel > :last-child { margin-bottom: 12px; }
  /* Traits: caja de info / lista «Más» por encima del menú */
  html body.aw-page-traits .tt-side { bottom: calc(var(--aw-mbot) + 6px) !important; max-height: calc(100dvh - var(--aw-mbot) - 84px) !important; }
  html body.aw-page-traits .tt-more, html body.aw-page-traits .tt-morelist { max-height: calc(100dvh - var(--aw-mbot) - 84px) !important; overflow-y: auto !important; padding-bottom: 12px; }
  /* footers y últimas secciones */
  html body footer.aw-legend--site, html body .aw-footer { margin-bottom: 0 !important; }
}

/* t668u: Traits móvil — el árbol (touch-action:none) no debe crecer: main con alto fijo = pantalla − barra superior − menú inferior; sin scroll atascado */
@media (max-width: 899.98px), (hover: none) and (pointer: coarse) and (max-height: 600px) {
  html.tt-js body.aw-page-traits:not(:has(.bv-build)) main.tt-page { height: calc(100dvh - var(--aw-topbar-h, 62px) - var(--aw-mbot)) !important; min-height: 0 !important; max-height: none !important; overflow: hidden !important; }
  html body.aw-page-traits:not(:has(.bv-build)) .tt-stage:not(.is-catalog-stage) { min-height: 0 !important; }
}

/* t669u: Personajes (todas las lenguas) — etiqueta/valor blancos y número azul juntos en la misma línea; columnas con ancho según contenido, alineadas a la izquierda; se mantiene el hueco reservado de la previsualización (sin desplazamientos ni solapes) */
body.aw-page-character .aw-char .qs { grid-template-columns: repeat(2, max-content) !important; justify-content: start !important; justify-items: start !important; column-gap: 22px !important; }
body.aw-page-character .aw-char .q { min-width: 0; justify-content: flex-start !important; white-space: nowrap; }
body.aw-page-character .aw-char .q span.t { flex-wrap: nowrap !important; white-space: nowrap; align-items: baseline; justify-content: flex-start; }
body.aw-page-character .aw-char .q span.t .bn, body.aw-page-character .aw-char .q .bn { display: inline-flex !important; flex: none; white-space: nowrap; }
@media (max-width: 899.98px), (hover: none) and (pointer: coarse) and (max-height: 600px) {
  body.aw-page-character .aw-char .qs { column-gap: 14px !important; }
}
