/* Batak — arayüz stilleri (sürüm 2).
   Görünümün sözleşmesi docs/TASARIM.md'dedir: "çuha ve ceviz" — petrol yeşili çuha, ceviz ray,
   krem kâğıt kartlar, nar kırmızısı ve mürekkep siyahı iki renkli deste, pirinç sıra göstergesi,
   defter sayfası görünümlü yazboz.
   Dış kaynak yok: yazı tipi sistemden; kartlar, masa ve desenler CSS ile satır içi SVG'den çizilir.
   Önce dik telefon (360×640 – 430×932): masa ekranı sabit satırlı bir ızgaradır; hiçbir kutu evreye
   göre yer ya da boy değiştirmez (TASARIM 1.2). Orta ve geniş ekran kuralları ilgili bölümlerin
   sonundadır.
   Renk tek başına bilgi taşımaz: her renkli işaretin yanında yazı ya da ayrı bir biçim vardır. */

:root {
  color-scheme: light dark;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);

  /* Sayfa */
  --bg: #f4efe6;
  --surface: #fffaf2;
  --surface-2: #efe7da;
  --text: #1d2433;
  --muted: #586173;
  --line: #d6ccbb;
  --accent: #0f6b63;
  --accent-ink: #ffffff;
  --accent-soft: #d6ebe6;
  --warm: #a8431b;
  --warm-soft: #f7e2d6;
  --danger: #b3261e;
  --danger-ink: #ffffff;
  --ok: #1c6b3a;
  --focus: #9a5b00;
  --focus-felt: #ffd36a;

  /* Kartlar: iki temada da krem kâğıt; iki mürekkep her yerde aynıdır (TASARIM 3.1, 3.7). */
  --card-face: #fffdf7;
  --card-face-2: #f3ecdd;
  --card-edge: #c9c0ae;
  --ink-black: #1a1c22;
  --ink-red: #b3202c;
  --back-1: #7a1f2b;
  --back-2: #5a1520;
  --back-line: #f4e7c8;

  /* Çuha, ray, plakalar */
  --felt-hi: #186f62;
  --felt-mid: #115a51;
  --felt-lo: #0a403a;
  --felt-text: #f1faf7;
  --felt-dim: #cfe6e0;
  --plate: #0a322d;
  --plate-line: #9fd0c5;
  --us: #8fe3d4;
  --them: #ffc39e;
  --brass: #f2c24d;
  --brass-ink: #2a1d00;
  --rail-hi: #7a5535;
  --rail-lo: #4d321e;
  --low: #ff8a7a;

  /* Yazboz kâğıdı */
  --paper: #fbf6e8;
  --paper-ink: #232a38;
  --paper-muted: #5c6475;
  --paper-line: #d9cfb8;
  --paper-margin: #c96a5a;
  --paper-live: #f3e6c0;
  --paper-mine: #f1ead6;

  --radius: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c;
    --surface: #1b212b;
    --surface-2: #252d3a;
    --text: #ece8df;
    --muted: #a6afbe;
    --line: #353f50;
    --accent: #36b8a9;
    --accent-ink: #04211e;
    --accent-soft: #173a3b;
    --warm: #ee9468;
    --warm-soft: #3e271b;
    --danger: #ff8f85;
    --danger-ink: #2b0705;
    --ok: #74d394;
    --focus: #ffc857;
    --card-face: #f4efe4;
    --card-face-2: #e6dfd0;
    --card-edge: #8f897d;
    --felt-hi: #176a5f;
    --felt-mid: #0e4a43;
    --felt-lo: #08322e;
    --paper: #1e2530;
    --paper-ink: #ece8df;
    --paper-muted: #a6afbe;
    --paper-line: #33404f;
    --paper-margin: #b0584c;
    --paper-live: #3a3524;
    --paper-mine: #252e3b;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.4;
  /* Ana ekrandan uygulama gibi açılınca (iPhone) giriş ve lobi durum çubuğunun altında başlar; tarayıcı
     sekmesinde bu değer 0'dır. Masa ekranında boşluk masanın kendisindedir (aşağıda sıfırlanır). */
  padding-top: env(safe-area-inset-top, 0px);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

/* Masa ekranı: belge kaymaz (çekip yenileme tetiklenmez). Tarayıcılar sayfanın kaydırma ve çekme
   davranışını kök öğeden (html) okur; app.js `data-screen`i html'e de yazar. iOS 15'te
   `overscroll-behavior` yoktur: orada sürüklemeyi masa görünümünün dokunma dinleyicisi durdurur. */
html[data-screen="table"] {
  overflow: hidden;
  overscroll-behavior: none;
}

/* Masa ekranı: çift dokunuşla büyütme ve uzun basınca metin seçimi yoktur; iki parmakla büyütme
   serbesttir (TASARIM 8.2). */
body[data-screen="table"] {
  position: fixed;
  inset: 0;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  padding: 0;
  min-height: 0;
}

h1, h2, h3, p, ul, ol, fieldset, legend {
  margin: 0;
  padding: 0;
}

fieldset {
  border: 0;
  min-width: 0;
}

button, input {
  font: inherit;
  color: inherit;
}

button,
.card {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.noscript {
  margin: 24px 16px;
  padding: 12px;
  border: 2px solid var(--danger);
  border-radius: var(--radius);
}

.app {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.view {
  flex: 1 1 auto;
  min-height: 0;
}

.muted {
  color: var(--muted);
  font-size: 14px;
}

/* ------------------------------------------------------------------ Düğmeler */

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  line-height: 1.15;
  text-align: center;
  cursor: pointer;
}

.btn:active:not([disabled]) {
  transform: translateY(1px);
}

.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn--primary {
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-ink);
}

.btn--danger {
  background: var(--danger);
  border-color: transparent;
  color: var(--danger-ink);
}

.btn--ghost {
  background: transparent;
}

.btn--small {
  min-height: 44px;
  padding: 6px 10px;
  font-size: 13px;
}

.btn--wide {
  width: 100%;
}

/* ------------------------------------------------------------------ Etiketler */

.tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(127, 127, 127, 0.22);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}

.tag--ok {
  background: var(--accent-soft);
  color: var(--accent);
}

.tag--declarer {
  background: var(--brass);
  color: var(--brass-ink);
}

.tag--down {
  background: transparent;
  border: 1px solid currentColor;
  color: var(--danger);
  margin-right: 6px;
}

.tag--esli {
  background: var(--accent-soft);
  color: var(--accent);
}

.tag--tekli {
  background: var(--warm-soft);
  color: var(--warm);
}

/* ------------------------------------------------------------------ Renk simgeleri, kartlar (TASARIM 3) */

