/* =====================================================================
   İHALELİ BATAK — Eşli & Tekli · online web client styles.
   Felt-table look ported 1:1 from the validated prototype
   (birkartoyunu-ios/prototypes/batak/play/index.html), extended with a
   cak-style screen router (home / name / lobby / game) + connection banner.
   Render-from-server-state: the client never decides legality.
   ===================================================================== */

/* ---------- DESIGN TOKENS ---------- */
:root {
  --felt-900: #07241d;
  --felt-800: #0c3329;
  --felt-700: #115040;
  --felt-rim: #0a1f1a;
  --rail-hi:  #2c3a3a;
  --rail-lo:  #16201f;
  --rail-line: rgba(255,255,255,0.10);
  --card-face: #f7f9f6;
  --card-edge: #d7ded6;
  --card-back-a: #114b3c;
  --card-back-b: #0a3329;
  --suit-spade:   #18242b;
  --suit-club:    #18242b;
  --suit-heart:   #c8324a;
  --suit-diamond: #c8324a;
  --gold:      #e9b949;
  --gold-soft: rgba(233,185,73,0.16);
  --gold-line: rgba(233,185,73,0.55);
  --text:      #f3f8f4;
  --text-soft: rgba(226,238,231,0.70);
  --text-dim:  rgba(206,224,215,0.45);
  --r-lg: 26px;
  --r-md: 18px;
  --r-sm: 11px;
  --r-pill: 999px;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI",
          system-ui, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  font-family: var(--sans);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body {
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(233,185,73,0.06), transparent 50%),
    linear-gradient(180deg, #0a1714, #060f0d 60%, #050b09);
  background-attachment: fixed;
  padding: 16px 14px 28px;
  overflow-x: hidden;
}

#app { max-width: 1100px; margin: 0 auto; }

.page-head { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom: 14px; }
.brand { display:flex; flex-direction:column; gap:2px; text-decoration:none; color:inherit; border-radius: 10px; transition: opacity .15s; }
a.brand:hover { opacity: 0.85; }
a.brand:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }
.eyebrow { font-size: 10px; letter-spacing: 0.34em; text-transform: uppercase; color: var(--gold); font-weight: 600; margin: 0; }
.page-title { font-size: clamp(20px, 4vw, 30px); font-weight: 300; letter-spacing: -0.02em; margin: 0; line-height: 1.02; }
.page-title b { font-weight: 600; }
.head-actions { display:flex; gap:8px; }
.ghost-btn {
  height: 38px; padding: 0 14px; border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.05);
  color: var(--text); font-size: 13px; font-weight: 600; letter-spacing:0.02em;
  cursor: pointer; display:flex; align-items:center; gap:6px;
}
.ghost-btn:hover { background: rgba(255,255,255,0.10); }
.ghost-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.section-tag { font-size: 11px; letter-spacing: 0.30em; text-transform: uppercase; color: var(--text-dim); font-weight: 600; margin: 14px 4px 8px; display:block; }

/* ---------- SCREEN ROUTER ---------- */
.screen { display: none; }
.screen.show { display: block; }
.screen.home, .screen.name, .screen.lobby, .screen.browse, .screen.recent { min-height: 60vh; display: none; }
.screen.home.show, .screen.name.show, .screen.lobby.show, .screen.browse.show, .screen.recent.show { display: flex; flex-direction: column; align-items: center; justify-content: center; }

/* ---------- HOME / NAME / LOBBY CARD ---------- */
.home-card {
  width: 100%; max-width: 420px; margin: 8px auto;
  border-radius: var(--r-lg); padding: 26px 22px;
  background: linear-gradient(160deg, #14322a, #0b211b);
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 40px 90px -30px rgba(0,0,0,0.9), inset 0 1px 0 rgba(255,255,255,0.12);
  display: flex; flex-direction: column; gap: 12px;
}
.home-card.wide { max-width: 480px; }

/* Back-to-hub affordance (cross-origin link to the birkartoyunu.com hub). */
.hub-back {
  align-self: flex-start;
  display: inline-flex; align-items: center; gap: 5px;
  text-decoration: none; cursor: pointer;
  font-size: 13px; font-weight: 600; letter-spacing: 0.02em;
  color: var(--text-soft);
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--r-pill); padding: 6px 14px; margin: 0 0 4px;
  transition: background .15s, color .15s, transform .08s;
}
.hub-back:hover { background: rgba(255,255,255,0.10); color: var(--text); }
.hub-back:active { transform: translateY(1px); }
.hub-back:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.home-tag { margin: 0 0 6px; font-size: 14px; color: var(--text-soft); line-height: 1.55; text-align: center; }
.home-tag b { color: var(--text); }

.btn {
  height: 50px; border-radius: 14px; font-size: 15px; font-weight: 600; letter-spacing: 0.02em;
  display: flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
  border: 1px solid transparent; width: 100%;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.btn-pass { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.16); color: var(--text-soft); }
