* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #1b2618; color: #f3ead2; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; overflow: hidden; overscroll-behavior: none; }
.hidden { display: none !important; }
button { font: inherit; color: #f3ead2; background: #3a3326; border: 1px solid #6d5f42; border-radius: 10px; padding: 8px 12px; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
button:active { transform: scale(.96); }
button:disabled { opacity: .4; }
button.primary { background: #8a5a1c; border-color: #d29b4a; font-weight: 600; }
button.icon { padding: 4px 9px; }
.muted { color: #b7ad94; font-size: .9em; }

/* ---------- salon ---------- */
#lobby { height: 100%; overflow-y: auto; padding: max(16px, env(safe-area-inset-top)) 16px 24px; max-width: 560px; margin: 0 auto; }
h1 { text-align: center; font-size: 1.7em; margin: 8px 0 16px; letter-spacing: .5px; }
h2 { margin: 0 0 10px; font-size: 1.1em; }
.card { background: #2a2a20; border: 1px solid #4b4430; border-radius: 14px; padding: 14px; margin-bottom: 12px; }
label { display: flex; gap: 10px; align-items: center; }
input { flex: 1; font: inherit; padding: 8px 10px; border-radius: 8px; border: 1px solid #6d5f42; background: #1b1b14; color: inherit; }
#plist { list-style: none; padding: 0; margin: 0 0 12px; }
#plist li { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid #3a3526; }
#plist li:last-child { border-bottom: 0; }
.dot { width: 14px; height: 14px; border-radius: 50%; flex: none; }
#plist .tag { margin-left: auto; font-size: .8em; color: #b7ad94; }
#plist button { padding: 2px 8px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row button { flex: 1; }
.help { padding-left: 18px; margin: 10px 0 0; line-height: 1.45; }
summary { cursor: pointer; font-weight: 600; }

/* ---------- partie ---------- */
#game { position: fixed; inset: 0; }
#cv { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; display: block; }
#top { position: absolute; top: max(6px, env(safe-area-inset-top)); left: max(6px, env(safe-area-inset-left)); right: 160px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; pointer-events: none; }
#top > * { pointer-events: auto; }
.chip { background: rgba(20, 18, 12, .78); border-radius: 8px; padding: 4px 8px; font-size: 14px; font-weight: 600; white-space: nowrap; }
#pchips { display: flex; gap: 4px; flex-wrap: wrap; }
#pchips .chip { display: flex; align-items: center; gap: 5px; font-weight: 500; font-size: 12px; }
#pchips .dead { text-decoration: line-through; opacity: .5; }
#pchips .dot { width: 10px; height: 10px; }
#mini { position: absolute; top: max(6px, env(safe-area-inset-top)); right: max(6px, env(safe-area-inset-right)); width: 150px; height: 100px; border: 2px solid #6d5f42; border-radius: 6px; background: #2c4a25; touch-action: none; }

#left { position: absolute; left: max(6px, env(safe-area-inset-left)); top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 8px; }
#herobar { display: flex; flex-direction: column; gap: 8px; }
.hbtn { width: 54px; height: 54px; border-radius: 50%; font-size: 24px; padding: 0; position: relative; background: rgba(40, 34, 22, .88); border: 2px solid #d29b4a; }
.hbtn .cd { position: absolute; inset: 0; border-radius: 50%; background: rgba(0, 0, 0, .6); display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 700; }
.hbtn.sel { box-shadow: 0 0 0 3px #fff; }

#selbar { position: absolute; left: max(6px, env(safe-area-inset-left)); bottom: max(6px, env(safe-area-inset-bottom)); display: flex; gap: 6px; align-items: center; }
#selbar button { background: rgba(40, 34, 22, .9); padding: 9px 12px; }
#selcount { background: rgba(20, 18, 12, .78); border-radius: 8px; padding: 6px 9px; font-size: 13px; }
#selcount:empty { display: none; }

#panel { position: absolute; right: max(6px, env(safe-area-inset-right)); bottom: max(6px, env(safe-area-inset-bottom)); width: min(340px, 60vw); max-height: 62vh; overflow-y: auto; background: rgba(32, 29, 20, .95); border: 1px solid #6d5f42; border-radius: 14px; padding: 10px; }
#panel .ph { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
#panel .ph b { font-size: 16px; }
#panel .ph .x { margin-left: auto; padding: 2px 10px; }
#panel .bar { height: 6px; background: #111; border-radius: 3px; overflow: hidden; margin: 4px 0 8px; }
#panel .bar > i { display: block; height: 100%; background: #6ac35b; }
#panel .bar.prog > i { background: #e7b04c; }
#panel .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
#panel .opt { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; }
#panel .opt .ic { font-size: 24px; }
#panel .opt small { color: #e7c88a; }
#panel .queue { display: flex; gap: 4px; align-items: center; margin-top: 8px; font-size: 20px; flex-wrap: wrap; }
#panel .queue button { font-size: 13px; padding: 4px 8px; margin-left: auto; }
#panel p { margin: 4px 0; font-size: 14px; }

#toast { position: absolute; top: 56px; left: 50%; transform: translateX(-50%); background: rgba(120, 30, 20, .92); padding: 8px 14px; border-radius: 10px; font-size: 14px; opacity: 0; transition: opacity .3s; pointer-events: none; }
#toast.show { opacity: 1; }
#overlay { position: absolute; inset: 0; background: rgba(0, 0, 0, .55); display: flex; align-items: center; justify-content: center; }
#overlay .card { text-align: center; min-width: 260px; }
#overlay h2 { font-size: 1.6em; }

@media (max-height: 430px) {
  .hbtn { width: 46px; height: 46px; font-size: 20px; }
  #mini { width: 120px; height: 80px; }
  #top { right: 130px; }
  #panel { max-height: 70vh; }
}