.suit {
  display: block;
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.ink-black { color: var(--ink-black); }
.ink-red { color: var(--ink-red); }

/* Renk simgesi kart dışında her zaman krem zeminli bir rozetin içindedir: koyu zeminde siyah maça
   ve sinek kaybolmaz. */
.suitchip {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  padding: 3px;
  border-radius: 50%;
  background: var(--card-face);
  box-shadow: 0 0 0 1px var(--card-edge);
  vertical-align: middle;
}

.suitchip--black { color: var(--ink-black); }
.suitchip--red { color: var(--ink-red); }

.card {
  position: relative;
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: calc(var(--w, 60px) * 0.07);
  background: linear-gradient(160deg, #fffefb 0%, var(--card-face) 52%, var(--card-face-2) 100%);
  box-shadow: 0 0 0 1px var(--card-edge), 0 1px 2px rgba(0, 0, 0, .30), 0 3px 8px rgba(0, 0, 0, .18);
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
}

.card--black { color: var(--ink-black); }
.card--red { color: var(--ink-red); }

button.card {
  cursor: pointer;
}

.card__face {
  display: block;
  width: 100%;
  height: 100%;
  fill: currentColor;
  pointer-events: none;
}

.face__rank {
  font-family: var(--font);
  font-variant-numeric: tabular-nums;
}

.face__ring {
  fill: none;
  stroke: currentColor;
  stroke-width: 1;
  opacity: .3;
}

.face__frame {
  fill: currentColor;
  fill-opacity: .06;
  stroke: currentColor;
  stroke-opacity: .55;
  stroke-width: 1.2;
}

/* Perde: saydamlık değil, kartın üstüne binen koyu katman (karşıtlığı hesaplanabilir). */
.card.is-dim::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: rgba(18, 22, 28, .30);
  pointer-events: none;
}

/* Kart sırtı: nar kırmızısı zemin, krem baklava örgüsü, ortada krem nokta, krem iç çerçeve. */
.cardback {
  display: block;
  border-radius: calc(var(--w, 40px) * 0.07);
  background:
    radial-gradient(circle at 50% 50%, var(--back-line) 0 9%, transparent 9.5%),
    repeating-linear-gradient(45deg, transparent 0 5px, rgba(244, 231, 200, .2) 5px 6px),
    repeating-linear-gradient(-45deg, transparent 0 5px, rgba(244, 231, 200, .2) 5px 6px),
    linear-gradient(160deg, var(--back-1), var(--back-2));
  box-shadow: 0 0 0 1px #3a0c14, inset 0 0 0 3px var(--back-line), inset 0 0 0 4px #3a0c14, 0 1px 3px rgba(0, 0, 0, .35);
}

/* ------------------------------------------------------------------ Marka */

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand--big {
  flex-direction: column;
  text-align: center;
  gap: 8px;
}

.brand__title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.brand--big .brand__title {
  font-size: 34px;
}

.brand__tagline {
  color: var(--muted);
}

.brandmark {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  width: 40px;
  height: 40px;
  padding: 5px;
  border-radius: 9px;
  background: linear-gradient(160deg, #fffefb 0%, var(--card-face) 52%, var(--card-face-2) 100%);
  box-shadow: 0 0 0 1px var(--card-edge), 0 0 0 3px var(--back-1), 0 2px 5px rgba(0, 0, 0, .25);
  transform: rotate(-4deg);
}

.brand--big .brandmark {
  width: 64px;
  height: 64px;
  padding: 8px;
  border-radius: 13px;
  box-shadow: 0 0 0 1px var(--card-edge), 0 0 0 4px var(--back-1), 0 3px 8px rgba(0, 0, 0, .25);
}

/* ------------------------------------------------------------------ Bağlantı durumu */

/* Lobide ve açılışta sayfanın üstündeki şerit; masa ekranında yerini üst çubuktaki katman alır. */
.connbar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  gap: 8px;
  padding: 5px 10px;
  background: var(--warm-soft);
  color: var(--text);
  border-bottom: 2px solid var(--warm);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}

.connbar__text {
  min-width: 0;
  line-height: 1.25;
}

.connbar .btn {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 4px 10px;
  white-space: nowrap;
}

.connbar--busy {
  background: var(--surface-2);
  border-bottom-color: var(--line);
}

.connchip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.connchip__dot,
.conndot {
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--ok);
}

/* Bağlantı yokken nokta kareye, kurulurken içi boş halkaya döner: renk görmeden de ayırt edilir. */
.connchip--busy .connchip__dot,
.conndot--busy {
  background: transparent;
  border: 2px solid var(--muted);
}

.connchip--down .connchip__dot,
.conndot--down {
  border-radius: 2px;
  background: var(--danger);
}

.connchip--down .connchip__text {
  color: var(--danger);
  font-weight: 700;
}

/* ------------------------------------------------------------------ Açılış ve giriş */

