:root {
  --bg: #121731; --panel: #1c2348; --ink: #f4f6ff; --muted: #a9b3d8; --gold: #ffd54a;
  --green: #2fb862; --blue: #3a7bea; --orange: #f08a2c; --seat: #ff8c26;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: "Kanit", "Leelawadee UI", Tahoma, sans-serif; overflow: hidden; user-select: none; -webkit-user-select: none; touch-action: none; }
button, input { font-family: inherit; }
.screen { position: fixed; inset: 0; display: flex; flex-direction: column; }
[hidden] { display: none !important; }

#connect { align-items: center; justify-content: center; gap: 10px; padding: 16px; overflow-y: auto; touch-action: auto; }
h1 { margin: 0; color: var(--gold); font-size: 44px; font-weight: 800; line-height: 1; }
.sub { margin: 0; font-size: 18px; }
.status { color: var(--muted); min-height: 1.4em; text-align: center; margin: 6px 0; }
.rooms { display: flex; flex-direction: column; gap: 8px; width: min(420px, 100%); }
.code { display: flex; flex-direction: column; gap: 6px; width: min(420px, 100%); }
.code label, .sheet label { color: var(--muted); font-size: 14px; }
input { background: #0b0f24; color: var(--ink); border: 2px solid #33407a; border-radius: 12px; font-size: 22px; padding: 10px 12px; }
#code { text-transform: uppercase; letter-spacing: 8px; text-align: center; font-size: 30px; font-weight: 800; }
.big { min-height: 56px; border: 0; border-radius: 14px; background: var(--green); color: #fff; font-size: 22px; font-weight: 600; }
.mid { min-height: 48px; border: 0; border-radius: 12px; background: #2d3770; color: #fff; font-size: 18px; padding: 0 14px; flex: 1; }
.mid.ready { background: var(--green); }
.mid.on { outline: 3px solid var(--gold); }
.danger { background: #8c2b2b; }
.icon { border: 0; background: transparent; color: var(--ink); font-size: 28px; width: 48px; height: 48px; }

#pad header { display: flex; align-items: center; gap: 10px; padding: 6px 10px; padding-top: max(6px, env(safe-area-inset-top)); background: rgba(0,0,0,0.25); }
.seat { background: var(--seat); color: #fff; font-weight: 800; border-radius: 10px; padding: 2px 10px; font-size: 20px; }
.who { font-weight: 600; font-size: 18px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.phase { color: var(--muted); font-size: 14px; }
.lobbybar { display: flex; gap: 8px; padding: 8px 10px; }

.layout { flex: 1; display: flex; position: relative; }
.stickArea { flex: 1; position: relative; }
.stickArea .hint { position: absolute; left: 0; right: 0; bottom: 10px; text-align: center; color: var(--muted); margin: 0; font-size: 14px; }
.base { position: absolute; width: 150px; height: 150px; border-radius: 50%; background: rgba(255,255,255,0.12); border: 2px solid rgba(255,255,255,0.25); left: 50%; top: 50%; transform: translate(-50%, -50%); }
.knob { position: absolute; width: 66px; height: 66px; border-radius: 50%; background: rgba(255,255,255,0.6); left: 50%; top: 50%; transform: translate(-50%, -50%); }
.buttons { width: 46%; position: relative; }
.btn { position: absolute; border: 0; border-radius: 50%; color: #fff; font-weight: 800; font-size: 20px; display: flex; flex-direction: column; align-items: center; justify-content: center; box-shadow: 0 6px 0 rgba(0,0,0,0.3); }
.btn small { font-weight: 400; font-size: 12px; opacity: 0.9; }
.btn.pressed { transform: translateY(4px); box-shadow: 0 2px 0 rgba(0,0,0,0.3); filter: brightness(1.15); }
.btn.green { background: var(--green); width: 150px; height: 150px; right: 16px; bottom: 18px; font-size: 22px; }
.btn.blue { background: var(--blue); width: 100px; height: 100px; right: 176px; bottom: 30px; }
.btn.orange { background: var(--orange); width: 100px; height: 100px; right: 40px; bottom: 182px; }

.oneArea { flex: 1; position: relative; background: radial-gradient(circle at 50% 60%, rgba(47,184,98,0.18), transparent 60%); }
.bigHint { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); text-align: center; color: var(--muted); font-size: 20px; margin: 0; pointer-events: none; }
.oneArea.tapped { background: radial-gradient(circle at 50% 60%, rgba(255,213,74,0.35), transparent 60%); }

.sheet { position: fixed; inset: 0; background: rgba(10,14,34,0.97); padding: 20px 16px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; touch-action: auto; }
.sheet h2 { margin: 0; color: var(--gold); }
.row { display: flex; gap: 10px; }
.small { color: var(--muted); font-size: 14px; word-break: break-all; }

@media (orientation: portrait) {
  .buttons { width: 56%; }
  .btn.green { width: 130px; height: 130px; }
  .btn.blue { right: 152px; }
}
