/* =====================================================================
   PİŞTİ — online web client styles.
   Kıraathane (Turkish coffeehouse) identity ported from the validated
   prototype (birkartoyunu-ios/prototypes/pisti/play/index.html):
   walnut wood + brass/amber + the hot ember-red PİŞTİ signature.
   Extended with an SPA screen router (home / browse / name / lobby / game),
   a connection banner, and 2p (Tekli) vs 4p (Eşli) table layouts.
   Deliberately DISTINCT from Batak (emerald felt + gold). Mobile-first.
   ===================================================================== */

/* ---------- DESIGN TOKENS (Kıraathane / coffeehouse) ---------- */
:root {
  --wood-900: #2a1a10;
  --wood-800: #3a2415;
  --wood-700: #4d3019;
  --wood-rim: #1a0f07;
  --brass:      #d9a441;
  --brass-soft: rgba(217,164,65,0.16);
  --brass-line: rgba(217,164,65,0.55);
  --amber-glow: rgba(245,196,108,0.5);
  --ember:     #e4452c;
  --ember-hot: #ff6a3d;
  --ember-soft: rgba(228,69,44,0.18);
  --card-face: #f8f3e7;
  --card-edge: #e0d5bd;
  --card-back-a: #7c2d1c;
  --card-back-b: #5a1f12;
  --suit-black: #211a13;
  --suit-red:   #c4332a;
  --text:      #f4ead7;
  --text-soft: rgba(244,234,215,0.72);
  --text-dim:  rgba(244,234,215,0.42);
  --teal:      #4fb3a0; /* "Biz" team tint (eşli) */
  --rust:      #e0a89a; /* "Onlar" team tint (eşli) */
  --r-lg: 24px;
  --r-md: 16px;
  --r-sm: 10px;
  --r-pill: 999px;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI",
          system-ui, "Helvetica Neue", Arial, sans-serif;
  --serif: "Georgia", "Times New Roman", "Playfair Display", serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
}

* { 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% 70% at 50% -8%, rgba(245,196,108,0.10), transparent 55%),
    radial-gradient(100% 60% at 50% 110%, rgba(228,69,44,0.06), transparent 60%),
    linear-gradient(180deg, #221007, #170b04 65%, #120803);
  background-attachment: fixed;
  overflow-x: hidden;
}

/* ---------- SCREEN ROUTER ---------- */
.screen {
  display: none;
  max-width: 560px; margin: 0 auto;
  padding: calc(14px + var(--safe-top)) 14px calc(26px + var(--safe-bot));
  min-height: 100dvh;
}
.screen.show { display: block; }
.game-screen.show { display: flex; flex-direction: column; }

/* ---------- HEADERS ---------- */
.page-head { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom: 14px; }
/* Sub-page header (back · centred title · trailing action). A 3-column grid keeps
   the title TRULY centred between the side controls and lets a long title shrink
   or wrap without shoving the buttons off-axis on narrow phones (≤390px). */
.page-head--sub {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center; gap: 8px;
}
.page-head--sub > .brand.center,
.page-head--sub > .sub-title { grid-column: 2; justify-self: center; text-align: center; min-width: 0; }
.page-head--sub > .sub-title { line-height: 1.12; }
.brand { display:flex; flex-direction:column; gap:1px; }
.brand.center { align-items:center; text-align:center; }
/* Brand may be a cross-origin link to the birkartoyunu.com hub; keep it text-like. */
a.brand { text-decoration: none; color: inherit; cursor: pointer; }
a.brand:focus-visible { outline: 2px solid var(--brass); outline-offset: 3px; border-radius: 6px; }
.eyebrow { font-size: 9.5px; letter-spacing: 0.36em; text-transform: uppercase; color: var(--brass); font-weight: 700; margin: 0; }
.page-title { font-family: var(--serif); font-size: clamp(26px, 9vw, 38px); font-weight: 700; font-style: italic; letter-spacing: -0.01em; margin: 0; line-height: 1; color: var(--text); }
.page-title b { color: var(--ember-hot); font-style: normal; }
.sub-title { font-family: var(--serif); font-style: italic; font-weight: 700; font-size: clamp(18px, 6vw, 24px); margin: 0; }
.sub-title b { color: var(--ember-hot); font-style: normal; }
.head-actions { display:flex; gap:7px; }
.ghost-btn {
  height: 38px; padding: 0 14px; border-radius: 11px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.04);
  color: var(--text); font-size: 13px; font-weight: 600;
  cursor: pointer; display:flex; align-items:center; gap:6px; min-width: 0;
}
.ghost-btn:hover { background: rgba(255,255,255,0.09); }
.ghost-btn:focus-visible, .icon-btn:focus-visible, .big-btn:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 11px; flex: 0 0 38px;
  border: 1px solid rgba(255,255,255,0.14); background: rgba(255,255,255,0.04);
  color: var(--text); font-size: 17px; cursor: pointer; line-height: 1;
}
.icon-btn:hover { background: rgba(255,255,255,0.09); }
.icon-btn.spinning { animation: spin .6s linear; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- HOME ---------- */
/* Back-to-hub affordance (cross-origin link to the birkartoyunu.com hub).
   Mirrors Batak's .hub-back, recolored for the kıraathane (walnut + brass) palette. */
.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: var(--brass-soft);
  border: 1px solid var(--brass-line);
  border-radius: var(--r-pill); padding: 6px 14px; margin: 0 0 14px;
  transition: background .15s, color .15s, transform .08s;
}
.hub-back:hover { background: rgba(217,164,65,0.26); color: var(--text); }
.hub-back:active { transform: translateY(1px); }
.hub-back:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  .hub-back { transition: none; }
  .hub-back:active { transform: none; }
}