.boot,
.login {
  width: min(420px, 100%);
  margin: 0 auto;
  padding: 32px 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.boot {
  align-items: center;
  text-align: center;
  padding-top: 20vh;
}

.boot__status {
  color: var(--muted);
  text-align: center;
  padding: 16px;
}

/* Çok eski tarayıcı (betik modülü çalışmadı): index.html'deki bu satır yalnız on saniye sonra görünür.
   Sayfa açılırsa betik açılış ekranını baştan kurar ve satır kalkar; betiğe gerek yoktur. Bu bir
   hareket değil, bekleme süresidir: azaltılmış harekette de aynıdır (dosyanın sonu). */
.boot__eski {
  max-width: 420px;
  margin: 0 auto;
  padding: 0 16px;
  color: var(--text);
  font-size: 15px;
  text-align: center;
  animation: eski-bekle 10s;
}

@keyframes eski-bekle {
  from, to { opacity: 0; }
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.panel__title {
  font-size: 18px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field__label {
  font-weight: 600;
  font-size: 14px;
}

.field__input {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  /* 16 px altı yazı iOS'ta alana dokununca sayfayı büyütür. */
  font-size: 16px;
}

.field__foot {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.field__help {
  color: var(--muted);
  font-size: 13px;
}

.field__count {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
}

.check__input {
  width: 20px;
  height: 20px;
  margin: 0;
}

.form-error {
  padding: 10px 12px;
  border-left: 4px solid var(--danger);
  border-radius: 6px;
  background: var(--warm-soft);
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
}

.notice {
  padding: 10px 12px;
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  background: var(--accent-soft);
  font-size: 14px;
}

.login__note {
  text-align: center;
}

/* ------------------------------------------------------------------ Lobi (TASARIM 6.2) */

.lobby {
  width: min(980px, 100%);
  margin: 0 auto;
  /* Alttaki sabit "Yeni masa aç" çubuğunun altında içerik kalmasın. */
  padding: 12px 12px calc(88px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lobby__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.lobby__user {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.lobby__hello {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.lobby__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.lobby__tables {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.lobby__tableshead {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lobby__online {
  margin-left: auto;
}

.lobby__foot {
  text-align: center;
}

.lobby__bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  padding: 8px max(12px, env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left));
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.lobby__bar .btn {
  min-height: 48px;
}

.tables {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.empty {
  padding: 20px 12px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

.tcard {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.tcard__head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.tcard__title {
  margin-right: auto;
  font-size: 16px;
  letter-spacing: 0.03em;
}

.tcard__status {
  font-size: 14px;
  color: var(--muted);
}

.tcard__summary {
  font-size: 13px;
  font-weight: 600;
}

.tcard__seats,
.tcard__teams {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.tcard__team {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px;
  border-radius: 10px;
  border: 2px solid var(--accent);
  min-width: 0;
}

/* İkinci takım kesikli çerçeveyle ayrılır (renge ek olarak biçim). */
.tcard__team--1 {
  border-style: dashed;
  border-color: var(--warm);
}

.tcard__teamname {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.lseat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-height: 48px;
  min-width: 0;
  padding: 2px 6px 2px 8px;
  border-radius: 8px;
  background: var(--surface-2);
}

.lseat__name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 600;
}

.lseat__sit {
  flex: 0 0 auto;
  padding: 6px 10px;
  font-size: 13px;
}

.lseat--empty .lseat__name {
  color: var(--muted);
  font-style: italic;
  font-weight: 400;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.2;
}

/* Bot koltuğunda ad kısalmasın: düğme adın altına iner. */
.lseat--bot.is-open {
  flex-direction: column;
  align-items: stretch;
  padding: 6px 8px;
}

.tcard__hint {
  font-size: 12px;
}

/* ------------------------------------------------------------------ Masa açma formu (TASARIM 6.3) */

/* Dik telefonda form alttan açılan penceredir; 820 px ve üstünde sağ sütunda hep açıktır. */
.createwrap {
  display: none;
}

.createwrap.is-open {
  position: fixed;
  inset: 0;
  z-index: 15;
  display: grid;
  place-items: end center;
  padding: 10px 10px 0;
  background: rgba(8, 12, 18, 0.6);
}

.create {
  width: min(520px, 100%);
  min-width: 0;
  max-height: 88vh;
  max-height: 88dvh;
  padding: 0;
  gap: 0;
  overflow: hidden;
}

.createwrap.is-open .create {
  border-radius: 16px 16px 0 0;
  animation: sheet-in 180ms ease-out;
}

.create > .panel__title {
  padding: 14px 16px 6px;
}

.create__body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  padding: 6px 16px 12px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* Alt düğme sırası sabittir ve güvenli alanın üstündedir. */
.create__foot {
  display: flex;
  gap: 8px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.create__cancel {
  flex: 0 0 auto;
}

.choices {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.choices--row {
  flex-direction: row;
  flex-wrap: wrap;
}

.choices__legend {
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 700;
}

.choice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 44px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
}

.choice--pill {
  flex: 1 1 0;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  font-weight: 600;
}

/* İki ayrı kural: :has() bilmeyen tarayıcı (iOS 15.0–15.3, eski Samsung Internet) bir seçici listesinin
   tamamını atar; hap düğmelerinin (51, 101) seçili görünümü onlarda da kalsın. Radyo düğmesinin kendi
   noktası her tarayıcıda seçimi gösterir. */
.choice[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.choice:has(.choice__input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.choice:has(.choice__input:focus-visible) {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.choice__input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
}

.choice--pill .choice__input {
  margin: 0;
}

.choice__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.choice__title {
  font-weight: 700;
}

.choice__hint {
  color: var(--muted);
  font-size: 13px;
}

.create__target {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.target__row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.target__pick {
  flex: 0 0 64px;
  min-height: 46px;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.target__field {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.target__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.target__input[aria-invalid="true"] {
  border-color: var(--danger);
  box-shadow: inset 0 0 0 1px var(--danger);
}

@media (min-width: 820px) {
  .lobby {
    padding-bottom: 24px;
  }

  .lobby__grid {
    grid-template-columns: minmax(0, 1fr) 360px;
  }

  .lobby__bar,
  .create__cancel {
    display: none;
  }

  .createwrap,
  .createwrap.is-open {
    position: static;
    display: block;
    padding: 0;
    background: none;
  }

  .create,
  .createwrap.is-open .create {
    width: 100%;
    max-height: none;
    border-radius: var(--radius);
    animation: none;
  }

  .create__body {
    overflow: visible;
  }

  .create__foot {
    padding-bottom: 14px;
    border-top: 0;
    background: none;
  }
}

/* ================================================================== Masa görünümü (TASARIM 1) */

.view--table {
  position: relative;
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;            /* yalnız ekran yetmediğinde (yatık telefon, çok kısa pencere) kayar */
  overscroll-behavior: none;   /* bir iki piksellik taşmada masa parmağın altında esneyip zıplamasın */
}

/* Ölçü değişkenleri — dik telefon (TASARIM 1.3). Bütün ölçüler --gen ve --yuk'ten türer;
   kart oranı her yerde 5 : 7'dir. */
.masa {
  --gen: 100vw;
  --yuk: 100vh;
  --m: 8px;
  --g: 4px;
  --ust-h: 44px;
  --skor-h: 38px;
  --eylem-h: 48px;
  --alt-bosluk: 0px;
  --kolon: calc(var(--gen) - 2 * var(--m));

  /* El: iki katlı yelpaze, katta en çok 7 kart */
  --el-w: clamp(60px, calc((var(--gen) - 16px) / 5.4), 76px);
  --el-h: calc(var(--el-w) * 1.4);
  --el-kat: max(46px, calc(var(--el-h) * 0.52));
  --el-zone: calc(6px + var(--el-kat) + var(--el-h) + 6px);

  /* Yer şeridi (Eşli): iki katlı yelpaze */
  --yer-w: clamp(48px, calc((var(--gen) - 16px) / 6.9), 60px);
  --yer-h: calc(var(--yer-w) * 1.4);
  --yer-kat: 44px;
  --yer-zone: calc(6px + var(--yer-kat) + var(--yer-h) + 10px);

  /* Çuhanın içi */
  --ic: 8px;
  --plaka-h: 28px;
  --plaka-orta-w: 196px;
  --plaka-yan-h: 42px;
  --plaka-yan-w: clamp(96px, calc(var(--gen) * 0.275), 116px);
  --yer-ust: calc(var(--ic) + var(--plaka-h) + 4px);
  --saha-ust: var(--yer-ust);
  --saha-bas: calc(var(--saha-ust) + 12px);
  --saha-son: calc(var(--ic) + var(--plaka-h) + 4px);

  /* Yerdeki kartlar: genişlikten ve çuhada kalan yükseklikten türer */
  --tk-en-az: 44px;
  --cuha-min: max(
    calc(var(--saha-bas) + 1.72 * 1.4 * var(--tk-en-az) + var(--saha-son)),
    calc(var(--saha-bas) + var(--plaka-yan-h) + 4px + 50px + 4px + 40px + var(--ic)));
  --cuha-h: max(var(--cuha-min),
    calc(var(--yuk) - var(--ust-h) - var(--skor-h) - var(--eylem-h) - var(--el-zone) - 4 * var(--g)
         - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - var(--alt-bosluk, 0px)));
  --capraz-h: calc(var(--cuha-h) - var(--saha-bas) - var(--saha-son));
  --tk-w: clamp(var(--tk-en-az), min(calc(var(--gen) * 0.205 - 15px), calc(var(--capraz-h) / 2.408)), 84px);
  --tk-h: calc(var(--tk-w) * 1.4);
  --tk-adim: calc(var(--tk-w) * 0.6);

  position: relative;
  /* Canlandırılan kartlar (dağıtım, toplanma) masanın dışına taşıp kaydırma alanı açmasın. */
  overflow: hidden;
  overflow: clip;
  display: grid;
  grid-template-columns: minmax(0, var(--kolon));
  grid-template-rows:
    var(--ust-h)
    var(--skor-h)
    minmax(var(--cuha-min), 1fr)
    var(--eylem-h)
    calc(var(--el-zone) + env(safe-area-inset-bottom, 0px));
  justify-content: center;
  row-gap: var(--g);
  height: var(--yuk);
  min-height: calc(var(--ust-h) + var(--skor-h) + var(--cuha-min) + var(--eylem-h) + var(--el-zone) + 4 * var(--g)
                   + env(safe-area-inset-top, 0px) + env(safe-area-inset-bottom, 0px));
  padding: env(safe-area-inset-top, 0px) max(var(--m), env(safe-area-inset-right, 0px)) 0 max(var(--m), env(safe-area-inset-left, 0px));
}

@supports (height: 100dvh) {
  .masa { --yuk: 100dvh; }
}

.masa--tekli { --eylem-h: 98px; --saha-ust: var(--yer-ust); }
.masa--esli { --saha-ust: calc(var(--yer-ust) + var(--yer-zone)); }

.masa > [data-zone] { min-width: 0; min-height: 0; overflow: hidden; }
.masa > [data-zone="topbar"] { grid-row: 1; grid-column: 1; }
.masa > [data-zone="status"] { grid-row: 2; grid-column: 1; }
/* Çuha ve el kendi yığın bağlamını kurar: yelpazedeki kartların sıra numarası (20 + sıra) dışarı
   sızmaz; yazboz katmanı ve pencereler her zaman kartların üstünde kalır. */
.masa > [data-zone="board"] { grid-row: 3; grid-column: 1; isolation: isolate; }
.masa > [data-zone="actions"] { grid-row: 4; grid-column: 1; }
.masa > [data-zone="hand"] { grid-row: 5; grid-column: 1; overflow: visible; isolation: isolate; }   /* kalkan kart kırpılmaz */

/* Betiğin ölçtüğü yükseklik ve küçültme (TASARIM 1.7, TK-15; views/table.js syncScale).
   - data-yuk: yükseklik px olarak betikten gelir (100dvh'yi bilmeyen tarayıcıda; küçültülen masada).
   - data-olcek: masa 360 px'ten dar ya da ekrana yüksekliğe sığmayan dik telefonda aynı sabit yerleşimle,
     daha geniş bir tasarım genişliğinde kurulur ve oranla küçültülür. Küçültülen öğenin içinde görünüm
     birimi kalmaz: genişlik ve yükseklik betikten px olarak gelir, sonuç tarayıcının vw / dvh'yi `zoom`
     ile çarpıp çarpmamasına bağlı değildir. `zoom`u bilmeyen tarayıcıda betik bu yolu açmaz. */
.masa[data-yuk] { --yuk: var(--yuk-px); }
.masa[data-olcek] { --gen: var(--gen-px); width: var(--gen-px); zoom: var(--olcek); }

/* ------------------------------------------------------------------ Üst çubuk */

.topbar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
}

.topbar__title {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  line-height: 1.15;
  padding: 0 2px;
}

.topbar__name,
.topbar__meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar__name {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .02em;
}

.topbar__meta {
  transform-origin: left center;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
}

.topbar__conn {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 16px;
}

.tbtn {
  appearance: none;
  flex: 0 0 auto;
  min-width: 40px;
  height: 40px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.tbtn--icon {
  padding: 0;
  font-size: 16px;
  font-weight: 800;
}

.tbtn[aria-pressed="true"] {
  border-color: transparent;
  background: var(--accent);
  color: var(--accent-ink);
}

/* Bağlantı uyarısı: üst çubuğun üstüne, aynı kutuya oturan katman; masayı itmez (TASARIM 8.4). */
.connlayer {
  position: absolute;
  inset: 2px 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 4px 0 10px;
  border: 2px solid var(--warm);
  border-radius: 10px;
  background: var(--warm-soft);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.15;
}

.connlayer--busy {
  border-color: var(--line);
  background: var(--surface-2);
}

.connlayer__text {
  flex: 1 1 auto;
  min-width: 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  text-align: center;
}

.connlayer__btn {
  appearance: none;
  flex: 0 0 auto;
  align-self: stretch;
  min-width: 44px;
  min-height: 40px;
  margin: -2px -4px -2px 0;
  padding: 0 10px;
  border: 0;
  border-radius: 0 8px 8px 0;
  background: var(--warm);
  color: var(--surface);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}

/* ------------------------------------------------------------------ Skor şeridi (TASARIM 4.6) */

.skor {
  display: grid;
  align-items: center;
  gap: 6px;
}

.skor--takim { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.skor--tek { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }

.takim {
  position: relative;
  display: flex;
  align-items: center;
  gap: 5px;
  height: 34px;
  min-width: 0;
  padding: 0 8px;
  border: 2px solid var(--accent);
  border-radius: 10px;
  background: var(--accent-soft);
  overflow: hidden;
  white-space: nowrap;
}

/* Rakip: renk + kesikli kenarlık + baklava işaret. */
.takim--rakip {
  border-style: dashed;
  border-color: var(--warm);
  background: var(--warm-soft);
}

.takim__isaret {
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
}

.takim--rakip .takim__isaret {
  border-radius: 1px;
  background: var(--warm);
  transform: rotate(45deg) scale(.86);
}

.takim__ad {
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 800;
}

.takim__el {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.takim__puan {
  flex: 0 0 auto;
  margin-left: auto;
  font-size: 17px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.hucre {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 34px;
  min-width: 0;
  padding: 0 6px 1px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  line-height: 1.1;
  overflow: hidden;
}

.hucre--ben {
  border: 2px solid var(--accent);
  background: var(--accent-soft);
}

.hucre__ad {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.hucre__puan {
  font-size: 15px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* Hedefli oyunda hedefe ilerleme: alt kenarda 3 px'lik çizgi. */
.skor__ilerleme {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: rgba(127, 127, 127, .2);
}

.skor__dolu {
  display: block;
  width: 100%;
  height: 100%;
  background: currentColor;
  opacity: .7;
  transform: scaleX(var(--oran, 0));
  transform-origin: left center;
}

.takim.is-up, .hucre.is-up { animation: flash-up 600ms ease-out; }
.takim.is-down, .hucre.is-down { animation: flash-down 600ms ease-out; }

@keyframes flash-up {
  0% { box-shadow: 0 0 0 3px var(--brass); }
  100% { box-shadow: 0 0 0 0 transparent; }
}

@keyframes flash-down {
  0% { box-shadow: 0 0 0 3px var(--danger); }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* ------------------------------------------------------------------ Çuha (TASARIM 4.1) */

.cuha {
  position: relative;                 /* içindeki her şey mutlak konumlu: yer ve boyut içerikten bağımsız */
  border-radius: 18px;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, .022) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, .03) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at 50% 34%, var(--felt-hi) 0%, var(--felt-mid) 58%, var(--felt-lo) 100%);
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, .55),
    inset 0 0 0 4px var(--rail-hi),
    inset 0 0 0 5px var(--rail-lo),
    inset 0 0 22px 6px rgba(0, 0, 0, .32);
  color: var(--felt-text);
}

.cuha :focus-visible {
  outline-color: var(--focus-felt);
}

/* --- Koltuk plakası (TASARIM 4.2): sabit boy; durumlar yalnız kenarlık ve gölgeyle --- */

.plaka {
  position: absolute;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 7px;
  border: 2px solid var(--plate-line);
  border-radius: 10px;
  background: var(--plate);
  color: var(--felt-text);
  line-height: 1.1;
}

.plaka[data-pos="top"],
.plaka[data-pos="bottom"] {
  left: 50%;
  width: var(--plaka-orta-w);
  margin-left: calc(var(--plaka-orta-w) / -2);
  height: var(--plaka-h);
}

.plaka[data-pos="top"] { top: var(--ic); }
.plaka[data-pos="bottom"] { bottom: var(--ic); }

.plaka[data-pos="left"],
.plaka[data-pos="right"] {
  top: var(--saha-bas);
  width: var(--plaka-yan-w);
  height: var(--plaka-yan-h);
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 3px;
}

.plaka[data-pos="left"] { left: var(--ic); }
.plaka[data-pos="right"] { right: var(--ic); }

.plaka--us { border-color: var(--us); }
.plaka--them { border-style: dashed; border-color: var(--them); }
.plaka--self { border-color: var(--us); }
.plaka--other { border-color: var(--plate-line); }

.plaka__ad {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 4px;
}

.plaka__name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 700;
}

.plaka__bilgi {
  flex: 0 0 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.plaka[data-pos="left"] .plaka__ad,
.plaka[data-pos="right"] .plaka__ad {
  flex: 0 0 auto;
}

.plaka[data-pos="left"] .plaka__bilgi,
.plaka[data-pos="right"] .plaka__bilgi {
  justify-content: space-between;
  min-height: 15px;
}

.plaka__role {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--brass);
  color: var(--brass-ink);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.plaka__slot {
  flex: 0 0 auto;
  margin-left: auto;
  color: var(--felt-dim);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.plaka__slot--bid {
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--card-face);
  color: var(--ink-black);
  font-size: 11px;
  font-weight: 800;
}

.plaka__slot--pass {
  padding: 0 6px;
  border: 1px solid var(--felt-dim);
  border-radius: 999px;
  font-size: 11px;
}

.plaka__slot--owner {
  font-size: 11px;
  font-style: italic;
  font-weight: 600;
}

/* Adın önündeki işaret: yerine bot oynuyor (çerçeveli BOT) ya da bağlantısı koptu (kırmızı kare). */
.plaka__mark {
  flex: 0 0 auto;
}

.plaka__mark--bot {
  padding: 0 3px;
  border: 1px solid var(--felt-dim);
  border-radius: 4px;
  color: var(--felt-dim);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .04em;
}

.plaka__mark--off {
  width: 8px;
  height: 8px;
  border-radius: 1px;
  background: var(--low);
}

.plaka.is-off .plaka__name {
  text-decoration: line-through;
  opacity: .75;
}

/* Karar verecek koltuk: düz pirinç kenarlık + nefes alan dış parıltı + süre çubuğu. */
.plaka.is-actor,
.plaka.is-turn,
.plaka.is-winner {
  border-style: solid;
  border-color: var(--brass);
}

.plaka.is-actor::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  box-shadow: 0 0 0 2px rgba(242, 194, 77, .4), 0 0 14px 2px rgba(242, 194, 77, .35);
  pointer-events: none;
  animation: breathe 1600ms ease-in-out infinite alternate;
}

.plaka.is-winner {
  animation: plate-win 600ms ease-out;
}

@keyframes breathe {
  from { opacity: .6; }
  to { opacity: 1; }
}

@keyframes plate-win {
  0% { box-shadow: 0 0 0 4px rgba(242, 194, 77, .7), 0 0 18px 6px rgba(242, 194, 77, .55); }
  100% { box-shadow: 0 0 0 0 rgba(242, 194, 77, 0); }
}

.plaka__timer {
  position: absolute;
  left: 7px;
  right: 7px;
  bottom: 1px;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, .16);
  overflow: hidden;
}

.plaka__timerbar,
.eylem__surebar {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--brass);
  transform: scaleX(var(--frac, 1));
  transform-origin: left center;
  transition: transform 250ms linear;
}

.plaka__timerbar.is-low { background: var(--low); }

/* Köşe rozetleri plakanın dışına taşar ve yer tutmaz; plakayı büyütmez. */
.rozet {
  position: absolute;
  z-index: 1;
  display: grid;
  place-items: center;
  height: 18px;
  min-width: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--card-face);
  color: var(--ink-black);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .45);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.rozet--dealer { top: -8px; left: -8px; padding: 0; }
.rozet--open { top: -8px; right: -8px; letter-spacing: .04em; }
.rozet--ready { top: -8px; right: -8px; padding: 0; background: var(--brass); color: var(--brass-ink); font-size: 12px; }
.rozet--pending { bottom: -8px; right: -8px; }

/* Boş koltuk (yalnız beklemede): zeminsiz, kesikli beyaz kenarlık, eğik yazı; plakanın tamamı düğme. */
.plaka.is-empty {
  border: 2px dashed rgba(255, 255, 255, .75);
  background: transparent;
}

.plaka.is-empty .plaka__name {
  font-style: italic;
  font-weight: 600;
}

.plaka__move {
  appearance: none;
  position: absolute;
  inset: -2px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 8px;
  border: 0;
  border-radius: inherit;
  background: transparent;
  color: var(--focus-felt);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.plaka[data-pos="left"] .plaka__move,
.plaka[data-pos="right"] .plaka__move {
  align-items: flex-end;
  padding-bottom: 6px;
}

/* Dokunma alanı en az 44 px yüksekliğe tamamlanır. */
.plaka__move::after {
  content: "";
  position: absolute;
  inset: -8px 0;
}

/* --- Yer şeridi (TASARIM 2): açık el her bakışta aynı yerde, aynı boyda --- */

[data-zone="openhand"] {
  position: absolute;
  left: 0;
  right: 0;
  top: var(--yer-ust);
  height: var(--yer-zone);
  border-bottom: 1px dashed rgba(255, 255, 255, .28);   /* dikiş çizgisi */
}

/* İhalecinin görünümünde sıra yerdeyken şerit pirinç çerçeve alır. */
[data-zone="openhand"].is-due::before {
  content: "";
  position: absolute;
  inset: 1px calc(var(--ic) - 3px) 4px;
  border: 2px solid var(--brass);
  border-radius: 10px;
  box-shadow: 0 0 12px 1px rgba(242, 194, 77, .3);
  pointer-events: none;
}

.yer__etiket {
  position: absolute;
  left: 50%;
  bottom: -9px;
  z-index: 3;
  transform: translateX(-50%);
  max-width: calc(100% - 2 * var(--plaka-yan-w) + 40px);
  height: 18px;
  padding: 0 9px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--card-face);
  color: var(--ink-black);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .4);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .02em;
  line-height: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.yer__metin {
  position: absolute;
  inset: 8px 22px 14px;
  display: grid;
  place-items: center;
  border: 1.5px dashed rgba(255, 255, 255, .2);
  border-radius: 10px;
  color: var(--felt-dim);
  font-size: 12.5px;
  line-height: 1.3;
  text-align: center;
  padding: 0 12px;
}

.yer--empty .yelpaze--yer:empty {
  border: 1.5px dashed rgba(255, 255, 255, .2);
  border-radius: 10px;
}

/* --- Yelpaze kuralı (TASARIM 2.3): el ve yer için aynı. Kutu sabittir; kartlar içinde sıklaşır. --- */

.yelpaze {
  position: absolute;
}

.yelpaze .card {
  position: absolute;
  width: var(--w);
  height: var(--h);
  /* Dik telefonda iki kat: sıra ve bölen kattan gelir (betik --i, --b, --s verir). */
  --idx: var(--i);
  --div: var(--b);
  --span: var(--s);
  --adim: min(calc(var(--w) + 6px), calc((100% - var(--w)) / var(--div)));
  left: calc((100% - (var(--span) * var(--adim) + var(--w))) / 2 + var(--idx) * var(--adim));
  top: var(--kat);
  z-index: calc(20 + var(--idx));
  transition: transform 120ms ease-out, box-shadow 120ms ease-out;
}

.yelpaze .card[data-tier="upper"] {
  top: 0;
  z-index: calc(1 + var(--idx));
}

[data-zone="hand"] .yelpaze {
  left: 0;
  right: 0;
  top: 6px;
  bottom: 6px;
  --w: var(--el-w);
  --h: var(--el-h);
  --kat: var(--el-kat);
  --kalk: 6px;
}

[data-zone="openhand"] .yelpaze {
  left: calc(var(--ic) + 2px);
  right: calc(var(--ic) + 2px);
  top: 6px;
  bottom: 10px;
  --w: var(--yer-w);
  --h: var(--yer-h);
  --kat: var(--yer-kat);
  --kalk: 4px;
}

/* Oynanabilir kart kalkar ve pirinç çerçeve alır; ayrım yalnız koyuluğa bağlı değildir. */
.yelpaze .card.is-playable {
  transform: translateY(calc(-1 * var(--kalk)));
  box-shadow: 0 0 0 2px var(--brass), 0 4px 10px rgba(0, 0, 0, .4);
}

/* Basılı (parmak kartın üstünde) ve gönderildi (sunucunun yanıtı bekleniyor). */
.yelpaze .card.is-playable:active,
.yelpaze .card.is-pending {
  transform: translateY(calc(-1 * var(--kalk) - 6px)) scale(1.04);
  box-shadow: 0 0 0 2px var(--brass), 0 8px 16px rgba(0, 0, 0, .45);
}

.yelpaze .card:focus-visible {
  outline: 3px solid var(--focus-felt);
  outline-offset: 1px;
}

[data-zone="hand"] .card:focus-visible {
  outline-color: var(--focus);
}

/* Dağıtım ve yerin açılması: kartlar sırayla yerine oturur. Görünürlük canlandırmaya bağlı değildir. */
.yelpaze--el.is-dealing .card {
  animation: deal 180ms var(--ease) backwards;
  animation-delay: calc(var(--i1) * 28ms);
}

.yelpaze--yer.is-opening .card {
  animation: reveal 200ms var(--ease) backwards;
  animation-delay: calc(var(--i1) * 30ms);
}

@keyframes deal {
  from { transform: translateY(24px) rotate(-4deg); }
}

@keyframes reveal {
  from { transform: translateY(-14px) scale(.9); }
}

/* --- Yerdeki kartlar (TASARIM 1.4, 3.6): sabit kutu, dört sabit yuva --- */

[data-part="trick"] {
  position: absolute;
  left: 50%;
  top: calc(var(--saha-bas) + (100% - var(--saha-bas) - var(--saha-son)) / 2);
  width: calc(var(--tk-w) + 2 * var(--tk-adim));
  height: calc(var(--tk-h) * 1.72);
  margin-left: calc(var(--tk-w) / -2 - var(--tk-adim));
  margin-top: calc(var(--tk-h) * -0.86);
  --w: var(--tk-w);
}

[data-slot],
.trick__win {
  position: absolute;
  width: var(--tk-w);
  height: var(--tk-h);
  border-radius: calc(var(--tk-w) * 0.07);
}

/* Yuvaların sırası sabittir (üst < sol < sağ < alt): dört kartın dördünün de sol üst indisi görünür. */
[data-slot="top"], .trick__win[data-at="top"] { left: var(--tk-adim); top: 0; }
[data-slot="left"], .trick__win[data-at="left"] { left: 0; top: calc(var(--tk-h) * 0.36); }
[data-slot="right"], .trick__win[data-at="right"] { left: calc(var(--tk-adim) * 2); top: calc(var(--tk-h) * 0.36); }
[data-slot="bottom"], .trick__win[data-at="bottom"] { left: var(--tk-adim); top: calc(var(--tk-h) * 0.72); }
[data-slot="top"] { z-index: 1; }
[data-slot="left"] { z-index: 2; }
[data-slot="right"] { z-index: 3; }
[data-slot="bottom"] { z-index: 4; }

[data-slot]:empty {
  border: 1.5px dashed rgba(255, 255, 255, .2);
}

[data-slot] > .card {
  width: 100%;
  height: 100%;
}

/* Eli kazanan kart: bütün kartların önünde, dokunulmaz çerçeve katmanı. Kartların sırası değişmez. */
.trick__win {
  z-index: 5;
  box-shadow: 0 0 0 3px var(--brass), 0 0 16px 4px rgba(242, 194, 77, .55);
  pointer-events: none;
}

.trick__ribbon {
  position: absolute;
  left: 50%;
  top: 0;
  z-index: 6;
  transform: translate(-50%, -60%);
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--brass);
  color: var(--brass-ink);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .4);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

/* --- Bilgi kartı (kart oynanmayan evrelerde) --- */

.orta {
  position: absolute;
  left: var(--ic);
  right: var(--ic);
  top: calc(var(--saha-bas) + var(--plaka-yan-h) + 4px);
  bottom: calc(var(--ic) + 40px + 4px);
  display: grid;
  place-items: center;
  pointer-events: none;
}

.bilgi {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: min(300px, 100%);
  max-height: 100%;
  padding: 8px 14px;
  overflow: hidden;
  border-radius: 12px;
  background: rgba(6, 26, 23, .7);
  text-align: center;
  line-height: 1.25;
}

.bilgi__1 {
  font-size: 14px;
  font-weight: 700;
}

.bilgi__2 {
  color: var(--felt-dim);
  font-size: 12px;
}

/* --- Köşe yuvaları: 44×40 px, yerleri sabit (TASARIM 4.4) --- */

.kose {
  position: absolute;
  z-index: 2;
  bottom: var(--ic);
  width: 44px;
  height: 40px;
}

.kose--sonel {
  appearance: none;
  left: var(--ic);
  padding: 0;
  border: 1.5px solid var(--plate-line);
  border-radius: 10px;
  background: var(--plate);
  color: var(--felt-text);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.1;
  cursor: pointer;
}

.kose--sonel[disabled] {
  opacity: .45;
  cursor: default;
}

.kose--sonel[aria-pressed="true"] {
  border-color: var(--brass);
  background: var(--brass);
  color: var(--brass-ink);
}

.kose--koz {
  right: var(--ic);
  display: grid;
  place-items: center;
}

.koz__bos {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1.5px dashed rgba(255, 255, 255, .5);
  border-radius: 50%;
  color: var(--felt-dim);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .06em;
}

.koz__rozet {
  width: 36px;
  height: 36px;
  padding: 7px;
  box-shadow: 0 0 0 2px var(--brass), 0 2px 6px rgba(0, 0, 0, .4);
}

/* --- Geçici baloncuk: yalnız eylem şeridinde düğme varken; alt plakanın üstüne biner, hiçbir şeyi itmez --- */

[data-part="toast"] {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: var(--ic);
  z-index: 8;
  display: grid;
  place-items: center;
  min-height: 30px;
  padding: 5px 10px;
  border: 2px solid var(--warm);
  border-radius: 10px;
  background: var(--warm-soft);
  color: var(--text);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .4);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  animation: toast-in 150ms ease-out;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(6px); }
}

/* ------------------------------------------------------------------ Eylem şeridi (TASARIM 1.8, 4.5) */

.eylem {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Karar bendeyken şeridin üst kenarında akan 3 px'lik süre çubuğu. */
.eylem__sure {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  border-radius: 2px;
  background: rgba(127, 127, 127, .25);
  overflow: hidden;
}

.eylem__surebar { background: var(--accent); }
.eylem__sure.is-low .eylem__surebar { background: var(--danger); }

.eylem__dugmeler {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 2px 0;
}

.eylem__dugmeler .btn {
  height: 44px;
  min-height: 44px;
  padding: 0 10px;
  font-size: 14px;
  white-space: nowrap;
}

.eylem__not {
  min-width: 0;
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.2;
}

/* Söz düğmeleri: modun bütün sözleri; söylenemeyenler de yerinde durur (kapalı). */
.eylem__dugmeler--bids {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(40px, 52px);
  gap: 4px;
}

.btn--bid {
  padding: 0;
  border-color: var(--card-edge);
  background: var(--card-face);
  color: var(--ink-black);
  font-size: 18px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.eylem__dugmeler .btn--bid {
  padding: 0;
  font-size: 18px;
}

.btn--bid[disabled] {
  opacity: .38;
}

.btn--pass {
  border: 2px solid var(--warm);
  background: var(--warm-soft);
  color: var(--text);
}

.eylem__dugmeler .btn--pass {
  padding: 0 4px;
}

/* Dik telefonda Herkes tek: on düğme beşerli iki sıra. */
.masa--tekli .eylem__dugmeler--bids {
  grid-auto-flow: row;
  grid-template-columns: repeat(5, minmax(40px, 64px));
  gap: 6px 4px;
}

/* Koz düğmeleri: maça, kupa, sinek, karo; eli atma hakkı varsa sona "Eli at". */
.eylem__dugmeler--trumps {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(56px, 76px);
  gap: 4px;
}

.eylem__dugmeler .btn--trump {
  flex-direction: column;
  gap: 1px;
  padding: 0 2px;
  font-size: 11.5px;
}

.btn__suit {
  width: 22px;
  height: 22px;
  padding: 3.5px;
}

.btn__label--genis { display: none; }

.eylem__dugmeler .btn--throw {
  font-size: 13px;
  white-space: normal;
  line-height: 1.05;
}

/* Metin kipi: tek ileti, en çok iki satır; iki yanda eş genişlikte sabit yuva (sağdaki: kalan süre). */
.eylem__metin {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  height: 100%;
}

.eylem__bos,
.eylem__sn {
  flex: 0 0 44px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.eylem__sn.is-low { color: var(--danger); }

.eylem__yazi {
  flex: 1 1 auto;
  min-width: 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
}

.eylem__yazi--status { color: var(--text); }
.eylem__yazi--notice { color: var(--muted); }
.eylem__yazi--mine { color: var(--accent); font-weight: 800; }
.eylem__yazi--hint { color: var(--warm); font-weight: 700; }
.eylem__yazi--error, .eylem__yazi--warn { color: var(--danger); font-weight: 700; }

/* ------------------------------------------------------------------ El bölgesi */

.el {
  position: relative;
}

.el__not {
  position: absolute;
  inset: 6px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 10px;
  border: 1.5px dashed var(--line);
  border-radius: 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.3;
  text-align: center;
  overflow: hidden;
}

.el__satir--ilk {
  color: var(--text);
  font-weight: 700;
}

.el__not--waiting .el__satir--ilk,
.el__not--pending .el__satir--ilk {
  font-weight: 600;
}

/* ------------------------------------------------------------------ Yazboz (TASARIM 5) */

/* 900 px'ten dar ekranda çuhanın tam üstüne binen katman: ızgaraya satır ya da sütun eklemez;
   üst çubuk, skor şeridi, eylem şeridi ve el açıkta kalır. */
.masa > [data-zone="yazboz"] {
  position: absolute;
  /* Mutlak konumlu ızgara çocuğunun kapsayan kutusu, iki çizgisi de verilen ızgara alanıdır: çuhanın kutusu. */
  grid-row: 3 / 4;
  grid-column: 1 / 2;
  inset: 0;
  z-index: 9;
  overflow: hidden;
  border-radius: 18px;
}

.yazboz-yeri {
  display: none;
}

.yz {
  --yz-cols: 28px 96px repeat(2, minmax(0, 1fr));
  display: flex;
  flex-direction: column;
  height: 100%;
  border: 1px solid var(--paper-line);
  border-radius: inherit;
  /* Defter sayfası: kâğıt zemin, solda 30. pikselde ince kırmızı kenar çizgisi. */
  background:
    linear-gradient(to right, transparent 29px, var(--paper-margin) 29px 30px, transparent 30px),
    var(--paper);
  color: var(--paper-ink);
  box-shadow: 0 6px 22px rgba(0, 0, 0, .35);
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  animation: yz-in 200ms var(--ease);
}

/* Herkes tek: altı sütun. Değişken tablonun kendisinde tanımlanır (satırlar onun içindedir); :has()
   gerekmez, iOS 15.0–15.3'te de altı hücre tek satıra dizilir. */
.yz__tablo--tekli {
  --yz-cols: 26px 54px repeat(4, minmax(0, 1fr));
}

@keyframes yz-in {
  from { transform: translateX(100%); }
}

.yz__bas {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 0 0 38px;
  border-bottom: 2px solid var(--paper-line);
}

.yz__baslik {
  font-size: 16px;
  font-weight: 800;
}

.yz__ayar {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px 8px;
  color: var(--paper-muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.15;
}

.yz__sinir:not(.is-empty) {
  padding: 0 6px;
  border: 1px solid currentColor;
  border-radius: 999px;
}

.yz__kapat {
  appearance: none;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--paper-ink);
  font-size: 24px;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
}

.yz :focus-visible {
  outline-color: var(--focus);
}

.yz__tablo {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.yz__govde {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.yz__satir {
  display: grid;
  grid-template-columns: var(--yz-cols);
  align-items: center;
  min-height: 40px;
  border-bottom: 1px solid var(--paper-line);
}

.yz__satir--kolon {
  flex: 0 0 auto;
  min-height: 32px;
  border-bottom-width: 2px;
  color: var(--paper-muted);
  font-size: 11px;
  font-weight: 800;
}

.yz__hucre {
  min-width: 0;
  padding: 2px 4px;
  line-height: 1.15;
}

.yz__hucre--tur {
  padding: 0;
  color: var(--paper-muted);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.yz__hucre--ihale {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding-left: 6px;
  font-size: 12px;
}

.yz__ihaleci,
.yz__kolon,
.yz__ortaklar {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.yz__ihaleci {
  font-weight: 600;
}

.yz__soz {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 800;
  white-space: nowrap;
}

.yz__koz {
  width: 16px;
  height: 16px;
  padding: 2.5px;
}

.yz__canli {
  color: var(--paper-muted);
  font-style: italic;
}

.yz__hucre--taraf {
  display: flex;
  flex-direction: column;
  gap: 1px;
  align-self: stretch;
  justify-content: center;
  text-align: right;
}

.yz__hucre--taraf.is-mine {
  background: var(--paper-mine);
}

.yz__satir--kolon .yz__hucre--taraf {
  color: var(--paper-ink);
  font-size: 12.5px;
}

.yz__kolon { display: block; }

.yz__ortaklar {
  display: block;
  color: var(--paper-muted);
  font-size: 10px;
  font-weight: 600;
}

.yz__puan {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.yz__delta {
  font-size: 14px;
  font-weight: 800;
}

.yz__delta--pos { color: var(--ok); }
.yz__delta--neg { color: var(--danger); }

/* Batan taraf: renk tek başına yetmez; puanın önünde çerçeveli "battı" yazısı. */
.yz__batti {
  padding: 0 4px;
  border: 1px solid currentColor;
  border-radius: 4px;
  color: var(--danger);
  font-size: 9.5px;
  font-weight: 800;
}

.yz__altsatir {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px;
  font-size: 11px;
  white-space: nowrap;
}

.yz__el {
  color: var(--paper-muted);
}

.yz__ara {
  font-weight: 600;
}

/* Süren tur: eğik yazı ve hafif pirinç zemin; puan yazılmaz. */
.yz__satir--suren {
  background: var(--paper-live);
  font-style: italic;
}

.yz__satir--suren .yz__hucre--taraf.is-mine {
  background: transparent;
}

.yz__satir--suren .yz__el {
  font-size: 12px;
  font-weight: 700;
}

.yz__uzadi {
  padding: 3px 8px 3px 38px;
  border-bottom: 1px solid var(--paper-line);
  background: var(--paper-live);
  color: var(--paper-ink);
  font-size: 11.5px;
  font-weight: 700;
  text-align: center;
}

.yz__bos {
  padding: 10px 8px 10px 38px;
  border-bottom: 1px solid var(--paper-line);
  color: var(--paper-muted);
  font-size: 13px;
}

.yz__satir--toplam {
  flex: 0 0 auto;
  grid-template-columns: var(--yz-cols);
  border-top: 2px solid var(--paper-line);
  border-bottom: 0;
}

.yz__hucre--toplam {
  grid-column: 1 / span 2;
  padding-left: 38px;
  font-size: 12.5px;
  font-weight: 800;
}

.yz__toplam {
  font-size: 15px;
  font-weight: 800;
}

.yz__kazanan {
  align-self: flex-end;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--brass);
  color: var(--brass-ink);
  font-size: 9.5px;
  font-weight: 800;
}

.yz__ayak {
  flex: 0 0 auto;
  padding: 4px 8px 6px 38px;
  border-top: 1px solid var(--paper-line);
  color: var(--paper-muted);
  font-size: 11.5px;
  line-height: 1.25;
}

.yz__alt {
  color: var(--paper-ink);
  font-weight: 700;
}

.yz__alt:empty,
.yz__not:empty {
  display: none;
}

.yz__ayak:not(:has(p:not(:empty))) {
  display: none;
}

/* ------------------------------------------------------------------ Pencereler */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: end center;
  padding: 10px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  background: rgba(8, 12, 18, 0.6);
}

.sheet__box {
  width: min(600px, 100%);
  max-height: 88vh;
  max-height: 88dvh;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 16px;
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  animation: sheet-in 180ms ease-out;
}

@keyframes sheet-in {
  from { transform: translateY(16px); }
}

.sheet__title {
  margin-bottom: 10px;
  font-size: 19px;
}

.sheet__body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sheet__headline {
  font-size: 20px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.sheet__line {
  font-size: 15px;
  overflow-wrap: anywhere;
}

.sheet__suit {
  margin-right: 6px;
}

.sheet__timer {
  min-height: 20px;
}

.sheet__last {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

.sheet__label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.rules__title {
  margin-top: 6px;
  font-size: 15px;
}

.rules__list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-left: 20px;
  font-size: 14px;
  line-height: 1.35;
}

/* Masadayken o masanın ayarlarına uyan satırlar öne çıkar. */
.rules__list li.is-mine {
  font-weight: 600;
}

.rules__tag {
  margin-left: 6px;
}

.sheet__foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

.rtable {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.rtable th,
.rtable td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-weight: 400;
}

.rtable thead th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.rtable .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.rtable__name {
  font-weight: 700;
  overflow-wrap: anywhere;
  margin-right: 6px;
}

.rtable tr.is-mine {
  background: var(--accent-soft);
}

.rtable tr.is-winner .rtable__name::before {
  content: "\2605\FE0E";
  margin-right: 4px;
}

.neg { color: var(--danger); }
.pos { color: var(--ok); }

/* ================================================================== Orta ekran (640–899 px; TASARIM 1.6)
   Tek sütun; el ve yer şeridi tek kat; dört plaka da iki satırlı; yan plakalar yerdeki kartların iki
   yanında, dikeyde ortada; yerdeki kartlar binişsiz üç sütun. */

@media (min-width: 640px) {
  .sheet {
    place-items: center;
  }

  .masa {
    --m: 16px;
    --g: 6px;
    --ust-h: 48px;
    --skor-h: 40px;
    --eylem-h: 52px;
    --kolon: min(calc(var(--gen) - 32px), 960px);
    --el-w: clamp(60px, min(calc(var(--kolon) * 0.092), calc(var(--yuk) * 0.11)), 92px);
    --el-kat: 0px;
    --el-zone: calc(8px + var(--el-h) + 8px);
    --yer-w: clamp(52px, min(calc(var(--kolon) * 0.075), calc(var(--yuk) * 0.09)), 72px);
    --yer-kat: 0px;
    --yer-zone: calc(8px + var(--yer-h) + 12px);
    --ic: 10px;
    --plaka-h: 46px;
    --plaka-yan-h: 46px;
    --plaka-yan-w: 148px;
    --plaka-orta-w: 200px;
    --tk-en-az: 52px;
    --alt-bosluk: 8px;
    --cuha-min: calc(var(--saha-bas) + 1.72 * 1.4 * var(--tk-en-az) + var(--saha-son));
    --tk-w: clamp(var(--tk-en-az), min(calc(var(--capraz-h) / 2.408), calc((var(--kolon) - 324px) / 3.16)), 96px);
    --tk-adim: calc(var(--tk-w) * 1.08);
    padding-bottom: 8px;
    min-height: calc(var(--ust-h) + var(--skor-h) + var(--cuha-min) + var(--eylem-h) + var(--el-zone) + 4 * var(--g) + 8px
                     + env(safe-area-inset-top, 0px) + env(safe-area-inset-bottom, 0px));
  }

  .masa--tekli { --eylem-h: 52px; }

  .topbar { gap: 8px; }
  .topbar__name { font-size: 16px; }
  .topbar__meta { font-size: 12.5px; }
  .tbtn { padding: 0 12px; font-size: 14px; }

  .plaka {
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: 4px;
    padding: 0 9px;
  }

  .plaka .plaka__ad { flex: 0 0 auto; }
  .plaka .plaka__bilgi { justify-content: space-between; min-height: 16px; }
  .plaka__name { font-size: 15px; }
  .plaka__move { align-items: flex-end; padding-bottom: 7px; }

  .plaka[data-pos="left"],
  .plaka[data-pos="right"] {
    top: calc(var(--saha-bas) + (100% - var(--saha-bas) - var(--saha-son)) / 2);
    margin-top: calc(var(--plaka-yan-h) / -2);
  }

  .orta {
    top: var(--saha-bas);
    bottom: var(--saha-son);
    left: calc(var(--ic) + var(--plaka-yan-w) + 4px);
    right: calc(var(--ic) + var(--plaka-yan-w) + 4px);
  }

  /* Tek kat: sıra ve bölen bütün elden gelir (betik --i1, --b1, --s1 verir). */
  .yelpaze .card,
  .yelpaze .card[data-tier="upper"] {
    --idx: var(--i1);
    --div: var(--b1);
    --span: var(--s1);
    top: 0;
    z-index: calc(20 + var(--idx));
  }

  [data-zone="hand"] .yelpaze { top: 8px; bottom: 8px; }
  [data-zone="openhand"] .yelpaze { top: 8px; bottom: 12px; }

  /* On söz düğmesi tek sıraya sığar. */
  .masa--tekli .eylem__dugmeler--bids {
    grid-auto-flow: column;
    grid-template-columns: none;
    grid-auto-columns: minmax(40px, 52px);
    gap: 4px;
  }

  .eylem__dugmeler--trumps {
    grid-auto-columns: minmax(96px, 132px);
  }

  .eylem__dugmeler .btn--trump {
    flex-direction: row;
    gap: 6px;
    font-size: 14px;
  }

  .btn__label--kisa { display: none; }
  .btn__label--genis { display: inline; }

  .eylem__yazi { font-size: 15px; }

  /* Yazboz: çuhanın sağ kenarına yaslı 320 px'lik çekmece. */
  .masa > [data-zone="yazboz"] {
    left: auto;
    width: 320px;
  }
}

/* ================================================================== Geniş ekran (900 px ve üstü)
   İki sütun: masa ve yazboz. Yazboz sütunu her zaman ayrılıdır: açıp kapatmak masayı kıpırdatmaz. */

@media (min-width: 900px) {
  .masa {
    --yazboz-w: clamp(280px, 26vw, 320px);
    --kolon: min(calc(var(--gen) - 32px - var(--yazboz-w) - 16px), 960px);
    grid-template-columns: minmax(0, var(--kolon)) var(--yazboz-w);
    column-gap: 16px;
  }

  .masa > [data-zone="yazboz"],
  .yazboz-yeri {
    position: static;
    grid-column: 2 / 3;
    grid-row: 1 / -1;
    width: auto;
    border-radius: 14px;
    margin-top: 6px;
  }

  .yz {
    animation: none;
  }

  .yazboz-yeri {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    border: 2px dashed var(--line);
    color: var(--muted);
  }

  .yazboz-yeri__yazi {
    font-size: 14px;
    font-weight: 600;
  }
}

/* ------------------------------------------------------------------ Azaltılmış hareket (TASARIM 7)
   Bütün canlandırmalar ve geçişler kapanır; kartlar, yelpaze ve yazboz yeni yerlerine anında geçer.
   Duruşlar (oynanan kart 350 ms, kapanan el 1200 ms) olay kuyruğundadır ve kısalmaz. */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  /* Eski tarayıcı uyarısının on saniyelik beklemesi hareket değildir; kalır. */
  .boot__eski {
    animation: eski-bekle 10s !important;
  }
}
