/* Self-hosted Rubik (variable font, Hebrew + Latin subsets) — no external fetch on page load. */
@font-face {
  font-family: 'Rubik';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url('/static/fonts/rubik-hebrew.woff2') format('woff2');
  unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F;
}
@font-face {
  font-family: 'Rubik';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url('/static/fonts/rubik-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* Mediterranean palette */
  --ocean-deep:   #07304a;
  --ocean-mid:    #0d5a82;
  --sky-blue:     #2aa7c4;
  --turquoise:    #3dd8c3;
  --aqua:         #a8ede2;

  /* Sunset warmth */
  --coral:        #ff6b5b;
  --peach:        #ffa373;
  --sun:          #ffd166;
  --sand:         #fef3e2;
  --sand-shade:   #f2dcb4;

  /* Modern greens */
  --mint:         #7fe3c4;

  /* Card colors */
  --card-bg:      #ffffff;
  --card-red:     #ff4b5e;
  --card-black:   #1a2332;

  /* Neutral */
  --ink:          #0a1828;
  --soft-ink:     #2a3f5a;

  --radius-lg:    24px;
  --radius-md:    16px;
  --radius-sm:    10px;
  --ease:         cubic-bezier(.32,.72,0,1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  min-height: 100%;
  direction: rtl;
  font-family: 'Rubik', 'Segoe UI', sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  /* Kill double-tap zoom + the 300 ms click delay on iOS without blocking scroll. */
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--ocean-deep);
}

/* Lock viewport only while the game table is visible */
body.in-game { overflow: hidden; height: 100vh; height: 100dvh; }

/* ═══ BACKGROUND ═══ */
.sun-bg {
  position: absolute; inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 70% 50% at 80% -5%, rgba(180,130,50,.12) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 15% 95%, rgba(20,80,120,.4) 0%, transparent 60%),
    linear-gradient(160deg, #070c14 0%, #0a1420 40%, #0d1e30 70%, #071018 100%);
  overflow: hidden;
}

.sun-bg::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 35%;
  background:
    radial-gradient(ellipse 80% 100% at 50% 100%, rgba(10,40,70,.8) 0%, transparent 70%);
}

/* Palm silhouette */
.palm {
  position: absolute;
  bottom: 0;
  width: 250px; height: 350px;
  opacity: 0.07;
  pointer-events: none;
}
.palm-left { left: -40px; transform: scaleX(-1); }
.palm-right { right: -40px; }

/* Subtle dot grid */
.pattern-grid {
  position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 1px 1px, rgba(255,255,255,.04) 1px, transparent 0);
  background-size: 40px 40px;
  pointer-events: none;
}

/* ── SCREENS ── */
.screen { display: none; width: 100%; min-height: 100vh; min-height: 100dvh; position: relative; }
.screen.active { display: flex; }

/* ═══════════════════════════════════════
   LOBBY
═══════════════════════════════════════ */
#screen-lobby.active, #screen-waiting.active {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
}

.lobby-inner {
  position: relative; z-index: 2;
  display: flex; flex-direction: column; align-items: center;
  width: 100%;
}

/* Hero */
.hero {
  text-align: center;
  margin-bottom: 2.2rem;
  position: relative;
}
.hero-badge {
  display: inline-block;
  padding: 0.3rem 1rem;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 4px;
  color: rgba(255,255,255,.5);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.22rem;
  text-transform: uppercase;
  margin-bottom: 1.4rem;
}
.hero-badge::before { display: none; }

.hero-logo {
  font-family: 'Rubik', sans-serif;
  font-weight: 900;
  font-size: clamp(5rem, 14vw, 8.5rem);
  line-height: 0.88;
  color: #fff;
  letter-spacing: -3px;
  text-shadow: 0 2px 40px rgba(0,0,0,.6);
  position: relative;
}

#screen-auth .hero-logo {
  font-size: clamp(2rem, 6vw, 4rem);
  line-height: 1.05;
  letter-spacing: -1px;
}

.hero-tag {
  font-size: 0.82rem;
  font-weight: 400;
  color: rgba(255,255,255,.38);
  letter-spacing: 0.18rem;
  margin-top: 0.75rem;
  text-transform: uppercase;
}
.hero-tag span { color: rgba(196,154,60,.8); font-weight: 500; }

/* Card panel */
.glass {
  color: #fff;
  background: rgba(8,16,28,.88);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 16px;
  padding: 1.75rem;
  width: min(440px, 94vw);
  box-shadow: 0 32px 80px rgba(0,0,0,.5), 0 2px 0 rgba(255,255,255,.06) inset;
  position: relative;
  overflow: hidden;
}
.glass::before { display: none; }

.glass-title {
  font-weight: 700;
  font-size: 1rem;
  color: rgba(255,255,255,.55);
  letter-spacing: 0.08rem;
  text-transform: uppercase;
  margin-bottom: 1.3rem;
  position: relative;
}
.glass-title::before { display: none; }

.tabs {
  display: flex; gap: 0;
  border-bottom: 1px solid rgba(255,255,255,.08);
  margin-bottom: 1.4rem;
}
.tab {
  flex: 1;
  padding: 0.65rem 0.5rem;
  border: none; background: transparent;
  font-family: inherit;
  font-weight: 500;
  font-size: 0.88rem;
  color: rgba(255,255,255,.35);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .2s, border-color .2s;
}
.tab:hover { color: rgba(255,255,255,.65); }
.tab.active {
  color: #fff;
  font-weight: 700;
  border-bottom-color: rgba(196,154,60,.8);
}

.tab-panel { display: none; flex-direction: column; gap: 0.9rem; }
.tab-panel.active { display: flex; }

.field-wrap { display: flex; flex-direction: column; gap: 0.45rem; }
.field-label {
  font-size: 0.72rem;
  font-weight: 500;
  color: rgba(255,255,255,.4);
  letter-spacing: 0.08rem;
  text-transform: uppercase;
}
.field {
  width: 100%;
  padding: 0.8rem 1rem;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px;
  color: #fff;
  font-family: inherit;
  font-size: 0.98rem;
  font-weight: 500;
  outline: none;
  transition: border-color .2s;
  direction: rtl;
}
.field:focus { border-color: rgba(196,154,60,.6); }
.field::placeholder { color: rgba(255,255,255,.2); }
.field.code {
  text-align: center;
  letter-spacing: 0.6rem;
  font-size: 1.6rem;
  font-weight: 700;
  color: #fff;
}

.btn {
  border: none;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s var(--ease);
}
.btn-sunset {
  width: 100%;
  padding: 0.95rem 1rem;
  background: rgba(196,154,60,.15);
  border: 1px solid rgba(196,154,60,.4);
  color: rgba(220,178,80,.95);
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.04rem;
  position: relative;
}
.btn-sunset::before { display: none; }
.btn-sunset:hover {
  background: rgba(196,154,60,.25);
  border-color: rgba(196,154,60,.65);
  color: #fff;
  transform: translateY(-1px);
}
.btn-sunset:active { transform: translateY(0); }

