/* The touch page: a phone or tablet (html.touch, set by index.html's #phone-check; input/touch.rs reads the thumbs).
   A phone is played on its side. Two scales, both set by ui/kit/scale.rs: --ui-scale shrinks the desktop HUD's
   clusters and panels to a small screen, and --touch-scale sizes what a thumb presses (1 on an 844 by 390 screen).
   Every rule here is under html.touch, so a page with a mouse is unchanged. */

/* The page is the game: no scroll, no rubber band, no selection, no callout, no tap flash, and the notch kept clear. */
html.touch, html.touch body { overscroll-behavior: none; touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
html.touch canvas#game, html.touch #touch-stick, html.touch [data-ability-slot], html.touch :is(#touch-attack, #touch-minion, #touch-tower, #touch-recall, #shop-toggle) { touch-action: none; }
html.touch :is(input, textarea) { -webkit-user-select: text; user-select: text; }
html.touch #hud { inset: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px); }

/* A match is played on the phone's side. */
html.touch body::after { content: none; }
@media (orientation: portrait) {
  html.touch:has(#hud > *) body::after {
    content: 'Turn your phone on its side';
    position: fixed; inset: 0; z-index: 10000; display: grid; place-items: center; padding: 24px; text-align: center;
    font: 400 22px/1.3 var(--font-head); letter-spacing: 1px; text-transform: uppercase; color: var(--you-light); background: var(--bg-0);
  }
}

/* What a thumb does not use: the mouse's camera toggle, capture button and drawn cursor, the stats strip under the
   stick, the frame-rate readout under the minimap, and the keys printed on buttons. The first-match tips name keys and
   clicks and stand where the ability buttons are, so a touch page does not show them. */
html.touch :is(#camera, .capture-resume, .arena-software-cursor, .statspanel, .match-performance, .points-key, .tip-dock, .minimap-key) { display: none !important; }
/* Q, W, E and R stay on the ability buttons, small: Training and players call them by those names. Every other key
   label goes. */
html.touch #hud .slot:not([data-ability-slot]) .k, html.touch #hud :is(kbd, .key) { display: none; }
html.touch .combat .slot[data-ability-slot] .k { font-size: 13px; }

/* Top left: the minimap, where neither thumb rests. */
html.touch .minimap-frame { left: 0; right: auto; top: calc(40px * var(--mm)); bottom: auto; --mm: 0.62; border: 2px solid var(--trim); border-left: none; border-top: none; }
html.touch .minimap-frame::before { display: none; }
/* Under it: the target card. */
html.touch .inspection-dock { top: 150px; bottom: 150px; left: var(--s2); zoom: calc(var(--ui-scale) * 0.9); }

/* The desktop console comes apart: its ability slots go under the right thumb; bottom centre, from the edge up, the
   health and mana bars, then the buffs. A phone has no item row and no gold box (Tyler, 18 November 2026: "Right now
   it's taking up way too much space"): the gold is in the top-right strip, the Shop button shows while you can buy
   (ui/play/touch.rs ShopButton) and the items are in the shop's foot and on the scoreboard. Offsets are in the rows'
   own zoom (--ui-scale). */
html.touch .combat:not([hidden]), html.touch .combat:not([hidden]) :is(.abil, .slots) { display: contents; zoom: 1; }
html.touch .combat::before, html.touch .combat::after { display: none; }
html.touch .combat .me { display: none; }
html.touch .combat .bars { position: absolute; left: 50%; bottom: 4px; transform: translateX(-50%); zoom: var(--ui-scale); width: 380px; pointer-events: none; }
html.touch .combat .buffs { position: absolute; left: 50%; bottom: 54px; margin: 0; transform: translateX(-50%); zoom: var(--ui-scale); justify-content: center; }
/* Recalling: above the buffs. */
html.touch .hint, html.touch .recall { bottom: 100px; }
/* The aiming line ("tap a target, or drag from the button to aim"): small, under the top bar, off the champion. */
html.touch .status { top: calc(46px / var(--ui-scale)); bottom: auto; padding: 2px var(--s3); font-size: var(--t-s); border-width: 1px; }

/* Top right: KDA, CS, gold and Settings, clear of the top bar. Players and Feedback are a desktop's (ui/play/hud.rs
   MyScore); Feedback is in Settings' header. Settings is 44 px on the glass. */
html.touch .mystats { top: 0; right: 0; gap: var(--s1); padding: 0 0 0 var(--s2); }
html.touch .mystats .strip-gold { gap: var(--s1); margin-right: var(--s2); align-items: center; }
html.touch .mystats #settings-toggle { display: grid; place-items: center; width: calc(44px / var(--ui-scale)); height: calc(44px / var(--ui-scale)); padding: 0; }
html.touch .mystats #settings-toggle .ico { width: calc(20px / var(--ui-scale)); height: calc(20px / var(--ui-scale)); }
html.touch .notifications { top: 76px; }

/* The chat's newest lines, read only, top left under the minimap: the match's news and the game's notices to you
   ("Ready in 3s"), which a phone shows here and not over the champion (Tyler, 18 November 2026: "Just put that in the
   chat"; session/display.rs notice). Three lines at most, small, clear of the stick. */
html.touch .player-chat.in-match { top: calc(172px * var(--ui-scale)); bottom: auto; left: calc(env(safe-area-inset-left, 0px) + 4px); width: min(320px, 38vw); gap: 0; font-size: 12px; line-height: 1.35; }
html.touch .player-chat.in-match #chat-history { max-height: calc(4.05em); }
html.touch .player-chat.in-match .chat-message:nth-last-child(n+4), html.touch .player-chat.in-match .chat-meta { display: none; }

/* Bottom right, as a phone MOBA lays it out (Tyler, 18 November 2026: "Just look at how Wild Rift does it"): Attack,
   by far the largest, in the corner; the four abilities on an arc round it to its upper left, Recall below their end;
   Minion low beside Attack on the bottom edge and Tower high beside it on the right edge, far apart ("one on bottom,
   one on top, so that they're very separated"). Positions are each button's centre from the screen's bottom right, in
   CSS px on an 844 by 390 screen, times --touch-scale (0.87 on an 844 by 340 screen). Minion, Tower and Recall are
   smaller than Attack and never under 45 px on the glass (--small). Symbols, not words (the kit's pixel glyphs). */
html.touch .touch-actions, html.touch .touch-shop { position: absolute; right: 0; bottom: 0; zoom: var(--touch-scale); width: 0; height: 0; --small: max(48px, calc(45px / var(--touch-scale))); }
html.touch :is(#touch-attack, #touch-recall, #touch-minion, #touch-tower) {
  position: absolute; display: grid; place-items: center; padding: 0; border-radius: 50%;
  color: var(--text); background: color-mix(in srgb, var(--steel-dark) 78%, transparent); border: 2px solid var(--trim);
  box-shadow: 0 0 0 2px var(--steel-dark);
}
html.touch :is(.touch-actions, .touch-shop) .touch-ico { width: 27px; height: 27px; vertical-align: 0; }
/* Attack: 104 px, centre (76, 70). */
html.touch #touch-attack { right: 24px; bottom: 18px; width: 104px; height: 104px; }
html.touch #touch-attack .touch-ico { width: 54px; height: 54px; }
html.touch :is(#touch-attack, #touch-minion, #touch-tower, #touch-recall):active { background: var(--plate); border-color: var(--you-light); }
html.touch :is(#touch-recall, #touch-minion, #touch-tower) { width: var(--small); height: var(--small); }
/* Minion (160, 26), Tower (26, 140), Recall (262, 26). */
html.touch #touch-minion { right: calc(160px - var(--small) / 2); bottom: calc(26px - var(--small) / 2); }
html.touch #touch-tower { right: calc(26px - var(--small) / 2); bottom: calc(140px - var(--small) / 2); color: var(--you-light); }
html.touch #touch-recall { right: calc(262px - var(--small) / 2); bottom: calc(26px - var(--small) / 2); color: var(--mana); }
/* The abilities, 56 px, on an arc of 120 px round Attack's centre at 4, 34, 64 and 94 degrees up from its left: Q
   (196, 78), W (176, 137), E (129, 178), R (68, 190). --at-x and --at-y are each slot's bottom right corner. */
html.touch .combat .slotcol { position: absolute; zoom: calc(var(--touch-scale) * 0.875); right: 0; bottom: 0; --at-x: 0px; --at-y: 0px; margin: 0 calc(var(--at-x) / 0.875) calc(var(--at-y) / 0.875) 0; }
/* The passive is not pressed, and a phone has no room for it. */
html.touch .combat .slotcol:nth-child(1) { display: none; }
html.touch .combat .slotcol:nth-child(2) { --at-x: 167.7px; --at-y: 50.4px; }
html.touch .combat .slotcol:nth-child(3) { --at-x: 147.5px; --at-y: 109.1px; }
html.touch .combat .slotcol:nth-child(4) { --at-x: 100.6px; --at-y: 149.9px; }
html.touch .combat .slotcol:nth-child(5) { --at-x: 39.6px; --at-y: 161.7px; }
html.touch .combat .slotcol .slot[data-ability-slot] { border-radius: 50%; overflow: visible; }
html.touch .combat .slotcol .slot[data-ability-slot] > img { border-radius: 50%; }
html.touch .combat .slotcol .pips { position: absolute; left: 0; right: 0; bottom: -9px; margin: 0; }
/* Each level-up button stands on its ability's outer side, along the arc's radius, away from Attack, where no other
   button is: 44 px drawn (in the slot's own zoom), and a thumb finds it 8 px past its edge, which keeps it at least
   44 px on the glass. It is read by its own pointer (input/touch.rs plus_down), so it works with the stick held. */
html.touch .combat .plus { transform: none; width: 44px; height: 44px; font-size: 26px; }
html.touch .combat .plus::before { content: ''; position: absolute; inset: -8px; }
html.touch .combat .slotcol:nth-child(2) .plus { left: -55.8px; top: 5.4px; }
html.touch .combat .slotcol:nth-child(3) .plus { left: -44.7px; top: -26.9px; }
html.touch .combat .slotcol:nth-child(4) .plus { left: -18.9px; top: -49.3px; }
html.touch .combat .slotcol:nth-child(5) .plus { left: 14.6px; top: -55.8px; }

/* The Shop button, while you can buy: the kit's gold, with the shop's purse, left of the abilities at (322, 100), 56 px
   (Tyler, 18 November 2026: "have a shop button pop up and make it yellow ... make it obvious"). */
html.touch #shop-toggle {
  position: absolute; right: 294px; bottom: 72px; width: 56px; height: 56px; padding: 0; display: grid; place-items: center;
  color: var(--ink); border: 5px solid transparent; border-image: url('/c/a45acd7c1a0c134020cb7a0483ee926794a89be47cbfa370c0d22614286a7c77.png') 5 / 10px stretch; background: var(--face-gold) padding-box;
  animation: touch-shop-in 260ms cubic-bezier(.2, 1.4, .4, 1) both;
}
html.touch #shop-toggle .touch-ico { width: 36px; height: 36px; }
html.touch #shop-toggle:active { border-image-source: url('/c/f971626c33be548ca5545379ee4dd02f5d7d6845aa67f4c90a6668912371da2d.png'); background: var(--face-gold-pressed) padding-box; }
@keyframes touch-shop-in { from { scale: .6; opacity: 0; } to { scale: 1; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { html.touch #shop-toggle { animation: none; } }

/* Bottom left: the move stick. The knob follows the thumb (--stick-x, --stick-y, set by input/touch.rs). */
html.touch #touch-stick {
  position: absolute; left: 26px; bottom: 22px; zoom: var(--touch-scale); width: 124px; height: 124px; border-radius: 50%;
  background: color-mix(in srgb, var(--steel-dark) 55%, transparent); border: 2px solid color-mix(in srgb, var(--trim) 70%, transparent);
}
html.touch #touch-stick::before { content: ''; position: absolute; inset: -34px; border-radius: 50%; }
html.touch #touch-stick .touch-knob {
  position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; margin: -27px 0 0 -27px; border-radius: 50%; pointer-events: none;
  background: color-mix(in srgb, var(--you-light) 55%, transparent); border: 2px solid var(--you-light);
  transform: translate(var(--stick-x, 0px), var(--stick-y, 0px));
}

/* The scoreboard, opened by a tap on the top bar: it takes the thumb so it scrolls (a desktop's lets clicks through
   while Tab holds it), its head stays at the top as the rows scroll, and a cross at its top right closes it
   (ui/play/touch.rs BoardClose), 44 px on the glass. A tap on the arena or the top bar still closes it. */
html.touch #hud #scoreboard { pointer-events: auto; touch-action: pan-y; overscroll-behavior: contain; top: calc(48px / var(--ui-scale)); max-height: calc(100vh / var(--ui-scale) - 56px / var(--ui-scale)); }
/* Inside #hud's safe area (the top of this sheet): measured from the screen, the board reached under the Dynamic Island
   of a home-screen web app on its side. */
html.touch #hud #scoreboard { max-width: calc((100vw - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px) - 16px) / var(--ui-scale));
  max-height: calc((100vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 56px) / var(--ui-scale)); }
html.touch #scoreboard .board-head { position: sticky; top: 0; z-index: 2; grid-template-columns: 1fr auto 1fr auto; column-gap: var(--s4); background: var(--steel); }
html.touch #scoreboard .board-close {
  position: relative; width: calc(44px / var(--ui-scale)); height: calc(44px / var(--ui-scale)); padding: 0;
  background: var(--steel-dark); border: 2px solid var(--trim); cursor: pointer;
}
html.touch #scoreboard .board-close::before, html.touch #scoreboard .board-close::after {
  content: ''; position: absolute; left: 50%; top: 50%; width: 55%; height: calc(4px / var(--ui-scale)); background: var(--you-light); transform: translate(-50%, -50%) rotate(45deg);
}
html.touch #scoreboard .board-close::after { transform: translate(-50%, -50%) rotate(-45deg); }
html.touch #scoreboard .board-close:active { background: var(--plate); }

/* Training (ui/play/training_layer.rs) on a phone: the same words in smaller type, clear of Skip, and no key on Skip.
   The prompt is placed in window px by the game, so its type shrinks, not the box. Recall is not taught. */
html.touch .training-intro { padding: 8px 150px 14px; }
html.touch .training-intro h2 { font-size: 20px; letter-spacing: 1px; }
html.touch .training-intro p, html.touch .training-line { font-size: var(--t-m); }
html.touch .training-skip-dock { top: var(--s2); right: var(--s2); }
html.touch .training-skip .key { display: none; }
html.touch body.training-hud #touch-recall { display: none; }
/* The Shop button waits for the Shop step, which teaches it. */
html.touch body.training-hud:not(.training-shop) .touch-shop { display: none !important; }

/* The lane arrow (ui/play/lane_guide.rs keeps it above the thumbs' controls): smaller type on a phone. */
html.touch .lane-pointer { font-size: var(--t-s); padding: 2px 8px; }
