/* DESTAN — Kart Destanı
   Tasarım dili: yeşil çuha masa (kahvehane) + sıcak ahşap + altın vurgular.
   Kartlar DOM/CSS ile çizilir → her ölçekte keskin tipografi. */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --felt: #123a2e;          /* çuha masa */
  --felt2: #0d2b22;
  --wood: #2a1d14;
  --panel: #1a2b25;
  --panel2: #22382f;
  --line: #33564a;
  --gold: #e8c04a;
  --text: #eef5f1;
  --dim: #8fae a2;
  --dim: #91a89e;
  --red: #e2445c;
  --blue: #3b82f6;
  --yellow: #eab308;
  --black: #2f3646;
  --mult: #ff5f6d;
  --chip: #4ea8ff;
  --radius: 12px;
}
html, body { height: 100%; overflow: hidden; }
body {
  background: var(--felt2);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  user-select: none; -webkit-user-select: none;
  touch-action: manipulation;
}
.hidden { display: none !important; }
button { font-family: inherit; color: inherit; cursor: pointer; border: none; background: none; }
button:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- Giriş ekranı ---------- */
#titleScreen {
  position: fixed; inset: 0; z-index: 200;
  background: radial-gradient(ellipse at 50% 35%, #1b4f3e 0%, #0a201a 70%);
  display: flex; align-items: center; justify-content: center; text-align: center;
}
.titleLogo { font-size: 78px; line-height: 1; animation: float 3.4s ease-in-out infinite; }
@keyframes float { 0%,100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-12px) rotate(3deg); } }
.titleInner h1 {
  font-size: 54px; letter-spacing: 10px; margin: 10px 0 0; font-weight: 800;
  background: linear-gradient(180deg, #fff6d8, var(--gold));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 16px rgba(232,192,74,.35));
}
.titleSub { color: var(--dim); letter-spacing: 6px; font-size: 12px; text-transform: uppercase; margin-bottom: 34px; }
.titlePlay {
  font-size: 19px; font-weight: 700; padding: 14px 60px; border-radius: 14px;
  background: linear-gradient(135deg, #2e7d5b, #1b5540);
  border: 1px solid #4aa17b; color: #fff;
  box-shadow: 0 6px 24px rgba(46,125,91,.45);
  transition: transform .12s;
}
.titlePlay:hover { transform: scale(1.05); }
.titleModes { display: flex; gap: 10px; justify-content: center; margin-top: 14px; }
.titleModes button {
  padding: 10px 20px; font-size: 14px; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--line);
}
.titleModes button:hover { background: var(--panel2); }
.titleFoot { margin-top: 40px; font-size: 11px; color: #4d6a5f; }

/* ---------- Üst bar ---------- */
#topbar {
  height: 50px; display: flex; align-items: center; gap: 14px; padding: 0 16px;
  background: linear-gradient(180deg, #24382f, #1a2b25);
  border-bottom: 2px solid #0c1f19;
}
.logo { font-weight: 800; letter-spacing: 2px; font-size: 15px; white-space: nowrap; }
.logo span { color: var(--gold); }
.anteBox, .roundBox, .res {
  display: flex; align-items: baseline; gap: 6px;
  background: #0f2620; border: 1px solid var(--line);
  padding: 5px 12px; border-radius: 10px; white-space: nowrap;
}
.anteBox small { font-size: 9.5px; color: var(--dim); letter-spacing: 1.2px; }
.anteBox b { font-size: 17px; color: var(--gold); }
.anteMax { font-size: 11px; color: var(--dim); }
.roundBox { font-size: 12.5px; font-weight: 600; }
.roundBox.boss { border-color: #7a2e3a; background: #33161d; color: #ff9a9a; }
.res.gold b { color: var(--gold); font-size: 16px; }
.ctrl { display: flex; gap: 6px; margin-left: auto; }
.iconbtn {
  padding: 6px 11px; font-size: 14px; border-radius: 9px;
  background: var(--panel2); border: 1px solid var(--line);
}
.iconbtn:hover { background: #2c4a3e; }

/* ---------- Düzen ---------- */
main { display: flex; height: calc(100vh - 50px); }
#leftPanel {
  width: 220px; flex-shrink: 0; display: flex; flex-direction: column; gap: 8px;
  padding: 10px; background: #16261f; border-right: 2px solid #0c1f19; overflow-y: auto;
}
.panelSec { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; }
.panelSec.grow { flex: 1; min-height: 0; overflow-y: auto; }
.panelTitle {
  font-size: 10px; letter-spacing: 1.4px; text-transform: uppercase;
  color: var(--dim); margin-bottom: 7px; display: flex; justify-content: space-between;
}
#board {
  flex: 1; min-width: 0; display: flex; flex-direction: column;
  background: radial-gradient(ellipse at 50% 40%, var(--felt) 0%, var(--felt2) 75%);
  position: relative; overflow: hidden;
}

/* ---------- Hedef ---------- */
#targetArea {
  padding: 14px 20px 10px; text-align: center; position: relative;
  background: linear-gradient(180deg, rgba(8,26,20,.55), transparent);
  border-bottom: 1px solid rgba(51,86,74,.5);
}
.targetTop { font-size: 11px; letter-spacing: 2px; color: var(--dim); }
.targetTop b { font-size: 24px; color: var(--text); margin-left: 8px; letter-spacing: 0; }
#scoreBar {
  height: 14px; margin: 9px auto 0; max-width: 620px;
  background: #0a1e18; border: 1px solid var(--line); border-radius: 999px; overflow: hidden;
  box-shadow: inset 0 2px 5px rgba(0,0,0,.5);
}
#scoreFill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #2e9e6b, #6ee7a8, var(--gold));
  box-shadow: 0 0 12px rgba(110,231,168,.5);
  transition: width .35s cubic-bezier(.2,.8,.3,1);
}
#scoreVal {
  font-size: 40px; font-weight: 900; margin-top: 6px; color: var(--gold);
  letter-spacing: -1px; text-shadow: 0 0 22px rgba(232,192,74,.35);
  font-variant-numeric: tabular-nums; line-height: 1.05;
}
#bossBadge {
  display: inline-block; margin-bottom: 6px; padding: 4px 12px; border-radius: 999px;
  background: #33161d; border: 1px solid #7a2e3a; color: #ff9a9a;
  font-size: 11.5px; font-weight: 700;
}
#bossBadge small { display: block; font-weight: 400; color: #d8a0a8; font-size: 10px; }