.btn-glass {
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.12);
  color: rgba(255,255,255,.8);
  border-radius: 8px;
  padding: 0.8rem 1rem;
  font-size: 0.92rem;
  font-weight: 600;
}
.btn-glass:hover { background: rgba(255,255,255,.12); color: #fff; }

/* ═══════════════════════════════════════
   WAITING ROOM
═══════════════════════════════════════ */

.code-display {
  font-family: 'Rubik', sans-serif;
  font-weight: 800;
  font-size: clamp(3rem, 9vw, 4.8rem);
  text-align: center;
  letter-spacing: 0.6rem;
  direction: ltr;
  unicode-bidi: isolate;
  color: #fff;
  margin: 0.5rem 0 0.4rem;
  line-height: 1;
}
.code-sub {
  text-align: center;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.22rem;
  text-transform: uppercase;
  color: rgba(255,255,255,.3);
}

.seats { display: flex; flex-direction: column; gap: 0.4rem; margin: 1.1rem 0 0.9rem; }
.seat {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.7rem 0.9rem;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 8px;
  color: #fff;
  font-weight: 500;
  font-size: 0.92rem;
}
.seat.empty { color: rgba(255,255,255,.25); border-style: dashed; background: transparent; }

.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: rgba(196,154,60,.2);
  border: 1px solid rgba(196,154,60,.35);
  display: flex; align-items: center; justify-content: center;
  color: rgba(220,178,80,.9); font-weight: 700; font-size: 0.9rem;
  flex-shrink: 0;
}
.avatar.bot { background: rgba(30,144,168,.2); border-color: rgba(30,144,168,.4); color: rgba(90,200,220,.9); }
.avatar.empty { background: transparent; border-color: rgba(255,255,255,.1); color: rgba(255,255,255,.2); }

.seat-name { flex: 1; }
.seat-badge {
  padding: 0.18rem 0.65rem;
  background: rgba(196,154,60,.12);
  border: 1px solid rgba(196,154,60,.3);
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12rem;
  color: rgba(196,154,60,.8);
  text-transform: uppercase;
}

/* Threshold picker: styled as a segmented control matching the glass aesthetic.
   Same label treatment as form fields (.field-label), pills sit in a single
   glass-blur track, active pill uses the sunset gradient like btn-sunset. */
.threshold-row { margin-top: 0.3rem; display: flex; flex-direction: column; gap: 0.45rem; }
.threshold-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: rgba(255,255,255,.8);
  letter-spacing: 0.05rem;
}
.threshold-pills {
  display: flex;
  gap: 3px;
  padding: 3px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px;
}
.th-pill {
  flex: 1;
  padding: 0.5rem 0;
  border: none;
  background: transparent;
  color: rgba(255,255,255,.4);
  font-family: inherit; font-weight: 700; font-size: 0.95rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s, color .15s;
  direction: ltr;
}
.th-pill:hover:not([disabled]):not(.active) {
  background: rgba(255,255,255,.07);
  color: rgba(255,255,255,.8);
}
.th-pill.active {
  background: rgba(196,154,60,.18);
  color: rgba(220,178,80,.95);
  border: 1px solid rgba(196,154,60,.35);
}
.th-pill[disabled] { cursor: not-allowed; }
.th-pill[disabled]:not(.active) { color: rgba(255,255,255,.2); }

.waiting-actions { display: flex; gap: 0.6rem; margin-top: 0.9rem; }

/* Profile pill, top-right of lobby/waiting screens. */
/* Physical top-right (works in both LTR and RTL; `left` put it behind iOS notch). */
.profile-pill {
  position: absolute;
  top: max(1rem, env(safe-area-inset-top, 0px));
  right: 1rem;
  max-width: calc(100vw - 2rem);
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.45rem 0.7rem 0.45rem 0.5rem;
  background: rgba(8,16,28,.82);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 12px;
  color: #fff;
  font-weight: 600;
  font-size: 0.85rem;
  z-index: 3;
  box-shadow: 0 8px 32px rgba(0,0,0,.4);
}
/* Very narrow phones: drop the meta row + shop button so the pill stays in one line. */
@media (max-width: 380px) {
  .profile-pill .pp-meta { display: none; }
}
.pp-avatar {
  width: 34px; height: 34px; border-radius: 8px;
  background: rgba(196,154,60,.18);
  border: 1px solid rgba(196,154,60,.3);
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 0.95rem;
  color: rgba(220,178,80,.9);
  flex-shrink: 0;
}
.pp-text { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.pp-name { max-width: 8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.pp-meta { display: flex; gap: 0.3rem; direction: ltr; justify-content: flex-end; }
.pp-chip {
  font-size: 0.7rem; font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 100px;
  background: rgba(0,0,0,.2);
  color: rgba(255,255,255,.9);
  letter-spacing: 0.02rem;
}
.pp-chip.pp-gold { background: rgba(196,154,60,.15); border: 1px solid rgba(196,154,60,.25); }
.pp-chip.pp-trophy { background: rgba(196,154,60,.15); border: 1px solid rgba(196,154,60,.25); }
.pp-logout, .pp-shop {
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.6);
  font-family: inherit; font-weight: 600; font-size: 0.7rem;
  padding: 0.3rem 0.6rem;
  border-radius: 6px; cursor: pointer;
  letter-spacing: 0.06rem;
  transition: all .15s;
}
.pp-logout:hover, .pp-shop:hover { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.2); }
.pp-shop { border-color: rgba(196,154,60,.3); color: rgba(196,154,60,.85); background: rgba(196,154,60,.08); }
.pp-shop:hover { background: rgba(196,154,60,.18); color: rgba(220,178,80,.95); }
.pp-history { border: none; background: rgba(255,255,255,.12); color: rgba(255,255,255,.85);
  font-family: inherit; font-weight: 600; font-size: 0.78rem;
  padding: 0.3rem 0.5rem; border-radius: 100px; cursor: pointer; transition: background .2s var(--ease); }
.pp-history:hover { background: rgba(255,255,255,.22); }

.pp-xp-row { display: flex; align-items: center; gap: 0.35rem; margin-top: 0.1rem; }
.pp-xp-track {
  flex: 1; height: 4px; border-radius: 4px;
  background: rgba(255,255,255,.15); overflow: hidden; min-width: 50px;
}
.pp-xp-fill {
  height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, var(--turquoise), var(--sun));
  transition: width .6s var(--ease);
}
.pp-xp-hint { font-size: 0.62rem; color: rgba(255,255,255,.6); white-space: nowrap; font-weight: 600; }

/* ═══════════════════════════════════════
   GAME TABLE — modern Mediterranean
═══════════════════════════════════════ */
#screen-game.active {
  flex-direction: column;
  height: 100vh; height: 100dvh;
  overflow: hidden;
  background: var(--ocean-deep);
}

.topbar {
  padding: 0.75rem 1.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  background: rgba(255,255,255,.08);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255,255,255,.1);
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}

.top-l, .top-r { display: flex; align-items: center; gap: 0.9rem; }

.top-logo {
  font-weight: 900;
  font-size: 1.5rem;
  background: linear-gradient(135deg, var(--sun), var(--coral));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: -1px;
}

.top-room {
  font-size: 0.78rem;
  color: rgba(255,255,255,.6);
  font-weight: 500;
}
.top-room strong {
  color: var(--sun);
  font-weight: 800;
  letter-spacing: 0.2rem;
  margin-right: 0.3rem;
}

