/* touch.css — v0.8 phone / small-screen layer: safe areas, touch controls, pause menu, rotate hint, compact layouts */
/* ===== v0.8 mobile / small-screen layer ===== */
:root{--sl:env(safe-area-inset-left,0px);--sr:env(safe-area-inset-right,0px);--st:env(safe-area-inset-top,0px);--sb:env(safe-area-inset-bottom,0px);--vh:100dvh}
html,body{height:100%;height:100dvh;overscroll-behavior:none;-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none;-webkit-user-select:none;touch-action:manipulation}
body.touch{position:fixed;inset:0}
#game{touch-action:none}
button{touch-action:manipulation;-webkit-user-select:none;user-select:none}
input[type=range]{touch-action:pan-x}
@media (hover:none){button:hover,.bill:hover{filter:none;transform:none}}
.ovl .x{z-index:3}
.cashX{position:absolute;left:-14px;right:auto;top:-16px;z-index:3}
.drawerWrap,.regTop,.term{position:relative}
.term .x{right:14px;top:auto;bottom:-26px;border-radius:12px}
/* touch controls */
#touchUI{display:none;position:fixed;inset:0;z-index:3;touch-action:none}
body.touch.playing #touchUI{display:block}
body.touch #keys,body.touch #lockHint,body.touch #mute,body.touch #setBtn{display:none!important}
#tLook{position:absolute;inset:0}
#tStick{position:absolute;left:calc(24px + var(--sl));bottom:calc(22px + var(--sb));width:132px;height:132px;border-radius:50%;background:rgba(255,246,230,.22);border:3px solid rgba(59,42,32,.45);transition:opacity .2s;opacity:.75;pointer-events:none}
#tStick.on{opacity:1;transition:none;background:rgba(255,246,230,.32)}
#tStick::after{content:"按住拖动走路";position:absolute;left:50%;bottom:-20px;transform:translateX(-50%);white-space:nowrap;font:900 11px var(--fb);color:#fff;text-shadow:0 1px 0 var(--ink),1px 0 0 var(--ink),-1px 0 0 var(--ink),0 -1px 0 var(--ink);opacity:.9}
#tStick.used::after{display:none}
#tKnob{position:absolute;left:50%;top:50%;width:58px;height:58px;margin:-29px;border-radius:50%;background:rgba(255,246,230,.92);border:3.5px solid var(--ink);box-shadow:0 4px 0 rgba(59,42,32,.4)}
#tStick.run #tKnob{background:#F2C14E}
.tb{position:absolute;border-radius:50%;width:70px;height:70px;padding:0;font:900 16px/1.1 var(--fb);background:rgba(255,246,230,.92);box-shadow:0 5px 0 var(--ink);touch-action:none;-webkit-user-select:none;user-select:none;transition:transform .06s,box-shadow .06s,opacity .15s,filter .1s}
.tb small{display:block;font-size:10px;font-weight:900;margin-top:2px;opacity:.85}
.tb.down{transform:translateY(4px) scale(.94);box-shadow:0 1px 0 var(--ink);filter:brightness(.88)}
.tb.dim{opacity:.45}
.tb.hide{opacity:0;pointer-events:none;transform:scale(.6)}
.tb.big{width:94px;height:94px;font-size:21px;background:rgba(229,83,61,.95);color:#FFF6E6;right:calc(18px + var(--sr));bottom:calc(18px + var(--sb))}
.tb.big.on{background:#F2C14E;color:var(--ink)}
#tGrab{right:calc(122px + var(--sr));bottom:calc(14px + var(--sb));background:rgba(143,211,182,.97)}
.tb.sm{width:52px;height:52px;font-size:13px}
#tR{right:calc(20px + var(--sr));bottom:calc(124px + var(--sb))}
#tQ{right:calc(80px + var(--sr));bottom:calc(150px + var(--sb));background:rgba(255,226,122,.95)}
#tF{right:calc(134px + var(--sr));bottom:calc(96px + var(--sb));background:rgba(255,179,161,.95)}
#tMenu{position:absolute;left:auto;right:calc(206px + var(--sr));top:calc(8px + var(--st));width:46px;height:46px;border-radius:12px;font:900 13px var(--fb);background:rgba(255,246,230,.95);box-shadow:0 4px 0 var(--ink);padding:0}
#tMenu b{display:block;font-size:15px;letter-spacing:-2px;line-height:1}
/* prompt key chips for touch */
#prompt kbd.kAct{background:#E5533D;color:#FFF6E6}
#prompt kbd.kGrab{background:#8FD3B6}
#prompt kbd.kSm{background:var(--cream)}
/* pause menu */
#pause .pbox{position:relative;background:var(--paper);border:4px solid var(--ink);border-radius:18px;padding:18px 18px 16px;width:min(380px,100%);text-align:center;box-shadow:0 8px 0 rgba(59,42,32,.35)}
#pause h3{font:400 34px var(--fh);margin-bottom:10px}
#pause .pgrid{display:grid;grid-template-columns:1fr 1fr;gap:10px}
#pause .pgrid button{min-height:48px;font-size:16px;padding:6px 10px}
#pause .pgrid .wide{grid-column:span 2;background:var(--mint);font:400 26px var(--fh);min-height:56px}
#pause p{font-size:12px;color:#7a6a58;margin-top:12px;line-height:1.5}
.helpClose{display:none}
#pause .phelp{display:none;text-align:left;max-height:46dvh;overflow:auto;overscroll-behavior:contain;font-size:13px;line-height:1.75;margin-top:12px;border-top:2px dashed var(--ink);padding-top:8px;touch-action:pan-y}
#pause .phelp.show{display:block}
/* rotate hint */
#rotateHint{display:none;position:fixed;inset:0;z-index:30;background:rgba(59,42,32,.94);color:#FFF6E6;align-items:center;justify-content:center;text-align:center;font:400 30px var(--fh);padding:24px calc(24px + var(--sr)) calc(24px + var(--sb)) calc(24px + var(--sl));flex-direction:column;gap:14px}
#rotateHint .ph{width:62px;height:104px;border:5px solid #FFF6E6;border-radius:14px;position:relative;animation:rot 2.4s ease-in-out infinite;margin-bottom:10px}
#rotateHint .ph::after{content:"";position:absolute;left:50%;bottom:6px;width:12px;height:12px;margin-left:-6px;border-radius:50%;background:#FFF6E6}
@keyframes rot{0%,25%{transform:rotate(0)}55%,85%{transform:rotate(-90deg)}100%{transform:rotate(0)}}
#rotateHint small{display:block;font:900 15px/1.6 var(--fb);opacity:.85;margin-top:6px}
#rotateHint button{font:900 17px var(--fb);background:var(--cream);margin-top:8px;min-height:48px;padding:8px 22px}
@media (orientation:portrait){body.touch:not(.portraitOK) #rotateHint{display:flex}}
#fsBtn{background:var(--cream)}
/* ---------- compact HUD: phones & small windows (replaces old zoom hacks) ---------- */
@media (max-width:1000px),(max-height:600px){
  #reg{left:calc(10px + var(--sl));top:calc(8px + var(--st));width:176px;border-width:3px;border-radius:14px;padding:6px 8px}
  #regLcd{height:38px;padding:0 8px;border-width:2px}
  #regLcd small{font-size:8px;left:7px;top:2px;letter-spacing:1px}
  #regLcd .yen{font-size:22px;margin-top:6px}
  #money{font-size:30px;margin-top:6px}
  #repBar{margin-top:5px;height:22px;border-width:2px;border-radius:6px;padding:0 6px}
  #rep svg{width:14px;height:14px;margin-right:0}
  #repN{font-size:11px}
  #chaos{left:calc(10px + var(--sl));top:calc(98px + var(--st));width:176px;padding:2px 8px;font-size:11px;border-width:2.5px;gap:6px}
  #chaos i{height:10px;border-width:2px}
  #wanted{left:calc(10px + var(--sl));top:calc(128px + var(--st));font-size:12px;padding:2px 8px;border-width:2.5px;gap:4px}
  #wanted svg{width:14px;height:14px}
  #combo{left:calc(10px + var(--sl));top:calc(158px + var(--st));font-size:16px;padding:2px 10px 4px;border-width:3px;border-radius:10px}
  #combo b{font-size:22px}
  #combo .heat{height:5px;margin-top:2px}
  #mute,#setBtn{top:calc(204px + var(--st));left:calc(10px + var(--sl));font-size:12px;padding:4px 10px;min-height:36px}
  #setBtn{left:calc(96px + var(--sl))}
  #clockBox{top:calc(8px + var(--st))}
  #dial{width:46px;height:46px}
  #clockTab{margin-left:-14px;height:30px;gap:8px;padding:0 10px 0 20px;border-width:2.5px;border-radius:9px}
  #day{font-size:15px}
  #clock{font-size:19px}
  #status{top:calc(52px + var(--st));font-size:11px;padding:1px 8px;border-width:2px;border-radius:6px}
  #goalsBox{right:calc(10px + var(--sr));top:calc(6px + var(--st));width:184px;transform:rotate(1deg)}
  #goalsBox .receipt{padding:12px 10px 14px}
  #goalsBox .tape{width:56px;height:14px;margin-left:-28px;top:-6px}
  #goalsBox .rh{font-size:13px}
  #goalsBox .rs{font-size:9px}
  #goalsBox .dash{margin:5px 0;border-top-width:1.5px}
  #goals li{font-size:11.5px;margin:5px 0;gap:6px;line-height:1.25}
  #goals .bx{width:14px;height:14px;border-width:2px;border-radius:3px}
  #goals .bx svg{left:-2px;top:-7px;width:20px;height:20px}
  #goalsBox .gfoot,#goalsBox .bar{display:none!important}
  #tut{top:calc(80px + var(--st));width:min(360px,calc(100vw - 420px));min-width:240px;left:50%;margin-left:0;translate:-50% 0;font-size:15px;padding:8px 14px 10px;box-shadow:0 5px 0 rgba(59,42,32,.18)}
  #tut::before{width:12px;height:12px;top:-6px;margin-left:-6px;border-width:2px}
  #toasts{top:calc(138px + var(--st));gap:4px}
  .toast{border-width:2.5px;border-radius:8px;box-shadow:0 3px 0 rgba(59,42,32,.3)}
  .toast i{font-size:11px;padding:4px 7px}
  .toast span{font-size:13px;padding:4px 10px;max-width:min(420px,calc(100vw - 120px))}
  #prompt{bottom:calc(16px + var(--sb));margin-left:0;translate:-50% 0;max-width:min(480px,calc(100vw - 420px));min-width:0}
  #prompt .tag{min-width:0;padding:6px 12px 6px 30px;border-width:3px;clip-path:polygon(18px 0,100% 0,100% 100%,18px 100%,0 50%);overflow:hidden;text-overflow:ellipsis}
  #prompt .hole{left:12px;width:10px;height:10px;margin-top:-5px;border-width:2px}
  #prompt kbd{font-size:12px;padding:0 6px;margin-right:6px;border-width:2px;border-radius:6px;box-shadow:0 2px 0 var(--ink)}
  #prompt span{font-size:14px}
  #hold{left:50%;bottom:calc(58px + var(--sb));translate:-50% 0}
  #hold .kt{padding:4px 12px 4px 24px;gap:8px;border-width:3px;clip-path:polygon(12px 0,100% 0,100% 100%,12px 100%,0 50%)}
  #hold .kt svg{width:26px;height:26px}
  #hold small{font-size:10px}
  #hold b{font-size:16px}
  #hold .pips{grid-template-columns:repeat(6,6px);gap:2px;margin-left:4px}
  #hold .pips i{width:6px;height:6px;border-width:1px}
  #cross{width:18px;height:18px;margin:-9px 0 0 -9px;border-width:2.5px}
  #cross.hot{width:28px;height:28px;margin:-14px 0 0 -14px}
  #charge{width:52px;height:52px;margin:-26px 0 0 -26px;-webkit-mask:radial-gradient(circle,transparent 18px,#000 19px);mask:radial-gradient(circle,transparent 18px,#000 19px)}
  #cctv{right:calc(24px + var(--sr));bottom:calc(70px + var(--sb));width:208px;height:117px;border-width:3px}
  body.touch #cctv{top:calc(8px + var(--st));bottom:auto;right:calc(10px + var(--sr));width:184px;height:104px}
  body.touch.out #goalsBox{display:none}
  #cctv b{font-size:11px;padding:0 5px;left:4px;top:3px}
  #cctv span{font-size:11px;padding:1px 6px;left:4px;bottom:3px}
  #cctv .rec{width:8px;height:8px;right:6px;top:6px}
  .float{font-size:30px}.float small{font-size:15px}
  #banner{top:30%}
  #banner div{font-size:34px;padding:6px 22px 8px;border-width:4px;border-radius:14px}
  #banner small{font-size:13px}
  #keys{right:10px;left:10px;bottom:10px;flex-wrap:wrap;justify-content:flex-end;gap:4px 10px;font-size:12px}
  #keys kbd{font-size:11px;padding:0 5px;min-width:24px;box-shadow:0 2px 0 var(--ink)}
  #lockHint{font-size:13px}
  body:not(.touch) #prompt{bottom:46px}
  body:not(.touch) #hold{bottom:92px}
  /* settings becomes a centred, scrollable sheet */
  #setPanel{left:0;right:0;top:0;bottom:0;margin:auto;height:fit-content;width:min(360px,calc(100vw - 32px));max-height:calc(100dvh - 24px);overflow:auto;overscroll-behavior:contain;padding:14px 16px 10px;touch-action:pan-y}
  #setPanel h4{font-size:22px;margin-bottom:2px}
  #setPanel label{min-height:40px;display:flex;align-items:center;flex-wrap:wrap;gap:4px;margin:4px 0}
  #setPanel label b{margin-left:4px}
  #setPanel input[type=range]{height:30px;flex-basis:100%}
  #setPanel input[type=checkbox]{width:22px;height:22px}
  .x{min-width:44px;min-height:40px;font-size:20px;padding:0 10px}
  /* overlays: scroll instead of zoom */
  .ovl{overflow:auto;overscroll-behavior:contain;padding:calc(8px + var(--st)) calc(8px + var(--sr)) calc(8px + var(--sb)) calc(8px + var(--sl));touch-action:pan-x pan-y}
  #pc>.crt,#cash>.drawerWrap,#card>.term,#price>.gun,#end>.soft,#pause>.pbox{margin:auto}
  /* start */
  #awn{height:46px}
  #awn i{height:40px;border-width:3px;border-radius:0 0 50% 50%/0 0 18px 18px}
  #sign{margin-top:24px;padding:8px 26px 10px;border-width:5px;border-radius:18px}
  #sign::before,#sign::after{top:-34px;height:30px;width:4px}
  #sign::before{left:50px}#sign::after{right:50px}
  #sign .dots{inset:6px;border-width:2px;border-radius:12px}
  #sign h1{font-size:56px;-webkit-text-stroke:6px var(--ink);letter-spacing:3px}
  #sign p{font-size:11px;letter-spacing:2px}
  #hang{margin-top:26px;transform-origin:50% -22px}
  #hang::before{top:-24px;height:24px;width:70px;margin-left:-35px;border-width:3px}
  #startBtn{font-size:30px;padding:6px 30px 8px;border-width:4px;border-radius:14px;letter-spacing:4px;box-shadow:0 6px 0 var(--ink)}
  #startBtn small{font-size:12px}
  #start .btns{margin-top:18px;gap:10px}
  #start .btns button{font-size:15px;padding:8px 16px;min-width:118px;min-height:44px}
  #helpBox{position:fixed;inset:0;margin:auto;z-index:6;width:min(660px,calc(100vw - 24px - var(--sl) - var(--sr)));height:fit-content;max-height:calc(100dvh - 24px);overflow:auto;overscroll-behavior:contain;font-size:14px;line-height:1.85;padding:14px 18px 16px;touch-action:pan-y;border-radius:12px}
  #helpBox .helpClose{display:block;position:sticky;top:0;float:right;margin:-4px -8px 4px 8px}
  #helpBox kbd{font-size:12px;padding:0 5px;min-width:24px}
  #note{width:132px;font-size:14px;padding:8px 10px;right:calc(18px + var(--sr));bottom:calc(16px + var(--sb))}
  #ver{left:calc(14px + var(--sl));bottom:calc(10px + var(--sb));font-size:12px}
  /* PC */
  .crt{padding:8px 10px 22px;border-width:4px;border-radius:22px}
  .crt .glass{padding:5px;border-width:3px;border-radius:14px}
  .crt .desk{padding:5px;border-radius:10px}
  .crt .brand{left:22px;bottom:2px;font-size:13px}
  .crt .led{right:22px;bottom:5px;width:10px;height:10px;border-width:2px}
  .crt .sticky{display:none}
  .win{width:min(980px,calc(100vw - 80px - var(--sl) - var(--sr)));height:min(560px,calc(100dvh - 96px - var(--st) - var(--sb)))}
  .title{font-size:14px;padding:2px 2px 2px 8px}
  .title button{min-width:54px;min-height:40px;font-size:16px;padding:0 8px;line-height:1}
  .tabs{padding:5px 5px 0;gap:3px}
  .tabs button{font-size:14px;padding:6px 14px;min-height:42px}
  .tabs button.on{padding:8px 12px}
  #pcMoney{font-size:19px;padding:0 4px 4px}
  #pcBody{margin:0 5px 5px;padding:8px;overscroll-behavior:contain;touch-action:pan-y;-webkit-overflow-scrolling:touch}
  .grid{grid-template-columns:repeat(auto-fill,minmax(196px,1fr));gap:8px}
  .card{grid-template-columns:42px 1fr;padding:6px 8px;gap:0 8px}
  .card .ic{width:42px;height:42px}
  .card b{font-size:15px}.card .sm{font-size:11px}.card .pr{font-size:16px}
  .card button{font-size:14px;min-height:44px;margin-top:6px;padding:4px}
  .card .low{font-size:11px;right:-4px;top:-4px}
  .card.up .hd{font-size:15px;padding:6px 10px}
  .card.up .sm{padding:6px 10px 0;min-height:0;font-size:12px}
  .card.up button{margin:8px 10px 10px}
  .own{font-size:15px;margin:8px 10px 10px;border-width:3px}
  .orders{font-size:13px;padding:6px 8px;gap:8px;margin-top:8px;flex-wrap:wrap}
  .truck{width:46px;height:22px}
  .prog{height:16px;min-width:80px}
  /* cash drawer */
  .drawerWrap{width:min(760px,100%)}
  .regTop{padding:8px;gap:8px;border-width:4px;border-radius:16px}
  .regTop .lcd{padding:4px 0}
  .regTop .lcd div{padding:2px 10px;border-right-width:2px}
  .regTop .lcd small{font-size:11px}
  .regTop .lcd b{font-size:28px}
  #cGiven{font-size:20px!important}
  .side2{gap:6px}
  .side2 button,#cFake,#cUndo{font-size:13px;padding:4px 10px;min-height:40px}
  #cOk{font-size:26px;padding:4px 16px;border-radius:12px}
  #cTray{margin:8px 0 0;min-height:52px;padding:5px 8px;gap:5px;border-width:3px;border-radius:12px;box-shadow:inset 0 0 0 4px #5E666C}
  #cTray .hint{font-size:13px;padding-left:6px}
  .tray{font-size:18px;padding:2px 9px;border-width:2px;border-left-width:7px}
  .tray.b1,.tray.b0_5{width:38px;height:38px;font-size:17px;border-left-width:2px}
  #denoms{margin-top:8px;padding:8px;gap:8px;border-width:4px;border-radius:14px}
  #denoms .bill{height:58px;font-size:26px}
  #denoms .coin{height:52px;font-size:19px!important;padding:0;white-space:nowrap}
  #denoms .coinRow{padding:5px;gap:22px;border-width:2px}
  .bill::before{inset:4px;border-width:2px}
  .bill::after{width:30px;height:30px;margin:-15px}
  /* card terminal */
  .term{display:grid;grid-template-columns:1fr 1fr;gap:0 16px;width:min(640px,100%);padding:14px 16px 16px;border-width:4px;border-radius:24px;align-items:start}
  .term::before{display:none}
  .term .tt{grid-column:1;font-size:15px;margin-bottom:8px}
  .term .tt i{width:12px;height:12px;border-width:2px}
  .term .lcd{grid-column:1;padding:8px 12px;margin-bottom:0}
  .term .lcd .r{font-size:13px}.term .lcd .r b{font-size:22px}
  #kDisp{font-size:48px}
  #keypad{grid-column:2;grid-row:1/span 3;gap:7px}
  #keypad button{font-size:26px;min-height:46px;padding:0;border-radius:10px}
  #keypad button[data-k="⌫"]{font-size:15px}
  #keypad .ok{font-size:20px}
  .cardPic{display:none}
  .term .x{grid-column:1;position:static;margin-top:12px;justify-self:start}
  /* price gun */
  .gun{width:min(740px,100%);display:flex;gap:12px;align-items:flex-start}
  .gunBody{flex:1;padding:14px 14px 14px;border-width:4px;border-radius:30px 30px 22px 22px}
  .gunGrip{display:none}
  .gun .lcd{height:auto;grid-template-columns:52px 1fr auto;gap:10px;padding:8px 14px}
  .gun .lcd svg{width:50px;height:50px}
  #prE{font-size:20px}#prE small{font-size:11px}
  #prV{font-size:54px}
  .pRow{margin-top:10px;gap:8px}
  .pRow button{width:64px;min-height:56px;font-size:36px;border-radius:14px}
  #prInfo{font-size:12px;padding:6px 8px;border-width:3px;gap:2px 6px}
  #prInfo b{font-size:16px}
  #prInfo .pf{font-size:13px;padding-top:3px}
  #prInfo .pf b{font-size:22px}
  .gunBody .x{right:10px;top:-14px}
  .meter{position:relative;right:auto;top:auto;width:190px;flex:none;padding:12px 12px 10px;font-size:12px;line-height:1.6;border-width:3px}
  .meter h4{font-size:18px}
  .meter .seg{margin:6px 0 2px}
  .meter .seg i{border-width:2px;font-size:12px}
  /* end of day */
  #end .receipt{width:min(420px,calc(100vw - 32px));max-height:none;padding:24px 18px 26px}
  #end .rh{font-size:30px}
  .rows{font-size:14px;gap:3px 14px}
  .rows b{font-size:18px}
  .rows .big{font-size:18px}.rows b.big{font-size:26px}
  .gl li{font-size:13px;margin:5px 0;gap:8px}
  .gl b{font-size:16px}
  #stamp{width:92px;height:92px;font-size:24px;border-width:5px;right:calc(5% + var(--sr));top:22%;pointer-events:none}
  #stamp small{font-size:11px}
  #nextDay{font-size:24px;padding:8px 22px;right:calc(16px + var(--sr));bottom:calc(16px + var(--sb));border-width:4px;box-shadow:0 6px 0 var(--ink)}
}
/* portrait phones (when the player chose to keep portrait) */
@media (max-width:600px){
  #goalsBox{width:min(184px,calc(100vw - 210px))}
  #clockBox{left:auto;right:calc(10px + var(--sr));transform:none;top:calc(150px + var(--st))}
  #status{left:auto;right:calc(10px + var(--sr));transform:rotate(-3deg);top:calc(194px + var(--st))}
  #tMenu{right:auto;left:calc(10px + var(--sl));top:calc(204px + var(--st))}
  #tut{top:calc(240px + var(--st));width:calc(100vw - 40px);min-width:0}
  #toasts{top:calc(300px + var(--st))}
  .toast span{max-width:calc(100vw - 90px)}
  #prompt{bottom:calc(206px + var(--sb));max-width:calc(100vw - 24px)}
  #hold{bottom:calc(252px + var(--sb))}
  #cctv{top:calc(8px + var(--st))}
  .term{grid-template-columns:1fr;width:min(380px,100%)}
  .regTop{flex-wrap:wrap}
  .regTop .lcd{flex-basis:100%}
  .regTop .side2{flex-direction:row;flex:1}
  .regTop .side2 button{flex:1}
  #cOk{flex:1}
  #keypad{grid-column:1;grid-row:auto;margin-top:12px}
  .gun{flex-direction:column;align-items:stretch}
  .meter{width:auto}
  #sign h1{font-size:50px}
  #start .btns{flex-wrap:wrap;justify-content:center}
  #note{display:none}
  #stamp{width:70px;height:70px;font-size:18px;top:calc(10px + var(--st));right:calc(10px + var(--sr))}
  .grid{grid-template-columns:1fr}
  .win{width:calc(100vw - 60px)}
}
/* very short landscape (e.g. 360-390px tall) */
@media (max-height:400px){
  #goals li{margin:3px 0}
  #tStick{width:120px;height:120px}
  #denoms .bill{height:50px}
  #denoms .coin{height:46px}
  #keypad button{min-height:44px}
}