/* ---------- Oyun alanı ---------- */
#playArea {
  flex: 1; min-height: 170px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 12px; position: relative;
}
/* Boş masa: kartların konacağı yeri gösteren zarif yuvalar */
#playedCards {
  display: flex; gap: 8px; min-height: 116px; align-items: center;
  padding: 0 10px; border-radius: 14px;
}
#playedCards:empty::before {
  content: ''; display: block; width: 400px; height: 112px;
  border: 2px dashed rgba(80,124,108,.4); border-radius: 14px;
  background: radial-gradient(ellipse at center, rgba(30,80,62,.28), transparent 70%);
}
#playedCards:not(:empty) ~ #emptyHint { display: none; }
#emptyHint {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  font-size: 12.5px; color: rgba(145,168,158,.7); letter-spacing: .3px;
  pointer-events: none; text-align: center; line-height: 1.6;
}
#emptyHint b { color: var(--gold); }
#handReadout {
  display: flex; align-items: center; gap: 14px;
  background: #0b2019; border: 1px solid var(--line); border-radius: 12px;
  padding: 8px 18px;
}
#hrName { font-size: 15px; font-weight: 700; color: var(--gold); }
#hrCalc { display: flex; align-items: center; gap: 8px; font-size: 20px; font-weight: 800; }
#hrChips { color: var(--chip); }
#hrCalc i { color: var(--dim); font-style: normal; font-size: 15px; }
#hrMult { color: var(--mult); }
#scorePopup {
  position: absolute; top: 26%; left: 50%; transform: translateX(-50%);
  font-size: 46px; font-weight: 900; color: var(--gold);
  text-shadow: 0 0 26px rgba(232,192,74,.65), 0 3px 10px #000;
  pointer-events: none; animation: popScore 1.1s ease-out forwards;
}
@keyframes popScore {
  0% { opacity: 0; transform: translateX(-50%) scale(.5); }
  20% { opacity: 1; transform: translateX(-50%) scale(1.12); }
  35% { transform: translateX(-50%) scale(1); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-40px) scale(1); }
}

