/* public/phone.css — lane PH1: the phone's fight controls (public/touch.js), its shell (public/phone.js: rotate screen,
   install hint, THE PHONE BETA's tag) and the fight HUD on a small landscape screen. Everything is scoped to html.touchfight /
   body.touchfight (set only on a touch device) or to a coarse-pointer media query: a desktop renders exactly as before. */

/* ---------------------------------------------------------------- no browser gestures over the game */
html.touchfight, html.touchfight body { overscroll-behavior: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
html.touchfight canvas#game, html.touchfight #hud, html.touchfight .touchui { touch-action: none; }
html.touchfight button, html.touchfight select, html.touchfight input { touch-action: manipulation; }
.tsafe { position: fixed; left: 0; top: 0; width: 0; height: 0; visibility: hidden; pointer-events: none;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px); }

/* ---------------------------------------------------------------- the sticks + buttons */
.touchui { position: fixed; inset: 0; z-index: 3; pointer-events: none; --tsr: 52px; }
.touchui.hidden { display: none; }
.tstick { position: absolute; left: 0; top: 0; width: 0; height: 0; }
.tstick i { position: absolute; display: block; border-radius: 50%; pointer-events: none; }
.tstick .tbase { left: calc(var(--tsr) * -1); top: calc(var(--tsr) * -1); width: calc(var(--tsr) * 2); height: calc(var(--tsr) * 2);
  border: 2px solid rgba(255, 244, 220, 0.28); background: radial-gradient(rgba(20, 14, 24, 0.10), rgba(20, 14, 24, 0.38)); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5); }
