/* ==========================================================================
   Yüzbir — 101 Okey · kıraathane lüksü: koyu çuha, ceviz ıstaka, fildişi taş, altın
   ========================================================================== */
:root {
  --bg: #07120e;
  --bg2: #0c1c16;
  --ink: #f3ecdc;
  --ink-dim: #b9b19f;
  --muted: #8c8676;
  --gold: #d9b85b;
  --gold-hi: #f2d98e;
  --gold-lo: #a8862f;
  --teal: #3cc9a7;
  --danger: #e2574c;
  --glass: rgba(255, 255, 255, .055);
  --glass-hi: rgba(255, 255, 255, .09);
  --line: rgba(255, 255, 255, .09);
  --felt-1: #17774f;
  --felt-2: #0e5b3c;
  --felt-3: #083826;
  --wood-1: #94602f;
  --wood-2: #6e4320;
  --wood-3: #4a2b13;
  --tc0: #d0302b;
  --tc1: #e19a06;
  --tc2: #1c64c8;
  --tc3: #1b1d21;
  --tw: 46px;
  --th: calc(var(--tw) * 1.36);
  --mw: 30px;
  --mh: calc(var(--mw) * 1.36);
  --radius: 16px;
  --font-ui: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-brand: 'Fraunces', Georgia, serif;
  --font-tile: 'Rubik', 'Arial Black', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background:
    radial-gradient(1200px 700px at 20% -10%, rgba(217, 184, 91, .10), transparent 60%),
    radial-gradient(900px 600px at 110% 110%, rgba(60, 201, 167, .07), transparent 60%),
    var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }

#app { height: 100%; }
.view { display: none; height: 100%; }
.view.active { display: flex; flex-direction: column; }

.glass {
  background: linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.035));
  border: 1px solid var(--line);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}

/* ------------------------------------------------------------------ butonlar */
.btn {
  border: 1px solid var(--line);
  background: var(--glass);
  border-radius: 12px;
  padding: 10px 16px;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: .01em;
  transition: transform .12s ease, background .2s, border-color .2s, opacity .2s, box-shadow .2s;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--glass-hi); border-color: rgba(255,255,255,.18); }
.btn:active:not(:disabled) { transform: translateY(1px) scale(.98); }
.btn:disabled { opacity: .38; cursor: not-allowed; }
.btn.gold {
  background: linear-gradient(180deg, var(--gold-hi), var(--gold) 55%, var(--gold-lo));
  color: #2a1e05;
  border-color: rgba(255, 230, 160, .6);
  box-shadow: 0 6px 20px rgba(217,184,91,.25), inset 0 1px 0 rgba(255,255,255,.6);
}
.btn.gold:hover:not(:disabled) { background: linear-gradient(180deg, #fbe7a8, var(--gold-hi) 55%, var(--gold)); }
.btn.big { width: 100%; padding: 15px; font-size: 16px; border-radius: 14px; }
.btn.sm { padding: 8px 14px; font-size: 13px; }
.btn.danger { background: rgba(226,87,76,.16); border-color: rgba(226,87,76,.45); color: #ffb3ab; }
.btn.danger small { opacity: .8; font-weight: 800; }
.btn.ghost { background: transparent; }
.btn.chip { padding: 7px 12px; font-size: 12.5px; border-radius: 999px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--glass); display: grid; place-items: center; font-size: 16px; position: relative;
  transition: background .2s;
}
.icon-btn:hover { background: var(--glass-hi); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 26px; }
.feature { padding: 18px; border-radius: 16px; border: 1px solid var(--line); background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.015)); }
.feature h4 { margin: 12px 0 4px; font-family: var(--font-brand); font-size: 17px; }
.feature p { margin: 0; color: var(--ink-dim); font-size: 13px; line-height: 1.5; }
.f-tiles { display: flex; gap: 3px; --mw: 26px; height: 36px; align-items: flex-end; }
.f-num { height: 36px; display: flex; align-items: flex-end; font-family: var(--font-tile); font-weight: 800; font-size: 28px; color: var(--gold-hi); }
@media (max-width: 760px) { .features { grid-template-columns: 1fr; } }
.badge-wrap .badge {
  position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; border-radius: 9px;
  background: var(--danger); color: #fff; font-size: 11px; font-style: normal; font-weight: 800;
  display: none; place-items: center; padding: 0 5px;
}
.badge-wrap .badge.on { display: grid; }