.turn-pill {
  padding: 0.4rem 1rem;
  border-radius: 100px;
  font-weight: 700;
  font-size: 0.85rem;
  background: linear-gradient(135deg, var(--turquoise), var(--mint));
  color: var(--ocean-deep);
  box-shadow: 0 4px 14px rgba(61,216,195,.5);
  position: relative;
  animation: breathe 2.5s ease-in-out infinite;
}
@keyframes breathe {
  0%,100% { box-shadow: 0 4px 14px rgba(61,216,195,.5); }
  50% { box-shadow: 0 4px 28px rgba(61,216,195,.85); }
}
.turn-pill::before { content: '●'; margin-left: 0.3rem; }
.turn-pill.warn {
  background: linear-gradient(135deg, var(--coral), #ff1744);
  color: #fff;
  box-shadow: 0 4px 14px rgba(255,23,68,.55);
  animation: breathe-warn 0.9s ease-in-out infinite;
}
@keyframes breathe-warn {
  0%,100% { box-shadow: 0 4px 14px rgba(255,23,68,.5); }
  50%     { box-shadow: 0 4px 30px rgba(255,23,68,.95); }
}

.top-round {
  font-size: 0.75rem;
  color: rgba(255,255,255,.5);
  letter-spacing: 0.15rem;
  text-transform: uppercase;
  font-weight: 600;
}
.top-leave {
  border: 1px solid rgba(255,107,91,.5);
  background: rgba(255,107,91,.15);
  color: #ffb9ac;
  font-family: inherit; font-weight: 700; font-size: 0.7rem;
  letter-spacing: 0.1rem;
  padding: 0.3rem 0.7rem;
  border-radius: 100px;
  cursor: pointer;
  transition: all .2s var(--ease);
}
.top-leave:hover { background: rgba(255,107,91,.3); color: #fff; }

/* ═══ MAIN GAME AREA ═══ */
.table-wrap {
  flex: 1;
  display: grid;
  grid-template-columns: 190px 1fr;
  overflow: hidden;
  position: relative;
}

/* Scoreboard */
.score-col {
  background: rgba(7,48,74,.85);
  backdrop-filter: blur(20px);
  border-left: 1px solid rgba(255,255,255,.08);
  padding: 1rem 0.75rem;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 0.55rem;
}

.score-hdr {
  display: flex; align-items: center; gap: 0.4rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.2rem;
  color: rgba(255,255,255,.5);
  text-transform: uppercase;
  margin-bottom: 0.25rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.score-hdr::before {
  content: '◆';
  color: var(--sun);
  font-size: 0.6rem;
}

.pc {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius-md);
  padding: 0.7rem 0.8rem;
  transition: all .3s var(--ease);
  position: relative;
  overflow: hidden;
}
.pc.turn {
  background: linear-gradient(135deg, rgba(61,216,195,.25), rgba(61,216,195,.08));
  border-color: var(--turquoise);
  box-shadow: 0 0 24px rgba(61,216,195,.25);
}
.pc.turn::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--turquoise), var(--mint));
}
.pc.out { opacity: 0.35; }
.pc.out .p-score { color: var(--coral); }

.p-row { display: flex; align-items: center; gap: 0.5rem; }
.p-ava {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--coral), var(--peach));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 0.75rem;
  flex-shrink: 0;
}
.p-ava.bot { background: linear-gradient(135deg, var(--turquoise), var(--sky-blue)); }
.p-name {
  font-weight: 600;
  font-size: 0.88rem;
  color: #fff;
  display: flex; flex-direction: column; line-height: 1.15;
}
.p-name small { font-size: 0.65rem; color: var(--sun); font-weight: 500; letter-spacing: 0.05rem; }

.p-score {
  font-family: 'Rubik', sans-serif;
  font-weight: 900;
  font-size: 1.65rem;
  color: var(--sun);
  line-height: 1;
  margin-top: 0.4rem;
}
.p-meta {
  font-size: 0.7rem;
  color: rgba(255,255,255,.5);
  margin-top: 0.2rem;
  font-weight: 500;
}

/* ═══ TABLE ═══ */
.felt {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: clamp(1rem, 3vw, 1.8rem) clamp(1rem, 3vw, 2rem);
  background:
    radial-gradient(ellipse 70% 65% at 50% 50%,
      var(--sky-blue) 0%,
      var(--ocean-mid) 45%,
      var(--ocean-deep) 100%);
}

/* Water ripple pattern */
.felt::before {
  content: '';
  position: absolute; inset: 0;
  opacity: 0.12;
  background-image:
    radial-gradient(circle at 50% 50%, transparent 30%, rgba(255,255,255,.3) 31%, transparent 33%, transparent 55%, rgba(255,255,255,.2) 56%, transparent 58%),
    radial-gradient(circle at 20% 30%, transparent 20%, rgba(255,255,255,.2) 21%, transparent 23%);
  background-size: 200px 200px, 150px 150px;
  pointer-events: none;
}

/* Sun shimmer */
.felt::after {
  content: '';
  position: absolute;
  top: -30%; left: 20%; right: 20%;
  height: 80%;
  background: radial-gradient(ellipse 50% 50% at 50% 100%, rgba(255,209,102,.18) 0%, transparent 70%);
  pointer-events: none;
}

/* Opponents */
.opp-row {
  display: flex;
  gap: clamp(1.5rem, 4vw, 3rem);
  justify-content: center;
  flex-wrap: wrap;
  position: relative;
  z-index: 2;
}
.opp {
  display: flex; flex-direction: column; align-items: center;
  gap: 0.55rem;
}
.opp-fan {
  position: relative;
  height: clamp(50px, 8vw, 68px);
  width: clamp(75px, 13vw, 100px);
  display: flex; justify-content: center;
}
.opp-fan .cb {
  position: absolute; top: 0;
  transition: transform .3s var(--ease);
}
.opp-fan .cb:nth-child(1) { transform: rotate(-15deg) translateX(18px); }
.opp-fan .cb:nth-child(2) { transform: rotate(-5deg) translateX(6px); }
.opp-fan .cb:nth-child(3) { transform: rotate(5deg)  translateX(-6px); }
.opp-fan .cb:nth-child(4) { transform: rotate(15deg) translateX(-18px); }
.opp-fan .cb:nth-child(5) { transform: rotate(22deg) translateX(-28px); }

.cb {
  width: clamp(32px, 5vw, 42px);
  height: clamp(45px, 7vw, 60px);
  border-radius: 8px;
  background:
    repeating-linear-gradient(45deg, var(--coral) 0, var(--coral) 4px, var(--peach) 4px, var(--peach) 8px);
  border: 2px solid #fff;
  box-shadow: 0 3px 10px rgba(0,0,0,.3);
  position: relative;
}
.cb::before {
  content: '';
  position: absolute; inset: 4px;
  border: 1px dashed rgba(255,255,255,.5);
  border-radius: 5px;
  pointer-events: none;
}
.cb::after {
  content: '☀';
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--sun);
  font-size: 0.85rem;
  text-shadow: 0 0 5px rgba(0,0,0,.5);
}

