/* =========================
   WHIST PRO – MOBILE CSS
   BetOnSports vibe (dark + yellow + premium green)
   ========================= */

:root{
  --bg-main:#070A0F;
  --bg-grad-1:#0B1220;
  --bg-grad-2:#060A12;

  --card-top:#0F1A30;
  --card-bot:#0A1222;

  --border-soft:rgba(255,255,255,.08);
  --border-strong:rgba(255,255,255,.14);

  --txt-main:#EAF0FF;
  --txt-muted:#95A2C4;

  /* BetOnSports-like accents */
  --yellow:#FFD400;
  --yellow-2:#FFB800;
  --yellow-glow:rgba(255,212,0,.22);

  --green:#18D17B;              /* premium green */
  --green-deep:#0AAE63;
  --green-glow:rgba(24,209,123,.20);

  --danger:#EF4444;

  --radius:16px;
  --radiusBtn:12px;             /* more “square” than pills */
  --shadow:0 10px 26px rgba(0,0,0,.55);
}

/* ---------- base ---------- */

*{ box-sizing:border-box; }
html,body{ height:100%; }

body{
  margin:0;
  background:
    radial-gradient(900px 700px at 20% -10%, rgba(255,212,0,.10), transparent 55%),
    radial-gradient(900px 700px at 90% 10%, rgba(24,209,123,.08), transparent 55%),
    linear-gradient(180deg, var(--bg-grad-1), var(--bg-grad-2));
  color:var(--txt-main);
  font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
}

button, input, select{
  font-family:inherit;
}

a{ color:inherit; }

/* ---------- layout wrapper ---------- */

.app{
  max-width:420px;
  margin:0 auto;
  padding:12px;
}

/* ---------- topbar ---------- */

.topbar{
  display:flex;
  flex-wrap:nowrap;
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
align-items:center;
  gap:10px;
  padding:10px 10px;
  margin-bottom:12px;

  background:linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
  border:1px solid var(--border-soft);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  backdrop-filter: blur(10px);
}

.topbar .btn, .topbar a.btn{ flex:0 0 auto; white-space:nowrap; }

.brand{
  font-weight:900;
  letter-spacing:.3px;
}

.spacer{ flex:1; min-width:8px; }

.badge{
  padding:6px 10px;
  border-radius:999px;
  font-weight:800;
  font-size:12px;
  background:rgba(255,255,255,.06);
  border:1px solid var(--border-soft);
  color:var(--txt-muted);
}

/* ---------- cards ---------- */

.card{
  background:linear-gradient(145deg, rgba(15,26,48,.95), rgba(10,18,34,.95));
  border:1px solid var(--border-soft);
  border-radius:var(--radius);
  padding:12px;
  box-shadow:var(--shadow);
}

