:root {
  --felt-1: #1c8a5c;
  --felt-2: #0b4d31;
  --felt-3: #063a24;
  --felt-edge: #03230f;
  --felt-line: rgba(255,255,255,0.05);
  --panel: #12211b;
  --panel-2: #1a2c23;
  --panel-border: rgba(226,201,140,0.16);
  --ink: #f6f1e4;
  --ink-dim: #a7b7ab;
  --gold: #e7c25a;
  --gold-2: #c69a34;
  --champagne: #f6e6b8;
  --gold-ink: #2a1e04;
  --brass: #8a6a2e;
  --blue: #5570e6;
  --red: #d8514c;
  --card-back-a: #2b4f95;
  --card-back-b: #142a56;
  --radius-lg: 20px;
  --radius-md: 13px;
  --radius-sm: 9px;
  --shadow-lg: 0 26px 60px rgba(0,0,0,0.55), 0 4px 14px rgba(0,0,0,0.4);
  --shadow-md: 0 10px 26px rgba(0,0,0,0.4);
  --hairline: 0 0 0 1px rgba(226,201,140,0.14);
  --inset-top: inset 0 1px 0 rgba(255,255,255,0.08);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --display: "Cinzel", "Times New Roman", serif;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
}

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

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(900px 520px at 50% 34%, rgba(60,190,130,0.28), transparent 66%),
    radial-gradient(1400px 1000px at 50% 8%, rgba(255,255,255,0.05), transparent 60%),
    radial-gradient(150% 130% at 50% 0%, var(--felt-1) 0%, var(--felt-2) 44%, var(--felt-3) 72%, var(--felt-edge) 100%);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
/* Woven-felt grain + a soft top light, so the table reads as a real surface */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  opacity: 0.05;
  mix-blend-mode: overlay;
}
/* Vignette for depth toward the edges */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(120% 100% at 50% 42%, transparent 55%, rgba(0,0,0,0.5) 100%);
}

#app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  transition: transform 0.06s ease, filter 0.15s ease, box-shadow 0.15s ease;
}
button:active { transform: scale(0.97); }
button:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-gold { background: linear-gradient(180deg, #f4cb5c, var(--gold)); color: var(--gold-ink); box-shadow: 0 4px 14px rgba(232,185,63,0.35); }
.btn-gold:hover:not(:disabled) { filter: brightness(1.06); }
.btn-blue { background: linear-gradient(180deg, #6c85ff, var(--blue)); color: white; box-shadow: 0 4px 14px rgba(79,107,237,0.35); }
.btn-blue:hover:not(:disabled) { filter: brightness(1.08); }
.btn-ghost { background: rgba(255,255,255,0.08); color: var(--ink); border: 1px solid var(--panel-border); }
.btn-ghost:hover:not(:disabled) { background: rgba(255,255,255,0.14); }
.btn-red { background: linear-gradient(180deg, #ef7871, var(--red)); color: white; box-shadow: 0 4px 14px rgba(226,86,79,0.35); }
.btn-red:hover:not(:disabled) { filter: brightness(1.08); }

input[type="text"], input[type="number"], input[type="password"], input[type="email"] {
  font-family: inherit;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--panel-border);
  background: rgba(255,255,255,0.06);
  color: var(--ink);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}
input::placeholder { color: var(--ink-dim); }
input[type="text"]:focus, input[type="number"]:focus, input[type="password"]:focus, input[type="email"]:focus {
  border-color: var(--gold);
  background: rgba(255,255,255,0.09);
}

.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.center { justify-content: center; }
.row.between { justify-content: space-between; }
.col { display: flex; flex-direction: column; gap: 10px; }
.grow { flex: 1; }

.help-text { color: var(--ink-dim); font-size: 0.85rem; line-height: 1.5; }

/* ---------- Landing ---------- */

.landing-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}

.brand {
  text-align: center;
  margin-bottom: 32px;
}
.brand .suits { font-size: 1.6rem; letter-spacing: 10px; color: var(--gold); opacity: 0.85; margin-bottom: 6px; }
.brand h1 {
  font-size: clamp(2.6rem, 8vw, 4rem);
  margin: 0;
  letter-spacing: 6px;
  font-weight: 800;
  background: linear-gradient(180deg, #ffffff, #cfe6d8);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 6px 30px rgba(0,0,0,0.4);
}
.brand .tagline { color: var(--ink-dim); margin-top: 8px; font-size: 1rem; }

.landing-cards {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
  max-width: 760px;
}

.card-panel {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  padding: 26px;
  box-shadow: var(--shadow-lg);
  flex: 1 1 320px;
  max-width: 360px;
}
.card-panel h2 {
  margin: 0 0 4px;
  font-size: 1.3rem;
}
.card-panel .sub { color: var(--ink-dim); font-size: 0.88rem; margin-bottom: 18px; }

.divider-or {
  display: flex;
  align-items: center;
  color: var(--ink-dim);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 2px;
  align-self: center;
}

.code-input {
  text-transform: uppercase;
  letter-spacing: 6px;
  font-weight: 800;
  text-align: center;
  font-size: 1.2rem;
}

/* ---------- Lobby ---------- */

.lobby-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  gap: 22px;
}

.room-code-box {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  padding: 28px 34px;
  text-align: center;
  box-shadow: var(--shadow-lg);
}
.room-code-box .label { color: var(--ink-dim); font-size: 0.85rem; letter-spacing: 1px; margin-bottom: 10px; }
.room-code-box .code {
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: 12px;
  color: var(--gold);
  cursor: pointer;
  user-select: all;
}
.room-code-box .copy-hint { color: var(--ink-dim); font-size: 0.78rem; margin-top: 8px; }

.player-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  max-width: 560px;
}

.player-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  padding: 6px 14px 6px 6px;
  font-size: 0.9rem;
  font-weight: 600;
}
.player-chip.offline { opacity: 0.5; }

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  color: white;
  flex-shrink: 0;
}
.avatar.sm { width: 22px; height: 22px; font-size: 0.7rem; }
.avatar.lg { width: 44px; height: 44px; font-size: 1.1rem; }

/* ---------- Game screen ---------- */

.game-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: rgba(0,0,0,0.22);
  border-bottom: 1px solid var(--felt-line);
}
.top-bar .brand-mini { font-weight: 800; letter-spacing: 3px; color: var(--ink); font-size: 0.95rem; }
.top-bar .room-tag {
  font-size: 0.78rem;
  color: var(--ink-dim);
  background: rgba(255,255,255,0.07);
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  letter-spacing: 1px;
}
.leave-btn {
  padding: 5px 12px;
  font-size: 0.78rem;
  background: rgba(226,86,79,0.15);
  border: 1px solid rgba(226,86,79,0.4);
  color: #ff9a94;
}
.leave-btn:hover { background: rgba(226,86,79,0.28); }

