/* On-screen controls for phones and tablets (touch.js). Shown only while touch is the input in use. */
#tc { position: fixed; inset: 0; z-index: 3; pointer-events: none; display: none;
      font: 600 13px/1.1 system-ui, -apple-system, "Segoe UI", sans-serif; color: #EEF2F7;
      -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
#tc.on { display: block; }
#tc button { -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; touch-action: none; }

/* Where the thumbs go while a night is played: the stick (left) and looking (right). */
#tc-zone { position: absolute; inset: 0; pointer-events: auto; touch-action: none; display: none; }
#tc.play #tc-zone { display: block; }

#tc-stick { position: absolute; width: 132px; height: 132px; margin: -66px 0 0 -66px; border-radius: 50%;
            background: rgba(10, 14, 22, 0.32); border: 2px solid rgba(238, 242, 247, 0.30); display: none; }
#tc.play #tc-stick { display: block; }
#tc-stick.held { border-color: rgba(255, 200, 87, 0.65); background: rgba(10, 14, 22, 0.42); }
#tc-knob { position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; margin: -29px 0 0 -29px; border-radius: 50%;
           background: rgba(238, 242, 247, 0.55); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45); }
#tc-stick.held #tc-knob { background: rgba(255, 200, 87, 0.85); }

/* Buttons: glass discs like the game's HUD, amber when the game's prompt names them. */
.tc-btn { position: absolute; pointer-events: auto; display: none; flex-direction: column; align-items: center; justify-content: center;
          width: 60px; height: 60px; margin: 0; padding: 0; border-radius: 50%; box-sizing: border-box;
          background: rgba(10, 14, 22, 0.50); border: 2px solid rgba(238, 242, 247, 0.32); color: #EEF2F7;
          font: 700 13px/1.05 system-ui, -apple-system, "Segoe UI", sans-serif; letter-spacing: 0.02em;
          text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7); cursor: default; }
.tc-btn.lit { border-color: #FFC857; color: #FFE3A3; box-shadow: 0 0 0 3px rgba(255, 200, 87, 0.22); }
.tc-btn.down, .tc-btn.on { background: rgba(255, 200, 87, 0.40); border-color: #FFC857; }
.tc-btn.dim { opacity: 0.55; }
#tc.play .tc-btn.p { display: flex; }
#tc .tc-btn.always { display: flex; }
#tc .tc-btn.gone { display: none !important; }
.tc-btn.big { width: 84px; height: 84px; font-size: 15px; }
.tc-btn.small { width: 50px; height: 50px; font-size: 12px; border-radius: 14px; }

/* Where they sit: the right thumb's arc around Clean, the left thumb's switches above the stick,
   pause and the shift sheet top left (the HUD's clock is top right); all clear of the notch and the home indicator. */
#b-use      { right: calc(env(safe-area-inset-right) + 26px);  bottom: calc(env(safe-area-inset-bottom) + 30px); }
#b-interact { right: calc(env(safe-area-inset-right) + 124px); bottom: calc(env(safe-area-inset-bottom) + 26px); }
#b-spray    { right: calc(env(safe-area-inset-right) + 38px);  bottom: calc(env(safe-area-inset-bottom) + 128px); }
#b-drop     { right: calc(env(safe-area-inset-right) + 120px); bottom: calc(env(safe-area-inset-bottom) + 106px); }
#b-torch    { right: calc(env(safe-area-inset-right) + 200px); bottom: calc(env(safe-area-inset-bottom) + 32px); }
#b-tool     { right: calc(env(safe-area-inset-right) + 44px);  bottom: calc(env(safe-area-inset-bottom) + 204px); }
#b-crouch   { left: calc(env(safe-area-inset-left) + 22px);  bottom: calc(env(safe-area-inset-bottom) + 214px); }
#b-sprint   { left: calc(env(safe-area-inset-left) + 84px);  bottom: calc(env(safe-area-inset-bottom) + 214px); }
#b-pause    { left: calc(env(safe-area-inset-left) + 14px);  top: calc(env(safe-area-inset-top) + 12px); }
#b-sheet    { left: calc(env(safe-area-inset-left) + 74px);  top: calc(env(safe-area-inset-top) + 12px); }
#b-full     { left: calc(env(safe-area-inset-left) + 134px); top: calc(env(safe-area-inset-top) + 12px); }
/* Short screens (a phone held sideways in a browser with its bars showing): pull the upper ones down. */
@media (max-height: 360px) {
  #b-tool   { bottom: calc(env(safe-area-inset-bottom) + 190px); right: calc(env(safe-area-inset-right) + 112px); }
  #b-crouch, #b-sprint { bottom: calc(env(safe-area-inset-bottom) + 176px); }
}

/* Soft keys: a row of buttons for screens read with keys (the clipboard, the document reader). */
#tc-keys { position: absolute; left: 50%; transform: translateX(-50%); display: flex; gap: 10px; pointer-events: none;
           bottom: calc(10px + env(safe-area-inset-bottom)); }
#tc-keys button { pointer-events: auto; min-width: 64px; min-height: 50px; padding: 0 16px; border-radius: 12px;
                  background: rgba(10, 14, 22, 0.72); border: 2px solid rgba(238, 242, 247, 0.34); color: #EEF2F7;
                  font: 700 16px/1 system-ui, -apple-system, "Segoe UI", sans-serif; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); }
#tc-keys button.down { background: rgba(255, 200, 87, 0.45); border-color: #FFC857; }

/* Turn the device: the game is laid out for landscape. */
#rotate { display: none; z-index: 5; }
#rotate.on { display: flex; }
#rotate .phone { width: 46px; height: 78px; border: 4px solid #9ED9F2; border-radius: 10px; animation: ah-turn 2.4s ease-in-out infinite; }
@keyframes ah-turn { 0%, 30% { transform: rotate(0deg); } 60%, 100% { transform: rotate(-90deg); } }
@media (prefers-reduced-motion: reduce) { #rotate .phone { animation: none; transform: rotate(-90deg); } }
