/* Slopfighter phone pad: the game's playset look (UITokens): sky gradient, white/colour faces, navy ink, chunky lip. */
@font-face { font-family: Fredoka; src: url(/fonts/Fredoka-VF.ttf); font-weight: 300 700; font-display: swap; }
@font-face { font-family: Nunito; src: url(/fonts/Nunito-VF.ttf); font-weight: 200 1000; font-display: swap; }
:root {
  --navy: #1B2559; --navy-dim: #4A5688; --edge: #D5DCF5; --edge-lo: #9AA6D8;
  --sky-hi: #BFE5FF; --sky-lo: #FFF1D2;
  --mint: #22C58B; --mint-lo: #12905F; --tomato: #E8412B; --tomato-lo: #A82614;
  --sky: #2F8CFF; --sky-d: #1A5FC4; --lemon: #FFD23F; --lemon-lo: #C79A12; --tangerine: #FF8A1F; --tangerine-lo: #B8560A;
  --lip: 6px; --lip-p: 2px;
  --s: clamp(44px, 17dvh, 76px);      /* face-button edge: everything scales from the visible height */
  --pad: max(10px, 2.4dvh);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; color: var(--navy); font: 800 14px Nunito, system-ui, sans-serif;
  background: linear-gradient(var(--sky-hi), var(--sky-lo)) fixed;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; overscroll-behavior: none; }

#pad { position: fixed; inset: 0; height: 100dvh; display: grid; grid-template-columns: 1fr auto 1fr; grid-template-rows: auto 1fr; gap: 0 12px;
  padding: max(var(--pad), env(safe-area-inset-top)) max(var(--pad), env(safe-area-inset-right)) max(var(--pad), env(safe-area-inset-bottom)) max(var(--pad), env(safe-area-inset-left)); }

/* Buttons: white face, EDGE lip. Pressed: face drops by the lip difference, lip shrinks. */
.b { font: 700 calc(var(--s) * .4) Fredoka, system-ui, sans-serif; color: var(--navy); background: #fff; border: 0; padding: 0; margin: 0;
  box-shadow: 0 var(--lip) 0 var(--edge-lo); touch-action: none; transform: translateY(0); }
.b.on { transform: translateY(calc(var(--lip) - var(--lip-p))); box-shadow: 0 var(--lip-p) 0 var(--edge-lo); }
.b span { pointer-events: none; }
.b { position: relative; display: flex; align-items: center; justify-content: center; }
/* iOS haptics: a see-through switch covers each button, so the finger's tap is a real tap on a switch (iOS ticks only then). */
.b .hx { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: .011; }

.shoulder { height: clamp(32px, 9dvh, 42px); width: min(30vw, 200px); border-radius: 999px; font-size: 17px; margin-bottom: var(--lip); }
#L { grid-column: 1; grid-row: 1; justify-self: start; }
#R { grid-column: 3; grid-row: 1; justify-self: end; }

#status { grid-column: 2; grid-row: 1; align-self: start; display: flex; align-items: center; gap: 6px; height: 26px; padding: 0 12px; border-radius: 999px;
  background: rgba(255,255,255,.85); font-size: 12px; color: var(--navy-dim); pointer-events: none; white-space: nowrap; }
#status i { width: 8px; height: 8px; border-radius: 50%; background: var(--tangerine); }
#status[data-ok="1"] i { background: var(--mint); }

#stickzone { grid-column: 1; grid-row: 2; display: flex; align-items: center; justify-content: center; min-height: 0; }
.base { position: relative; border-radius: 50%; background: rgba(255,255,255,.45); border: 4px solid rgba(255,255,255,.9); box-shadow: 0 var(--lip) 0 rgba(154,166,216,.55); flex: none; }
#lbase { width: min(calc(var(--s) * 3), 100%); aspect-ratio: 1; }
#right { grid-column: 3; grid-row: 2; justify-self: end; align-self: end; display: flex; align-items: flex-end; gap: calc(var(--s) * .3); min-height: 0; }
.base.small { width: calc(var(--s) * 1.5); height: calc(var(--s) * 1.5); margin-bottom: var(--lip); }
.knob { position: absolute; left: 50%; top: 50%; width: 46%; height: 46%; margin: -23% 0 0 -23%; border-radius: 50%; background: var(--sky);
  box-shadow: 0 var(--lip) 0 var(--sky-d); will-change: transform; }
