/* Portrait sizing and the focused mini-game stage on short screens. */
.pq-app.pq-portrait162 {
  --pq-font:15px;
  --pq-mobile-label162:13px;
  --pq-mobile-heading162:20px;
  --pq-mobile-gap162:8px;
  --pq-mobile-pad162:12px;
  --pq-touch162:44px;
  width:100%; max-width:none; margin:0;
  font-size:var(--pq-font); line-height:1.4;
}
.pq-app.pq-portrait162 .pq-shell { border:0; border-radius:0; }
.pq-app.pq-portrait162:has(.pq-welcome[hidden]) { width:100%; max-width:none; margin:0; }
.pq-app.pq-portrait162 :is(button,input,select,textarea) { -webkit-tap-highlight-color:transparent; }
.pq-app.pq-portrait162 :is(input,select,textarea) { font-size:16px !important; }
.pq-app.pq-portrait162 :is(.pq-button,.gr-button) {
  min-height:var(--pq-touch162); min-width:var(--pq-touch162);
  padding:9px 12px; gap:8px; font-size:15px; line-height:1.3;
}
.pq-app.pq-portrait162 .pq-button>svg { width:22px; height:22px; flex-basis:22px; }
.pq-app.pq-portrait162 :is(button,a,input,select,textarea,summary):focus-visible { outline-width:2px; outline-offset:2px; }

/* A real touch target with a centred glyph, independent of SVG dimensions. */
.pq-app.pq-portrait162 .pq-header,
.pq-app.pq-layout146.pq-portrait162:has(.pq-welcome[hidden]) .pq-header {
  min-height:56px; height:auto; padding:6px 8px; padding-top:max(6px,env(safe-area-inset-top)); gap:0;
}
.pq-app.pq-portrait162 .pq-brand { display:none; }
.pq-app.pq-portrait162 .pq-header__tools,
.pq-app.pq-layout146.pq-portrait162:has(.pq-welcome[hidden]) .pq-header__tools {
  display:flex; flex-wrap:wrap; justify-content:space-evenly; align-items:center;
  width:100%; min-width:0; gap:2px;
}
.pq-app.pq-portrait162 .pq-header .pq-online { display:none; }
.pq-app.pq-portrait162 .pq-header .pq-tool,
.pq-app.pq-layout146.pq-portrait162:has(.pq-welcome[hidden]) .pq-header .pq-tool {
  position:relative; display:grid; place-items:center; flex:0 0 44px;
  width:44px; height:44px; min-width:44px; min-height:44px;
  padding:0; margin:0; line-height:1; border-width:1px; border-radius:50%;
}
.pq-app.pq-portrait162 .pq-header .pq-tool>svg { display:block; width:24px; height:24px; margin:0; flex:none; }
.pq-app.pq-portrait162 .pq-header .pq-live-count { --pq-badge-size:18px; top:-2px; right:-2px; font-size:11px; }