.tstick .tknob { left: calc(var(--tsr) * -0.42); top: calc(var(--tsr) * -0.42); width: calc(var(--tsr) * 0.84); height: calc(var(--tsr) * 0.84);
  background: radial-gradient(circle at 40% 35%, rgba(255, 246, 225, 0.55), rgba(190, 160, 120, 0.35)); border: 2px solid rgba(255, 244, 220, 0.6); box-shadow: 0 0 0 1px #000; }
.tstick, .tbtn { opacity: var(--tso, 0.6); }
.tstick.live { opacity: min(1, calc(var(--tso, 0.6) + 0.25)); }
.tstick:not(.live) { opacity: calc(var(--tso, 0.6) * 0.7); }
/* Settings opened from the pause menu: over it (both are z-index 20 and the menu comes later in the page) */
html.touchfight #modal { z-index: 21; }
.tbtn.on { opacity: 1; }
.tstick.taim .tknob { background: radial-gradient(circle at 40% 35%, rgba(255, 210, 160, 0.6), rgba(220, 110, 60, 0.4)); border-color: rgba(255, 190, 120, 0.7); }
.tstick.taim.live .tbase { border-color: rgba(255, 170, 90, 0.55); }
/* the lev tank as a ring round the move stick (gold, red when nearly empty), filling clockwise from the top */
.tstick .tlev { left: calc(var(--tsr) * -1 - 7px); top: calc(var(--tsr) * -1 - 7px); width: calc(var(--tsr) * 2 + 14px); height: calc(var(--tsr) * 2 + 14px);
  background: conic-gradient(#ffd86a calc(var(--lev, 1) * 360deg), rgba(58, 44, 16, 0.55) 0);
  -webkit-mask: radial-gradient(closest-side, transparent calc(100% - 5px), #000 calc(100% - 4px)); mask: radial-gradient(closest-side, transparent calc(100% - 5px), #000 calc(100% - 4px)); }
.tstick .tlev.low { background: conic-gradient(#ff5040 calc(var(--lev, 1) * 360deg), rgba(74, 16, 22, 0.6) 0); }
.tbtn { position: absolute; pointer-events: auto; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 40% 35%, rgba(60, 46, 68, 0.62), rgba(18, 12, 22, 0.62)); border: 2px solid rgba(255, 244, 220, 0.42);
  box-shadow: 0 0 0 1px #000, inset 0 -3px 0 rgba(0, 0, 0, 0.35); color: #fff4dc; font-family: var(--title); letter-spacing: 0.5px; text-shadow: 1px 1px 0 #000; }
.tbtn span { pointer-events: none; line-height: 1; }
.tbtn.on { background: radial-gradient(circle at 40% 35%, rgba(255, 216, 106, 0.75), rgba(150, 100, 30, 0.7)); border-color: #ffe8a8; transform: scale(0.94); }
.tb-fly { border-color: rgba(255, 216, 106, 0.6); }
.tb-pause, .tb-score { background: rgba(10, 8, 14, 0.55); border-width: 1px; }
.touchui.dead .tstick, .touchui.dead .tb-fly, .touchui.dead .tb-kick, .touchui.dead .tb-throw, .touchui.dead .tb-pour, .touchui.dead .tb-wand { display: none; }
/* the wand wheel: four slices round the WAND button (slot 1 up, then clockwise) */
.twheel { position: absolute; left: 0; top: 0; width: 0; height: 0; pointer-events: none; }
.twheel.hidden { display: none; }
.twheel .tws { position: absolute; width: 74px; height: 50px; margin: -25px 0 0 -37px; background: rgba(12, 10, 16, 0.9); border: 2px solid var(--edge2, #5a4a3a);
  box-shadow: 0 0 0 1px #000; display: flex; align-items: center; justify-content: center; gap: 4px; }
.twheel .tws b { font-family: var(--title); font-size: 11px; color: var(--dim, #9a8d7a); font-weight: 400; }
.twheel .tws img { width: 44px; height: 17px; image-rendering: pixelated; }
.twheel .tws.empty { opacity: 0.35; }
.twheel .tws.pick { border-color: var(--gold, #f2c14e); box-shadow: 0 0 0 1px #000, 0 0 14px rgba(242, 193, 78, 0.7); }
.twheel .tws0 { left: 0; top: -78px; } .twheel .tws1 { left: 82px; top: 0; } .twheel .tws2 { left: 0; top: 78px; } .twheel .tws3 { left: -82px; top: 0; }

/* ---------------------------------------------------------------- the rotate screen (portrait on a phone) */
.rotate { display: none; }
@media (orientation: portrait) and (pointer: coarse) {
  .rotate { display: flex; position: fixed; inset: 0; z-index: 200; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
    background: #0b0a0d; color: #fff4dc; font-family: var(--title); text-align: center; padding: 24px; }
  .rotate b { font-size: 20px; font-weight: 400; letter-spacing: 1px; }
  .rotate small { font-family: var(--font); font-size: 14px; color: var(--dim, #9a8d7a); }
  .rotate .rphone { width: 46px; height: 78px; border: 4px solid #f2c14e; border-radius: 8px; position: relative; animation: rphone 1.8s ease-in-out infinite; box-shadow: 0 0 0 2px #000; }
  .rotate .rphone i { position: absolute; left: 50%; bottom: 5px; width: 10px; height: 4px; margin-left: -5px; background: #f2c14e; }
}
@keyframes rphone { 0%, 25% { transform: rotate(0deg); } 55%, 100% { transform: rotate(-90deg); } }

/* ---------------------------------------------------------------- install hint + THE PHONE BETA's tag */
/* bottom row of the title, right of its Full screen button (iOS has none: body.nofs, the chip takes its place) */
.installhint { position: absolute; left: calc(178px + env(safe-area-inset-left, 0px)); bottom: 8px; z-index: 4; display: flex; align-items: center; gap: 6px; font-size: 12px !important;
  background: rgba(12, 10, 16, 0.9); border: 2px solid var(--edge2, #5a4a3a); padding: 3px 6px; max-width: min(300px, calc(100vw - 200px)); box-shadow: 0 0 0 1px #000; }
body.nofs .installhint { left: calc(12px + env(safe-area-inset-left, 0px)); max-width: 46vw; }
.installhint button { font-size: 11px; padding: 3px 8px; }
.installhint .ishare { display: inline-block; width: 11px; height: 13px; border: 2px solid #8ac8ff; border-top: 0; position: relative; vertical-align: -2px; margin: 0 2px; }
.installhint .ishare::before { content: ''; position: absolute; left: 50%; top: -6px; width: 2px; height: 10px; margin-left: -1px; background: #8ac8ff; }
.betatag { position: fixed; right: calc(8px + env(safe-area-inset-right, 0px)); bottom: 6px; z-index: 6; pointer-events: none; font-size: 11px; color: #ffd86a;
  background: rgba(12, 10, 16, 0.75); border: 1px solid #6a5420; padding: 1px 6px; font-family: var(--title); }
.betatag small { font-family: var(--font); color: var(--dim, #9a8d7a); margin-left: 4px; }
body.ingame .betatag { opacity: 0.45; }
body.betastale .betatag { pointer-events: auto; left: 50%; right: auto; bottom: auto; top: 8px; transform: translateX(-50%); font-size: 14px; padding: 6px 12px; border: 2px solid #ff8a5a; color: #fff; background: #3a1410; z-index: 120; max-width: 92vw; text-align: center; }
body.betastale .betatag small { display: block; margin: 2px 0 0; font-size: 12px; color: #ffd8c8; }
body.betastale .betatag a { color: #ffd86a; }

/* ---------------------------------------------------------------- the fight HUD round the sticks */
/* the fight tutorial's card sits bottom-left on a desktop: on a phone that is the move stick. Top centre instead, narrow */
html.touchfight .tutcard.bottom { left: 50%; bottom: auto; top: 46px; transform: translateX(-50%); width: min(360px, calc(44vw / var(--ui-scale))); font-size: 12.5px; line-height: 1.3; padding: 6px 9px; }
html.touchfight .tutcard.bottom .tutbtns button { padding: 3px 8px; }
/* the flask's keyboard hint (E hold: pour / Q throw): the POUR and THROW buttons say it */
html.touchfight #hud .ihint { display: none; }
/* the beta tag would sit under the aim stick: not in the fight */
html.touchfight body.ingame .betatag { display: none; }

/* lane PH2's fight pause button (.tpause, bottom centre) sits between the two sticks, where a thumb sliding onto a stick
   would pause the fight: with the touch controls on, their pause (top edge, public/touch.js) is the fight's */
html.touchfight #hud .tpause { display: none !important; }