.card.inner{
  margin-top:10px;
  background:linear-gradient(145deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
}

h2{
  margin:0 0 10px 0;
  font-size:16px;
}

/* ---------- fields ---------- */

.field{ margin-bottom:10px; }
label{
  display:block;
  font-size:12px;
  color:var(--txt-muted);
  margin-bottom:6px;
}

.input{
  width:100%;
  height:42px;
  border-radius:12px;
  border:1px solid var(--border-soft);
  background:rgba(0,0,0,.20);
  color:var(--txt-main);
  padding:0 12px;
  outline:none;
}

.input:focus{
  border-color:rgba(255,212,0,.35);
  box-shadow:0 0 0 3px rgba(255,212,0,.12);
}

.help{
  font-size:12px;
  color:var(--txt-muted);
  margin-top:6px;
}

.actions{
  display:flex;
  gap:10px;
  margin-top:6px;
}

/* ---------- buttons ---------- */

.btn{
  height:40px;
  padding:0 14px;
  border-radius:12px;
  border:1px solid var(--border-soft);
  background:rgba(255,255,255,.06);
  color:var(--txt-main);
  font-weight:800;
  letter-spacing:.2px;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  line-height:1;
}

.btn:active{ transform:translateY(1px); }

.btn.primary{
  background:linear-gradient(180deg, var(--yellow), var(--yellow-2));
  border-color:rgba(255,212,0,.35);
  color:#111827;
  box-shadow:0 10px 24px var(--yellow-glow);
}

.btn.danger{
  background:rgba(239,68,68,.14);
  border-color:rgba(239,68,68,.28);
  color:#fecaca;
}

/* ---------- summary header in game ---------- */

.summary{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
  margin-bottom:10px;
}

.summary > div{
  padding:10px;
  border-radius:14px;
  background:rgba(0,0,0,.20);
  border:1px solid var(--border-soft);
}

.muted{
  font-size:12px;
  color:var(--txt-muted);
}

.big{
  font-size:18px;
  font-weight:900;
  margin-top:4px;
}

.mono{ font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono","Courier New", monospace; }

/* ---------- players list ---------- */

.players{ margin-top:10px; }

/* player card */
.playerRow{
  background:
    radial-gradient(420px 220px at 10% 0%, rgba(255,212,0,.08), transparent 60%),
    radial-gradient(420px 220px at 90% 30%, rgba(24,209,123,.06), transparent 60%),
    linear-gradient(145deg, rgba(14,23,41,.95), rgba(8,13,24,.95));
  border:1px solid var(--border-soft);
  border-radius:var(--radius);
  padding:12px;
  margin-bottom:12px;
  box-shadow:0 10px 26px rgba(0,0,0,.50);
  display:grid;
  grid-template-columns:1fr auto;
  grid-template-areas:
    "name total"
    "buttons buttons"
    "info info";
  gap:10px;
}

.playerLabel{
  grid-area:name;
  font-weight:900;
  font-size:15px;
  letter-spacing:.2px;
}

.playerTotal{
  grid-area:total;
  font-weight:900;
  font-size:14px;
  color:var(--yellow);
  text-shadow:0 0 14px rgba(255,212,0,.18);
  text-align:right;
}

/* buttons row (2 buttons) */
.badgeBtn{
  height:46px;
  border-radius:var(--radiusBtn); /* more “square-ish” */
  font-size:15px;
  font-weight:900;
  letter-spacing:.2px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  border:1px solid var(--border-soft);
  background:rgba(255,255,255,.06);
  color:var(--txt-main);
  cursor:pointer;
}

.badgeBtn:active{ transform:translateY(1px); }

.playerRow > .badgeBtn:nth-of-type(1){
  grid-area:buttons;
  justify-self:start;
  width:58%;
}

.playerRow > .badgeBtn:nth-of-type(2){
  grid-area:buttons;
  justify-self:end;
  width:38%;
}

/* states */
.badgeWait{
  background:linear-gradient(180deg, var(--yellow), var(--yellow-2));
  border-color:rgba(255,212,0,.38);
  color:#111827;
  box-shadow:0 10px 22px rgba(255,212,0,.18);
}

.badgeDone{
  background:linear-gradient(180deg, rgba(24,209,123,.95), rgba(10,174,99,.95));
  border-color:rgba(24,209,123,.40);
  color:#052e16;
  box-shadow:0 10px 22px rgba(24,209,123,.16);
}

.badgeBtn:disabled{
  background:rgba(255,255,255,.05);
  color:rgba(234,240,255,.45);
  opacity:.75;
  cursor:not-allowed;
}

/* ---------- mini info / pills (IMPORTANT) ---------- */

.playerInfo{
  grid-area:info;
  display:flex;               /* <- ensures they show */
  gap:8px;
  flex-wrap:wrap;
  align-items:center;
}

.pill{
  display:inline-flex;
  align-items:center;
  padding:6px 10px;
  border-radius:999px;
  font-weight:900;
  font-size:12px;
  letter-spacing:.2px;
  border:1px solid var(--border-soft);
  background:rgba(255,255,255,.06);
  color:var(--txt-muted);
}

.pillL{
  background:rgba(255,212,0,.10);
  border-color:rgba(255,212,0,.22);
  color:#ffe37a;
}

.pillR{
  background:rgba(24,209,123,.10);
  border-color:rgba(24,209,123,.22);
  color:#7ff0be;
}

/* ---------- messages ---------- */

.msg{
  margin-top:10px;
  font-size:13px;
  color:var(--txt-muted);
}

/* ---------- history ---------- */

.pre{
  white-space:pre-wrap;
  word-break:break-word;
  font-size:12px;
  color:rgba(234,240,255,.70);
}

/* ---------- names wrap in setup ---------- */

.namesWrap{ margin-top:8px; }

/* Setup: player picker (select existing or create new) */
.playerPickRow{
  display:flex;
  gap:10px;
  align-items:center;
  margin-bottom:8px;
}

.playerPickSelect{
  flex: 0 0 170px;
  max-width: 170px;
  height:42px;
  border-radius:12px;
  border:1px solid var(--border-soft);
  background:rgba(0,0,0,.20);
  color:var(--txt-main);
  padding:0 10px;
  outline:none;
}

.playerNameInput{
  width:100%;
  height:42px;
  border-radius:12px;
  border:1px solid var(--border-soft);
  background:rgba(0,0,0,.20);
  color:var(--txt-main);
  padding:0 12px;
  outline:none;
  margin-bottom:0; /* handled by .playerPickRow */
}

/* ---------- numpad overlay ---------- */

#numpadOverlay{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.70);
  display:none;
  align-items:center;
  justify-content:center;
  z-index:9999;
  padding:14px;
}

.numpadCard{
  width:min(460px, 96vw);
  border-radius:18px;
  border:1px solid var(--border-soft);
  background:
    radial-gradient(420px 220px at 15% 0%, rgba(255,212,0,.10), transparent 60%),
    radial-gradient(420px 220px at 95% 20%, rgba(24,209,123,.08), transparent 60%),
    linear-gradient(145deg, rgba(15,26,48,.98), rgba(8,13,24,.98));
  box-shadow:0 18px 42px rgba(0,0,0,.70);
  padding:16px;
}

#numpadTitle{
  font-weight:900;
  color:rgba(234,240,255,.92);
  margin-bottom:6px;
}

