/* Mana Andhra: touch layout (phones and tablets in landscape). Loaded after ui.css; every rule is scoped to html.ma-touch / .ma-touchdev,
   so the desktop look is untouched. JS: game/src/ui/touch.js.
   --u is the thumb unit (about 54 px on a 390 px tall phone); every control is sized in it. --ts is the player's Button size setting. */

html.ma-touchdev, html.ma-touchdev body { overscroll-behavior: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
html.ma-touch, html.ma-touch body { touch-action: none; position: fixed; inset: 0; width: 100%; height: 100%; overflow: hidden; }
html.ma-touch canvas { touch-action: none; }
html.ma-touch .ma-ui input[type="text"], html.ma-touch .ma-ui textarea { -webkit-user-select: text; user-select: text; touch-action: manipulation; }
html.ma-touch .ma-ui .ma-pause__panel, html.ma-touch .ma-ui .ma-panel__body, html.ma-touch .ma-ui .ma-pause__rail, html.ma-touch .ma-ui [style*="overflow-y:auto"] { touch-action: pan-y; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }

.ma-ui { --ts: 1; }
html.ma-touch .ma-ui {
  --u: clamp(46px, calc(13.6vh * var(--ts, 1)), 78px);
  --sl: max(12px, env(safe-area-inset-left)); --sr: max(12px, env(safe-area-inset-right));
  --st: max(8px, env(safe-area-inset-top)); --sb: max(10px, env(safe-area-inset-bottom));
  --mm: 7.4em; /* minimap diameter */
  font-size: clamp(12.5px, 3.4vh, 20px);
}
.ma-ui [hidden] { display: none !important; }

/* ------------------------------------------------------------------ controls */
.ma-touch, .ma-touch__game, .ma-touch__sys { position: absolute; inset: 0; pointer-events: none; }
.ma-touch[hidden] { display: none !important; }
.ma-ui.in-menu .ma-touch__game, .ma-ui.has-overlay .ma-touch__game { display: none; }
.ma-tz { position: absolute; top: 0; bottom: 0; pointer-events: auto; touch-action: none; z-index: 1; }
.ma-tz--move { left: 0; width: 44%; }
.ma-tz--look { right: 0; width: 56%; }

/* joystick: the ring waits bottom-left, then appears wherever the left thumb lands */
.ma-stick { --w: calc(var(--u) * 2.7); position: absolute; left: calc(var(--sl) + var(--u) * 2.2); bottom: calc(var(--sb) + var(--u) * 1.9); width: var(--w); height: var(--w); margin: calc(var(--w) / -2); pointer-events: none; z-index: 2; opacity: .5; transition: opacity .12s; }
.ma-stick.is-on { opacity: 1; }
.ma-stick__base { position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(255,248,236,.5); background: radial-gradient(circle, rgba(255,248,236,.06), rgba(12,17,32,.34)); box-shadow: 0 0 0 1px rgba(0,0,0,.25), inset 0 0 1.4em rgba(0,0,0,.2); }
.ma-stick__base::before { content: ""; position: absolute; inset: 14%; border-radius: 50%; border: 1px dashed rgba(255,248,236,.28); }
.ma-stick__knob { position: absolute; left: 50%; top: 50%; width: calc(var(--u) * 1.15); height: calc(var(--u) * 1.15); margin: calc(var(--u) * -.575); border-radius: 50%; background: radial-gradient(circle at 35% 30%, rgba(255,248,236,.92), rgba(242,180,27,.8)); border: 2px solid rgba(255,248,236,.9); box-shadow: 0 .2em .6em rgba(0,0,0,.45); will-change: transform; }
.ma-stick.is-run .ma-stick__base { border-color: var(--turmeric); box-shadow: 0 0 1.2em rgba(242,180,27,.55); }
.ma-stick.is-run .ma-stick__knob { background: radial-gradient(circle at 35% 30%, #fff3c9, #f2b41b); }

/* buttons */
.ma-tb { --s: calc(var(--u) * .9); position: absolute; width: var(--s); height: var(--s); border-radius: 50%; display: grid; place-items: center; align-content: center; gap: 0; padding: 0; z-index: 3; pointer-events: auto; touch-action: none; cursor: pointer;
  color: var(--cream); background: rgba(12,17,32,.58); border: 2px solid rgba(255,248,236,.42); box-shadow: 0 .2em .7em rgba(0,0,0,.35); -webkit-tap-highlight-color: transparent; transition: transform .06s, background .1s; }
.ma-tb .ma-ico { width: 46%; height: 46%; stroke-width: 1.9; }
.ma-tb__l { font: 700 .62em/1 var(--display); letter-spacing: .04em; text-transform: uppercase; opacity: .9; margin-top: -.1em; pointer-events: none; }
.ma-tb.is-down { transform: scale(.92); background: rgba(242,180,27,.78); color: var(--night); border-color: #fff3c9; }
.ma-tb--a { --s: calc(var(--u) * 1.4); right: calc(var(--sr) + var(--u) * .3); bottom: calc(var(--sb) + var(--u) * .3); background: rgba(180,71,42,.72); }
.ma-tb--b { --s: calc(var(--u) * 1.15); right: calc(var(--sr) + var(--u) * 1.85); bottom: calc(var(--sb) + var(--u) * .3); }
.ma-tb--c { --s: calc(var(--u) * 1.1); right: calc(var(--sr) + var(--u) * .42); bottom: calc(var(--sb) + var(--u) * 1.85); }
.ma-tb--d { --s: max(44px, calc(var(--u) * .9)); right: calc(var(--sr) + var(--u) * 1.75); bottom: calc(var(--sb) + var(--u) * 1.7); }
.ma-tb--e { --s: max(44px, calc(var(--u) * .85)); right: calc(var(--sr) + var(--u) * 3.3); bottom: calc(var(--sb) + var(--u) * .35); }
.ma-touch__game.is-veh .ma-tb--foot, .ma-touch__game.is-foot .ma-tb--veh { display: none; }
.ma-touch__game:not(.has-enter) .ma-tb--foot.ma-tb--ctx { display: none; }
.ma-touch__game.has-enter .ma-tb--ctx { background: rgba(30,59,47,.85); border-color: var(--good); animation: ma-tb-pulse 1.2s ease-in-out infinite; }
.ma-tb--b.ma-tb--veh { background: rgba(30,59,47,.8); }
@keyframes ma-tb-pulse { 50% { box-shadow: 0 0 0 .5em rgba(127,209,168,.28), 0 .2em .7em rgba(0,0,0,.35); } }

/* top bar: pause, phone, map, full screen */
.ma-touch__bar { position: absolute; right: var(--sr); top: var(--st); display: flex; gap: calc(var(--u) * .16); pointer-events: none; z-index: 3; }
.ma-touch__bar .ma-tb--top { position: static; --s: max(44px, calc(var(--u) * .85)); }
.ma-tb--top .ma-tb__l { display: none; }
.ma-tb--top .ma-ico { width: 54%; height: 54%; }
.ma-touch__sys { z-index: 120; }
.ma-touch__sys .ma-tb--fs { position: absolute; right: var(--sr); top: var(--st); --s: max(44px, calc(var(--u) * .85)); }
.ma-ui:not(.in-menu) .ma-touch__sys .ma-tb--fs, .ma-ui.has-overlay .ma-touch__sys .ma-tb--fs { display: none; }
.ma-touch__sys .ma-tb--back { position: absolute; right: var(--sr); top: var(--st); width: auto; height: max(44px, calc(var(--u) * .85)); border-radius: 2em; padding: 0 1.1em 0 .6em; grid-auto-flow: column; gap: .3em; background: rgba(12,17,32,.85); }
.ma-touch__sys .ma-tb--back .ma-ico { width: 1.5em; height: 1.5em; }
.ma-touch__sys .ma-tb--back .ma-tb__l { font-size: .85em; opacity: 1; margin: 0; }

/* ------------------------------------------------------------------ HUD, rearranged for a small landscape screen */
html.ma-touch .ma-ui .ma-minimap { left: var(--sl); top: var(--st); bottom: auto; width: var(--mm); height: var(--mm); }
html.ma-touch .ma-ui .ma-minimap__open { display: none; }
html.ma-touch .ma-ui .ma-hud__bl { left: var(--sl); top: calc(var(--st) + var(--mm) + .9em); bottom: auto; width: 9.5em; }
html.ma-touch .ma-ui .ma-vitals { padding: .35em .55em; }
html.ma-touch .ma-ui .ma-meter { padding: .25em .5em; font-size: .85em; }
html.ma-touch .ma-ui .ma-hud__tl { left: calc(var(--sl) + var(--mm) + 1.3em); top: var(--st); width: min(18em, 26vw); }
html.ma-touch .ma-ui .ma-obj { padding: .4em .65em .5em; }
html.ma-touch .ma-ui .ma-obj__kick { margin-bottom: .25em; }
html.ma-touch .ma-ui .ma-obj__text { font-size: .95em; min-height: 0; -webkit-line-clamp: unset; }
html.ma-touch .ma-ui .ma-job { padding: .3em .6em .4em; }
html.ma-touch .ma-ui .ma-hud__tc { top: var(--st); }
html.ma-touch .ma-ui .ma-env { padding: .25em .7em; gap: .5em; }
html.ma-touch .ma-ui .ma-env__wx span { display: none; }
html.ma-touch .ma-ui .ma-hud__tr { right: var(--sr); top: calc(var(--st) + max(44px, var(--u) * .85) + .6em); width: 13em; gap: .3em; }
html.ma-touch .ma-ui .ma-money__v { font-size: 1.6em; }
html.ma-touch .ma-ui .ma-gola { padding: .35em .6em .4em; grid-template-areas: "stars lv"; }
html.ma-touch .ma-ui .ma-gola__tag { display: none; }
html.ma-touch:not([data-lang="te"]) .ma-ui .ma-gola__te { display: none; } /* ui12: in Telugu mode the Telugu name is the only name */
html.ma-touch .ma-ui .ma-gola__stars .ma-ico { width: 1.1em; height: 1.1em; }
html.ma-touch .ma-ui .ma-gola__name { font-size: .9em; }
html.ma-touch .ma-ui .ma-gola__what { font-size: .8em; }
html.ma-touch .ma-ui .ma-toasts { right: var(--sr); top: calc(var(--st) + max(44px, var(--u) * .85) + 8.6em); width: min(17em, 34vw); font-size: .88em; }
html.ma-touch .ma-ui .ma-toast:nth-last-child(n+3) { display: none; }
html.ma-touch .ma-ui .ma-hud__br { right: calc(var(--sr) + var(--u) * 4.4); bottom: var(--sb); width: 8em; }
html.ma-touch .ma-ui .ma-speed__v { font-size: 2.5em; }
html.ma-touch .ma-ui .ma-radio { display: none; }
html.ma-touch .ma-ui .ma-sub { bottom: var(--sb); width: min(30em, 38vw); font-size: .9em; padding: .4em .8em .5em; }
html.ma-touch .ma-ui .ma-prompt { bottom: 31vh; padding: .65em 1.4em .7em; font-size: 1.05em; }
html.ma-touch .ma-ui .ma-prompt.is-tap { pointer-events: auto; cursor: pointer; border-color: var(--good); background: rgba(30,59,47,.88); touch-action: none; }
html.ma-touch .ma-ui .ma-prompt.is-tap .ma-key { background: var(--good); color: var(--night); }
html.ma-touch .ma-ui .ma-banner__title { font-size: 2.8em; }
html.ma-touch .ma-ui .ma-banner--chapter .ma-banner__title { font-size: 3.4em; }
html.ma-touch .ma-ui .ma-fps { top: calc(var(--st) + var(--u) * .8 + .2em); right: calc(var(--sr) + .2em); }
html.ma-touch .ma-ui .ma-phone { right: var(--sr); bottom: var(--sb); height: calc(100% - var(--st) - var(--sb)); width: min(17.5em, 40vw); }

/* ------------------------------------------------------------------ menus */
html.ma-touch .ma-ui :where(button, .ma-btn, .ma-iconbtn, .ma-seg__b, .ma-chipbtn, .ma-menu__item) { min-height: 44px; touch-action: manipulation; }
html.ma-touch .ma-ui .ma-iconbtn { min-width: 44px; }
html.ma-touch .ma-ui .ma-minimap, html.ma-touch .ma-ui .ma-tb { min-height: 0; }
html.ma-touch .ma-ui .ma-title__left { left: var(--sl); width: min(36em, 62vw); }
html.ma-touch .ma-ui.has-overlay .ma-title__left { visibility: hidden; }
html.ma-touch .ma-ui .ma-title__shade { background: linear-gradient(90deg, rgba(10,14,28,.9) 0%, rgba(10,14,28,.7) 55%, rgba(10,14,28,.1) 100%); }
html.ma-touch .ma-ui .ma-logo--title .ma-logo__svg { width: min(17em, 34vw) !important; }
html.ma-touch .ma-ui .ma-title__tag { margin: .2em 0 .7em; font-size: .8em; }
html.ma-touch .ma-ui .ma-menu { grid-template-columns: 1fr 1fr; gap: .15em .8em; margin-left: -.5em; }
html.ma-touch .ma-ui .ma-menu__item { padding-top: .3em; padding-bottom: .3em; }
html.ma-touch .ma-ui .ma-menu__item .ma-menu__sub { display: none; }
html.ma-touch .ma-ui .ma-title__hint, html.ma-touch .ma-ui .ma-news, html.ma-touch .ma-ui .ma-title__foot { display: none; }
html.ma-touch .ma-ui .ma-load__center { top: 9%; }
html.ma-touch .ma-ui .ma-load .ma-logo__svg { width: min(18em, 36vw) !important; }
html.ma-touch .ma-ui .ma-load__bottom { bottom: max(4vh, var(--sb)); }
html.ma-touch .ma-ui .ma-load__meta { margin-bottom: 1.6em; }
html.ma-touch .ma-ui .ma-load__tip { margin-top: .8em; min-height: 2.4em; font-size: .95em; }

html.ma-touch .ma-ui .ma-pause__sheet { width: calc(100vw - var(--sl) - var(--sr)); height: calc(100vh - var(--st) - var(--sb)); max-width: 80em; grid-template-columns: 13.5em 1fr; }
html.ma-touch .ma-ui .ma-pause__left { padding: .8em .5em .6em; }
html.ma-touch .ma-ui .ma-pause__title { padding-bottom: .5em; }
html.ma-touch .ma-ui .ma-pause__title b { font-size: 1.5em; }
html.ma-touch .ma-ui .ma-menu__item--rail { padding: .3em .7em; }
html.ma-touch:not([data-lang="te"]) .ma-ui .ma-menu__item--rail .ma-menu__te { display: none; } /* ui12: Telugu mode shows nothing else, hiding it left the pause rail empty on phones */
html.ma-touch .ma-ui .ma-panel__head { padding: .7em 1.1em .5em; }
html.ma-touch .ma-ui .ma-set__row { grid-template-columns: minmax(0, 1fr) auto; gap: .3em 1em; align-items: center; }
html.ma-touch .ma-ui .ma-seg, html.ma-touch .ma-ui .ma-switch, html.ma-touch .ma-ui .ma-range__wrap { justify-self: end; }
html.ma-touch .ma-ui .ma-map__hint { display: none; }
html.ma-touch .ma-ui .ma-seg__b { padding-left: 1em; padding-right: 1em; }
html.ma-touch .ma-ui .ma-switch { min-width: 70px; min-height: 44px; border-radius: 1.6em; }
html.ma-touch .ma-ui .ma-range { height: 2.6em; touch-action: pan-y; }
html.ma-touch .ma-ui .ma-range::-webkit-slider-thumb { width: 2em; height: 2em; }
html.ma-touch .ma-ui .ma-range::-moz-range-thumb { width: 2em; height: 2em; }
html.ma-touch .ma-ui .ma-sheet__card { max-height: calc(100vh - var(--st) - var(--sb)); }
html.ma-touch .ma-ui .ma-sheet__card .ma-panel__body { overflow-y: auto; }
html.ma-touch .ma-ui .ma-confirm__btns { gap: .8em; }
html.ma-touch .ma-ui .ma-cheatbox__in { font-size: 16px; } /* 16 px stops iOS zooming into the field */

/* hero choice and the test quest picker use inline styles: tighten them by class */
html.ma-touch .ma-ui .ma-hero { padding: var(--st) var(--sr) var(--sb) var(--sl) !important; overflow-y: auto; }
html.ma-touch .ma-ui .ma-hero h2 { font-size: 22px !important; }
html.ma-touch .ma-ui .ma-hero p { margin: 0 0 8px !important; font-size: 14px !important; }
html.ma-touch .ma-ui .ma-hero__card { min-height: 0 !important; padding: 12px 16px !important; flex-basis: 240px !important; }
html.ma-touch .ma-ui .ma-hero__card small { font-size: 12px !important; line-height: 1.35 !important; }
html.ma-touch .ma-ui .ma-hero p:last-child, html.ma-touch .ma-ui .ma-questpick p:last-child { display: none; }
html.ma-touch .ma-ui .ma-questpick { padding: var(--st) calc(var(--sr) + 7em) var(--sb) var(--sl) !important; }
html.ma-touch .ma-ui .ma-questpick > div { max-height: calc(100vh - var(--st) - var(--sb)) !important; }
html.ma-touch .ma-ui .ma-questpick h2 { font-size: 20px !important; }
html.ma-touch .ma-ui .ma-questpick [role="option"] { min-height: 48px; padding: 8px 12px !important; }

/* map: bigger controls */
html.ma-touch .ma-ui .ma-map__frame { touch-action: none; }

/* ------------------------------------------------------------------ rotate screen */
.ma-rotate { display: none; position: fixed; inset: 0; z-index: 2000; place-items: center; text-align: center; background: radial-gradient(circle at 50% 35%, #1d2747, #0b0f1a 70%); color: var(--cream, #FFF8EC); pointer-events: auto; touch-action: none; padding: 24px; box-sizing: border-box; }
@media (orientation: portrait) { html.ma-touchdev .ma-rotate { display: grid; } }
.ma-rotate__card { display: grid; gap: 10px; justify-items: center; max-width: 320px; font-family: var(--body, system-ui); }
.ma-rotate__card b { font: 800 24px/1.15 var(--display, system-ui); }
.ma-rotate__card span[lang] { font: 600 17px/1.5 var(--display, system-ui); color: #F2B41B; }
.ma-rotate__card small { font-size: 14px; opacity: .75; }
.ma-rotate__fs { margin-top: 8px; min-height: 48px; padding: 0 28px; border-radius: 28px; border: 0; font: 700 16px var(--display, system-ui); background: #F2B41B; color: #10172A; }
.ma-rotate__ph { width: 120px; height: 120px; display: grid; place-items: center; }
.ma-rotate__ph i { display: block; width: 44px; height: 84px; border-radius: 10px; border: 4px solid #FFF8EC; position: relative; animation: ma-rot 2.6s ease-in-out infinite; }
.ma-rotate__ph i::after { content: ""; position: absolute; left: 50%; bottom: 6px; width: 14px; height: 3px; margin-left: -7px; border-radius: 2px; background: #FFF8EC; }
@keyframes ma-rot { 0%, 18% { transform: rotate(0); } 55%, 85% { transform: rotate(-90deg); } 100% { transform: rotate(0); } }
@media (prefers-reduced-motion: reduce) { .ma-rotate__ph i { animation: none; transform: rotate(-90deg); } .ma-tb { animation: none !important; } }

/* ---- ui12 (12 Nov 2026): thumb-button labels readable (10 px and up, Telugu too) over a bright sky */
.ma-tb { background: rgba(12,17,32,.78); }
.ma-tb--a { background: rgba(150,52,28,.88); }
.ma-tb__l { font-size: .72em; opacity: 1; }
html[data-lang="te"] .ma-tb__l { font-size: .78em; letter-spacing: 0; text-transform: none; line-height: 1.2; }

/* ---- ui12: a 44 px tall switch on touch screens; the visible track stays small, drawn by ::before */
html.ma-touch .ma-ui .ma-switch { width: 4.6em; height: 44px; min-width: 64px; min-height: 44px; background: none !important; border: 0 !important; }
html.ma-touch .ma-ui .ma-switch::before { content: ""; position: absolute; left: 50%; top: 50%; width: 3.4em; height: 1.9em; margin: -.95em 0 0 -1.7em; border-radius: 1em; background: rgba(0,0,0,.45); border: 1px solid var(--line); transition: background .2s; }
html.ma-touch .ma-ui .ma-switch[aria-checked="true"]::before { background: var(--turmeric); border-color: transparent; }
html.ma-touch .ma-ui .ma-switch i { left: 50%; top: 50%; width: 1.5em; height: 1.5em; margin: -.75em 0 0 -1.5em; }
html.ma-touch .ma-ui .ma-switch[aria-checked="true"] i { transform: translateX(1.5em); background: var(--night); }
