/* Mystery Face: Hub navy-slate tokens (Board and Card Games/Hub/index.html), the family's controls */
:root {
  --bg: #0f1117; --bg-soft: #161923; --card: #1a1e2b; --card-hover: #212636; --line: #2a3042;
  --text: #e8eaf0; --muted: #969db4; --accent: #6ea8fe; --warm: #f0b354;
  --good: #4ade80; --bad: #f87171;
  --tabh: 58px; --r: 12px;
  color-scheme: dark;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; overflow: hidden; overflow-x: clip;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
input { font-size: 16px; } /* no iOS zoom */
h2 { font-size: 19px; } h3 { font-size: 16px; margin: 4px 0 6px; } h4 { font-size: 14px; margin: 10px 0 4px; }
a { color: var(--accent); }

#app { height: 100vh; display: grid; grid-template-rows: auto minmax(0, 1fr) var(--tabh); }
@supports (height: 100dvh) { #app { height: 100dvh; } }

/* ---------- header ---------- */
.top { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--line); min-height: 46px; min-width: 0; padding-top: max(6px, env(safe-area-inset-top)); }
.back { display: inline-grid; place-items: center; width: 30px; height: 34px; color: var(--muted); flex: none; }
.back svg { width: 20px; height: 20px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: .02em; font-size: 17px; flex: none; }
.brand svg { width: 26px; height: 26px; }
#topInfo { margin-left: auto; display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; color: var(--muted); }
#topInfo .score { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#topInfo b { color: var(--text); }
.acct { width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; color: var(--muted); flex: none; }
.acct svg { width: 26px; height: 26px; }
.acct.in { background: var(--accent); color: #0b1220; font-weight: 800; font-size: 13px; }

/* ---------- tabs ---------- */
.tabs { display: flex; border-top: 1px solid var(--line); background: var(--bg-soft); padding-bottom: env(safe-area-inset-bottom); }
.tabs button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-size: 11.5px; font-weight: 600; }
.tabs button svg { width: 22px; height: 22px; }
.tabs button.on { color: var(--accent); }
.tabs button:active { transform: scale(.96); }

main { min-height: 0; position: relative; }
.tab { position: absolute; inset: 0; display: none; }
.tab.on { display: flex; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 16px; border-radius: 10px; font-weight: 650; background: var(--card); border: 1px solid var(--line); transition: transform .1s ease, background .15s; white-space: nowrap; }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn.main { background: var(--accent); border-color: var(--accent); color: #0b1220; }
.btn.danger { color: var(--bad); }
.btn.main.danger { background: var(--bad); border-color: var(--bad); color: #1a0606; }
.btn.small { min-height: 32px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn.big { min-height: 48px; font-size: 17px; }
.btn.icon { padding: 0; width: 34px; position: relative; }
.btn.icon svg { width: 18px; height: 18px; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.google { width: 100%; background: #fff; color: #1f1f1f; border-color: #dadce0; margin-top: 4px; }
.btn.google svg { width: 18px; height: 18px; }
.link { color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 11px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); font-weight: 650; font-size: 13.5px; white-space: nowrap; flex: none; }
.chip span { color: var(--muted); font-weight: 600; font-size: 12px; }
.chip.on { border-color: var(--accent); background: rgba(110,168,254,.16); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex-shrink: 0; background: #4a5068; }
.dot.on { background: var(--good); }
.seg { display: inline-flex; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 9px; padding: 2px; max-width: 100%; }
.seg button { padding: 5px 11px; border-radius: 7px; font-size: 13px; font-weight: 650; color: var(--muted); white-space: nowrap; min-width: 0; }
.seg button.on, .seg button[aria-pressed="true"] { background: var(--card-hover); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.4); }
.switch { display: inline-flex; align-items: center; flex: none; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch span { width: 42px; height: 26px; border-radius: 13px; background: #3a4157; position: relative; transition: background .2s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.q { width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--line); color: var(--muted); font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; vertical-align: middle; margin-left: 4px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; justify-content: center; }
.right { text-align: right; }
.grow { flex: 1; min-width: 0; }
.warn { color: var(--warm); }
.bad { color: var(--bad); } .ok { color: var(--good); }
.field { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.field input { height: 42px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-soft); padding: 0 12px; outline: none; min-width: 0; width: 100%; }
.field input:focus { border-color: var(--accent); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.row.end { justify-content: flex-end; }
.col { display: flex; flex-direction: column; gap: 8px; }
.lbl { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 12px 0 6px; }
.lbl.inl { margin: 0; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 12px 0 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ---------- a face picture: name tile underneath, photo on top (a broken photo just leaves the tile) ---------- */
.ph { position: relative; display: block; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: #262b3b; }
.ph img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.nt { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 800; letter-spacing: .02em; color: #fff;
  background: linear-gradient(145deg, hsl(var(--h, 220) 55% 46%), hsl(var(--h, 220) 60% 32%)); font-size: clamp(12px, 40cqw, 40px); container-type: inline-size; }
.ph { container-type: inline-size; }
.nt { font-size: 34cqw; }
/* name-only deck people: the full name (and where they're from) instead of initials */
.nt.full { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 3cqw; padding: 6cqw; text-align: center;
  font-size: 15cqw; line-height: 1.08; letter-spacing: 0; overflow-wrap: anywhere; }
.nt.full b { font-weight: 800; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.nt.full small { font-size: 10.5cqw; font-weight: 600; opacity: .8; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- panes (home, lobby, people, settings) ---------- */
.pane { flex: 1; min-width: 0; overflow-y: auto; overflow-x: hidden; padding: 12px 14px 20px; -webkit-overflow-scrolling: touch; }
.pane > * { max-width: 640px; margin-left: auto; margin-right: auto; }
.center-pane { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; }

/* home */
.seg.modes { display: flex; width: 100%; }
.seg.modes button { flex: 1; padding: 9px 6px; font-size: 14px; }
.srcs { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.src { display: flex; flex-direction: column; align-items: stretch; gap: 3px; padding: 6px; border-radius: 12px; background: var(--card); border: 1.5px solid var(--line); text-align: left; min-width: 0; }
.src b { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.src > span:last-child { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.src.on { border-color: var(--warm); box-shadow: 0 0 0 1px var(--warm); }
.mosaic { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: #262b3b; }
.mosaic .mt { position: relative; display: block; overflow: hidden; container-type: inline-size; }
.mosaic .mt img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.mosaic .mt.empty { background: #20253a; }
.mosaic.plus { display: grid; place-items: center; grid-template-columns: 1fr; font-size: 34px; color: var(--muted); border: 1.5px dashed var(--line); background: none; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips.tags { margin-top: 10px; }
.sizes { margin-top: 12px; }
.online-box { margin-top: 6px; }
.joinrow input { width: 0; flex: 1; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-soft); padding: 0 12px; outline: none; text-transform: uppercase; letter-spacing: .2em; font-weight: 700; }
.joinrow input:focus { border-color: var(--accent); }
.home .center { margin-top: 8px; }

/* lobby */
.big-code { font-size: 46px; font-weight: 800; letter-spacing: .18em; color: var(--warm); font-variant-numeric: tabular-nums; }
.plates { display: flex; flex-direction: column; gap: 6px; margin: 10px 0 2px; }
.plate { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); font-weight: 600; }
.plate.wait { color: var(--muted); border-style: dashed; }

/* ---------- the game ---------- */
.game { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 6px; padding: 6px 8px 8px; position: relative; }
.prompt { display: flex; align-items: center; gap: 8px; min-height: 48px; flex: none; }
.ptext { flex: 1; min-width: 0; }
.pmain { font-size: 15px; line-height: 1.25; }
.psub { font-size: 12.5px; color: var(--muted); line-height: 1.25; margin-top: 1px; }
.pside { display: flex; align-items: center; gap: 5px; flex: none; }
.lc { position: absolute; top: -5px; right: -5px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--accent); color: #0b1220; font-size: 10.5px; font-weight: 800; line-height: 17px; }
.oppline { display: none; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.timer { font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--muted); min-width: 34px; text-align: right; }
.timer.low { color: var(--warm); }
.mychip { display: flex; flex-direction: column; align-items: center; width: 46px; flex: none; gap: 1px; }
.mychip .ph, .mychip .nt { width: 40px; height: 40px; border-radius: 7px; box-shadow: 0 0 0 2px var(--warm); }
.mychip.none .nt { position: relative; display: grid; }
.mychip em { font-style: normal; font-size: 10px; color: var(--warm); max-width: 54px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pswitch { display: flex; flex: none; }
.pswitch button { flex: 1; }
.pswitch button.act:not(.on) { color: var(--warm); }

.boards { flex: 1; min-height: 0; display: flex; gap: 12px; }
.boardbox { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; }
.boards.two .boardbox.other { display: none; }
.bhead { display: none; align-items: center; gap: 10px; padding: 0 2px 6px; flex: none; }
.board { display: grid; grid-template-columns: repeat(var(--cols, 4), var(--tile, 70px)); gap: var(--gap, 4px); justify-content: center; align-content: start; margin: auto 0; }

.face { position: relative; display: flex; flex-direction: column; width: var(--tile, 70px); min-width: 0; padding: 0; text-align: center; border-radius: 9px; }
.face .ph { width: 100%; border-radius: 8px; box-shadow: 0 0 0 1px rgba(255,255,255,.08), 0 2px 4px rgba(0,0,0,.35); transition: filter .18s, opacity .18s; }
.face .nm { display: block; height: var(--nameh, 14px); font-size: calc(var(--nameh, 14px) * .78); line-height: var(--nameh, 14px); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #cfd4e2; padding: 0 1px; }
.face:active .ph { transform: scale(.96); }
/* flipped down: darkened, greyed, and a big X, so it reads without colour */
.face .xmark { position: absolute; inset: 0; display: none; pointer-events: none; }
.face .xmark::before, .face .xmark::after { content: ""; position: absolute; left: 50%; top: 50%; width: 120%; height: 3px; background: rgba(255,255,255,.85); border-radius: 2px; box-shadow: 0 0 0 1px rgba(0,0,0,.5); }
.face .xmark::before { transform: translate(-50%, -50%) rotate(45deg); }
.face .xmark::after { transform: translate(-50%, -50%) rotate(-45deg); }
/* small red X marks (Tim, 2026-11-06): 1 per turn, up to 3, along the bottom of the picture */
.face .pmarks { position: absolute; left: 0; right: 0; bottom: 3px; display: flex; justify-content: center; gap: 2px; pointer-events: none; }
.face .pmarks b { width: 22%; max-width: 18px; aspect-ratio: 1; border-radius: 50%; background: rgba(0,0,0,.55); color: #ef4444; font: 900 clamp(9px, 2.6vw, 14px)/1 system-ui, sans-serif; display: grid; place-items: center; box-shadow: 0 0 0 1px rgba(239,68,68,.7); }
.face.down .pmarks, .face.wrong .pmarks { display: none; }
.face.down .ph { filter: grayscale(1) brightness(.38); }
.face.down .xmark { display: block; }
/* a wrong guess: red X, locked (can't be flipped or guessed again) */
.face.wrong .xmark { display: block; }
.face.wrong .xmark::before, .face.wrong .xmark::after { background: #ef4444; height: 4px; }
.face.wrong .ph { filter: brightness(.55); }
.face.wrong .nm { color: #ef4444; text-decoration: line-through; }
#topInfo .navbtns { display: flex; gap: 6px; flex: none; }
.face.down .nm { color: #5d6377; text-decoration: line-through; }
.face.flipping .ph { animation: flipit .28s ease; }
@keyframes flipit { 0% { transform: rotateY(0); } 50% { transform: rotateY(90deg); } 100% { transform: rotateY(0); } }
/* don't-know marks: dashed ring + question badge */
/* after a swap: new faces lit, the rest dimmed (until Ready) */
.face.stale .ph { filter: brightness(.42) saturate(.5); }
.face.stale .nm { color: #6c7286; }
.face.fresh .ph { box-shadow: 0 0 0 2.5px var(--accent), 0 0 12px 2px var(--accent); }
/* "Swap this one" mark: one tap toggles, the whole picture says so */
.face.marked .ph { box-shadow: 0 0 0 3px var(--warm); filter: none; }
.face.marked .ph::after { content: "Swap"; position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; padding: 0 6%; text-align: center;
  background: rgba(20, 14, 6, .86); color: var(--warm); font-weight: 900; font-size: max(9px, 18cqw); line-height: 1.05; text-transform: uppercase; letter-spacing: .02em; }
/* chosen (pick or guess): thick ring + tick */
.face.sel .ph { box-shadow: 0 0 0 3px var(--accent); }
.face.sel::after { content: "✓"; position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: #0b1220; font-weight: 900; font-size: 13px; line-height: 20px; }
.ph-ask .face.sel::after, .ph-flip .face.sel::after { content: "?"; }
/* your own mystery face on your board: a small star */
.face.mine::before { content: "★"; position: absolute; top: 2px; left: 4px; z-index: 2; color: var(--warm); font-size: 13px; text-shadow: 0 1px 2px #000; }

.dock { flex: none; display: flex; gap: 8px; justify-content: center; align-items: center; flex-wrap: wrap; min-height: 44px; }
.dock.quiet { min-height: 0; }
.dock .btn { flex: 1; max-width: 220px; }
.dock .btn.ans { min-height: 46px; font-size: 16px; }
.dock.askdock { flex-direction: column; align-items: stretch; gap: 6px; flex-wrap: nowrap; }
.askrow { display: flex; gap: 6px; }
.askrow input { flex: 1; min-width: 0; height: 42px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-soft); padding: 0 12px; outline: none; }
.askrow input:focus { border-color: var(--accent); }
.askrow .btn { flex: none; }
.qchips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.qchips::-webkit-scrollbar { display: none; }
.guessrow { margin: 0; justify-content: center; }
.guessrow .btn { max-width: none; flex: none; }

/* same screen: the look-away cover, and the press-and-hold peek */
.cover { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; background: #0b0d13; text-align: center; padding: 20px; }
.cover > div { display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--muted); }
.cover h2 { color: var(--text); font-size: 22px; }
.cover .btn { margin-top: 10px; min-width: 200px; }
.peek { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px 3px 3px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); position: relative; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: none; }
.peek .ph { width: 30px; height: 30px; border-radius: 6px; }
.peek .pk-cover { position: absolute; left: 3px; top: 3px; width: 30px; height: 30px; border-radius: 6px; background: repeating-linear-gradient(45deg, #2b3550 0 5px, #232b42 5px 10px); display: grid; place-items: center; color: var(--warm); }
.peek.on .pk-cover { display: none; }
.peek em { font-style: normal; font-size: 12px; font-weight: 600; }
.peek em span { color: var(--muted); font-weight: 500; }
.ph-pick.local .peek, .ph-dunno.local .peek { display: none; }
/* phone same-screen: peek sits in the prompt row's place under the switch */
.game.local .bhead { display: flex; }
@media (max-width: 899px) { .bhead > b { display: none; } }

/* end of round */
.over { position: absolute; inset: 0; z-index: 6; background: rgba(8,10,16,.82); display: flex; align-items: flex-start; justify-content: center; overflow-y: auto; padding: 12px; }
.ocard { width: 100%; max-width: 460px; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin: auto 0; text-align: center; }
.ocard h2 { font-size: 22px; }
.reveal { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0 6px; }
.rv { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; }
.rv .ph { width: 100%; max-width: 120px; }
.rv .ph .nt { position: absolute; }
.rv b { font-size: 15px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rv .ok, .rv .bad { font-size: 12px; font-weight: 700; }
.review { text-align: left; margin-top: 8px; }
.review summary { cursor: pointer; font-weight: 650; font-size: 14px; padding: 6px 0; }
.log { padding-left: 22px; font-size: 13.5px; display: flex; flex-direction: column; gap: 4px; text-align: left; }
.log li.flag { color: var(--warm); }
.log em { font-style: normal; font-size: 12px; color: var(--warm); }
.a { display: inline-block; padding: 0 6px; border-radius: 6px; font-size: 12px; font-weight: 800; border: 1px solid var(--line); }
.a-yes { color: var(--good); } .a-no { color: var(--bad); } .a-unsure { color: var(--muted); }

/* ---------- people ---------- */
.phead { display: flex; align-items: center; gap: 8px; }
.phead h2 { flex: 1; }
.title-in { flex: 1; min-width: 0; height: 38px; border-radius: 9px; border: 1px solid transparent; background: none; font-size: 18px; font-weight: 700; padding: 0 8px; outline: none; }
.title-in:focus { border-color: var(--line); background: var(--bg-soft); }
.acctline { margin: 6px 0 10px; }
.setlist { display: flex; flex-direction: column; gap: 8px; }
.setrow { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); cursor: pointer; }
.setrow .mosaic { width: 52px; flex: none; }
.si { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.si b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.empty-note { text-align: center; padding: 18px 8px; display: flex; flex-direction: column; align-items: center; gap: 10px; grid-column: 1 / -1; }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; margin-top: 10px; }
.pcard { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pcard .nm { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard.unnamed .nm { color: var(--warm); font-style: italic; }
.playrow { position: sticky; bottom: 0; padding: 8px 0 0; background: linear-gradient(transparent, var(--bg) 40%); }
.person .bigpic { position: relative; width: 140px; aspect-ratio: 1; margin: 0 auto 4px; border-radius: 12px; overflow: hidden; container-type: inline-size; }
.person .bigpic img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.person .bigpic .editpic { position: absolute; right: 6px; bottom: 6px; z-index: 1; box-shadow: 0 1px 4px rgba(0,0,0,.35); }
.framer .repick { text-align: center; margin: 10px 0 0; }
/* framing a photo: drag / pinch inside the square; the ring shows where the face should sit */
.framer h3 { margin-bottom: 8px; }
.framer .frame { position: relative; width: min(300px, 78vw, 52dvh); aspect-ratio: 1; margin: 0 auto; border-radius: 12px; overflow: hidden; background: #000; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; cursor: grab; overscroll-behavior: contain; }
.framer .frame:active { cursor: grabbing; }
.framer .frame img { position: absolute; left: 0; top: 0; max-width: none; transform-origin: 0 0; pointer-events: none; }
.framer .guide { position: absolute; inset: 9%; border-radius: 50%; border: 2px solid rgba(255,255,255,.75); box-shadow: 0 0 0 999px rgba(5,7,12,.35); pointer-events: none; }
.framer input[type=range] { display: block; width: min(300px, 78vw); margin: 12px auto 0; accent-color: var(--accent); }

/* ---------- settings ---------- */
.settings h3 { margin-top: 16px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.set-row > span:first-child { min-width: 0; font-weight: 600; }
.set-row .seg { flex: none; }
.row.wrap { margin-top: 12px; }
.credits { list-style: none; font-size: 12.5px; color: var(--muted); display: flex; flex-direction: column; gap: 2px; }
.credits b { color: var(--text); font-weight: 600; }
.scrollbox { max-height: 60dvh; overflow-y: auto; }

/* ---------- group browser: search on top, the list scrolls inside the sheet ---------- */
.sheet.groups { height: 88dvh; display: flex; flex-direction: column; overflow: hidden; padding-bottom: env(safe-area-inset-bottom); }
.gtop { display: flex; gap: 8px; align-items: center; }
.gtop input { flex: 1; min-width: 0; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); padding: 0 12px; outline: none; }
.gtop input:focus { border-color: var(--accent); }
.glist { flex: 1; min-height: 0; overflow-y: auto; margin: 6px -16px 0; padding: 0 16px 16px; -webkit-overflow-scrolling: touch; }
.glist .lbl { margin: 12px 0 4px; }
.ggrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); column-gap: 14px; }
.grp { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.grp .mosaic { width: 48px; flex: none; border-radius: 6px; }
.gtxt { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.gtxt b, .gtxt > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gtxt b { font-size: 14.5px; }
.glinks { display: flex; gap: 12px; margin-top: 1px; }
.glinks .link { font-size: 12.5px; }
.gadd { flex: none; min-width: 78px; }
.gadd.on { border-color: var(--warm); color: var(--warm); }

/* ---------- sheets + toast ---------- */
#layer { position: fixed; inset: 0; z-index: 40; display: none; align-items: flex-end; justify-content: center; }
#layer.on { display: flex; }
.veil { position: absolute; inset: 0; background: rgba(5,7,12,.6); }
.sheet { position: relative; width: 100%; max-width: 460px; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 16px 16px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); animation: up .22s ease-out; max-height: 88dvh; overflow-y: auto; }
.sheet.wide { max-width: 640px; }
.sheet p { margin-bottom: 6px; }
.zoom { text-align: center; }
.zoom .ph { width: min(240px, 70vw); margin: 4px auto 8px; border-radius: 14px; }
@keyframes up { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
#toast { position: fixed; left: 50%; bottom: calc(var(--tabh) + 14px + env(safe-area-inset-bottom)); transform: translate(-50%, 10px); z-index: 60; background: #2b3247; border: 1px solid var(--line); padding: 8px 14px; border-radius: 10px; font-size: 14px; box-shadow: 0 6px 20px rgba(0,0,0,.4); max-width: calc(100vw - 32px); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
#toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Sort faces: one face at a time, ← Don't know / Know → ---------- */
.lblrow { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 12px auto 6px; }
.lbllinks { display: flex; gap: 14px; align-items: baseline; }
#sorter { position: fixed; inset: 0; z-index: 45; background: var(--bg); display: flex; flex-direction: column; overflow: hidden;
  padding: calc(8px + env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left)); }
.so-top { display: flex; align-items: center; gap: 6px; min-height: 40px; width: 100%; max-width: 560px; margin: 0 auto; }
.so-count { font-size: 15px; font-variant-numeric: tabular-nums; }
.so-stage { flex: 1; min-height: 0; display: grid; place-items: center; container-type: size; }
.so-card { grid-area: 1 / 1; display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center;
  width: min(100cqw - 8px, 100cqh - 64px, 440px); touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab;
  transition: transform .22s ease, opacity .22s ease; }
.so-card .ph { width: 100%; border-radius: 16px; box-shadow: 0 0 0 2px transparent; transition: box-shadow .15s; }
.so-card.drag { transition: none; cursor: grabbing; }
.so-card[data-lean="yes"] .ph { box-shadow: 0 0 0 3px var(--good); }
.so-card[data-lean="no"] .ph { box-shadow: 0 0 0 3px var(--bad); }
.so-name { font-size: 20px; margin-top: 8px; line-height: 1.2; }
.so-from { font-size: 14px; }
.so-card.gone { pointer-events: none; opacity: 0; }
.so-card.fly-r { transform: translateX(110%) rotate(14deg); }
.so-card.fly-l { transform: translateX(-110%) rotate(-14deg); }
.so-card.in-r { animation: so-in-r .22s ease-out; }
.so-card.in-l { animation: so-in-l .22s ease-out; }
@keyframes so-in-r { from { transform: translateX(110%) rotate(14deg); opacity: 0; } }
@keyframes so-in-l { from { transform: translateX(-110%) rotate(-14deg); opacity: 0; } }
.so-end { cursor: default; gap: 8px; touch-action: auto; }
.so-end .col { width: min(100%, 280px); margin-top: 6px; }
.so-btns { display: flex; gap: 10px; width: 100%; max-width: 560px; margin: 10px auto 0; }
.so-btns .btn { flex: 1; min-height: 56px; font-size: 17px; }

/* ---------- laptop: both same-screen boards side by side, room for the opponent line ---------- */
@media (min-width: 900px) {
  .game { padding: 10px 18px 14px; gap: 10px; }
  .pmain { font-size: 17px; }
  .oppline { display: inline-flex; }
  .boards.two .boardbox.other { display: flex; opacity: .55; }
  .boards.two .boardbox { padding: 8px; border-radius: 14px; background: var(--bg-soft); border: 1px solid var(--line); }
  .pswitch { display: none; }
  .pane { padding-top: 20px; }
  .dock .btn { max-width: 240px; }
  .dock.askdock { max-width: 760px; margin: 0 auto; width: 100%; }
}
/* phone sideways: board on the left, prompt and buttons on the right */
@media (max-height: 500px) and (orientation: landscape) {
  :root { --tabh: 44px; }
  .top { min-height: 38px; padding-top: 3px; padding-bottom: 3px; }
  .tabs button { flex-direction: row; gap: 6px; }
  .tabs button svg { width: 18px; height: 18px; }
  .game { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 34%); grid-template-rows: auto auto minmax(0, 1fr); column-gap: 10px; row-gap: 6px; padding-left: max(8px, env(safe-area-inset-left)); padding-right: max(8px, env(safe-area-inset-right)); }
  .game > .boards { grid-column: 1; grid-row: 1 / -1; }
  .game > .prompt { grid-column: 2; grid-row: 1; flex-wrap: wrap; }
  .game > .pswitch { grid-column: 2; grid-row: 2; }
  .game > .dock { grid-column: 2; grid-row: 3; align-self: start; }
  .game > .cover, .game > .over { grid-column: 1 / -1; grid-row: 1 / -1; }
  .dock .btn { flex-basis: 40%; }
}
@media (max-width: 360px) {
  .brand span { font-size: 15px; }
  .seg button { padding: 5px 8px; }
  .set-row { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) { .face.flipping .ph, .sheet, .so-card { animation: none; } }

/* connection trouble (2026-11-19): a red bar under the top bar for as long as it lasts */
#netbar { position: fixed; left: 50%; top: calc(64px + env(safe-area-inset-top, 0px)); transform: translateX(-50%); z-index: 60; width: min(560px, calc(100vw - 24px)); box-sizing: border-box; padding: 10px 14px; border-radius: 10px; background: var(--bad); color: #1a0b0b; font-weight: 600; font-size: 14px; line-height: 1.35; text-align: center; box-shadow: 0 6px 18px rgba(0,0,0,.45); pointer-events: none; }
/* online: your face stays covered until tapped (2026-11-19) */
.mychip .mc-cover { display: grid; place-items: center; background: repeating-linear-gradient(45deg, #2b3550 0 5px, #232b42 5px 10px); color: var(--warm); font-weight: 700; font-size: 18px; }
