/* 101 Okey Odası — yeşil çuha, ahşap istaka, krem taşlar. Açık/koyu tema. */
:root {
  --bg: #e9e4d8;
  --panel: #f7f3ea;
  --panel-2: #efe8da;
  --line: #d6ccb6;
  --text: #2a2620;
  --muted: #6d6556;
  --accent: #1f7a4a;
  --accent-ink: #ffffff;
  --warn: #c2410c;
  --warn-bg: #fff1e6;
  --good: #15803d;
  --good-bg: #e7f7ec;
  --info-bg: #eef2f7;
  --felt: #1f6b43;
  --felt-2: #175636;
  --felt-line: rgba(255, 255, 255, 0.14);
  --felt-text: #eaf5ee;
  --wood: #8a5a2b;
  --wood-2: #6e4520;
  --wood-hi: #b07a45;
  --tile: #f8f1dc;
  --tile-2: #ece2c4;
  --tile-edge: #cdbf9a;
  --c0: #b97800; /* sarı */
  --c1: #1d5bbf; /* mavi */
  --c2: #1c1c1c; /* siyah */
  --c3: #c62828; /* kırmızı */
  --turn: #fbbf24;
  --speak: #22c55e;
  --tw: 46px;
  --mini: 26px;
  --radius: 10px;
  --shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101412; --panel: #1a201d; --panel-2: #222a26; --line: #33403a; --text: #e8ece9; --muted: #a2aea7;
    --accent: #2f9e63; --warn: #fb923c; --warn-bg: #3a2416; --good: #4ade80; --good-bg: #16301f; --info-bg: #1f2833;
    --felt: #14482e; --felt-2: #0f3a25; --felt-text: #d9ebe0;
    --wood: #6b4521; --wood-2: #4f3216; --wood-hi: #8a5a2b;
    --tile: #ece3c8; --tile-2: #ddd2b1; --tile-edge: #b9ab86;
    --c0: #a86d00; --c1: #1a52ad; --c2: #161616; --c3: #b42020;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #101412; --panel: #1a201d; --panel-2: #222a26; --line: #33403a; --text: #e8ece9; --muted: #a2aea7;
  --accent: #2f9e63; --warn: #fb923c; --warn-bg: #3a2416; --good: #4ade80; --good-bg: #16301f; --info-bg: #1f2833;
  --felt: #14482e; --felt-2: #0f3a25; --felt-text: #d9ebe0;
  --wood: #6b4521; --wood-2: #4f3216; --wood-hi: #8a5a2b;
  --tile: #ece3c8; --tile-2: #ddd2b1; --tile-edge: #b9ab86;
  --c0: #a86d00; --c1: #1a52ad; --c2: #161616; --c3: #b42020;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button, input, select { font: inherit; color: inherit; }
button {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  min-height: 40px;
  touch-action: manipulation;
}
button:hover:not(:disabled) { filter: brightness(0.97); }
button:disabled { opacity: 0.45; cursor: default; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
button.warn { background: var(--warn); color: #fff; border-color: transparent; font-weight: 600; }
button.ghost { background: transparent; }
button.small { min-height: 32px; padding: 4px 10px; font-size: 13px; }
input[type="text"], select {
  border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 9px 11px; min-height: 42px;
}
input[type="text"]:focus, select:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
h1, h2, h3 { margin: 0 0 8px; }

.screen { display: none; min-height: 100dvh; }
.screen.active { display: block; }

/* --- Giriş / lobi --------------------------------------------------------- */
.page {
  max-width: 980px; margin: 0 auto; padding: max(16px, env(safe-area-inset-top)) 16px 32px;
}
.hero {
  display: flex; align-items: center; gap: 14px; margin: 8px 0 18px;
}
.logo-tile {
  width: 56px; height: 74px; border-radius: 9px; background: linear-gradient(var(--tile), var(--tile-2));
  border: 1px solid var(--tile-edge); box-shadow: 0 3px 0 var(--tile-edge), var(--shadow);
  display: grid; place-items: center; font-weight: 800; color: var(--c3); font-size: 22px;
}
.hero h1 { font-size: 28px; margin: 0; }
.hero p { margin: 2px 0 0; color: var(--muted); }
.cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.card h2 { font-size: 18px; }
.field { display: grid; gap: 6px; margin-bottom: 12px; }
.field label { font-size: 13px; color: var(--muted); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.grow { flex: 1; }
.avatars { display: grid; grid-template-columns: repeat(6, 44px); gap: 8px; }
.avatar-pick { padding: 0; min-height: 0; width: 44px; height: 44px; border-radius: 50%; border: 2px solid transparent; background: none; }
.avatar-pick[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--accent); }
.avatar { display: inline-block; width: 40px; height: 40px; border-radius: 50%; flex: none; position: relative; }
.avatar svg { width: 100%; height: 100%; display: block; }
.code-big { font-size: 34px; font-weight: 800; letter-spacing: 6px; font-family: ui-monospace, Menlo, Consolas, monospace; }
.note { font-size: 13px; color: var(--muted); }
.banner {
  background: var(--info-bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 14px;
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
}
.seats { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 10px; }
.seat {
  display: flex; gap: 10px; align-items: center; padding: 10px; border: 1px dashed var(--line); border-radius: 12px; min-height: 64px;
}
.seat.filled { border-style: solid; background: var(--panel-2); }
.seat .who { flex: 1; min-width: 0; }
.seat .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag { display: inline-block; font-size: 11px; padding: 2px 7px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.tag.on { color: var(--good); border-color: currentColor; background: var(--good-bg); }
.tag.off { color: var(--warn); border-color: currentColor; background: var(--warn-bg); }

/* Ayarlar formu / kurallar */
.settings-group { margin-top: 14px; }
.settings-group h3 { font-size: 15px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.setting { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 9px 0; border-bottom: 1px dashed var(--line); align-items: center; }
.setting .lbl { font-weight: 600; font-size: 14px; }
.setting .desc { grid-column: 1 / -1; font-size: 12.5px; color: var(--muted); }
.setting .val { font-weight: 600; text-align: right; }
.switch { position: relative; width: 52px; height: 30px; border-radius: 999px; padding: 0; min-height: 0; background: var(--line); border: none; }
.switch::after { content: ""; position: absolute; left: 3px; top: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform 0.15s; box-shadow: 0 1px 3px rgba(0,0,0,0.3); }
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"]::after { transform: translateX(22px); }
.setting select, .setting input { min-height: 36px; padding: 5px 8px; max-width: 220px; }

/* --- Oyun ekranı ------------------------------------------------------------ */
#scr-game.active {
  display: grid;
  height: 100dvh;
  grid-template-columns: minmax(0, 1fr) 300px;
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas: "top top" "table side" "rack side";
  overflow: hidden;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}
#topbar {
  grid-area: top; display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: var(--panel);
  border-bottom: 1px solid var(--line); min-width: 0;
}
#scoreboard { display: flex; gap: 6px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
#scoreboard::-webkit-scrollbar { display: none; }
.pchip {
  display: flex; align-items: center; gap: 7px; padding: 4px 9px 4px 4px; border-radius: 999px; background: var(--panel-2);
  border: 2px solid transparent; flex: none; min-width: 0;
}
.pchip.turn { border-color: var(--turn); box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.25); }
.pchip .avatar { width: 30px; height: 30px; }
.pchip .nm { font-weight: 600; font-size: 13px; max-width: 92px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pchip .sub { font-size: 11px; color: var(--muted); white-space: nowrap; }
.pchip .pts { font-weight: 800; font-size: 14px; margin-left: 2px; font-variant-numeric: tabular-nums; }
.pchip .turnmark { font-size: 10px; font-weight: 700; color: #8a5a00; background: var(--turn); padding: 1px 6px; border-radius: 999px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--good); }
.dot.off { background: var(--warn); }
#timer { display: flex; align-items: center; gap: 6px; flex: none; font-variant-numeric: tabular-nums; }
#timer .bar { width: 70px; height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
#timer .bar i { display: block; height: 100%; background: var(--accent); width: 100%; transition: width 0.25s linear; }
#timer.low .bar i { background: var(--warn); }
#timer .sec { font-weight: 700; min-width: 34px; text-align: right; font-size: 14px; }
.top-actions { display: flex; gap: 4px; flex: none; }
.top-actions button { min-height: 34px; padding: 4px 9px; font-size: 13px; }
.top-actions .badge { background: var(--warn); color: #fff; border-radius: 999px; padding: 0 6px; font-size: 11px; margin-left: 4px; }

#table {
  grid-area: table; position: relative; min-height: 0; overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(255,255,255,0.08), transparent 60%),
    repeating-linear-gradient(45deg, rgba(0,0,0,0.025) 0 2px, transparent 2px 5px),
    linear-gradient(var(--felt), var(--felt-2));
  color: var(--felt-text);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas: "dtl top dtr" "left mid right" "dbl bot dbr";
  gap: 6px; padding: 8px;
  box-shadow: inset 0 0 0 6px rgba(0,0,0,0.12), inset 0 0 40px rgba(0,0,0,0.35);
}
.opp { display: flex; align-items: center; gap: 6px; font-size: 12px; min-width: 0; }
#opp-top { grid-area: top; justify-content: center; }
#opp-left { grid-area: left; flex-direction: column; justify-content: center; }
#opp-right { grid-area: right; flex-direction: column; justify-content: center; }
.opp .ochip { display: flex; align-items: center; gap: 6px; background: rgba(0,0,0,0.22); border-radius: 999px; padding: 3px 9px 3px 3px; border: 2px solid transparent; }
.opp .ochip.turn { border-color: var(--turn); }
.opp .ochip.speaking .avatar { box-shadow: 0 0 0 3px var(--speak); }
.opp .avatar { width: 28px; height: 28px; }
.opp .on { font-weight: 600; max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.backs { display: flex; }
.backs i { width: 10px; height: 15px; border-radius: 2px; background: linear-gradient(#e9dfc3, #cfc19c); border: 1px solid rgba(0,0,0,0.25); margin-left: -4px; }
#opp-left .backs, #opp-right .backs { display: none; }
.discard {
  display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: calc(var(--tw) + 12px);
  padding: 4px; border-radius: 10px; border: 1px dashed var(--felt-line); font-size: 11px; text-align: center;
}
#disc-tl { grid-area: dtl; } #disc-tr { grid-area: dtr; } #disc-bl { grid-area: dbl; } #disc-br { grid-area: dbr; }
.discard .cap { opacity: 0.85; white-space: nowrap; }
.discard .stack { position: relative; min-height: calc(var(--tw) * 1.36); min-width: var(--tw); display: grid; place-items: center; }
.discard.take { border: 2px solid var(--turn); background: rgba(251,191,36,0.12); cursor: pointer; }
.discard.take .cap { color: var(--turn); font-weight: 700; }
.discard.drop { border: 2px dashed rgba(255,255,255,0.6); }
.discard.drop.hot, .discard.drop:hover { background: rgba(255,255,255,0.12); }
.discard .hint { max-width: 150px; font-size: 10.5px; line-height: 1.25; color: #fde68a; }
#mid { grid-area: mid; display: flex; gap: 10px; min-height: 0; min-width: 0; }
#center {
  display: grid; grid-template-columns: auto auto; grid-auto-rows: min-content; gap: 4px 8px; align-items: end; justify-items: center;
  flex: none; align-self: flex-start;
}
#center .okey-info, #center .hashline { grid-column: 1 / -1; }
#center .indicator { --w: calc(var(--tw) * 0.8) !important; }
.pile {
  position: relative; width: calc(var(--tw) + 6px); height: calc(var(--tw) * 1.36 + 6px); border-radius: 8px; flex: none;
  background: linear-gradient(#efe6cb, #cdbf98); border: 1px solid rgba(0,0,0,0.3);
  box-shadow: 3px 3px 0 #b9ab86, 6px 6px 0 #a89a76, var(--shadow);
  display: grid; place-items: center; font-weight: 800; color: #5b4a2a; cursor: pointer;
}
.pile.can { outline: 3px solid var(--turn); outline-offset: 2px; animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { outline-color: rgba(251,191,36,0.3); } }
.pile small { position: absolute; bottom: 3px; font-size: 10px; font-weight: 600; }
.indicator-box { text-align: center; font-size: 11px; }
.okey-info { font-size: 11px; background: rgba(0,0,0,0.25); padding: 2px 7px; border-radius: 999px; white-space: nowrap; }
.hashline { font-size: 10px; opacity: 0.75; font-family: ui-monospace, Menlo, Consolas, monospace; white-space: nowrap; }
#melds { flex: 1; min-width: 0; overflow: auto; display: flex; flex-direction: column; gap: 6px; padding-right: 4px; }
.mgroup { display: flex; align-items: flex-start; gap: 6px; }
.mgroup .owner { font-size: 11px; font-weight: 700; background: rgba(0,0,0,0.25); padding: 2px 8px; border-radius: 999px; white-space: nowrap; flex: none; margin-top: 4px; }
.mlist { display: flex; flex-wrap: wrap; gap: 6px; }
.meld { display: flex; padding: 3px; border-radius: 7px; background: rgba(0,0,0,0.18); border: 2px solid transparent; }
.meld.target { border-color: rgba(255,255,255,0.55); cursor: pointer; }
.meld.target:hover, .meld.hot { border-color: var(--turn); background: rgba(251,191,36,0.15); }
.meld.fresh { animation: pop 0.6s ease-out; }
@keyframes pop { 0% { transform: scale(0.85); opacity: 0.4; } 100% { transform: scale(1); opacity: 1; } }
.status-line { grid-area: bot; text-align: center; align-self: center; font-size: 13px; font-weight: 600; text-shadow: 0 1px 2px rgba(0,0,0,0.4); }
.empty-melds { opacity: 0.6; font-size: 12px; margin: auto; }

/* --- Taşlar ------------------------------------------------------------------ */
.tile {
  --w: var(--tw);
  width: var(--w); height: calc(var(--w) * 1.36); border-radius: calc(var(--w) * 0.14);
  background: linear-gradient(var(--tile), var(--tile-2));
  border: 1px solid var(--tile-edge);
  box-shadow: 0 calc(var(--w) * 0.06) 0 var(--tile-edge), 0 2px 6px rgba(0,0,0,0.25);
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  padding-top: calc(var(--w) * 0.1);
  position: relative; user-select: none; -webkit-user-select: none; touch-action: none; flex: none;
  color: var(--c2);
}
.tile .n { font-weight: 800; font-size: calc(var(--w) * 0.56); line-height: 1; font-variant-numeric: tabular-nums; }
.tile .ab { font-size: calc(var(--w) * 0.22); font-weight: 700; letter-spacing: 0.5px; margin-top: calc(var(--w) * 0.04); opacity: 0.9; }
.tile .pip { position: absolute; bottom: calc(var(--w) * 0.12); width: calc(var(--w) * 0.18); height: calc(var(--w) * 0.18); border-radius: 50%; background: currentColor; opacity: 0.85; }
.tile.c0 { color: var(--c0); } .tile.c1 { color: var(--c1); } .tile.c2 { color: var(--c2); } .tile.c3 { color: var(--c3); }
.tile.fake { color: #3f3f46; }
.tile.fake .star { width: calc(var(--w) * 0.62); height: calc(var(--w) * 0.62); margin-top: calc(var(--w) * 0.02); }
.tile.fake .ab { font-size: calc(var(--w) * 0.18); }
.tile.joker::before {
  content: "OKEY"; position: absolute; top: -1px; right: -1px; font-size: calc(var(--w) * 0.17); font-weight: 800;
  background: var(--turn); color: #4a3200; padding: 0 3px; border-radius: 0 calc(var(--w) * 0.14) 0 4px; letter-spacing: 0.3px;
}
.tile.back { background: linear-gradient(135deg, #e9dfc3, #cfc19c); }
.tile.mini { --w: var(--mini); box-shadow: 0 1px 0 var(--tile-edge); }
.tile.mini .pip { display: none; }
.tile.mini.joker::before { display: none; }
.tile.mini .ab { font-size: calc(var(--w) * 0.24); }
.tile.sel { transform: translateY(-8px); box-shadow: 0 0 0 3px var(--turn), 0 8px 14px rgba(0,0,0,0.35); }
.tile.new { animation: glow 1.6s ease-out 2; }
@keyframes glow { 0%, 100% { box-shadow: 0 0 0 0 rgba(251,191,36,0); } 40% { box-shadow: 0 0 0 4px rgba(251,191,36,0.9); } }
.tile.bad { box-shadow: 0 0 0 3px var(--warn); }
.tile.dragging { opacity: 0.3; }
.tile.ghost { position: fixed; z-index: 1000; pointer-events: none; transform: rotate(-3deg) scale(1.06); box-shadow: 0 12px 24px rgba(0,0,0,0.4); }
.fly { position: fixed; z-index: 900; pointer-events: none; }

/* --- İstaka ------------------------------------------------------------------- */
#rackwrap { grid-area: rack; background: var(--panel); border-top: 1px solid var(--line); padding: 4px 8px calc(4px + env(safe-area-inset-bottom)); min-width: 0; }
.rack {
  position: relative; margin: 0 auto; width: max-content; max-width: 100%;
  padding: 4px 8px 8px; border-radius: 12px;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,0.04) 0 3px, transparent 3px 11px),
    repeating-linear-gradient(0deg, rgba(0,0,0,0.05) 0 1px, transparent 1px 7px),
    linear-gradient(var(--wood-hi), var(--wood) 40%, var(--wood-2));
  box-shadow: inset 0 2px 0 rgba(255,255,255,0.18), 0 6px 14px rgba(0,0,0,0.3);
}
.rack-row { position: relative; }
.rack-row + .rack-row { margin-top: 2px; }
.lbls { position: relative; height: 15px; }
.glabel {
  position: absolute; top: 1px; height: 13px; font-size: 10px; line-height: 13px; font-weight: 700; text-align: center;
  border-radius: 4px; color: #fff7e6; background: rgba(0,0,0,0.28); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding: 0 3px;
}
.glabel.run, .glabel.set, .glabel.pair { background: rgba(21,128,61,0.85); }
.glabel.invalid { background: rgba(194,65,12,0.9); }
.glabel.loose { background: rgba(0,0,0,0.25); color: #f3e7cc; font-weight: 500; }
.slots { display: flex; gap: 3px; padding-bottom: 6px; border-bottom: 4px solid var(--wood-2); }
.slot { width: var(--tw); height: calc(var(--tw) * 1.36 + 2px); border-radius: 6px; display: flex; align-items: flex-end; justify-content: center; }
.slot.empty { background: rgba(0,0,0,0.08); }
.slot.over { background: rgba(251,191,36,0.35); }
.slot.droppable { outline: 1px dashed rgba(255,255,255,0.25); outline-offset: -2px; }
#rackbar { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: center; padding: 5px 0 2px; }
.sumbox { font-weight: 700; font-size: 14px; padding: 4px 10px; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.sumbox.ok { color: var(--good); border-color: currentColor; background: var(--good-bg); }
.penalty-note { font-size: 12px; color: var(--warn); font-weight: 600; }
.penalty-note::before { content: "Uyarı: "; }

/* --- Yan panel ---------------------------------------------------------------- */
#side {
  grid-area: side; background: var(--panel); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0;
}
#side .sect { padding: 8px 10px; border-bottom: 1px solid var(--line); }
#side .sect h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted); margin-bottom: 6px; }
.tabs { display: flex; gap: 4px; padding: 6px 10px 0; }
.tabs button { flex: 1; min-height: 32px; font-size: 13px; border-radius: 8px 8px 0 0; border-bottom: none; }
.tabs button[aria-selected="true"] { background: var(--panel-2); font-weight: 700; }
.tabpanel { flex: 1; min-height: 0; overflow: auto; padding: 8px 10px; background: var(--panel-2); font-size: 13px; }
.logitem { padding: 3px 0; border-bottom: 1px dotted var(--line); line-height: 1.35; }
.logitem time { color: var(--muted); font-size: 11px; margin-right: 4px; font-variant-numeric: tabular-nums; }
.logitem.pen { color: var(--warn); }
.logitem.big { font-weight: 700; }
.chatitem { padding: 3px 0; }
.chatitem b { margin-right: 4px; }
.chatitem.react span { background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; font-weight: 600; }
.chatform { display: flex; gap: 6px; padding: 8px 10px; }
.chatform input { flex: 1; min-width: 0; }
.reacts { display: flex; flex-wrap: wrap; gap: 5px; padding: 0 10px 10px; }
.reacts button { min-height: 32px; padding: 3px 9px; font-size: 12.5px; border-radius: 999px; }
.voice-ph { font-size: 12.5px; color: var(--muted); }

/* Konuşma balonu (hızlı tepki) */
.bubble {
  position: absolute; z-index: 50; background: #fff; color: #222; font-weight: 700; font-size: 13px; padding: 5px 10px;
  border-radius: 12px; box-shadow: var(--shadow); pointer-events: none; animation: bub 2.6s ease-out forwards; white-space: nowrap;
}
@keyframes bub { 0% { opacity: 0; transform: translateY(6px); } 10%, 80% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-6px); } }

/* --- Modallar, bildirimler ------------------------------------------------------ */
.modal-back {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 500; display: grid; place-items: center; padding: 12px;
}
.modal {
  background: var(--panel); color: var(--text); border-radius: 16px; max-width: min(860px, 100%); width: 100%; max-height: calc(100dvh - 24px);
  overflow: auto; padding: 16px; box-shadow: var(--shadow); border: 1px solid var(--line);
}
.modal header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.modal header h2 { flex: 1; font-size: 19px; margin: 0; }
#toasts { position: fixed; left: 50%; top: 56px; transform: translateX(-50%); z-index: 700; display: grid; gap: 6px; width: min(520px, 92vw); pointer-events: none; }
.toast { background: var(--panel); border: 1px solid var(--line); border-left: 5px solid var(--accent); padding: 9px 12px; border-radius: 10px; box-shadow: var(--shadow); font-size: 14px; animation: tin 0.2s ease-out; }
.toast.warn { border-left-color: var(--warn); }
.toast.err { border-left-color: #dc2626; }
@keyframes tin { from { opacity: 0; transform: translateY(-6px); } }
#conn-banner {
  position: fixed; left: 0; right: 0; top: 0; z-index: 800; background: var(--warn); color: #fff; text-align: center; padding: 6px; font-weight: 600; font-size: 14px;
}
#rotate {
  position: fixed; inset: 0; z-index: 900; background: var(--felt); color: #fff; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; padding: 24px;
}
#rotate .phone { width: 54px; height: 92px; border: 4px solid #fff; border-radius: 12px; animation: rot 2s ease-in-out infinite; }
@keyframes rot { 40%, 70% { transform: rotate(-90deg); } }
@media (orientation: portrait) and (max-width: 820px) {
  body.in-game #rotate { display: flex; }
}

/* El sonu tablosu */
.res-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.res-table th, .res-table td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.res-table td.num { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.res-row { animation: rowin 0.45s ease-out both; }
@keyframes rowin { from { opacity: 0; transform: translateX(-12px); } }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { font-size: 12px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel-2); white-space: nowrap; }
.chip.penalty { color: var(--warn); background: var(--warn-bg); border-color: currentColor; }
.chip.penalty::before { content: "Ceza: "; font-weight: 700; }
.chip.bonus { color: var(--good); background: var(--good-bg); border-color: currentColor; }
.chip.bonus::before { content: "Bonus: "; font-weight: 700; }
.chip.base { }
.chip.info { font-style: italic; }
.mult-line { background: var(--info-bg); border-radius: 10px; padding: 8px 12px; margin: 8px 0; font-weight: 600; }
.formula { font-size: 12px; color: var(--muted); margin-top: 4px; }
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 10px; margin: 10px 0 16px; }
.podium .step { text-align: center; width: 120px; }
.podium .block { border-radius: 10px 10px 0 0; background: var(--accent); color: #fff; font-weight: 800; font-size: 26px; display: grid; place-items: center; }
.podium .p1 .block { height: 110px; background: #c99a2e; }
.podium .p2 .block { height: 80px; background: #8e9aa6; }
.podium .p3 .block { height: 60px; background: #a8643a; }
.podium .avatar { width: 46px; height: 46px; }
.chart-wrap { overflow-x: auto; }
.audit-ok { color: var(--good); font-weight: 700; }
.audit-bad { color: var(--warn); font-weight: 700; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; word-break: break-all; }
.rules-list li { margin: 4px 0; }

/* --- Dar ekranlar ------------------------------------------------------------------ */
@media (max-width: 1100px) {
  #scr-game.active { grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "table" "rack"; }
  #side {
    position: fixed; top: 0; right: 0; bottom: 0; width: min(330px, 88vw); z-index: 400; transform: translateX(105%);
    transition: transform 0.2s; box-shadow: var(--shadow); padding-top: env(safe-area-inset-top);
  }
  #side.open { transform: none; }
}
@media (min-width: 1101px) { #btn-panel { display: none; } }
.lastd { display: none; }
.penalty-note .short { display: none; }
@media (max-height: 520px) {
  body { font-size: 14px; }
  #topbar { padding: 2px 6px; gap: 5px; }
  .pchip { padding: 2px 7px 2px 2px; gap: 5px; }
  .pchip .avatar { width: 22px; height: 22px; }
  .pchip .sub { display: none; }
  .pchip .nm { font-size: 12px; max-width: 70px; }
  .top-actions button { min-height: 30px; padding: 2px 7px; font-size: 12px; }
  #timer .bar { width: 44px; }
  /* Masa: rakipler üstte tek sıra; altta bana ait atma alanı, orta, yandan al */
  #table {
    padding: 4px 6px; gap: 4px;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas: "left top right" "dbl mid dbr";
  }
  #disc-tl, #disc-tr, .status-line, .backs { display: none; }
  #opp-left, #opp-right { flex-direction: row; }
  .opp .ochip { padding: 2px 8px 2px 2px; font-size: 11px; }
  .opp .avatar { width: 22px; height: 22px; }
  .lastd { display: inline-flex; align-items: center; gap: 3px; font-size: 10px; opacity: 0.9; margin-left: 4px; }
  .discard { padding: 2px 4px; gap: 2px; align-self: stretch; justify-content: center; }
  .discard .hint { display: none; }
  .discard .stack { min-height: 0; }
  #center .indicator-box .cap { display: none; }
  .hashline { display: none; }
  .rack { padding: 2px 6px 4px; }
  .lbls { height: 11px; }
  .glabel { font-size: 8.5px; height: 10px; line-height: 10px; }
  .slots { padding-bottom: 3px; border-bottom-width: 3px; }
  #rackwrap { padding-top: 2px; }
  #rackbar { padding: 2px 0 0; gap: 4px; flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; scrollbar-width: none; }
  #rackbar::-webkit-scrollbar { display: none; }
  #rackbar > * { flex: none; }
  #rackbar button { min-height: 30px; padding: 2px 8px; font-size: 12.5px; }
  .sumbox { font-size: 12px; padding: 2px 7px; }
  .penalty-note { font-size: 10.5px; }
  #rackbar .penalty-note .long { display: none; }
  #rackbar .penalty-note .short { display: inline; }
}
@media (max-width: 1000px) {
  #rackbar { gap: 4px; }
  #rackbar button { min-height: 34px; padding: 4px 9px; font-size: 13px; }
  .sumbox { font-size: 12.5px; padding: 3px 8px; }
  .penalty-note { font-size: 11px; }
  .penalty-note::before { content: ""; }
}
@media (max-width: 640px) {
  .top-actions .lbl-long { display: none; }
  .hero h1 { font-size: 23px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* --- Sesli sohbet entegrasyonu ---------------------------------------------------------------- */
#btn-mic { font-weight: 700; border-color: var(--accent); color: var(--accent); user-select: none; -webkit-user-select: none; touch-action: none; }
#btn-mic.mic-off { color: var(--warn); border-color: var(--warn); }
#btn-mic.mic-held { background: var(--speak); color: #fff; border-color: transparent; }
.pchip.speaking .avatar, .seat.speaking .avatar, .ochip.speaking .avatar { box-shadow: 0 0 0 3px var(--speak); border-radius: 50%; }
.pchip.speaking { border-color: var(--speak); }
#voice-box .vc { font-size: 12.5px; }

/* --- Kasa (sanal jeton) ve Karne ---------------------------------------------------------------- */
.kasa-bal { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; margin: 4px 0 6px; }
.kasa-top { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; justify-content: space-between; }
.kasa-stats { display: flex; gap: 6px 12px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.coin-note { font-size: 12px; color: var(--muted); margin: 6px 0; }
.coin-banner { border-left: 5px solid var(--accent); }
.coin-banner.low { border-left-color: var(--warn); }
.coin-banner > div { display: grid; gap: 3px; }
#vote-box {
  position: fixed; left: 50%; transform: translateX(-50%); top: 50px; z-index: 650; width: min(420px, 92vw);
  background: var(--panel); border: 2px solid var(--accent); border-radius: 14px; padding: 10px 14px; box-shadow: var(--shadow); font-size: 14px;
}
.karne { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.award { border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; background: var(--panel-2); border-top: 4px solid var(--good); }
.award.bad { border-top-color: var(--warn); }
.award-title { font-weight: 800; }
.award-who { font-weight: 700; margin-top: 4px; }
.award.good .award-title::before { content: "Ödül: "; color: var(--good); }
.award.bad .award-title::before { content: "Uyarı: "; color: var(--warn); }
.chip.lb-good { color: var(--good); background: var(--good-bg); border-color: currentColor; font-weight: 700; }
.chip.lb-bad { color: var(--warn); background: var(--warn-bg); border-color: currentColor; font-weight: 700; }
