/* QUAIL big online rooms (Sketch, Impostor): the lobby's extras on top of party.css (name, players, colours,
 * the owner's settings) and the pieces both games share (panels, chat). */

.namefield { display: grid; gap: 6px; }
.namefield input, .chatin input {
  width: 100%; min-height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--border-strong);
  background: rgba(0, 0, 0, .35); color: var(--text); font: 600 1rem var(--body); outline: none;
}
.namefield input:focus, .chatin input:focus { border-color: color-mix(in srgb, var(--theme) 70%, transparent); }

/* the waiting room: the card gets wide, the picture shrinks to a title strip */
.lobby-card.waiting { width: min(1040px, 100%); grid-template-columns: 1fr !important; }
.lobby-card.waiting .lobby-hero {
  grid-template-columns: auto minmax(0, 1fr); align-items: center; justify-items: start; gap: 4px 16px;
  padding: 16px 24px !important; text-align: left; border-right: 0 !important; border-bottom: 1px solid var(--border); border-radius: 26px 26px 0 0 !important;
}
.lobby-card.waiting .hero-art { grid-row: span 2; width: 74px; height: 74px; aspect-ratio: 1; border-radius: 18px; animation: none; display: block; }
.lobby-card.waiting .brand { justify-self: start; }
.lobby-card.waiting h1 { font-size: clamp(1.7rem, 4vw, 2.3rem) !important; }
.lobby-card.waiting .lobby-sub { display: none; }
.lobby-card.waiting .lobby-main { padding: 18px 24px 22px !important; }

.wait-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.wait-head .codebox { display: flex; align-items: center; gap: 12px; margin-right: auto; }
.wait-head .label { margin: 0; }
.wait-head .code { font-size: 2rem; padding: 4px 14px; }
.wait-head .lobby-note { margin-left: auto; }
.wait-cols { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 820px) { .wait-cols { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); } }
.wait-col { display: grid; gap: 8px; align-content: start; padding: 14px; border-radius: 18px; background: rgba(0, 0, 0, .22); border: 1px solid var(--border); min-width: 0; }
.wait-col .label { display: flex; align-items: center; gap: 8px; margin: 0; }
.wait-col .label b { color: var(--text); letter-spacing: .04em; }
.wait-actions { display: flex; align-items: center; gap: 10px; }
.wait-actions .big { flex: 1; justify-content: center; text-align: center; min-height: 54px; font-size: 1.1rem; }
.wait-actions .big .txt { flex: none; }
.wait-actions .big:disabled { opacity: .45; cursor: default; transform: none; }
.wait-actions .big[hidden] { display: none; }
.wait-actions .mini { min-height: 54px; padding: 0 20px; }

.playerlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.rp {
  display: flex; align-items: center; gap: 9px; min-width: 0; min-height: 46px; padding: 5px 10px 5px 6px; border-radius: 14px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--pc, #888) 22%, transparent), rgba(255, 255, 255, .03));
  border: 1px solid color-mix(in srgb, var(--pc, #888) 30%, transparent); font-weight: 600; font-size: .9rem; animation: seatIn .4s var(--pop) both;
}
.rp.me { border-color: color-mix(in srgb, var(--pc, #888) 80%, #fff); box-shadow: 0 0 16px -6px var(--pc, #888); }
.rp canvas { width: 34px; height: 34px; flex: none; }
.rp span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp small { margin-left: auto; color: var(--gold); font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; }
.rp.free { justify-content: center; border-style: dashed; border-color: var(--border); background: transparent; color: var(--dim); font-weight: 500; font-size: .8rem; animation: none; }

.colorpick { display: flex; flex-wrap: wrap; gap: 7px; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .2); cursor: pointer; padding: 0; box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .22); transition: transform .15s var(--pop); }
.swatch:not(:disabled):hover { transform: scale(1.12); }
.swatch[aria-pressed="true"] { border-color: #fff; box-shadow: 0 0 0 3px rgba(255, 255, 255, .25), inset 0 -4px 0 rgba(0, 0, 0, .22); }
.swatch:disabled { opacity: .2; cursor: default; }
.swatch[aria-pressed="true"]:disabled { opacity: 1; }

.settings { display: grid; gap: 7px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.opt.wide { grid-column: 1 / -1; }
.opt { display: grid; gap: 5px; padding: 8px 9px; border-radius: 12px; background: rgba(255, 255, 255, .03); border: 1px solid var(--border); min-width: 0; }
.opt > span { color: var(--sub); font-size: .76rem; font-weight: 600; }
.optseg { display: flex; gap: 3px; padding: 3px; border-radius: 10px; background: rgba(0, 0, 0, .3); }
.optseg button { flex: 1; min-height: 28px; padding: 0 6px; border-radius: 7px; border: 0; background: transparent; color: var(--sub); font: 600 .78rem var(--body); cursor: pointer; white-space: nowrap; }
.optseg button[aria-pressed="true"] { background: color-mix(in srgb, var(--theme) 55%, #1a2236); color: #fff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15); }
.optseg button:disabled { cursor: default; }
.optseg button:disabled:not([aria-pressed="true"]) { opacity: .5; }
.waitnote { margin: 0; text-align: center; color: var(--gold); font-size: .85rem; }
.waitnote[hidden] { display: none; }
@media (max-width: 620px) {
  .lobby-card.waiting .lobby-hero { padding: 12px 16px !important; }
  .lobby-card.waiting .hero-art { width: 52px; height: 52px; border-radius: 14px; }
  .lobby-card.waiting .lobby-main { padding: 12px 12px 16px !important; }
  .wait-head .code { font-size: 1.6rem; letter-spacing: .2em; }
  .wait-head .lobby-note { margin-left: 0; width: 100%; justify-content: flex-start; }
  .settings { grid-template-columns: 1fr; }
  .playerlist { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rp.free:empty { display: none; }
}
@media (max-height: 600px) { .lobby-card.waiting .hero-art { display: none; } }

/* panels and chat, shared by the games */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; }
.chat { display: flex; flex-direction: column; min-height: 0; }
.chatlog { flex: 1; min-height: 0; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; font-size: .88rem; user-select: text; }
.chatlog p { margin: 0; line-height: 1.35; overflow-wrap: anywhere; }
.chatlog b { font-weight: 700; }
.chatlog .sys { color: var(--sub); font-style: italic; }
.chatlog .ok { color: #7dffa8; font-weight: 700; }
.chatlog .close { color: var(--gold); }
.chatlog .secret { color: #a7f3c4; }
.chatlog .ghost { color: #b9c3d6; opacity: .8; }
.chatin { display: flex; gap: 6px; padding: 8px; border-top: 1px solid var(--border); }
.chatin input { min-height: 38px; font-size: .92rem; }
.chatin input:disabled { opacity: .5; }
.hidden { display: none !important; }

/* ---------- phones and tablets (html.touch-ui / .kb-open / .in-game: set by room.js) */
@supports (height: 100dvh) { html, body { height: 100dvh; } }
html.touch-ui, html.touch-ui body { -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; -webkit-text-size-adjust: 100%; touch-action: manipulation; overscroll-behavior: none; }
html.touch-ui button, html.touch-ui input, html.touch-ui label { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
html.touch-ui body, html.touch-ui button { -webkit-user-select: none; user-select: none; }
html.touch-ui input, html.touch-ui .chatlog { -webkit-user-select: text; user-select: text; }   /* iOS: no typing in an input that can't be selected */
html.touch-ui .namefield input, html.touch-ui .chatin input { font-size: 16px; }   /* smaller and iOS zooms in on focus */
html.touch-ui .chatin input { min-height: 44px; }
html.touch-ui .lobby {
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  overscroll-behavior: contain;
}
html.touch-ui .mini { min-height: 44px; }
html.touch-ui .swatch { width: 40px; height: 40px; }
html.touch-ui .colorpick { gap: 8px; }
html.touch-ui .optseg button { min-height: 40px; }
html.touch-ui .swatch:not(:disabled):hover { transform: none; }
/* the on-screen keyboard is up: the game stays in what is left of the screen */
html.kb-open .stage, html.kb-open body > .lobby { position: fixed; left: 0; right: 0; top: var(--vvt, 0px); bottom: auto; height: var(--vvh, 100%); flex: none; }
@media (max-width: 380px) {
  .wait-head .codebox { gap: 8px; }
  .wait-head .code { font-size: 1.35rem; padding: 4px 10px; }
  .wait-actions .mini { padding: 0 14px; }
}

/* a game made for landscape, on a phone held upright: a short hint, never in the way */
:root { --i-rot: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='7' y='2' width='10' height='20' rx='2'/%3E%3Cpath d='M20 9a8 8 0 0 1 0 6M4 15a8 8 0 0 1 0-6'/%3E%3C/svg%3E"); }
.rotate-hint { display: none; }
@media (orientation: portrait) and (pointer: coarse) {
  html.in-game:not(.kb-open) .rotate-hint {
    display: flex; align-items: center; gap: 8px; position: fixed; left: 50%; top: 50%; z-index: 40; padding: 10px 16px; border-radius: 999px;
    background: rgba(8, 12, 22, .86); border: 1px solid rgba(255, 255, 255, .16); color: #fff; font: 600 .9rem var(--display); white-space: nowrap;
    pointer-events: none; animation: rotHint 5s ease both;
  }
  .rotate-hint::before { content: ""; width: 20px; height: 20px; background: currentColor; -webkit-mask: var(--i-rot) center / contain no-repeat; mask: var(--i-rot) center / contain no-repeat; }
}
@keyframes rotHint { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.92); } 10%, 78% { opacity: 1; transform: translate(-50%, -50%); } 100% { opacity: 0; transform: translate(-50%, -50%); } }