#numpadDisplay{
  font-size:34px;
  font-weight:1000;
  text-align:center;
  margin:10px 0 12px 0;
  color:var(--yellow);
  text-shadow:0 0 18px rgba(255,212,0,.20);
}

.numpadGrid{
  display:grid;
  grid-template-columns:repeat(3,1fr);
  grid-auto-flow:dense;
  gap:12px;
}

.numpadGrid button{
  height:56px;
  border-radius:14px; /* slightly squared */
  border:1px solid var(--border-soft);
  background:rgba(255,255,255,.06);
  color:var(--txt-main);
  font-size:18px;
  font-weight:900;
  cursor:pointer;
}

.npSpacer{
  height:56px;
  border-radius:14px;
  background:transparent;
  border:1px dashed rgba(255,255,255,.06);
  visibility:hidden;
}

.numpadGrid button:active{ transform:translateY(1px); }

.npGhost{
  background:rgba(255,255,255,.04) !important;
  color:rgba(234,240,255,.70) !important;
}

.numpadActions{
  display:grid;
  grid-template-columns:1fr;   /* OK full width */
  gap:10px;
  margin-top:12px;
}

#numpadCancel{
  height:44px;
  border-radius:14px;
  border:1px solid var(--border-soft);
  background:rgba(255,255,255,.06);
  color:rgba(234,240,255,.85);
  font-weight:900;
}

