/* ── RESET ──────────────────────────────────────────────── */
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
html,body{height:100%;font-family:'Segoe UI',system-ui,sans-serif}
body.bg{background:#0f172a;color:#e2e8f0}
body.game-page{overflow:hidden;height:100dvh}
.hidden{display:none!important}

/* ── SIGN-IN / HOME (unchanged) ─────────────────────────── */
.fullscreen-center{position:fixed;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;background:#0f172a;z-index:100}
.loading-logo{font-size:64px;color:#1d4ed8}.loading-sub{font-size:18px;color:#64748b;letter-spacing:2px}
.signin-card{max-width:360px;width:90%;text-align:center;padding:40px 30px;background:#1e293b;border:1px solid #334155;border-radius:16px}
.signin-badge{font-size:56px;color:#1d4ed8;margin-bottom:12px}
.signin-title{font-size:28px;font-weight:800;margin-bottom:8px}
.signin-sub{color:#94a3b8;margin-bottom:28px;font-size:14px}
.google-btn{width:100%;justify-content:center;gap:10px;padding:14px;background:#fff;color:#1e293b;font-weight:600;font-size:15px;border:none;border-radius:10px;cursor:pointer;display:flex;align-items:center;box-shadow:0 2px 8px rgba(0,0,0,.3)}
.google-btn:hover{background:#f1f5f9}.google-icon{font-weight:900;color:#1d4ed8}
.home-topbar{display:flex;align-items:center;justify-content:space-between;padding:12px 16px;background:#1e293b;border-bottom:1px solid #334155}
.user-pill{display:flex;align-items:center;gap:10px}
.user-avatar{width:36px;height:36px;border-radius:50%;object-fit:cover;border:2px solid #1d4ed8}
.user-name{font-weight:700;font-size:14px}.coin-badge{font-size:12px;color:#f59e0b;font-weight:600}
.home-main{padding:20px 16px;max-width:600px;margin:0 auto}
.home-hero{text-align:center;padding:24px 0 20px}
.hero-badge{font-size:52px;color:#1d4ed8}.hero-title{font-size:28px;font-weight:900;letter-spacing:1px}
.mode-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px}
@media(max-width:480px){.mode-grid{grid-template-columns:1fr}}
.mode-card{padding:20px 16px;text-align:center;background:#1e293b;border:1px solid #334155;border-radius:12px}
.mode-icon{font-size:36px;margin-bottom:8px}
.mode-card h2{font-size:16px;font-weight:800;margin-bottom:6px}
.mode-card p{font-size:12px;color:#94a3b8;margin-bottom:8px;line-height:1.4}
.mode-fee{font-size:12px;color:#64748b;margin-bottom:14px}
.mode-actions{display:flex;flex-direction:column;gap:8px}
.coin-mini{font-size:12px;color:#f59e0b;font-weight:700;white-space:nowrap}
.queue-timer{font-size:48px;font-weight:900;color:#1d4ed8;margin:16px 0}
.modal{position:fixed;inset:0;background:rgba(0,0,0,.7);display:flex;align-items:center;justify-content:center;z-index:200}
.modal-card{background:#1e293b;border:1px solid #334155;border-radius:16px;padding:28px 24px;width:90%;max-width:360px;text-align:center;display:flex;flex-direction:column;gap:14px}
.modal-card h3{font-size:18px;font-weight:700}
.modal-card input{width:100%;padding:12px;border-radius:8px;border:1px solid #334155;background:#0f172a;color:#e2e8f0;font-size:16px;text-align:center;letter-spacing:3px;font-weight:700}
input[type="text"]{width:100%;padding:10px 12px;border-radius:8px;border:1px solid #334155;background:#0f172a;color:#e2e8f0;font-size:15px}
input::placeholder{color:#475569}

/* ── SHARED UTILITIES ───────────────────────────────────── */
.card{background:#1e293b;border:1px solid #334155;border-radius:12px;padding:16px}
.btn{display:inline-flex;align-items:center;justify-content:center;padding:10px 18px;border:none;border-radius:8px;font-weight:700;font-size:13px;cursor:pointer;letter-spacing:.5px;transition:opacity .15s;background:#334155;color:#e2e8f0}
.btn:hover{opacity:.85}.btn:disabled{opacity:.4;cursor:not-allowed}
.btn.primary{background:#1d4ed8;color:#fff}.btn.danger{background:#dc2626;color:#fff}
.btn.gold{background:#d97706;color:#fff}.btn.success{background:#16a34a;color:#fff}
.btn.small{padding:6px 12px;font-size:11px}.btn.back-btn{background:transparent;color:#64748b;text-decoration:underline}
.wide-btn{width:100%;padding:14px;font-size:15px}
.row{display:flex;align-items:center}.row.between{justify-content:space-between}.row.gap{gap:8px}
.stack{display:flex;flex-direction:column;gap:10px}
.tag{font-size:11px;font-weight:700;padding:3px 8px;border-radius:20px;background:#334155;color:#94a3b8}
.small-label{font-size:10px;color:#64748b;text-transform:uppercase;letter-spacing:1px}
.msg{font-size:12px;color:#f87171}

/* ── SCREEN SHELLS ──────────────────────────────────────── */
.screen{min-height:100dvh}

/* ── LOBBY ──────────────────────────────────────────────── */
.lobby-topbar{display:flex;align-items:center;justify-content:space-between;padding:8px 12px;background:#1e293b;border-bottom:1px solid #334155}
.room-code{font-weight:800;font-size:14px;letter-spacing:1px;color:#60a5fa}
.player-as{font-size:11px;color:#64748b}
.top-actions{display:flex;align-items:center;gap:8px}
.lobby-body{padding:12px}
.seated-count{font-size:12px;color:#64748b;margin-bottom:8px}
.player-list{display:flex;flex-direction:column;gap:6px;margin-bottom:12px}
.player-item{display:flex;align-items:center;justify-content:space-between;background:#0f172a;border-radius:8px;padding:10px 12px}
.player-item .left{display:flex;align-items:center;gap:10px}
.pill{width:28px;height:28px;border-radius:50%;background:#334155;display:flex;align-items:center;justify-content:center;font-size:12px;font-weight:700}
.pill.host{background:#1d4ed8}
.mini{font-size:11px;color:#64748b}
.player-actions{display:flex;gap:4px}
.host-controls{display:flex;flex-direction:column;gap:8px;margin-top:12px}

/* ── GAME SCREEN ────────────────────────────────────────── */
.game-screen{position:fixed;inset:0;display:flex;flex-direction:column;background:#060c18}

/* Top info bar */
.game-topbar{
  flex-shrink:0;display:flex;align-items:center;gap:8px;
  padding:6px 12px;background:#111827;border-bottom:1px solid #1f2937;
  min-height:42px;
}
.game-title-txt{flex:1;font-size:13px;font-weight:700;color:#e2e8f0}
.timer-pill{background:#dc2626;color:#fff;font-weight:800;font-size:13px;padding:3px 10px;border-radius:20px;min-width:38px;text-align:center;transition:background .3s}
.timer-pill.ok{background:#16a34a}
.phase-ctr{font-size:13px;color:#f59e0b;font-weight:700;min-width:40px;text-align:right}

/* ── ACTION AREA (bid/trump/team — no table) ────────────── */
.action-area{
  flex:1;min-height:0;display:flex;flex-direction:column;gap:8px;
  padding:8px 10px;overflow-y:auto;
}
.bid-hint{font-size:12px;color:#94a3b8;margin-bottom:4px}

/* Bid grid — large tappable buttons */
.bid-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(80px,1fr));
  gap:8px;
  flex:1;
}
.bid-option{
  padding:16px 6px;border-radius:14px;border:2px solid #2d3748;
  background:#1a2235;color:#f59e0b;font-size:18px;font-weight:900;
  cursor:pointer;text-align:center;transition:all .15s;
  line-height:1;
}
.bid-option:hover:not(:disabled){background:#1d4ed8;border-color:#1d4ed8;color:#fff}
.bid-option.pass{background:#1a0a0a;border-color:#7f1d1d;color:#fca5a5}
.bid-option:disabled{opacity:.35;cursor:not-allowed}
.bid-option.my-turn{border-color:#334155}

/* Trump selection */
.trump-choices{display:flex;gap:12px;justify-content:center;margin:12px 0}
.trump-choice{width:72px;height:72px;border-radius:16px;font-size:36px;border:2px solid #334155;background:#1e293b;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .15s}
.trump-choice.red{color:#ef4444}.trump-choice.black{color:#e2e8f0}
.trump-choice.selected{border-color:#d97706;background:#451a03}

/* Team pick */
.team-pick-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(72px,1fr));gap:6px;overflow-y:auto;flex:1}
.team-option{border:2px solid #334155;background:#1a2235;border-radius:10px;cursor:pointer;padding:3px;transition:all .15s}
.team-option.selected{border-color:#16a34a;background:#14532d}
.team-option.unavailable{opacity:.3;cursor:not-allowed}

/* ── TABLE AREA (playing/round_end/finished) ────────────── */
.table-area{
  flex:1;min-height:0;position:relative;
  display:flex;align-items:center;justify-content:center;
  overflow:hidden;
}
/* Corners */
.corner-tl{position:absolute;top:6px;left:6px;z-index:10;display:flex;flex-direction:column;gap:3px}
.corner-tr{position:absolute;top:6px;right:6px;z-index:10;display:flex;flex-direction:column;gap:3px;align-items:flex-end}
.corner-bl{position:absolute;bottom:4px;left:6px;z-index:10;display:flex;flex-direction:column;gap:3px}
.turn-info{position:absolute;top:6px;left:50%;transform:translateX(-50%);z-index:10;display:flex;gap:5px;flex-wrap:wrap;justify-content:center}
.turn-info div{background:rgba(6,12,24,.85);padding:3px 10px;border-radius:20px;font-size:11px;backdrop-filter:blur(4px)}

/* ── OVAL TABLE ─────────────────────────────────────────── */
.table-oval-wrap{
  /* Fill available area */
  width:calc(100% - 8px);
  height:calc(100% - 8px);
  display:flex;align-items:center;justify-content:center;
}
.table-oval{
  width:min(calc(100% - 8px), 700px);
  height:min(calc(100% - 8px), 500px);
  position:relative;
  border-radius:25%;
  background:radial-gradient(ellipse at 40% 40%, #5c2d0a 0%, #3d1a05 45%, #1c0a02 100%);
  border:5px solid #7c3d12;
  box-shadow:0 0 0 3px #4a2208,0 10px 50px rgba(0,0,0,.8),inset 0 0 80px rgba(0,0,0,.5);
}
/* Portrait phones: taller oval */
@media(max-aspect-ratio:3/4){
  .table-oval{
    width:min(calc(100% - 8px),380px);
    height:min(calc(100% - 8px),520px);
  }
}

/* ── SEAT LAYER ─────────────────────────────────────────── */
.seat-layer{position:absolute;inset:0;pointer-events:none;z-index:4}

/* Each seat-box: positioned at oval edge, content faces center */
.seat-box{position:absolute;display:flex;align-items:center;gap:5px;pointer-events:none}

/* Bottom player (me) — name near bottom, card above toward center */
.seat-bottom{bottom:1%;left:50%;transform:translateX(-50%);flex-direction:column-reverse;align-items:center}
/* Top player — name near top, card below toward center */
.seat-top{top:1%;left:50%;transform:translateX(-50%);flex-direction:column;align-items:center}
/* Left player — name at left edge, card to right toward center */
.seat-left{top:50%;left:1%;transform:translateY(-50%);flex-direction:row}
/* Right player — name at right edge, card to left toward center */
.seat-right{top:50%;right:1%;transform:translateY(-50%);flex-direction:row-reverse}
/* 8-player diagonal seats */
.seat-bottom-left{bottom:25%;left:1%;flex-direction:row;align-items:center}
.seat-bottom-right{bottom:25%;right:1%;flex-direction:row-reverse;align-items:center}
.seat-top-left{top:25%;left:1%;flex-direction:row;align-items:center}
.seat-top-right{top:25%;right:1%;flex-direction:row-reverse;align-items:center}

/* Player name pill + score badge */
.player-info-row{
  display:flex;align-items:center;gap:4px;
  background:rgba(6,12,24,.88);
  border:2px solid transparent;
  border-radius:30px;
  padding:3px 5px 3px 3px;
  backdrop-filter:blur(6px);
  white-space:nowrap;
  flex-shrink:0;
}
.player-info-row.active-turn{border-color:#f59e0b}

/* Name pill color = role */
.name-pill{border-radius:20px;padding:4px 10px;font-weight:700;font-size:11px;color:#fff;letter-spacing:.3px;white-space:nowrap;max-width:80px;overflow:hidden;text-overflow:ellipsis}
.name-pill.lead{background:#16a34a}
.name-pill.team{background:#16a34a}
.name-pill.opp{background:#dc2626}

/* Score circle */
.score-circle{width:24px;height:24px;border-radius:50%;background:#0f172a;border:2px solid #374151;display:flex;align-items:center;justify-content:center;font-size:9px;font-weight:800;color:#f59e0b;flex-shrink:0}

/* Played card slot — between name and center */
.played-slot{display:flex;align-items:center;justify-content:center;min-width:38px;min-height:52px}
.played-slot.empty{opacity:0}

/* Center area (kept but usually empty) */
.center-pot{position:absolute;inset:30%;z-index:5;display:flex;align-items:center;justify-content:center;gap:3px;flex-wrap:wrap}

/* ── CARD COMPONENTS ─────────────────────────────────────── */
.card-core{
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  border-radius:8px;border:1.5px solid #d1d5db;background:#f8fafc;
  cursor:default;user-select:none;
  width:48px;min-height:64px;padding:3px;flex-shrink:0;
}
.card-core.red{color:#dc2626}.card-core.black{color:#1e293b}
.card-core.playable{cursor:pointer;border-color:#1d4ed8;box-shadow:0 0 0 2px #1d4ed844}
.card-core.dimmed{opacity:.35}
.card-core.flash{animation:flash .6s 3}
.card-core.played{width:38px;min-height:52px;font-size:12px;border-radius:6px}
.card-label{font-size:14px;font-weight:900;line-height:1.1}
.card-points{font-size:9px;color:#dc2626;font-weight:700;min-height:10px}
@keyframes flash{50%{box-shadow:0 0 18px #f59e0b;border-color:#f59e0b}}

.mini-card{
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  border-radius:7px;border:1.5px solid #d1d5db;background:#f8fafc;
  width:36px;min-height:48px;font-size:11px;font-weight:900;
  position:relative;padding:2px;user-select:none;flex-shrink:0;
}
.mini-card.red{color:#dc2626}.mini-card.black{color:#1e293b}
.mini-card.trump-tint{background:#fef3c7;border-color:#d97706}
.card-mode-badge{position:absolute;top:2px;right:2px;font-size:7px;font-weight:900;background:#1d4ed8;color:#fff;border-radius:3px;padding:0 2px}

/* ── HAND STRIP ──────────────────────────────────────────── */
.hand-strip{flex-shrink:0;background:#111827;border-top:2px solid #1f2937;padding:6px 10px 10px}
.hand-strip-hdr{display:flex;align-items:center;justify-content:space-between;margin-bottom:5px}
.your-cards-lbl{font-size:11px;color:#f59e0b;font-weight:700;text-transform:uppercase;letter-spacing:1px}
.turn-lbl{font-size:12px;color:#60a5fa;font-weight:700}
.hand-grid{display:flex;gap:5px;overflow-x:auto;padding-bottom:2px}

/* ── RESULT OVERLAY ──────────────────────────────────────── */
.result-overlay{position:absolute;inset:0;background:rgba(6,12,24,.97);z-index:50;overflow-y:auto;display:flex;flex-direction:column}
.result-inner{padding:20px;display:flex;flex-direction:column;gap:14px;flex:1}
.result-heading{font-size:17px;font-weight:800;color:#f59e0b;line-height:1.3}
.result-summary{font-size:12px;color:#94a3b8}
.result-teams{display:flex;gap:10px;flex-wrap:wrap}
.team-panel{background:#1e293b;border-radius:10px;padding:12px;flex:1;min-width:130px}
.team-panel h3{font-size:13px;font-weight:700;margin-bottom:8px}
.team-panel.lead h3{color:#ef4444}.team-panel.opp h3{color:#60a5fa}
.score-row{display:flex;justify-content:space-between;align-items:baseline;margin-bottom:6px}
.score-row-name{font-weight:600;font-size:14px}
.score-row-role{font-size:10px;color:#16a34a;display:block}
.score-row-pts{font-weight:800;font-size:18px}
.home-btn{background:#2563eb;color:#fff;border:none;border-radius:8px;padding:14px;font-weight:700;font-size:15px;cursor:pointer;letter-spacing:.5px;width:100%}

/* FAB restart button */
.fab-restart{position:absolute;bottom:10px;right:10px;z-index:60;background:#1d4ed8;color:#fff;border:none;border-radius:8px;padding:10px 16px;font-weight:700;font-size:13px;cursor:pointer}

/* Event feed */
.event-pill{font-size:10px;padding:2px 7px;border-radius:10px;background:#1e3a5f;color:#60a5fa;white-space:nowrap}
.event-pill.reveal{background:#14532d;color:#4ade80}

/* ── SOUND TOGGLE ────────────────────────────────────────── */
.sound-toggle{position:fixed;bottom:12px;right:12px;z-index:200;width:38px;height:38px;border-radius:50%;background:#1e293b;color:#94a3b8;border:none;font-size:16px;cursor:pointer;box-shadow:0 2px 8px rgba(0,0,0,.5)}
.sound-toggle.is-muted{color:#475569}

/* ── SCROLLBAR ───────────────────────────────────────────── */
::-webkit-scrollbar{width:4px;height:4px}
::-webkit-scrollbar-track{background:transparent}
::-webkit-scrollbar-thumb{background:#334155;border-radius:2px}

/* ── WIN / LOSE ANIMATIONS ───────────────────────────────────────────────────── */
.confetti-piece {
  position: fixed; top: -40px; font-size: 28px; z-index: 999;
  pointer-events: none; user-select: none;
  animation: confetti-fall linear forwards;
}
@keyframes confetti-fall {
  0%   { transform: translateY(0) rotate(0deg) scale(1);   opacity: 1; }
  70%  { opacity: 1; }
  100% { transform: translateY(105vh) rotate(900deg) scale(0.6); opacity: 0; }
}

.sad-piece {
  position: fixed; font-size: 30px; z-index: 999;
  pointer-events: none; user-select: none;
  animation: sad-rise ease-out forwards;
}
@keyframes sad-rise {
  0%   { transform: translateY(0) scale(1);   opacity: 1; }
  60%  { opacity: 1; }
  100% { transform: translateY(-180px) scale(0.5); opacity: 0; }
}

/* Result overlay: win vs lose tint */
.result-overlay.you-won  { background: rgba(4, 20, 10, .97); }
.result-overlay.you-lost { background: rgba(20, 4, 4,  .97); }

.result-headline {
  font-size: 28px; font-weight: 900; text-align: center;
  padding: 10px 0 4px; letter-spacing: 1px;
}
.result-headline.win  { color: #4ade80; }
.result-headline.lose { color: #f87171; }

/* ── BIG PLAY MODE CARD ───────────────────────────────────────────────────── */
.big-play-card { border-color: #d97706; background: linear-gradient(160deg, #1e293b 0%, #2a1a05 100%); }

/* ── HOME FOOTER LINKS ────────────────────────────────────────────────────── */
.home-footer-links { text-align: center; margin-top: 26px; font-size: 12px; color: #64748b; }
.home-footer-links a { color: #60a5fa; text-decoration: none; margin: 0 4px; }
.home-footer-links a:hover { text-decoration: underline; }

/* ── PRIZE DISPLAY (winner screen) ────────────────────────────────────────── */
.prize-display { text-align: center; margin: 6px 0 14px; }
.prize-amount { font-size: 40px; font-weight: 900; line-height: 1; }
.prize-amount.positive { color: #4ade80; }
.prize-amount.zero { color: #94a3b8; font-size: 28px; }
.prize-label { font-size: 11px; color: #64748b; text-transform: uppercase; letter-spacing: 1px; margin-top: 4px; }

/* ── WATCH AD CARD ────────────────────────────────────────────────────────── */
.ad-reward-card { border-color: #16a34a; background: linear-gradient(160deg, #1e293b 0%, #052e16 100%); }

