/* =====================================================================
   Süper Mangala — web client styles.
   Terracotta + teal earthen theme (mirrors the approved landscape
   prototype). Lobby/home/list/overlay shell mirrors the sibling Pişti
   web client; the GAME screen is a Mangala board (2×6 pits + 2 stores).
   ===================================================================== */
:root {
  --wood-1:    #2f1d14;
  --wood-2:    #3d2519;
  --board:     #6b3a23;
  --board-2:   #7d4429;
  --teal:      #0f3d3a;
  --teal-2:    #155049;
  --pit:       #4a2616;
  --pit-rim:   #8a5436;
  --store:     #123e3b;
  --store-rim: #1c5751;
  --bead:      #e9c46a;
  --bead-2:    #f4d58d;
  --bead-3:    #d99a4e;
  --terra:     #c1502e;
  --terra-2:   #d96a44;
  --cream:     #f3e7d3;
  --ink:       #f7ecd9;
  --ink-dim:   #cdb89a;
  --ink-soft:  #e7d6bb;
  --good:      #6fbf73;
  --danger:    #c0473a;

  --panel:     rgba(255,255,255,0.06);
  --panel-2:   rgba(0,0,0,0.25);
  --line:      rgba(255,255,255,0.10);

  --sans: "Avenir Next", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --r-sm: 12px; --r-md: 18px; --r-lg: 28px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background:
    radial-gradient(120% 80% at 50% 0%, #432a1d 0%, var(--wood-1) 55%, #160c07 100%);
  background-attachment: fixed;
  overflow: hidden;
  touch-action: manipulation;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
body {
  font-family: var(--sans);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ====================== SCREENS ====================== */
.screen {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  padding: calc(var(--safe-t) + 12px) calc(var(--safe-r) + 18px) calc(var(--safe-b) + 14px) calc(var(--safe-l) + 18px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.screen.show { display: flex; }

/* ====================== HEADER ====================== */
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
/* 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 (matches Pişti). */
.page-head--sub {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}
.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 { text-decoration: none; color: inherit; }
.brand.center { text-align: center; flex: 1; }
.eyebrow {
  margin: 0;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.page-title {
  margin: 2px 0 0;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--cream);
  text-shadow: 0 2px 0 rgba(0,0,0,0.35);
}
.sub-title {
  margin: 0;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: var(--cream);
}
.head-actions { display: flex; gap: 8px; }

.ghost-btn, .icon-btn {
  appearance: none;
  border: none;
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--ink);
  border-radius: 12px;
  min-height: 40px;
  padding: 0 12px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.icon-btn { width: 40px; padding: 0; font-size: 18px; }
.ghost-btn:active, .icon-btn:active { filter: brightness(1.12); transform: translateY(1px); }
.icon-btn.spinning { animation: spin 0.6s linear; }
@keyframes spin { to { transform: rotate(360deg); } }

.hub-back {
  align-self: flex-start;
  margin: -2px 0 8px;
  color: var(--ink-dim);
  text-decoration: none;
  font-size: 13px;
}
.home-tag {
  color: var(--ink-dim);
  font-size: 14px;
  line-height: 1.5;
  margin: 4px 0 16px;
  max-width: 520px;
}

/* ====================== HOME ACTIONS ====================== */
.home-screen { max-width: 560px; margin: 0 auto; width: 100%; }
.home-actions { display: flex; flex-direction: column; gap: 12px; }
.big-btn {
  appearance: none;
  border: none;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: var(--r-md);
  background: linear-gradient(160deg, var(--board-2), var(--board) 60%, #5a3020 100%);
  box-shadow: 0 6px 16px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.06);
  color: var(--cream);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 0.08s ease, filter 0.15s ease;
}
.big-btn:active { transform: translateY(2px) scale(0.995); filter: brightness(1.06); }
.big-btn.primary { background: linear-gradient(160deg, var(--terra-2), var(--terra)); }
.bb-emoji { font-size: 26px; flex: 0 0 auto; }
.bb-text { display: flex; flex-direction: column; line-height: 1.3; }
.bb-text b { font-size: 17px; }
.bb-text span { font-size: 12.5px; color: rgba(255,255,255,0.72); font-weight: 500; }

.join-row { display: flex; gap: 10px; margin: 16px 0 4px; }
.code-input {
  flex: 1;
  min-height: 50px;
  border: none;
  border-radius: var(--r-md);
  background: var(--panel-2);
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--cream);
  font: inherit;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 4px;
  text-align: center;
  text-transform: uppercase;
  padding: 0 12px;
}
.code-input::placeholder { letter-spacing: 2px; color: var(--ink-dim); font-weight: 700; }

.footer-mark { margin-top: 18px; text-align: center; font-size: 12px; color: var(--ink-dim); }
.home-err { color: var(--terra-2); font-size: 13px; min-height: 18px; margin: 6px 0 0; font-weight: 600; }

/* ====================== BUTTONS ====================== */
.btn {
  appearance: none;
  border: none;
  min-height: 50px;
  padding: 0 20px;
  border-radius: var(--r-md);
  font: inherit;
  font-size: 16px;
  font-weight: 800;
  color: var(--cream);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.08s ease, filter 0.15s ease;
}
.btn:active { transform: translateY(2px); filter: brightness(1.08); }
.btn.full { width: 100%; }
.btn-confirm { background: linear-gradient(160deg, var(--terra-2), var(--terra)); box-shadow: 0 6px 14px rgba(0,0,0,0.3); }
.btn-ghost { background: var(--panel); box-shadow: inset 0 0 0 1px var(--line); }
.btn-danger { background: linear-gradient(160deg, #d4584a, var(--danger)); box-shadow: 0 6px 14px rgba(0,0,0,0.3); }
.btn:disabled { opacity: 0.5; cursor: default; transform: none; }

/* ====================== LISTS (rooms / recent) ====================== */
/* Panel wrapper for recent / room-browser screens.
   Mirrors the sibling Pişti .list-panel so these screens look finished instead
   of bare — recolored to the Mangala terracotta/earthen palette. The .screen is
   a fixed flex column, so flex:1 lets this raised panel fill the viewport. */
.list-panel {
  flex: 1;
  background: linear-gradient(160deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
  box-shadow: inset 0 0 0 1px var(--line), inset 0 1px 0 rgba(255,255,255,0.06), 0 24px 60px -34px rgba(0,0,0,0.8);
  border-radius: var(--r-lg);
  padding: 14px;
  min-height: 200px;
}
.data-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.data-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--line);
}
.rAvatar {
  width: 40px; height: 40px;
  flex: 0 0 auto;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  background:
    radial-gradient(circle at 32% 30%, var(--bead-2), var(--bead) 50%, var(--bead-3) 100%);
}
.rMeta { flex: 1; min-width: 0; }
.rTitle { display: flex; align-items: center; gap: 8px; font-weight: 800; color: var(--cream); }
.rSub { font-size: 12.5px; color: var(--ink-dim); margin-top: 2px; }
.rCode { letter-spacing: 1px; }
.rJoin { min-height: 40px; padding: 0 16px; }
.variant-badge {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--teal-2);
  color: var(--cream);
}
.variant-badge.fmt { background: rgba(0,0,0,0.3); color: var(--bead-2); }
/* 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: 14px; color: var(--ink-dim); text-align: center; margin: 0;
  padding: 18px 8px; line-height: 1.5;
  display: flex; align-items: center; justify-content: center; min-height: 168px;
}
.list-empty.hide { display: none; }

/* ====================== NAME ====================== */
.name-card {
  max-width: 420px; width: 100%; margin: 8px auto 0;
  display: flex; flex-direction: column; gap: 12px;
  padding: 22px;
  border-radius: var(--r-lg);
  background: linear-gradient(160deg, var(--board-2), var(--board));
  box-shadow: 0 16px 40px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.06);
}
.name-sub { margin: 0; color: var(--ink-soft); font-size: 14px; }
.text-input {
  min-height: 52px;
  border: none;
  border-radius: var(--r-md);
  background: var(--panel-2);
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--cream);
  font: inherit; font-size: 17px; font-weight: 700;
  padding: 0 16px;
}

/* ====================== LOBBY ====================== */
#lobbyScreen { max-width: 560px; margin: 0 auto; width: 100%; }
.code-card {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px;
  border-radius: var(--r-md);
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--line);
  margin-bottom: 16px;
}
.cc-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cc-label { font-size: 12px; color: var(--ink-dim); text-transform: uppercase; letter-spacing: 1px; }
.cc-code { font-size: 24px; font-weight: 900; letter-spacing: 4px; color: var(--bead-2); }
.section-head h2 { font-size: 16px; margin: 0 0 10px; color: var(--cream); }
.muted { color: var(--ink-dim); font-weight: 500; }
.seat-list { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.seat-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--line);
}
.seat-row.me { box-shadow: inset 0 0 0 2px var(--terra-2); }
.seat-row.empty { opacity: 0.55; }
.pAvatar {
  width: 36px; height: 36px; flex: 0 0 auto;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 16px;
  background: radial-gradient(circle at 32% 30%, var(--bead-2), var(--bead) 55%, var(--bead-3) 100%);
  color: #3a230f;
}
.seat-row.empty .pAvatar { background: var(--panel-2); color: var(--ink-dim); }
.pName { flex: 1; font-weight: 700; }
.badge {
  font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 999px;
  background: var(--panel-2); color: var(--ink-soft);
}
.badge.host { background: var(--teal-2); color: var(--cream); }
.lobby-actions { display: flex; flex-direction: column; gap: 10px; margin-top: auto; }
.wait-hint { text-align: center; color: var(--ink-dim); font-size: 14px; }

