* { box-sizing: border-box; }
:root {
  --felt: #0f5132;
  --felt-dark: #08331f;
  --gold: #f5c542;
  --red: #e5383b;
  --ink: #f8f9fa;
  --muted: #a8c5b5;
}
html, body { margin: 0; height: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: radial-gradient(ellipse at center, var(--felt) 0%, var(--felt-dark) 100%) fixed;
  -webkit-tap-highlight-color: transparent;
}
button {
  font: inherit;
  border: 0;
  border-radius: 14px;
  padding: 14px 20px;
  font-weight: 700;
  cursor: pointer;
  background: var(--gold);
  color: #222;
}
button:disabled { opacity: .35; cursor: default; }
button.ghost { background: rgba(255,255,255,.12); color: var(--ink); }
button.liar { background: var(--red); color: #fff; font-size: 1.6rem; letter-spacing: 2px; }
input {
  font: inherit;
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  border: 2px solid rgba(255,255,255,.2);
  background: rgba(0,0,0,.25);
  color: var(--ink);
  font-size: 1.2rem;
}
input:focus { outline: none; border-color: var(--gold); }
.hidden { display: none !important; }
.muted { color: var(--muted); }

/* Cards */
.card {
  position: relative;
  width: 64px;
  height: 92px;
  border-radius: 10px;
  background: #fff;
  color: #111;
  box-shadow: 0 3px 8px rgba(0,0,0,.4);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  user-select: none;
  flex: 0 0 auto;
  transition: transform .15s;
}
.card.red { color: #c1121f; }
.card.joker { background: linear-gradient(135deg, #ffe066, #ff8fab 50%, #8ecae6); color: #3a0ca3; }
.card .corner { position: absolute; top: 4px; left: 7px; font-weight: 800; font-size: .9rem; }
.card .big { font-size: 2.2rem; font-weight: 900; line-height: 1; }
.card .suit { font-size: .8rem; font-weight: 800; }
.card.back {
  background: repeating-linear-gradient(45deg, #7b2cbf 0 6px, #5a189a 6px 12px);
  border: 3px solid #fff;
}
.card.selected { transform: translateY(-14px); box-shadow: 0 0 0 4px var(--gold), 0 8px 14px rgba(0,0,0,.5); }

/* Overlay (rules) */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  display: none; align-items: center; justify-content: center; z-index: 50; padding: 12px;
}
.overlay.show { display: flex; }
.overlay .sheet {
  position: relative; width: 100%; max-width: 720px; height: 92vh;
  background: var(--felt-dark); border-radius: 16px; overflow: hidden;
}
.overlay iframe { width: 100%; height: 100%; border: 0; }
.overlay .close { position: absolute; top: 8px; right: 8px; padding: 8px 14px; z-index: 2; }

/* Rules page */
.rules-page { background: var(--felt-dark); }
.rules { max-width: 680px; margin: 0 auto; padding: 20px 20px 60px; line-height: 1.5; }
.rules h1 { margin-top: 8px; }
.rules h2 { color: var(--gold); margin-top: 28px; font-size: 1.15rem; text-transform: uppercase; letter-spacing: 1px; }
.rules .lead { font-size: 1.1rem; }
.rules li { margin: 6px 0; }

/* ---------- Phone ---------- */
.phone { max-width: 520px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; padding: 14px; }
.phone header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.phone header .title { font-weight: 800; font-size: 1.1rem; }
.phone header button { padding: 8px 14px; font-size: .9rem; }
.phone .screen { flex: 1; display: flex; flex-direction: column; gap: 14px; padding-top: 14px; }
.phone .center { text-align: center; }
.phone .hero { font-size: 2rem; font-weight: 900; margin: 10px 0; }
.join-form { display: flex; flex-direction: column; gap: 14px; margin-top: 20px; }
.join-form label { font-weight: 700; color: var(--muted); font-size: .9rem; }
#code { text-transform: uppercase; letter-spacing: 8px; font-size: 1.8rem; text-align: center; font-weight: 800; }
.error { color: #ffb3b3; font-weight: 700; min-height: 1.2em; }
.plist { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.plist li { background: rgba(0,0,0,.25); border-radius: 12px; padding: 12px 14px; display: flex; justify-content: space-between; align-items: center; }
.plist li.off { opacity: .5; }
.plist button { padding: 6px 10px; font-size: .8rem; }
.tablebar { display: flex; align-items: center; gap: 14px; background: rgba(0,0,0,.25); border-radius: 14px; padding: 10px 14px; }
.tablebar .card { width: 48px; height: 68px; }
.tablebar .card .big { font-size: 1.6rem; }
.tablebar .what { flex: 1; }
.tablebar .what b { font-size: 1.3rem; display: block; }
.status { text-align: center; font-size: 1.25rem; font-weight: 800; padding: 12px; border-radius: 14px; background: rgba(0,0,0,.2); }
.status.turn { background: var(--gold); color: #222; animation: pulse 1.2s infinite alternate; }
.status.must { background: var(--red); color: #fff; }
@keyframes pulse { from { transform: scale(1); } to { transform: scale(1.03); } }
.claim { text-align: center; color: var(--muted); }
.hand { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; padding: 18px 0 6px; }
.hand .card { width: 72px; height: 104px; cursor: pointer; }
.hand .card .big { font-size: 2.6rem; }
.actions { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: auto; padding-bottom: 8px; }
.actions button { padding: 18px; font-size: 1.2rem; }
.reveal-cards { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: #222; color: #fff; padding: 12px 18px; border-radius: 12px; z-index: 60; font-weight: 700;
}
.conn { position: fixed; top: 0; left: 0; right: 0; background: var(--red); color: #fff; text-align: center; padding: 4px; font-size: .85rem; z-index: 70; }

/* ---------- TV ---------- */
.tv { height: 100vh; display: flex; flex-direction: column; padding: 2.5vh 3vw; overflow: hidden; font-size: 2.2vh; }
.tv header { display: flex; justify-content: space-between; align-items: center; }
.tv header .logo { font-size: 4vh; font-weight: 900; }
.tv header .tools button { font-size: 1.8vh; padding: 1vh 1.6vh; margin-left: 1vh; }
.tv .badge { background: rgba(0,0,0,.3); border-radius: 1.5vh; padding: .8vh 1.8vh; font-weight: 700; }
.tv-lobby { flex: 1; display: grid; grid-template-columns: 1.1fr 1fr; gap: 4vw; align-items: center; }
.joinbox { text-align: center; }
.joinbox .url { font-size: 3.4vh; }
.joinbox .url b { color: var(--gold); }
.joinbox .code { font-size: 16vh; font-weight: 900; letter-spacing: 3vh; line-height: 1; margin: 2vh 0; color: var(--gold); text-shadow: 0 .6vh 0 rgba(0,0,0,.35); }
.joinbox .qr { background: #fff; border-radius: 2vh; padding: 1.5vh; display: inline-block; }
.joinbox .qr svg { width: 24vh; height: 24vh; display: block; }
.lobby-side h2 { font-size: 3vh; margin: 0 0 1.5vh; color: var(--gold); }
.lobby-side ol.how { padding-left: 3vh; margin: 0 0 3vh; font-size: 2.3vh; line-height: 1.45; }
.chips { display: flex; flex-wrap: wrap; gap: 1.2vh; }
.chip { background: rgba(0,0,0,.3); padding: 1.2vh 2vh; border-radius: 5vh; font-size: 2.6vh; font-weight: 700; }
.chip.off { opacity: .45; }
.tv-game { flex: 1; display: flex; flex-direction: column; gap: 2vh; min-height: 0; }
.seats { display: flex; justify-content: center; gap: 1.6vw; flex-wrap: wrap; }
.seat {
  background: rgba(0,0,0,.3); border-radius: 2vh; padding: 1.4vh 2vh; min-width: 15vw; text-align: center;
  border: .5vh solid transparent; transition: transform .2s, border-color .2s;
}
.seat.turn { border-color: var(--gold); transform: translateY(-.8vh); box-shadow: 0 0 3vh rgba(245,197,66,.45); }
.seat.out { opacity: .35; }
.seat.off .name::after { content: " 📵"; }
.seat .name { font-size: 3vh; font-weight: 800; }
.seat .lives { font-size: 2.6vh; margin: .6vh 0; }
.seat .count { display: flex; justify-content: center; gap: .4vh; min-height: 4.6vh; }
.seat .count .card { width: 3vh; height: 4.4vh; border-width: .25vh; border-radius: .5vh; box-shadow: none; }
.table-area { flex: 1; display: grid; grid-template-columns: 1fr 1.3fr 1fr; align-items: center; gap: 3vw; min-height: 0; }
.tablecard { text-align: center; }
.tablecard .label { font-size: 2.6vh; color: var(--muted); text-transform: uppercase; letter-spacing: .4vh; }
.tablecard .card { width: 16vh; height: 23vh; border-radius: 2vh; margin-top: 1.5vh; }
.tablecard .card .big { font-size: 10vh; }
.tablecard .card .corner { font-size: 2.6vh; top: 1vh; left: 1.5vh; }
.tablecard .card .suit { font-size: 2.6vh; }
.tablecard .name { font-size: 4.5vh; font-weight: 900; margin-top: 1vh; color: var(--gold); }
.pile { position: relative; height: 30vh; display: flex; align-items: center; justify-content: center; }
.pile .card { position: absolute; width: 14vh; height: 20vh; border-width: .5vh; border-radius: 1.6vh; }
.pile .count { position: absolute; bottom: -3vh; font-size: 2.6vh; color: var(--muted); }
.claimbox { text-align: center; font-size: 3.6vh; font-weight: 800; margin-top: 7vh; min-height: 5vh; }
.claimbox .who { color: var(--gold); }
.turnline { text-align: center; font-size: 3vh; }
.logbox { font-size: 2vh; color: var(--muted); line-height: 1.6; }
.logbox div:last-child { color: var(--ink); }
.bigmsg {
  position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: rgba(0,0,0,.72); z-index: 40; text-align: center; gap: 3vh;
}
.bigmsg .headline { font-size: 11vh; font-weight: 900; letter-spacing: .6vh; }
.bigmsg .headline.lie { color: var(--red); text-shadow: 0 0 4vh rgba(229,56,59,.6); }
.bigmsg .headline.honest { color: #74c69d; }
.bigmsg .sub { font-size: 4vh; }
.bigmsg .reveal-cards .card { width: 16vh; height: 23vh; border-radius: 2vh; animation: flip .6s ease-out both; }
.bigmsg .reveal-cards .card .big { font-size: 10vh; }
.bigmsg .reveal-cards .card .corner, .bigmsg .reveal-cards .card .suit { font-size: 2.6vh; }
.bigmsg .reveal-cards .card.bad { box-shadow: 0 0 0 1vh var(--red); }
.bigmsg .reveal-cards .card:nth-child(2) { animation-delay: .25s; }
.bigmsg .reveal-cards .card:nth-child(3) { animation-delay: .5s; }
@keyframes flip { from { transform: rotateY(90deg) scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
.bigmsg .countdown { font-size: 2.4vh; color: var(--muted); }
.trophy { font-size: 20vh; }