/* ------------------------------------------------------------------ taş */
.tile {
  --tc: var(--tc3);
  position: relative;
  width: var(--tw);
  height: calc(var(--tw) * 1.36);
  border-radius: calc(var(--tw) * .14);
  background: linear-gradient(180deg, #fffcf3 0%, #f7efdb 55%, #ebdfc2 100%);
  box-shadow:
    inset 0 1px 0 #fff,
    inset 0 -2px 0 rgba(120, 95, 50, .14),
    0 3px 0 #c9b88f,
    0 5px 9px rgba(0, 0, 0, .38);
  display: flex; flex-direction: column; align-items: center;
  padding-top: calc(var(--tw) * .16);
  user-select: none; -webkit-user-select: none;
  touch-action: none;
  transition: transform .14s ease, box-shadow .2s, opacity .2s;
}
.tile.c0 { --tc: var(--tc0); }
.tile.c1 { --tc: var(--tc1); }
.tile.c2 { --tc: var(--tc2); }
.tile.c3 { --tc: var(--tc3); }
.tile b {
  font-family: var(--font-tile); font-weight: 800; color: var(--tc);
  font-size: calc(var(--tw) * .58); line-height: .95; letter-spacing: -.02em;
  text-shadow: 0 1px 0 rgba(255,255,255,.8);
}
.tile i {
  display: block; width: calc(var(--tw) * .26); height: calc(var(--tw) * .26);
  margin-top: calc(var(--tw) * .1); border-radius: 50%;
  border: calc(var(--tw) * .055) solid var(--tc); opacity: .85;
}
.tile.fake b { display: none; }
.tile.fake i {
  width: calc(var(--tw) * .62); height: calc(var(--tw) * .62); border: 0; opacity: 1; margin-top: calc(var(--tw) * .04);
  background: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cg fill='%23177a4e'%3E%3Ccircle cx='20' cy='11' r='8'/%3E%3Ccircle cx='29' cy='20' r='8'/%3E%3Ccircle cx='20' cy='29' r='8'/%3E%3Ccircle cx='11' cy='20' r='8'/%3E%3C/g%3E%3Ccircle cx='20' cy='20' r='4' fill='%23f6efdc'/%3E%3C/svg%3E");
}
.tile .fake-face {
  position: absolute; left: 4%; bottom: 5%; font-family: var(--font-tile); font-weight: 800;
  font-size: calc(var(--tw) * .26); color: var(--tc); line-height: 1;
}
.tile.joker {
  box-shadow:
    inset 0 0 0 2px rgba(217,184,91,.95),
    inset 0 1px 0 #fff,
    0 3px 0 #b8954a,
    0 5px 12px rgba(217,184,91,.35),
    0 5px 9px rgba(0,0,0,.38);
  background: linear-gradient(180deg, #fffdf5 0%, #fbf0d0 60%, #f0dca8 100%);
}
.tile.joker::before {
  content: '★'; position: absolute; top: 2px; right: 4px; font-size: calc(var(--tw) * .22);
  color: var(--gold-lo); line-height: 1;
}
.tile.back {
  background:
    radial-gradient(circle at 50% 50%, rgba(23,119,79,.25) 0 22%, transparent 23%),
    linear-gradient(180deg, #f3ead3, #e3d4b0);
  padding: 0;
}
.tile.back::after {
  content: ''; position: absolute; inset: 14% 18%; border-radius: 4px;
  border: 1.5px solid rgba(23,119,79,.35);
}

/* mini taş (yer, atılan, gösterge) */
.mini { --tw: var(--mw); }
.mini.tile { box-shadow: inset 0 1px 0 #fff, 0 2px 0 #c9b88f, 0 3px 6px rgba(0,0,0,.35); }
.mini.tile.joker { box-shadow: inset 0 0 0 1.5px rgba(217,184,91,.95), 0 2px 0 #b8954a, 0 3px 6px rgba(0,0,0,.35); }

/* ------------------------------------------------------------------ giriş */
#v-welcome { align-items: center; justify-content: center; padding: 20px; overflow: auto; }
.welcome-card { width: min(440px, 100%); padding: 34px 30px 26px; text-align: center; position: relative; }
.hero-tiles { display: flex; justify-content: center; gap: 10px; margin: -6px 0 10px; --tw: 54px; }
.hero-tiles .tile { animation: floaty 5s ease-in-out infinite; }
.hero-tiles .tile:nth-child(2) { animation-delay: -1.6s; transform: rotate(-4deg); }
.hero-tiles .tile:nth-child(3) { animation-delay: -3.2s; }
@keyframes floaty { 0%,100% { translate: 0 0; } 50% { translate: 0 -6px; } }
.brand {
  font-family: var(--font-brand); font-weight: 900; font-size: 56px; margin: 8px 0 0; letter-spacing: -.02em;
  background: linear-gradient(180deg, #fff3cc, var(--gold) 60%, var(--gold-lo));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tagline { margin: 2px 0 22px; color: var(--ink-dim); letter-spacing: .18em; text-transform: uppercase; font-size: 12px; font-weight: 700; }
.field { display: block; text-align: left; margin-bottom: 16px; }
.field > span { display: block; font-size: 12px; font-weight: 700; color: var(--ink-dim); margin-bottom: 7px; letter-spacing: .06em; text-transform: uppercase; }
.field input, .chat-form input, .join-row input, .modal input[type=text] {
  width: 100%; background: rgba(0,0,0,.28); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; outline: none; transition: border-color .2s, box-shadow .2s;
}
.field input:focus, .chat-form input:focus, .join-row input:focus, .modal input[type=text]:focus {
  border-color: rgba(217,184,91,.6); box-shadow: 0 0 0 3px rgba(217,184,91,.15);
}
.avatar-pick { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.avatar-pick button {
  aspect-ratio: 1; border-radius: 12px; border: 1px solid var(--line); background: rgba(0,0,0,.2);
  font-size: 20px; display: grid; place-items: center; transition: transform .15s, border-color .2s, background .2s;
}
.avatar-pick button:hover { transform: translateY(-2px); }
.avatar-pick button.on { border-color: var(--gold); background: rgba(217,184,91,.16); box-shadow: 0 0 0 2px rgba(217,184,91,.25); }
.fine { color: var(--muted); font-size: 12px; margin: 16px 0 0; }

/* ------------------------------------------------------------------ üst bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 20px; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(0,0,0,.25), rgba(0,0,0,0));
  flex: none;
}
.brand-sm { font-family: var(--font-brand); font-weight: 900; font-size: 24px; color: var(--gold); }
.brand-sm span { font-family: var(--font-ui); font-size: 12px; font-weight: 700; color: var(--ink-dim); letter-spacing: .14em; text-transform: uppercase; margin-left: 6px; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.online-pill { font-size: 13px; color: var(--ink-dim); display: flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 999px; background: var(--glass); border: 1px solid var(--line); }
.online-pill b { color: var(--ink); }
.dot-live { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 0 rgba(60,201,167,.6); animation: live 2s infinite; }
@keyframes live { 0% { box-shadow: 0 0 0 0 rgba(60,201,167,.55); } 70% { box-shadow: 0 0 0 8px rgba(60,201,167,0); } 100% { box-shadow: 0 0 0 0 rgba(60,201,167,0); } }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 6px 14px 6px 8px; border-radius: 999px; background: var(--glass); border: 1px solid var(--line); font-weight: 700; }
.user-chip span:first-child { font-size: 18px; }

/* ------------------------------------------------------------------ lobi */
.lobby { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 340px; gap: 20px; padding: 20px; }
.lobby-main { min-height: 0; overflow: auto; padding-right: 4px; }
.hero-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 26px; }
.action-card {
  display: flex; align-items: center; gap: 16px; text-align: left; padding: 22px; border-radius: 20px;
  border: 1px solid var(--line); position: relative; overflow: hidden; min-height: 110px;
  background: linear-gradient(135deg, rgba(255,255,255,.07), rgba(255,255,255,.02));
  transition: transform .18s ease, border-color .2s, box-shadow .2s;
}
.action-card:hover { transform: translateY(-3px); border-color: rgba(217,184,91,.45); box-shadow: 0 16px 40px rgba(0,0,0,.35); }
.action-card.quick { background: linear-gradient(135deg, rgba(23,119,79,.55), rgba(8,56,38,.6)); }
.action-card.create { background: linear-gradient(135deg, rgba(217,184,91,.22), rgba(120,80,20,.18)); }
.action-card h3 { margin: 0 0 4px; font-family: var(--font-brand); font-size: 21px; font-weight: 700; }
.action-card p { margin: 0; color: var(--ink-dim); font-size: 13.5px; }
.ac-icon { width: 52px; height: 52px; flex: none; border-radius: 16px; display: grid; place-items: center; font-size: 24px; font-weight: 800; background: rgba(0,0,0,.25); border: 1px solid var(--line); color: var(--gold-hi); }
.join-inner { flex: 1; min-width: 0; }
.join-row { display: flex; gap: 8px; margin-top: 6px; }
.join-row input { text-transform: uppercase; letter-spacing: .2em; font-weight: 800; padding: 9px 12px; min-width: 0; }
.section-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.section-head h2 { margin: 0; font-family: var(--font-brand); font-size: 22px; }
.room-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.room-card { padding: 16px; border-radius: 16px; border: 1px solid var(--line); background: rgba(255,255,255,.04); display: flex; flex-direction: column; gap: 12px; }
.room-card .rc-top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.room-card h4 { margin: 0; font-size: 16px; }
.room-card .rc-code { font-size: 11px; color: var(--muted); letter-spacing: .14em; font-weight: 800; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-size: 11px; font-weight: 800; padding: 4px 8px; border-radius: 999px; background: rgba(255,255,255,.07); color: var(--ink-dim); letter-spacing: .03em; }
.tag.k { background: rgba(217,184,91,.16); color: var(--gold-hi); }
.tag.live { background: rgba(60,201,167,.15); color: var(--teal); }
.rc-seats { display: flex; gap: 6px; }
.rc-seat { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: rgba(0,0,0,.25); border: 1px dashed rgba(255,255,255,.15); font-size: 16px; }
.rc-seat.full { border-style: solid; border-color: rgba(217,184,91,.4); }
.rc-bottom { display: flex; justify-content: space-between; align-items: center; }
.empty-state { grid-column: 1 / -1; padding: 40px 20px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 16px; }
.lobby-side { display: flex; flex-direction: column; min-height: 0; padding: 0; overflow: hidden; }
.panel-head { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.panel-head h3 { margin: 0; font-size: 15px; }

/* ------------------------------------------------------------------ sohbet */
.chat-log { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; scroll-behavior: smooth; }
.msg { display: flex; gap: 8px; align-items: flex-start; animation: msgIn .25s ease; }
@keyframes msgIn { from { opacity: 0; transform: translateY(4px); } }
.msg .m-av { width: 28px; height: 28px; flex: none; border-radius: 50%; background: rgba(0,0,0,.3); display: grid; place-items: center; font-size: 15px; }
.msg .m-body { min-width: 0; }
.msg .m-name { font-size: 12px; font-weight: 800; color: var(--gold-hi); }
.msg .m-name small { color: var(--muted); font-weight: 600; margin-left: 4px; }
.msg .m-text { font-size: 13.5px; line-height: 1.4; color: var(--ink); word-wrap: break-word; overflow-wrap: anywhere; }
.msg.me .m-name { color: var(--teal); }
.msg.sys { justify-content: center; }
.msg.sys .m-text { font-size: 12px; color: var(--ink-dim); background: rgba(255,255,255,.05); padding: 4px 10px; border-radius: 999px; text-align: center; }
.chat-form { display: flex; gap: 8px; padding: 10px 12px 12px; border-top: 1px solid var(--line); }
.chat-form input { padding: 10px 12px; }
.quick-row { display: flex; gap: 6px; overflow-x: auto; padding: 8px 12px 0; scrollbar-width: none; }
.quick-row::-webkit-scrollbar { display: none; }
.quick-row button { flex: none; border: 1px solid var(--line); background: rgba(255,255,255,.05); border-radius: 999px; padding: 6px 10px; font-size: 12.5px; font-weight: 600; }
.quick-row button:hover { background: rgba(255,255,255,.1); }
.quick-row button.emo { font-size: 16px; padding: 3px 8px; }

/* ------------------------------------------------------------------ masa düzeni */
#v-game { position: relative; }
.game-top { padding: 8px 14px; }
.table-title { flex: 1; min-width: 0; }
.tt-name { font-family: var(--font-brand); font-weight: 700; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tt-meta { font-size: 12px; color: var(--ink-dim); display: flex; gap: 8px; flex-wrap: wrap; }
.tt-meta b { color: var(--gold-hi); }
.game-wrap { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 330px; gap: 12px; padding: 10px 12px 12px; }
.table-area { min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 10px; }

.felt {
  flex: 1; min-height: 0; position: relative;
  display: grid;
  grid-template-columns: minmax(84px, auto) 1fr minmax(84px, auto);
  grid-template-rows: auto 1fr auto;
  grid-template-areas: "tl top tr" "left center right" "bl me br";
  gap: 6px;
  padding: 12px;
  border-radius: 28px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .5 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='.35'/%3E%3C/svg%3E"),
    radial-gradient(ellipse at 50% 42%, var(--felt-1) 0%, var(--felt-2) 48%, var(--felt-3) 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,.06),
    inset 0 0 90px rgba(0,0,0,.5),
    0 0 0 9px #3e2410,
    0 0 0 10px rgba(255,220,160,.12),
    0 24px 60px rgba(0,0,0,.55);
  margin: 9px;
}
.pile-tl { grid-area: tl; } .seat-top { grid-area: top; } .pile-tr { grid-area: tr; }
.seat-left { grid-area: left; } .center { grid-area: center; } .seat-right { grid-area: right; }
.pile-bl { grid-area: bl; } .seat-me { grid-area: me; } .pile-br { grid-area: br; }

/* oyuncu koltukları */
.seat { display: flex; align-items: center; justify-content: center; gap: 10px; min-width: 0; }
.seat-left, .seat-right { flex-direction: column; text-align: center; }
.seat-top { padding-bottom: 2px; }
.player { display: flex; align-items: center; gap: 10px; position: relative; padding: 6px 12px 6px 6px; border-radius: 999px; background: rgba(0,0,0,.22); border: 1px solid rgba(255,255,255,.06); transition: background .3s, box-shadow .3s; }
.seat-left .player, .seat-right .player { flex-direction: column; padding: 10px 8px; border-radius: 18px; gap: 6px; }
.player.turn { background: rgba(217,184,91,.14); box-shadow: 0 0 0 1px rgba(217,184,91,.45), 0 0 26px rgba(217,184,91,.22); }
.avatar {
  --p: 0; position: relative; width: 46px; height: 46px; flex: none; border-radius: 50%;
  display: grid; place-items: center; font-size: 23px;
}
.avatar::before {
  content: ''; position: absolute; inset: -3px; border-radius: 50%;
  background: conic-gradient(var(--ring, transparent) calc(var(--p) * 360deg), rgba(255,255,255,.08) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
}
.avatar .av-in { width: 100%; height: 100%; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 35% 30%, #2b3a33, #121a16); border: 1px solid rgba(255,255,255,.1); }
.player.turn .avatar { --ring: var(--gold); }
.player.turn.low .avatar { --ring: var(--danger); }
.p-info { min-width: 0; }
.p-name { font-weight: 800; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
.p-meta { display: flex; gap: 6px; align-items: center; font-size: 11.5px; color: var(--ink-dim); flex-wrap: wrap; justify-content: center; }
.p-badge { font-size: 10.5px; font-weight: 800; padding: 2px 7px; border-radius: 999px; background: rgba(255,255,255,.08); letter-spacing: .02em; }
.p-badge.seri { background: rgba(217,184,91,.2); color: var(--gold-hi); }
.p-badge.cift { background: rgba(60,201,167,.18); color: var(--teal); }
.p-badge.off { background: rgba(226,87,76,.18); color: #ffb3ab; }
.p-badge.bot { background: rgba(255,255,255,.06); color: var(--muted); }
.p-count { font-weight: 800; color: var(--ink); }
.backs { display: flex; }
.backs .tile { --tw: 15px; margin-left: -8px; box-shadow: 0 1px 0 #c9b88f, 0 2px 4px rgba(0,0,0,.4); }
.backs .tile:first-child { margin-left: 0; }
.seat-left .backs, .seat-right .backs { display: none; }
.bubble {
  position: absolute; z-index: 30; bottom: calc(100% + 8px); left: 50%; translate: -50% 0;
  background: #fffaf0; color: #1d1a12; font-size: 13px; font-weight: 600; line-height: 1.35;
  padding: 8px 12px; border-radius: 14px; max-width: 220px; width: max-content;
  box-shadow: 0 10px 30px rgba(0,0,0,.4); animation: bubbleIn .25s cubic-bezier(.2,1.4,.5,1);
  pointer-events: none; overflow-wrap: anywhere;
}
.bubble::after { content: ''; position: absolute; top: 100%; left: 50%; translate: -50% 0; border: 7px solid transparent; border-top-color: #fffaf0; }
.seat-top .bubble { bottom: auto; top: calc(100% + 8px); }
.seat-top .bubble::after { top: auto; bottom: 100%; border-top-color: transparent; border-bottom-color: #fffaf0; }
.bubble.emo { font-size: 30px; background: transparent; box-shadow: none; padding: 0; }
.bubble.emo::after { display: none; }
@keyframes bubbleIn { from { opacity: 0; transform: translateY(6px) scale(.9); } }

/* atılan taş yığınları */
.pile { display: flex; align-items: center; justify-content: center; position: relative; min-height: calc(calc(var(--mw) * 1.36) + 18px); }
.pile .stack { position: relative; width: calc(var(--mw) + 8px); height: calc(calc(var(--mw) * 1.36) + 6px); }
.pile .stack .tile { position: absolute; left: 0; top: 0; }
.pile .stack .tile:nth-last-child(2) { left: 3px; top: 2px; }
.pile .stack .tile:nth-last-child(1) { left: 6px; top: 4px; }
.pile .pc { position: absolute; z-index: 2; top: -7px; right: -9px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; display: grid; place-items: center; font-size: 10px; font-weight: 800; color: var(--ink); background: rgba(0,0,0,.55); border: 1px solid rgba(255,255,255,.12); }
.pile .slot-ghost { width: var(--mw); height: calc(var(--mw) * 1.36); border-radius: 6px; border: 1.5px dashed rgba(255,255,255,.14); }
.pile.takeable .stack .tile:last-child { box-shadow: 0 0 0 2px var(--gold), 0 0 22px rgba(217,184,91,.7); cursor: pointer; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { transform: translateY(-3px); } }
.pile.drop-target { outline: 2px dashed rgba(217,184,91,.7); outline-offset: 2px; border-radius: 12px; }
.pile.drop-hover { background: rgba(217,184,91,.15); border-radius: 12px; }
.pile .pile-label { position: absolute; top: -4px; left: 50%; translate: -50% -100%; font-size: 10px; font-weight: 800; letter-spacing: .1em; color: var(--gold-hi); text-transform: uppercase; white-space: nowrap; opacity: 0; transition: opacity .2s; }
.pile.drop-target .pile-label, .pile.takeable .pile-label { opacity: 1; }

/* orta */
.center { min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px; }
.center.is-waiting { display: flex; flex-direction: column; }
.center-bar { display: flex; align-items: center; justify-content: center; gap: 18px; flex-wrap: wrap; padding: 6px 10px; }
.deck-wrap { display: flex; align-items: flex-end; gap: 14px; }
.deck {
  --tw: var(--mw); position: relative; width: calc(var(--mw) + 6px); height: calc(calc(var(--mw) * 1.36) + 6px); border-radius: 7px;
  background: linear-gradient(180deg, #f3ead3, #e0d0aa);
  box-shadow: 2px 2px 0 #cdbb92, 4px 4px 0 #bfae86, 6px 6px 0 #ad9b73, 6px 9px 14px rgba(0,0,0,.45);
  display: grid; place-items: center; transition: transform .15s, box-shadow .2s;
}
.deck::after { content: ''; position: absolute; inset: 16% 20%; border-radius: 4px; border: 1.5px solid rgba(23,119,79,.35); }
.deck-count { position: relative; z-index: 1; font-family: var(--font-tile); font-weight: 800; color: #1a5a3c; font-size: 15px; }
.deck.can { cursor: pointer; box-shadow: 0 0 0 2px var(--gold), 0 0 24px rgba(217,184,91,.7), 2px 2px 0 #cdbb92, 4px 4px 0 #bfae86, 6px 6px 0 #ad9b73; animation: pulse 1.4s ease-in-out infinite; }
.indicator-wrap, .okey-info { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: rgba(255,255,255,.6); }
.okey-info .tile { box-shadow: inset 0 0 0 1.5px var(--gold), 0 0 16px rgba(217,184,91,.45), 0 2px 0 #b8954a; }
.baraj { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.baraj span { font-size: 11.5px; font-weight: 700; padding: 5px 10px; border-radius: 999px; background: rgba(0,0,0,.25); color: var(--ink-dim); border: 1px solid rgba(255,255,255,.06); }
.baraj span b { color: var(--gold-hi); }

.melds { min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding: 2px 4px; scrollbar-width: thin; }
/* alttaki perler ıstakaya yakın dursun; margin-top:auto kaydırmayı bozmadan aşağı yaslar */
.melds-bottom .melds-inner { margin-top: auto; display: flex; flex-direction: column; gap: 6px; }
.meld-section { background: rgba(0,0,0,.16); border: 1px solid rgba(255,255,255,.05); border-radius: 14px; padding: 6px 8px 8px; }
.ms-head { font-size: 11px; font-weight: 800; color: rgba(255,255,255,.7); margin-bottom: 5px; display: flex; gap: 6px; align-items: center; }
.ms-head .p-badge { font-size: 10px; }
.ms-list { display: flex; flex-wrap: wrap; gap: 8px 12px; }
.meld { display: flex; gap: 2px; padding: 4px; border-radius: 9px; transition: background .15s, box-shadow .15s; position: relative; }
.meld .tile { --tw: var(--mw); }
.meld.droppable { background: rgba(217,184,91,.12); box-shadow: 0 0 0 1.5px rgba(217,184,91,.55); cursor: pointer; }
.meld.drop-hover { background: rgba(217,184,91,.28); box-shadow: 0 0 0 2px var(--gold); }
.meld.flash { animation: flash 1s ease; }
@keyframes flash { 0% { background: rgba(217,184,91,.5); } 100% { background: transparent; } }
.meld .tile.new { animation: popIn .35s cubic-bezier(.2,1.4,.5,1); }
@keyframes popIn { from { transform: scale(.6); opacity: 0; } }
.waiting { display: none; flex: 1; align-items: center; justify-content: center; flex-direction: column; gap: 14px; text-align: center; }
.waiting.on { display: flex; }
.waiting h2 { font-family: var(--font-brand); margin: 0; font-size: 26px; }
.waiting p { margin: 0; color: var(--ink-dim); }
.seat-slots { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.seat-slot { width: 128px; padding: 14px 10px; border-radius: 16px; background: rgba(0,0,0,.25); border: 1px dashed rgba(255,255,255,.18); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.seat-slot.full { border-style: solid; border-color: rgba(217,184,91,.35); }
.seat-slot .ss-av { font-size: 30px; }
.seat-slot .ss-name { font-weight: 800; font-size: 13px; }
.share-box { display: flex; gap: 8px; align-items: center; background: rgba(0,0,0,.3); border: 1px solid var(--line); border-radius: 12px; padding: 6px 6px 6px 14px; }
.share-box code { font-weight: 800; letter-spacing: .25em; color: var(--gold-hi); font-size: 18px; }

/* benim koltuğum */
.seat-me .player { padding: 4px 14px 4px 4px; }
.seat-me .avatar { width: 38px; height: 38px; font-size: 19px; }

/* ------------------------------------------------------------------ ıstaka */
.rack-area { flex: none; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.controls { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.status { font-weight: 700; font-size: 14px; min-width: 180px; display: flex; align-items: center; gap: 8px; }
.status .st-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.status.my .st-dot { background: var(--gold); box-shadow: 0 0 10px var(--gold); animation: live 1.6s infinite; }
.status.my { color: var(--gold-hi); }
.open-box { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: center; }
.open-btn { display: flex; align-items: center; gap: 8px; padding: 8px 12px; }
.open-btn .ob-val { font-family: var(--font-tile); font-weight: 800; font-size: 13px; padding: 2px 8px; border-radius: 8px; background: rgba(0,0,0,.25); color: var(--ink-dim); }
.open-btn.ready { background: linear-gradient(180deg, var(--gold-hi), var(--gold) 55%, var(--gold-lo)); color: #2a1e05; border-color: rgba(255,230,160,.6); box-shadow: 0 6px 20px rgba(217,184,91,.3); }
.open-btn.ready .ob-val { background: rgba(0,0,0,.15); color: #2a1e05; }
.open-btn.teal.ready { background: linear-gradient(180deg, #7ff0d2, var(--teal) 55%, #1f9476); color: #04251c; border-color: rgba(160,255,230,.6); box-shadow: 0 6px 20px rgba(60,201,167,.3); }
.open-btn.teal.ready .ob-val { color: #04251c; }
.arrange { display: flex; gap: 6px; }

.rack {
  position: relative;
  padding: 10px 12px 6px;
  border-radius: 16px;
  background:
    repeating-linear-gradient(92deg, rgba(0,0,0,.0) 0 7px, rgba(0,0,0,.06) 7px 9px, rgba(255,255,255,.03) 9px 13px),
    repeating-linear-gradient(88deg, rgba(255,255,255,.0) 0 31px, rgba(0,0,0,.08) 31px 33px),
    linear-gradient(180deg, var(--wood-1), var(--wood-2) 55%, var(--wood-3));
  box-shadow:
    inset 0 2px 0 rgba(255,220,170,.25),
    inset 0 -3px 0 rgba(0,0,0,.35),
    0 18px 36px rgba(0,0,0,.55);
  display: flex; flex-direction: column; gap: 4px;
  touch-action: none;
}
.rack-row {
  display: grid; grid-template-columns: repeat(16, var(--tw)); gap: 3px;
  padding-bottom: 7px; position: relative;
}
.rack-row::after {
  content: ''; position: absolute; left: -6px; right: -6px; bottom: 0; height: 9px; border-radius: 4px;
  background: linear-gradient(180deg, #5a3517, #3a200c);
  box-shadow: inset 0 1px 0 rgba(255,210,150,.25), 0 2px 3px rgba(0,0,0,.35);
}
.slot { width: var(--tw); height: calc(var(--tw) * 1.36); position: relative; z-index: 1; }
.slot.drop-hover::before { content: ''; position: absolute; inset: 0; border-radius: calc(var(--tw) * .14); background: rgba(255,240,200,.18); box-shadow: inset 0 0 0 2px rgba(255,240,200,.5); }
.slot .tile { cursor: grab; }
.slot .tile:hover { transform: translateY(-2px); }
.slot .tile.sel { transform: translateY(-9px); box-shadow: 0 0 0 2px var(--gold), 0 3px 0 #c9b88f, 0 10px 18px rgba(0,0,0,.45); }
.slot .tile.dragging { opacity: .25; }
.slot .tile.new { animation: popIn .4s cubic-bezier(.2,1.4,.5,1); }
.slot .tile.side-taken { box-shadow: 0 0 0 2px var(--danger), 0 3px 0 #c9b88f, 0 5px 9px rgba(0,0,0,.38); }
.slot .tile.in-seri::after, .slot .tile.in-cift::after {
  content: ''; position: absolute; left: 6%; right: 6%; bottom: -6px; height: 4px; border-radius: 3px;
}
.slot .tile.in-seri::after { background: var(--gold); box-shadow: 0 0 8px var(--gold); }
.slot .tile.in-cift::after { background: var(--teal); box-shadow: 0 0 8px var(--teal); }
.hint { font-size: 12px; color: var(--muted); min-height: 16px; text-align: center; }
.hint b { color: var(--ink-dim); }

#drag-layer { position: fixed; inset: 0; pointer-events: none; z-index: 900; }
#drag-layer .tile { position: absolute; left: 0; top: 0; transform-origin: center; will-change: transform; }
#drag-layer .tile.lifted { box-shadow: 0 3px 0 #c9b88f, 0 18px 30px rgba(0,0,0,.5); }
.fly { position: fixed; z-index: 800; pointer-events: none; transition: transform .45s cubic-bezier(.3,.8,.3,1), opacity .45s; }

/* ------------------------------------------------------------------ yan panel */
.side { min-height: 0; display: flex; flex-direction: column; overflow: hidden; border-radius: 20px;
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03)); border: 1px solid var(--line); }
.side-tabs { display: flex; gap: 4px; padding: 8px; border-bottom: 1px solid var(--line); align-items: center; }
.tab { flex: 1; border: 0; background: transparent; padding: 9px; border-radius: 10px; font-weight: 800; font-size: 13px; color: var(--ink-dim); }
.tab.active { background: rgba(255,255,255,.08); color: var(--ink); }
.close-side { display: none; width: 34px; height: 34px; }
.tab-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#scoreboard { overflow: auto; padding: 12px; }
.score-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.score-table th, .score-table td { padding: 8px 6px; text-align: center; border-bottom: 1px solid rgba(255,255,255,.06); }
.score-table th { font-size: 11px; color: var(--ink-dim); font-weight: 800; }
.score-table th .sh-av { display: block; font-size: 18px; }
.score-table td:first-child, .score-table th:first-child { text-align: left; color: var(--muted); font-weight: 700; }
.score-table td.neg { color: var(--teal); font-weight: 800; }
.score-table td.big { color: #ff9b91; }
.score-table tfoot td { font-weight: 900; font-size: 15px; color: var(--gold-hi); border-bottom: 0; padding-top: 12px; }
.score-table .lead { position: relative; }
.score-note { font-size: 11.5px; color: var(--muted); margin-top: 12px; line-height: 1.5; }

/* ------------------------------------------------------------------ modal & toast */
#modal-root { position: fixed; inset: 0; z-index: 1000; pointer-events: none; }
.modal-back { position: absolute; inset: 0; background: rgba(3,8,6,.6); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); display: grid; place-items: center; padding: 16px; pointer-events: auto; animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; } }
.modal { width: min(520px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 24px; position: relative; animation: modalIn .3s cubic-bezier(.2,1.2,.4,1); background: linear-gradient(180deg, #16241e, #0d1713); }
.modal.wide { width: min(820px, 100%); }
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(.97); } }
.modal h2 { font-family: var(--font-brand); margin: 0 0 6px; font-size: 26px; }
.modal .sub { color: var(--ink-dim); margin: 0 0 18px; font-size: 14px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }
.seg { display: flex; background: rgba(0,0,0,.3); border: 1px solid var(--line); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 9px 8px; border-radius: 9px; font-weight: 800; font-size: 13px; color: var(--ink-dim); }
.seg button.on { background: linear-gradient(180deg, var(--gold-hi), var(--gold)); color: #2a1e05; }
.opt-note { font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.45; }
.toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 700; font-size: 14px; }
.toggle input { width: 18px; height: 18px; accent-color: var(--gold); }

.result-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.result-head .crown { font-size: 40px; filter: drop-shadow(0 4px 12px rgba(217,184,91,.5)); }
.result-types { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.result-rows { display: flex; flex-direction: column; gap: 8px; }
.rr { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 14px; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.06); }
.rr.win { background: linear-gradient(90deg, rgba(217,184,91,.2), rgba(217,184,91,.05)); border-color: rgba(217,184,91,.4); }
.rr .rr-who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.rr .rr-av { font-size: 22px; }
.rr .rr-name { font-weight: 800; }
.rr .rr-why { font-size: 11.5px; color: var(--ink-dim); }
.rr .rr-tiles { display: flex; flex-wrap: wrap; gap: 2px; grid-column: 1 / -1; --mw: 20px; }
.rr .rr-tiles .tile { --tw: 20px; }
.rr .rr-score { font-family: var(--font-tile); font-weight: 800; font-size: 20px; text-align: right; }
.rr .rr-score.neg { color: var(--teal); }
.rr .rr-score.pos { color: #ff9b91; }
.rr .rr-total { font-size: 12px; color: var(--muted); text-align: right; min-width: 64px; }
.rr .rr-total b { color: var(--ink); font-size: 14px; display: block; }
.countdown { font-size: 13px; color: var(--ink-dim); }

.podium { display: flex; align-items: flex-end; justify-content: center; gap: 12px; margin: 10px 0 20px; }
.pod { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.pod .pod-av { font-size: 34px; }
.pod .pod-bar { width: 96px; border-radius: 12px 12px 4px 4px; display: grid; place-items: center; font-family: var(--font-tile); font-weight: 800; font-size: 22px; color: #2a1e05; }
.pod.p1 .pod-bar { height: 110px; background: linear-gradient(180deg, var(--gold-hi), var(--gold-lo)); }
.pod.p2 .pod-bar { height: 80px; background: linear-gradient(180deg, #e8e8e8, #9a9a9a); }
.pod.p3 .pod-bar { height: 60px; background: linear-gradient(180deg, #e3a76f, #8d5528); }
.pod .pod-name { font-weight: 800; font-size: 13px; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pod .pod-score { font-size: 12px; color: var(--ink-dim); }

#toasts { position: fixed; top: 66px; left: 50%; translate: -50% 0; z-index: 1100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: rgba(14,24,20,.94); border: 1px solid var(--line); padding: 10px 16px; border-radius: 999px; font-size: 13.5px; font-weight: 700; box-shadow: 0 12px 30px rgba(0,0,0,.4); animation: toastIn .3s cubic-bezier(.2,1.3,.5,1); max-width: 92vw; text-align: center; }
.toast.err { border-color: rgba(226,87,76,.5); color: #ffc3bc; }
.toast.gold { border-color: rgba(217,184,91,.55); color: var(--gold-hi); }
.toast.out { opacity: 0; transform: translateY(-8px); transition: .3s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px) scale(.95); } }

.rules { font-size: 14px; line-height: 1.6; color: var(--ink-dim); }
.rules h3 { color: var(--ink); font-size: 15px; margin: 16px 0 4px; }
.rules ul { padding-left: 18px; margin: 4px 0; }
.rules b { color: var(--gold-hi); }

.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 1200; }

.rotate-hint { display: none; }

/* ------------------------------------------------------------------ duyarlı */
@media (max-width: 1180px) {
  .game-wrap { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 700; top: 0; right: 0; bottom: 0; width: min(360px, 92vw); border-radius: 0; transform: translateX(105%); transition: transform .3s cubic-bezier(.3,.8,.3,1); background: #0e1a15; box-shadow: -20px 0 60px rgba(0,0,0,.5); }
  .side.open { transform: none; }
  .close-side { display: grid; }
}
@media (min-width: 1181px) { #btn-side { display: none; } }
@media (max-width: 980px) {
  .lobby { grid-template-columns: 1fr; overflow: auto; }
  .lobby-main { overflow: visible; }
  .lobby-side { min-height: 360px; }
  body { overflow: auto; }
  .hero-actions { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .felt { grid-template-columns: minmax(58px, auto) 1fr minmax(58px, auto); padding: 8px; margin: 6px; border-radius: 20px; }
  .p-name { max-width: 80px; font-size: 12px; }
  .avatar { width: 36px; height: 36px; font-size: 18px; }
  .seat-left .player, .seat-right .player { padding: 6px 4px; }
  .controls { justify-content: center; }
  .status { min-width: 0; width: 100%; justify-content: center; }
  .backs { display: none; }
}
@media (max-height: 620px) {
  .topbar.game-top { padding: 4px 10px; }
  .tt-name { font-size: 15px; }
  .icon-btn { width: 32px; height: 32px; }
  .game-wrap { padding: 4px 8px 6px; gap: 6px; }
  .table-area { gap: 4px; }
  .felt { padding: 6px; gap: 4px; margin: 6px; }
  .player { padding: 3px 10px 3px 3px; }
  .avatar { width: 32px; height: 32px; font-size: 16px; }
  .seat-left .player, .seat-right .player { padding: 5px 4px; gap: 3px; }
  .backs { display: none; }
  .btn { padding: 6px 10px; font-size: 12.5px; }
  .btn.chip { padding: 5px 9px; }
  .controls { gap: 6px; }
  .status { font-size: 12.5px; min-width: 0; }
  .hint { display: none; }
  .rack { padding: 6px 8px 4px; }
  .center-bar .baraj, .indicator-wrap span, .okey-info span { display: none; }
  .meld-section { padding: 4px 6px 5px; }
  .ms-head { font-size: 10px; margin-bottom: 3px; }
}
/* Üst/alt bölme ancak yüksek ekranda yer bulur; diğerlerinde per alanları yan yana:
   sol perler | deste | sağ perler. Deste her iki düzende de masanın ortasında. */
@media (max-height: 819px) {
  .center { grid-template-rows: minmax(0, 1fr); grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px; }
  .center-bar { flex-direction: column; flex-wrap: nowrap; gap: 8px; padding: 0; align-self: center; }
  .deck-wrap { align-items: center; }
}
@media (orientation: portrait) and (max-width: 640px) {
  .rotate-hint { display: block; position: fixed; bottom: 10px; left: 50%; translate: -50% 0; z-index: 650; background: rgba(14,24,20,.95); border: 1px solid rgba(217,184,91,.4); color: var(--gold-hi); padding: 8px 14px; border-radius: 999px; font-size: 12.5px; font-weight: 700; white-space: nowrap; pointer-events: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