/* Card-back skins — applied by setting body.cb-<slug> from the equipped item. */
body.cb-sunset .cb {
  background: linear-gradient(135deg, var(--coral) 0%, var(--peach) 50%, var(--sun) 100%);
}
body.cb-sunset .cb::after { content: '✦'; color: #fff; }

body.cb-ocean .cb {
  background: linear-gradient(135deg, var(--ocean-deep), var(--ocean-mid) 60%, var(--turquoise));
}
body.cb-ocean .cb::before { border-color: rgba(168,237,226,.55); }
body.cb-ocean .cb::after { content: '~'; color: var(--aqua); font-weight: 900; }

body.cb-midnight .cb {
  background: linear-gradient(135deg, #0a0b1e, #2a1b4e 60%, #553c8b);
  border-color: rgba(255,255,255,.25);
}
body.cb-midnight .cb::before { border-color: rgba(200,180,255,.5); }
body.cb-midnight .cb::after { content: '☾'; color: #d8cfff; }

body.cb-neon .cb {
  background: linear-gradient(135deg, #0f0235, #4a0e7d 50%, #00c8ff);
  border-color: #00c8ff;
}
body.cb-neon .cb::before { border-color: rgba(0,200,255,.5); }
body.cb-neon .cb::after { content: '✦'; color: #00c8ff; text-shadow: 0 0 6px #00c8ff; }

body.cb-fire .cb {
  background: linear-gradient(135deg, #1a0000, #8b1a00 40%, #ff6b00);
  border-color: rgba(255,107,0,.7);
}
body.cb-fire .cb::before { border-color: rgba(255,107,0,.4); }
body.cb-fire .cb::after { content: '♨'; color: #ffd166; }

body.cb-royal .cb {
  background: linear-gradient(135deg, #1a1400, #4a3800 40%, #8b6914);
  border-color: rgba(215,175,0,.7);
}
body.cb-royal .cb::before { border-color: rgba(215,175,0,.4); }
body.cb-royal .cb::after { content: '♛'; color: #ffd700; }

/* ═══ SHOP ═══ */
.shop-modal {
  position: fixed; inset: 0;
  background: radial-gradient(ellipse at center, rgba(7,48,74,.85), rgba(0,0,0,.95));
  display: none;
  align-items: center; justify-content: center;
  z-index: 250;
  backdrop-filter: blur(10px);
  padding: 1rem;
}
.shop-modal.show { display: flex; }
.shop-card {
  background: rgba(255,255,255,.1);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  width: min(520px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  color: #fff;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.shop-head {
  display: flex; align-items: center; gap: 0.7rem;
  margin-bottom: 1rem;
}
.shop-title {
  font-family: 'Rubik', sans-serif;
  font-weight: 900;
  font-size: 1.4rem;
  letter-spacing: 0.05rem;
  flex: 1;
}
.shop-balance {
  padding: 0.35rem 0.8rem;
  background: linear-gradient(135deg, rgba(255,209,102,.4), rgba(255,163,115,.4));
  border: 1px solid rgba(255,209,102,.5);
  border-radius: 100px;
  font-weight: 700;
  font-size: 0.9rem;
  direction: ltr;
}
.shop-close {
  border: none;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
  color: #fff;
  font-size: 1.2rem; font-weight: 700;
  cursor: pointer;
  transition: background .2s var(--ease);
}
.shop-close:hover { background: rgba(255,255,255,.22); }

.shop-section-title {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.18rem;
  color: rgba(255,255,255,.55);
  text-transform: uppercase;
  margin: 0.5rem 0;
}
.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.8rem;
}
.shop-item {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: var(--radius-md);
  padding: 0.8rem;
  display: flex; flex-direction: column; align-items: center; gap: 0.5rem;
  transition: border-color .2s var(--ease);
}
.shop-item.equipped { border-color: var(--sun); box-shadow: 0 0 0 1px var(--sun); }

.shop-preview {
  /* Same visual as .cb but 2× size for the shop grid. Each preview applies the
     relevant variant's styles locally via data-skin. */
  width: 72px; height: 100px;
  border-radius: 10px;
  border: 2px solid #fff;
  box-shadow: 0 4px 14px rgba(0,0,0,.35);
  position: relative;
  background: repeating-linear-gradient(45deg, var(--coral) 0, var(--coral) 5px, var(--peach) 5px, var(--peach) 10px);
}
.shop-preview::before {
  content: ''; position: absolute; inset: 6px;
  border: 1px dashed rgba(255,255,255,.5);
  border-radius: 7px;
}
.shop-preview::after {
  content: '☀'; position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--sun); font-size: 1.4rem;
  text-shadow: 0 0 6px rgba(0,0,0,.5);
}
.shop-preview[data-skin="sunset"] { background: linear-gradient(135deg, var(--coral) 0%, var(--peach) 50%, var(--sun) 100%); }
.shop-preview[data-skin="sunset"]::after { content: '✦'; color: #fff; }
.shop-preview[data-skin="ocean"]  { background: linear-gradient(135deg, var(--ocean-deep), var(--ocean-mid) 60%, var(--turquoise)); }
.shop-preview[data-skin="ocean"]::before  { border-color: rgba(168,237,226,.55); }
.shop-preview[data-skin="ocean"]::after   { content: '~'; color: var(--aqua); font-weight: 900; }
.shop-preview[data-skin="midnight"] { background: linear-gradient(135deg, #0a0b1e, #2a1b4e 60%, #553c8b); border-color: rgba(255,255,255,.25); }
.shop-preview[data-skin="midnight"]::before { border-color: rgba(200,180,255,.5); }
.shop-preview[data-skin="midnight"]::after  { content: '☾'; color: #d8cfff; }
.shop-preview[data-skin="neon"] { background: linear-gradient(135deg, #0f0235, #4a0e7d 50%, #00c8ff); border-color: #00c8ff; }
.shop-preview[data-skin="neon"]::before { border-color: rgba(0,200,255,.5); }
.shop-preview[data-skin="neon"]::after  { content: '✦'; color: #00c8ff; text-shadow: 0 0 6px #00c8ff; }
.shop-preview[data-skin="fire"] { background: linear-gradient(135deg, #1a0000, #8b1a00 40%, #ff6b00); border-color: rgba(255,107,0,.7); }
.shop-preview[data-skin="fire"]::before { border-color: rgba(255,107,0,.4); }
.shop-preview[data-skin="fire"]::after  { content: '♨'; color: #ffd166; }
.shop-preview[data-skin="royal"] { background: linear-gradient(135deg, #1a1400, #4a3800 40%, #8b6914); border-color: rgba(215,175,0,.7); }
.shop-preview[data-skin="royal"]::before { border-color: rgba(215,175,0,.4); }
.shop-preview[data-skin="royal"]::after  { content: '♛'; color: #ffd700; }

.shop-item-name {
  font-size: 0.9rem;
  font-weight: 700;
  text-align: center;
}
.shop-item-price {
  font-size: 0.78rem;
  font-weight: 600;
  color: rgba(255,255,255,.7);
  direction: ltr;
}
.shop-item-btn {
  width: 100%;
  padding: 0.45rem 0;
  border: none;
  border-radius: 100px;
  font-family: inherit; font-weight: 700; font-size: 0.78rem;
  cursor: pointer;
  transition: all .2s var(--ease);
}
.shop-item-btn.buy {
  background: linear-gradient(135deg, var(--coral), var(--sun));
  color: #fff;
}
.shop-item-btn.buy:hover { transform: translateY(-1px); }
.shop-item-btn.buy[disabled] { opacity: 0.45; cursor: not-allowed; transform: none; }
.shop-item-btn.equip {
  background: rgba(255,255,255,.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,.25);
}
.shop-item-btn.equip:hover { background: rgba(255,255,255,.25); }
.shop-item-btn.equipped-badge {
  background: rgba(255,209,102,.2);
  color: var(--sun);
  border: 1px solid var(--sun);
  cursor: default;
}

.opp-name {
  display: flex; flex-direction: column; align-items: center;
  padding: 0.3rem 0.8rem;
  background: rgba(7,48,74,.75);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 100px;
  min-width: 80px;
  text-align: center;
}
.opp-name.turn {
  background: linear-gradient(135deg, rgba(61,216,195,.35), rgba(61,216,195,.1));
  border-color: var(--turquoise);
  box-shadow: 0 0 20px rgba(61,216,195,.4);
}
.opp-n {
  font-weight: 700;
  font-size: 0.85rem;
  color: #fff;
  white-space: nowrap;
}
.opp-cnt {
  font-size: 0.68rem;
  color: rgba(255,255,255,.7);
  font-weight: 500;
}

/* ═══ CENTER PILES ═══ */
.center-scene {
  display: flex; align-items: center; justify-content: center;
  gap: clamp(1.5rem, 5vw, 3rem);
  position: relative; z-index: 2;
  padding: 0.5rem 0;
}

.pg { display: flex; flex-direction: column; align-items: center; gap: 0.55rem; }
.pg-cap {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.15rem;
  text-transform: uppercase;
  color: rgba(255,255,255,.75);
}

.deck-stack {
  position: relative;
  width: clamp(60px, 10vw, 80px);
  height: clamp(84px, 14vw, 112px);
  cursor: default;
  transition: transform .2s var(--ease), filter .2s var(--ease);
}
.deck-stack .cb {
  position: absolute; width: 100%; height: 100%;
  border-radius: 12px;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.deck-stack .cb:nth-child(1) { top: 4px; left: 4px; transform: rotate(2deg); opacity: 0.7; }
.deck-stack .cb:nth-child(2) { top: 2px; left: 2px; transform: rotate(-1deg); opacity: 0.85; }
.deck-stack .cb:nth-child(3) { top: 0; left: 0; }

/* Click-to-play affordance: deck stack and discard-top cards pulse when it's
   the user's turn AND they've selected at least one hand card. */
/* Card entry: hand cards fade in with a stagger so they feel "dealt", and
   discard-top cards slam in with a scale+rotate. The nth-child rotations on
   .hand-fan .pcard already set the resting transform — we only animate opacity
   there to avoid the transform-override conflict. */
.hand-fan .pcard { animation: card-deal .38s var(--ease) backwards; }
.hand-fan .pcard:nth-child(1) { animation-delay: 0.00s; }
.hand-fan .pcard:nth-child(2) { animation-delay: 0.06s; }
.hand-fan .pcard:nth-child(3) { animation-delay: 0.12s; }
.hand-fan .pcard:nth-child(4) { animation-delay: 0.18s; }
.hand-fan .pcard:nth-child(5) { animation-delay: 0.24s; }
.hand-fan .pcard:nth-child(6) { animation-delay: 0.30s; }
.hand-fan .pcard:nth-child(7) { animation-delay: 0.36s; }
.hand-fan .pcard:nth-child(8) { animation-delay: 0.42s; }
@keyframes card-deal {
  from { opacity: 0; filter: brightness(0.55); }
  to   { opacity: 1; filter: brightness(1); }
}

/* Discard pile: lay cards in a flex row so multi-card throws (e.g. a 10-J-Q-K sequence)
   are all visible. On narrow phones, overlap cards slightly and scale down so 4 fit. */
.discard-top {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  gap: 3px;
  flex-wrap: nowrap;
  max-width: 100%;
}
.discard-top .pcard { animation: card-slap .28s cubic-bezier(.2,1.3,.4,1) backwards; }
@media (max-width: 520px) {
  .discard-top { gap: 0; }
  .discard-top .pcard {
    width: clamp(44px, 13vw, 60px);
    height: clamp(62px, 18vw, 84px);
    padding: 4px 5px;
    margin-right: -10px;
  }
  .discard-top .pcard:last-child { margin-right: 0; }
  .discard-top .pc-center { font-size: 1.1rem; }
  .discard-top .pc-rank { font-size: 0.85rem; }
  .discard-top .pc-suit { font-size: 0.7rem; }
  .discard-top .pc-bot-corner .pc-rank { font-size: 0.75rem; }
  .discard-top .pc-bot-corner .pc-suit { font-size: 0.6rem; }
}
@keyframes card-slap {
  0%   { opacity: 0; transform: scale(1.35) rotate(-8deg); }
  60%  { opacity: 1; transform: scale(0.92) rotate(3deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}

/* Opponent cards: a soft fade, no transform (nth-child owns the transform). */
.opp-fan .cb { animation: card-fade .4s var(--ease) backwards; }
.opp-fan .cb:nth-child(2) { animation-delay: 0.05s; }
.opp-fan .cb:nth-child(3) { animation-delay: 0.10s; }
.opp-fan .cb:nth-child(4) { animation-delay: 0.15s; }
.opp-fan .cb:nth-child(5) { animation-delay: 0.20s; }
@keyframes card-fade {
  from { opacity: 0; filter: brightness(0.55); }
  to   { opacity: 1; filter: brightness(1); }
}

/* Exiting animation applied transiently by JS right before a selected card
   is removed from the DOM on discard. */
.pcard.leaving {
  animation: card-swipe .3s var(--ease) forwards !important;
  pointer-events: none;
}
@keyframes card-swipe {
  from { opacity: 1; }
  to   { opacity: 0; transform: translateY(-120px) rotate(-18deg) scale(0.75); }
}

body.ready-to-play .deck-stack { cursor: pointer; animation: play-pulse 1.4s ease-in-out infinite; }
body.ready-to-play .deck-stack:hover { transform: translateY(-4px); filter: brightness(1.08); }
body.ready-to-play .discard-top .pcard.discard-pick {
  cursor: pointer; animation: play-pulse 1.4s ease-in-out infinite;
  box-shadow: 0 0 0 2px var(--sun), 0 8px 24px rgba(255,209,102,.5);
}
body.ready-to-play .discard-top .pcard.discard-pick:hover { transform: translateY(-6px) !important; }
@keyframes play-pulse {
  0%,100% { box-shadow: 0 0 0 2px rgba(255,209,102,.3), 0 4px 14px rgba(255,209,102,.25); }
  50%     { box-shadow: 0 0 0 3px rgba(255,209,102,.85), 0 8px 28px rgba(255,209,102,.7); }
}

/* Subtle cue when it's your turn but nothing selected yet. */
body.can-act:not(.ready-to-play) .deck-stack { cursor: not-allowed; }
.deck-count-lbl {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  pointer-events: none; z-index: 2;
}
.deck-count-lbl .n {
  font-family: 'Rubik', sans-serif;
  font-weight: 900;
  font-size: clamp(1.2rem, 2.5vw, 1.6rem);
  color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,.6);
}
.deck-count-lbl .s {
  font-size: 0.65rem;
  color: rgba(255,255,255,.9);
  letter-spacing: 0.1rem;
  text-transform: uppercase;
  text-shadow: 0 1px 4px rgba(0,0,0,.8);
}

.pile-sep {
  width: 40px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--sun), var(--coral), transparent);
  margin-top: 2rem;
  border-radius: 2px;
  position: relative;
}
.pile-sep::before {
  content: '☀';
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%,-50%);
  background: var(--ocean-mid);
  color: var(--sun);
  font-size: 1.1rem;
  padding: 0 8px;
  border-radius: 50%;
}

/* Playing card */
.pcard {
  width: clamp(60px, 10vw, 80px);
  height: clamp(84px, 14vw, 112px);
  background: var(--card-bg);
  border-radius: 12px;
  padding: 6px 8px;
  box-shadow:
    0 2px 0 rgba(0,0,0,.08),
    0 8px 24px rgba(0,0,0,.4),
    inset 0 0 0 1px rgba(0,0,0,.05);
  cursor: pointer;
  transition: all .25s var(--ease);
  position: relative;
  user-select: none;
  display: flex; flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}
.pcard.red { color: var(--card-red); }
.pcard.black { color: var(--card-black); }

.pc-top, .pc-bot-corner {
  line-height: 1;
  font-family: 'Rubik', sans-serif;
}
.pc-rank {
  font-size: clamp(1rem, 2vw, 1.35rem);
  font-weight: 900;
}
.pc-suit {
  font-size: clamp(0.85rem, 1.7vw, 1.1rem);
  margin-top: 1px;
}
.pc-center {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  font-size: clamp(1.8rem, 3.5vw, 2.6rem);
  opacity: 0.18;
  font-weight: 900;
}
.pc-bot-corner {
  position: absolute;
  bottom: 6px; left: 8px;
  transform: rotate(180deg);
  display: flex; flex-direction: column; align-items: flex-start;
}
.pc-bot-corner .pc-rank { font-size: clamp(0.8rem, 1.7vw, 1.05rem); }
.pc-bot-corner .pc-suit { font-size: clamp(0.7rem, 1.4vw, 0.9rem); }

.pcard:hover { transform: translateY(-8px); box-shadow: 0 4px 0 rgba(0,0,0,.08), 0 14px 32px rgba(0,0,0,.5); }
.pcard.selected {
  transform: translateY(-20px);
  box-shadow: 0 6px 0 rgba(0,0,0,.1), 0 20px 40px rgba(255,209,102,.6), 0 0 0 3px var(--sun);
}

/* Actions */
.actions {
  display: flex; gap: 0.6rem;
  flex-wrap: wrap; justify-content: center; align-items: center;
  position: relative; z-index: 2;
}
.action-hint {
  font-size: clamp(0.7rem, 1.3vw, 0.8rem);
  font-weight: 600;
  color: rgba(255,255,255,.6);
  text-align: center;
  max-width: 22rem;
  line-height: 1.3;
}
.act-yaniv {
  background: linear-gradient(135deg, var(--sun), var(--coral));
  border: none;
  color: #fff;
  font-weight: 900;
  padding: clamp(0.7rem, 2vw, 0.95rem) clamp(1.5rem, 4vw, 2rem);
  font-size: clamp(1rem, 2vw, 1.2rem);
  letter-spacing: 0.05rem;
  box-shadow: 0 8px 24px rgba(255,107,91,.5);
}
.act-yaniv:hover { box-shadow: 0 12px 32px rgba(255,107,91,.7); }

/* ═══ MY HAND PANEL ═══ */
.my-panel {
  background: linear-gradient(180deg, rgba(7,48,74,.95), rgba(10,24,40,.98));
  backdrop-filter: blur(30px);
  border-top: 1px solid rgba(255,255,255,.12);
  padding: clamp(0.7rem, 2vw, 1.1rem) 1rem clamp(1rem, 2.5vw, 1.4rem);
  position: relative;
  flex-shrink: 0;
  box-shadow: 0 -20px 40px rgba(0,0,0,.3);
}
.my-panel::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--turquoise), var(--sun), var(--coral), transparent);
  opacity: 0.6;
}

.hand-meta {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 0.7rem;
}
.hand-label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.1rem;
  color: rgba(255,255,255,.6);
  text-transform: uppercase;
}
.hand-total {
  font-size: 0.8rem;
  color: rgba(255,255,255,.6);
  font-weight: 500;
}
.hand-total strong {
  background: linear-gradient(135deg, var(--sun), var(--coral));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 900;
  font-size: 1.4rem;
  margin-right: 0.3rem;
}

.hand-fan {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  min-height: clamp(94px, 16vw, 128px);
  position: relative;
}
/* Fan: small negative margin so cards touch but don't hide each other's rank.
   No explicit z-index on center — natural DOM stacking puts each card's rank
   (top-right in RTL) above its right neighbor, so every rank is visible. */
.hand-fan .pcard { margin: 0 clamp(-6px, -0.6vw, -4px); transition: all .3s var(--ease); }
.hand-fan .pcard:nth-child(1) { transform: rotate(-10deg) translateY(6px); }
.hand-fan .pcard:nth-child(2) { transform: rotate(-5deg) translateY(2px); }
.hand-fan .pcard:nth-child(3) { transform: rotate(0deg); }
.hand-fan .pcard:nth-child(4) { transform: rotate(5deg) translateY(2px); }
.hand-fan .pcard:nth-child(5) { transform: rotate(10deg) translateY(6px); }
/* 6–8 card hands (can happen mid-round after draws) */
.hand-fan .pcard:nth-child(6) { transform: rotate(15deg) translateY(14px); }
.hand-fan .pcard:nth-child(7) { transform: rotate(20deg) translateY(22px); }
.hand-fan .pcard:nth-child(8) { transform: rotate(25deg) translateY(32px); }

.hand-fan .pcard:hover { transform: translateY(-16px) rotate(0deg) !important; z-index: 5; }
.hand-fan .pcard.selected { transform: translateY(-28px) rotate(0deg) !important; z-index: 10; }

/* ═══ OVERLAY ═══ */
.overlay {
  position: fixed; inset: 0;
  background: radial-gradient(ellipse at center, rgba(7,48,74,.85), rgba(0,0,0,.95));
  display: none;
  align-items: center; justify-content: center;
  z-index: 200;
  backdrop-filter: blur(10px);
}
.overlay.show { display: flex; }
.overlay-box {
  text-align: center;
  animation: bigPop .55s var(--ease);
  position: relative;
}
@keyframes bigPop {
  from { opacity: 0; transform: scale(.5) rotate(-8deg); }
  to { opacity: 1; transform: scale(1) rotate(0); }
}
.overlay-tag {
  display: inline-block;
  font-size: 0.8rem;
  letter-spacing: 0.4rem;
  text-transform: uppercase;
  color: rgba(255,255,255,.7);
  margin-bottom: 0.5rem;
  padding: 0.3rem 1rem;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 100px;
  font-weight: 600;
}
.overlay-title {
  font-family: 'Rubik', sans-serif;
  font-size: clamp(5rem, 18vw, 10rem);
  font-weight: 900;
  line-height: 0.9;
  letter-spacing: -4px;
  margin: 1rem 0;
}
.overlay-title.yaniv {
  background: linear-gradient(135deg, var(--sun) 0%, var(--peach) 40%, var(--coral) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 100px rgba(255,107,91,.6);
}
.overlay-title.asaf {
  background: linear-gradient(135deg, #ff4b5e, #ff1744);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 100px rgba(255,23,68,.6);
}
.overlay-desc {
  font-weight: 500;
  font-size: clamp(1rem, 2.5vw, 1.3rem);
  color: rgba(255,255,255,.9);
  margin-top: 0.3rem;
}
.overlay-hint {
  font-size: 0.75rem;
  letter-spacing: 0.25rem;
  text-transform: uppercase;
  color: rgba(255,255,255,.4);
  margin-top: 1.5rem;
  cursor: pointer;
}

/* Revealed hands displayed inside the round-end overlay */
.overlay-hands {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  justify-content: center;
  margin-top: 1.2rem;
  max-width: min(90vw, 560px);
}
.ov-hand-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
}
.ov-hand-name {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08rem;
  color: rgba(255,255,255,.75);
  text-align: center;
}
.ov-hand-fan {
  display: flex;
  gap: 2px;
}
.ov-hand-fan .pcard {
  width: 38px;
  height: 54px;
  padding: 3px 4px;
  border-radius: 6px;
  cursor: default;
  flex-shrink: 0;
}
.ov-hand-fan .pcard .pc-center { font-size: 0.9rem; }
.ov-hand-fan .pcard .pc-rank  { font-size: 0.7rem; }
.ov-hand-fan .pcard .pc-suit  { font-size: 0.6rem; }
.ov-hand-fan .pcard .pc-bot-corner .pc-rank { font-size: 0.6rem; }
.ov-hand-fan .pcard .pc-bot-corner .pc-suit { font-size: 0.55rem; }

/* RESPONSIVE */
@media (max-width: 700px) {
  .table-wrap { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .score-col {
    flex-direction: row;
    overflow-x: auto; overflow-y: hidden;
    padding: 0.55rem 0.75rem;
    border-left: none;
    border-bottom: 1px solid rgba(255,255,255,.1);
    gap: 0.55rem;
    height: auto;
  }
  .score-hdr { display: none; }
  .pc { min-width: 130px; flex-shrink: 0; }
  .top-round { display: none; }
}
@media (max-width: 420px) {
  .opp-row { gap: 1rem; }
  .center-scene { gap: 1rem; }
}

/* Toast notification */
.toast {
  position: fixed;
  top: 1.5rem;
  left: 50%;
  transform: translate(-50%, -200%);
  background: rgba(255,75,94,.95);
  color: #fff;
  padding: 0.75rem 1.4rem;
  border-radius: 100px;
  font-family: 'Rubik', sans-serif;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0,0,0,.4);
  z-index: 300;
  transition: transform .4s cubic-bezier(.22,.61,.36,1);
}
.toast.show { transform: translate(-50%, 0); }

.share-hint {
  text-align: center;
  font-size: 0.72rem;
  color: rgba(255,255,255,.28);
  letter-spacing: 0.06rem;
  margin: 0.2rem 0 0.9rem;
}

/* ── Animations & Sound-paired Effects ── */

/* body pseudo-elements used as full-screen overlay layers during gameplay (pointer-events: none) */
body.in-game::before,
body.in-game::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9998;
}

/* Turn flash (::before) — gold border pulse when it becomes your turn */
@keyframes screen-turn-flash {
  0%   { box-shadow: inset 0 0 0 0 transparent; }
  25%  { box-shadow: inset 0 0 0 5px rgba(255,209,102,.85), inset 0 0 60px rgba(255,209,102,.18); }
  100% { box-shadow: inset 0 0 0 0 transparent; }
}
body.in-game.my-turn-flash::before { animation: screen-turn-flash 0.65s var(--ease) forwards; }

/* Danger pulse (::after) — red border throb when ≤ 5 s remain */
@keyframes screen-danger-pulse {
  0%, 100% { box-shadow: inset 0 0 0 0 transparent; }
  50%       { box-shadow: inset 0 0 0 5px rgba(255,107,91,.8), inset 0 0 40px rgba(255,107,91,.2); }
}
body.in-game.danger-pulse::after { animation: screen-danger-pulse 0.9s ease-in-out infinite; }

/* Opponent seat glow when they play */
@keyframes opp-glow {
  0%, 100% { box-shadow: none; outline: none; }
  35%      { box-shadow: 0 0 0 3px var(--sun), 0 0 18px rgba(255,209,102,.55); }
}
.opp.opp-played { animation: opp-glow 0.6s var(--ease) forwards; }

/* Discard pile impact when any card lands */
@keyframes pile-impact {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.09); filter: brightness(1.18); }
  100% { transform: scale(1);  filter: brightness(1); }
}
.discard-top.pile-impact { animation: pile-impact 0.22s cubic-bezier(.2,1.4,.4,1) forwards; }

/* Fresh drawn card glow in hand */
@keyframes card-fresh-glow {
  0%   { box-shadow: 0 0 0 3px var(--sun), 0 0 20px rgba(255,209,102,.7); }
  100% { box-shadow: 0 4px 0 rgba(0,0,0,.08), 0 8px 24px rgba(0,0,0,.35); }
}
.pcard.card-fresh { animation: card-fresh-glow 0.55s var(--ease) forwards; transition: none; }

/* Score element bump when value increases */
@keyframes score-bump {
  0%   { transform: scale(1);    color: inherit; }
  40%  { transform: scale(1.22); color: var(--sun); }
  100% { transform: scale(1);    color: inherit; }
}
.p-score.score-bump { animation: score-bump 0.35s var(--ease) forwards; }

/* Confetti pieces */
.confetti-piece {
  position: fixed;
  top: -16px;
  pointer-events: none;
  z-index: 9997;
  border-radius: 2px;
  will-change: transform, opacity;
}
@keyframes confetti-fall {
  0%   { transform: translateY(0)      translateX(0)              rotate(0deg);            opacity: 1; }
  85%  { opacity: 1; }
  100% { transform: translateY(110vh)  translateX(var(--drift,0px)) rotate(var(--spin,360deg)); opacity: 0; }
}

.flying-card {
  position: fixed;
  width: 40px;
  height: 56px;
  z-index: 1000;
  pointer-events: none;
  transition: transform 0.42s cubic-bezier(.4,0,.2,1), opacity 0.42s ease-in;
  will-change: transform, opacity;
}

/* ═══ STREAK BADGE ═══ */
.streak-badge {
  display: inline-flex; align-items: center; gap: 1px;
  font-size: 0.68rem; font-weight: 700;
  color: #ff8c00; letter-spacing: 0;
}

/* ═══ LEADERBOARD ═══ */
.leaderboard-list { display: flex; flex-direction: column; gap: 0; }
.lb-row {
  display: grid;
  grid-template-columns: 1.4rem 2rem 1fr auto;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.3rem;
  border-bottom: 1px solid rgba(255,255,255,.07);
  font-size: 0.82rem;
}
.lb-row:last-child { border-bottom: none; }
.lb-row.me { background: rgba(255,209,102,.08); border-radius: 8px; }
.lb-rank { font-size: 0.75rem; color: rgba(255,255,255,.45); font-weight: 700; text-align: center; }
.lb-rank.top { color: var(--sun); font-size: 0.9rem; }
.lb-ava {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--coral), var(--peach));
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 0.78rem; flex-shrink: 0;
}
.lb-info { min-width: 0; }
.lb-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #fff; }
.lb-sub { font-size: 0.7rem; color: rgba(255,255,255,.5); margin-top: 1px; }
.lb-xp { text-align: left; font-weight: 700; font-size: 0.78rem; color: var(--turquoise); white-space: nowrap; }

/* ═══ MODAL OVERLAY (level road, history) ═══ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 600;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.modal-card {
  background: linear-gradient(160deg, #1a2a3a, #0d1a28);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 20px;
  width: min(420px, 96vw);
  max-height: 80vh;
  display: flex; flex-direction: column;
  box-shadow: 0 24px 60px rgba(0,0,0,.6);
  overflow: hidden;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.1rem 1.4rem 0.8rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}
.modal-title { font-weight: 800; font-size: 1.05rem; color: var(--sun); }
.modal-close {
  background: none; border: none; color: rgba(255,255,255,.5);
  font-size: 1rem; cursor: pointer; padding: 0.2rem 0.5rem;
  border-radius: 6px; transition: background .15s;
}
.modal-close:hover { background: rgba(255,255,255,.1); color: #fff; }

/* ═══ LEVEL ROAD ═══ */
.level-road-body {
  overflow-y: auto; padding: 1rem 1.2rem;
  display: flex; flex-direction: column; gap: 0.3rem;
}
.lr-row {
  display: grid;
  grid-template-columns: 2.4rem 1fr auto;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0.8rem;
  border-radius: 10px;
  transition: background .15s;
}
.lr-row.current {
  background: linear-gradient(135deg, rgba(255,209,102,.18), rgba(6,214,160,.12));
  border: 1px solid rgba(255,209,102,.3);
}
.lr-row.done { opacity: 0.55; }
.lr-row.future { opacity: 0.75; }
.lr-badge {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 0.85rem;
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.6);
  flex-shrink: 0;
}
.lr-row.current .lr-badge { background: linear-gradient(135deg, var(--sun), var(--coral)); color: #1a0a00; }
.lr-row.done .lr-badge { background: rgba(6,214,160,.25); color: var(--turquoise); }
.lr-info {}
.lr-level { font-weight: 700; font-size: 0.88rem; }
.lr-title { font-size: 0.72rem; color: rgba(255,255,255,.5); margin-top: 1px; }
.lr-xp { font-size: 0.72rem; color: rgba(255,255,255,.4); text-align: left; white-space: nowrap; }
.lr-row.current .lr-xp { color: var(--sun); }
.lr-progress {
  grid-column: 1 / -1;
  height: 3px; border-radius: 3px;
  background: rgba(255,255,255,.1);
  overflow: hidden;
  margin-top: 0.2rem;
}
.lr-progress-fill {
  height: 100%; border-radius: 3px;
  background: linear-gradient(90deg, var(--turquoise), var(--sun));
}

/* ═══ MATCH HISTORY ═══ */
.history-body { overflow-y: auto; padding: 0.8rem 1.2rem; display: flex; flex-direction: column; gap: 0.4rem; }
.hist-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.8rem;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.06);
}
.hist-result {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 0.9rem; flex-shrink: 0;
}
.hist-result.win  { background: rgba(6,214,160,.2); color: var(--turquoise); }
.hist-result.loss { background: rgba(255,107,91,.15); color: var(--coral); }
.hist-info { min-width: 0; }
.hist-date { font-size: 0.7rem; color: rgba(255,255,255,.45); }
.hist-score { font-weight: 700; font-size: 0.85rem; margin-top: 1px; }
.hist-meta { font-size: 0.7rem; color: rgba(255,255,255,.4); }
.hist-right { text-align: left; }
.hist-yaniv { font-size: 0.72rem; color: rgba(255,255,255,.5); }
.hist-empty { text-align: center; color: rgba(255,255,255,.35); padding: 2rem; font-size: 0.88rem; }

/* ═══ STICKER TRAY ═══ */
.act-row {
  display: flex; align-items: center; gap: 0.7rem;
  position: relative;
}
.sticker-wrap { position: relative; }

.act-sticker {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: var(--radius-sm);
  font-size: 1.4rem;
  padding: 0.6rem 0.75rem;
  cursor: pointer;
  transition: background .15s, transform .15s;
  line-height: 1;
}
.act-sticker:hover { background: rgba(255,255,255,.22); transform: scale(1.08); }

.sticker-tray {
  position: absolute;
  bottom: calc(100% + 10px);
  right: 0;
  background: rgba(8,16,28,.96);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 14px;
  padding: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 210px;
  min-width: 120px;
  z-index: 60;
  box-shadow: 0 12px 40px rgba(0,0,0,.6);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.sticker-btn-item {
  font-size: 1.7rem;
  cursor: pointer;
  padding: 5px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: none;
  line-height: 1;
  transition: background .1s, transform .12s, border-color .1s;
}
.sticker-btn-item:hover {
  background: rgba(255,255,255,.1);
  border-color: rgba(255,255,255,.18);
  transform: scale(1.22);
}

.sticker-tray-empty {
  font-size: 0.75rem;
  color: rgba(255,255,255,.4);
  padding: 4px 6px;
  white-space: nowrap;
}

/* ═══ STICKER BUBBLE ═══ */
@keyframes sticker-float {
  0%   { transform: translate(-50%,-50%) scale(0.3); opacity: 0; }
  15%  { transform: translate(-50%,-70%) scale(1.15); opacity: 1; }
  25%  { transform: translate(-50%,-75%) scale(1.0); }
  75%  { transform: translate(-50%,-75%) scale(1.0); opacity: 1; }
  100% { transform: translate(-50%,-95%) scale(0.9); opacity: 0; }
}

.sticker-bubble {
  position: fixed;
  pointer-events: none;
  z-index: 9990;
  text-align: center;
  animation: sticker-float 3s cubic-bezier(.4,0,.2,1) forwards;
}
.sticker-bubble-content {
  font-size: 2.8rem;
  line-height: 1;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,.5));
}
.sticker-bubble-name {
  font-size: 0.7rem;
  font-weight: 700;
  color: rgba(255,255,255,.75);
  margin-top: 3px;
  text-shadow: 0 1px 4px rgba(0,0,0,.8);
  font-family: 'Rubik', sans-serif;
}

/* ═══ SHOP STICKER GRID ═══ */
.shop-grid-stickers { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); }

.shop-preview-sticker {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  line-height: 1;
  background: rgba(255,255,255,.06) !important;
  border: 1px solid rgba(255,255,255,.1) !important;
  min-height: 60px;
}
.shop-preview-sticker::before { content: none; }
.shop-preview-sticker::after  { content: none; }