/* ====================== GAME (BOARD) ====================== */
.game-screen { padding: calc(var(--safe-t) + 6px) calc(var(--safe-r) + 8px) calc(var(--safe-b) + 6px) calc(var(--safe-l) + 8px); overflow: hidden; }
.game-head { margin-bottom: 6px; }

.hud {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 4px;
}
.hud-card {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 12px;
  border-radius: 14px;
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--line);
}
.seat-scores { display: flex; gap: 10px; }
.ss { display: flex; align-items: center; gap: 6px; }
.ss .who { font-size: 12px; color: var(--ink-dim); font-weight: 700; }
.ss.me .who { color: var(--bead-2); }
.ss .num { font-size: 18px; font-weight: 900; color: var(--cream); }
.meta-chip { display: flex; align-items: center; gap: 6px; }
.meta-chip .k { font-size: 11px; color: var(--ink-dim); text-transform: uppercase; letter-spacing: 1px; }
.meta-chip .v { font-size: 16px; font-weight: 900; color: var(--cream); }

.status-bar {
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-soft);
  min-height: 20px;
  margin: 2px 0 4px;
  transition: color 0.2s ease;
}
.status-bar.your-turn { color: var(--bead-2); }
.status-bar.bot-turn { color: var(--terra-2); }

.board-rail {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}
.board {
  position: relative;
  width: 100%;
  max-width: 760px;
  background: linear-gradient(160deg, var(--board-2), var(--board) 55%, #5a3020 100%);
  border-radius: 30px;
  padding: 14px;
  box-shadow:
    inset 0 2px 0 rgba(255,255,255,0.08),
    inset 0 -8px 20px rgba(0,0,0,0.35),
    0 14px 30px rgba(0,0,0,0.4);
  display: grid;
  grid-template-columns: 72px 1fr 72px;
  gap: 14px;
  align-items: stretch;
}
.board::after {
  content: "";
  position: absolute; inset: 0;
  border-radius: 30px;
  pointer-events: none;
  background: repeating-linear-gradient(95deg, rgba(0,0,0,0.05) 0 6px, rgba(255,255,255,0.02) 6px 12px);
  opacity: 0.5;
  mix-blend-mode: overlay;
}

/* Store (kale / hazine) */
.store {
  position: relative;
  border-radius: 26px;
  background: radial-gradient(120% 60% at 50% 12%, var(--store-rim), var(--store) 70%);
  box-shadow: inset 0 4px 10px rgba(0,0,0,0.5), inset 0 -2px 0 rgba(255,255,255,0.08);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 10px 4px;
  overflow: hidden;
}
.store .store-count {
  position: absolute; bottom: 8px;
  font-size: 20px; font-weight: 800; color: var(--bead-2);
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}
.store .beadwell { position: relative; width: 100%; flex: 1; }
.store.highlight {
  box-shadow: inset 0 4px 10px rgba(0,0,0,0.5), 0 0 0 3px var(--bead-2), 0 0 18px rgba(233,196,106,0.5);
}

.rows { display: flex; flex-direction: column; gap: 12px; justify-content: center; }
.pit-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; justify-items: center; }