/* ---------- OKEY TAŞLARI ----------
   Gerçek Okey taşı gibi: fildişi gövde, hafif kabartma, ortada BÜYÜK renkli sayı.
   Taşta koz/sembol yoktur — sol üstteki minik işaret sadece renk körlüğü desteği. */
.card {
  position: relative; width: 74px; height: 106px; flex-shrink: 0;
  border-radius: 8px; cursor: pointer;
  /* Fildişi taş gövdesi: üstten ışık, altta gölge → fiziksel taş hissi */
  background:
    linear-gradient(#fffef8 0%, #f7f1e0 42%, #e8dfc7 100%);
  border: 1px solid #c3b797;
  box-shadow:
    inset 0 1px 0 #fffffc,
    inset 0 -2px 3px rgba(160,145,110,.35),
    inset 2px 0 2px rgba(255,255,255,.5),
    0 3px 7px rgba(0,0,0,.42);
  transition: transform .14s cubic-bezier(.2,.8,.3,1), box-shadow .14s;
  display: flex; align-items: center; justify-content: center;
}
.card:hover { transform: translateY(-9px); box-shadow: inset 0 1px 0 #fffffc, 0 11px 20px rgba(0,0,0,.5); }
.card.sel {
  transform: translateY(-20px);
  border-color: var(--gold);
  box-shadow: inset 0 1px 0 #fffffc, 0 12px 24px rgba(0,0,0,.55),
    0 0 0 2px var(--gold), 0 0 22px rgba(232,192,74,.45);
}
/* Sayı: taşın kahramanı — büyük, kalın, ortada */
.card .num {
  font-size: 40px; font-weight: 800; line-height: 1;
  font-variant-numeric: tabular-nums; letter-spacing: -1.5px;
  text-shadow: 0 1px 0 rgba(255,255,255,.85);
}
/* Renk körlüğü yardımcısı: küçük, köşede, ikincil */
.card .pip {
  position: absolute; top: 5px; left: 6px;
  font-size: 9px; line-height: 1; opacity: .75;
}
/* Gerçek taşlarda alt kısımdaki oluk/kabartma çizgisi */
.card .groove {
  position: absolute; left: 12%; right: 12%; bottom: 7px; height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, rgba(150,135,100,.4), transparent);
  box-shadow: 0 1px 0 rgba(255,255,255,.7);
}
.card .bonusTag {
  position: absolute; bottom: 3px; right: 5px;
  font-size: 8.5px; font-weight: 700; color: #b8860b; opacity: .9;
}
.card.suit-k { color: #c0202e; }
.card.suit-s { color: #23282f; }
.card.suit-m { color: #1565c0; }
.card.suit-y { color: #b06f00; }
/* Okey (sahte joker) taşı — altın gövde, ayırt edici */
.card.okey {
  background: linear-gradient(#fff8dc 0%, #f3dd9a 45%, #dfc27a 100%);
  border-color: #b3912f; color: #6b4c0a;
  flex-direction: column;
}
.card.okey .num { font-size: 30px; text-shadow: 0 1px 0 rgba(255,255,255,.7); }
.card.okey .tag {
  font-size: 8.5px; font-weight: 800; letter-spacing: 1.6px; margin-top: 2px; opacity: .8;
}
.card.okey .pip { opacity: .85; }
.card.blocked { filter: grayscale(.75) brightness(.7); }
.card.blocked::after {
  content: '✕'; position: absolute; inset: 0;
  display: grid; place-items: center; font-size: 30px; color: rgba(200,40,40,.8);
}
.card.played { animation: dealIn .3s ease-out backwards; cursor: default; }
@keyframes dealIn { from { opacity: 0; transform: translateY(24px) scale(.86); } }
.card.scoring { animation: pulseCard .34s ease-out; }
@keyframes pulseCard {
  0% { transform: translateY(0) scale(1); }
  45% { transform: translateY(-14px) scale(1.1); box-shadow: 0 0 24px var(--gold); }
  100% { transform: translateY(0) scale(1); }
}
.cardFx {
  position: absolute; left: 50%; top: -6px; transform: translateX(-50%);
  font-size: 15px; font-weight: 800; pointer-events: none;
  animation: fxUp .75s ease-out forwards; white-space: nowrap;
}
.cardFx.chip { color: var(--chip); }
.cardFx.mult { color: var(--mult); }
@keyframes fxUp {
  0% { opacity: 0; transform: translateX(-50%) translateY(6px); }
  25% { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) translateY(-34px); }
}

/* ---------- El alanı ---------- */
#handArea { padding: 8px 16px 14px; }
#handCards {
  display: flex; gap: 7px; justify-content: center; min-height: 126px;
  align-items: flex-end; flex-wrap: wrap;
}
#actionBar { display: flex; align-items: center; justify-content: center; gap: 18px; margin-top: 6px; }
.bigBtn {
  padding: 11px 30px; font-size: 15px; font-weight: 800; letter-spacing: 1px;
  border-radius: 12px; border: 1px solid;
  transition: transform .1s, filter .15s;
}
.bigBtn:hover:not(:disabled) { transform: translateY(-2px); filter: brightness(1.12); }
.bigBtn.play { background: linear-gradient(135deg, #2e7d5b, #1b5540); border-color: #4aa17b; color: #fff; }
.bigBtn.discard { background: linear-gradient(135deg, #a03a4a, #7a2432); border-color: #c9556a; color: #fff; }
.counters { display: flex; gap: 14px; font-size: 12px; color: var(--dim); text-align: center; }
.counters i { font-style: normal; display: block; font-size: 9.5px; letter-spacing: 1px; text-transform: uppercase; }
.counters b { font-size: 19px; color: var(--text); }

/* ---------- Jokerler ---------- */
#jokerRow { display: flex; gap: 5px; flex-wrap: wrap; min-height: 46px; }
.jokerCard {
  width: 42px; height: 46px; border-radius: 9px; cursor: pointer;
  background: linear-gradient(160deg, #2c4a3e, #1d332b);
  border: 1px solid var(--line);
  display: grid; place-items: center; font-size: 20px;
  transition: transform .12s, border-color .15s;
}
.jokerCard:hover { transform: translateY(-3px); border-color: var(--gold); }
.jokerCard.r2 { border-color: #4a7fb5; }
.jokerCard.r3 { border-color: var(--gold); box-shadow: 0 0 10px rgba(232,192,74,.35); }
.jokerSlot {
  width: 42px; height: 46px; border-radius: 9px;
  border: 1px dashed #2f4b40; opacity: .5;
}

/* ---------- El türleri listesi ---------- */
.handRow {
  display: flex; align-items: center; gap: 6px; padding: 4px 6px;
  border-radius: 7px; font-size: 11.5px; margin-bottom: 2px;
}
.handRow.active { background: #2a4a3c; box-shadow: inset 0 0 0 1px var(--gold); }
.handRow .hName { flex: 1; }
.handRow .hLvl { font-size: 9.5px; color: var(--gold); }
.handRow .hVal { color: var(--dim); font-variant-numeric: tabular-nums; }
.handRow .hVal b { color: var(--chip); }
.handRow .hVal i { color: var(--mult); font-style: normal; }
#deckInfo { font-size: 11.5px; color: var(--dim); line-height: 1.6; }
#deckInfo b { color: var(--text); }

/* ---------- Dükkân ---------- */
#shopView {
  position: fixed; inset: 0; z-index: 120;
  background: rgba(6,18,14,.88); backdrop-filter: blur(5px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.shopBox {
  background: linear-gradient(170deg, #1f3a2f, #14261f);
  border: 1px solid #3d6a58; border-radius: 18px;
  padding: 22px 26px; max-width: 760px; width: 100%;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
}
.shopBox h2 { font-size: 23px; text-align: center; color: var(--gold); }
.shopSub { text-align: center; color: var(--dim); font-size: 12.5px; margin: 6px 0 18px; }
#shopItems { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.shopItem {
  background: #172b23; border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 12px; text-align: center;
  transition: transform .14s, border-color .15s;
}
.shopItem:not(.bought):hover { transform: translateY(-4px); border-color: var(--gold); }
.shopItem.r2 { border-color: #4a7fb5; }
.shopItem.r3 { border-color: var(--gold); box-shadow: 0 0 14px rgba(232,192,74,.25); }
.shopItem.bought { opacity: .45; }
.shopItem .sIco { font-size: 34px; display: block; margin-bottom: 6px; }
.shopItem .sName { font-size: 13.5px; font-weight: 700; margin-bottom: 4px; }
.shopItem .sDesc { font-size: 11px; color: var(--dim); line-height: 1.45; min-height: 42px; }
.shopItem button {
  width: 100%; margin-top: 8px; padding: 7px; border-radius: 9px; font-size: 12.5px; font-weight: 700;
  background: #235c44; border: 1px solid #3f8a67; color: #fff;
}
.shopItem button:hover:not(:disabled) { background: #2d7355; }
.shopFoot { display: flex; align-items: center; gap: 14px; margin-top: 20px; }
.shopFoot .shopGold { margin-left: auto; font-size: 17px; font-weight: 700; }
.shopFoot .shopGold b { color: var(--gold); }
#rerollBtn {
  padding: 9px 18px; border-radius: 11px; font-size: 13px;
  background: var(--panel2); border: 1px solid var(--line);
}
#rerollBtn:hover:not(:disabled) { background: #2c4a3e; }

/* ---------- Modal ---------- */
#modalBack {
  position: fixed; inset: 0; z-index: 250;
  background: rgba(6,18,14,.86); backdrop-filter: blur(5px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
#modal {
  background: linear-gradient(170deg, #1f3a2f, #14261f);
  border: 1px solid #3d6a58; border-radius: 18px;
  padding: 22px 26px; max-width: 520px; width: 100%; max-height: 86vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
}
#modal h2 {
  font-size: 21px; text-align: center; padding-bottom: 12px; margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
#modalBody { font-size: 13.5px; color: var(--dim); line-height: 1.62; text-align: center; }
#modalBody h3 { color: var(--text); font-size: 14px; margin: 12px 0 4px; text-align: left; }
#modalBody h3:first-child { margin-top: 0; }
#modalBody p { margin: 4px 0; text-align: left; }
#modalBody b { color: var(--gold); }
#modalBody .big { font-size: 30px; color: var(--gold); font-weight: 800; margin: 10px 0; }
#modalActions { display: flex; gap: 8px; margin-top: 18px; justify-content: center; flex-wrap: wrap; }
#modalActions button {
  min-width: 130px; padding: 10px 18px; border-radius: 11px; font-size: 14px;
  background: var(--panel2); border: 1px solid var(--line);
}
#modalActions button:hover { background: #2c4a3e; }
#modalActions button.primary {
  background: linear-gradient(135deg, #2e7d5b, #1b5540); border-color: #4aa17b; font-weight: 700;
}
.handPick { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 12px; }
.handPick button { padding: 8px; border-radius: 9px; font-size: 12px; background: #172b23; border: 1px solid var(--line); }
.handPick button:hover { border-color: var(--gold); }

/* ---------- Bildirimler ---------- */
#toasts { position: fixed; left: 14px; bottom: 14px; z-index: 300; display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.toast {
  background: rgba(20,40,32,.96); border: 1px solid var(--line);
  border-left: 3px solid var(--gold); border-radius: 9px;
  padding: 8px 15px; font-size: 13px; max-width: 330px;
  animation: tIn .22s ease-out, tOut .4s ease-in 2.6s forwards;
}
.toast.err { border-left-color: var(--red); }
.toast.good { border-left-color: #4ade80; }
@keyframes tIn { from { opacity: 0; transform: translateX(-14px); } }
@keyframes tOut { to { opacity: 0; transform: translateY(8px); } }

/* ---------- Mobil ---------- */
@media (max-width: 900px) {
  #leftPanel { display: none; }
  .card { width: 58px; height: 84px; }
  .card .num { font-size: 31px; }
  .card.okey .num { font-size: 24px; }
  #handCards { min-height: 100px; gap: 5px; }
  #playedCards { min-height: 92px; }
  .bigBtn { padding: 10px 20px; font-size: 13px; }
  .titleInner h1 { font-size: 40px; letter-spacing: 6px; }
  #scoreVal { font-size: 22px; }
}