.turn-banner {
  text-align: center;
  padding: 14px 16px 6px;
}
.turn-banner .headline { font-size: 1.15rem; font-weight: 800; }
.turn-banner .sub { color: var(--ink-dim); font-size: 0.88rem; margin-top: 4px; }
.turn-banner.your-turn .headline { color: var(--gold); }

.opponents-row {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 10px 16px 6px;
  justify-content: center;
  flex-wrap: wrap;
}

.opp-card {
  background: rgba(255,255,255,0.05);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 92px;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.opp-card.active { border-color: var(--gold); background: rgba(232,185,63,0.08); }
.opp-card.dutch { border-color: var(--red); }
.opp-card .opp-name { font-size: 0.82rem; font-weight: 700; display: flex; align-items: center; gap: 5px; max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opp-card .opp-tags { display: flex; gap: 4px; }
.opp-card .mini-tag { font-size: 0.6rem; font-weight: 800; padding: 2px 6px; border-radius: 5px; letter-spacing: 0.4px; }
.mini-tag.turn { background: var(--gold); color: var(--gold-ink); }
.mini-tag.dutch { background: var(--red); color: white; }
.mini-tag.offline { background: rgba(255,255,255,0.15); color: var(--ink-dim); }
.mini-cards { display: flex; gap: -6px; }
.mini-card {
  width: 26px;
  height: 37px;
  border-radius: 4px;
  background: repeating-linear-gradient(135deg, var(--card-back-a), var(--card-back-a) 4px, var(--card-back-b) 4px, var(--card-back-b) 8px);
  border: 1.5px solid rgba(255,255,255,0.35);
  margin-left: -10px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}
.mini-card:first-child { margin-left: 0; }

.table-area {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 34px;
  padding: 26px 16px;
  background: radial-gradient(ellipse 260px 150px at 50% 52%, rgba(255,255,255,0.07), transparent 72%);
}
.pile { display: flex; flex-direction: column; align-items: center; gap: 8px; }
/* Stacked-deck look for the draw pile */
#draw-slot .card.back {
  box-shadow: 0 3px 8px rgba(0,0,0,0.45),
    3px 4px 0 -1px var(--card-back-b), 3px 4px 1px -1px rgba(0,0,0,0.4),
    6px 8px 0 -2px var(--card-back-b), 6px 8px 1px -2px rgba(0,0,0,0.35);
}
#discard-slot .card { box-shadow: 0 4px 10px rgba(0,0,0,0.5); }
.pile-label { font-size: 0.75rem; color: var(--ink-dim); letter-spacing: 1px; text-transform: uppercase; }

.card {
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  box-shadow: 0 3px 8px rgba(0,0,0,0.4);
  user-select: none;
  position: relative;
  flex-shrink: 0;
  transition: transform 0.15s ease, box-shadow 0.15s ease, outline-color 0.15s ease;
}
.card.size-lg { width: 72px; height: 100px; font-size: 1.2rem; }
.card.size-md { width: 58px; height: 82px; font-size: 1.05rem; }
.card.size-sm { width: 44px; height: 62px; font-size: 0.85rem; }

.card.back {
  background: linear-gradient(140deg, var(--card-back-a), var(--card-back-b));
  border: 2px solid rgba(255,255,255,0.22);
  box-shadow: 0 3px 8px rgba(0,0,0,0.45), inset 0 0 0 1px rgba(255,255,255,0.06);
  overflow: hidden;
}
.card.back::before {
  content: "";
  position: absolute;
  inset: 13%;
  border: 1px solid rgba(255,255,255,0.28);
  border-radius: 4px;
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,0.07) 0 3px, transparent 3px 7px),
    repeating-linear-gradient(-45deg, rgba(255,255,255,0.05) 0 3px, transparent 3px 7px);
}
.card.back::after {
  content: "♦";
  position: relative;
  color: var(--gold);
  opacity: 0.9;
  font-size: 1em;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
.card.front {
  background: linear-gradient(158deg, #ffffff, #eef0ec);
  border: 1px solid rgba(0,0,0,0.14);
  box-shadow: 0 3px 8px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.9);
  overflow: hidden;
}
.card.front.red { color: #d1202f; }
.card.front.black { color: #1b1b1b; }
.card.front .corner {
  position: absolute;
  font-size: 0.82em;
  font-weight: 900;
  line-height: 0.82;
  text-align: center;
  letter-spacing: -0.5px;
}
.card.front .corner.tl { top: 5%; left: 7%; }
.card.front .corner.br { bottom: 5%; right: 7%; transform: rotate(180deg); }
.card.front .pip {
  font-size: 1.7em;
  line-height: 1;
  opacity: 0.92;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.12));
}
.card.empty { background: rgba(255,255,255,0.05); border: 2px dashed rgba(255,255,255,0.2); box-shadow: none; }

/* Flying card for the deck→discard flip animation */
.fly-card {
  position: fixed;
  z-index: 115;
  perspective: 700px;
  transition: transform 0.52s cubic-bezier(0.3, 0.7, 0.3, 1);
  pointer-events: none;
}
.fly-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.52s cubic-bezier(0.3, 0.7, 0.3, 1);
}
.fly-face {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  backface-visibility: hidden;
  margin: 0;
}
.fly-front { transform: rotateY(180deg); }

.card.just-swapped {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
  animation: swapPulse 0.5s ease;
  z-index: 2;
}
@keyframes swapPulse {
  0% { transform: scale(0.6) rotateY(90deg); opacity: 0; }
  60% { transform: scale(1.12); opacity: 1; }
  100% { transform: scale(1); }
}
.card.just-wrong {
  outline: 3px solid var(--red);
  outline-offset: 2px;
  animation: swapPulse 0.5s ease;
  z-index: 2;
}
.card.just-matched {
  outline: 3px solid #3ddc84;
  outline-offset: 2px;
  animation: matchPulse 0.6s ease;
}
@keyframes matchPulse {
  0% { transform: scale(1); box-shadow: 0 0 0 rgba(61,220,132,0); }
  50% { transform: scale(1.18); box-shadow: 0 0 22px rgba(61,220,132,0.8); }
  100% { transform: scale(1); }
}

