/* =====================================================================
   BLUFF — premium card table. Emerald felt, ivory cards, gold for "your move".
   Built on Bootstrap 5 (dark mode); this file only adds the table look.
   ===================================================================== */
:root {
  --felt-1: #0d5c3f;
  --felt-2: #063522;
  --felt-3: #04261a;
  --ink: #f4f1e8;
  --muted: #a9c2b5;
  --gold: #f5c542;
  --gold-2: #d9a520;
  --ruby: #e2404f;
  --card: #fbfaf6;
  --card-edge: #d8d2c2;
  --card-red: #c8102e;
  --card-black: #1b1b1f;
  --line: rgba(255, 255, 255, 0.12);
  --f-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --f-body: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --bs-body-font-family: var(--f-body);
  --bs-body-bg: var(--felt-3);
  --bs-body-color: var(--ink);
}
html, body { min-height: 100%; }
body {
  background: radial-gradient(ellipse at 50% 20%, var(--felt-1) 0%, var(--felt-2) 55%, var(--felt-3) 100%) fixed, var(--felt-3);
  color: var(--ink);
  font-family: var(--f-body);
  padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right);
}
:focus-visible { outline: 3px solid var(--gold) !important; outline-offset: 2px; }
a { color: var(--gold); }
.link-gold { color: var(--gold); text-decoration: none; font-weight: 700; }
.link-gold:hover { text-decoration: underline; }
.gold { color: var(--gold); }