.home-tag { font-size: 14px; color: var(--text-soft); line-height: 1.55; margin: 0 0 18px; }
.home-actions { display: flex; flex-direction: column; gap: 11px; margin-bottom: 16px; }
.big-btn {
  display: flex; align-items: center; gap: 14px; text-align: left;
  padding: 15px 16px; border-radius: var(--r-md); cursor: pointer;
  background: linear-gradient(160deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
  border: 1px solid rgba(255,255,255,0.10); color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}
.big-btn:hover { background: linear-gradient(160deg, rgba(255,255,255,0.10), rgba(255,255,255,0.04)); }
.big-btn.primary {
  background: linear-gradient(160deg, var(--ember-hot), var(--ember));
  border-color: rgba(255,255,255,0.2);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.3), 0 12px 26px -12px rgba(228,69,44,0.6);
}
.big-btn.primary .bb-text span { color: rgba(255,255,255,0.85); }
.bb-emoji { font-size: 26px; flex: 0 0 auto; }
.bb-text { display: flex; flex-direction: column; gap: 2px; }
.bb-text b { font-size: 16px; font-weight: 700; }
.bb-text span { font-size: 12px; color: var(--text-soft); }

.join-row { display: flex; gap: 9px; margin-bottom: 8px; }
.code-input {
  flex: 1; height: 50px; border-radius: 14px; padding: 0 16px;
  background: rgba(0,0,0,0.25); border: 1px solid rgba(255,255,255,0.14);
  color: var(--text); font-size: 18px; font-weight: 700; letter-spacing: 0.22em;
  text-transform: uppercase; text-align: center;
}
.code-input::placeholder { letter-spacing: 0.16em; font-weight: 600; color: var(--text-dim); }
.code-input:focus-visible { outline: 2px solid var(--brass); outline-offset: 1px; }

.home-err { font-size: 13px; color: var(--ember-hot); min-height: 18px; margin: 4px 0 0; font-weight: 600; }

.home-section { margin-top: 18px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.section-head h2 { font-size: 14px; font-weight: 700; letter-spacing: 0.04em; margin: 0; color: var(--text); }
.section-head .muted { color: var(--text-dim); font-weight: 600; }

/* ---------- DATA LISTS (rooms / recent / lobby seats) ---------- */
.data-list, .seat-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.data-row {
  display: flex; align-items: center; gap: 12px; padding: 11px 13px;
  border-radius: var(--r-md);
  background: linear-gradient(160deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
  border: 1px solid rgba(255,255,255,0.08);
}
.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, #8a3b22, #4d1f10);
  border: 1px solid rgba(255,255,255,0.16);
}
.rMeta { flex: 1; min-width: 0; }
.rTitle { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; font-size: 14px; font-weight: 700; }
.rSub { font-size: 12px; color: var(--text-soft); margin-top: 2px; }
.rCode { color: var(--brass); font-weight: 700; letter-spacing: 0.08em; }
.rJoin { flex: 0 0 auto; height: 38px; padding: 0 16px; font-size: 13px; border-radius: 11px; }
/* The empty/loading message fills the panel and centres so the raised list panel
   never looks like a broken, top-loaded void on the room-browser / recent screens. */
.list-empty { font-size: 13px; color: var(--text-dim); text-align: center; padding: 18px 8px; margin: 0;
  display: flex; align-items: center; justify-content: center; min-height: 168px; line-height: 1.5; }
.list-empty.hide { display: none; }

/* Panel wrapper for recent / room-browser screens.
   Mirrors Batak's .home-card surface treatment so these screens look finished
   instead of bare — recolored to the Pişti kıraathane (walnut + brass) palette.
   The .screen already fills the viewport (min-height:100dvh) with the body's
   walnut felt; this gives the list its own raised panel like the lobby/name cards. */
.list-panel {
  background: linear-gradient(160deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--r-lg);
  padding: 14px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 24px 60px -34px rgba(0,0,0,0.8);
  min-height: 200px;
}

.variant-badge {
  font-size: 9.5px; letter-spacing: 0.1em; font-weight: 800; text-transform: uppercase;
  padding: 3px 9px; border-radius: var(--r-pill);
  background: var(--brass-soft); border: 1px solid var(--brass-line); color: var(--brass);
}
.variant-badge.tekli { background: var(--ember-soft); border-color: rgba(228,69,44,0.45); color: var(--ember-hot); }
.variant-badge.fmt { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.18); color: var(--text-soft); }
.match-format-line { text-align: center; font-size: 13px; color: var(--text-soft); margin: 4px 0 12px; }

