/* Code Names: a spy table seen from your chair. Rivals on top, the board in the middle, your team at the bottom. */
:root {
  --ink: #0f1119;
  --ink-2: #171a26;
  --ink-3: #222636;
  --line: rgba(255, 255, 255, 0.09);
  --text: #f3eee3;
  --text-dim: #a9a397;
  --paper: #f3ead6;
  --paper-2: #e6d9bc;
  --paper-ink: #2b2417;
  --paper-dim: #7b6d51;
  --fox: #d8462f;
  --fox-2: #a72e1c;
  --fox-soft: rgba(216, 70, 47, 0.18);
  --wolf: #2f6fd8;
  --wolf-2: #1d4ea6;
  --wolf-soft: rgba(47, 111, 216, 0.2);
  --civ: #d8c49a;
  --cat: #151515;
  --gold: #f2c14e;
  --ok: #3fbf74;
  --radius: 10px;
  --gap: 5px;
  --font: 'Rubik', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(120% 70% at 50% 0%, #1c2133 0%, var(--ink) 60%) fixed, var(--ink);
  color: var(--text); font: 500 15px/1.35 var(--font); overscroll-behavior: none; -webkit-font-smoothing: antialiased;
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
input { font: inherit; }
[hidden] { display: none !important; }
.app { position: relative; height: 100dvh; max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; overflow: hidden; }

/* ---------------------------------------------------------------- shared pieces */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px; border-radius: 12px;
  font-weight: 700; font-size: 16px; background: var(--ink-3); border: 1px solid var(--line); transition: transform 0.08s, filter 0.15s; }
.btn:active { transform: scale(0.97); }
.btn.big { min-height: 54px; font-size: 18px; width: 100%; }
.btn.gold { background: linear-gradient(180deg, #f6cf6a, #e0a92e); color: #2a1d02; border: 0; box-shadow: 0 3px 0 #a87a16; }
.btn.fox { background: linear-gradient(180deg, #e65a42, var(--fox-2)); border: 0; box-shadow: 0 3px 0 #7d1f11; color: #fff; }
.btn.wolf { background: linear-gradient(180deg, #4a86ea, var(--wolf-2)); border: 0; box-shadow: 0 3px 0 #123a80; color: #fff; }
.btn.ghost { background: transparent; }
.btn[disabled] { filter: grayscale(1) brightness(0.6); pointer-events: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; background: var(--ink-3); border: 1px solid var(--line); font-size: 13px; font-weight: 600; }
.icon-btn { width: 38px; height: 38px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 18px; background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); position: relative; }
.icon-btn .dot { position: absolute; top: 2px; inset-inline-end: 2px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--fox); font-size: 10px; font-weight: 800; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
.face { position: relative; width: var(--fs, 40px); height: var(--fs, 40px); border-radius: 50%; overflow: hidden; flex: none; background: var(--ink-3); border: 2px solid rgba(255, 255, 255, 0.25); }
.face img, .face video { width: 100%; height: 100%; object-fit: cover; display: block; }
.face video { transform: scaleX(-1); }
.face.spy { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(242, 193, 78, 0.25); }
.face.off { filter: grayscale(1) brightness(0.55); }
.face.talking { box-shadow: 0 0 0 3px var(--ok); }
.spy-badge { position: absolute; inset-inline-end: -3px; bottom: -2px; width: 18px; height: 18px; border-radius: 50%; background: var(--gold); color: #3a2a00; font-size: 11px; display: flex; align-items: center; justify-content: center; border: 2px solid var(--ink); }
.toast { position: fixed; z-index: 90; left: 50%; top: calc(env(safe-area-inset-top) + 54px); transform: translateX(-50%); max-width: min(92vw, 480px); padding: 10px 16px; border-radius: 12px;
  background: #2b2f40; border: 1px solid rgba(255, 255, 255, 0.14); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); font-weight: 600; text-align: center; animation: toast-in 0.2s ease-out; }
.toast.warn { background: #4a2a1a; border-color: #a5532b; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, -8px); } }
.muted { color: var(--text-dim); }

/* ---------------------------------------------------------------- join */
.join { flex: 1; overflow-y: auto; padding: 18px 18px calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 16px; }
.brand { display: flex; align-items: center; gap: 14px; }
.brand .owl { width: 72px; height: 72px; border-radius: 18px; overflow: hidden; flex: none; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5); }
.brand .owl img { width: 100%; height: 100%; object-fit: cover; }
.brand h1 { margin: 0; font-size: 28px; font-weight: 800; letter-spacing: -0.01em; line-height: 1.05; }
.brand p { margin: 4px 0 0; color: var(--text-dim); font-weight: 600; }
.brand .r { color: #ff7a63; } .brand .b { color: #7fb0ff; }
.topline { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.langs { display: inline-flex; background: var(--ink-3); border-radius: 99px; padding: 3px; border: 1px solid var(--line); }
.langs button { padding: 5px 12px; border-radius: 99px; font-weight: 700; font-size: 13px; color: var(--text-dim); }
.langs button.on { background: var(--text); color: var(--ink); }
.field { width: 100%; height: 52px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.16); background: #0b0d14; color: var(--text); padding: 0 14px; font-size: 18px; font-weight: 600; outline: none; user-select: text; -webkit-user-select: text; }
.field:focus { border-color: var(--gold); }
.label { font-weight: 700; font-size: 14px; color: var(--text-dim); margin: 0 0 8px; }
.faces { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.faces button { aspect-ratio: 1; border-radius: 50%; overflow: hidden; border: 3px solid transparent; background: var(--ink-3); position: relative; }
.faces button img { width: 100%; height: 100%; object-fit: cover; }
.faces button.on { border-color: var(--gold); transform: scale(1.06); }
.faces .selfie { display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; gap: 1px; background: #2a2f44; }
.faces .selfie b { font-size: 20px; }
.cam { position: relative; width: 210px; height: 210px; border-radius: 50%; overflow: hidden; margin: 0 auto; border: 4px solid var(--gold); background: #000; }
.cam video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.cam-row { display: flex; gap: 10px; justify-content: center; }

/* ---------------------------------------------------------------- lobby */
.lobby { flex: 1; overflow-y: auto; padding: 12px 14px calc(16px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; }
.roomline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.roomno { font-size: 13px; font-weight: 700; color: var(--text-dim); display: flex; align-items: baseline; gap: 6px; }
.roomno b { font-size: 30px; color: var(--text); font-weight: 800; letter-spacing: 0.02em; }
.roomline .grow { flex: 1; }
.owl-say { display: flex; gap: 10px; align-items: flex-start; }
.owl-say .face { --fs: 46px; border-radius: 14px; border: 0; }
.owl-say .bubble { flex: 1; background: var(--paper); color: var(--paper-ink); border-radius: 14px; border-start-start-radius: 4px; padding: 9px 12px; font-weight: 600; font-size: 14px; min-height: 46px; display: flex; align-items: center; }
.teams { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.team { border-radius: 16px; overflow: hidden; background: var(--ink-2); border: 1px solid var(--line); display: flex; flex-direction: column; min-height: 180px; }
.team .head { position: relative; height: 74px; background-size: cover; background-position: center 28%; display: flex; align-items: flex-end; padding: 8px 10px; }
.team .head::before { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0, 0, 0, 0) 20%, rgba(0, 0, 0, 0.7)); }
.team.r .head { background-image: url('/img/cards/fox1.webp'); box-shadow: inset 0 -3px 0 var(--fox); }
.team.b .head { background-image: url('/img/cards/wolf1.webp'); box-shadow: inset 0 -3px 0 var(--wolf); }
.team .head h3 { position: relative; margin: 0; font-size: 20px; font-weight: 800; text-shadow: 0 2px 6px rgba(0, 0, 0, 0.7); }
.team .head .n { position: relative; margin-inline-start: auto; font-weight: 700; font-size: 13px; opacity: 0.9; }
.team ul { list-style: none; margin: 0; padding: 6px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.member { display: flex; align-items: center; gap: 8px; padding: 4px; border-radius: 10px; }
.member.me { background: rgba(255, 255, 255, 0.06); }
.member .face { --fs: 34px; }
.member .nm { flex: 1; min-width: 0; font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.member .nm small { display: block; font-weight: 600; font-size: 11px; color: var(--text-dim); }
.member .nm small.spy { color: var(--gold); }
.team .acts { padding: 6px; display: flex; flex-direction: column; gap: 6px; }
.team .acts .btn { min-height: 38px; font-size: 14px; padding: 0 10px; }
.free { background: var(--ink-2); border: 1px dashed rgba(255, 255, 255, 0.2); border-radius: 14px; padding: 8px; }
.free h4 { margin: 0 0 6px; font-size: 13px; color: var(--text-dim); }
.free .row { display: flex; flex-wrap: wrap; gap: 6px; }
.free .member { background: var(--ink-3); padding-inline-end: 10px; }
.how { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.how div { background: var(--ink-2); border: 1px solid var(--line); border-radius: 12px; padding: 8px 6px; text-align: center; font-size: 11.5px; font-weight: 600; color: var(--text-dim); }
.how b { display: block; font-size: 20px; margin-bottom: 2px; }
.setrow { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.setrow:last-child { border-bottom: 0; }
.setrow .k { font-weight: 700; font-size: 14px; }
.setrow .k small { display: block; color: var(--text-dim); font-weight: 500; font-size: 12px; }
.seg { display: inline-flex; background: var(--ink); border-radius: 10px; padding: 3px; border: 1px solid var(--line); flex-wrap: wrap; }
.seg button { padding: 6px 9px; border-radius: 8px; font-size: 13px; font-weight: 700; color: var(--text-dim); }
.seg button.on { background: var(--gold); color: #2a1d02; }
.panel { background: var(--ink-2); border: 1px solid var(--line); border-radius: 16px; padding: 4px 12px; }
.why { text-align: center; color: var(--gold); font-weight: 700; font-size: 14px; min-height: 18px; }
.lobby-foot { display: flex; flex-direction: column; gap: 8px; margin-top: auto; }

/* ---------------------------------------------------------------- the game table */
.game { flex: 1; display: flex; flex-direction: column; min-height: 0; padding-bottom: env(safe-area-inset-bottom); }
.topbar { display: flex; align-items: center; gap: 6px; padding: calc(env(safe-area-inset-top) + 4px) 8px 4px; height: calc(40px + env(safe-area-inset-top)); flex: none; }
.topbar .roomno b { font-size: 18px; }
.topbar .grow { flex: 1; }
.topbar .icon-btn { width: 32px; height: 32px; font-size: 15px; }
.score { font-weight: 800; font-size: 14px; display: flex; gap: 4px; align-items: center; }
.score .r { color: #ff7a63; } .score .b { color: #7fb0ff; }

.strip { flex: none; display: flex; align-items: center; gap: 8px; padding: 6px 10px; height: 62px; position: relative; transition: box-shadow 0.3s, background 0.3s; }
.strip.r { background: linear-gradient(90deg, rgba(216, 70, 47, 0.42), rgba(216, 70, 47, 0.1)); }
.strip.b { background: linear-gradient(90deg, rgba(47, 111, 216, 0.45), rgba(47, 111, 216, 0.1)); }
[dir='rtl'] .strip.r { background: linear-gradient(270deg, rgba(216, 70, 47, 0.42), rgba(216, 70, 47, 0.1)); }
[dir='rtl'] .strip.b { background: linear-gradient(270deg, rgba(47, 111, 216, 0.45), rgba(47, 111, 216, 0.1)); }
.strip.top { border-bottom: 1px solid var(--line); }
.strip.bottom { border-top: 1px solid var(--line); }
.strip.active.r { box-shadow: inset 0 0 0 2px var(--fox), 0 0 24px rgba(216, 70, 47, 0.35); }
.strip.active.b { box-shadow: inset 0 0 0 2px var(--wolf), 0 0 24px rgba(47, 111, 216, 0.35); }
.strip.robot { filter: saturate(0.6); }
.crest { width: 44px; height: 44px; border-radius: 12px; background-size: 210%; background-position: 50% 22%; flex: none; border: 2px solid rgba(255, 255, 255, 0.3); }
.strip.r .crest { background-image: url('/img/cards/fox1.webp'); border-color: var(--fox); }
.strip.b .crest { background-image: url('/img/cards/wolf1.webp'); border-color: var(--wolf); }
.strip.robot .crest { position: relative; }
.strip.robot .crest::after { content: '🐈‍⬛'; position: absolute; inset-inline-end: -6px; bottom: -6px; font-size: 16px; filter: drop-shadow(0 1px 2px #000); }
.tinfo { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.tinfo b { font-size: 16px; font-weight: 800; line-height: 1; white-space: nowrap; }
.tinfo .tag { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; padding: 2px 6px; border-radius: 6px; background: rgba(255, 255, 255, 0.16); margin-inline-start: 6px; vertical-align: 2px; }
.pips { display: flex; gap: 3px; }
.pips i { width: 9px; height: 9px; border-radius: 50%; background: rgba(255, 255, 255, 0.85); }
.pips i.gone { background: rgba(255, 255, 255, 0.15); }
.strip.r .pips i:not(.gone) { background: #ff8a72; } .strip.b .pips i:not(.gone) { background: #8fbaff; } .strip.robot .pips i:not(.gone) { background: #bbb; }
.people { margin-inline-start: auto; display: flex; gap: 6px; align-items: flex-start; }
.person { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 46px; }
.person .face { --fs: 38px; }
.person span { font-size: 10px; font-weight: 700; max-width: 48px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: rgba(255, 255, 255, 0.9); }
.people.many .person { width: 38px; } .people.many .person .face { --fs: 32px; }
.person .face.me { border-color: #fff; }
.typing-dots { display: inline-flex; gap: 2px; margin-inline-start: 4px; }
.typing-dots i { width: 4px; height: 4px; border-radius: 50%; background: currentColor; animation: dot 1s infinite; }
.typing-dots i:nth-child(2) { animation-delay: 0.15s; } .typing-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes dot { 0%, 60%, 100% { opacity: 0.25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-2px); } }

.cluebar { flex: none; height: 48px; display: flex; align-items: center; gap: 10px; padding: 0 12px; background: var(--ink-2); border-bottom: 1px solid var(--line); }
.cluebar .who { width: 28px; height: 28px; border-radius: 8px; background-size: 210%; background-position: 50% 22%; flex: none; }
.cluebar .who.r { background-image: url('/img/cards/fox1.webp'); box-shadow: 0 0 0 2px var(--fox); }
.cluebar .who.b { background-image: url('/img/cards/wolf1.webp'); box-shadow: 0 0 0 2px var(--wolf); }
.cluebar .word { font-size: 22px; font-weight: 800; letter-spacing: 0.02em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.cluebar .num { flex: none; min-width: 30px; height: 30px; border-radius: 9px; background: var(--paper); color: var(--paper-ink); font-weight: 800; font-size: 19px; display: flex; align-items: center; justify-content: center; padding: 0 6px; }
.cluebar .wait { font-weight: 700; color: var(--text-dim); font-size: 15px; display: flex; align-items: center; min-width: 0; white-space: nowrap; overflow: hidden; }
.cluebar .grow { flex: 1; }
.tries { display: flex; gap: 4px; align-items: center; flex: none; font-size: 12px; font-weight: 700; color: var(--text-dim); }
.tries i { width: 10px; height: 10px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.5); }
.tries i.used { background: rgba(255, 255, 255, 0.85); border-color: transparent; }
.tries i.bonus { border-style: dashed; }
.sand { flex: none; display: flex; align-items: center; gap: 4px; font-weight: 800; font-size: 15px; padding: 3px 8px; border-radius: 9px; background: #3b2c10; color: var(--gold); }
.sand.low { background: #5a1a12; color: #ffb4a6; animation: pulse 0.9s infinite; }
@keyframes pulse { 50% { transform: scale(1.06); } }
.cluebar.win { justify-content: center; font-size: 19px; font-weight: 800; }
.cluebar.win.r { background: linear-gradient(90deg, var(--fox-2), var(--fox)); }
.cluebar.win.b { background: linear-gradient(90deg, var(--wolf-2), var(--wolf)); }

/* the board: the same card order on every phone (Hebrew phones too), so "top-left" means the same card for everyone */
.boardwrap { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 6px; position: relative; }
.board { direction: ltr; display: grid; grid-template-columns: repeat(5, 1fr); gap: var(--gap); width: 100%; grid-auto-rows: var(--rowh, 56px); }
.card { position: relative; border-radius: 8px; perspective: 600px; min-width: 0; }
.card .in { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform 0.5s cubic-bezier(0.25, 1, 0.5, 1); }
.card.open .in { transform: rotateY(180deg); }
.card .fc, .card .bk { position: absolute; inset: 0; border-radius: 8px; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden; }
.card .fc { background: linear-gradient(180deg, var(--paper), var(--paper-2)); box-shadow: 0 2px 0 #a8946b, 0 4px 10px rgba(0, 0, 0, 0.35); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2px 3px; }
.card .fc::before { content: ''; position: absolute; inset: 3px; border: 1px solid rgba(123, 109, 81, 0.35); border-radius: 5px; pointer-events: none; }
.card .w { color: var(--paper-ink); font-weight: 700; text-align: center; line-height: 1.02; white-space: nowrap; max-width: 100%; }
.card .w.two { white-space: normal; }
.card .w2 { color: var(--paper-dim); font-weight: 600; text-align: center; line-height: 1; white-space: nowrap; max-width: 100%; overflow: hidden; margin-top: 2px; }
.card .bk { transform: rotateY(180deg); background: #000; }
.card .bk img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 26%; display: block; }
.card .bk::after { content: ''; position: absolute; inset: 0; border-radius: 8px; box-shadow: inset 0 0 0 3px var(--kc, #fff); pointer-events: none; }
.card .bk .lbl { position: absolute; left: 0; right: 0; bottom: 0; padding: 1px 3px 2px; font-size: 9px; font-weight: 700; text-align: center; color: #fff; background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.75)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card[data-k='r'] { --kc: var(--fox); } .card[data-k='b'] { --kc: var(--wolf); } .card[data-k='n'] { --kc: var(--civ); } .card[data-k='a'] { --kc: #000; }
/* the spymaster's key: the colour is on the card itself */
.spyview .card:not(.open)[data-k='r'] .fc { background: linear-gradient(180deg, #ee6a52, #c73c26); box-shadow: 0 2px 0 #7d1f11, 0 4px 10px rgba(0, 0, 0, 0.35); }
.spyview .card:not(.open)[data-k='b'] .fc { background: linear-gradient(180deg, #5b93ee, #2b5fc2); box-shadow: 0 2px 0 #123a80, 0 4px 10px rgba(0, 0, 0, 0.35); }
.spyview .card:not(.open)[data-k='a'] .fc { background: linear-gradient(180deg, #2c2c2c, #0d0d0d); box-shadow: 0 2px 0 #000, 0 0 0 2px #f5c518 inset, 0 4px 10px rgba(0, 0, 0, 0.5); }
.spyview .card:not(.open)[data-k='r'] .w, .spyview .card:not(.open)[data-k='b'] .w { color: #fff; }
.spyview .card:not(.open)[data-k='r'] .w2, .spyview .card:not(.open)[data-k='b'] .w2 { color: rgba(255, 255, 255, 0.75); }
.spyview .card:not(.open)[data-k='a'] .w { color: #f5c518; }
.spyview .card:not(.open)[data-k='a'] .w2 { color: rgba(245, 197, 24, 0.7); }
.spyview .card:not(.open)[data-k='n'] .fc { background: linear-gradient(180deg, #ece2cb, #d8c8a4); }
.spyview .card.open .bk img, .over .card.open .bk img { filter: saturate(0.85) brightness(0.8); }
.card .ico { position: absolute; top: 2px; inset-inline-start: 3px; font-size: 9px; opacity: 0.85; }
/* game over: the cards nobody opened are tinted with their team's colour (everyone sees the key now) */
.over .card:not(.open)[data-k='r'] .fc { background: linear-gradient(180deg, #f7d6ce, #ecb8ab); }
.over .card:not(.open)[data-k='b'] .fc { background: linear-gradient(180deg, #d6e3f8, #b7cbee); }
.over .card:not(.open)[data-k='a'] .fc { background: linear-gradient(180deg, #2c2c2c, #0d0d0d); }
.over .card:not(.open)[data-k='a'] .w { color: #f5c518; }
/* fingers on the card: who points at it; my own pointed card shows "Open" */
.card.pt .fc { box-shadow: 0 0 0 3px var(--tc, #fff), 0 6px 16px rgba(0, 0, 0, 0.5); transform: translateY(-2px); }
.card.mine .fc { box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--tc, #fff), 0 8px 18px rgba(0, 0, 0, 0.55); }
.fingers { position: absolute; top: -7px; inset-inline-end: -5px; display: flex; z-index: 3; }
.fingers .face { --fs: 20px; border-width: 2px; border-color: #fff; margin-inline-start: -7px; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5); }
.card .go { position: absolute; left: 3px; right: 3px; bottom: 3px; height: 46%; min-height: 22px; border-radius: 6px; background: var(--ok); color: #05210f; font-weight: 800; font-size: 12px; z-index: 4;
  display: flex; align-items: center; justify-content: center; gap: 3px; box-shadow: 0 2px 0 #1f7a45; animation: go-in 0.18s ease-out; }
@keyframes go-in { from { transform: scale(0.6); opacity: 0; } }
.card.mark .fc { outline: 3px dashed var(--gold); outline-offset: -3px; }
.card.mark .fc::after { content: '★'; position: absolute; top: 1px; inset-inline-end: 3px; color: var(--gold); font-size: 11px; text-shadow: 0 1px 2px #000; }
.card.just .bk { animation: just 1.2s ease-out; }
@keyframes just { 0% { filter: brightness(2); } 100% { filter: brightness(1); } }
.card.cat-hit .bk { animation: cat-shake 0.6s; }
@keyframes cat-shake { 10%, 50%, 90% { transform: rotateY(180deg) translateX(-4px); } 30%, 70% { transform: rotateY(180deg) translateX(4px); } }
.board.tap .card:not(.open) { cursor: pointer; }
.board.tap .card:not(.open):active .fc { transform: scale(0.96); }
.flash { position: fixed; inset: 0; pointer-events: none; z-index: 60; animation: flash 0.9s ease-out forwards; }
.flash.cat { background: radial-gradient(circle, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.92)); }
.flash.miss { background: rgba(255, 60, 30, 0.18); }
@keyframes flash { from { opacity: 1; } to { opacity: 0; } }

/* the owl's line / what to do now */
.owlbar { flex: none; display: flex; align-items: center; gap: 8px; padding: 4px 10px; min-height: 48px; }
.owlbar .owlf { width: 40px; height: 40px; border-radius: 12px; overflow: hidden; flex: none; background: #263044; }
.owlbar .owlf img { width: 100%; height: 100%; object-fit: cover; }
.owlbar .txt { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 600; line-height: 1.25; color: var(--text-dim); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.owlbar .txt.say { color: var(--text); }
.owlbar .spk { flex: none; }

/* what I can do now */
.actions { flex: none; padding: 4px 10px 8px; display: flex; gap: 8px; align-items: center; min-height: 60px; }
.actions .btn { min-height: 48px; }
.actions .grow { flex: 1; }
.actions .note { flex: 1; font-size: 14px; font-weight: 700; color: var(--text-dim); }
.compose { display: flex; gap: 6px; width: 100%; align-items: center; }
.compose .field { height: 48px; font-size: 18px; flex: 1; min-width: 0; text-transform: uppercase; }
.compose .field::placeholder { text-transform: none; color: #6d6a63; font-weight: 600; }
.stepper { display: flex; align-items: center; background: #0b0d14; border: 1px solid rgba(255, 255, 255, 0.16); border-radius: 12px; height: 48px; flex: none; }
.stepper button { width: 32px; height: 46px; font-size: 22px; font-weight: 700; color: var(--text-dim); }
.stepper b { min-width: 26px; text-align: center; font-size: 20px; font-weight: 800; }
.compose .btn { padding: 0 14px; }

/* ---------------------------------------------------------------- sheets */
.sheet-bg { position: fixed; inset: 0; z-index: 70; background: rgba(5, 6, 10, 0.55); animation: fade 0.18s; }
@keyframes fade { from { opacity: 0; } }
.sheet { position: fixed; z-index: 71; left: 50%; bottom: 0; transform: translateX(-50%); width: min(100vw, 560px); max-height: 82dvh; overflow-y: auto; background: #1a1d2a; border-radius: 20px 20px 0 0;
  border: 1px solid rgba(255, 255, 255, 0.1); padding: 8px 16px calc(18px + env(safe-area-inset-bottom)); animation: sheet-in 0.22s cubic-bezier(0.2, 0.9, 0.3, 1); box-shadow: 0 -20px 50px rgba(0, 0, 0, 0.5); }
@keyframes sheet-in { from { transform: translate(-50%, 40px); opacity: 0; } }
.sheet .grab { width: 40px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.25); margin: 0 auto 8px; }
.sheet h2 { margin: 4px 0 10px; font-size: 20px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.sheet h2 .x { margin-inline-start: auto; }
.sheet .sec { margin: 12px 0 6px; font-size: 13px; font-weight: 800; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; }
.rule { display: flex; gap: 10px; padding: 7px 0; font-size: 14.5px; font-weight: 500; }
.rule b { font-size: 20px; width: 26px; flex: none; text-align: center; }
.vol { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-weight: 700; font-size: 14px; }
.vol span { width: 72px; }
.vol input { flex: 1; accent-color: var(--gold); }
.logrow { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.logrow .who { width: 26px; height: 26px; border-radius: 8px; background-size: 210%; background-position: 50% 22%; flex: none; margin-top: 2px; }
.logrow .who.r { background-image: url('/img/cards/fox1.webp'); } .logrow .who.b { background-image: url('/img/cards/wolf1.webp'); }
.logrow .cw { font-weight: 800; font-size: 17px; text-transform: uppercase; }
.logrow .cw .n { display: inline-block; margin-inline-start: 6px; padding: 0 6px; border-radius: 6px; background: var(--paper); color: var(--paper-ink); font-size: 14px; }
.logrow .by { font-size: 12px; color: var(--text-dim); font-weight: 600; }
.wchips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.wchip { font-size: 12px; font-weight: 700; padding: 2px 7px; border-radius: 6px; background: var(--paper); color: var(--paper-ink); }
.wchip.r { background: var(--fox); color: #fff; } .wchip.b { background: var(--wolf); color: #fff; } .wchip.n { background: var(--civ); } .wchip.a { background: #000; color: #f5c518; }
.wchip.meant { background: transparent; border: 1px dashed var(--gold); color: var(--gold); }
.wchip.meant.hit { border-style: solid; }
.recap-head { text-align: center; padding: 6px 0 4px; }
.recap-head .big { font-size: 26px; font-weight: 800; }
.recap-head .art { width: 120px; height: 80px; border-radius: 12px; object-fit: cover; object-position: 50% 26%; margin-bottom: 6px; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5); }
.scoreline { display: flex; justify-content: center; gap: 14px; font-weight: 800; font-size: 18px; margin: 6px 0 10px; }
.scoreline .r { color: #ff7a63; } .scoreline .b { color: #7fb0ff; }
.btnrow { display: flex; gap: 8px; margin-top: 12px; }
.btnrow .btn { flex: 1; }

/* the coach: a small bubble next to what it explains (first game only, never blocks the board) */
.coach { position: fixed; z-index: 65; max-width: min(330px, 88vw); background: var(--gold); color: #2a1d02; border-radius: 14px; padding: 10px 12px; font-weight: 700; font-size: 14px; line-height: 1.3;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.55); animation: coach-in 0.25s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes coach-in { from { transform: scale(0.85); opacity: 0; } }
.coach .ok { display: block; margin-top: 8px; margin-inline-start: auto; padding: 6px 12px; border-radius: 9px; background: #2a1d02; color: var(--gold); font-weight: 800; font-size: 13px; }
.coach::after { content: ''; position: absolute; width: 14px; height: 14px; background: var(--gold); transform: rotate(45deg); left: var(--ax, 50%); margin-left: -7px; }
.coach.below::after { top: -6px; } .coach.above::after { bottom: -6px; }

/* sound unlock + watch screen */
.unlock { position: fixed; z-index: 80; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom) + 130px); padding: 10px 16px; border-radius: 99px; background: var(--gold); color: #2a1d02; font-weight: 800; box-shadow: 0 10px 24px rgba(0, 0, 0, 0.5); animation: pulse 1.6s infinite; }
.qr { background: #fff; border-radius: 16px; padding: 10px; width: 180px; height: 180px; }
.qr img { width: 100%; height: 100%; }
.tvjoin { display: flex; gap: 18px; align-items: center; background: var(--ink-2); border: 1px solid var(--line); border-radius: 18px; padding: 14px; }
.tvjoin .big { font-size: 22px; font-weight: 800; }
.tvjoin .url { font-size: 28px; font-weight: 800; color: var(--gold); }

/* wide screens (laptop, TV): the same table laid out at 1280 px and scaled to the screen (app.js sets --z) */
body.wide { overflow: hidden; }
body.wide .app { position: absolute; left: 50%; top: 0; max-width: none; width: calc(100vw / var(--z, 1)); height: calc(100dvh / var(--z, 1)); transform: translateX(-50%) scale(var(--z, 1)); transform-origin: top center; }
body.wide .lobby { max-width: 1100px; margin: 0 auto; width: 100%; }
body.wide .card .bk .lbl { font-size: 12px; }
body.wide .owlbar { display: none; }
.side { display: none; }
body.wide .boardwrap { gap: 14px; align-items: stretch; }
body.wide .board { align-self: center; flex: none; }
body.wide .side { display: flex; flex-direction: column; width: 240px; flex: none; min-height: 0; }
body.wide .side.l { align-items: center; justify-content: center; gap: 8px; }
.owlbig { width: 190px; height: 190px; border-radius: 28px; overflow: hidden; box-shadow: 0 14px 34px rgba(0, 0, 0, 0.55); }
.owlbig img { width: 100%; height: 100%; object-fit: cover; }
.owlname { font-weight: 800; font-size: 14px; color: var(--gold); letter-spacing: 0.04em; }
.side .bubble { background: var(--paper); color: var(--paper-ink); border-radius: 16px; padding: 12px 14px; font-weight: 600; font-size: 16px; line-height: 1.3; min-height: 64px; width: 100%; position: relative; }
.side .bubble::before { content: ''; position: absolute; top: -7px; left: 50%; margin-left: -8px; width: 16px; height: 16px; background: var(--paper); transform: rotate(45deg); }
.side .bubble:not(.say) { background: #2a2f44; color: var(--text-dim); }
.side .bubble:not(.say)::before { background: #2a2f44; }
.side.r { overflow-y: auto; padding: 6px 4px; }
.side.r h3 { margin: 0 0 6px; font-size: 15px; font-weight: 800; color: var(--text-dim); }
.side.r .logrow { padding: 6px 0; }
.side.r .cw { font-size: 15px; }
.tv .actions { display: none; }
body.wide .unlock { bottom: auto; top: 10px; left: auto; right: 70px; transform: none; }
.member[data-act='who'] { cursor: pointer; }
.member[data-act='who']:active { background: rgba(255, 255, 255, 0.08); }
.sheet h2 .face { margin-inline-end: 4px; }
.rotate { display: none; }
@media (min-aspect-ratio: 4/3) and (max-height: 500px) {
  .rotate { display: flex; position: fixed; inset: 0; z-index: 200; background: var(--ink); flex-direction: column; align-items: center; justify-content: center; gap: 10px; font-weight: 800; font-size: 20px; text-align: center; padding: 20px; }
  .rotate b { font-size: 54px; animation: rot 1.6s ease-in-out infinite; }
}
@keyframes rot { 50% { transform: rotate(-90deg); } }
.callnote { margin: 6px 0; padding: 8px 10px; border-radius: 10px; background: var(--ink-3); font-weight: 600; font-size: 13.5px; }
.callnote.team { background: rgba(63, 191, 116, 0.16); border: 1px solid rgba(63, 191, 116, 0.35); }
.callnote.warn { background: rgba(242, 193, 78, 0.14); border: 1px solid rgba(242, 193, 78, 0.4); color: #ffe2a0; }
/* laptops / TVs: the join screen and the landing page keep a phone-like column (the face picker was huge) */
body.wide .join, .join { max-width: 560px; margin: 0 auto; width: 100%; }
.faces button { max-width: 76px; justify-self: center; width: 100%; }