/* Pit (kuyu) */
.pit {
  position: relative;
  width: 100%;
  max-width: 76px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  border: none;
  background: radial-gradient(120% 120% at 50% 18%, var(--pit-rim), var(--pit) 62%, #36190d 100%);
  box-shadow: inset 0 5px 10px rgba(0,0,0,0.55), inset 0 -2px 0 rgba(255,255,255,0.06);
  cursor: default;
  padding: 0;
  overflow: visible;
  transition: transform 0.08s ease, box-shadow 0.15s ease;
}
.pit .pit-beads { position: absolute; inset: 0; }
.pit .pit-count {
  position: absolute; bottom: -2px; left: 0; right: 0;
  text-align: center; font-size: 13px; font-weight: 800;
  color: var(--cream); text-shadow: 0 1px 2px rgba(0,0,0,0.8);
  pointer-events: none;
}
.pit.playable {
  cursor: pointer;
  box-shadow: inset 0 5px 10px rgba(0,0,0,0.55), 0 0 0 2px var(--bead-2), 0 0 14px rgba(233,196,106,0.45);
}
.pit.playable:active { transform: scale(0.94); }
.pit.capture-flash { animation: captureFlash 0.5s ease; }
@keyframes captureFlash {
  0%,100% { box-shadow: inset 0 5px 10px rgba(0,0,0,0.55); }
  40% { box-shadow: inset 0 0 0 3px var(--terra-2), 0 0 22px rgba(217,106,68,0.8); }
}

/* Beads / stones */
.bead {
  position: absolute;
  width: 22%; height: 22%;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, var(--bead-2), var(--bead) 55%, var(--bead-3) 100%);
  box-shadow: 0 1px 2px rgba(0,0,0,0.4), inset 0 -1px 2px rgba(0,0,0,0.25);
}
.store .bead { width: 16px; height: 16px; }
.fly-bead {
  position: absolute;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, var(--bead-2), var(--bead) 55%, var(--bead-3) 100%);
  box-shadow: 0 2px 5px rgba(0,0,0,0.5);
  z-index: 50;
  pointer-events: none;
  transition: transform 0.26s cubic-bezier(0.25,0.8,0.4,1), opacity 0.26s ease;
}