.btn-pass:hover:not(:disabled) { background: rgba(255,255,255,0.09); color: var(--text); }
.btn-confirm { background: linear-gradient(160deg, #f3c662, var(--gold)); color: #2a1e05; border-color: rgba(255,255,255,0.3); box-shadow: inset 0 1px 0 rgba(255,255,255,0.5), 0 12px 26px -12px rgba(233,185,73,0.6); }
.btn-confirm:hover:not(:disabled) { filter: brightness(1.04); }
.btn-danger { background: linear-gradient(160deg, #d6435b, var(--suit-heart)); color: #fff; border-color: rgba(255,255,255,0.22); box-shadow: inset 0 1px 0 rgba(255,255,255,0.25), 0 12px 26px -12px rgba(200,50,74,0.6); }
.btn-danger:hover:not(:disabled) { filter: brightness(1.06); }
.btn-danger:focus-visible { outline: 2px solid var(--suit-heart); outline-offset: 2px; }
.btn.ghost-line { height: 46px; background: transparent; border-color: rgba(255,255,255,0.14); color: var(--text-soft); }
.btn.ghost-line:hover { background: rgba(255,255,255,0.06); color: var(--text); }
.home-btn { margin: 0; }

.orline { display:flex; align-items:center; gap:10px; color: var(--text-dim); font-size: 12px; margin: 4px 0; }
.orline::before, .orline::after { content:""; flex:1; height:1px; background: rgba(255,255,255,0.10); }

.field-label { font-size: 12px; color: var(--text-soft); font-weight: 600; letter-spacing: 0.04em; }
.join-row { display:flex; gap: 8px; }
.code-input {
  flex: 1; height: 50px; border-radius: 14px; padding: 0 20px;
  background: linear-gradient(160deg, rgba(6,18,15,0.78), rgba(4,12,10,0.62));
  border: 1px solid rgba(255,255,255,0.18);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), inset 0 2px 8px rgba(0,0,0,0.45);
  color: var(--text); font-size: 18px; font-weight: 600; letter-spacing: 0.18em;
  line-height: 50px; text-align: center; text-transform: uppercase;
  text-indent: 0.18em; /* offset trailing letter-spacing so glyphs read centered */
  -webkit-appearance: none; appearance: none;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.code-input:hover { border-color: rgba(255,255,255,0.26); }
.code-input.name-input {
  letter-spacing: 0.01em; text-transform: none; text-align: left;
  font-size: 17px; padding: 0 18px; text-indent: 0;
}
.code-input::placeholder { color: var(--text-dim); font-weight: 500; opacity: 1; }
.code-input::selection { background: var(--gold-soft); color: var(--text); }
.code-input:focus-visible,
.code-input:focus {
  outline: none;
  border-color: var(--gold-line);
  box-shadow:
    0 0 0 2px var(--gold-soft),
    inset 0 1px 0 rgba(255,255,255,0.08),
    0 8px 22px -14px rgba(233,185,73,0.6);
  background: linear-gradient(160deg, rgba(10,26,21,0.85), rgba(6,16,13,0.7));
}
.join-btn { width: auto; padding: 0 22px; }

.home-err { color: #ef8aa0; font-size: 13px; font-weight: 600; margin: 4px 0 0; min-height: 16px; text-align: center; }

/* ---------- LOBBY ---------- */
.lobby-head { text-align: center; }
.invite-box { text-align: center; padding: 12px 0; border-radius: var(--r-md); background: rgba(6,18,15,0.45); border: 1px solid rgba(255,255,255,0.08); display: flex; flex-direction: column; gap: 8px; padding: 16px; }
.invite-label { font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--text-soft); font-weight: 600; }
.code-big { font-size: 34px; font-weight: 700; letter-spacing: 0.22em; color: var(--gold); font-variant-numeric: tabular-nums; }
.copy-btn { height: 44px; }
.invite-hint { font-size: 12px; color: var(--text-dim); line-height: 1.5; margin: 2px 0 0; }
.players-label { font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-soft); font-weight: 700; margin: 6px 0 2px; }
.seat-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.seat-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r-md); background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08); }
.seat-row.me { border-color: var(--gold-line); background: var(--gold-soft); }
.seat-row.empty { opacity: 0.55; border-style: dashed; }
.seat-row .pAvatar { width: 36px; height: 36px; flex: 0 0 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 14px; background: linear-gradient(150deg, #1d6b53, #0e4234); border: 1px solid rgba(255,255,255,0.18); }
.seat-row.them .pAvatar { background: linear-gradient(150deg, #4a3f57, #261f31); }
.seat-row .pName { flex: 1; font-size: 14px; font-weight: 600; }
.seat-row .badge { font-size: 9px; letter-spacing: 0.12em; font-weight: 700; text-transform: uppercase; padding: 2px 7px; border-radius: var(--r-pill); background: rgba(255,255,255,0.10); border: 1px solid rgba(255,255,255,0.18); color: var(--text-soft); }
.seat-row .badge.host { background: var(--gold-soft); border-color: var(--gold-line); color: var(--gold); }
.start-btn { margin-top: 6px; }
.wait-hint { font-size: 12px; color: var(--text-dim); text-align: center; margin: 2px 0; }

/* ---------- HUD ---------- */
.hud { display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch; margin-bottom: 12px; }
.hud-card {
  display: flex; align-items: center; gap: 10px; padding: 9px 13px; border-radius: var(--r-md);
  background: linear-gradient(160deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
  border: 1px solid rgba(255,255,255,0.09);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12);
}
.hud-card .k { font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--text-soft); font-weight: 600; }
.score-card { gap: 12px; }
.score-side { display: flex; flex-direction: column; gap: 1px; align-items: center; }
.score-side .who { font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; font-weight: 700; }
.score-side.us .who   { color: var(--gold); }
.score-side.them .who { color: #cdb6e0; }
.score-side .num { font-size: 24px; font-weight: 500; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--text); line-height: 1; }
.score-div { font-size: 15px; color: var(--text-dim); font-weight: 300; align-self: center; }
.koz-card { border-color: var(--gold-line); background: linear-gradient(160deg, rgba(233,185,73,0.18), rgba(233,185,73,0.04)); box-shadow: inset 0 1px 0 rgba(255,255,255,0.18), 0 0 18px -8px rgba(233,185,73,0.5); }
.koz-card.empty { border-color: rgba(255,255,255,0.09); background: linear-gradient(160deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02)); box-shadow: inset 0 1px 0 rgba(255,255,255,0.12); }
.koz-card .k { color: var(--gold); }
.koz-card.empty .k { color: var(--text-soft); }
.koz-suit {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 26px; height: 32px; padding: 0 5px;
  font-size: 20px; line-height: 1; font-weight: 700;
  border-radius: 6px;
  background: linear-gradient(160deg, #fdfbf4, #ece4cf);
  border: 1px solid rgba(0,0,0,0.18);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.9), 0 1px 3px rgba(0,0,0,0.45);
}
.koz-card.empty .koz-suit {
  background: none; border: none; box-shadow: none;
  min-width: 0; height: auto; padding: 0; font-size: 23px; color: var(--text-dim);
}
.koz-val { display: flex; flex-direction: column; gap: 1px; }
.koz-val .name { font-size: 13px; font-weight: 700; color: var(--gold); }
.round-card .v { font-size: 14px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.hud-spacer { flex: 1 1 0; min-width: 0; }
.game-leave { width: 38px; padding: 0; font-size: 18px; flex: 0 0 38px; justify-content: center; }
.suit-spade { color: var(--suit-spade); } .suit-club { color: var(--suit-club); }
.suit-heart { color: var(--suit-heart); } .suit-diamond { color: var(--suit-diamond); }
.koz-suit.s-spade   { color: var(--suit-spade); }
.koz-suit.s-club    { color: var(--suit-club); }
.koz-suit.s-heart   { color: var(--suit-heart); }
.koz-suit.s-diamond { color: var(--suit-diamond); }

.layout { display: grid; grid-template-columns: 1fr 300px; gap: 16px; align-items: start; }
@media (max-width: 860px) { .layout { grid-template-columns: 1fr; } }

/* ---------- TABLE ---------- */
.table-rail {
  border-radius: var(--r-lg); padding: 12px;
  background: linear-gradient(160deg, var(--rail-hi), var(--rail-lo));
  border: 1px solid var(--rail-line);
  box-shadow: 0 40px 90px -34px rgba(0,0,0,0.85), inset 0 1px 0 rgba(255,255,255,0.14), inset 0 -2px 6px rgba(0,0,0,0.5);
}
.felt {
  position: relative; border-radius: 16px;
  background:
    radial-gradient(80% 62% at 50% 42%, var(--felt-700), transparent 70%),
    radial-gradient(120% 100% at 50% 50%, var(--felt-800), var(--felt-900) 92%);
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.45), inset 0 0 0 1px var(--felt-rim), inset 0 0 60px rgba(0,0,0,0.35);
  overflow: hidden; padding: 16px; min-height: 520px;
  display: grid;
  grid-template-columns: minmax(56px, 0.7fr) minmax(0, 2fr) minmax(56px, 0.7fr);
  grid-template-rows: auto minmax(150px, 1fr) auto;
  grid-template-areas: ".     partner  ." "left  trick    right" ".     me       .";
  gap: 8px; align-items: center; justify-items: center;
}
.felt::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    repeating-linear-gradient(45deg, rgba(255,255,255,0.015) 0 2px, transparent 2px 4px),
    repeating-linear-gradient(-45deg, rgba(0,0,0,0.05) 0 2px, transparent 2px 4px);
  pointer-events: none;
}
.felt::after {
  content: ""; position: absolute; top: 50%; left: 50%;
  width: min(46%, 320px); aspect-ratio: 1.45 / 1; transform: translate(-50%, -50%);
  border: 1px dashed rgba(233,185,73,0.18); border-radius: 50%; pointer-events: none;
}

.seat {
  position: relative; z-index: 2; display: flex; align-items: center; gap: 9px;
  padding: 7px 11px; border-radius: var(--r-pill);
  background: rgba(6,18,15,0.55); border: 1px solid rgba(255,255,255,0.07);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  box-shadow: 0 8px 22px -12px rgba(0,0,0,0.7); max-width: 100%;
  transition: box-shadow .2s ease, border-color .2s ease, background .2s ease;
}
.seat.partner { grid-area: partner; }
.seat.left    { grid-area: left;  flex-direction: column; gap: 6px; padding: 10px 8px; text-align: center; }
.seat.right   { grid-area: right; flex-direction: column; gap: 6px; padding: 10px 8px; text-align: center; }
.seat.me      { grid-area: me; }
.seat.active {
  border-color: var(--gold-line); background: rgba(28,40,30,0.7);
  box-shadow: 0 0 0 1px var(--gold-line), 0 0 26px -6px rgba(233,185,73,0.55), 0 10px 26px -12px rgba(0,0,0,0.7);
}
.seat.active.pulse { animation: seatPulse 1.4s ease-in-out infinite; }
@keyframes seatPulse {
  0%,100% { box-shadow: 0 0 0 1px var(--gold-line), 0 0 20px -8px rgba(233,185,73,0.45), 0 10px 26px -12px rgba(0,0,0,0.7); }
  50%     { box-shadow: 0 0 0 1px var(--gold-line), 0 0 30px -4px rgba(233,185,73,0.75), 0 10px 26px -12px rgba(0,0,0,0.7); }
}
.seat.gone { opacity: 0.5; }
.seat.dealer-mark::before {
  content: "D"; position:absolute; top:-6px; right:-4px;
  width:18px; height:18px; border-radius:50%;
  background: var(--gold); color:#2a1e05; font-size:10px; font-weight:800;
  display:flex; align-items:center; justify-content:center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}
.avatar {
  width: 38px; height: 38px; flex: 0 0 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 14px; color: var(--text);
  background: linear-gradient(150deg, #1d6b53, #0e4234);
  border: 1px solid rgba(255,255,255,0.18); box-shadow: inset 0 1px 0 rgba(255,255,255,0.25);
}
.seat.left .avatar, .seat.right .avatar { background: linear-gradient(150deg, #4a3f57, #261f31); }
.seat.active .avatar { border-color: var(--gold-line); box-shadow: inset 0 1px 0 rgba(255,255,255,0.3), 0 0 14px -2px rgba(233,185,73,0.6); }
.seat-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.seat.left .seat-meta, .seat.right .seat-meta { align-items: center; }
.seat-name { font-size: 13px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.seat-sub { font-size: 10px; letter-spacing: 0.10em; text-transform: uppercase; color: var(--text-soft); font-weight: 600; font-variant-numeric: tabular-nums; }
.seat-sub b { color: var(--text); font-weight: 700; }
.bot-badge { font-size: 9px; letter-spacing: 0.14em; font-weight: 700; text-transform: uppercase; padding: 2px 6px; border-radius: var(--r-pill); background: rgba(255,255,255,0.10); border: 1px solid rgba(255,255,255,0.18); color: var(--text-soft); }
.turn-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 8px var(--gold); }
.team-tag { font-size: 9px; letter-spacing: 0.12em; font-weight: 700; text-transform: uppercase; padding: 2px 6px; border-radius: var(--r-pill); }
.team-tag.us  { background: var(--gold-soft); color: var(--gold); border: 1px solid var(--gold-line); }
.team-tag.them{ background: rgba(180,140,200,0.14); color: #cdb6e0; border: 1px solid rgba(180,140,200,0.35); }

/* ---------- TRICK AREA ---------- */
.trick {
  grid-area: trick; position: relative; z-index: 2; width: 100%; max-width: 300px;
  aspect-ratio: 1.2 / 1; display: grid; place-items: center;
  grid-template-columns: 1fr 1fr 1fr; grid-template-rows: 1fr 1fr 1fr;
  grid-template-areas: ".      t-top    ." "t-left .        t-right" ".      t-bottom .";
}
.play { position: relative; }
.play.top    { grid-area: t-top; }
.play.bottom { grid-area: t-bottom; }
.play.left   { grid-area: t-left; }
.play.right  { grid-area: t-right; }

/* ---------- CARD ---------- */
.card {
  --w: 52px; width: var(--w); height: calc(var(--w) * 1.5); border-radius: 8px;
  background: linear-gradient(170deg, var(--card-face), #eef2ec);
  border: 1px solid var(--card-edge);
  box-shadow: 0 6px 16px -6px rgba(0,0,0,0.65), inset 0 1px 0 rgba(255,255,255,0.9);
  position: relative; color: var(--suit-spade); flex: 0 0 auto;
}
.card .idx { position: absolute; top: 4px; left: 5px; display: flex; flex-direction: column; align-items: center; line-height: 0.92; font-weight: 700; font-variant-numeric: tabular-nums; }
.card .idx .rank { font-size: calc(var(--w) * 0.30); letter-spacing: -0.02em; }
.card .idx .pip  { font-size: calc(var(--w) * 0.26); }
.card .center { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: calc(var(--w) * 0.62); line-height: 1; }
.card .idx.br { top: auto; left: auto; bottom: 4px; right: 5px; transform: rotate(180deg); }
.card.s-spade   { color: var(--suit-spade); }
.card.s-club    { color: var(--suit-club); }
.card.s-heart   { color: var(--suit-heart); }
.card.s-diamond { color: var(--suit-diamond); }
.card.koz-card-mark::before {
  content: "★"; position:absolute; top:2px; right:4px; font-size: calc(var(--w)*0.22); color: var(--gold); opacity:0.85;
}

/* ---------- PARTNER OPEN-HAND FAN (Eşli only — top "Eşin" seat) ----------
   A small, READ-ONLY face-up fan of the partner's cards. Sits below the
   partner seat meta. Not interactive (rendered with aria-hidden + no handlers).
   Compact mini cards so it never crowds the trick area. */
.seat.partner.has-partner-fan { flex-direction: column; gap: 6px; align-items: center; }
.partner-fan {
  display: flex; justify-content: center; align-items: flex-end;
  padding-top: 2px; pointer-events: none; user-select: none;
}
.card.mini {
  --w: 30px; border-radius: 6px;
  box-shadow: 0 4px 10px -5px rgba(0,0,0,0.7), inset 0 1px 0 rgba(255,255,255,0.85);
  margin-left: -14px; transform-origin: bottom center;
}
.card.mini:first-child { margin-left: 0; }
.card.mini .idx { top: 2px; left: 3px; }
.card.mini .idx .rank { font-size: calc(var(--w) * 0.34); }
.card.mini .idx .pip  { font-size: calc(var(--w) * 0.30); }
.card.mini.koz-card-mark::before { top: 1px; right: 2px; font-size: calc(var(--w)*0.26); }
@media (max-width: 560px) {
  .card.mini { --w: 24px; margin-left: -12px; }
}

.play .card { box-shadow: 0 10px 24px -8px rgba(0,0,0,0.8), inset 0 1px 0 rgba(255,255,255,0.9); }
.play.top .card    { transform: rotate(-3deg); }
.play.bottom .card { transform: rotate(2deg); }
.play.left .card   { transform: rotate(4deg); }
.play.right .card  { transform: rotate(-4deg); }
.play .card.just-played { animation: dropIn .28s cubic-bezier(.2,.8,.2,1); }
@keyframes dropIn { from { opacity:0; transform: translateY(-18px) scale(.9); } to { opacity:1; } }
.play .card.winner-glow { box-shadow: 0 0 0 2px var(--gold-line), 0 0 22px -4px rgba(233,185,73,0.7), 0 10px 24px -8px rgba(0,0,0,0.8); }

/* Trick "toplama" sweep: cloned cards glide toward the winning seat, then
   fade/scale out as they "arrive". Rendered in a fixed overlay so the live
   #trick can be cleared/re-rendered from server state underneath without
   ghosts. GPU-friendly: transform + opacity only. */
.sweep-layer { position: fixed; inset: 0; z-index: 40; pointer-events: none; }
.sweep-card {
  position: fixed; margin: 0; will-change: transform, opacity;
  transition: transform .32s cubic-bezier(.4,.05,.25,1), opacity .32s ease-in;
}
.sweep-card.go { opacity: 0; }
/* Winner glow briefly intensifies as the sweep begins. */
.sweep-card.winner-glow {
  box-shadow: 0 0 0 2px var(--gold-line), 0 0 30px -2px rgba(233,185,73,0.95), 0 12px 26px -8px rgba(0,0,0,0.85);
}

/* ---------- YOUR HAND ---------- */
.hand-zone { margin-top: 12px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.hand { display: flex; justify-content: center; padding: 24px 8px 6px; min-height: 96px; flex-wrap: nowrap; }
.hand .card {
  --w: 60px; margin-left: -26px; transform-origin: bottom center;
  transition: transform .14s ease, box-shadow .14s ease, opacity .14s ease;
  cursor: pointer;
}
.hand .card:first-child { margin-left: 0; }
.hand .card.playable:hover, .hand .card.playable:focus-visible { transform: translateY(-16px) !important; z-index: 5; }
.hand .card.playable { box-shadow: 0 16px 30px -10px rgba(0,0,0,0.8), 0 0 0 1px var(--gold-line), inset 0 1px 0 rgba(255,255,255,0.9); }
.hand .card.illegal { opacity: 0.4; filter: saturate(0.5) brightness(0.85); cursor: not-allowed; }
.hand .card:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.hand .card.shake { animation: shake .32s ease; }
@keyframes shake { 0%,100%{transform:translateX(0);} 20%{transform:translateX(-5px);} 40%{transform:translateX(5px);} 60%{transform:translateX(-3px);} 80%{transform:translateX(3px);} }
.hand-hint { font-size: 11px; color: var(--text-dim); letter-spacing: 0.04em; margin: 0; text-align:center; min-height: 14px; }

/* ---------- İHALE PANEL ---------- */
.bid-panel {
  border-radius: var(--r-lg); padding: 20px 18px;
  background: linear-gradient(160deg, var(--rail-hi), var(--rail-lo));
  border: 1px solid var(--rail-line);
  box-shadow: 0 30px 70px -34px rgba(0,0,0,0.8), inset 0 1px 0 rgba(255,255,255,0.12);
  position: sticky; top: 12px;
}
.bid-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 4px; }
.bid-title { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; margin: 0; }
.bid-tag { font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--gold); font-weight: 700; }
.bid-tag.waiting { color: var(--text-dim); }
.bid-sub { margin: 0 0 16px; font-size: 12px; color: var(--text-soft); line-height: 1.5; }

.stepper { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px; border-radius: var(--r-md); background: rgba(6,18,15,0.5); border: 1px solid rgba(255,255,255,0.08); margin-bottom: 8px; }
.step-btn { width: 46px; height: 46px; flex: 0 0 46px; border-radius: 14px; border: 1px solid rgba(255,255,255,0.16); background: linear-gradient(160deg, rgba(255,255,255,0.10), rgba(255,255,255,0.03)); color: var(--text); font-size: 24px; font-weight: 400; line-height: 1; display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: inset 0 1px 0 rgba(255,255,255,0.2); }
.step-btn:hover:not(:disabled) { background: linear-gradient(160deg, rgba(255,255,255,0.16), rgba(255,255,255,0.05)); }
.step-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.step-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.step-val { text-align: center; }
.step-val .num { font-size: 40px; font-weight: 300; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1; color: var(--text); }
.step-val .lbl { font-size: 10px; letter-spacing: 0.20em; text-transform: uppercase; color: var(--text-soft); font-weight: 600; }
.bid-range { text-align: center; font-size: 11px; color: var(--text-dim); letter-spacing: 0.06em; margin: 0 0 14px; font-variant-numeric: tabular-nums; }
.bid-actions { display: flex; gap: 10px; }
.bid-actions .btn { flex: 1; }

/* koz picker */
.koz-pick { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-top:6px; }
.koz-opt { height:64px; border-radius:14px; border:1px solid rgba(255,255,255,0.16); background:rgba(6,18,15,0.5); cursor:pointer; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px; color: var(--text); }
.koz-opt:hover { background:rgba(255,255,255,0.08); }
.koz-opt:focus-visible { outline:2px solid var(--gold); outline-offset:2px; }
.koz-opt .gl { font-size:26px; line-height:1; }
.koz-opt .nm { font-size:11px; font-weight:600; color:var(--text-soft); letter-spacing:0.04em; }

.bid-log { margin-top: 16px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,0.08); display: flex; flex-direction: column; gap: 7px; max-height: 180px; overflow-y:auto; }
.bid-log:empty::after { content: "Henüz teklif yok."; color: var(--text-dim); font-size: 12px; }
.bid-row { display: flex; align-items: center; justify-content: space-between; font-size: 12px; }
.bid-row .nm { color: var(--text-soft); display: flex; align-items: center; gap: 6px; }
.bid-row .vl { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.bid-row .vl.pas { color: var(--text-dim); font-weight: 600; }
.bid-row .vl.lead { color: var(--gold); }

.panel-info { margin-top:16px; padding-top:14px; border-top:1px solid rgba(255,255,255,0.08); font-size:12px; color:var(--text-soft); line-height:1.55; }
.panel-info b { color: var(--text); }

/* ---------- OVERLAY / MODAL ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; display: none; align-items: center; justify-content: center; padding: 20px; background: rgba(4,11,9,0.78); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.overlay.show { display: flex; animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity:0; } }
.modal {
  width: 100%; max-width: 460px; max-height: 88vh; overflow-y: auto;
  border-radius: var(--r-lg); padding: 26px 24px;
  background: linear-gradient(160deg, #14322a, #0b211b);
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 40px 90px -30px rgba(0,0,0,0.9), inset 0 1px 0 rgba(255,255,255,0.12);
}
.modal h2 { margin: 0 0 4px; font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
.modal .modal-eyebrow { font-size:10px; letter-spacing:0.3em; text-transform:uppercase; color:var(--gold); font-weight:700; margin:0 0 8px; }
.modal p { font-size: 14px; color: var(--text-soft); line-height: 1.6; margin: 0 0 12px; }
.modal ul { margin: 0 0 14px; padding-left: 18px; }
.modal li { font-size: 13.5px; color: var(--text-soft); line-height: 1.6; margin-bottom: 7px; }
.modal li b { color: var(--text); }
.modal-actions { display:flex; gap:10px; margin-top: 18px; }
.modal-actions .btn { flex: 1; }
.result-table { width:100%; border-collapse:collapse; margin: 8px 0 14px; }
.result-table th, .result-table td { text-align:left; padding:8px 10px; font-size:13px; border-bottom:1px solid rgba(255,255,255,0.08); }
.result-table th { color: var(--text-dim); font-weight:600; font-size:11px; letter-spacing:0.1em; text-transform:uppercase; }
.result-table td { color: var(--text); font-variant-numeric: tabular-nums; }
.result-table .win-row td { color: var(--gold); font-weight: 700; }
.result-table .delta-pos { color: #7fdca4; font-weight:700; }
.result-table .delta-neg { color: #ef8aa0; font-weight:700; }
.result-badge { display:inline-block; padding:3px 10px; border-radius:var(--r-pill); font-size:11px; font-weight:700; letter-spacing:0.08em; text-transform:uppercase; }
.result-badge.win { background: var(--gold-soft); color: var(--gold); border:1px solid var(--gold-line); }
.result-badge.set { background: rgba(239,138,160,0.14); color:#ef8aa0; border:1px solid rgba(239,138,160,0.4); }
.big-result { font-size: 40px; font-weight: 300; text-align:center; margin: 6px 0 4px; letter-spacing:-0.02em; }
.big-result.us { color: var(--gold); }
.big-result.them { color: #cdb6e0; }

/* toast */
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(20px); z-index: 60; padding: 11px 18px; border-radius: var(--r-pill); background: rgba(10,24,20,0.92); border: 1px solid var(--gold-line); color: var(--text); font-size: 13px; font-weight: 600; box-shadow: 0 12px 30px -10px rgba(0,0,0,0.8); opacity: 0; pointer-events: none; transition: opacity .25s ease, transform .25s ease; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); max-width: 90vw; text-align:center; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast .koz-chip {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 22px; padding: 0 4px; margin: 0 2px;
  vertical-align: -5px; font-size: 15px; font-weight: 700; border-radius: 5px;
  background: linear-gradient(160deg, #fdfbf4, #ece4cf);
  border: 1px solid rgba(0,0,0,0.18);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.9), 0 1px 2px rgba(0,0,0,0.4);
}
.toast .koz-chip.s-spade   { color: var(--suit-spade); }
.toast .koz-chip.s-club    { color: var(--suit-club); }
.toast .koz-chip.s-heart   { color: var(--suit-heart); }
.toast .koz-chip.s-diamond { color: var(--suit-diamond); }
.toast .koz-name { color: var(--gold); font-weight: 700; }

/* connection banner */
.conn-banner {
  position: fixed; left: 50%; top: 14px; transform: translateX(-50%) translateY(-20px);
  z-index: 70; display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; border-radius: var(--r-pill);
  background: rgba(10,24,20,0.95); border: 1px solid var(--gold-line);
  color: var(--text); font-size: 13px; font-weight: 600;
  box-shadow: 0 12px 30px -10px rgba(0,0,0,0.8);
  opacity: 0; pointer-events: none; transition: opacity .25s ease, transform .25s ease;
  max-width: 92vw;
}
.conn-banner.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.conn-banner.ok { border-color: #7fdca4; }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.25); border-top-color: var(--gold); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.footer-mark { text-align: center; color: var(--text-dim); font-size: 11px; margin: 22px 0 0; letter-spacing: 0.04em; }
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }

/* ---------- VARIANT BADGE ---------- */
.variant-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; font-weight: 700;
  padding: 3px 9px; border-radius: var(--r-pill);
  background: var(--gold-soft); color: var(--gold); border: 1px solid var(--gold-line);
  vertical-align: middle;
}
.variant-badge.tekli { background: rgba(180,140,200,0.16); color: #cdb6e0; border-color: rgba(180,140,200,0.4); }
.variant-badge.format { background: rgba(120,180,230,0.15); color: #a9cdec; border-color: rgba(120,180,230,0.38); }
.lobby-head { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.table-tag { display: inline-flex; align-items: center; gap: 8px; }

/* ---------- BROWSE / RECENT ---------- */
.browse-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 2px; }
.refresh-btn { font-size: 18px; width: 38px; padding: 0; justify-content: center; flex: 0 0 38px; }
.refresh-btn.spinning { animation: spin .7s linear infinite; }
.data-list { list-style: none; margin: 6px 0 12px; padding: 0; display: flex; flex-direction: column; gap: 8px; max-height: 46vh; overflow-y: auto; }
.data-row {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 11px;
  padding: 11px 13px; border-radius: var(--r-md);
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08);
  animation: rowPop .22s ease;
}
@keyframes rowPop { from { opacity: 0; transform: translateY(6px); } }
.data-row .rAvatar {
  width: 38px; height: 38px; flex: 0 0 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
  background: linear-gradient(150deg, #1d6b53, #0e4234); border: 1px solid rgba(255,255,255,0.18);
}
.data-row .rMeta { min-width: 0; text-align: left; display: flex; flex-direction: column; gap: 3px; }
.data-row .rTitle { font-weight: 700; font-size: 15px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 7px; }
.data-row .rSub { font-size: 12px; font-weight: 600; color: var(--text-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.data-row .rSub .rCode { color: var(--gold); letter-spacing: 0.1em; font-variant-numeric: tabular-nums; }
.data-row .rJoin { width: auto; height: 40px; padding: 0 18px; justify-self: end; white-space: nowrap; }
.list-empty { font-size: 14px; font-weight: 600; color: var(--text-soft); text-align: center; margin: 14px 0 16px; line-height: 1.5; }

/* ---------- CREATE / BOT OPTIONS MODAL ---------- */
.opt-group { text-align: left; margin: 16px 0; }
.opt-label { font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-soft); font-weight: 700; margin-bottom: 8px; }
.opt-hint { font-size: 12px; font-weight: 500; color: var(--text-dim); margin: 8px 0 0; line-height: 1.5; }
.seg-row { display: flex; gap: 8px; }
.seg-row[hidden] { display: none; }
.val-row { margin-top: 8px; }
.val-row .seg { font-size: 15px; font-variant-numeric: tabular-nums; padding: 11px 6px; }
.seg {
  flex: 1 1 0; min-width: 64px; cursor: pointer;
  font-family: var(--sans); font-weight: 600; font-size: 14px; letter-spacing: 0.01em;
  padding: 13px 8px; border-radius: 14px; color: var(--text-soft);
  background: rgba(6,18,15,0.5); border: 1px solid rgba(255,255,255,0.14);
  transition: background .15s, color .15s, border-color .15s, box-shadow .15s;
}
.seg:hover:not(.active) { background: rgba(255,255,255,0.06); color: var(--text); }
.seg:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.seg.active {
  background: linear-gradient(160deg, #f3c662, var(--gold)); color: #2a1e05; border-color: rgba(255,255,255,0.3);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.5), 0 8px 20px -12px rgba(233,185,73,0.6);
}

/* ---------- TEKLI: four individual seat scores ---------- */
.seat-score-card { gap: 12px; }
.seat-scores { display: flex; gap: 14px; }
.seat-scores .ss { display: flex; flex-direction: column; gap: 1px; align-items: center; min-width: 30px; }
.seat-scores .ss .who { font-size: 9px; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 700; color: var(--text-soft); max-width: 56px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seat-scores .ss.me .who { color: var(--gold); }
.seat-scores .ss .num { font-size: 22px; font-weight: 500; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--text); line-height: 1; }
.seat-scores .ss.me .num { color: var(--gold); }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 540px) {
  body { padding: 12px 10px 24px; }
  .felt { min-height: 440px; padding: 11px; gap: 5px; grid-template-columns: minmax(42px, 0.55fr) minmax(0, 2fr) minmax(42px, 0.55fr); }
  .seat { padding: 5px 8px; gap: 6px; }
  .seat.left, .seat.right { padding: 7px 5px; }
  .avatar { width: 30px; height: 30px; flex-basis: 30px; font-size: 12px; }
  .seat-name { font-size: 11px; }
  .seat.left .seat-name, .seat.right .seat-name { font-size: 10px; }
  .seat.left .team-tag, .seat.right .team-tag { display:none; }
  .trick { max-width: 210px; }
  .play .card, .trick .card { --w: 38px; }
  .hand .card { --w: 46px; margin-left: -24px; }
  .bid-panel { position: static; }
  .hud-card { padding: 7px 10px; }
  .score-side .num { font-size: 20px; }
  .seat-scores { gap: 9px; }
  .seat-scores .ss { min-width: 24px; }
  .seat-scores .ss .num { font-size: 18px; }
  .seat-scores .ss .who { font-size: 8px; max-width: 42px; }
  .page-title { font-size: 20px; }
}
@media (max-width: 380px) {
  .hand .card { --w: 41px; margin-left: -23px; }
  .trick { max-width: 184px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  .sweep-card { transition: none !important; }
}

/* ============ Google AdSense yerleşimleri ============ */
/* Ana ekran üst/alt reklam — normal akışta, yükseklik rezerve edilir (CLS yok) */
.ad-slot { display: block; width: 100%; max-width: 420px; margin: 0 auto; overflow: hidden; text-align: center; }
.ad-slot .adsbygoogle { display: block; }
.ad-home-header { min-height: 90px; margin: 2px auto 14px; }
.ad-home-footer { min-height: 90px; margin: 16px auto 4px; }

/* Yan dikey raylar — masaüstünde, yalnız oyun sütununun (#app 1100px) dışındaki
   gerçek boşluk yeterliyse. Toast/modallardan (z-index 40+) altta durur. */
.ad-rail { display: none; }
@media (min-width: 1460px) {
  .ad-rail {
    display: block;
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 160px;
    height: min(600px, 80vh);
    z-index: 20;
  }
  .ad-rail--left  { left: 16px; }
  .ad-rail--right { right: 16px; }
  .ad-rail .adsbygoogle { display: block; width: 160px; height: 100%; }
}
