.mobile-tools, #menu-shade, #touch { display: none }
.handheld .desktop-only { display: none }
.handheld body {
  --edge-l: max(14px, env(safe-area-inset-left)); --edge-r: max(14px, env(safe-area-inset-right));
  --edge-t: max(8px, env(safe-area-inset-top)); --edge-b: max(10px, env(safe-area-inset-bottom));
  --lime: #e7fb4c; overflow: hidden; overscroll-behavior: none; background: #152321;
}
.handheld main { width: 100%; height: 100vh; height: 100dvh; margin: 0; padding: 0; display: grid }
.handheld header, .handheld .bar, .handheld aside, .handheld #instructions { display: none }
.handheld .layout { display: contents }
.handheld .monitor { display: grid; place-items: center; border: 0; border-radius: 0; background: #152321 }
.handheld #display { width: min(100vw, calc(100dvh * 256 / 240)); min-width: 0; margin: 0 }
.handheld .field-view #display { width: 100%; height: 100%; aspect-ratio: auto; overflow: hidden }
.handheld .field-view #display #world { width: 100%; height: 100% }

.handheld button { touch-action: manipulation; -webkit-tap-highlight-color: transparent }
.handheld .mobile-tools { display: block }
.handheld #touch, .handheld #mobile-hud { position: fixed; inset: 0; margin: 0; pointer-events: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none }
.handheld .running #touch { display: block; z-index: 2 }
.handheld #mobile-hud { z-index: 3 }
.handheld #touch button, .handheld #stick-zone, .handheld #mobile-hud button { pointer-events: auto }
.handheld #menu { position: absolute; top: var(--edge-t); right: var(--edge-r); width: 44px; height: 44px; padding: 0; border: 1px solid #d9e7c483; border-radius: 50%; background: #142e28dc; color: #f4f8df; font-size: 21px }
#vitals { display: none }
.field-view.running #vitals { display: block; position: absolute; left: var(--edge-l); top: var(--edge-t); width: clamp(185px,27vw,256px); max-width: calc(100% - 86px); border: 1px solid #e5edc885; border-radius: 6px; background: #102821; image-rendering: pixelated }
.handheld body:not(.running):not(.choosing) #mobile-hud { background: linear-gradient(90deg,#081d1be8,#102b24a8 28%,transparent 80%) }
#fight-cover { position: absolute; left: max(6.5vw,var(--edge-l)); top: 48%; right: var(--edge-r); transform: translateY(-50%) }
#fight-cover h2 { font: 1000 clamp(62px,min(11vw,17vh),150px)/.98 "Microsoft YaHei",sans-serif; letter-spacing: -.07em; transform: skew(-8deg); margin: 0 0 22px; color: #fff9eb; text-shadow: 3px 4px 0 #153d38 }
#fight-cover h2 span { color: var(--lime) }
.cover-actions { display: flex; flex-wrap: wrap; gap: 9px }
.cover-actions button { min-height: 44px; padding: 0 17px; border-radius: 3px; color: #fff9eb; border: 1px solid #a8bcb1; background: #163332e8; font-weight: 800 }
.cover-actions #mobile-play { background: var(--lime); color: #172c23; border-color: var(--lime) }
.running #fight-cover, .choosing #fight-cover { display: none }
.handheld #stick-zone { position: absolute; left: 0; bottom: 0; width: 50%; height: 50%; touch-action: none }
#stick { --size: clamp(106px,26vmin,142px); position: absolute; left: var(--edge-l); bottom: var(--edge-b); width: var(--size); height: var(--size); pointer-events: none; opacity: .72; display: grid; place-items: center; border: 2px solid #f1f6dba8; border-radius: 50%; background: radial-gradient(circle,#47664c77 0 48%,#18383099 49% 68%,#deeabc66 69% 70%,#183830ad 71%); box-shadow: 0 3px 10px #071b1c3d }
#stick.engaged { opacity: 1 }
#stick span { position: absolute; inset: 0; text-align: center; padding-top: 4px }
#stick span, #stick::after { font: 11px sans-serif; color: #e8efd4 }
#stick span::before, #stick span::after, #stick::after { position: absolute }
#stick span::before { content: '◀'; left: 4px; top: 45% }
#stick span::after { content: '▶'; right: 4px; top: 45% }
#stick::after { content: '▼'; bottom: 3px }
#stick i { width: 42%; height: 42%; border: 2px solid #f0f4dcbf; border-radius: 50%; background: radial-gradient(circle at 40% 28%,#899980,#506a55 72%); box-shadow: 0 3px 8px #0d241f66 }
#attacks { --key: clamp(48px,13vmin,64px); position: absolute; right: var(--edge-r); bottom: var(--edge-b); width: min(calc(50% - var(--edge-r)),calc(var(--key)*3.22)); height: calc(var(--key)*2.65) }
#attacks button { position: absolute; display: grid; place-items: center; padding: 0; width: var(--key); height: var(--key); border: 2px solid #eaf0d39e; border-radius: 50%; font-size: 16px; font-weight: 800; line-height: 1; background: #1b3934d9; color: #fffce9; box-shadow: inset 0 -4px 0 #061d242f,0 2px 7px #122b245c; touch-action: none }
#attacks .jump { left: 16%; top: 0 } #attacks .kick { left: 0; bottom: 0 }
#attacks .punch { right: 0; bottom: 13%; width: calc(var(--key)*1.22); height: calc(var(--key)*1.22); background: #d9ef6bee; border-color: #f5ffc8; color: #193122 }
#attacks button.pressed, #system-keys .pressed { background: #fcffb9; color: #1b3520; border-color: white; transform: scale(.94) }
#system-keys { position: absolute; top: var(--edge-t); left: var(--edge-l); display: none; gap: 6px }
#system-keys button { min-height: 44px; background: #142e28dc; border-radius: 22px; touch-action: none }
.handheld .native-screen #system-keys { display: flex }
.handheld .choosing #menu-shade { display: block; position: fixed; inset: 0; background: #081812b8; z-index: 4 }
.handheld .choosing aside { display: block; position: fixed; z-index: 5; left: 50%; top: 50%; transform: translate(-50%,-50%); width: min(355px,92vw); max-height: 90dvh; overflow: auto; overscroll-behavior: contain; background: #172b29; border: 1px solid #89a294; border-top: 4px solid #dcf551; border-radius: 3px; box-shadow: 0 15px 60px #1119; padding: 18px }
.menu-head { display: flex; align-items: center; justify-content: space-between; font-size: 21px; margin-bottom: 12px }
.menu-head button { background: transparent; border: 0; min-height: 44px; font-size: 14px }
.menu-options { display: grid; grid-template-columns: 1fr 1fr; gap: 9px }
.menu-options button, .handheld #title { min-height: 46px; padding: 8px; border: 1px solid #627c71; background: #234138; border-radius: 9px; font-weight: 700 }
#mobile-notice:empty, .handheld aside h2, .handheld aside #stages { display: none }
#touch-guide { font-size: 14px; color: #d3e2cf }
.handheld .picking aside h2 { display: block; font-size: 17px }
.handheld .picking aside #stages { display: grid; grid-template-columns: 1fr 1fr }
.handheld .picking aside .main-options, .handheld .picking aside #title, .handheld .picking aside [data-system] { display: none }
.handheld .stage img { height: 45px } .handheld .stage span { padding: 5px 8px }
@media (orientation:portrait) {
  .handheld .field-view .monitor { background: linear-gradient(#142823,#253e33 65%,#172b29) }
  #fight-cover h2 span { display: block }
}