/* ---------- NAME ---------- */
.name-card {
  background: linear-gradient(160deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
  border: 1px solid rgba(255,255,255,0.08); border-radius: var(--r-lg);
  padding: 22px 18px; margin-top: 20px;
}
.name-sub { font-size: 14px; color: var(--text-soft); margin: 0 0 14px; }
.text-input {
  width: 100%; height: 52px; border-radius: 14px; padding: 0 16px;
  background: rgba(0,0,0,0.25); border: 1px solid rgba(255,255,255,0.14);
  color: var(--text); font-size: 17px; font-weight: 600;
}
.text-input:focus-visible { outline: 2px solid var(--brass); outline-offset: 1px; }

/* ---------- LOBBY ---------- */
.code-card {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px; border-radius: var(--r-md); margin-bottom: 18px;
  background: linear-gradient(160deg, rgba(217,164,65,0.10), rgba(255,255,255,0.02));
  border: 1px solid var(--brass-line);
}
.cc-meta { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cc-label { font-size: 9.5px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--text-soft); font-weight: 700; }
.cc-code { font-size: 26px; font-weight: 800; letter-spacing: 0.16em; color: var(--brass); font-family: var(--serif); }
.cc-share { flex: 0 0 auto; height: 42px; padding: 0 16px; }

.lobby-players { margin-bottom: 18px; }
.seat-row {
  display: flex; align-items: center; gap: 12px; padding: 11px 13px;
  border-radius: var(--r-md);
  background: linear-gradient(160deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
  border: 1px solid rgba(255,255,255,0.08);
}
.seat-row.me { border-color: var(--brass-line); }
.seat-row.empty { opacity: 0.5; border-style: dashed; }
.seat-row.us { box-shadow: inset 3px 0 0 var(--teal); }
.seat-row.them { box-shadow: inset 3px 0 0 var(--rust); }
.pAvatar {
  width: 38px; height: 38px; flex: 0 0 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 16px;
  background: linear-gradient(150deg, #8a3b22, #4d1f10);
  border: 1px solid rgba(255,255,255,0.16); color: var(--text);
}
.pName { flex: 1; font-size: 15px; font-weight: 600; min-width: 0; }
.badge {
  font-size: 9px; letter-spacing: 0.1em; font-weight: 800; text-transform: uppercase;
  padding: 3px 8px; border-radius: var(--r-pill);
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.16); color: var(--text-soft);
}
.badge.host { background: var(--brass-soft); border-color: var(--brass-line); color: var(--brass); }

.lobby-actions { display: flex; flex-direction: column; gap: 10px; }
.wait-hint { text-align: center; color: var(--text-soft); font-size: 14px; margin: 6px 0 0; }

/* ---------- BUTTONS ---------- */
.btn {
  height: 50px; border-radius: 14px; font-size: 15px; font-weight: 700; letter-spacing: 0.02em;
  display: flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
  border: 1px solid transparent; color: var(--text); background: rgba(255,255,255,0.05);
}
.btn.full { width: 100%; }
.btn:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-confirm { background: linear-gradient(160deg, var(--ember-hot), var(--ember)); color: #fff; border-color: rgba(255,255,255,0.2); box-shadow: inset 0 1px 0 rgba(255,255,255,0.3), 0 12px 26px -12px rgba(228,69,44,0.6); }
.btn-confirm:hover:not(:disabled) { filter: brightness(1.05); }
.btn-ghost { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.16); color: var(--text-soft); }
.btn-ghost:hover:not(:disabled) { background: rgba(255,255,255,0.09); color: var(--text); }
.btn-danger { background: linear-gradient(160deg, #a13420, #6e2011); color: #fff; border-color: rgba(255,255,255,0.18); box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 12px 26px -14px rgba(161,52,32,0.7); }
.btn-danger:hover:not(:disabled) { filter: brightness(1.08); }

/* ---------- CONNECTION BANNER ---------- */
.conn-banner {
  position: fixed; top: calc(8px + var(--safe-top)); left: 50%; transform: translate(-50%, -130%);
  z-index: 96; display: flex; align-items: center; gap: 9px;
  padding: 9px 16px; border-radius: var(--r-pill);
  background: rgba(40,20,10,0.95); border: 1px solid var(--ember);
  color: var(--text); font-size: 13px; font-weight: 600;
  box-shadow: 0 12px 30px -10px rgba(0,0,0,0.8); transition: transform .3s ease;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); max-width: 90vw;
}
.conn-banner.show { transform: translate(-50%, 0); }
.conn-banner.ok { border-color: var(--brass-line); }
.conn-spinner {
  width: 13px; height: 13px; border-radius: 50%; flex: 0 0 auto;
  border: 2px solid rgba(255,255,255,0.25); border-top-color: var(--ember-hot);
  animation: spin 0.8s linear infinite;
}
.conn-banner.ok .conn-spinner { display: none; }

/* =====================================================================
   GAME — HUD
   ===================================================================== */
.game-head { margin-bottom: 10px; }
.hud { display: flex; gap: 8px; align-items: stretch; margin-bottom: 12px; }
.hud-card {
  display: flex; align-items: center; gap: 9px; padding: 8px 12px; 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.08); box-shadow: inset 0 1px 0 rgba(255,255,255,0.10);
}
.score-card { flex: 1; justify-content: space-around; }
.score-side { display: flex; flex-direction: column; gap: 1px; align-items: center; }
.score-side .who { font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase; font-weight: 700; }
.score-side.you .who { color: var(--teal); }
.score-side.bot .who { color: var(--rust); }
.score-side .num { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1; }
.score-div { font-size: 14px; color: var(--text-dim); align-self: center; }

.seat-score-card { flex: 1; }
.seat-scores { display: flex; gap: 6px; width: 100%; justify-content: space-around; }
.ss { display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 0; }
.ss .who { font-size: 9px; letter-spacing: 0.04em; font-weight: 700; color: var(--text-soft); white-space: nowrap; max-width: 60px; overflow: hidden; text-overflow: ellipsis; }
.ss.me .who { color: var(--brass); }
.ss .num { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1; }

.meta-card { flex-direction: column; gap: 4px; align-items: stretch; justify-content: center; padding: 6px 12px; }
.meta-chip { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.meta-chip .k { font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-soft); font-weight: 700; }
.meta-chip .v { font-size: 15px; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }

/* =====================================================================
   GAME — TABLE
   ===================================================================== */
.table-rail {
  border-radius: var(--r-lg); padding: 10px;
  background: linear-gradient(160deg, #2c1c10, #170d06);
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 36px 80px -34px rgba(0,0,0,0.9), inset 0 1px 0 rgba(255,255,255,0.10);
}
.felt {
  position: relative; border-radius: 16px;
  background:
    radial-gradient(70% 55% at 50% 42%, var(--wood-700), transparent 72%),
    repeating-linear-gradient(96deg, rgba(0,0,0,0.04) 0 6px, rgba(255,255,255,0.012) 6px 13px),
    linear-gradient(180deg, var(--wood-800), var(--wood-900) 92%);
  box-shadow: inset 0 2px 12px rgba(0,0,0,0.5), inset 0 0 0 1px var(--wood-rim), inset 0 0 60px rgba(0,0,0,0.4);
  overflow: hidden; padding: 12px 10px; min-height: 360px;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 6px;
}
.mid-row { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; flex: 1; }
.sideseat { display: none; } /* shown only in Eşli (4p) */
.felt.four .sideseat { display: flex; }

/* seat chip */
.seat {
  position: relative; z-index: 2; display: flex; align-items: center; gap: 10px;
  padding: 7px 12px; border-radius: var(--r-pill);
  background: rgba(20,10,5,0.55); border: 1px solid rgba(255,255,255,0.06);
  -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.empty-chip { display: none; }
.seat.sideseat { flex-direction: column; gap: 6px; padding: 9px 8px; text-align: center; }
.seat.active { border-color: var(--brass-line); background: rgba(60,35,18,0.7); box-shadow: 0 0 0 1px var(--brass-line), 0 0 24px -6px var(--amber-glow); }
.seat.active.pulse { animation: seatPulse 1.4s ease-in-out infinite; }
@keyframes seatPulse {
  0%,100% { box-shadow: 0 0 0 1px var(--brass-line), 0 0 18px -8px var(--amber-glow); }
  50%     { box-shadow: 0 0 0 1px var(--brass-line), 0 0 30px -3px var(--amber-glow); }
}
.seat.gone { opacity: 0.55; }
.avatar {
  width: 36px; height: 36px; flex: 0 0 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; color: var(--text);
  background: linear-gradient(150deg, #8a3b22, #4d1f10);
  border: 1px solid rgba(255,255,255,0.16); box-shadow: inset 0 1px 0 rgba(255,255,255,0.22);
}
.seat.active .avatar { border-color: var(--brass-line); box-shadow: inset 0 1px 0 rgba(255,255,255,0.3), 0 0 14px -2px var(--amber-glow); }
.seat-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sideseat .seat-meta { align-items: center; }
.seat-name { font-size: 13px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.seat-sub { font-size: 10px; letter-spacing: 0.04em; color: var(--text-soft); font-weight: 600; font-variant-numeric: tabular-nums; }
.seat-sub b { color: var(--brass); font-weight: 800; }
.turn-dot { width:7px; height:7px; border-radius:50%; background: var(--brass); box-shadow: 0 0 8px var(--brass); flex:0 0 auto; }
.bot-badge, .team-tag {
  font-size: 8.5px; letter-spacing: 0.1em; font-weight: 800; text-transform: uppercase;
  padding: 2px 6px; border-radius: var(--r-pill);
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.16); color: var(--text-soft);
}
.team-tag.us { color: var(--teal); border-color: rgba(79,179,160,0.5); background: rgba(79,179,160,0.12); }
.team-tag.them { color: var(--rust); border-color: rgba(224,168,154,0.5); background: rgba(224,168,154,0.12); }
.dealer-mark::after { content: "D"; position: absolute; top: -6px; right: -4px; width: 18px; height: 18px; border-radius: 50%; background: var(--brass); color: #2a1a0a; font-size: 10px; font-weight: 800; display: flex; align-items: center; justify-content: center; }

/* opponent's face-down hand-back fan */
.mini-fan { display:flex; align-items:center; justify-content:center; height: 20px; }
.mini-fan i { position:relative; display:block; width: 14px; height: 19px; border-radius: 3px; background: linear-gradient(150deg, var(--card-back-a), var(--card-back-b)); border:1px solid #3a160c; margin-left:-8px; box-shadow: 0 2px 5px rgba(0,0,0,0.5); }
.mini-fan i::before { content:""; position:absolute; inset:2px; border-radius:2px; box-shadow: inset 0 0 0 1px rgba(217,164,65,0.4); background: repeating-linear-gradient(45deg, rgba(217,164,65,0.18) 0 1px, transparent 1px 4px); }
.mini-fan i:first-child{ margin-left:0; }

/* collected chip */
.collected { display:flex; align-items:center; gap:6px; font-size: 11px; font-weight:700; color: var(--text); background: rgba(255,255,255,0.06); border:1px solid rgba(255,255,255,0.12); border-radius: var(--r-pill); padding: 3px 9px; font-variant-numeric: tabular-nums; }
.collected .stk { display:inline-block; width:11px; height:15px; border-radius:2px; background: linear-gradient(150deg, var(--card-back-a), var(--card-back-b)); border:1px solid #3a160c; box-shadow: inset 0 0 0 1px rgba(217,164,65,0.35); }
.collected b { color: var(--brass); }
.youseat { background: transparent; border: none; box-shadow: none; padding: 2px; }

/* ---------- PILE ---------- */
.pile-zone { position: relative; z-index: 2; display:flex; flex-direction:column; align-items:center; gap: 8px; }
.pile { position: relative; width: 116px; height: 150px; }
.pile .stack-layer {
  position:absolute; left: 50%; top: 50%; width: 92px; height: 129px;
  margin-left: -46px; margin-top: -64px; border-radius: 9px;
  background: linear-gradient(150deg, #6f2a1a, #4f1b10); border: 1px solid #3a160c;
  box-shadow: 0 6px 14px -8px rgba(0,0,0,0.65), inset 0 0 0 1px rgba(217,164,65,0.18);
  opacity: 0; transition: opacity .25s ease, transform .25s ease;
}
.pile .stack-layer::after { content:""; position:absolute; inset:4px; border-radius:6px; box-shadow: inset 0 0 0 1px rgba(217,164,65,0.28); }
/* Cards UNDER the top fan out alternately LEFT and RIGHT (sağlı-sollu) with a
   small alternating rotation, so the heap visibly reads as several cards. The
   offset magnitude grows with each deeper layer so edges poke out on both sides;
   deeper layers sit slightly lower so the top card stays clearly readable. */
.pile .stack-layer.l1 { transform: translate(12px, 5px)  rotate(4deg); }   /* right */
.pile .stack-layer.l2 { transform: translate(-13px, 7px) rotate(-4.5deg); } /* left  */
.pile .stack-layer.l3 { transform: translate(19px, 9px)  rotate(6.5deg); }  /* right */
.pile .stack-layer.l4 { transform: translate(-20px, 11px) rotate(-7deg); }  /* left  */
.pile .stack-layer.l5 { transform: translate(8px, 13px)  rotate(2.5deg); }  /* slight right, fills centre depth */
/* Reveal underlying edges progressively as the pile grows (deepest first so the
   heap looks layered, not stacked). data-depth = number of fanned edges (1..5). */
.pile[data-depth="1"] .stack-layer.l1,
.pile[data-depth="2"] .stack-layer.l1, .pile[data-depth="2"] .stack-layer.l2,
.pile[data-depth="3"] .stack-layer.l1, .pile[data-depth="3"] .stack-layer.l2, .pile[data-depth="3"] .stack-layer.l3,
.pile[data-depth="4"] .stack-layer.l1, .pile[data-depth="4"] .stack-layer.l2, .pile[data-depth="4"] .stack-layer.l3, .pile[data-depth="4"] .stack-layer.l4,
.pile[data-depth="5"] .stack-layer { opacity: 1; }
.pile .top-card { position:absolute; left: 50%; top: 50%; transform: translate(-50%, -54%); z-index: 5; }
.pile .top-card .card { --w: 92px; box-shadow: 0 14px 30px -8px rgba(0,0,0,0.8), inset 0 0 0 1px rgba(255,255,255,0.55), inset 0 1px 0 rgba(255,255,255,0.9); }
.pile.empty .top-card { display:none; }
.pile.empty .stack-layer { display:none; }
.pile-empty-hint {
  position:absolute; left:50%; top:50%; transform: translate(-50%,-50%);
  width: 92px; height: 129px; display:flex; align-items:center; justify-content:center;
  border: 1.5px dashed rgba(244,234,215,0.22); border-radius: 10px;
  font-size: 10.5px; letter-spacing:0.12em; text-transform:uppercase; color: var(--text-dim); text-align:center; padding: 6px; background: rgba(0,0,0,0.12);
}
.pile:not(.empty) .pile-empty-hint { display:none; }
.pile-count {
  position: absolute; z-index: 6; right: -6px; top: -8px;
  min-width: 26px; height: 26px; padding: 0 8px;
  display: flex; align-items: center; justify-content: center; gap: 3px;
  border-radius: var(--r-pill); background: linear-gradient(160deg, var(--brass), #b9842f);
  color: #2a1a0a; font-weight: 800; font-size: 12.5px; font-variant-numeric: tabular-nums;
  border: 1px solid rgba(255,247,230,0.5); box-shadow: 0 4px 12px -3px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.5);
}
.pile-count .cu { font-size: 8.5px; font-weight: 800; opacity: 0.8; }
.pile.empty .pile-count { display: none; }
.pile-depth { font-size: 11px; font-weight:700; color: var(--text-soft); letter-spacing:0.04em; background: rgba(20,10,5,0.5); border:1px solid rgba(255,255,255,0.10); border-radius: var(--r-pill); padding: 3px 12px; font-variant-numeric: tabular-nums; display:flex; align-items:center; gap:6px; }
.pile-depth b { color: var(--brass); }
.feedback { min-height: 18px; font-size: 12.5px; font-weight: 700; color: var(--text-soft); text-align:center; transition: color .2s; }
.feedback.capture { color: var(--brass); }
.feedback.pisti { color: var(--ember-hot); }

/* =====================================================================
   CARD (premium, ~2.5:3.5 ratio) — ported 1:1 from prototype
   ===================================================================== */
.card {
  --w: 64px; width: var(--w); height: calc(var(--w) * 1.4); border-radius: calc(var(--w) * 0.10);
  background:
    radial-gradient(120% 90% at 50% 0%, #fffdf6, transparent 60%),
    linear-gradient(168deg, var(--card-face) 0%, #f1e8d2 78%, #e9dec2 100%);
  border: 1px solid var(--card-edge);
  box-shadow: 0 6px 16px -6px rgba(0,0,0,0.6), inset 0 0 0 1px rgba(255,255,255,0.55), inset 0 1px 0 rgba(255,255,255,0.9), inset 0 -10px 18px -12px rgba(120,90,40,0.25);
  position: relative; color: var(--suit-black); flex: 0 0 auto; overflow: hidden;
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, var(--serif);
}
.card .face-rule { position: absolute; inset: calc(var(--w) * 0.055); border-radius: calc(var(--w) * 0.06); box-shadow: inset 0 0 0 1px rgba(120,90,40,0.10); pointer-events: none; }
.card .idx { position: absolute; top: calc(var(--w) * 0.045); left: calc(var(--w) * 0.075); display: flex; flex-direction: column; align-items: center; line-height: 0.82; font-weight: 800; font-variant-numeric: tabular-nums; z-index: 4; }
.card .idx .rank { font-size: calc(var(--w) * 0.30); letter-spacing: -0.04em; }
.card .idx .pip  { font-size: calc(var(--w) * 0.205); margin-top: 1px; }
.card .idx.br { top: auto; left: auto; bottom: calc(var(--w) * 0.045); right: calc(var(--w) * 0.075); transform: rotate(180deg); }
.card .pips { position: absolute; top: calc(var(--w) * 0.165); bottom: calc(var(--w) * 0.165); left: calc(var(--w) * 0.265); right: calc(var(--w) * 0.265); display: grid; grid-template-columns: 1fr 1fr 1fr; grid-template-rows: repeat(13, 1fr); align-items: center; justify-items: center; z-index: 3; }
.card .pips span { font-size: calc(var(--w) * 0.26); line-height: 1; display: block; }
.card .pips span.flip { transform: rotate(180deg); }
/* ---- ACE: clean single centred glyph (unchanged behaviour) ---- */
.card .court.is-ace-body { position: absolute; inset: calc(var(--w) * 0.16) calc(var(--w) * 0.16); display: flex; align-items: center; justify-content: center; z-index: 3; border-radius: calc(var(--w) * 0.05); background: radial-gradient(120% 120% at 50% 18%, rgba(217,164,65,0.12), transparent 70%); box-shadow: inset 0 0 0 1px rgba(217,164,65,0.45), inset 0 0 0 3px rgba(217,164,65,0.10); }
.card .court.is-ace-body .glyph { font-size: calc(var(--w) * 0.78); line-height: 1; filter: drop-shadow(0 1px 0 rgba(255,255,255,0.6)); }

/* =====================================================================
   COURT FACE CARDS (K / Q / J) — emblem crest design
   Each rank: distinct brass emblem (crown / tiara / plume) over a large
   suit-coloured rank letter, ghosted suit glyph behind, brass frame, and a
   small Turkish wordmark. Distinct silhouettes keep K/Q/J legible at 64px.
   ===================================================================== */
.card .court:not(.is-ace-body) {
  position: absolute; inset: calc(var(--w) * 0.10);
  z-index: 3; border-radius: calc(var(--w) * 0.055);
  display: grid; grid-template-rows: 1fr auto auto 1fr; justify-items: center; align-items: center;
  padding: calc(var(--w) * 0.05) 0 calc(var(--w) * 0.04);
}
/* Ornamental brass double frame (consistent across K/Q/J). */
.card .court-frame {
  position: absolute; inset: 0; border-radius: calc(var(--w) * 0.055); pointer-events: none;
  background: radial-gradient(125% 95% at 50% 6%, rgba(217,164,65,0.16), transparent 62%);
  box-shadow:
    inset 0 0 0 1px var(--brass-line),
    inset 0 0 0 calc(var(--w) * 0.035) rgba(248,243,231,0.6),
    inset 0 0 0 calc(var(--w) * 0.045) rgba(217,164,65,0.30);
}
/* Corner brass ticks read as an engraved cartouche. */
.card .court-frame::before, .card .court-frame::after {
  content: ""; position: absolute; left: calc(var(--w) * 0.085); right: calc(var(--w) * 0.085); height: 0;
  border-top: 1px solid rgba(217,164,65,0.5);
}
.card .court-frame::before { top: calc(var(--w) * 0.10); }
.card .court-frame::after  { bottom: calc(var(--w) * 0.10); }

/* The brass emblem (top). */
.card .court-emblem { grid-row: 1; align-self: end; line-height: 0; margin-bottom: calc(var(--w) * -0.01); }
.card .court-emblem .emblem { width: calc(var(--w) * 0.42); height: auto; display: block; overflow: visible; }
.card .court-emblem .brass-stroke { stroke: var(--brass); filter: drop-shadow(0 1px 0 rgba(255,255,255,0.5)); }
.card .court-emblem .brass-fill { fill: var(--brass); stroke: none; }
.card .court-emblem .jewel { fill: currentColor; opacity: 0.92; }
.card .court-emblem .plume { stroke: rgba(217,164,65,0.7); }

/* Large suit-coloured rank letter (the hero). */
.card .court-letter {
  grid-row: 2; font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, var(--serif);
  font-weight: 700; font-size: calc(var(--w) * 0.46); line-height: 0.9; color: currentColor;
  letter-spacing: -0.02em; text-shadow: 0 1px 0 rgba(255,255,255,0.7);
}
/* Small suit glyph under the letter to confirm the suit on a face card. */
.card .court-suit { grid-row: 3; font-size: calc(var(--w) * 0.2); line-height: 1; color: currentColor; margin-top: calc(var(--w) * 0.01); filter: drop-shadow(0 1px 0 rgba(255,255,255,0.5)); }
/* Turkish wordmark cue along the bottom. */
.card .court-word {
  grid-row: 4; align-self: start; font-family: var(--serif); font-weight: 700;
  font-size: calc(var(--w) * 0.088); letter-spacing: 0.16em; text-transform: uppercase;
  color: rgba(120,90,40,0.62); margin-top: calc(var(--w) * 0.02);
}
/* Jack gets a subtle ember accent (Jacks capture-all in Pişti). */
.card.is-jack .court-word { color: rgba(228,69,44,0.72); }
.card.is-jack .court-emblem .plume { stroke: rgba(228,69,44,0.7); }
.card.s-red   { color: var(--suit-red); }
.card.s-black { color: var(--suit-black); }
.card.is-jack .idx .rank { color: var(--ember); }
.card.just-played { animation: snapIn .26s cubic-bezier(.2,.9,.25,1); }
@keyframes snapIn { from { opacity:0; transform: translateY(-26px) rotate(-6deg) scale(.92); } to { opacity:1; } }

/* flying card used for sweep animation */
.fly { position: fixed; z-index: 70; pointer-events:none; transition: transform var(--sweep,520ms) cubic-bezier(.45,.05,.25,1), opacity var(--sweep,520ms) ease; }

/* ---------- YOUR HAND ---------- */
.hand-zone { margin-top: 12px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.hand { display: flex; justify-content: center; padding: 22px 8px 4px; min-height: 110px; flex-wrap: nowrap; }
.hand .card { --w: 72px; margin-left: -22px; transform-origin: bottom center; transition: transform .14s ease, box-shadow .14s ease, opacity .2s ease; }
.hand .card:first-child { margin-left: 0; }
.hand .card.playable { cursor: pointer; box-shadow: 0 16px 30px -10px rgba(0,0,0,0.75), inset 0 1px 0 rgba(255,255,255,0.85); }
.hand .card.playable:hover, .hand .card.playable:focus-visible { transform: translateY(-18px) scale(1.03) !important; z-index: 5; }
.hand .card.would-capture { box-shadow: 0 16px 30px -10px rgba(0,0,0,0.75), 0 0 0 2px var(--brass-line), 0 0 18px -4px var(--amber-glow), inset 0 1px 0 rgba(255,255,255,0.85); }
.hand .card.illegal { opacity: 0.45; filter: grayscale(0.3); cursor: not-allowed; }
.hand .card:focus-visible { outline: 2px solid var(--brass); outline-offset: 3px; }
.hand .card.shake { animation: shake .3s; }
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-6px)} 75%{transform:translateX(6px)} }
.hand-hint { font-size: 11.5px; color: var(--text-dim); letter-spacing: 0.02em; margin: 0; text-align:center; min-height: 15px; }

/* ---------- PİŞTİ BURST (signature) ---------- */
.burst { position: fixed; inset: 0; z-index: 80; display:none; align-items:center; justify-content:center; pointer-events:none; }
.burst.show { display:flex; }
.burst-word {
  font-family: var(--serif); font-style: italic; font-weight: 700;
  font-size: clamp(54px, 22vw, 130px); letter-spacing: -0.02em; color: var(--ember-hot);
  text-shadow: 0 0 30px rgba(255,106,61,0.7), 0 6px 0 #a82a18, 0 10px 40px rgba(0,0,0,0.6);
  animation: burstPop .9s cubic-bezier(.2,.9,.25,1) forwards; position: relative; text-align: center;
}
.burst-plus { position:absolute; top:-26px; right:-18px; font-family: var(--sans); font-style: normal; font-weight: 800; font-size: clamp(22px,7vw,40px); color: var(--brass); text-shadow: 0 2px 10px rgba(0,0,0,0.6); animation: plusFloat 1s ease forwards; }
@keyframes burstPop { 0%{transform:scale(.3) rotate(-8deg);opacity:0} 35%{transform:scale(1.12) rotate(-3deg);opacity:1} 55%{transform:scale(0.98) rotate(-3deg)} 80%{transform:scale(1.0) rotate(-3deg);opacity:1} 100%{transform:scale(1.0) rotate(-3deg);opacity:0} }
@keyframes plusFloat { 0%{transform:translateY(8px) scale(.5);opacity:0} 40%{transform:translateY(-4px) scale(1.1);opacity:1} 100%{transform:translateY(-22px) scale(1);opacity:0} }
.spark { position:fixed; z-index:79; width:10px; height:10px; border-radius:50%; pointer-events:none; background: radial-gradient(circle, var(--ember-hot), var(--ember) 60%, transparent 70%); }

/* ---------- MODAL ---------- */
.overlay { position: fixed; inset: 0; z-index: 90; display: none; align-items: center; justify-content: center; padding: 18px; background: rgba(10,5,2,0.8); -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: 440px; max-height: 88vh; overflow-y: auto; border-radius: var(--r-lg); padding: 24px 22px; background: linear-gradient(160deg, #3a2415, #1f120a); border: 1px solid rgba(255,255,255,0.10); box-shadow: 0 40px 90px -30px rgba(0,0,0,0.9), inset 0 1px 0 rgba(255,255,255,0.10); }
.modal h2 { font-family: var(--serif); font-style:italic; margin: 0 0 4px; font-size: 24px; font-weight: 700; }
.modal .modal-eyebrow { font-size:10px; letter-spacing:0.3em; text-transform:uppercase; color:var(--brass); font-weight:800; margin:0 0 8px; }
.modal p { font-size: 13.5px; color: var(--text-soft); line-height: 1.6; margin: 0 0 12px; }
.field-label { display: block; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-soft); font-weight: 700; margin: 14px 0 8px; }
.field-hint { font-size: 12px; color: var(--text-dim); margin: 6px 0 0; line-height: 1.45; }
.seg-row { display: flex; gap: 8px; }
.seg-row[hidden] { display: none; }
.val-row { margin-top: 8px; }
.seg { flex: 1; height: 44px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.14); background: rgba(255,255,255,0.04); color: var(--text-soft); font-size: 14px; font-weight: 700; cursor: pointer; }
.seg.active { background: var(--brass-soft); border-color: var(--brass-line); color: var(--brass); }
.seg:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
.modal-actions { display:flex; gap:10px; margin-top: 18px; }

.result-table { width:100%; border-collapse:collapse; margin: 8px 0 12px; }
.result-table th, .result-table td { text-align:left; padding:7px 8px; font-size:12.5px; border-bottom:1px solid rgba(255,255,255,0.08); }
.result-table th { color: var(--text-dim); font-weight:700; font-size:10px; letter-spacing:0.1em; text-transform:uppercase; }
.result-table td { color: var(--text); font-variant-numeric: tabular-nums; }
.result-table td.lab { color: var(--text-soft); }
.result-table td.n { text-align:right; font-weight:700; }
.result-table tr.total td { border-top: 2px solid rgba(255,255,255,0.18); border-bottom:none; font-size: 16px; font-weight:800; padding-top:10px; }
.big-result { font-family:var(--serif); font-style:italic; font-size: 32px; font-weight: 700; text-align:center; margin: 4px 0 10px; }
.big-result.win { color: var(--brass); }
.big-result.lose { color: var(--rust); }
.big-result.tie { color: var(--text-soft); }

/* toast */
.toast { position: fixed; left: 50%; bottom: calc(20px + var(--safe-bot)); transform: translateX(-50%) translateY(20px); z-index: 95; padding: 10px 18px; border-radius: var(--r-pill); background: rgba(30,15,8,0.94); border: 1px solid var(--brass-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); }

.footer-mark { text-align: center; color: var(--text-dim); font-size: 10.5px; margin: 18px 0 0; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 380px) {
  .felt { min-height: 320px; padding: 10px 7px; }
  .pile { width: 104px; height: 138px; }
  .pile .top-card .card { --w: 82px; }
  .pile .stack-layer { width: 82px; height: 115px; margin-left: -41px; margin-top: -57px; }
  .hand .card { --w: 60px; margin-left: -20px; }
  .score-side .num { font-size: 20px; }
  .ss .who { max-width: 44px; }
}
@media (max-height: 700px) {
  .felt { min-height: 290px; }
  .hand { min-height: 96px; padding-top: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  .fly { display:none !important; }
  .burst { display: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: 520px; margin: 0 auto; overflow: hidden; text-align: center; }
.ad-slot .adsbygoogle { display: block; }
.ad-home-header { min-height: 90px; margin: 0 auto 16px; }
.ad-home-footer { min-height: 90px; margin: 18px auto 6px; }

/* Yan dikey raylar — masaüstünde, yalnız oyun sütununun (560px) dışındaki
   gerçek boşluk yeterliyse. Toast/modallardan (z-index 70+) altta durur. */
.ad-rail { display: none; }
@media (min-width: 1100px) {
  .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%; }
}