.btn-match {
  background: linear-gradient(180deg, #38c99a, #23a17b);
  color: #04231a;
  box-shadow: 0 4px 14px rgba(35,161,123,0.35);
}
.btn-match:hover:not(:disabled) { filter: brightness(1.08); }

.card.selectable { cursor: pointer; }
.card.selectable:hover { transform: translateY(-4px); box-shadow: 0 10px 20px rgba(0,0,0,0.45); }
.card.chosen { outline: 3px solid var(--gold); outline-offset: 2px; }
.card.dimmed { opacity: 0.45; }

.your-hand-wrap {
  margin-top: auto;
  background: linear-gradient(180deg, rgba(0,0,0,0), rgba(0,0,0,0.28) 30%);
  padding: 18px 16px 10px;
}
.your-hand-label {
  text-align: center;
  color: var(--ink-dim);
  font-size: 0.8rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.your-hand {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.action-bar {
  background: rgba(0,0,0,0.32);
  border-top: 1px solid var(--felt-line);
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  align-items: center;
  min-height: 28px;
}

.log-panel {
  max-width: 640px;
  margin: 0 auto 12px;
  background: rgba(0,0,0,0.2);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 0.8rem;
  color: var(--ink-dim);
  line-height: 1.6;
  max-height: 90px;
  overflow-y: auto;
}

/* ---------- Modal / private reveal ---------- */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
  padding: 20px;
  backdrop-filter: blur(2px);
}
.overlay-box {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  padding: 30px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
}
.overlay-box h2 { margin: 0 0 6px; font-size: 1.15rem; }
.overlay-box .big-card-wrap { display: flex; justify-content: center; margin: 20px 0; perspective: 600px; }
.flip-in {
  animation: flipIn 0.4s ease both;
}
@keyframes flipIn {
  from { transform: rotateY(90deg); opacity: 0; }
  to { transform: rotateY(0deg); opacity: 1; }
}

/* ---------- Toasts ---------- */

#toast-root {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  background: rgba(20,20,20,0.92);
  color: white;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(255,255,255,0.12);
  animation: toastIn 0.2s ease;
}
.toast.error { border-color: rgba(226,86,79,0.6); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Reveal / scoring ---------- */

.reveal-wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 24px 16px 60px;
  width: 100%;
}
.reveal-row {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  animation: revealRowIn 0.4s ease both;
}
@keyframes revealRowIn {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.reveal-row.winner {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold) inset;
  background: linear-gradient(100deg, var(--panel), rgba(232,185,63,0.14), var(--panel));
  background-size: 200% 100%;
  animation: revealRowIn 0.4s ease both, winnerShimmer 2.4s linear 0.6s infinite;
}
@keyframes winnerShimmer {
  0% { background-position: 120% 0; }
  100% { background-position: -120% 0; }
}
.reveal-row .rname { font-weight: 700; min-width: 110px; display: flex; align-items: center; gap: 8px; }
.reveal-row .rcards { display: flex; gap: 6px; flex-wrap: wrap; }
.reveal-row .rtotal { margin-left: auto; font-weight: 800; font-size: 1.05rem; }
.reveal-row.winner .rtotal { color: var(--gold); }
.badge-winner {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.6px;
  background: var(--gold);
  color: var(--gold-ink);
  padding: 2px 7px;
  border-radius: 5px;
}

.connecting-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-dim);
  font-size: 0.95rem;
}

/* ---------- Friends ---------- */

.friends-fab {
  position: fixed;
  top: 8px;
  right: 12px;
  z-index: 40;
  background: rgba(0,0,0,0.35);
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 1.05rem;
  line-height: 1;
  color: var(--ink);
}
.friends-fab:hover { background: rgba(0,0,0,0.5); }
.friends-fab .fab-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--red);
  color: white;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 6px;
}

.lb-fab {
  position: fixed;
  top: 8px;
  right: 60px;
  z-index: 40;
  background: rgba(0,0,0,0.35);
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 1.05rem;
  line-height: 1;
}
.lb-fab:hover { background: rgba(0,0,0,0.5); }

.top-bar { padding-right: 116px; }

.my-stats {
  background: rgba(232,185,63,0.08);
  border: 1px solid rgba(232,185,63,0.3);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.9rem;
}
.my-stats strong { color: var(--gold); }

.lb-table { display: flex; flex-direction: column; gap: 4px; }
.lb-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.9rem;
  background: rgba(255,255,255,0.04);
}
.lb-row.lb-head {
  background: transparent;
  color: var(--ink-dim);
  font-size: 0.7rem;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  font-weight: 700;
  padding-bottom: 2px;
}
.lb-row.me { background: rgba(232,185,63,0.14); border: 1px solid rgba(232,185,63,0.35); font-weight: 700; }
.lb-rank { width: 22px; text-align: center; color: var(--ink-dim); font-weight: 700; }
.lb-row.me .lb-rank { color: var(--gold); }
.lb-num { width: 44px; text-align: right; }

.drawer-overlay {
  justify-content: flex-end;
  align-items: stretch;
  padding: 0;
}
.friends-drawer {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border-left: 1px solid var(--panel-border);
  width: min(360px, 92vw);
  height: 100%;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: -12px 0 40px rgba(0,0,0,0.45);
  animation: drawerIn 0.18s ease;
}
@keyframes drawerIn { from { transform: translateX(30px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.friend-row {
  display: flex;
  align-items: center;
  gap: 9px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--panel-border);
  padding: 8px 11px;
  border-radius: 9px;
  font-size: 0.92rem;
  font-weight: 600;
}
.online-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #3ddc84;
  box-shadow: 0 0 7px rgba(61,220,132,0.7);
  flex-shrink: 0;
}
.online-dot.off { background: #5c6b62; box-shadow: none; }

.section-label {
  font-size: 0.7rem;
  letter-spacing: 1.4px;
  color: var(--ink-dim);
  text-transform: uppercase;
  font-weight: 700;
  margin-top: 6px;
}

.auth-tabs {
  display: flex;
  gap: 6px;
  background: rgba(255,255,255,0.05);
  border-radius: 10px;
  padding: 4px;
}
.auth-tab {
  flex: 1;
  background: transparent;
  color: var(--ink-dim);
  padding: 8px;
  border-radius: 7px;
  font-size: 0.9rem;
}
.auth-tab.on { background: var(--panel-2); color: var(--ink); box-shadow: var(--shadow-md); }

.recovery-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--gold);
  background: rgba(0,0,0,0.35);
  border: 1px dashed var(--panel-border);
  border-radius: 10px;
  padding: 14px;
  margin: 16px 0 0;
  word-break: break-all;
  user-select: all;
}