.btn-gold { background: linear-gradient(180deg, var(--gold), var(--gold-2)); color: #2b1d00; border: 0; font-weight: 800; letter-spacing: 0.01em; }
.btn-gold:hover, .btn-gold:focus { background: linear-gradient(180deg, #ffd65e, var(--gold)); color: #2b1d00; }
.btn-gold:disabled { background: #6b6b5a; color: #222; opacity: 0.6; }
.btn { border-radius: 12px; }
.form-control, .form-select { background-color: rgba(0, 0, 0, 0.28); border-color: var(--line); color: var(--ink); }
.form-control:focus, .form-select:focus { background-color: rgba(0, 0, 0, 0.35); color: var(--ink); border-color: var(--gold); box-shadow: 0 0 0 0.2rem rgba(245, 197, 66, 0.25); }
.form-control::placeholder { color: rgba(244, 241, 232, 0.4); }
.form-text { color: var(--muted); }

.eyebrow { font-size: 0.75rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); font-weight: 800; }
.display-title { font-family: var(--f-display); font-weight: 800; letter-spacing: 0.01em; line-height: 0.95; font-size: clamp(2.8rem, 9vw, 5.2rem); margin: 0 0 0.6rem; }
.display-title small { display: block; font-size: 0.42em; letter-spacing: 0.22em; color: var(--muted); margin-top: 0.3em; }
.display-title .dash { color: var(--gold); }
.subtitle { color: var(--ink); max-width: 30ch; }
.section-title { font-family: var(--f-display); font-size: 1.6rem; margin-bottom: 1rem; }
.brand { font-family: var(--f-display); font-weight: 800; letter-spacing: 0.12em; color: var(--gold); text-decoration: none; font-size: 1.25rem; }

.felt-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.or-line { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.1em; }
.or-line::before, .or-line::after { content: ''; height: 1px; flex: 1; background: var(--line); }
.code-input { text-transform: uppercase; letter-spacing: 0.2em; font-weight: 800; }
.step { background: rgba(0, 0, 0, 0.18); border: 1px solid var(--line); border-radius: 14px; padding: 16px; height: 100%; }
.step b { color: var(--gold); font-family: var(--f-display); font-size: 1.1rem; }
.step p { margin: 6px 0 0; color: var(--muted); font-size: 0.92rem; }

/* ---------- playing cards ---------- */
.pcard {
  --w: 64px; position: relative; display: inline-flex; flex-direction: column; justify-content: space-between;
  width: var(--w); height: calc(var(--w) * 1.42); border-radius: calc(var(--w) * 0.12);
  background: var(--card); border: 1px solid var(--card-edge); box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35);
  padding: calc(var(--w) * 0.08) calc(var(--w) * 0.1); font-weight: 800; line-height: 1; user-select: none;
}
.pcard span { font-size: calc(var(--w) * 0.34); font-family: var(--f-display); }
.pcard i { font-style: normal; font-size: calc(var(--w) * 0.5); align-self: flex-end; }
.pcard.red { color: var(--card-red); } .pcard.black { color: var(--card-black); }
.pcard.back { background: repeating-linear-gradient(45deg, #7a1424 0 6px, #9b1b30 6px 12px); border: 3px solid var(--card); }
.hero-cards { position: relative; height: 170px; margin-top: 1.5rem; }
.hero-cards .pcard { --w: 96px; position: absolute; top: 0; }
.hero-cards .tilt-l { left: 0; transform: rotate(-12deg); }
.hero-cards .tilt-0 { left: 64px; top: -10px; transform: rotate(-2deg); }
.hero-cards .tilt-r { left: 128px; transform: rotate(10deg); }

/* ---------- lobby ---------- */
.room-code { font-family: var(--f-display); font-size: clamp(2.2rem, 8vw, 3rem); letter-spacing: 0.22em; color: var(--gold); line-height: 1; }
.player-list { display: grid; gap: 6px; }
.player-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: rgba(0, 0, 0, 0.18); }
.player-row.me { outline: 1px solid rgba(245, 197, 66, 0.4); }
.player-row .pname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.avatar { width: 34px; height: 34px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: linear-gradient(135deg, var(--gold), #c47f17); color: #2b1d00; }
.conn { width: 10px; height: 10px; border-radius: 50%; flex: none; display: inline-block; }
.conn.on { background: #33d17a; box-shadow: 0 0 6px #33d17a; } .conn.off { background: #6b7280; }
.chat-log { min-height: 120px; max-height: 240px; overflow-y: auto; font-size: 0.88rem; display: flex; flex-direction: column; gap: 3px; overflow-wrap: anywhere; }
.chat-line .t { color: var(--muted); font-size: 0.75rem; }
.chat-line.ev { color: var(--muted); }
.chat-line.ev-challenge_result { color: var(--gold); }
.chat-line.ev-game_over { color: var(--gold); font-weight: 700; }
.rules-table td:first-child { color: var(--muted); width: 45%; }

/* ---------- game table ---------- */
.page-game { overflow-x: hidden; }
.game-shell {
  min-height: 100vh; min-height: 100dvh; display: grid; gap: 10px; max-width: 1100px; margin: 0 auto;
  grid-template-rows: auto auto 1fr auto auto; grid-template-columns: minmax(0, 1fr);
  padding: max(8px, env(safe-area-inset-top)) 12px max(10px, env(safe-area-inset-bottom));
}
.game-shell > * { min-width: 0; }
.topbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.status-pill { padding: 4px 12px; border-radius: 999px; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--line); font-weight: 700; font-size: 0.85rem; }
.status-pill[data-kind="warn"] { border-color: var(--ruby); color: #ffb4bb; }
.code-btn b { color: var(--gold); letter-spacing: 0.1em; }

.opponents { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.opp {
  min-width: 108px; max-width: 150px; flex: 1 1 108px; text-align: center; padding: 10px 8px; border-radius: 16px;
  background: rgba(0, 0, 0, 0.22); border: 1px solid var(--line); transition: box-shadow 0.25s, border-color 0.25s, opacity 0.25s;
}
.opp.active { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(245, 197, 66, 0.35), 0 0 22px rgba(245, 197, 66, 0.25); }
.opp.out { opacity: 0.45; }
.opp-top { position: relative; display: inline-block; }
.opp-top .conn { position: absolute; right: -2px; bottom: 0; border: 2px solid var(--felt-2); }
.opp-name { font-weight: 800; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 4px; }
.opp-cards { display: flex; align-items: center; justify-content: center; gap: 0; margin-top: 4px; min-height: 22px; }
.opp-cards b { margin-left: 8px; font-variant-numeric: tabular-nums; }
.mini-back { width: 13px; height: 19px; border-radius: 3px; margin-left: -6px; background: repeating-linear-gradient(45deg, #7a1424 0 3px, #9b1b30 3px 6px); border: 1.5px solid var(--card); display: inline-block; }
.mini-back:first-child { margin-left: 0; }
.opp-tag { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }

.table-center {
  display: grid; grid-template-columns: auto auto 1fr; gap: 18px; align-items: center; align-self: center;
  background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.08), rgba(0, 0, 0, 0.15));
  border: 1px solid var(--line); border-radius: 26px; padding: 18px 20px; min-height: 190px;
}
.pile-wrap, .rank-wrap { text-align: center; }
.pile { position: relative; width: 78px; height: 110px; margin: 0 auto; }
.pile-stack i { position: absolute; inset: 0; border-radius: 9px; background: repeating-linear-gradient(45deg, #7a1424 0 6px, #9b1b30 6px 12px); border: 3px solid var(--card); box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35); }
.pile-stack i:nth-child(2) { transform: rotate(5deg) translate(2px, -2px); } .pile-stack i:nth-child(3) { transform: rotate(-6deg) translate(-3px, -3px); }
.pile-stack i:nth-child(4) { transform: rotate(9deg) translate(4px, -5px); } .pile-stack i:nth-child(5) { transform: rotate(-10deg) translate(-4px, -6px); }
.pile-stack i:nth-child(6) { transform: rotate(3deg) translate(1px, -8px); }
.pile-count { position: absolute; right: -10px; bottom: -10px; min-width: 32px; height: 32px; border-radius: 999px; display: grid; place-items: center; background: var(--gold); color: #2b1d00; font-weight: 800; font-variant-numeric: tabular-nums; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4); }
.pile-label, .rank-label { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.12em; margin-top: 12px; }
.rank-label { margin: 0 0 4px; }
.rank-big { font-family: var(--f-display); font-weight: 800; font-size: 4.2rem; line-height: 1; color: var(--ink); text-shadow: 0 6px 20px rgba(0, 0, 0, 0.4); }
.rank-big.mine { color: var(--gold); }
.rank-name { font-weight: 700; color: var(--muted); }
.play-info { min-width: 0; }
.last-play { font-size: 1.05rem; }
.challenge-bar { height: 8px; border-radius: 999px; background: rgba(0, 0, 0, 0.35); overflow: hidden; margin-top: 10px; }
.challenge-fill { height: 100%; width: 100%; background: linear-gradient(90deg, var(--ruby), var(--gold)); }
.reveal { margin-top: 12px; padding: 10px 12px; border-radius: 14px; background: rgba(0, 0, 0, 0.35); border: 1px solid var(--line); animation: pop 0.35s ease-out; }
.verdict { font-family: var(--f-display); font-weight: 800; font-size: 1.6rem; line-height: 1; }
.verdict.bad { color: #ff6b78; } .verdict.good { color: #6ee7a8; }
.reveal-cards { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.reveal-cards .pcard { --w: 46px; animation: flip 0.5s ease-out both; }
.reveal-cards .pcard:nth-child(2) { animation-delay: 0.08s; } .reveal-cards .pcard:nth-child(3) { animation-delay: 0.16s; } .reveal-cards .pcard:nth-child(4) { animation-delay: 0.24s; }
.reveal-cards .pcard.wrong { outline: 3px solid var(--ruby); }
@keyframes flip { from { transform: rotateY(90deg); } to { transform: rotateY(0); } }
@keyframes pop { from { transform: scale(0.94); opacity: 0; } to { transform: none; opacity: 1; } }

.action-panel { text-align: center; }
.turn-msg { min-height: 1.5em; margin-bottom: 8px; font-weight: 700; }
#bluffBtn.pulse:not(:disabled) { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(226, 64, 79, 0.25); } }

.my-hand { background: rgba(0, 0, 0, 0.22); border: 1px solid var(--line); border-radius: 18px; padding: 8px 6px 4px; }
.hand-head { display: flex; justify-content: space-between; padding: 0 8px; font-size: 0.8rem; color: var(--muted); font-weight: 700; }
.sel-count { color: var(--gold); }
.hand-scroll {
  display: flex; gap: 6px; overflow-x: auto; overflow-y: hidden; padding: 18px 8px 10px; scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; touch-action: pan-x;
}
.card-btn { flex: none; border: 0; padding: 0; background: none; border-radius: 10px; transition: transform 0.15s ease-out; scroll-snap-align: start; touch-action: manipulation; }
.card-btn .pcard { --w: 62px; }
.card-btn:hover { transform: translateY(-4px); }
.card-btn.sel { transform: translateY(-16px); }
.card-btn.sel .pcard { outline: 3px solid var(--gold); box-shadow: 0 10px 22px rgba(245, 197, 66, 0.35); }
.card-btn.match .pcard::after { content: ''; position: absolute; left: 50%; bottom: 5px; width: 6px; height: 6px; margin-left: -3px; border-radius: 50%; background: var(--gold); }

.side-panel { --bs-offcanvas-width: min(400px, 92vw); background: var(--felt-3) !important; }
.side-panel .chat-log { max-height: none; min-height: 200px; overflow-y: auto; }
.min-h-0 { min-height: 0; }
.standings { padding-left: 1.2rem; display: grid; gap: 3px; }
.standings li span { display: inline-block; min-width: 9ch; }
.felt-modal { background: radial-gradient(ellipse at top, var(--felt-1), var(--felt-3)); border: 1px solid var(--gold); border-radius: 20px; color: var(--ink); }
.trophy { font-size: 3rem; }

@media (max-width: 640px) {
  .table-center { grid-template-columns: auto auto; gap: 12px; padding: 14px; min-height: 0; }
  .play-info { grid-column: 1 / -1; text-align: center; }
  .rank-big { font-size: 3.2rem; }
  .opp { min-width: 92px; padding: 8px 6px; }
  .opp .avatar { width: 28px; height: 28px; font-size: 0.8rem; }
  .card-btn .pcard { --w: 56px; }
  .action-panel .btn-lg { padding: 10px 16px; font-size: 1rem; }
  .topbar .status-pill { order: 3; width: 100%; text-align: center; }
  .hero-cards { height: 140px; } .hero-cards .pcard { --w: 78px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.01ms !important; transition: none !important; } }
