/* Ecos · interfaz de teléfono. Se carga después de oz.css.
   body.handset depende del lado corto/puntero, no de un ancho de escritorio. */
body.handset {
  height: 100dvh; min-height: 0; width: 100%; overflow: hidden; display: block;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
body.handset #app {
  width: 100%; height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  max-width: none; margin: 0; border-width: 1px; border-radius: 0; min-height: 0;
  display: flex; flex-direction: column; flex-wrap: nowrap; overflow: hidden;
}
body.handset button, body.handset #touch, body.handset #screen {
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
body.handset button, body.handset select, body.handset summary, body.handset input[type="range"] { min-height: 44px; }
body.handset #desktop-controls, body.handset .keyboard-help { display: none; }
body.handset #app #hud {
  position: static; inset: auto; z-index: 3; width: auto; min-height: 48px; height: 48px;
  padding: 2px 8px; gap: 8px; flex: 0 0 48px; flex-wrap: nowrap;
  border-bottom: 1px solid #80697f; background: #2d1829;
}
body.handset #app .hud-brand { flex: 1 1 auto; min-width: 0; gap: 7px; }
body.handset .hud-brand img { width: 42px; height: 29px; }
body.handset .hud-brand > div { min-width: 0; gap: 1px; }
body.handset .hud-game-title { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.handset #hud-location { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.handset #app #hud-objective, body.handset #hud-bag,
body.handset #hud-berries, body.handset #hud-save { display: none; }
body.handset #app #hud-right { flex: 0 0 auto; order: 0; justify-content: end; }
body.handset #hud-menu.hud-menu-button { min-height: 44px; padding: 4px 11px; gap: 8px; font-size: 12px; }
body.handset #hud-menu kbd { display: none; }
body.handset #hud-home { min-width: 52px; min-height: 44px; padding: 4px 8px; font-size: 12px; }
body.handset #hud-right { gap: 5px; }
/* Same 48px / 44px rail as before; the full objective remains in the map panel. */
body.handset #app #hud { grid-template-columns: auto minmax(0, 1fr) auto; gap: 7px; padding-inline: 7px; }
body.handset #app #hud .hud-brand { gap: 4px; padding-right: 7px; border-right-color: #72556880; }
body.handset #hud .hud-brand img { width: 35px; height: 27px; }
body.handset #hud .hud-podcast-copy { gap: 2px; }
body.handset #hud .hud-podcast-copy b { font-size: 10px; }
body.handset #hud .hud-podcast-copy small { font-size: 8px; }
body.handset #hud .hud-podcast-category { display: block; }
body.handset #hud .hud-podcast-invite, body.handset #hud .hud-podcast-cta { display: none; }
body.handset #hud .hud-route { gap: 1px; }
body.handset #hud .hud-location-line { display: block; }
body.handset #hud .hud-game-title { display: block; font-size: 9px; }
body.handset #hud #hud-location { display: block; font-size: 11px; line-height: 1.2; }
body.handset #app #hud #hud-objective, body.handset #app #hud .hud-resources,
body.handset #app #hud #hud-bag { display: none; }
body.handset #app #hud #hud-right { gap: 2px; }
body.handset #app #hud #hud-menu, body.handset #app #hud #hud-home { min-width: 44px; min-height: 44px; padding: 4px 7px; font-size: 11px; }
body.handset #app #hud #hud-home { min-width: 44px; }
body.handset .ranking-tabs { gap: 5px; }
body.handset .ranking-tabs button { flex-basis: 75px; padding: 8px; font-size: 12px; }
body.handset .ranking-table th, body.handset .ranking-table td { padding: 8px 5px; font-size: 11px; }
body.handset .ranked-result { padding: 12px; }
body.handset .ranked-result-name { gap: 10px; }
body.handset .ranked-metrics b { font-size: 26px; }
body.handset .ranked-metrics span { font-size: 11px; }
body.handset .island-grid { gap: 8px; }
body.handset .island-choice { min-height: 116px; padding: 12px; }
body.handset .island-choice > span { font-size: 20px; }
body.handset .island-choice small { font-size: 11px; }
body.handset .podcast-links a { min-height: 44px; }
body.handset #app #stage {
  flex: 1 1 auto; min-width: 0; min-height: 0; height: auto; max-height: none;
  padding: 4px; border: 0; overflow: hidden; align-items: center;
}
body.handset #screen { flex: 0 1 auto; max-width: 100%; max-height: 100%; }
body.handset #app #panel {
  min-width: 0; min-height: 0; width: auto; height: auto; max-height: none;
  padding: 8px; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch; scrollbar-width: thin;
}