.toast.invite {
  display: flex;
  gap: 10px;
  align-items: center;
  pointer-events: auto;
}
.toast.invite button { padding: 6px 12px; font-size: 0.8rem; }

/* ---------- Bots ---------- */

.add-bot-box {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  max-width: 420px;
  width: 100%;
}
.diff-btn { font-size: 0.85rem; padding: 8px 14px; }
.diff-btn.easy:hover:not(:disabled) { box-shadow: inset 0 0 0 1px #3ddc84; }
.diff-btn.medium:hover:not(:disabled) { box-shadow: inset 0 0 0 1px #4f9bed; }
.diff-btn.hard:hover:not(:disabled) { box-shadow: inset 0 0 0 1px #e8963f; }
.diff-btn.impossible:hover:not(:disabled) { box-shadow: inset 0 0 0 1px #e2564f; }

.diff-badge, .mini-tag.bot {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.4px;
  padding: 2px 7px;
  border-radius: 5px;
  color: #0c1410;
  text-transform: uppercase;
}
.diff-badge.easy, .mini-tag.bot.easy { background: #3ddc84; }
.diff-badge.medium, .mini-tag.bot.medium { background: #4f9bed; color: white; }
.diff-badge.hard, .mini-tag.bot.hard { background: #e8963f; }
.diff-badge.impossible, .mini-tag.bot.impossible { background: #e2564f; color: white; }

/* ---------- Tutorial ---------- */

.help-fab {
  position: fixed;
  top: 8px;
  left: 12px;
  z-index: 40;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(0,0,0,0.35);
  border: 1px solid var(--panel-border);
  color: var(--ink);
  font-size: 1.15rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}
.help-fab:hover { background: rgba(0,0,0,0.5); }

.tutorial-overlay { z-index: 90; }
.tutorial-box {
  position: relative;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  padding: 26px 24px 22px;
  max-width: 430px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  text-align: center;
  box-shadow: var(--shadow-lg);
}
.tutorial-skip {
  position: absolute;
  top: 10px;
  right: 12px;
  background: transparent;
  border: none;
  color: var(--ink-dim);
  font-size: 1rem;
  padding: 4px 8px;
}
.tutorial-skip:hover { color: var(--ink); }
.tutorial-step {
  font-size: 0.7rem;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 700;
}
.tutorial-title { font-size: 1.35rem; font-weight: 800; margin: 4px 0 2px; }
.tutorial-body { color: var(--ink-dim); font-size: 0.95rem; line-height: 1.6; }
.tutorial-body strong { color: var(--ink); }
.tutorial-illus {
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  margin: 18px 0;
}
.tutorial-card-wrap { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.tutorial-tag {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--ink-dim);
  background: rgba(255,255,255,0.07);
  padding: 2px 8px;
  border-radius: 999px;
}
.tutorial-tag.good { background: rgba(61,220,132,0.2); color: #7ff0b0; }
.tutorial-tag.bad { background: rgba(226,86,79,0.2); color: #ff9a94; }
.tutorial-arrow { color: var(--ink-dim); font-size: 1.5rem; }
.tutorial-dutch-chip {
  background: linear-gradient(180deg, #ef7871, var(--red));
  color: white;
  font-weight: 800;
  padding: 12px 26px;
  border-radius: 999px;
  box-shadow: 0 4px 16px rgba(226,86,79,0.4);
}
.tutorial-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 22px;
}
.tutorial-nav .btn-ghost, .tutorial-nav .btn-gold { padding: 10px 18px; }
.tutorial-dots { display: flex; gap: 7px; justify-content: center; }
.tutorial-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  cursor: pointer;
}
.tutorial-dot.on { background: var(--gold); }

@media (max-width: 480px) {
  .card.size-lg { width: 60px; height: 84px; font-size: 1.05rem; }
  .card.size-md { width: 50px; height: 70px; font-size: 0.95rem; }
  .brand h1 { letter-spacing: 3px; }
  .room-code-box .code { font-size: 2.2rem; letter-spacing: 8px; }
}

/* ---------- Fun animations ---------- */

/* Confetti canvas + Dutch flash live in #fx-root, above everything, click-through */
#fx-root { position: fixed; inset: 0; z-index: 120; pointer-events: none; }
.confetti-canvas { position: fixed; inset: 0; width: 100%; height: 100%; }

.dutch-flash {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: radial-gradient(circle at center, rgba(226,86,79,0.28), rgba(226,86,79,0) 60%);
  animation: dutchFlash 1.6s ease forwards;
}
.dutch-flash-text {
  font-size: clamp(3rem, 16vw, 7rem);
  font-weight: 900;
  letter-spacing: 4px;
  color: #fff;
  text-shadow: 0 0 30px rgba(226,86,79,0.9), 0 4px 12px rgba(0,0,0,0.5);
  animation: dutchPop 1.6s cubic-bezier(0.2, 1.4, 0.3, 1) forwards;
}
.dutch-flash-sub { color: #ffd9d6; font-weight: 700; font-size: 1rem; opacity: 0; animation: fadeInOut 1.6s ease forwards; }
@keyframes dutchFlash { 0% { opacity: 0; } 15% { opacity: 1; } 75% { opacity: 1; } 100% { opacity: 0; } }
@keyframes dutchPop {
  0% { transform: scale(0.3) rotate(-8deg); opacity: 0; }
  25% { transform: scale(1.15) rotate(3deg); opacity: 1; }
  40% { transform: scale(1) rotate(0deg); }
  80% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.1); opacity: 0; }
}
@keyframes fadeInOut { 0%,20% { opacity: 0; } 35%,75% { opacity: 0.95; } 100% { opacity: 0; } }

/* Active-turn glow — smooth during the buffer thanks to text-only countdown ticks */
.turn-banner.your-turn { animation: yourTurnGlow 2.4s ease-in-out infinite; border-radius: var(--radius-md); }
@keyframes yourTurnGlow {
  0%, 100% { box-shadow: 0 0 0 rgba(232,185,63,0); }
  50% { box-shadow: 0 0 22px rgba(232,185,63,0.32); }
}
.opp-card.active { animation: activeOppGlow 2.4s ease-in-out infinite; }
@keyframes activeOppGlow {
  0%, 100% { box-shadow: 0 0 0 rgba(232,185,63,0); }
  50% { box-shadow: 0 0 16px rgba(232,185,63,0.4); }
}

/* Selectable cards gently pulse to invite a click */
.card.selectable {
  animation: cardHint 1.5s ease-in-out infinite;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
@keyframes cardHint {
  0%, 100% { outline: 2px solid rgba(232,185,63,0); outline-offset: 2px; }
  50% { outline: 2px solid rgba(232,185,63,0.65); outline-offset: 3px; }
}
.card.selectable:hover { animation: none; }

/* Landing suit symbols drift */
.brand .suits { display: inline-block; animation: suitsFloat 4s ease-in-out infinite; }
@keyframes suitsFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

/* Button press feedback (hover lift + squish on press) */
button { transition: transform 0.1s ease, filter 0.12s ease, box-shadow 0.12s ease; }
.btn-gold:hover:not(:disabled), .btn-blue:hover:not(:disabled),
.btn-red:hover:not(:disabled), .btn-match:hover:not(:disabled) {
  transform: translateY(-2px);
  filter: brightness(1.06);
}
button:active:not(:disabled) { transform: scale(0.95); }

/* Room-code pop in the lobby */
.player-chip { animation: chipIn 0.3s ease both; }
@keyframes chipIn {
  from { opacity: 0; transform: translateY(8px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .card.selectable, .turn-banner.your-turn, .opp-card.active, .brand .suits,
  .reveal-row, .reveal-row.winner { animation: none; }
}

/* ---------- QoL: sound toggle, series standings ---------- */

.sound-fab {
  position: fixed;
  top: 8px;
  left: 58px;
  z-index: 40;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(0,0,0,0.35);
  border: 1px solid var(--panel-border);
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sound-fab:hover { background: rgba(0,0,0,0.5); }

.series-box {
  max-width: 420px;
  margin: 18px auto 0;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}
.series-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: 8px;
  font-size: 0.92rem;
}
.series-row.leader { background: rgba(232,185,63,0.14); font-weight: 700; }
.series-rank { width: 20px; text-align: center; color: var(--ink-dim); font-weight: 700; }
.series-row.leader .series-rank { color: var(--gold); }
.series-total { font-weight: 800; }
.series-row.leader .series-total { color: var(--gold); }

/* ---------- Power-action highlights (Jack / Queen / Ace) ---------- */

.card.fx-jack   { outline: 3px solid #a259e6; outline-offset: 2px; animation: fxPulse 0.9s ease-in-out infinite; }
.card.fx-queen  { outline: 3px solid #4f9bed; outline-offset: 2px; animation: fxPulse 0.9s ease-in-out infinite; }
.card.fx-ace    { outline: 3px solid var(--red); outline-offset: 2px; animation: fxPulse 0.9s ease-in-out infinite; }
@keyframes fxPulse {
  0%, 100% { box-shadow: 0 0 0 rgba(255,255,255,0); }
  50%      { box-shadow: 0 0 16px rgba(255,255,255,0.35); }
}

.cell-badge {
  position: absolute;
  top: -9px;
  right: -9px;
  min-width: 20px;
  height: 20px;
  padding: 0 4px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
  z-index: 3;
  animation: badgePop 0.25s cubic-bezier(0.2, 1.5, 0.4, 1) both;
}
.fx-jack-badge  { background: #a259e6; }
.fx-queen-badge { background: #4f9bed; }
.fx-ace-badge   { background: var(--red); }
@keyframes badgePop { from { transform: scale(0); } to { transform: scale(1); } }

@media (prefers-reduced-motion: reduce) {
  .card.fx-jack, .card.fx-queen, .card.fx-ace { animation: none; }
}

/* ---------- Game settings / emotes / deal ---------- */

.settings-box {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  max-width: 440px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.settings-label { font-size: 0.85rem; color: var(--ink-dim); }
.seg { display: flex; gap: 4px; background: rgba(0,0,0,0.25); border-radius: 8px; padding: 3px; }
.seg-btn {
  padding: 5px 10px;
  font-size: 0.8rem;
  background: transparent;
  color: var(--ink-dim);
  border-radius: 6px;
  min-width: 32px;
}
.seg-btn.on { background: var(--gold); color: var(--gold-ink); }

.emote-fab {
  position: fixed;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 45;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--panel-border);
  font-size: 1.3rem;
  box-shadow: var(--shadow-md);
}
.emote-fab:hover { background: rgba(0,0,0,0.55); }
.emote-picker {
  position: fixed;
  right: 16px;
  bottom: calc(70px + env(safe-area-inset-bottom));
  z-index: 46;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  background: var(--panel-2);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 8px;
  box-shadow: var(--shadow-lg);
  animation: badgePop 0.16s ease both;
}
.emote-picker button { background: transparent; font-size: 1.4rem; padding: 6px; border-radius: 8px; }
.emote-picker button:hover { background: rgba(255,255,255,0.1); }

.emote-pop {
  position: fixed;
  margin-left: -18px;
  font-size: 2.4rem;
  z-index: 120;
  pointer-events: none;
  animation: emoteFloat 1.7s ease-out forwards;
  filter: drop-shadow(0 3px 6px rgba(0,0,0,0.5));
}
@keyframes emoteFloat {
  0% { opacity: 0; transform: translateY(6px) scale(0.4); }
  20% { opacity: 1; transform: translateY(-4px) scale(1.2); }
  40% { transform: translateY(-14px) scale(1); }
  100% { opacity: 0; transform: translateY(-70px) scale(0.95); }
}

.deal-fly {
  position: fixed;
  z-index: 114;
  pointer-events: none;
  transition: transform 0.4s cubic-bezier(0.25, 0.6, 0.3, 1), width 0.4s ease, height 0.4s ease;
}

/* ---------- Language + chat ---------- */

.lang-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.lang-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--panel-border);
  color: var(--ink);
  padding: 14px;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
}
.lang-btn:hover { background: rgba(255,255,255,0.12); }
.lang-btn.on { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }

.lang-fab {
  position: fixed;
  top: 8px;
  left: 104px;
  z-index: 40;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(0,0,0,0.35);
  border: 1px solid var(--panel-border);
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lang-fab:hover { background: rgba(0,0,0,0.5); }

.chat-fab {
  position: fixed;
  right: 16px;
  bottom: calc(72px + env(safe-area-inset-bottom));
  z-index: 45;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--panel-border);
  font-size: 1.25rem;
  box-shadow: var(--shadow-md);
}
.chat-fab:hover { background: rgba(0,0,0,0.55); }

.chat-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 6px 2px;
  min-height: 200px;
}
.chat-msg { display: flex; flex-direction: column; max-width: 85%; }
.chat-msg.mine { align-self: flex-end; align-items: flex-end; }
.chat-name { font-size: 0.72rem; color: var(--ink-dim); margin: 0 6px 2px; }
.chat-bubble {
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--panel-border);
  padding: 8px 12px;
  border-radius: 14px;
  font-size: 0.92rem;
  word-break: break-word;
}
.chat-msg.mine .chat-bubble { background: var(--blue); border-color: transparent; color: #fff; }

/* ============================================================
   ELABORATE THEME — card-room / old-world casino
   (overrides above; visual only, layout preserved)
   ============================================================ */

/* ---- Typography ---- */
.brand h1 {
  font-family: var(--display);
  font-weight: 900;
  letter-spacing: 0.14em;
  font-size: clamp(3rem, 9vw, 4.8rem);
  background: linear-gradient(180deg, #fff7e2 0%, var(--champagne) 30%, var(--gold) 55%, var(--gold-2) 80%, #8a6a2e 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 1px 0 rgba(255,255,255,0.15), 0 3px 8px rgba(0,0,0,0.5);
  filter: drop-shadow(0 2px 1px rgba(0,0,0,0.35));
}
.brand .suits {
  font-size: 1.3rem;
  letter-spacing: 0.9rem;
  color: var(--gold);
  opacity: 0.9;
  text-indent: 0.9rem;
  position: relative;
  display: inline-block;
  padding: 0 1.1rem;
}
.brand .suits::before, .brand .suits::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 46px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(226,201,140,0.6));
}
.brand .suits::before { right: 100%; }
.brand .suits::after { left: 100%; transform: scaleX(-1); }
.brand .tagline {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.06rem;
  color: #d8c99a;
  letter-spacing: 0.01em;
}

.card-panel h2, .overlay-box h2, .reveal-wrap h1 {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: 0.04em;
}
.reveal-wrap h1 { font-size: 2.3rem; background: linear-gradient(180deg, #fff7e2, var(--gold-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.section-label { color: #cdb579 !important; letter-spacing: 2px !important; }
.turn-banner .headline { font-family: var(--display); letter-spacing: 0.03em; }
.turn-banner.your-turn .headline { color: var(--champagne); }

/* ---- Buttons: beveled, tactile ---- */
.btn-gold {
  background: linear-gradient(180deg, #fbe9b0 0%, var(--gold) 45%, var(--gold-2) 100%);
  color: #3c2a06;
  border: 1px solid rgba(120,90,30,0.7);
  box-shadow: var(--inset-top), 0 1px 0 rgba(255,255,255,0.5) inset, 0 8px 18px rgba(0,0,0,0.4);
  text-shadow: 0 1px 0 rgba(255,255,255,0.35);
}
.btn-blue {
  background: linear-gradient(180deg, #3f5bd6 0%, #2a3fa8 55%, #1b2870 100%);
  color: #f3f5ff;
  border: 1px solid rgba(140,120,60,0.45);
  box-shadow: var(--inset-top), 0 1px 0 rgba(255,255,255,0.14) inset, 0 8px 18px rgba(0,0,0,0.45);
  text-shadow: 0 1px 1px rgba(0,0,0,0.35);
}
.btn-red {
  background: linear-gradient(180deg, #ec7a75, var(--red) 60%, #b23a36);
  border: 1px solid rgba(120,30,28,0.7);
  box-shadow: var(--inset-top), 0 8px 18px rgba(0,0,0,0.4);
}
.btn-match {
  background: linear-gradient(180deg, #46d6a6, #23a17b 60%, #177a5c);
  border: 1px solid rgba(15,90,68,0.7);
  box-shadow: var(--inset-top), 0 8px 18px rgba(0,0,0,0.4);
}
.btn-ghost {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(226,201,140,0.22);
  box-shadow: var(--inset-top);
}
.btn-ghost:hover:not(:disabled) { background: rgba(226,201,140,0.12); }

/* ---- Panels: felt-glass with gilt hairline ---- */
.card-panel, .room-code-box, .settings-box, .add-bot-box, .series-box, .my-stats,
.log-panel, .friends-drawer, .overlay-box, .tutorial-box {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0) 30%),
    linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--panel-border);
  box-shadow: var(--inset-top), 0 1px 0 rgba(0,0,0,0.3), var(--shadow-lg);
  position: relative;
}
.card-panel::before, .room-code-box::before, .overlay-box::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
}
.card-panel h2, .overlay-box h2 { color: var(--champagne); }

/* Drawers & modals get real glass */
.overlay { background: rgba(4,10,7,0.62); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.friends-drawer { background: linear-gradient(180deg, rgba(26,44,35,0.96), rgba(18,33,27,0.98)); border-left: 1px solid var(--panel-border); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }

/* ---- Room code ---- */
.room-code-box .code {
  font-family: var(--display);
  font-weight: 700;
  background: linear-gradient(180deg, #fff7e2, var(--gold) 55%, var(--gold-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---- Top bar ---- */
.top-bar {
  background: linear-gradient(180deg, rgba(0,0,0,0.4), rgba(0,0,0,0.18));
  border-bottom: 1px solid rgba(226,201,140,0.18);
  box-shadow: 0 1px 0 rgba(0,0,0,0.4);
}
.top-bar .brand-mini { font-family: var(--display); font-weight: 700; color: var(--champagne); letter-spacing: 0.22em; }

/* ---- Table: felt inset with a gilt rail ---- */
.table-area {
  border-radius: 180px;
  margin: 18px auto;
  min-width: min(560px, 86vw);
  min-height: 240px;
  padding: 56px 60px;
  background:
    radial-gradient(ellipse 66% 78% at 50% 48%, rgba(255,255,255,0.08), transparent 70%),
    radial-gradient(ellipse 84% 98% at 50% 55%, rgba(0,0,0,0.24), transparent 72%);
  box-shadow: inset 0 0 0 1px rgba(226,201,140,0.14), inset 0 0 56px rgba(0,0,0,0.38);
}
.pile-label { color: #cdb579; letter-spacing: 2px; }
.your-hand-label { color: #cdb579; }

/* ---- Opponent seats ---- */
.opp-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(0,0,0,0.12));
  border: 1px solid rgba(226,201,140,0.14);
  box-shadow: var(--inset-top), 0 6px 18px rgba(0,0,0,0.35);
}
.opp-card.active { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset, 0 0 22px rgba(231,194,90,0.25); }

/* ---- Avatars: subtle gilt ring ---- */
.avatar { box-shadow: 0 0 0 1.5px rgba(255,255,255,0.15), 0 2px 5px rgba(0,0,0,0.4); }

/* ---- Cards: a touch more finish ---- */
.card.front { box-shadow: 0 4px 10px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.95), inset 0 -6px 12px rgba(0,0,0,0.05); }
.card.back { border-color: rgba(226,201,140,0.35); }
.card.back::after { color: var(--gold); }

/* ---- Turn banner ---- */
.turn-banner { border-bottom: 1px solid rgba(226,201,140,0.08); }

/* ---- Player chips ---- */
.player-chip { background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(0,0,0,0.15)); border: 1px solid rgba(226,201,140,0.16); box-shadow: var(--inset-top); }

/* ---- Round-code / reveal winner shimmer keeps but warmer gold already ---- */
.reveal-row { box-shadow: var(--inset-top), 0 8px 20px rgba(0,0,0,0.3); }

/* ---- FABs: gilt-rimmed ---- */
.friends-fab, .lb-fab, .help-fab, .sound-fab, .lang-fab, .emote-fab, .chat-fab {
  border: 1px solid rgba(226,201,140,0.28) !important;
  background: linear-gradient(180deg, rgba(26,40,32,0.9), rgba(12,22,17,0.92)) !important;
  box-shadow: var(--inset-top), 0 6px 16px rgba(0,0,0,0.4) !important;
}

/* ---- Layout tidy: keep floating controls clear of the top bar ---- */
.sound-fab { top: auto !important; left: 16px !important; bottom: calc(16px + env(safe-area-inset-bottom)) !important; }
.lang-fab { left: 58px; }
.top-bar .brand-mini { letter-spacing: 0.14em; font-size: 0.9rem; }
.top-bar { padding-left: 14px; padding-right: 104px; }

/* A lone panel in a centered column must size to its content, not stretch to fill height */
.lobby-wrap > .card-panel { flex: 0 0 auto; }

/* House Rules: line the option groups up in a tidy column instead of ragged flush-right */
.settings-row { justify-content: flex-start; gap: 14px; }
.settings-label { flex: 0 0 116px; }

/* Center the glyph inside every round FAB (base button padding was pushing emojis off-center) */
.friends-fab, .lb-fab, .help-fab, .sound-fab, .lang-fab, .emote-fab, .chat-fab {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  line-height: 1 !important;
}

/* ---- Ranked 1v1 ---- */
.ranked-cta { display: flex; justify-content: center; margin: -4px 0 24px; }
.ranked-cta .btn-blue { padding: 11px 26px; font-size: 1rem; letter-spacing: 0.03em; }
.ranked-banner {
  align-self: center;
  text-align: center;
  font-family: var(--display);
  letter-spacing: 0.08em;
  color: var(--champagne);
  font-weight: 700;
  padding: 7px 18px;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(226,201,140,0.14), rgba(0,0,0,0.18));
  box-shadow: var(--inset-top);
}
.ranked-banner .ranked-sub {
  font-family: var(--font); font-weight: 500; letter-spacing: 0; color: var(--ink-dim); font-size: 0.8rem;
}
.rating-change { display: flex; flex-direction: column; align-items: center; gap: 2px; margin: 0 auto 18px; }
.rating-change .rating-delta { font-family: var(--display); font-size: 1.9rem; font-weight: 900; line-height: 1; }
.rating-change.up .rating-delta { color: #46d6a6; text-shadow: 0 0 18px rgba(70,214,166,0.35); }
.rating-change.down .rating-delta { color: #ec7a75; }
.rating-change .rating-new { color: var(--ink-dim); font-size: 0.85rem; letter-spacing: 0.05em; text-transform: uppercase; }
.lb-rating { color: var(--champagne); font-weight: 700; }

/* ---- Public games list (landing) ---- */
.public-games {
  width: 100%; max-width: 420px; margin: 0 0 20px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--panel-border); border-radius: var(--radius-md);
  box-shadow: var(--inset-top), var(--shadow-md); padding: 12px 14px;
}
.public-games .pg-head {
  font-family: var(--display); font-weight: 700; letter-spacing: 0.04em;
  color: var(--champagne); font-size: 0.92rem; text-align: center; margin-bottom: 8px;
}
.public-games .pg-list { display: flex; flex-direction: column; gap: 6px; max-height: 168px; overflow-y: auto; }
.public-games .pg-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 9px;
  background: rgba(255,255,255,0.04); border: 1px solid var(--panel-border);
}
.public-games .pg-info { flex: 1; font-weight: 600; font-size: 0.9rem; }
.public-games .pg-join { padding: 7px 16px; font-size: 0.85rem; }

/* ---- Match history ---- */
.hist-list { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.hist-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 12px; border-radius: 9px;
  background: rgba(255,255,255,0.04); border: 1px solid var(--panel-border);
  font-size: 0.85rem;
}
.hist-row.won { border-color: rgba(231,194,90,0.4); background: rgba(231,194,90,0.08); }
.hist-when { color: var(--ink-dim); font-size: 0.78rem; min-width: 74px; }
.hist-score { flex: 1; font-weight: 600; }
.hist-right { text-align: right; }
.hist-players { color: var(--ink-dim); font-size: 0.8rem; }
.hist-delta { font-weight: 800; }
.hist-delta.up { color: #46d6a6; }
.hist-delta.down { color: #ec7a75; }

/* ---- Account call-to-action (landing) ---- */
.account-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin: 0 0 14px;
  padding: 12px 26px;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(226,201,140,0.16), rgba(226,201,140,0.06));
  border: 1px solid var(--panel-border);
  box-shadow: var(--inset-top);
  color: var(--champagne);
}
.account-cta:hover:not(:disabled) { filter: brightness(1.08); border-color: var(--gold); }
.account-cta .account-cta-main { font-family: var(--display); font-weight: 700; letter-spacing: 0.04em; font-size: 1.02rem; }
.account-cta .account-cta-sub { font-family: var(--font); font-weight: 500; color: var(--ink-dim); font-size: 0.8rem; }
.account-cta.signed { flex-direction: row; font-weight: 600; font-size: 0.92rem; color: var(--ink); }
.account-cta.signed strong { color: var(--champagne); margin-left: 4px; }

/* ================= Mobile / small screens ================= */
@media (max-width: 560px) {
  /* Fit the whole game on one phone screen (dvh accounts for browser chrome). */
  #app, .game-wrap { min-height: 100dvh; }

  /* Keep the top bar and action bar on screen at all times. */
  .top-bar {
    position: sticky; top: 0; z-index: 30;
    padding: 8px 92px 8px 12px;
    background: linear-gradient(180deg, rgba(6,14,10,0.92), rgba(6,14,10,0.78));
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  }
  .top-bar .brand-mini { font-size: 0.82rem; letter-spacing: 0.1em; }

  /* Compact cards */
  .card.size-lg { width: 48px; height: 68px; font-size: 0.88rem; }
  .card.size-md { width: 42px; height: 59px; font-size: 0.8rem; }
  .card.size-sm { width: 30px; height: 42px; font-size: 0.62rem; }

  /* Compact felt table */
  .table-area {
    min-width: min(400px, 92vw); min-height: 112px;
    padding: 16px 24px; border-radius: 100px; margin: 6px auto; gap: 16px;
  }
  .pile-label { font-size: 0.62rem; letter-spacing: 1px; }

  /* Tighten vertical rhythm */
  .turn-banner { padding: 8px 12px 2px; }
  .turn-banner .headline { font-size: 1rem; }
  .turn-banner .sub { font-size: 0.76rem; margin-top: 2px; }
  /* Opponents sit side-by-side (compact) so 2-4 players don't stack tall. */
  .opponents-row { gap: 6px; padding: 5px 10px 2px; }
  .opp-card { padding: 6px 8px; min-width: 0; gap: 3px; }
  .opp-card .opp-name { font-size: 0.72rem; max-width: 88px; }
  .opp-card .row { gap: 3px !important; }
  .your-hand-wrap { padding: 6px 8px 4px; }
  .your-hand-label { margin-bottom: 4px; font-size: 0.66rem; }
  .your-hand { gap: 6px; }

  /* Action bar pinned to the bottom, single compact row where possible */
  .action-bar {
    position: sticky; bottom: 0; z-index: 30;
    padding: 9px 10px calc(9px + env(safe-area-inset-bottom));
    gap: 7px;
    background: linear-gradient(0deg, rgba(6,14,10,0.94), rgba(6,14,10,0.82));
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  }
  .action-bar button { padding: 11px 14px; font-size: 0.9rem; }
  .action-bar .help-text { font-size: 0.76rem; }

  /* The event log lives under the action bar in the DOM — keep it short. */
  .log-panel { font-size: 0.66rem; line-height: 1.3; padding: 5px 10px; margin-bottom: 4px; max-height: 2.3em; overflow: hidden; }

  /* Utility FABs: smaller, tucked into corners clear of the sticky action bar. */
  .friends-fab, .lb-fab, .help-fab, .sound-fab, .lang-fab, .emote-fab, .chat-fab {
    width: 38px !important; height: 38px !important; font-size: 1.05rem !important;
  }
  /* Trophy + friends in the top-right; sound/emote/chat as a left-edge stack —
     both clear of the centered opponents, table, hand, and sticky action bar. */
  .lb-fab { top: 6px; right: 10px; }
  .friends-fab { top: 6px; right: 54px; }
  .sound-fab { left: 8px !important; right: auto !important; bottom: auto !important; top: 52px !important; }
  .emote-fab { left: 8px !important; right: auto !important; bottom: auto !important; top: 98px !important; }
  .chat-fab { left: 8px !important; right: auto !important; bottom: auto !important; top: 144px !important; }
  .emote-picker { left: 52px !important; right: auto !important; bottom: auto !important; top: 98px !important; }

  /* Landing: compact so it fits without scrolling. Hide the ornamental
     divider (collided with the corner buttons) and the panel descriptions. */
  .brand .suits::before, .brand .suits::after { display: none; }
  .landing-wrap { padding-top: 40px; justify-content: flex-start; }
  .brand { margin-bottom: 14px; }
  .brand .suits { font-size: 1.3rem; letter-spacing: 7px; margin-bottom: 2px; }
  .brand h1 { font-size: clamp(2rem, 11vw, 2.7rem); }
  .brand .tagline { font-size: 0.9rem; margin-top: 4px; }
  .account-cta { padding: 9px 20px; margin-bottom: 10px; }
  .account-cta .account-cta-main { font-size: 0.95rem; }
  .account-cta .account-cta-sub { font-size: 0.74rem; }
  .ranked-cta { margin: 0 0 14px; }
  .ranked-cta .btn-blue { padding: 9px 22px; }
  .landing-cards { gap: 12px; }
  .card-panel { padding: 16px; }
  .card-panel h2 { font-size: 1.15rem; margin-bottom: 8px; }
  .card-panel .sub { display: none; }
  .card-panel .col { gap: 8px; }
  .card-panel input, .card-panel button { padding: 10px 12px; font-size: 0.95rem; }

  /* Lobby: compact and top-aligned so Start Game is reachable without scroll. */
  .lobby-wrap { justify-content: flex-start; padding-top: 46px; gap: 8px; }
  .room-code-box { padding: 11px 18px; }
  .room-code-box .code { font-size: 1.8rem; letter-spacing: 6px; }
  .room-code-box .label { font-size: 0.7rem; margin-bottom: 4px; }
  .room-code-box .copy-hint { display: none; }
  .room-code-box #copy-link-btn { margin-top: 8px !important; padding: 6px 14px !important; font-size: 0.8rem !important; }
  .player-chip-list { gap: 6px; }
  .player-chip { padding: 4px 11px 4px 4px; font-size: 0.83rem; }
  .add-bot-box, .settings-box { padding: 9px 12px; }
  .section-label { font-size: 0.7rem; }
  /* Bot buttons on a single row */
  .add-bot-box .row { gap: 5px; flex-wrap: nowrap; }
  .diff-btn { padding: 7px 8px; font-size: 0.76rem; letter-spacing: 0; }
  .settings-box { margin-top: 2px; }
  .settings-row { gap: 8px; }
  .settings-label { flex-basis: 92px; font-size: 0.78rem; }
  .seg { padding: 2px; gap: 3px; }
  .seg-btn { padding: 5px 8px; font-size: 0.8rem; }
  #start-btn { padding: 11px 24px !important; font-size: 0.98rem !important; }
  #lobby-leave { margin-top: 2px !important; }

  /* Reveal / peek: give the header room below the corner buttons */
  .reveal-wrap { padding-top: 50px; }
}
