/* Killer — base styles (owner: screens agent C1). Tokens first; every screen is ONE portrait page that never scrolls
   (390x844, 375x667, 320x568), targets >= 44 px, nothing under 11 px, the main action >= 30 px above the bottom. */
:root {
  --bg: #0e1118; --panel: #181c27; --panel-2: #222839; --ink: #f3f1ec; --muted: #9aa0b4;
  --accent: #f5b342; --accent-ink: #1a1304; --danger: #ff4156; --ok: #3ddc97;
  --radius: 14px; --gap: 12px; --margin-bottom: 30px;
  --hv: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}
@supports (height: 100dvh) { :root { --hv: 100dvh; } }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: var(--hv); overflow: hidden; background: var(--bg); color: var(--ink); overscroll-behavior: none; }
body { padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
#app { height: 100%; position: relative; }
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; padding: 16px 16px var(--margin-bottom); gap: var(--gap); }
.screen[hidden] { display: none; }
.center { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; flex: 1; gap: var(--gap); min-height: 0; }
.stack { display: flex; flex-direction: column; gap: var(--gap); min-height: 0; }
.grow { flex: 1; min-height: 0; }
h1 { font-size: 28px; line-height: 1.1; margin: 0; }
h2 { font-size: 20px; line-height: 1.2; margin: 0; }
p { margin: 0; font-size: 16px; line-height: 1.35; }
.hint { color: var(--muted); font-size: 14px; }
.small { font-size: 12px; }
.btn { appearance: none; border: 0; border-radius: var(--radius); min-height: 48px; padding: 0 20px; font: inherit; font-size: 17px; font-weight: 600; color: var(--ink); background: var(--panel-2); width: 100%; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.ghost { background: transparent; color: var(--muted); min-height: 44px; }
.btn:disabled { opacity: .45; }
.btn:active:not(:disabled) { transform: scale(.98); }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--panel); border-radius: 999px; padding: 6px 14px; font-size: 14px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel { background: var(--panel); border-radius: var(--radius); padding: 14px; }
.row { display: flex; gap: var(--gap); align-items: center; }
.row > * { flex: 1; min-width: 0; }
input[type=text] { font: inherit; font-size: 18px; color: var(--ink); background: var(--panel); border: 2px solid var(--panel-2); border-radius: var(--radius); min-height: 48px; padding: 0 14px; width: 100%; }
input[type=text]:focus { outline: none; border-color: var(--accent); }
.shake { animation: shake .5s ease; }
@keyframes shake { 10%, 90% { transform: translateX(-3px); } 20%, 80% { transform: translateX(5px); } 30%, 50%, 70% { transform: translateX(-8px); } 40%, 60% { transform: translateX(8px); } }
@media (prefers-reduced-motion: reduce) { .shake { animation: none; } }

