/* Shared iPhone / standalone additions; desktop identity stays unchanged. */
html{-webkit-text-size-adjust:100%;touch-action:auto}
.install-app{font:600 14px system-ui;color:#d3e6f3;border:1px solid #a0bdce55;background:#102233cf;border-radius:12px;padding:12px 18px;min-height:44px;margin:12px auto;cursor:pointer;touch-action:manipulation}
.app-install-dialog{box-sizing:border-box;width:min(440px,calc(100% - 32px));max-height:85dvh;overflow:auto;padding:24px;color:#eff7ff;background:#122234;border:1px solid #608195;border-radius:20px;font:16px/1.55 system-ui;touch-action:pan-y;user-select:text;-webkit-user-select:text}
.app-install-dialog *{touch-action:pan-y}.app-install-dialog::backdrop{background:#020914bb}.app-install-dialog h2{font-size:24px;margin-top:0}.app-install-dialog ol{padding-left:22px}.app-install-dialog li{margin:12px 0}.app-install-dialog p{color:#becfdd}.app-install-dialog button{min-height:44px;width:100%;font:600 16px system-ui;background:#75dbd8;color:#082432;border:0;border-radius:10px;padding:12px}
.mobile-table-hint{display:none}
@media(max-width:700px){
  body:not(.racer-body) input,body:not(.racer-body) select,body:not(.racer-body) textarea{font-size:16px!important;min-height:44px}
  .login-body,.home-body{min-height:100svh;background-attachment:scroll}
  body.login-body{background-size:100% auto;background-color:#08111e}
  .login-body .login-page{min-height:100svh;justify-content:center;padding:clamp(170px,28vw,230px) max(18px,env(safe-area-inset-right)) max(20px,env(safe-area-inset-bottom)) max(18px,env(safe-area-inset-left))}
  .login-body .profiles{grid-template-columns:repeat(2,minmax(90px,120px));gap:18px 30px}
  .login-body .avatar{width:clamp(82px,23vw,104px);height:clamp(82px,23vw,104px)}
  .login-body .profile-name{margin-top:7px}
  .login-body .login-form{margin-top:22px}
  .login-body .submit{width:44px;height:44px;flex-shrink:0}
  .login-body footer,.home-body footer{position:static;margin:0;padding:12px 16px max(18px,env(safe-area-inset-bottom))}
  .home-body .home-page{min-height:calc(100svh - 56px);padding:90px max(20px,env(safe-area-inset-right)) 28px max(20px,env(safe-area-inset-left))}
  .home-body .home-page h1{font-size:clamp(38px,11vw,64px)}
  .home-body .family{font-size:14px;letter-spacing:.12em}
  .home-body .logout-form{top:max(16px,env(safe-area-inset-top));right:max(16px,env(safe-area-inset-right))}
  .tony-body .shell{padding:env(safe-area-inset-top) max(16px,env(safe-area-inset-right)) env(safe-area-inset-bottom) max(16px,env(safe-area-inset-left));max-width:100%}
  .tony-body .topbar{height:auto;min-height:90px;flex-wrap:wrap;gap:12px;padding:16px 0}
  .tony-body .topbar nav{flex-wrap:wrap;gap:16px}.tony-body .topbar nav>a{display:inline-flex;align-items:center;min-height:44px}
  .tony-body button{min-height:44px}.tony-body .page-heading{margin-top:24px}
  .tony-body .stats strong{font-size:clamp(17px,5vw,25px);overflow-wrap:anywhere}.tony-body .stats article{min-width:0}
  .tony-body .statusbar{flex-wrap:wrap;gap:10px}.tony-body .value-fields,.tony-body .valuation{min-width:0}
  .tony-body .ledger{min-width:0;max-width:100%}.tony-body .table-scroll{overscroll-behavior-x:contain;-webkit-overflow-scrolling:touch}
  .tony-body .mobile-table-hint{display:block;font-size:13px;color:#b4c8d5;padding:0 18px}
  .tony-body table th:first-child,.tony-body table td:first-child{position:sticky;left:0;z-index:1;background:#19212b;box-shadow:2px 0 8px #0003}
  .tony-body dialog{max-height:calc(100dvh - 32px);width:calc(100% - 24px);padding:20px}
  .tony-body .weeks{grid-template-columns:repeat(2,minmax(0,1fr))}.tony-body .form-grid{grid-template-columns:minmax(0,1fr)}
  .tony-body label{font-size:14px}.tony-body .table-tools{flex-wrap:wrap}.tony-body .dialog-actions{flex-wrap:wrap}
}
@media(max-height:500px) and (orientation:landscape){
  .login-body .login-page{min-height:100svh;padding:40px max(24px,env(safe-area-inset-right)) 16px max(24px,env(safe-area-inset-left));justify-content:flex-end}
  .login-body .profiles{grid-template-columns:repeat(4,80px);gap:22px}.login-body .avatar{width:70px;height:70px}.login-body .login-form{margin-top:14px}
}
/* Keep phone controls clear of the notch and home indicator in both orientations. */
.racer-body{height:100dvh;touch-action:auto}.racer-body #race{height:100dvh}
@media(max-width:950px){
  .racer-body header{left:max(10px,env(safe-area-inset-left));right:max(10px,env(safe-area-inset-right));top:max(8px,env(safe-area-inset-top));gap:6px}
  .racer-body nav button{min-height:44px}
  .racer-body .controls{left:max(10px,env(safe-area-inset-left));right:max(10px,env(safe-area-inset-right));bottom:max(12px,env(safe-area-inset-bottom))}
  .racer-body #overlay,.racer-body #pause-panel,.racer-body #finish{padding: max(24px,env(safe-area-inset-top)) max(22px,env(safe-area-inset-right)) max(24px,env(safe-area-inset-bottom)) max(22px,env(safe-area-inset-left));touch-action:pan-y;overscroll-behavior:contain}
  .racer-body #overlay *,.racer-body #pause-panel *,.racer-body #finish *{touch-action:pan-y}
  .racer-body #pause-panel,.racer-body #finish{align-items:safe center}
  .racer-body #garage-panel{padding:max(18px,env(safe-area-inset-top)) max(16px,env(safe-area-inset-right)) max(24px,env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left))}
  .racer-body .garage-top{flex-wrap:wrap}.racer-body .garage-top h2{font-size:28px}
  .racer-body .instructions{font-size:13px}.racer-body .map-choices small{font-size:12px}
}
@media(max-width:600px) and (orientation:portrait){
  .racer-body header .brand{display:none}.racer-body header nav{width:100%;justify-content:space-between}.racer-body header .timing{gap:8px}
  .racer-body #turn{top:calc(112px + env(safe-area-inset-top));left:14px}.racer-body #minimap{top:calc(112px + env(safe-area-inset-top));right:12px;width:85px;height:73px}
  .racer-body .controls>div:first-child,.racer-body .controls>div:last-child{--pedal:clamp(54px,18vw,80px);--drift:58px;gap:6px}
  .racer-body .speed{bottom:calc(166px + env(safe-area-inset-bottom));right:16px}.racer-body .nitro{width:100px}
  .racer-body #drift-feedback strong{font-size:25px}.racer-body #drift-feedback small{display:none}
}
@media(max-height:500px) and (orientation:landscape){
  .racer-body header{padding:4px 8px}.racer-body header .brand{display:none}.racer-body .timing{gap:16px}.racer-body .timing b{font-size:14px}
  .racer-body #turn{top:70px;left:max(16px,env(safe-area-inset-left))}.racer-body #turn-arrow{font-size:30px}.racer-body #turn b{font-size:14px}.racer-body #turn small{font-size:9px}
  .racer-body #minimap{top:70px;right:max(16px,env(safe-area-inset-right));width:85px;height:73px}
  .racer-body .controls>div:first-child,.racer-body .controls>div:last-child{--pedal:64px;--drift:48px;gap:6px}
  .racer-body .speed{bottom:calc(28px + env(safe-area-inset-bottom));right:calc(162px + env(safe-area-inset-right))}.racer-body .speed>b{font-size:32px}.racer-body .speed>span{font-size:10px}.racer-body .nitro{width:85px}
  .racer-body #drift-feedback{top:27%}.racer-body #drift-feedback strong{font-size:24px}.racer-body #drift-feedback small{display:none}
  .racer-body #wrong-way{font-size:16px;padding:6px 10px}.racer-body #wrong-way small{font-size:9px}
}