/* Campamento: toda acción tiene su botón; no necesita cruceta. */
body.handset #app[data-scene="camp"] { display: grid; grid-template-rows: 48px minmax(140px, 1fr) auto; }
body.handset #app[data-scene="camp"] #touch { display: none !important; }
body.handset #app[data-scene="camp"] #panel { max-height: min(240px, 42dvh); border-top: 1px solid #80697f; }
body.handset .camp-heading { gap: 10px; min-height: 36px; }
body.handset .camp-heading h2 { font-size: 20px; }
body.handset .camp-heading .menu-eyebrow { font-size: 9px; margin-bottom: 2px; }
body.handset .camp-crew { gap: 4px; }
body.handset .camp-crew .portrait--sm { width: 32px; height: 32px; }
body.handset .camp-commands { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-top: 8px; }
body.handset .camp-commands .cmd { min-height: 56px; padding: 7px 10px; font-size: 13px; line-height: 1.25; }
body.handset .camp-commands .cmd small { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
body.handset .camp-note { display: none; }
body.handset .camp-tools { margin-top: 3px; }
body.handset .camp-tools .cmd { padding: 4px 9px; }
body.handset .inventory-vitals { gap: 5px; }
body.handset .inventory-vitals > div { padding: 7px; font-size: 12px; }
body.handset .inventory-vitals span { font-size: 11px; }

/* Exploración: escenario, objetivo breve y pulgares en regiones independientes. */
body.handset #app[data-scene="exploration"] { display: grid; grid-template-rows: 48px minmax(130px, 1fr) auto 148px; }
body.handset #app[data-scene="exploration"] #panel { padding: 5px 10px; max-height: 88px; border-top: 1px solid #80697f; }
body.handset .exploration-panel > .panel-title, body.handset .exploration-commands, body.handset .exploration-panel > .log { display: none; }
body.handset .exploration-panel > .preview { margin: 0; padding: 5px 8px; font-size: 12px; line-height: 1.4; }
body.handset .exploration-panel .preview > :first-child { font-weight: 600; }
body.handset .exploration-panel .preview > :last-child { font-size: 11px; }
body.handset #app[data-scene="exploration"] #touch:not([hidden]) {
  position: static; inset: auto; width: auto; height: 148px; min-height: 148px; z-index: auto;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 4px 12px 6px;
  background: #241629; border-top: 1px solid #604764; pointer-events: auto;
}
body.handset #dpad { display: grid; grid-template-columns: repeat(3, 44px); grid-template-rows: repeat(3, 44px); gap: 3px; flex: 0 0 138px; touch-action: none; }
body.handset .dpad-btn { min-width: 44px; width: 44px; height: 44px; min-height: 44px; padding: 0; font-size: 18px; touch-action: none; background: #43283e; border-color: #a38ba5; }
body.handset .dpad-btn:active { background: #eaded8; color: #30182d; }
body.handset #touch-actions { width: min(168px, 46%); display: flex; gap: 8px; flex-direction: column; }
body.handset #touch-actions .touch-btn { width: 100%; min-width: 0; min-height: 50px; padding: 8px 10px; font-size: 13px; line-height: 1.25; background: #43283e; }
body.handset #touch-actions .touch-btn--main { min-height: 62px; background: #ede2da; color: #331c30; border-color: #ede2da; font-weight: 600; }
body.handset #touch-actions .touch-btn:disabled { opacity: .68; background: #35253a; color: #c1aec5; border-color: #77627c; }

/* Combate vertical: tres integrantes compactos y comandos a todo el ancho. */
body.handset #app[data-scene="battle"] { display: grid; grid-template-rows: 48px calc((100vw - 10px) * .434 + 8px) minmax(0, 1fr); }
body.handset #app[data-scene="battle"] #stage { height: auto; max-height: none; flex: none; }
body.handset #app[data-scene="battle"] #panel,
body.handset #app[data-scene="battle"] #panel[data-signature="true"] { height: auto; flex: none; max-height: none; padding: 5px 6px 10px; border-top: 2px solid #a18ba4; }
body.handset .battle-controls { display: flex; flex-direction: column; gap: 5px; min-height: 0; }
body.handset .action-workspace, body.handset .party-panel { padding: 5px 7px; border-width: 1px; }
body.handset .party-panel { order: -1; }
body.handset .party-heading { display: block; padding: 0 1px 4px; font-size: 11px; line-height: 1.1; }
body.handset .party-heading > :first-child { font-size: 11px; }
body.handset .party-heading > :not(:first-child) { display: none; }
body.handset .battle-controls .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
body.handset .battle-controls .card { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px 5px; padding: 5px 6px; min-height: 76px; align-items: center; }
body.handset .battle-controls .party-identity { grid-column: 1 / -1; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1px 3px; }
body.handset .battle-controls .card-head { grid-column: 1; grid-row: 1; min-width: 0; flex-wrap: nowrap; gap: 2px; }
body.handset .battle-controls .card-name { font-size: 12px; line-height: 1.15; }
body.handset .battle-controls .card-tag { font-size: 8px; padding: 0 2px; }
body.handset .battle-controls .card-status { grid-column: 2; grid-row: 1 / span 2; display: flex; flex-wrap: wrap; max-width: 33px; align-content: center; margin: 0; gap: 1px; }
body.handset .battle-controls .party-tension { grid-column: 1; grid-row: 2; margin: 0; font-size: 9px; line-height: 11px; }
body.handset .party-vital { min-width: 0; }
body.handset .party-vital::before { display: block; float: none; content: 'HP'; font-size: 8px; line-height: 10px; color: #d3c1d7; }
body.handset .party-vital--en::before { content: 'EN'; }
body.handset .party-number { justify-content: start; flex-wrap: nowrap; gap: 1px; }
body.handset .party-number b { font-size: 13px; line-height: 15px; }
body.handset .party-number small { font-size: 9px; line-height: 11px; }
body.handset .party-vital .bar { height: 3px; margin-top: 2px; }
body.handset .action-workspace { position: relative; }
body.handset .battle-heading { min-height: 16px; padding-right: 43px; flex-wrap: nowrap; gap: 5px; margin-bottom: 0; }
body.handset .battle-step { font-size: 12px; }
body.handset .round-label { font-size: 10px; }
body.handset .action-caption { min-height: 17px; font-size: 11px; line-height: 1.35; padding-right: 40px; }
body.handset .battle-controls .commands { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; margin-top: 4px; }
body.handset .battle-controls .cmd { min-width: 0; min-height: 48px; padding: 5px 7px; flex-direction: column; align-items: start; justify-content: center; font-size: 12px; line-height: 1.2; gap: 2px; }
body.handset .battle-controls .cmd small { font-size: 10px; line-height: 1.1; text-align: left; }
body.handset .action-help { margin: 0; }
body.handset .action-help summary { position: absolute; right: 3px; top: 1px; display: grid; place-items: center; width: 44px; height: 44px; min-height: 44px; font-size: 0; padding: 0; border: 0; border-radius: 4px; }
body.handset .action-help summary::before { content: '?'; font: 600 16px/1 var(--font); color: #e8dbe9; width: 23px; height: 23px; border: 1px solid #bea8c3; border-radius: 50%; display: grid; place-items: center; }
body.handset .action-help[open] summary::before { content: '×'; }
body.handset .action-help-text { padding: 8px 2px 0; font-size: 12px; }
body.handset .target-picker > .cmd { margin-top: 4px; min-height: 44px; }
body.handset .battle-footnotes { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
body.handset .battle-intel summary, body.handset .battle-log .hud-chip { min-height: 44px; font-size: 11px; }
body.handset .battle-intel .intel-hint { display: none; }
body.handset .battle-log .log { max-width: none; font-size: 11px; }
body.handset .signature-warning { padding: 6px 8px; margin-top: 5px; font-size: 11px; line-height: 1.35; }
body.handset .signature-warning b, body.handset .signature-warning span { display: block; }
body.handset .console-panel { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 4px 8px; padding: 4px 7px; font-size: 10px; margin-bottom: 5px; }
body.handset .console-panel .console-opening { grid-column: 1 / -1; display: block; padding: 5px 7px; font-size: 11px; line-height: 1.35; }
body.handset .console-opening b { display: block; font-size: 11px; margin-bottom: 2px; }
body.handset .console-opening > span { display: block; }
body.handset .console-panel .panel-title { font-size: 10px; margin-bottom: 3px; letter-spacing: .06em; }
body.handset .console-panel > .muted { display: none; }
body.handset .console-slots { gap: 4px; }
body.handset .console-slot { width: 14px; height: 10px; }
body.handset .console-transfer { width: auto; }
body.handset .console-panel .bar-label { font-size: 10px; }
body.handset .console-seal, body.handset .console-last { grid-column: 1 / -1; }
body.handset .console-rule { grid-column: 1 / -1; font-size: 10px; }
body.handset .enemy-overview { gap: 3px; grid-template-columns: repeat(auto-fit, minmax(98px, 1fr)); }
body.handset .enemy-vital { grid-template-columns: 1fr; gap: 1px; padding: 4px 5px; font-size: 10px; }
body.handset .enemy-vital > span { text-align: left; }
body.handset .battle-heading, body.handset .action-caption { padding-right: 0; }
body.handset .action-context { font-size: 11px; line-height: 1.4; padding: 6px; margin-top: 5px; }
body.handset .area-target { font-size: 11px; grid-template-columns: minmax(70px, .7fr) minmax(0, 1.3fr); }
body.handset .battle-controls .commands.area-confirm { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
body.handset .battle-footnotes { grid-template-columns: 1fr; gap: 2px; }
body.handset .battle-log { grid-row: 1; }
body.handset .log-recent { font-size: 11px; }
body.handset .battle-intel summary { min-height: 44px; }
body.handset .rpg-menu .rpg-detail { font-size: 12px; }
body.handset .rpg-menu .cmd { min-height: 44px; }
body.handset .rpg-menu .rpg-tabs button { min-height: 44px; }

/* Menús desplazables en una sola superficie; respetan la zona del sistema. */
body.handset #modal-root { padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); align-items: center; overflow: hidden; }
body.handset .modal { width: min(940px, 100%); max-height: calc(100dvh - max(8px, env(safe-area-inset-top)) - max(8px, env(safe-area-inset-bottom))); padding: 16px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
body.handset .modal > .modal-actions { position: static; margin: 18px 0 0; padding: 12px 0 0; }
body.handset .modal .grid--roster, body.handset .modal .grid--shop { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
body.handset .modal .pick { padding: 10px; gap: 7px; }
body.handset .modal .pick .cmd { min-height: 44px; padding: 7px; }
body.handset .modal h2 { font-size: 24px; }
body.handset .pause-modal { padding: 0; height: calc(100dvh - max(8px, env(safe-area-inset-top)) - max(8px, env(safe-area-inset-bottom))); display: flex; flex-direction: column; }
body.handset .pause-header { flex: 0 0 auto; padding: 15px 16px 10px; }
body.handset .pause-meta { flex: 0 0 auto; padding: 0 16px 12px; }
body.handset .pause-tabs { flex: 0 0 auto; padding: 0 8px; }
body.handset .pause-pages { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
body.handset .pause-page { padding: 14px; }
body.handset .pause-footer { flex: 0 0 auto; padding: 9px 14px; }
body.handset .pause-roster { grid-template-columns: 1fr; }
body.handset .settings-columns { grid-template-columns: 1fr; }
body.handset .title-screen { padding: 18px; min-height: 100%; }
body.handset #app[data-scene="title"] #panel { flex: 1 1 auto; padding: 0; max-height: none; }
body.handset .title-content { padding: 30px 0 24px; }
body.handset .title-screen h1 { font-size: clamp(36px, 11vw, 54px); }
body.handset .title-lead { font-size: 15px; }
body.handset .title-play { min-height: 60px; }
body.handset .title-caption { font-size: 9px; letter-spacing: .09em; margin-top: 20px; }
body.handset .title-footer { gap: 12px; }
body.handset #toast-root { bottom: calc(12px + env(safe-area-inset-bottom)); max-width: calc(100vw - 24px); }

@media (orientation: landscape) {
  body.handset #app #hud { height: 44px; min-height: 44px; flex-basis: 44px; padding: 0 8px; }
  body.handset #app[data-scene="camp"] { grid-template-columns: minmax(0, 1fr) minmax(280px, 38%); grid-template-rows: 44px minmax(0, 1fr); }
  body.handset #app[data-scene="camp"] #hud { grid-column: 1 / -1; }
  body.handset #app[data-scene="camp"] #stage { grid-column: 1; grid-row: 2; }
  body.handset #app[data-scene="camp"] #panel { grid-column: 2; grid-row: 2; height: auto; max-height: none; border-top: 0; border-left: 1px solid #80697f; padding: 10px; }
  body.handset .camp-heading { align-items: start; }
  body.handset .camp-heading h2 { font-size: 18px; }
  body.handset .camp-crew { display: none; }
  body.handset .camp-commands { margin-top: 12px; }
  body.handset .camp-commands .cmd { min-height: 62px; }
  body.handset #app[data-scene="exploration"] { position: relative; grid-template-columns: minmax(0, 1fr); grid-template-rows: 44px minmax(0, 1fr); }
  body.handset #app[data-scene="exploration"] #hud { grid-column: 1; grid-row: 1; }
  body.handset #app[data-scene="exploration"] #stage { grid-column: 1; grid-row: 2; padding: 0; }
  body.handset #app[data-scene="exploration"] #panel {
    position: absolute; z-index: 4; top: 52px; right: 12px; width: min(300px, 44%);
    max-height: 86px; padding: 0; border: 0; border-radius: 4px; background: transparent;
  }
  body.handset #app[data-scene="exploration"] .exploration-panel > .preview { background: #22152be8; border-color: #d4bdcf; padding: 7px 10px; box-shadow: 0 2px 10px #0005; }
  body.handset #app[data-scene="exploration"] #touch:not([hidden]) { display: contents; }
  body.handset #app[data-scene="exploration"] #dpad { position: absolute; z-index: 5; left: 12px; bottom: 12px; margin: 0; }
  body.handset #app[data-scene="exploration"] .dpad-btn { background: #302138df; border-color: #d0b7d3; box-shadow: 0 2px 8px #0005; }
  body.handset #app[data-scene="exploration"] .dpad-btn:active { background: #eaded8ef; color: #30182d; }
  body.handset #app[data-scene="exploration"] #touch-actions { position: absolute; z-index: 5; right: 12px; bottom: 12px; width: 160px; padding: 0; }
  body.handset #app[data-scene="exploration"] #touch-actions .touch-btn { background: #302138df; border-color: #d0b7d3; box-shadow: 0 2px 8px #0005; }
  body.handset #app[data-scene="exploration"] #touch-actions .touch-btn--main { background: #ede2daed; border-color: #ede2da; }
  body.handset #app[data-scene="exploration"] #touch-actions .touch-btn:disabled { background: #302138df; color: #d3c1d7; border-color: #ad91b1; opacity: .86; }
  body.handset #app[data-scene="battle"] { grid-template-columns: minmax(0, 1fr) minmax(338px, 45%); grid-template-rows: 44px minmax(0, 1fr); }
  body.handset #app[data-scene="battle"] #hud { grid-column: 1 / -1; grid-row: 1; }
  body.handset #app[data-scene="battle"] #stage { grid-column: 1; grid-row: 2; height: auto; max-height: none; }
  body.handset #app[data-scene="battle"] #panel,
  body.handset #app[data-scene="battle"] #panel[data-signature="true"] { grid-column: 2; grid-row: 2; height: auto; max-height: none; padding: 4px 5px 8px; border-top: 0; border-left: 2px solid #a18ba4; }
  body.handset .battle-controls { gap: 4px; }
  body.handset .party-heading { padding-bottom: 3px; }
  body.handset .battle-controls .card { min-height: 66px; padding: 3px 4px; gap: 2px 4px; }
  body.handset .battle-controls .cmd { min-height: 44px; padding: 4px 6px; }
  body.handset .action-workspace, body.handset .party-panel { padding: 4px 6px; }
  body.handset .battle-controls .commands { gap: 3px; }
  body.handset .pause-header { padding: 10px 16px 7px; }
  body.handset .pause-header .menu-eyebrow { display: none; }
  body.handset .pause-meta { padding-bottom: 7px; }
  body.handset .pause-tabs button { min-height: 44px; padding: 8px 16px; }
  body.handset .pause-footer { padding: 6px 14px; }
  body.handset .modal .grid--roster, body.handset .modal .grid--shop, body.handset .pause-roster { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  body.handset .settings-columns { grid-template-columns: 1fr 1fr; }
  body.handset .title-screen { padding: 16px 24px; }
  body.handset .title-content { padding: 20px 0; }
  body.handset .title-screen h1 { font-size: 42px; }
}

@media (orientation: portrait) and (max-height: 700px) {
  body.handset #app[data-scene="battle"] { grid-template-rows: 48px calc((100vw - 10px) * .434 + 8px) minmax(0, 1fr); }
  body.handset .battle-controls .card { min-height: 66px; padding: 3px 5px; gap: 2px 4px; }
  body.handset .battle-controls .cmd { min-height: 44px; padding: 4px 6px; }
  body.handset .party-heading { padding-bottom: 3px; }
  body.handset .title-content { padding-top: 22px; }
}