#numpadOk{
  height:48px;
  border-radius:14px;
  border:1px solid rgba(255,212,0,.38);
  background:linear-gradient(180deg, var(--yellow), var(--yellow-2));
  color:#111827;
  font-weight:1000;
  box-shadow:0 14px 30px rgba(255,212,0,.18);
}

#numpadOk:active{ transform:translateY(1px); }

#numpadHint{
  margin-top:8px;
  font-size:12px;
  color:rgba(234,240,255,.65);
}

/* ---------- tiny improvements ---------- */

.toprow{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}
/* Licitație deja făcută */
.badgeBtn.badgeChecked {
  background: linear-gradient(180deg, #d4a900, #b89000);
  color: #111;
  box-shadow: inset 0 0 0 2px rgba(0,0,0,0.25);
}

.badgeBtn.badgeChecked::before {
  content: "✓";
  margin-right: 6px;
  font-weight: 1000;
}

/* doar bifă (fără text) */
.badgeBtn.badgeCheckedOnly{
  background: linear-gradient(180deg, #d4a900, #b89000);
  color: #111;
  box-shadow: inset 0 0 0 2px rgba(0,0,0,0.25);
}
.badgeBtn.badgeCheckedOnly::after{
  content: "✓";
  font-weight: 1100;
  font-size: 18px;
}

.badgeBtn.badgeDoneCheckedOnly{
  background: linear-gradient(180deg, rgba(24,209,123,.85), rgba(13,155,92,.85));
  color: #062014;
  box-shadow: inset 0 0 0 2px rgba(0,0,0,0.18);
}
.badgeBtn.badgeDoneCheckedOnly::after{
  content: "✓";
  font-weight: 1100;
  font-size: 18px;
}

/* overlays & modals */
.overlay{
  position:fixed; inset:0;
  display:flex; align-items:center; justify-content:center;
  background:rgba(0,0,0,0.55);
  backdrop-filter: blur(6px);
  z-index: 9999;
}
.modal{ width:min(520px, 92vw); }
.modalHead{ display:flex; align-items:center; justify-content:space-between; gap:10px; }
.modalBody{ margin-top:12px; display:flex; flex-direction:column; gap:12px; }
.qrImg{ width:240px; height:240px; align-self:center; border-radius:14px; background:#fff; padding:10px; }
.linkBox{ padding:10px 12px; border-radius:12px; border:1px solid rgba(255,255,255,0.12); background:rgba(10,16,28,0.55); word-break:break-all; }
.small{ font-size:12px; opacity:.85; }

/* hands history */
.handsHistory{ display:flex; flex-direction:column; gap:12px; }
.handCard{ padding:12px; border-radius:16px; border:1px solid rgba(255,255,255,0.08); background:rgba(10,16,28,0.55); }
.handCard.active{ border-color: rgba(245,196,0,0.55); box-shadow: 0 0 0 1px rgba(245,196,0,0.25) inset; }
.handCard{ cursor:pointer; }
.handCardHead{ display:flex; align-items:center; justify-content:space-between; margin-bottom:10px; }
.pillMini{ display:inline-block; padding:2px 8px; border-radius:999px; font-size:12px; border:1px solid rgba(255,255,255,0.12); opacity:.9; }
.handGrid{ display:flex; flex-direction:column; gap:6px; }
.handGridRow{ display:grid; grid-template-columns: 1.4fr .4fr .4fr .5fr; gap:8px; }
.handGridHead{ opacity:.75; font-size:12px; }



/* ===== Numpad: hide digits above max ===== */
.numpadGrid .np{ transition: transform .12s ease, opacity .12s ease; }
.numpadGrid .np:active{ transform: scale(.96); }

/* ===== Checkmark pop ===== */
.badgeBtn.badgeCheckedOnly::after,
.badgeBtn.badgeDoneCheckedOnly::after{
  animation: popIn .14s ease-out;
}
@keyframes popIn{
  from{ transform: scale(.6); opacity:.2; }
  to{ transform: scale(1); opacity:1; }
}

/* ===== Game Done Overlay ===== */
.doneOverlay{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  display:flex;
  align-items:center;
  justify-content:center;
  z-index: 9999;
  padding: 18px;
}
.doneCard{
  width: min(420px, 92vw);
  background: rgba(10,16,28,0.92);
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 18px;
  padding: 14px;
  box-shadow: 0 24px 70px rgba(0,0,0,.55);
}
.doneTitle{
  font-weight: 1000;
  font-size: 18px;
  margin-bottom: 10px;
}
.doneTable{ display:flex; flex-direction:column; gap:8px; margin-bottom: 12px; }
.doneRow{
  display:flex;
  justify-content:space-between;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
}


/* Spectator topbar stats link as button */
#btnStats{ text-decoration:none; display:inline-flex; align-items:center; justify-content:center; }


/* keep checkmark style even when disabled (we disable after submit to prevent double-post) */
.badgeBtn.badgeCheckedOnly:disabled{
  opacity:1;
  background: linear-gradient(180deg, rgba(255,206,0,.22), rgba(255,206,0,.10));
  border-color: rgba(255,206,0,.55);
  color: rgba(255,255,255,.92);
}
.badgeBtn.badgeDoneCheckedOnly:disabled{
  opacity:1;
  background: linear-gradient(180deg, rgba(22,203,106,.22), rgba(22,203,106,.10));
  border-color: rgba(22,203,106,.55);
  color: rgba(255,255,255,.92);
}


/* ---------- UX polish (micro-animații, hover/tap, shake) ---------- */
.btn{transition:transform .08s ease,filter .15s ease,box-shadow .15s ease,opacity .15s ease;will-change:transform}
.btn:hover{filter:brightness(1.05)}
.btn:active{transform:scale(0.98)}
.btn:disabled{opacity:.55;cursor:not-allowed;transform:none}

.card{transition:transform .12s ease,box-shadow .15s ease,filter .15s ease}
.card:active{transform:scale(0.995)}

.tick{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:18px;
  height:18px;
  margin-left:6px;
  border-radius:999px;
  background:rgba(255,212,0,.85);
  color:#111;
  font-weight:1000;
  font-size:12px;
  opacity:0;
  transform:scale(.6);
  filter:blur(.2px);
  transition:transform .18s ease,opacity .18s ease,filter .18s ease;
}
.tick.is-on{transform:scale(1);opacity:1;animation:tick-pop .22s ease-out}
@keyframes tick-pop{0%{transform:scale(.6)}70%{transform:scale(1.08)}100%{transform:scale(1)}}

.shake{animation:shake .28s ease-in-out}
@keyframes shake{0%,100%{transform:translateX(0)}25%{transform:translateX(-6px)}75%{transform:translateX(6px)}}

:focus-visible{outline:2px solid rgba(255,255,255,.45);outline-offset:2px}


/* Online badge colors */
.badge{display:inline-flex; align-items:center; justify-content:center; line-height:1;}
.badge:not(.offline){
  background:rgba(32,208,122,.16);
  border-color:rgba(32,208,122,.35);
  color:#20d07a;
}
.badge.offline{
  background:rgba(255,86,86,.14);
  border-color:rgba(255,86,86,.35);
  color:#ff7b7b;
}

/* Reset confirm modal */
.overlay{
  position:fixed; inset:0;
  display:flex; align-items:center; justify-content:center;
  background:rgba(0,0,0,.55);
  z-index:9999;
  padding:16px;
}
.modalCard{
  width:min(520px, 92vw);
  background:rgba(16,24,35,.96);
  border:1px solid var(--border-soft);
  border-radius:18px;
  box-shadow:0 18px 50px rgba(0,0,0,.45);
  padding:14px;
}
.modalTitle{ font-weight:950; font-size:16px; margin-bottom:6px; }
.modalText{ color:var(--txt-muted); font-size:13px; margin-bottom:12px; }
.modalActions{ display:flex; gap:10px; justify-content:flex-end; flex-wrap:wrap; }

/* History nicer */
.handsHistory{ display:flex; flex-direction:column; gap:12px; }
.handCard{
  background:rgba(255,255,255,.03);
  border:1px solid var(--border-soft);
  border-radius:16px;
  overflow:hidden;
}
.handHead{
  display:flex; justify-content:space-between; align-items:center;
  padding:10px 12px;
  background:linear-gradient(180deg, rgba(245,196,0,.10), rgba(255,255,255,0));
  border-bottom:1px solid var(--border-soft);
}
.handGrid{ padding:10px 12px 12px; }
.handGridRow{ display:grid; grid-template-columns:1.6fr .6fr .6fr .7fr .8fr; gap:8px; padding:8px 0; border-bottom:1px solid rgba(255,255,255,.06); }
.handGridRow:last-child{ border-bottom:0; }
.handGridHead{ color:var(--txt-muted); font-size:12px; font-weight:800; }
.handGridRow b{ font-weight:950; }

.starterPill{ background:rgba(245,196,0,.18); border-color:rgba(245,196,0,.35); color:#f5c400; }

.actionsRow{display:flex;gap:10px;margin-top:10px}
.actionsRow .btn{flex:1;display:flex;align-items:center;justify-content:center}
.summaryRow{gap:10px;flex-wrap:wrap;display:grid;grid-template-columns:1fr 1fr 1fr;gap:10px;margin-top:12px}

/* leader highlight */
.playerRow.leader{outline:1px solid rgba(245,196,0,.35); box-shadow:0 0 0 2px rgba(245,196,0,.08) inset;}

.badgeBtn:hover:not(:disabled){filter:brightness(1.05)}
.np:hover{filter:brightness(1.06)}


/* ---------- bid rule popup (reuses doneOverlay styles) ---------- */
#bidRuleOverlay{
  opacity:0;
  transition:opacity .14s ease;
}
#bidRuleOverlay.open{
  opacity:1;
}
#bidRuleOverlay .doneCard{
  transform:scale(.96);
  transition:transform .14s ease;
}
#bidRuleOverlay.open .doneCard{
  transform:scale(1);
}