#cknob { background: var(--tangerine); box-shadow: 0 var(--lip) 0 var(--tangerine-lo); }
.knob.rel { transition: transform .14s cubic-bezier(.3,1.4,.5,1); }

#face { display: grid; gap: 6px; grid-template-areas: ". y ." "x . b" ". a ."; grid-template-columns: repeat(3, var(--s)); grid-template-rows: repeat(3, var(--s)); margin-bottom: var(--lip); }
#face .b { width: var(--s); height: var(--s); border-radius: 50%; color: #fff; }
.f-a { background: var(--mint); box-shadow: 0 var(--lip) 0 var(--mint-lo); }     .f-a.on { box-shadow: 0 var(--lip-p) 0 var(--mint-lo); }
.f-b { background: var(--tomato); box-shadow: 0 var(--lip) 0 var(--tomato-lo); } .f-b.on { box-shadow: 0 var(--lip-p) 0 var(--tomato-lo); }
.f-x { background: var(--sky); box-shadow: 0 var(--lip) 0 var(--sky-d); }        .f-x.on { box-shadow: 0 var(--lip-p) 0 var(--sky-d); }
.f-y { background: var(--lemon); color: var(--navy); box-shadow: 0 var(--lip) 0 var(--lemon-lo); } .f-y.on { box-shadow: 0 var(--lip-p) 0 var(--lemon-lo); }

#start { grid-column: 2; grid-row: 2; align-self: end; height: clamp(30px, 8dvh, 38px); padding: 0 22px; border-radius: 999px; font-size: 13px; letter-spacing: .08em; margin-bottom: var(--lip); }

#hx { position: fixed; opacity: 0; pointer-events: none; left: -50px; top: 0; }

/* Connection screens */
#msg { position: fixed; inset: 0; background: linear-gradient(var(--sky-hi), var(--sky-lo)); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 5; }
#msg:has(#msgtext:empty):has(#entry[hidden]) { display: none; }
#msg .card { max-width: min(460px, 100%); background: #fff; border-radius: 28px; padding: 20px 24px; text-align: center; box-shadow: 0 8px 0 var(--edge-lo); }
#msgtext { margin: 0; font: 600 clamp(16px, 5dvh, 20px)/1.3 Fredoka, system-ui, sans-serif; }
#msgtext:empty { display: none; }
#entry { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 14px; }
#entry[hidden] { display: none; }
#entry:first-child { margin-top: 0; }
#entry input { font: 700 clamp(24px, 8dvh, 34px) Fredoka, system-ui, sans-serif; letter-spacing: .12em; width: 4.6em; text-align: center; text-transform: uppercase; padding: 6px 0;
  border-radius: 999px; border: 3px solid var(--edge); background: #fff; color: var(--navy); outline: none; }
#entry input:focus { border-color: var(--sky); }
#entry button { font: 700 18px Fredoka, system-ui, sans-serif; padding: 10px 24px; border-radius: 999px; border: 0; background: var(--mint); color: #fff;
  box-shadow: 0 var(--lip) 0 var(--mint-lo); }
#entry button:active { transform: translateY(4px); box-shadow: 0 var(--lip-p) 0 var(--mint-lo); }
#rotate { display: none; position: fixed; inset: 0; background: linear-gradient(var(--sky-hi), var(--sky-lo)); flex-direction: column; align-items: center; justify-content: center; gap: 22px; z-index: 9;
  font: 600 22px Fredoka, system-ui, sans-serif; }
#rotate p { margin: 0; }
#rotate .phone { width: 44px; height: 76px; border-radius: 10px; background: #fff; border: 4px solid var(--navy); box-shadow: 0 var(--lip) 0 var(--edge-lo); animation: turn 2.2s ease-in-out infinite; will-change: transform; }
@keyframes turn { 0%, 25% { transform: rotate(0); } 60%, 100% { transform: rotate(-90deg); } }
@media (prefers-reduced-motion: reduce) { #rotate .phone { animation: none; transform: rotate(-90deg); } .knob.rel { transition: none; } }
@media (orientation: portrait) { #rotate { display: flex; } }
