/* Okey ailesi ortak ekran stili (okey, eşli okey, çanak okey) */
*, *::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: #f4efe2;
  background: #0f3a2c;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
button, select { 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: 62rem; margin: 0 auto; padding: 0.35rem 0.4rem 0.4rem;
  display: grid; gap: 0.3rem; grid-template-rows: auto minmax(0, 1fr) auto auto auto;
}

/* Üst çubuk */
.ust { display: flex; gap: 0.3rem; align-items: center; min-width: 0; }
.dugme {
  min-height: 2.5rem; padding: 0.25rem 0.55rem; border: 0; border-radius: 10px; background: #f0b429; color: #2b1d00;
  font-weight: 800; font-size: 0.86rem; cursor: pointer; line-height: 1.1; touch-action: manipulation;
}
.dugme--ikinci { background: #e9f3ee; color: #12402f; }
.dugme--yesil { background: #2fbf5b; color: #04230f; }
.dugme:disabled { opacity: 0.4; cursor: default; }
.dugme:hover:not(:disabled) { filter: brightness(1.07); }
.dugme:focus-visible, select:focus-visible, .yuva:focus-visible, .yer:focus-visible, .deste:focus-visible {
  outline: 3px solid #ffd166; outline-offset: 2px;
}
select {
  min-height: 2.5rem; padding: 0.15rem 0.3rem; border-radius: 10px; border: 2px solid #3f7d64; background: #f4efe2;
  color: #12402f; font-weight: 700; font-size: 0.84rem; max-width: 7.5rem;
}
.ust .bilgi { margin-left: auto; display: flex; gap: 0.3rem; align-items: center; font-weight: 800; font-size: 0.82rem; white-space: nowrap; }
.rozet { background: rgba(0, 0, 0, 0.28); border-radius: 999px; padding: 0.25rem 0.55rem; }
.rozet--canak { background: #f0b429; color: #2b1d00; }

/* Masa */
.masa {
  min-height: 0; position: relative; border-radius: 16px; padding: 0.35rem;
  background: radial-gradient(ellipse at 50% 45%, #23845e 0%, #18664a 60%, #12553d 100%);
  box-shadow: inset 0 0 0 3px #0b3326, inset 0 0 22px rgba(0, 0, 0, 0.35);
  display: grid; gap: 0.25rem; grid-template-columns: 1fr 1.2fr 1fr; grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas: "y2 k2 y1" "k3 orta k1" "y3 k0 y0";
  container-type: size;
}
.koltuk {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.1rem; text-align: center;
  font-size: 0.78rem; font-weight: 700; min-width: 0;
}
.koltuk .kart { background: rgba(0, 0, 0, 0.3); border: 2px solid transparent; border-radius: 10px; padding: 0.2rem 0.45rem; max-width: 100%; }
.koltuk.sirada .kart { border-color: #ffd166; background: rgba(255, 209, 102, 0.2); }
.koltuk .ad { display: block; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.koltuk .puan { display: block; font-size: 1.05rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.koltuk .tas-sayi { display: block; font-size: 0.68rem; opacity: 0.85; font-weight: 600; }
.koltuk.esin .kart { box-shadow: inset 0 0 0 2px #7fd1ff; }
.k0 { grid-area: k0; } .k1 { grid-area: k1; } .k2 { grid-area: k2; } .k3 { grid-area: k3; }
.k0 { flex-direction: row; gap: 0.3rem; }
.k0 .kart { display: flex; gap: 0.4rem; align-items: baseline; }

.yer {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.1rem; min-width: 0;
  border-radius: 10px; border: 2px dashed rgba(255, 255, 255, 0.22); padding: 0.15rem; background: rgba(0, 0, 0, 0.12);
  color: inherit; font-size: 0.66rem; font-weight: 700; position: relative;
}
.y0 { grid-area: y0; } .y1 { grid-area: y1; } .y2 { grid-area: y2; } .y3 { grid-area: y3; }
button.yer { cursor: default; padding: 0.15rem; }
.yer.alinir { border-color: #ffd166; border-style: solid; cursor: pointer; background: rgba(255, 209, 102, 0.16); }
.yer.hedef { border-color: #f0b429; border-style: solid; cursor: pointer; }
.yer.ustunde { background: rgba(255, 209, 102, 0.35); }
.yer .etiket { opacity: 0.9; white-space: nowrap; }
.yer .adet { position: absolute; top: 2px; right: 5px; font-size: 0.62rem; opacity: 0.8; }

.orta { grid-area: orta; display: flex; align-items: center; justify-content: center; gap: 0.6rem; min-width: 0; }
.deste {
  border: 0; padding: 0; background: none; color: inherit; display: flex; flex-direction: column; align-items: center; gap: 0.12rem;
  font-size: 0.66rem; font-weight: 700; cursor: default; border-radius: 10px;
}
.deste .sirt {
  width: var(--tg, 2.6rem); height: calc(var(--tg, 2.6rem) * 1.38); border-radius: 6px;
  background: repeating-linear-gradient(45deg, #b5462f 0 5px, #c9573e 5px 10px); box-shadow: 0 0 0 2px #fff4dd, 2px 3px 0 #7a2a19, 4px 6px 0 #5c1f12;
  display: grid; place-items: center; color: #fff4dd; font-weight: 900; font-size: 0.9rem;
}
.deste.alinir { cursor: pointer; }
.deste.alinir .sirt { box-shadow: 0 0 0 3px #ffd166, 2px 3px 0 #7a2a19, 4px 6px 0 #5c1f12; }
.gosterge-kutu { display: flex; flex-direction: column; align-items: center; gap: 0.12rem; font-size: 0.66rem; font-weight: 700; text-align: center; }
.gosterge-kutu .okey-yazi { font-size: 0.64rem; opacity: 0.9; max-width: 6.5rem; line-height: 1.15; }

/* Taş */
.masa { --tg: clamp(1.8rem, 11cqh, 3.1rem); }
.tas {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: linear-gradient(180deg, #fffdf6 0%, #f3ead2 100%); border-radius: 6px; color: #1a1a1a;
  box-shadow: 0 2px 0 #c9b98f, 0 3px 4px rgba(0, 0, 0, 0.35); user-select: none; -webkit-user-select: none;
  font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums;
}
.masa .tas { width: var(--tg); height: calc(var(--tg) * 1.38); font-size: calc(var(--tg) * 0.56); }
.tas .sayi { display: block; }
.tas .isaret { display: block; font-size: 0.42em; margin-top: 0.12em; }
.tas.r0 { color: #b77300; }
.tas.r1 { color: #1d5bc2; }
.tas.r2 { color: #1a1a1a; }
.tas.r3 { color: #cc1f1f; }
.tas.sahte { color: #1f7a46; }
.tas.sahte .sayi { font-size: 0.95em; }
.tas.joker::after {
  content: "★"; position: absolute; top: 2%; right: 5%; font-size: 0.42em; color: #e0a100;
  text-shadow: 0 0 1px #6b4a00;
}

/* Istaka */
.istaka {
  background: linear-gradient(180deg, #8a5a2b 0%, #6e4520 100%); border-radius: 12px; padding: 0.3rem 0.3rem 0.35rem;
  box-shadow: inset 0 2px 0 #a8743d, 0 3px 8px rgba(0, 0, 0, 0.4);
  display: grid; gap: 0.3rem 0.18rem; grid-template-columns: repeat(var(--sutun, 10), minmax(0, 1fr));
  width: 100%; max-width: calc(var(--sutun, 10) * 3.6rem); margin: 0 auto; touch-action: none;
}
.yuva {
  aspect-ratio: 5 / 7; border: 0; padding: 0; margin: 0; background: rgba(0, 0, 0, 0.16); border-radius: 6px;
  container-type: size; cursor: pointer; position: relative; min-width: 0; color: inherit;
}
.yuva .tas { width: 100%; height: 100%; font-size: min(64cqw, 46cqh); }
@media (prefers-reduced-motion: no-preference) {
  .yuva .tas { transition: transform 0.12s ease-out; }
  .dugme--parla { animation: parla 1.2s ease-in-out infinite; }
  @keyframes parla { 50% { box-shadow: 0 0 0 4px rgba(47, 191, 91, 0.5); } }
}
.yuva.secili .tas { transform: translateY(-14%); box-shadow: 0 0 0 3px #ff9f1c, 0 5px 6px rgba(0, 0, 0, 0.4); }
.yuva.bitirir .tas { box-shadow: 0 0 0 3px #2fbf5b, 0 0 10px 2px rgba(47, 191, 91, 0.9); }
.yuva.secili.bitirir .tas { box-shadow: 0 0 0 3px #ff9f1c, 0 0 10px 3px rgba(47, 191, 91, 0.95); }
.yuva.yeni .tas { box-shadow: 0 0 0 2px #7fd1ff, 0 3px 4px rgba(0, 0, 0, 0.35); }
.yuva.ustunde { background: rgba(255, 209, 102, 0.45); }
.yuva.kaynak .tas { opacity: 0.35; }

.hayalet { position: fixed; left: 0; top: 0; pointer-events: none; z-index: 20; opacity: 0.92; }
.hayalet.tas { box-shadow: 0 8px 16px rgba(0, 0, 0, 0.45); }

.mesaj {
  margin: 0; min-height: 2.3em; display: flex; align-items: center; justify-content: center; text-align: center;
  font-size: 0.82rem; font-weight: 700; line-height: 1.2;
}
.dugmeler { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.3rem; }
.dugmeler.goster-var { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.dugmeler .dugme { padding: 0.25rem 0.2rem; font-size: 0.82rem; }
.klavye { margin: 0; font-size: 0.7rem; opacity: 0.8; text-align: center; }
@media (max-width: 700px), (max-height: 600px) { .klavye { display: none; } }
@media (max-width: 380px) {
  .dugme { font-size: 0.78rem; }
  .dugmeler .dugme { font-size: 0.74rem; }
  .masa { grid-template-columns: 1fr 1.05fr 1fr; }
}
@media (max-height: 560px) {
  .oyun { gap: 0.22rem; padding-top: 0.25rem; }
  .dugme, select { min-height: 2.25rem; }
  .mesaj { min-height: 2.1em; font-size: 0.76rem; }
  .koltuk .tas-sayi { display: none; }
  .yer .etiket { font-size: 0.6rem; }
}

/* Örtü */
.ortu { position: fixed; inset: 0; background: rgba(4, 20, 14, 0.6); display: grid; place-items: center; padding: 0.7rem; z-index: 30; }
.panel {
  background: #fffdf6; color: #14302a; border-radius: 16px; padding: 0.9rem 1rem; width: min(26rem, 100%); max-height: 100%;
  overflow: auto; display: flex; flex-direction: column; gap: 0.5rem; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35); text-align: center;
}
.panel h2 { margin: 0; color: #12553d; font-size: 1.25rem; }
.panel p { margin: 0; line-height: 1.4; font-size: 0.9rem; }
.panel table { border-collapse: collapse; width: 100%; font-size: 0.86rem; }
.panel th, .panel td { padding: 0.22rem 0.3rem; border-bottom: 1px solid #e3dccb; }
.panel td.sayi { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.panel .eksi { color: #b3261e; }
.panel .arti { color: #1b7a3e; }
.panel .el-goster { display: flex; flex-wrap: wrap; gap: 0.35rem; justify-content: center; }
.panel .el-goster .parca { display: flex; gap: 2px; }
.panel .el-goster .tas { width: 1.6rem; height: 2.2rem; font-size: 0.95rem; }
.panel .dugmeler-p { display: flex; gap: 0.5rem; justify-content: center; flex-wrap: wrap; }
.panel .dugme { padding: 0.4rem 0.9rem; }
.panel .not { font-size: 0.8rem; color: #2a6150; }
