html, body { position: fixed; inset: 0; width: 100%; overflow: hidden; overscroll-behavior: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.screen { position: fixed; inset: 0; display: grid; place-items: center; padding: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left)); overflow: auto; }
.card { padding: 20px; }
.form { width: min(100%, 420px); display: grid; gap: 14px; }
.center { text-align: center; }
.form h1 { font-size: 2rem; line-height: 1; color: var(--gold); }
.form .logo { font-size: 1.5rem; }
label { display: grid; gap: 6px; font-family: var(--disp); font-size: 1.3rem; color: var(--cream); }
input { font: inherit; font-family: var(--disp); font-size: 2rem; color: var(--ink); background: #ffe9c4; border: 3px solid var(--ink); border-radius: 16px; padding: 6px 14px; width: 100%; -webkit-user-select: text; user-select: text; box-shadow: inset 0 4px 0 rgba(173, 78, 26, .35); }
#inCode { text-transform: uppercase; letter-spacing: .3em; text-align: center; font-size: 2.6rem; }
input:focus { outline: none; background: #fff6df; border-color: var(--orange); }
.err { background: var(--red); color: #fff; border: 3px solid var(--ink); padding: 8px 12px; font-size: 1rem; }
.tip { color: var(--cream); font-size: .85rem; margin: 0; }
.mut { color: var(--paper); margin: 0; }
.btn { font-size: 1.8rem; }
.btn.small { font-size: 1.1rem; padding: .35em .9em; }
.link { background: none; border: 0; color: var(--cream); text-decoration: underline; font-size: .9rem; padding: 6px; font-family: var(--body); }
.meav { flex: none; display: grid; place-items: center; }
.meav.big { margin: 0 auto; }

/* ---- Salon ---- */
.lobby { width: min(100%, 880px); height: 100%; display: grid; grid-template-rows: auto 1fr; gap: 14px; min-height: 0; }
.me { display: grid; grid-template-columns: auto 1fr; gap: 10px 12px; align-items: center; }
.me .ready { grid-column: 1 / -1; font-size: 1.6rem; }
.me .ready.on { filter: saturate(.5) brightness(1.08); }
.me .small, .me .link { grid-column: 1 / -1; justify-self: center; }
.mename { display: grid; min-width: 0; }
.mename span { font-family: var(--disp); font-size: 1.8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1; color: var(--paper); }
.mename small { color: var(--gold); font-family: var(--disp); font-size: 1.3rem; letter-spacing: .25em; }
.list { min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 10px; -webkit-overflow-scrolling: touch; padding: 2px 8px 8px 2px; }
.info { text-align: center; font-family: var(--disp); font-size: 1.4rem; color: var(--paper); text-shadow: 2px 2px 0 var(--ink); }
#plist { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
#plist li { display: flex; align-items: center; gap: 10px; padding: 2px 10px 2px 6px; background: var(--earth) #4a2a14; background-size: auto, 230px; border: 3px solid var(--ink); border-radius: 18px; box-shadow: inset 0 0 0 3px rgba(255,214,150,.16), 0 6px 14px rgba(20,10,3,.4); }
#plist li.ready { background-color: #123b0c; box-shadow: inset 0 0 0 3px var(--leaf), 0 6px 14px rgba(20,10,3,.4); }
#plist li.idle { box-shadow: inset 0 0 0 3px var(--orange), 0 6px 14px rgba(20,10,3,.4); }
#plist li.off { opacity: .6; }
#plist .w { flex: 1; min-width: 0; }
#plist .n { font-family: var(--disp); font-size: 1.3rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.05; }
#plist .s { font-size: .8rem; color: var(--cream); }
#plist li.ready .s { color: var(--leaf); } #plist li.idle .s { color: var(--orange); }
#plist .kick { font-family: var(--disp); font-size: 1rem; padding: .3em .8em; border-radius: 99px; border: 2px solid var(--ink); background: #5c3c0d; color: var(--paper); white-space: nowrap; }
#plist .kick.hot { background: var(--orange); color: var(--ink); }
#plist .kick.done { background: var(--red); color: #fff; }
.hint { color: var(--paper); font-size: .8rem; text-align: center; margin: 4px 8px 12px; text-shadow: 1px 1px 0 var(--ink); }

@media (orientation: landscape) and (max-height: 520px) {
  .lobby { grid-template-columns: minmax(220px, 34%) 1fr; grid-template-rows: 1fr; }
  .me { align-content: center; }
}

/* ---- Vote ---- */
.votebox { width: min(100%, 900px); height: 100%; display: grid; grid-template-rows: auto auto 1fr; gap: 10px; min-height: 0; text-align: center; }
.votebox h1 { font-size: clamp(2rem, 8vmin, 3.2rem); color: var(--paper); text-shadow: 3px 0 var(--ink), -3px 0 var(--ink), 0 3px var(--ink), 0 -3px var(--ink), 3px 3px var(--ink), -3px -3px var(--ink), 3px -3px var(--ink), -3px 3px var(--ink); }
.timer { height: 14px; border: 3px solid var(--ink); background: #2b1b12; box-shadow: 0 0 0 3px var(--bark); overflow: hidden; }
#vFill { height: 100%; width: 100%; background: var(--gold); transform-origin: left; }
.vcards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 14px; min-height: 0; overflow: auto; padding: 4px 6px 10px 2px; align-content: start; }
.vcard { position: relative; text-align: left; padding: 5px; display: flex; flex-direction: column; font-family: inherit; touch-action: manipulation; color: var(--paper); }
.vcard:active { transform: translate(3px, 3px); }
.vcard .cover { position: relative; border: 3px solid var(--ink); background: var(--sky); }
.vcard .cover canvas { display: block; width: 100%; height: auto; }
.vcard .t { padding: 6px 6px 4px; }
.vcard h2 { font-size: 1.5rem; line-height: 1; color: var(--gold); }
.vcard p { margin: 2px 0 0; font-size: .8rem; line-height: 1.25; }
.vcard.sel { box-shadow: inset 0 0 0 4px var(--gold), inset 0 0 0 6px var(--ink), 6px 6px 0 rgba(35, 23, 18, .55); }
.vcard.sel::after { content: "TON VOTE"; position: absolute; top: -6px; right: -4px; background: var(--gold); color: var(--ink); font-family: var(--disp); font-size: 1.2rem; padding: 0 8px; border: 3px solid var(--ink); }
.vcard.win { box-shadow: inset 0 0 0 4px var(--leaf), inset 0 0 0 6px var(--ink), 6px 6px 0 rgba(35, 23, 18, .55); }
.vcard.lose { opacity: .4; pointer-events: none; }
@media (orientation: landscape) and (max-height: 520px) {
  .votebox h1 { font-size: 1.8rem; }
  .vcards { grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); grid-auto-flow: column; overflow: hidden; }
  .vcard .t { padding: 2px 4px; } .vcard p { display: none; }
}

/* ---- Manette ---- */
#sPad { display: block; padding: 0; background: var(--earth) #4a2a14; background-size: auto, 230px; touch-action: none; overflow: hidden; color: var(--paper); }
.zone { position: absolute; top: 0; bottom: 0; touch-action: none; }
.zone.left { left: 0; width: 50%; padding-left: env(safe-area-inset-left); }
.zone.right { right: 0; width: 50%; padding-right: env(safe-area-inset-right); }
.zone.left::after { content: ""; position: absolute; left: 6%; right: 6%; top: 16%; bottom: 8%; border: 4px dashed rgba(245, 183, 132, .28); pointer-events: none; }
.hintz { position: absolute; left: 0; right: 0; bottom: 18%; text-align: center; color: rgba(245, 183, 132, .6); font-family: var(--disp); font-size: 1.6rem; pointer-events: none; z-index: 1; }
.stick-base { position: absolute; width: var(--sr2, 160px); height: var(--sr2, 160px); margin: calc(var(--sr2, 160px) / -2) 0 0 calc(var(--sr2, 160px) / -2); pointer-events: none; z-index: 2; }
.stick-base canvas { position: absolute; }
#stickRing { inset: 0; width: 100%; height: 100%; }
#stickKnob { left: 50%; top: 50%; width: 44%; height: 44%; margin: -22% 0 0 -22%; }
.abtn { position: absolute; pointer-events: none; transition: transform .05s; }
.abtn canvas { width: 100%; height: 100%; display: block; filter: drop-shadow(0 8px 6px rgba(0,0,0,.45)); }
.abtn.down { transform: translateY(6px) scale(.97); }
.abtn span { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--disp); font-size: clamp(1.4rem, 6vmin, 2.4rem); letter-spacing: .04em; color: var(--paper); text-shadow: 2px 0 var(--ink), -2px 0 var(--ink), 0 2px var(--ink), 0 -2px var(--ink), 2px 2px var(--ink), -2px -2px var(--ink), 2px -2px var(--ink), -2px 2px var(--ink); }
.padbar { position: absolute; left: 0; right: 0; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: max(6px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) 0 max(10px, env(safe-area-inset-left)); pointer-events: none; z-index: 5; }
.chip { background: rgba(35, 23, 18, .8); border: 3px solid var(--ink); padding: 0 10px; font-family: var(--disp); font-size: 1.2rem; color: var(--cream); max-width: 32vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.3; }
.chip.fs { pointer-events: auto; }
.chip.ping.bad { color: #ff8a78; } .chip.ping.mid { color: var(--gold); } .chip.ping.ok { color: var(--leaf); }
.status { font-family: var(--disp); font-size: clamp(1.3rem, 5vmin, 2rem); text-align: center; flex: 1; color: var(--paper); text-shadow: 2px 2px 0 var(--ink); }
.status.dead { color: #ff8a78; } .status.win { color: var(--gold); }

.rotate { position: fixed; inset: 0; z-index: 50; display: none; flex-direction: column; align-items: center; justify-content: center; background: var(--earth) #4a2a14; background-size: auto, 230px; text-align: center; font-family: var(--disp); font-size: 2.2rem; gap: 16px; color: var(--paper); }
.rotate .phone { animation: rot 1.8s steps(8) infinite; }
@keyframes rot { 0%, 20% { transform: rotate(0); } 60%, 100% { transform: rotate(-90deg); } }
@media (orientation: portrait) { body.in-pad .rotate { display: flex; } }
.conn { position: fixed; top: 8px; left: 50%; transform: translateX(-50%); background: var(--red); color: #fff; border: 3px solid var(--ink); padding: 0 16px; font-family: var(--disp); z-index: 60; font-size: 1.3rem; }

.vcard, .card { border-radius: 22px; } .vcard .cover { border-radius: 14px; overflow: hidden; } .timer, #vFill { border-radius: 99px; } .chip { border-radius: 99px; } .conn { border-radius: 99px; }
#stickKnob { filter: drop-shadow(0 6px 5px rgba(0,0,0,.45)); }