/* ====================== ROTATE HINT ====================== */
#rotateHint {
  position: fixed; inset: 0;
  display: none;
  flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; text-align: center; padding: 32px;
  background: radial-gradient(120% 80% at 50% 30%, #432a1d 0%, var(--wood-1) 70%, #160c07 100%);
  z-index: 200;
}
#rotateHint .rot-icon { font-size: 64px; animation: rotPulse 1.8s ease-in-out infinite; }
@keyframes rotPulse { 0%,100% { transform: rotate(-12deg); } 50% { transform: rotate(78deg); } }
#rotateHint .rot-title { font-size: 22px; font-weight: 800; color: var(--cream); }
#rotateHint .rot-sub { font-size: 14px; color: var(--ink-dim); max-width: 260px; line-height: 1.5; }

/* Real device, in-game, portrait → show rotate hint, hide the board. */
@media (max-width: 1024px) and (orientation: portrait) {
  body.in-game #rotateHint { display: flex; }
  body.in-game #gameScreen { visibility: hidden; }
}

/* Landscape play layout: tighten so the board fits on phones held sideways. */
@media (orientation: landscape) and (max-height: 560px) {
  .game-head { margin-bottom: 2px; }
  .hud { margin-bottom: 0; }
  .hud-card { padding: 4px 10px; }
  .status-bar { margin: 0; min-height: 16px; font-size: 13px; }
  .board {
    max-width: min(760px, calc((100vh - 100px) * 2.4));
    padding: 10px;
    gap: 10px;
    grid-template-columns: 60px 1fr 60px;
  }
  .rows { gap: 8px; }
  .pit-row { gap: 8px; }
  .pit { max-width: 60px; }
  .store .store-count { font-size: 17px; }
}
@media (orientation: landscape) and (max-height: 400px) {
  .board { max-width: calc((100vh - 80px) * 2.3); padding: 8px; gap: 7px; grid-template-columns: 52px 1fr 52px; }
  .pit { max-width: 52px; }
}