.pq-app.pq-layout146.pq-portrait162:has(.pq-welcome[hidden]) .pq-stage,
.pq-app.pq-layout146.pq-portrait162:has(.pq-welcome[hidden]) .pq-stage:has(.pq-panel[hidden]) {
  padding:8px; padding-bottom:max(8px,env(safe-area-inset-bottom)); gap:8px;
  grid-template-rows:auto minmax(0,1fr) auto;
}
.pq-app.pq-layout146.pq-portrait162:has(.pq-welcome[hidden]) .pq-hud {
  min-height:44px; padding:0 4px; gap:4px; border-radius:10px;
}
.pq-app.pq-layout146.pq-portrait162:has(.pq-welcome[hidden]) .pq-hud>.pq-resource {
  min-height:44px; padding:0 2px; min-width:0;
}
.pq-app.pq-layout146.pq-portrait162:has(.pq-welcome[hidden]) .pq-resource>span { gap:4px; min-width:0; }
.pq-app.pq-layout146.pq-portrait162:has(.pq-welcome[hidden]) .pq-resource>span>svg { width:17px; height:17px; }
.pq-app.pq-layout146.pq-portrait162:has(.pq-welcome[hidden]) .pq-resource b { font-size:16px; line-height:1.2; }
.pq-app.pq-layout146.pq-portrait162:has(.pq-welcome[hidden]) .pq-resource small {
  display:block; position:absolute; width:1px; height:1px; margin:-1px; padding:0;
  overflow:hidden; clip-path:inset(50%); white-space:nowrap; border:0;
}
.pq-app.pq-layout146.pq-portrait162:has(.pq-welcome[hidden]) .pq-scene { min-height:0; border-radius:12px; }
.pq-app.pq-layout146.pq-portrait162:has(.pq-welcome[hidden]) .pq-dock { grid-template-columns:minmax(0,1fr) auto; gap:6px; }
.pq-app.pq-layout146.pq-portrait162:has(.pq-welcome[hidden]) .pq-dock__ship {
  grid-column:1/-1; grid-row:1; min-height:72px; padding:7px 10px; border-radius:10px;
}
.pq-app.pq-layout146.pq-portrait162:has(.pq-welcome[hidden]) .pq-command-heading155 {
  display:flex; flex-wrap:wrap; align-items:baseline; gap:2px 8px; min-width:0;
}
.pq-app.pq-layout146.pq-portrait162:has(.pq-welcome[hidden]) .pq-dock__ship [data-command-name] {
  display:block; min-width:0; max-width:100%; margin:0; font-size:16px; line-height:1.2;
}
.pq-app.pq-layout146.pq-portrait162:has(.pq-welcome[hidden]) .pq-own-tierline {
  display:block; max-width:100%; margin:0; font-size:12px; line-height:1.3; color:#b6d1c8;
}
.pq-app.pq-layout146.pq-portrait162:has(.pq-welcome[hidden]) .pq-ship-readouts { grid-template-columns:minmax(0,.7fr) minmax(0,1fr); gap:8px; margin-top:6px; }
.pq-app.pq-layout146.pq-portrait162:has(.pq-welcome[hidden]) .pq-own-attackline,
.pq-app.pq-layout146.pq-portrait162:has(.pq-welcome[hidden]) .pq-dock__ship .pq-hull__label { font-size:15px; line-height:1.2; }
.pq-app.pq-layout146.pq-portrait162:has(.pq-welcome[hidden]) .pq-hull__label { margin-bottom:4px; }
.pq-app.pq-layout146.pq-portrait162:has(.pq-welcome[hidden]) .pq-meter { height:5px; }
.pq-app.pq-layout146.pq-portrait162:has(.pq-welcome[hidden]) .pq-course { grid-column:1; grid-row:2; gap:6px; }
.pq-app.pq-layout146.pq-portrait162:has(.pq-welcome[hidden]) .pq-course button { width:44px; height:44px; min-height:44px; font-size:26px; }
.pq-app.pq-layout146.pq-portrait162:has(.pq-welcome[hidden]) .pq-dock__actions { grid-column:2; grid-row:2; min-width:0; }
.pq-app.pq-layout146.pq-portrait162:has(.pq-welcome[hidden]) .pq-stop { min-width:64px; min-height:44px; height:44px; font-size:15px; padding:6px 10px; }

