html, body { margin: 0; height: 100%; overflow: hidden; background: #000; touch-action: none; overscroll-behavior: none;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; font-family: system-ui, sans-serif; }
canvas { display: block; position: fixed; inset: 0; }
:root { --inset: 22px; --btn: 84px; }
.hidden { display: none !important; }
#hud { position: fixed; left: 50%; top: calc(var(--inset) / 2 + env(safe-area-inset-top)); transform: translateX(-50%); z-index: 10; pointer-events: none;
  color: #fff; background: #000; border: 3px solid #fff; border-radius: 14px; padding: 4px 16px; font-weight: 900; font-size: 20px; white-space: nowrap; }
#hud b { font-size: 30px; color: #ffe600; } #gear { color: #ff3b3b; font-size: 26px; }
.big-btn { position: fixed; z-index: 20; width: var(--btn); height: var(--btn); border-radius: 22px; background: #000; color: #fff; border: 5px solid #fff;
  font: 900 46px/1 system-ui, sans-serif; display: flex; align-items: center; justify-content: center; padding: 0; touch-action: none; }
/* inset the same distance from the side and the bottom, plus the safe area (clear of the camera cutout) */
#btnSet { left: calc(var(--inset) + env(safe-area-inset-left)); bottom: calc(var(--inset) + env(safe-area-inset-bottom)); }
/* pressed: glow, pop slightly bigger, then fade back */
@keyframes pop { 0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255,230,0,0); }
  30% { transform: scale(1.14); box-shadow: 0 0 22px 8px rgba(255,230,0,.95); background: #ffe600; color: #000; border-color: #000; }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255,230,0,0); } }
.pop { animation: pop .45s ease-out; }
#set { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.82); display: flex; align-items: center; justify-content: center; }
#set .panel { background: #111; color: #fff; border: 4px solid #fff; border-radius: 22px; padding: 8px 22px; width: min(94vw, 760px); max-height: 94vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px; touch-action: pan-y; }
#set h2 { margin: 0; text-align: center; font-size: 26px; } #set .hint { margin: 0 0 4px; text-align: center; font-size: 15px; font-weight: 700; color: #ccc; }
#set .row { display: grid; grid-template-columns: 210px 1fr 72px; align-items: center; gap: 12px; font-size: 19px; font-weight: 900; min-height: 50px; } #set .row b { color: #ffe600; text-align: right; }
#set input[type=range] { width: 100%; height: 46px; margin: 0; -webkit-appearance: none; background: none; accent-color: #ffe600; touch-action: none; }
#set input[type=range]::-webkit-slider-runnable-track { height: 12px; background: #fff; border-radius: 6px; }
#set input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 40px; height: 40px; margin-top: -14px; border-radius: 50%; background: #ffe600; border: 4px solid #000; }
#set .btns { display: flex; gap: 12px; justify-content: center; margin-top: 8px; }
.pbtn { font: 900 22px system-ui, sans-serif; padding: 12px 20px; min-height: 60px; border-radius: 18px; border: 4px solid #000; background: #ffe600; color: #000; }
.pbtn.alt { background: #000; color: #fff; border-color: #fff; }
#start { position: fixed; inset: 0; z-index: 50; background: #000; color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 20px; text-align: center; }
#start button { font: 900 34px system-ui, sans-serif; padding: 22px 40px; border-radius: 24px; border: 5px solid #000; background: #ffe600; color: #000; min-height: 96px; }
#start p { font-size: 21px; font-weight: 800; max-width: 680px; margin: 0; line-height: 1.3; }
#toast { position: fixed; left: 50%; top: 70px; transform: translateX(-50%); z-index: 45; background: #000; color: #ffe600; border: 3px solid #ffe600; border-radius: 14px;
  padding: 10px 18px; font: 900 20px system-ui, sans-serif; pointer-events: none; white-space: nowrap; }
#rotate { display: none; position: fixed; inset: 0; z-index: 60; background: #000; color: #fff; flex-direction: column; align-items: center; justify-content: center; gap: 24px; text-align: center; padding: 24px; }
#rotate p { font-size: 26px; font-weight: 900; margin: 0; }
#rotate .phone { width: 70px; height: 120px; border: 6px solid #ffe600; border-radius: 14px; animation: turn 1.6s ease-in-out infinite; }
@keyframes turn { 0%, 20% { transform: rotate(0); } 60%, 100% { transform: rotate(-90deg); } }
@media (orientation: portrait) { #rotate { display: flex; } }