/* Flash when rule triggers */
.flashBad{
  animation: flashBad .35s ease;
}
@keyframes flashBad{
  0%{ transform:scale(1); filter:brightness(1); }
  40%{ transform:scale(1.04); filter:brightness(1.35); }
  100%{ transform:scale(1); filter:brightness(1); }
}

.doneBody{font-size:14px; line-height:1.35; opacity:.95; margin: 6px 0 14px;}

/* Footers: italic, subtle (requested) */

/* ---------- Spectator: Scor curent (aliniere + paleta) ---------- */
.scoreWrap{
  display:flex;
  flex-direction:column;
  gap:6px;
}

.scoreHead, .scoreRow{
  display:grid;
  grid-template-columns: 1.6fr .6fr .6fr .8fr;
  gap:10px;
  align-items:center;
}

.scoreHead{
  padding:8px 10px;
  border-radius:14px;
  background:rgba(255,255,255,.04);
  border:1px solid var(--border-soft);
  color:var(--txt-muted);
  font-size:12px;
  font-weight:900;
  letter-spacing:.2px;
}

.scoreRow{
  padding:10px 10px;
  border-radius:14px;
  background:rgba(0,0,0,.18);
  border:1px solid rgba(255,255,255,.06);
}

.scoreCell{min-width:0;}
.scoreName{font-weight:900; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
.scoreBid, .scoreTrick, .scoreTotal{ text-align:center; font-weight:850; }

.yellowTxt{ color:var(--yellow); font-weight:950; }
.scoreTotal{ color:var(--yellow); }

.handTotal{ color:var(--yellow); font-weight:950; }
.footer{ font-style: italic; }