/* Compact arrival information still has a full-size click target. */
.pq-app.pq-portrait162 .pq-interact { min-height:44px; padding:6px 8px; gap:3px; border-width:1px; border-radius:10px; font-size:14px; line-height:1.25; }
.pq-app.pq-portrait162 .pq-interact strong { font-size:15px; line-height:1.25; }
.pq-app.pq-portrait162 .pq-interact .pq-object-meta,
.pq-app.pq-portrait162 .pq-interact .pq-object-secondary { font-size:12px; line-height:1.3; }
.pq-app.pq-portrait162 .pq-interact .pq-capability-icon { width:17px; height:17px; }
.pq-app.pq-portrait162 .pq-interact .pq-capability-icon>svg { width:17px; height:17px; }
.pq-app.pq-portrait162 .pq-peer-badge { min-height:44px; padding:6px 8px; border-radius:9px; font-size:13px; }
.pq-app.pq-layout146.pq-portrait162:has(.pq-welcome[hidden]) .pq-scene>.pq-panel {
  width:calc(100% - 16px); max-width:calc(100% - 16px); max-height:calc(100% - 16px);
  left:8px; right:8px; bottom:8px; top:auto; padding:12px; border-radius:12px; font-size:15px;
}
.pq-app.pq-layout146.pq-portrait162:has(.pq-welcome[hidden]) .pq-scene>.pq-panel>h2 { margin:0 0 8px; font-size:20px; line-height:1.2; }
.pq-app.pq-portrait162 .pq-panel :is(p,.pq-panel__foot) { margin:0 0 10px; font-size:14px; line-height:1.4; }
.pq-app.pq-portrait162 .pq-panel__eyebrow { margin-bottom:6px; gap:6px; font-size:12px; }
.pq-app.pq-portrait162 .pq-panel__actions { gap:6px; }
.pq-app.pq-portrait162 .pq-panel .pq-button { min-height:44px; padding:8px; font-size:15px; }
.pq-app.pq-portrait162:has(.pq-welcome[hidden]) .pq-scene>.pq-panel :is(.pq-panel__actions,.pq-island-depart) .pq-button { height:auto; min-height:44px; padding:8px; }
.pq-app.pq-portrait162 .pq-panel__stats { margin:0 0 8px; gap:4px 12px; font-size:14px; }
.pq-app.pq-portrait162 .pq-opponent-mark { display:none; }
.pq-app.pq-portrait162 .pq-battle-clock { padding:6px 0; font-size:14px; }
.pq-app.pq-portrait162 .pq-battle-clock b { font-size:16px; }
.pq-app.pq-portrait162 .pq-battle-actions { bottom:-12px; padding-top:8px; gap:6px; }
.pq-app.pq-portrait162 .pq-opponent-hull>span { margin-bottom:4px; font-size:14px; }