/* ---- shared pieces ---- */
[hidden] { display: none !important; }
.screens, .host { position: absolute; inset: 0; }
.center-text { text-align: center; }
.topbar { display: flex; align-items: center; gap: var(--gap); min-height: 44px; }
.topbar .title { flex: 1; min-width: 0; margin: 0; font-size: 18px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .title.right { text-align: right; }
.iconbtn { appearance: none; border: 0; width: 44px; height: 44px; flex: none; border-radius: 50%; background: var(--panel); color: var(--ink); font: inherit; font-size: 24px; line-height: 1; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.iconbtn:active { transform: scale(.94); }
.chip.sm { padding: 4px 11px; font-size: 13px; }
.chip.me { box-shadow: 0 0 0 2px var(--accent); }
.chip.off { opacity: .45; }
.lobby.guest .chip.sm { font-size: 17px; padding: 8px 16px; }
.lobby.guest .chips { gap: 10px; margin-top: 12px; }
button, .key, .secret { touch-action: manipulation; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.notice { background: #3a1018; color: #ffd5da; border-radius: var(--radius); padding: 10px 12px; font-size: 14px; text-align: center; }

/* layers above the screens: connection banner, toast, menu sheet */
.layer { position: absolute; inset: 0; pointer-events: none; z-index: 20; }
.banner { position: absolute; top: 0; left: 0; right: 0; background: var(--danger); color: #fff; font-size: 13px; padding: 6px 12px; text-align: center; }
.toast { position: absolute; left: 16px; right: 16px; top: 12px; background: rgba(0, 0, 0, .88); color: #fff; border-radius: var(--radius); padding: 12px 14px; font-size: 15px; text-align: center; }
.sheet-wrap { position: absolute; inset: 0; z-index: 30; display: flex; flex-direction: column; justify-content: flex-end; }
.sheet-back { position: absolute; inset: 0; background: rgba(0, 0, 0, .6); }
.sheet { position: relative; padding: 16px 16px var(--margin-bottom); background: var(--panel); border-radius: 20px 20px 0 0; display: flex; flex-direction: column; gap: 10px; }
.sheet-q { font-size: 17px; text-align: center; padding: 4px 0 8px; }

/* ---- home ---- */
.screen.home { justify-content: center; gap: 20px; }
.brand { flex: none; gap: 10px; }
/* Keyboard open (main.js sets html.kbd and --hv to the visible height): the form must stay in view, the pitch can go. */
html.kbd .logo, html.kbd .home-intro, html.kbd .home-title { display: none; }
.logo { font-size: 44px; font-weight: 900; letter-spacing: .28em; text-indent: .28em; text-transform: uppercase; color: var(--accent); line-height: 1; }
.home-title { font-size: 24px; }
.home-intro { max-width: 300px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.home-form { gap: 10px; }

/* ---- lobby ---- */
.invite { display: flex; justify-content: center; }
.invite-qr { border-radius: 12px; display: block; }
.note { min-height: 18px; }

/* ---- express rules ---- */
.btn.skip { width: auto; min-height: 44px; padding: 0 12px; }
.rules-body { flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: center; gap: 12px; }
.rules-num { font-size: 72px; font-weight: 900; color: var(--accent); line-height: 1; }
.rules-title { font-size: 26px; }
.rules-title.safe { font-size: 20px; color: var(--accent); }
.rules-text { font-size: 19px; line-height: 1.4; }
.safety { margin: 0; padding: 0 0 0 20px; display: flex; flex-direction: column; gap: 8px; }
.safety li { font-size: 14px; line-height: 1.35; }
.dots { display: flex; justify-content: center; gap: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--panel-2); }
.dot.on { background: var(--accent); }

/* ---- contract (briefing) ---- */
.timebar { height: 4px; background: var(--panel-2); border-radius: 2px; overflow: hidden; flex: none; }
.timebar-fill { display: block; height: 100%; width: 0; background: var(--accent); transition: width .5s linear; }
.brief-consigne { font-size: 15px; }
.brief-note { min-height: 18px; }
.secret { flex: 1; min-height: 120px; position: relative; display: grid; background: var(--panel); border-radius: var(--radius); overflow: hidden;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: none; }
.secret-hidden, .secret-shown { grid-area: 1 / 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 14px; gap: 6px; min-width: 0; }
.secret-shown { visibility: hidden; }
.secret.on .secret-shown { visibility: visible; }
.secret.on .secret-hidden { visibility: hidden; }
.secret-eye { font-size: 44px; color: var(--muted); line-height: 1; }
.secret-hold { position: absolute; left: 0; bottom: 0; height: 4px; width: 0; background: var(--accent); }
.secret.holding .secret-hold { width: 100%; transition: width .35s linear; }
.secret.on .secret-hold { width: 0; }
.secret-name { font-size: 34px; font-weight: 900; color: var(--accent); max-width: 100%; overflow-wrap: anywhere; line-height: 1.1; }
.secret-gap { margin-top: 10px; }
.secret-gadget { font-size: 19px; line-height: 1.3; }

.boot { margin: 0; height: 100%; display: flex; align-items: center; justify-content: center; text-align: center; padding: 24px; color: var(--muted); font-size: 16px; }
