/* PROTOCOL v2 lobby (app/lobby.js): mobile-first, works from 320 px wide, 48 px tap targets, no horizontal scroll. */
html, body { overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }
body.in-lobby #stage { visibility: hidden; }
body.in-lobby #rotate-hint { display: none !important; }

#lobby { position: fixed; inset: 0; z-index: 20000; overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: radial-gradient(120% 80% at 50% 0%, #133250 0%, #08121e 55%, #04070d 100%);
  padding: max(24px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom)); box-sizing: border-box; touch-action: manipulation; }
#lobby[hidden] { display: none; }
#lobby *, #lobby *::before, #lobby *::after { box-sizing: border-box; }
.lobby-card { width: 100%; max-width: 440px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.lobby-brand { font-size: 34px; font-weight: 800; letter-spacing: 0.02em; text-align: center; margin: 8px 0 4px; color: #eaf6ff;
  text-shadow: 0 2px 18px rgba(80,170,255,0.45); }
.lobby-sub { color: var(--ink-dim); text-align: center; font-size: 15px; line-height: 1.4; min-height: 1.4em; }
.lobby-label { color: var(--ink-dim); font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; margin-top: 8px; }
.lobby-form { display: flex; flex-direction: column; gap: 12px; }
.lobby-row { display: flex; gap: 8px; width: 100%; min-width: 0; }
.lobby-row > .lobby-input { flex: 1 1 auto; min-width: 0; }
/* 16 px+ inputs: iOS does not zoom the page on focus */
.lobby-input { width: 100%; min-height: 50px; padding: 12px 14px; border-radius: 12px; font-size: 17px; color: var(--ink);
  background: rgba(4,10,18,0.85); border: 1.5px solid rgba(160,200,235,0.35); outline: none; }
.lobby-input:focus { border-color: #59b7ff; box-shadow: 0 0 0 3px rgba(89,183,255,0.25); }
.lobby-code-input { text-transform: uppercase; letter-spacing: 0.12em; font-weight: 700; }
.lobby-link-input { font-size: 14px; color: var(--ink-dim); }
.lobby-btn { min-height: 52px; padding: 12px 18px; border-radius: 14px; font-size: 17px; font-weight: 800; color: var(--ink); cursor: pointer;
  background: rgba(20,40,60,0.9); border: 1.5px solid rgba(200,230,250,0.35); transition: transform 120ms ease, filter 150ms ease; }
.lobby-btn:active:not(:disabled) { transform: scale(0.98); }
.lobby-btn:disabled { opacity: 0.55; cursor: default; }
.lobby-btn.is-primary { background: linear-gradient(180deg, #ffd27a, #e79a2d); color: #2a1600; border-color: transparent; }
.lobby-btn.is-small { min-height: 50px; padding: 10px 14px; font-size: 15px; flex: 0 0 auto; }
.lobby-btn.is-ghost { text-align: left; font-weight: 700; font-size: 15px; background: rgba(10,22,36,0.7); }
.lobby-btn.is-busy { filter: saturate(0.6); }
.lobby-link { align-self: center; min-height: 44px; padding: 8px 16px; background: none; border: 0; color: #8ccaff; font-size: 15px; font-weight: 700; text-decoration: underline; cursor: pointer; }
.lobby-error { color: #ff9c8a; text-align: center; font-size: 15px; min-height: 1.2em; }
.lobby-list { display: flex; flex-direction: column; gap: 8px; }
.lobby-code { display: flex; align-items: baseline; justify-content: center; gap: 10px; }
.lobby-code b { font-size: 34px; letter-spacing: 0.16em; color: #fff3c4; }
.lobby-invite { display: flex; flex-direction: column; gap: 6px; }
.lobby-invite[hidden] { display: none; }
.lobby-seats { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.lobby-seat { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 10px 14px; border-radius: 12px;
  background: rgba(10,22,36,0.75); border: 1px solid rgba(160,200,235,0.18); }
.lobby-seat.is-me { border-color: rgba(89,183,255,0.5); }
.lobby-seat .dot { width: 12px; height: 12px; border-radius: 50%; background: #4a5866; flex: 0 0 auto; }
.lobby-seat .dot.is-on { background: #49d17a; box-shadow: 0 0 8px rgba(73,209,122,0.7); }
.seat-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.seat-ready { font-size: 13px; font-weight: 800; color: var(--ink-dim); }
.seat-ready.is-ready { color: #49d17a; }

/* in-game: opponent presence (PROTOCOL v2) */
.presence-banner { position: absolute; left: 50%; top: 150px; transform: translateX(-50%); z-index: 5850; display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; border-radius: 14px; background: rgba(40,20,8,0.92); border: 1px solid rgba(255,170,90,0.6); color: #ffe2c4; font-weight: 700; font-size: 16px; }
.presence-banner[hidden] { display: none; }
.presence-claim { padding: 8px 14px; border-radius: 10px; border: 0; font-weight: 800; background: linear-gradient(180deg, #ffd27a, #e79a2d); color: #2a1600; cursor: pointer; }
.presence-claim[hidden] { display: none; }

/* phone portrait: the table is landscape; suggest turning the phone (dismissible) */
#rotate-hint { display: none; }
@media (orientation: portrait) and (max-width: 760px) {
  body:not(.rotate-ok) #rotate-hint { display: flex; position: fixed; left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); z-index: 15000;
    align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: rgba(8,16,28,0.95); border: 1px solid rgba(160,200,235,0.35);
    color: var(--ink); font-size: 15px; }
  #rotate-hint div { flex: 1; }
  #rotate-hint button { min-height: 44px; min-width: 64px; border-radius: 10px; border: 0; font-weight: 800; background: #2a6f9c; color: #fff; }
}

/* static splash in index.html until main.js has loaded (first load through a tunnel can take many seconds) */
#boot-splash { position: fixed; inset: 0; z-index: 30000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: radial-gradient(120% 80% at 50% 0%, #133250 0%, #08121e 55%, #04070d 100%); color: #eaf6ff; font-family: system-ui, sans-serif; }
#boot-splash .boot-title { font-size: 34px; font-weight: 800; }
#boot-splash .boot-sub { font-size: 16px; color: #9fb3c4; }

/* EN | IT switch (BACKLOG 1m): lobby top corner and gear menu */
.lang-switch { display: inline-flex; border-radius: 10px; overflow: hidden; border: 1.5px solid rgba(160,200,235,0.35); }
.lang-switch button { min-width: 48px; min-height: 44px; padding: 6px 10px; border: 0; background: rgba(6,14,24,0.85); color: #9fb3c4; font-weight: 800; font-size: 14px; cursor: pointer; }
.lang-switch button.is-on { background: #2a6f9c; color: #fff; }
.lobby-lang { position: absolute; top: max(12px, env(safe-area-inset-top)); right: 12px; z-index: 2; }
#lobby { position: fixed; }
.game-menu-lang { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 6px 2px; border-top: 1px solid rgba(160,200,235,0.18); margin-top: 2px; }
.game-menu-label { color: #9fb3c4; font-size: 13px; font-weight: 700; }
.game-menu .lang-switch button { min-height: 36px; min-width: 42px; }