/* The same full-screen dialog shell is shared by every phone screen. */
.pq-app.pq-portrait162 .gr-screen-dialog { height:min(100dvh,var(--pq-visible-height146,100dvh)); max-height:100dvh; font-size:15px; line-height:1.4; }
.pq-app.pq-portrait162 .gr-screen-dialog>.gr-dialog__head { align-items:center; gap:8px; padding:8px 12px; padding-top:max(8px,env(safe-area-inset-top)); min-height:60px; }
.pq-app.pq-portrait162 .gr-screen-dialog>.gr-dialog__head h2 { font-size:20px; line-height:1.2; margin:0; }
.pq-app.pq-portrait162 .gr-screen-dialog>.gr-dialog__head .gr-icon-button { display:grid; place-items:center; align-self:center; width:44px; height:44px; min-width:44px; min-height:44px; max-height:44px; flex:0 0 44px; padding:0; }
.pq-app.pq-portrait162 .gr-screen-dialog>.gr-dialog__head .gr-icon-button>svg { display:block; width:24px; height:24px; margin:0; }
.pq-app.pq-portrait162 .gr-screen-dialog>.gr-dialog__body { padding:12px; padding-bottom:max(12px,env(safe-area-inset-bottom)); font-size:15px; }
.pq-app.pq-portrait162 .gr-screen-dialog>.gr-dialog__body h3 { font-size:18px; line-height:1.3; }
.pq-app.pq-portrait162 .gr-screen-dialog>.gr-dialog__body h4 { font-size:16px; line-height:1.3; }
.pq-app.pq-portrait162 .gr-screen-dialog>.gr-dialog__body.gr-scroll-needed { padding-right:36px; }
.pq-app.pq-portrait162 .pq-screen-actions { gap:8px; margin-top:12px; }
.pq-app.pq-portrait162 .pq-screen-actions>.pq-button { min-width:0; flex:1 1 auto; }
.pq-app.pq-portrait162 .pq-harbour-dialog .pq-service-groups h2 { font-size:18px; }
.pq-app.pq-portrait162 .pq-ship-identity>strong { font-size:20px; line-height:1.3; }
.pq-app.pq-portrait162 .pq-stat-link { display:inline-flex; align-items:center; justify-content:center; min-width:44px; min-height:44px; height:auto; padding:6px 10px; }
.pq-app.pq-portrait162 .pq-service-row { padding:12px 0; gap:8px; }
.pq-app.pq-portrait162 .pq-service-controls>[data-service-submit] { font-size:15px !important; }
.pq-app.pq-portrait162 .pq-service-controls .pq-button { min-height:44px; }
.pq-app.pq-portrait162 .pq-atlas-dialog>.gr-dialog__body.gr-scroll-viewport { padding:8px; }
.pq-app.pq-portrait162 .pq-atlas-dialog .pq-atlas-detail strong { font-size:18px; }
.pq-app.pq-portrait162 .pq-atlas-dialog .pq-atlas-detail { padding:12px; gap:8px; }
.pq-app.pq-portrait162 .pq-atlas-dialog .pq-atlas-detail p { font-size:14px; line-height:1.4; }
.pq-app.pq-portrait162 .pq-atlas-dialog .pq-atlas-count { font-size:12px; }
.pq-app.pq-portrait162 .pq-atlas-dialog .pq-atlas-tools .pq-button { width:44px; min-width:44px; min-height:44px; height:44px; padding:0; }
.pq-app.pq-portrait162 .pq-atlas-dialog .pq-atlas-actions .pq-button { font-size:15px; min-height:44px; }
.pq-app.pq-portrait162 .pq-atlas-dialog .pq-atlas-layout { display:flex; flex-direction:column; gap:8px; }
.pq-app.pq-portrait162 .pq-atlas-dialog .pq-atlas-topbar { display:flex; flex:0 0 auto; }
.pq-app.pq-portrait162 .pq-atlas-dialog .pq-atlas-progress { flex:1 1 140px; grid-template-rows:auto 5px; gap:3px; }
.pq-app.pq-portrait162 .pq-atlas-dialog .pq-atlas-content { position:relative; display:flex; flex-direction:column; flex:1 1 0; gap:8px; }
.pq-app.pq-portrait162 .pq-atlas-dialog .pq-atlas-main { display:block; flex:1 1 0; min-height:150px; }
.pq-app.pq-portrait162 .pq-atlas-dialog .pq-atlas-bottom { flex:0 1 auto; height:auto; max-height:50%; gap:8px; }
.pq-app.pq-portrait162 .pq-atlas-dialog .pq-atlas-bottom .pq-atlas-back { align-self:flex-end; min-height:44px; }
.pq-app.pq-portrait162 .pq-atlas-dialog .pq-atlas-detail { flex:1 1 auto; min-height:0; }
.pq-app.pq-portrait162 .pq-atlas-dialog .pq-atlas-actions { flex:0 0 auto; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
.pq-app.pq-portrait162 .pq-atlas-dialog .pq-atlas-main:has(>.pq-atlas-legend158:not([hidden])) { position:static; overflow:visible; }
.pq-app.pq-portrait162 .pq-atlas-dialog .pq-atlas-legend158 { inset:0; width:100%; height:100%; max-height:none; }
.pq-app.pq-portrait162 .pq-atlas-dialog .pq-atlas-legend-head158 .pq-button { width:44px; height:44px; min-width:44px; min-height:44px; padding:0; }
.pq-app.pq-portrait162 .pq-atlas-dialog .pq-atlas-legend-body158 b { font-size:15px; }
.pq-app.pq-portrait162 .pq-atlas-dialog .pq-atlas-legend-body158 small { font-size:13px; }
.pq-app.pq-portrait162 .pq-quest-npc150 { gap:10px; margin-bottom:12px; }
.pq-app.pq-portrait162 .pq-quest-npc150>.pq-npc-portrait150 { width:56px; height:56px; }
.pq-app.pq-portrait162 .pq-quest-npc150>span { font-size:15px; }
.pq-app.pq-portrait162 .pq-chat-bubble { padding:10px 12px; margin:0 0 10px; font-size:15px; line-height:1.4; }
.pq-app.pq-portrait162 .pq-chat-bubble :is(p,small,span,strong) { font-size:inherit; line-height:inherit; }
.pq-app.pq-portrait162 .pq-quest-find-art150 { width:140px; height:130px; }
.pq-app.pq-portrait162 .pq-quest-find-art150>svg { width:128px; height:128px; }
.pq-app.pq-portrait162 .pq-quest-find150>h3 { font-size:24px; }
.pq-app.pq-portrait162 .pq-quest-card150 { padding:12px; margin:10px 0; }
.pq-app.pq-portrait162 .pq-quest-card-head150 h3 { font-size:17px; }

.pq-app.pq-portrait162 .pq-outcome { border-radius:12px; }
.pq-app.pq-portrait162 .pq-outcome-head { padding:10px 12px; gap:8px; }
.pq-app.pq-portrait162 .pq-outcome-head h2 { font-size:18px; line-height:1.25; }
.pq-app.pq-portrait162 .pq-outcome-head .pq-button { min-height:44px; padding:7px 12px; }
.pq-app.pq-portrait162 .pq-outcome-body { font-size:14px; }
.pq-app.pq-portrait162 .pq-outcome--exploration150 .pq-outcome-stat { min-height:38px; padding:6px 0; grid-template-columns:24px minmax(0,1fr) auto; gap:8px; }
.pq-app.pq-portrait162 .pq-outcome--exploration150 .pq-outcome-stat>span:not(.pq-stat-icon) { font-size:14px; }
.pq-app.pq-portrait162 .pq-outcome--exploration150 .pq-outcome-stat>strong { font-size:18px; }
.pq-app.pq-portrait162 .pq-outcome-stat svg { width:24px; height:24px; }
.pq-app.pq-portrait162 .pq-result-art150,
.pq-app.pq-portrait162 .pq-result-art150 canvas { min-height:100px; height:clamp(100px,20vh,170px); max-height:170px; }
.pq-app.pq-portrait162 .pq-result-copy150 { padding:10px 12px; }
.pq-app.pq-portrait162 .pq-result-salvage150>p { margin-left:32px; font-size:13px; }
.pq-app.pq-portrait162 .gr-notice { padding:9px 12px; gap:8px; font-size:14px; line-height:1.35; }
.pq-app.pq-portrait162 .gr-notice__icon svg { width:24px; height:24px; }
.pq-app.pq-portrait162 .pq-presentation-note { font-size:14px; padding:8px 10px; }
.pq-app.pq-portrait162 .pq-toast { padding:10px 12px; gap:8px; font-size:14px; line-height:1.35; }

.pq-app.pq-portrait162 .pq-welcome { padding:18px; }
.pq-app.pq-portrait162 .pq-welcome h1 { font-size:clamp(30px,9vw,42px); line-height:1.08; margin:12px 0; }
.pq-app.pq-portrait162 .pq-welcome p { margin-bottom:14px; font-size:15px; line-height:1.45; }
.pq-app.pq-portrait162 .pq-welcome__actions { gap:8px; }
.pq-app.pq-portrait162 .pq-welcome__note { font-size:12px; line-height:1.35; margin-top:16px; }

/* A mini-game already owns Help, Pause and Return. Share its stage budget
   across portrait phones and short landscape windows without per-device sizing. */
@media (max-width:600px) and (orientation:portrait), (max-height:500px) and (orientation:landscape) {
  .pq-app.pq-layout146:has(.pq-act160) .pq-header,
  .pq-app.pq-layout146:has(.pq-act160) .pq-hud,
  .pq-app.pq-layout146:has(.pq-act160) .pq-dock { display:none !important; }
  .pq-app.pq-layout146:has(.pq-welcome[hidden]):has(.pq-act160) .pq-stage,
  .pq-app.pq-layout146:has(.pq-welcome[hidden]):has(.pq-act160) .pq-stage:has(.pq-panel[hidden]) {
    grid-template-rows:minmax(0,1fr); grid-template-areas:"scene";
    padding-top:max(8px,env(safe-area-inset-top));
  }
}

/* Focused encounters retain the global toolbar and use one stage budget. */
.pq-app.pq-layout146.pq-portrait162:has(.pq-mystic160,.pq-enc150--duel,.pq-enc150--duel-result,.pq-tavern:not([hidden])) .pq-hud,
.pq-app.pq-layout146.pq-portrait162:has(.pq-mystic160,.pq-enc150--duel,.pq-enc150--duel-result,.pq-tavern:not([hidden])) .pq-dock { display:none !important; }
.pq-app.pq-layout146.pq-portrait162:has(.pq-welcome[hidden]):has(.pq-mystic160,.pq-enc150--duel,.pq-enc150--duel-result,.pq-tavern:not([hidden])) .pq-stage,
.pq-app.pq-layout146.pq-portrait162:has(.pq-welcome[hidden]):has(.pq-mystic160,.pq-enc150--duel,.pq-enc150--duel-result,.pq-tavern:not([hidden])) .pq-stage:has(.pq-panel[hidden]) {
  grid-template-rows:minmax(0,1fr); grid-template-areas:"scene";
}
.pq-app.pq-portrait162 .pq-mystic160__head { padding:8px 10px; gap:8px; }
.pq-app.pq-portrait162 .pq-mystic160__head h2 { font-size:18px; }
.pq-app.pq-portrait162 .pq-mystic160__head .pq-button { min-height:44px; font-size:14px; padding:8px; }
.pq-app.pq-portrait162 .pq-mystic160__head .pq-button span { max-width:none; }
.pq-app.pq-portrait162 .pq-mystic160 .pq-mystic160__embedded-chat .pq-chat-bubble { font-size:14px; }
.pq-app.pq-portrait162 .pq-mystic160 .pq-mystic160__embedded-chat .pq-chat-replies .pq-button,
.pq-app.pq-portrait162 .pq-mystic160 .pq-mystic160__embedded-chat .pq-chat-options154>.pq-button {
  min-height:44px; font-size:14px; line-height:1.35; padding:8px;
}

/* Scene-owned navigation has no dormant footer or reserved footer grid row. */
.pq-app.pq-navigation-unavailable .pq-dock { display:none !important; }
.pq-app.pq-layout146.pq-navigation-unavailable:has(.pq-welcome[hidden]) .pq-stage,
.pq-app.pq-layout146.pq-navigation-unavailable:has(.pq-welcome[hidden]) .pq-stage:has(.pq-panel[hidden]) {
  grid-template-rows:auto minmax(0,1fr); grid-template-areas:"hud" "scene";
}
.pq-app.pq-layout146.pq-portrait162.pq-navigation-unavailable:has(.pq-welcome[hidden]):has(.pq-mystic160,.pq-enc150--duel,.pq-enc150--duel-result,.pq-tavern:not([hidden])) .pq-stage,
.pq-app.pq-layout146.pq-portrait162.pq-navigation-unavailable:has(.pq-welcome[hidden]):has(.pq-mystic160,.pq-enc150--duel,.pq-enc150--duel-result,.pq-tavern:not([hidden])) .pq-stage:has(.pq-panel[hidden]) {
  grid-template-rows:minmax(0,1fr); grid-template-areas:"scene";
}
@media (max-width:600px) and (orientation:portrait), (max-height:500px) and (orientation:landscape) {
  .pq-app.pq-layout146.pq-navigation-unavailable:has(.pq-welcome[hidden]):has(.pq-act160) .pq-stage,
  .pq-app.pq-layout146.pq-navigation-unavailable:has(.pq-welcome[hidden]):has(.pq-act160) .pq-stage:has(.pq-panel[hidden]) {
    grid-template-rows:minmax(0,1fr); grid-template-areas:"scene";
  }
}

@media (min-width:500px) {
  .pq-app.pq-layout146.pq-navigation-unavailable.pq-in-battle.pq-layout-low146:has(.pq-welcome[hidden]) .pq-stage {
    grid-template-rows:minmax(0,1fr); grid-template-areas:"scene";
  }
}
@media (min-width:480px) and (max-width:800px) and (max-height:300px) and (orientation:landscape) {
  .pq-app.pq-layout146.pq-navigation-unavailable:has(.pq-welcome[hidden]):has(.pq-outcome:not([hidden])) .pq-stage,
  .pq-app.pq-layout146.pq-navigation-unavailable:has(.pq-welcome[hidden]):has(.pq-outcome:not([hidden])) .pq-stage:has(.pq-panel[hidden]) {
    grid-template-rows:minmax(0,1fr); grid-template-areas:"scene";
  }
}