/* ====================== HUD SEGMENTS / MODALS ====================== */
.field-label { display: block; font-size: 13px; color: var(--ink-dim); font-weight: 700; margin: 14px 0 8px; }
.seg-row { display: flex; gap: 8px; background: var(--panel-2); padding: 6px; border-radius: var(--r-md); }
.seg {
  flex: 1; min-height: 42px; border: none; border-radius: 12px;
  background: transparent; color: var(--ink-dim);
  font: inherit; font-size: 15px; font-weight: 800; cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.seg.active { background: linear-gradient(160deg, var(--bead-2), var(--bead-3)); color: #3a230f; box-shadow: 0 4px 10px rgba(0,0,0,0.3); }
.field-hint { font-size: 12.5px; color: var(--ink-dim); margin: 8px 2px 0; line-height: 1.4; }

/* ====================== OVERLAYS ====================== */
.overlay {
  position: fixed; inset: 0;
  display: none; align-items: center; justify-content: center;
  background: rgba(20,10,6,0.78);
  backdrop-filter: blur(4px);
  z-index: 100;
  padding: 24px;
}
.overlay.show { display: flex; }
.modal {
  width: 100%; max-width: 420px;
  background: linear-gradient(160deg, var(--board-2), var(--board));
  border-radius: var(--r-lg);
  padding: 24px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.1);
  max-height: 90vh; overflow-y: auto;
}
.modal-eyebrow { margin: 0; font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--ink-dim); }
.modal h2 { margin: 4px 0 8px; font-size: 22px; color: var(--cream); }
.modal p { color: var(--ink-soft); font-size: 14px; line-height: 1.5; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; }
.modal-actions .btn { flex: 1; }

/* Result tables (handover + matchover) */
.result-table { width: 100%; border-collapse: collapse; margin: 10px 0; }
.result-table th, .result-table td { padding: 8px 6px; font-size: 14px; }
.result-table th { color: var(--ink-dim); font-weight: 700; text-align: right; }
.result-table .lab { text-align: left; color: var(--ink-soft); }
.result-table .n { text-align: right; font-weight: 800; color: var(--cream); }
.result-table tr.total td { border-top: 1px solid var(--line); font-weight: 900; color: var(--bead-2); padding-top: 10px; }
.big-result { text-align: center; font-size: 26px; font-weight: 900; margin: 6px 0 2px; }
.big-result.win { color: var(--good); }
.big-result.lose { color: var(--terra-2); }
.match-format-line { text-align: center; color: var(--ink-dim); margin: 0 0 6px; }

/* ====================== CONNECTION BANNER / TOAST ====================== */
.conn-banner {
  position: fixed; top: calc(var(--safe-t) + 8px); left: 50%; transform: translateX(-50%) translateY(-200%);
  z-index: 300;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px; border-radius: 999px;
  background: var(--danger); color: #fff;
  font-size: 13px; font-weight: 700;
  box-shadow: 0 8px 20px rgba(0,0,0,0.4);
  transition: transform 0.25s ease;
}
.conn-banner.show { transform: translateX(-50%) translateY(0); }
.conn-banner.ok { background: var(--good); }
.conn-spinner {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.4); border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}
.conn-banner.ok .conn-spinner { display: none; }

.toast {
  position: fixed; bottom: calc(var(--safe-b) + 20px); left: 50%; transform: translateX(-50%) translateY(200%);
  z-index: 300;
  padding: 10px 18px; border-radius: 999px;
  background: rgba(20,10,6,0.94); color: var(--cream);
  font-size: 14px; font-weight: 700;
  box-shadow: 0 8px 20px rgba(0,0,0,0.4);
  transition: transform 0.25s ease;
  max-width: 88vw; text-align: center;
}
.toast.show { transform: translateX(-50%) translateY(0); }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !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 tahtasının (760px) dışındaki
   gerçek boşluk yeterliyse. Modallardan (z-index 50+) altta durur. */
.ad-rail { display: none; }
@media (min-width: 1200px) {
  .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%; }
}
