/* 101 okey ve eşli 101 okey ortak ekran stili. Taşlar resimsiz: CSS + Unicode simge. */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: #13261d;
  background: #1f5a3f;
  background-image: radial-gradient(ellipse at 50% 35%, #2d7652 0%, #1f5a3f 70%);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; }
[hidden] { display: none !important; }
.gizli-baslik { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.oyun { height: 100%; max-width: 56rem; margin: 0 auto; padding: 0.3rem 0.35rem 0.35rem; display: flex; flex-direction: column; gap: 0.28rem; }

/* Üst çubuk */
.ust { display: flex; align-items: center; gap: 0.3rem; color: #eaf6ef; font-size: 0.74rem; font-weight: 700; flex: none; }
.ust .el-bilgi { margin-right: auto; white-space: nowrap; }
.el-sayisi { display: flex; align-items: center; gap: 0.2rem; }
.el-sayisi span { white-space: nowrap; }
.dugme { min-height: 2.2rem; padding: 0.2rem 0.4rem; border: 0; border-radius: 9px; background: #f2b13c; color: #2b1a00; font-weight: 800; font-size: 0.8rem; cursor: pointer; line-height: 1.1; }
.dugme--ikinci { background: #f4f1e6; color: #1d4a35; }
.dugme--kucuk { min-height: 1.9rem; min-width: 1.9rem; padding: 0.1rem 0.35rem; font-size: 0.76rem; }
.dugme[aria-pressed="true"] { background: #f2b13c; color: #2b1a00; box-shadow: inset 0 0 0 2px #fff6dd; }
.dugme:disabled { opacity: 0.42; cursor: default; }
.dugme:hover:not(:disabled) { filter: brightness(1.06); }
button:focus-visible, select:focus-visible { outline: 3px solid #ffd76a; outline-offset: 2px; }
@media (max-width: 360px) { .el-sayisi > span { display: none; } }
.ust select { font: inherit; min-height: 1.9rem; padding: 0.1rem 0.2rem; border: 0; border-radius: 9px; background: #f4f1e6; color: #1d4a35; font-weight: 800; font-size: 0.76rem; max-width: 6.2rem; cursor: pointer; }

/* Oyuncular */
.oyuncular { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.25rem; flex: none; }
.oyuncu { background: rgba(255, 255, 255, 0.92); border-radius: 9px; padding: 0.15rem 0.3rem; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto; column-gap: 0.2rem; align-items: center;
  border: 2px solid transparent; min-width: 0; font-size: 0.68rem; line-height: 1.2; }
.oyuncu.sirada { border-color: #f2b13c; box-shadow: 0 0 0 2px rgba(242, 177, 60, 0.35); }
.oyuncu.takim { background: #fff7df; }
.oyuncu .ad { font-weight: 800; font-size: 0.74rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.oyuncu .puan { font-weight: 900; font-variant-numeric: tabular-nums; font-size: 0.78rem; text-align: right; }
.oyuncu .durum { color: #3c5a4b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.oyuncu .son { grid-row: 2; grid-column: 2; justify-self: end; }
.takim-cubuk { display: flex; justify-content: center; gap: 0.8rem; color: #eaf6ef; font-size: 0.74rem; font-weight: 800; flex: none; }
.takim-cubuk b { color: #ffd76a; font-variant-numeric: tabular-nums; }

/* Masa */
.masa { flex: 1 1 auto; min-height: 4rem; overflow-y: auto; overscroll-behavior: contain; background: rgba(0, 0, 0, 0.16); border-radius: 10px; padding: 0.3rem;
  display: flex; flex-wrap: wrap; align-content: flex-start; gap: 0.3rem; box-shadow: inset 0 1px 6px rgba(0, 0, 0, 0.25); }
.masa:focus-visible { outline: 3px solid #ffd76a; outline-offset: -3px; }
.masa .bos-yazi { color: #cfe6d9; font-size: 0.76rem; margin: auto; text-align: center; padding: 0.5rem; }
.per { display: inline-flex; align-items: center; gap: 1px; padding: 0.18rem 0.22rem 0.18rem 0.15rem; border-radius: 7px; border: 2px solid transparent; background: rgba(255, 255, 255, 0.12); cursor: default; color: #fff; max-width: 100%; flex-wrap: wrap; }
.per .sahip { font-size: 0.56rem; font-weight: 800; color: #d7efe2; writing-mode: vertical-rl; transform: rotate(180deg); margin-right: 2px; letter-spacing: 0.02em; }
.per.benim .sahip { color: #ffd76a; }
.per.islenebilir { border-color: #ffd76a; background: rgba(255, 215, 106, 0.22); cursor: pointer; }
.per.yeni { box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.55); }

/* Orta: deste, gösterge, soldaki taş */
.orta { display: flex; align-items: stretch; gap: 0.3rem; flex: none; }
.orta .dugme { flex: 1 1 0; display: flex; align-items: center; justify-content: center; gap: 0.3rem; min-width: 0; }
.gosterge { display: flex; align-items: center; gap: 0.3rem; background: rgba(0, 0, 0, 0.2); color: #eaf6ef; border-radius: 9px; padding: 0.15rem 0.4rem; font-size: 0.68rem; font-weight: 700; line-height: 1.15; flex: 0 1 auto; }
.mesaj { margin: 0; color: #fff; font-weight: 700; font-size: 0.78rem; line-height: 1.25; min-height: 2.5em; text-align: center; display: flex; align-items: center; justify-content: center; flex: none; }

/* Ayrılan perler (açılış hazırlığı) */
.ayrilan { display: flex; gap: 0.3rem; align-items: center; overflow-x: auto; flex: none; min-height: 1.6rem; }
.ayrilan .sayac { color: #2b1a00; background: #ffd76a; border-radius: 99px; padding: 0.1rem 0.45rem; font-weight: 900; font-size: 0.74rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ayrilan .sayac.tamam { background: #8fe3a7; }
.ayrilan .parca { color: #eaf6ef; font-size: 0.7rem; font-weight: 700; white-space: nowrap; background: rgba(0, 0, 0, 0.2); border-radius: 6px; padding: 0.1rem 0.35rem; }

/* Eylem düğmeleri */
.eylemler { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 0.25rem; flex: none; }
.eylemler .dugme { padding: 0.15rem 0.1rem; font-size: 0.76rem; }

/* Istaka: iki sıra, 13'er yuva */
.istaka { flex: none; width: 100%; max-width: calc(13 * 3.1rem + 1.4rem); margin: 0 auto; background: linear-gradient(#a8743f, #8a5a2b); border-radius: 8px; padding: 0.22rem; display: grid;
  grid-template-columns: repeat(13, minmax(0, 1fr)); gap: 0.22rem 0.12rem; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35); }
.yuva { aspect-ratio: 0.7; border-radius: 5px; background: rgba(0, 0, 0, 0.12); border: 0; padding: 0; min-width: 0; position: relative; }
.yuva.hedef { background: rgba(255, 215, 106, 0.35); cursor: pointer; }

/* Taş */
.tas { width: 100%; height: 100%; border: 0; padding: 0; border-radius: 5px; background: linear-gradient(#fffdf6, #efe6cf); box-shadow: 0 2px 0 #c9b88f, 0 2px 4px rgba(0, 0, 0, 0.3);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; cursor: pointer; position: relative; font-weight: 900; line-height: 1; touch-action: manipulation; }
.tas .no { font-size: clamp(0.8rem, 3.6cqw, 1.45rem); font-variant-numeric: tabular-nums; }
.tas .simge { font-size: clamp(0.45rem, 2cqw, 0.8rem); margin-top: 1px; }
.istaka { container-type: inline-size; }
.r0 { color: #b87700; }
.r1 { color: #1857b8; }
.r2 { color: #1d1d1d; }
.r3 { color: #c42121; }
.tas.sahte { color: #0f7a46; }
.tas.okey::after { content: "★"; position: absolute; top: 1px; right: 2px; font-size: 0.5rem; color: #d48a00; }
.tas.secili { transform: translateY(-18%); box-shadow: 0 0 0 2px #f2b13c, 0 4px 6px rgba(0, 0, 0, 0.35); }
.tas.ayrildi { opacity: 0.4; cursor: default; }
.tas.ayrildi::before { content: attr(data-grup); position: absolute; bottom: 1px; right: 2px; font-size: 0.5rem; color: #333; }
.tas.zorunlu { box-shadow: 0 0 0 2px #e8492b, 0 2px 4px rgba(0, 0, 0, 0.3); }
.tas.yeni { background: linear-gradient(#fff7d6, #f3e1a7); }

/* Küçük taş (masa, oyuncu kartı, gösterge) */
.mini { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; width: 1.3rem; height: 1.75rem; border-radius: 3px; background: linear-gradient(#fffdf6, #efe6cf);
  font-weight: 900; font-size: 0.82rem; line-height: 1; box-shadow: 0 1px 0 #c9b88f; flex: none; position: relative; }
.mini .simge { font-size: 0.42rem; }
.mini.joker { box-shadow: 0 1px 0 #c9b88f, inset 0 0 0 1.5px #f2b13c; }
.mini.kucuk { width: 1.05rem; height: 1.4rem; font-size: 0.7rem; }
.mini.bos { background: rgba(0, 0, 0, 0.12); box-shadow: none; }

/* Örtü (el sonu, maç sonu) */
.ortu { position: fixed; inset: 0; background: rgba(8, 30, 20, 0.6); display: grid; place-items: center; padding: 0.6rem; z-index: 5; }
.panel { background: #fff; border-radius: 14px; padding: 0.8rem 0.9rem; width: min(30rem, 100%); max-height: 100%; overflow-y: auto; text-align: center; display: flex; flex-direction: column; gap: 0.45rem; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3); }
.panel h2 { margin: 0; color: #1d6f4f; font-size: 1.2rem; }
.panel p { margin: 0; line-height: 1.4; font-size: 0.86rem; }
.panel .dugmeler { display: flex; gap: 0.5rem; justify-content: center; flex-wrap: wrap; }
.panel .dugme { padding: 0.4rem 0.9rem; }
.panel .dugme--ikinci { box-shadow: inset 0 0 0 2px #b3d6c6; }
.cetvel { width: 100%; border-collapse: collapse; font-size: 0.76rem; }
.cetvel th, .cetvel td { padding: 0.22rem 0.2rem; border-bottom: 1px solid #e3ece7; text-align: left; vertical-align: middle; }
.cetvel td.sayi, .cetvel th.sayi { text-align: right; font-variant-numeric: tabular-nums; font-weight: 800; white-space: nowrap; }
.cetvel .kalan { display: flex; flex-wrap: wrap; gap: 1px; margin-top: 2px; }
.cetvel tr.sen td { background: #fff7df; }
.cetvel tfoot td { font-weight: 900; }

@media (min-width: 640px) and (min-height: 600px) {
  .oyun { padding: 0.6rem 0.8rem; gap: 0.4rem; }
  .ust, .oyuncu, .mesaj { font-size: 0.86rem; }
  .oyuncu .ad, .oyuncu .puan { font-size: 0.9rem; }
  .oyuncu { padding: 0.25rem 0.5rem; }
  .dugme { font-size: 0.9rem; min-height: 2.4rem; }
  .eylemler .dugme { font-size: 0.88rem; }
  .gosterge { font-size: 0.8rem; }
  .mini { width: 1.55rem; height: 2.1rem; font-size: 1rem; }
  .masa { padding: 0.45rem; gap: 0.4rem; }
}
@media (max-height: 560px) {
  .mesaj { min-height: 2.2em; font-size: 0.72rem; }
  .oyuncu { font-size: 0.62rem; }
  .mini { width: 1.15rem; height: 1.5rem; font-size: 0.72rem; }
  .dugme { min-height: 2rem; }
}
@media (prefers-reduced-motion: no-preference) {
  .tas { transition: transform 0.12s ease-out; }
  .per.yeni { animation: belir 0.5s ease-out; }
  @keyframes belir { from { transform: scale(0.85); opacity: 0.4; } to { transform: scale(1); opacity: 1; } }
}
