/* The mobile game fills the visible viewport; menus open above the board. */
.mobile-controls,.mobile-power,.mobile-effects,.mobile-status,.mobile-menu-section{display:none}
button,select,input[type=range]{touch-action:manipulation}
.play-area,.sidebar,.player-card{min-width:0}
html.touch-game{height:100%;overflow:hidden;overscroll-behavior:none;background:#121016}
body.touch-game{position:fixed;inset:0;width:100%;height:var(--mobile-height,100dvh);min-height:0;overflow:hidden;overscroll-behavior:none;background:radial-gradient(ellipse at 50% 15%,#251c33,#121016 75%)}
.touch-game .shell{position:relative;max-width:none;width:100%;height:100%;min-height:0;margin:0;padding:max(4px,env(safe-area-inset-top)) max(6px,env(safe-area-inset-right)) max(4px,env(safe-area-inset-bottom)) max(6px,env(safe-area-inset-left));overflow:hidden}
.touch-game .topbar{position:absolute;top:max(10px,env(safe-area-inset-top));left:max(10px,env(safe-area-inset-left));z-index:3;display:flex;width:44px;height:44px;min-height:0;padding:0;border:0;gap:0}
.touch-game .topbar .brand,.touch-game .topbar .network,.touch-game .intro{display:none}
.touch-game .settings-button{width:44px;height:44px;min-width:44px;border-radius:12px;background:linear-gradient(#342443,#20182b);box-shadow:0 3px 12px #0005}
.touch-game .settings-button svg{width:24px;height:24px}
.touch-game .game-layout{display:block;width:100%;height:100%;min-height:0}
.touch-game .play-area{display:grid;width:100%;height:100%;min-height:0;grid-template-columns:56px minmax(0,1fr) 60px;grid-template-rows:64px minmax(0,1fr) 20px;grid-template-areas:'. players .' 'power table controls' '. status .';gap:4px 6px;align-items:stretch}
.touch-game .players-strip{grid-area:players;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));align-self:stretch;align-items:stretch;gap:12px;margin:0;padding:0}
.touch-game .player-card{padding:5px 9px;border-radius:10px;border:1px solid #3d314b;background:linear-gradient(110deg,#211b2b,#17131f);box-shadow:none;overflow:hidden}
.touch-game .player-card.active{border-color:#a064e7;background:linear-gradient(110deg,#392349,#20172c);box-shadow:inset 0 0 0 1px #9945ff30}
.touch-game .player-head{gap:7px;flex-wrap:nowrap;min-height:20px}
.touch-game .player-label{font-size:10px;white-space:nowrap;letter-spacing:.3px}
.touch-game .avatar{width:20px;height:20px;flex-shrink:0;font-size:11px}
.touch-game .active-tag{display:none}
.touch-game .group-name{font-size:10px;line-height:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin:2px 0 3px}
.touch-game .ball-row{display:flex;gap:4px;height:10px;min-height:10px;flex-wrap:nowrap}
.touch-game .mini-ball{width:10px;height:10px;flex-shrink:0}
.touch-game .mini-ball.stripe:after{top:3px}
.touch-game .empty-hint{font-size:8px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.touch-game .table-wrap{grid-area:table;display:flex;align-items:center;justify-content:center;align-self:stretch;min-height:0;min-width:0;width:100%;height:100%;padding:0;border:0;border-radius:0;background:transparent;box-shadow:none;overflow:hidden}
.touch-game .table-wrap canvas{flex:none;max-width:100%;max-height:100%;border-radius:4px;touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none}
.touch-game #snookerTarget{grid-area:table;position:relative;z-index:2;align-self:start;justify-self:center;pointer-events:none;max-width:100%;margin:0;padding:3px 8px;gap:5px;border-color:#634b7a;background:#17111ee8;border-radius:12px}
.touch-game #snookerTargetLabel,.touch-game #snookerTargetPoints{display:none}
.touch-game #snookerTargetName{font-size:10px}
.touch-game .snooker-target-ball{width:16px;height:16px}
.touch-game .mobile-power{grid-area:power;display:block;position:relative;align-self:center;justify-self:center;width:50px;height:85%;min-height:100px;max-height:340px;border:1px solid #685273;border-radius:15px;background:linear-gradient(90deg,#15111d,#30223d 50%,#15111d);box-shadow:inset 0 0 0 3px #ffffff05,0 4px 12px #0004}
.mobile-power-label{position:absolute;top:10px;left:0;width:100%;text-align:center;font:600 8px 'DM Mono',monospace;letter-spacing:1px;color:#c8b5db}
.mobile-power-reading{position:absolute;bottom:10px;left:0;width:100%;text-align:center;color:#e4cbff;font:600 10px 'DM Mono',monospace}
.touch-game .mobile-power .control-title{display:none}
.touch-game .mobile-power #power{position:absolute;top:50%;left:50%;width:var(--power-length,150px);height:40px;min-height:0;max-width:none;margin:0;transform:translate(-50%,-50%) rotate(-90deg);appearance:none;border:0;border-radius:0;background:linear-gradient(to right,#b06bff var(--power-fill,0%),#15101e var(--power-fill,0%)) center / 100% 12px no-repeat;touch-action:none;outline-offset:2px}
.touch-game #power::-webkit-slider-thumb{appearance:none;width:14px;height:32px;border:1px solid #e7cdff;border-radius:5px;background:linear-gradient(#cda3ff,#9945ff);box-shadow:0 0 8px #9945ff60}
.touch-game #power::-moz-range-thumb{width:14px;height:30px;border:1px solid #e7cdff;border-radius:5px;background:#ad69ff;box-shadow:0 0 8px #9945ff60}
.touch-game .mobile-controls{grid-area:controls;display:flex;flex-direction:column;align-items:center;justify-content:flex-start;gap:10px;min-height:0;padding:5px 0;margin:0;background:none;border:0}
.mobile-controls button{display:grid;place-items:center;flex-shrink:0;width:48px;min-width:44px;height:48px;min-height:44px;margin:0;border:1px solid #625174;border-radius:12px;background:linear-gradient(#2d253b,#1c1727);color:#eee4fa;box-shadow:0 3px 10px #0004;cursor:pointer;font:600 10px 'DM Sans',sans-serif;padding:4px}
.mobile-controls button:disabled{opacity:.4;cursor:default;transform:none}
.mobile-effect-ball{position:relative;display:block;width:33px;height:33px;border-radius:50%;border:1px solid #a9ada4;background:radial-gradient(circle at 32% 25%,#fff,#e2dfd1 55%,#96998f);box-shadow:0 2px 6px #0006}
.mobile-effect-ball i{position:absolute;left:13px;top:13px;width:7px;height:7px;border:2px solid #9945ff;border-radius:50%}
.mobile-controls .mobile-cancel{font-size:26px;line-height:1}
.mobile-controls .mobile-shoot{margin-top:auto;background:linear-gradient(#ac61ff,#8136d9);border-color:#bf89ff;font-size:11px;text-transform:uppercase;letter-spacing:.4px;color:#fff}
.mobile-controls .mobile-shoot:hover{transform:none}
.mobile-controls .mobile-fullscreen{font-size:28px;line-height:1}
.mobile-controls [hidden]{display:none}
.touch-game .mobile-status{grid-area:status;display:block;align-self:center;min-width:0;margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:center;font-size:10px;line-height:18px;color:#baa9cb}
.touch-game .sidebar,.touch-game .developer-cue-property{display:none}
.touch-game .mobile-effects{position:absolute;z-index:4;right:max(74px,env(safe-area-inset-right));top:50%;transform:translateY(-50%);display:block;width:min(278px,calc(100vw - 88px));max-height:calc(var(--mobile-height,100dvh) - 24px);overflow-y:auto;padding:12px;border:1px solid #755290;border-radius:16px;background:#21182ef5;box-shadow:0 12px 40px #0009;overscroll-behavior:contain}
.touch-game .mobile-effects[hidden]{display:none}
.mobile-effects header{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:8px}
.mobile-effects-title{font-size:13px}
.mobile-effects-close{width:40px;height:40px;border:1px solid #614776;border-radius:9px;background:#30213d;color:#fff;font-size:24px;cursor:pointer}
.mobile-effects .cue-contact-control{margin:0 auto 10px;gap:4px}
.mobile-effects .cue-contact-control svg{width:112px;height:112px}
.mobile-effects .cue-contact-control>label{font-size:10px}
.mobile-effects .cue-elevation-control label{font-size:11px}
.mobile-effects input[type=range]{height:32px;margin:4px 0;touch-action:none}
.mobile-effects .cue-rate-control{gap:8px;flex-wrap:wrap}
.mobile-effects select{min-height:40px;font-size:16px;max-width:100%}
.mobile-effects #placeCueInD{min-height:44px;width:100%;font-size:12px}
.touch-game .mobile-menu-section{display:block;margin:14px 0 18px;text-align:left}
.mobile-mode-label{display:block;font-size:12px;margin-bottom:7px;color:#c3afd5}
.mobile-menu-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.touch-game .mobile-menu-actions #gameMode{grid-column:1 / -1;appearance:auto;width:100%;min-height:44px;border:1px solid #755290;border-radius:8px;background:#17111f;color:#e6cbff;padding:8px;font-size:16px}
.mobile-menu-actions button{width:100%;min-height:44px;margin:0;font-size:12px}
.mobile-menu-section .event-log-card{margin-top:12px;padding:10px}
.mobile-menu-section #eventLog{max-height:140px}
.touch-game .settings-box,.touch-game .tutorial-box{max-height:calc(var(--mobile-height,100dvh) - 24px);overflow-y:auto;overscroll-behavior:contain}
.touch-game .modal{padding:12px}
.touch-game .modal-box{max-width:100%;min-width:0}
.touch-game .tutorial-close{min-width:44px;min-height:44px}
.touch-game .settings-kicker,.touch-game .settings-row,.touch-game #shortcutHint{display:none}
.touch-game .physics-debug{max-height:calc(var(--mobile-height,100dvh) - 24px)}
.touch-game .settings-box input:not([type=range]):not([type=checkbox]),.touch-game .physics-debug input:not([type=range]):not([type=color]),.touch-game .physics-debug select{font-size:16px}
@media(orientation:portrait){
  .touch-game .play-area{grid-template-columns:44px minmax(0,1fr) 44px;grid-template-rows:66px minmax(0,1fr) 24px;gap:5px 4px}
  .touch-game .topbar{left:max(6px,env(safe-area-inset-left));width:40px}
  .touch-game .settings-button{width:40px;min-width:40px;height:44px}
  .touch-game .players-strip{gap:5px}
  .touch-game .player-card{padding:5px}
  .touch-game .player-head{gap:4px}
  .touch-game .player-label{font-size:8px}
  .touch-game .group-name{font-size:9px}
  .touch-game .ball-row{gap:3px}
  .touch-game .mini-ball{width:8px;height:8px}
  .touch-game .mini-ball.stripe:after{top:2px;height:2px}
  .touch-game .mobile-power{width:40px;height:60%;max-height:300px}
  .touch-game .mobile-controls{justify-content:center;gap:12px}
  .mobile-controls button{width:42px;height:44px;min-width:40px}
  .mobile-controls .mobile-shoot{margin-top:14px;font-size:9px}
  .touch-game .mobile-effects{right:52px;width:min(278px,calc(100vw - 64px))}
}
@media(max-height:360px) and (orientation:landscape){
  .touch-game .play-area{grid-template-rows:52px minmax(0,1fr) 16px;gap:3px 5px}
  .touch-game .player-card{padding:3px 7px}
  .touch-game .player-head{min-height:16px}
  .touch-game .avatar{width:16px;height:16px}
  .touch-game .group-name{margin:1px 0;font-size:9px;line-height:10px}
  .touch-game .ball-row{height:9px;min-height:9px}
  .touch-game .mobile-controls{gap:5px;padding:0}
  .mobile-controls button{height:40px;min-height:40px;width:44px}
  .touch-game .mobile-status{font-size:9px;line-height:14px}
}

.mobile-controls .mobile-place-cue{font-size:26px}
@media(orientation:landscape){.touch-game .mobile-controls{gap:7px}.mobile-controls button{height:44px;min-height:44px}}
@media(max-height:360px) and (orientation:landscape){.touch-game .mobile-controls{gap:5px}.mobile-controls button{height:40px;min-height:40px}}

/* Relative swipes own pointer input; the range keeps keyboard and accessibility support. */
.touch-game .mobile-power{touch-action:none;user-select:none;-webkit-user-select:none;cursor:ns-resize}
.touch-game .mobile-power #power{pointer-events:none}
.touch-game .mobile-power.is-charging{border-color:#c99aff;box-shadow:inset 0 0 0 2px #9945ff40,0 0 16px #9945ff40}
.mobile-power-hint{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}

.mobile-effect-ball i{left:50%;top:50%;transform:translate(-50%,-50%)}
