/* =========================================================
   UNO Indonesia Online — client/style.css
   Struktur:
     1. Variabel & dasar
     2. Layar & tombol/input
     3. Beranda
     4. Lobi room
     5. Kartu UNO
     6. Meja permainan
     7. Hasil akhir
     8. Chat & toast
     9. Overlay (pilih warna / target)
    10. Responsive (HP)
   ========================================================= */

/* ---------------- 1. VARIABEL & DASAR ---------------- */
:root {
  --uno-red: #ed1c24;
  --uno-yellow: #ffde00;
  --uno-green: #00a651;
  --uno-blue: #0072bc;
  --felt-dark: #0c3b2e;
  --felt-light: #17604a;
  --bg: #0f1923;
  --panel: rgba(255, 255, 255, 0.05);
  --panel-strong: rgba(255, 255, 255, 0.09);
  --line: rgba(255, 255, 255, 0.12);
  --ink-soft: #9fb4c8;
  --ok: #38d39f;
  --warn: #ffb020;
  --card-w: clamp(52px, 8vw, 78px);
  --radius: 14px;
  --shadow: 0 10px 26px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Verdana, sans-serif;
  color: #fff;
  background:
    radial-gradient(1100px 520px at 50% -8%, #1e3d57 0%, transparent 60%),
    var(--bg);
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
}

button, input, select { font-family: inherit; }
.hidden { display: none !important; }
.hint { color: var(--ink-soft); font-size: 12.5px; margin: 6px 0 0; }
.error-text { color: #ff8f8a; font-size: 13.5px; margin: 10px 0 0; font-weight: 600; }
.sub-head { margin-top: 14px; }

/* ---------------- 2. LAYAR, TOMBOL & INPUT ---------------- */
.screen { display: none; padding: 16px 14px 28px; }
.screen.active { display: block; animation: fade-in 0.25s ease; }

@keyframes fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin: 0 auto 14px;
  max-width: 620px;
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.panel-head h2 { font-size: 15px; margin: 0; letter-spacing: 0.3px; }

.btn {
  border: 0;
  border-radius: 12px;
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease, opacity 0.15s ease;
}
.btn:active { transform: translateY(2px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(180deg, #ff5548, #d61f26);
  color: #fff;
  box-shadow: 0 4px 0 #7e1116, 0 10px 18px rgba(0, 0, 0, 0.32);
}
.btn-primary:not(:disabled):hover { filter: brightness(1.08); }

.btn-ghost {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #fff;
}
.btn-ghost:not(:disabled):hover { background: rgba(255, 255, 255, 0.16); }
.btn-ghost.muted { opacity: 0.5; filter: grayscale(1); }

.btn-warn { background: linear-gradient(180deg, #ffcf5c, #e79b00); color: #3a2600; box-shadow: 0 3px 0 #8a5c00; }
.btn-uno {
  background: linear-gradient(180deg, #ff6b5e, #b6000a);
  color: #fff;
  box-shadow: 0 4px 0 #6d0007, 0 0 0 3px rgba(255, 255, 255, 0.12);
  animation: uno-pulse 1.6s ease-in-out infinite;
}
@keyframes uno-pulse { 50% { filter: brightness(1.18); } }
.btn-mini { padding: 7px 12px; font-size: 13px; border-radius: 10px; }

.row-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.row-btns .btn { flex: 1 1 140px; }

.field { display: block; margin-bottom: 12px; }
.field-label { display: block; font-size: 12.5px; color: var(--ink-soft); margin-bottom: 6px; font-weight: 600; }

.input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.28);
  color: #fff;
  font-size: 15px;
  outline: none;
}
.input:focus { border-color: #4aa3df; box-shadow: 0 0 0 3px rgba(74, 163, 223, 0.18); }
select.input { appearance: none; background-image: none; }

.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0 12px;
  color: var(--ink-soft);
  font-size: 12px;
}
.divider::before, .divider::after { content: ""; height: 1px; background: var(--line); flex: 1; }

/* ---------------- 3. BERANDA ---------------- */
.home-wrap { max-width: 620px; margin: 0 auto; }
.home-head { text-align: center; margin: 10px 0 18px; }

.logo-card {
  width: 108px;
  aspect-ratio: 2 / 3;
  margin: 0 auto 14px;
  border-radius: 14px;
  background: var(--uno-red);
  border: 4px solid #fff;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.45);
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  transform: rotate(-6deg);
}
.logo-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: #fff;
  width: 170%;
  height: 88%;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) rotate(-33deg);
  border-radius: 50%;
}
.logo-glyph {
  position: relative;
  z-index: 1;
  font-size: 30px;
  font-weight: 900;
  font-style: italic;
  color: var(--uno-red);
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.25);
}
.home-title { font-size: clamp(24px, 6vw, 34px); margin: 0 0 6px; letter-spacing: 0.4px; }
.home-title span { color: var(--uno-yellow); }
.home-sub { color: var(--ink-soft); font-size: 14px; margin: 0; }

.join-row { display: flex; gap: 10px; }
.code-input { flex: 1; text-transform: uppercase; letter-spacing: 6px; font-weight: 800; text-align: center; }

.rooms-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.rooms-empty { color: var(--ink-soft); font-size: 13px; }
.room-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
}
.room-item b { font-size: 15px; letter-spacing: 2px; }
.room-item small { color: var(--ink-soft); display: block; font-size: 12px; margin-top: 2px; }

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 6px;
  text-align: center;
}
.stat b { display: block; font-size: 18px; }
.stat span { font-size: 11px; color: var(--ink-soft); }

.top-players { list-style: none; counter-reset: rank; margin: 0; padding: 0; display: grid; gap: 6px; }
.top-players li {
  counter-increment: rank;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  padding: 7px 10px;
  border-radius: 10px;
  background: var(--panel-strong);
}
.top-players li::before {
  content: counter(rank);
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  font-size: 11px;
  font-weight: 800;
}
.top-players li .tp-wins { margin-left: auto; color: var(--uno-yellow); font-weight: 800; }

.how-to summary { cursor: pointer; font-weight: 700; font-size: 14.5px; }
.how-to ul { margin: 10px 0 0; padding-left: 18px; color: var(--ink-soft); font-size: 13px; line-height: 1.6; }
.how-to b { color: #fff; }

/* ---------------- 4. LOBI ROOM ---------------- */
.lobby-wrap { max-width: 620px; margin: 0 auto; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.code-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 12px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
}
.code-chip-label { font-size: 11px; color: var(--ink-soft); }
.code-chip b { letter-spacing: 4px; font-size: 17px; color: var(--uno-yellow); }

.seat-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.seat {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
}
.seat.is-you { border-color: rgba(74, 163, 223, 0.55); }
.seat.offline { opacity: 0.5; }
.seat-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 20px;
  background: rgba(0, 0, 0, 0.3);
  border: 2px solid rgba(255, 255, 255, 0.25);
  flex: 0 0 auto;
}
.seat-avatar.red { border-color: var(--uno-red); }
.seat-avatar.yellow { border-color: var(--uno-yellow); }
.seat-avatar.green { border-color: var(--uno-green); }
.seat-avatar.blue { border-color: var(--uno-blue); }
.seat-info { flex: 1; min-width: 0; }
.seat-name { font-weight: 700; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seat-meta { font-size: 11.5px; color: var(--ink-soft); }
.seat-badge {
  font-size: 11px;
  font-weight: 800;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  white-space: nowrap;
}
.seat-badge.ready { background: rgba(56, 211, 159, 0.18); color: var(--ok); border-color: rgba(56, 211, 159, 0.4); }
.seat-badge.waiting { background: rgba(255, 255, 255, 0.07); color: var(--ink-soft); }
.seat-badge.host { background: rgba(255, 222, 0, 0.16); color: var(--uno-yellow); border-color: rgba(255, 222, 0, 0.35); }
.seat-badge.offline { background: rgba(255, 143, 138, 0.14); color: #ff8f8a; border-color: rgba(255, 143, 138, 0.35); }
.seat-badge.uno { background: rgba(237, 28, 36, 0.2); color: #ff8f8a; border-color: rgba(237, 28, 36, 0.45); }

.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.toggles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 4px; }
.toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  cursor: pointer;
}
.toggle input { width: 16px; height: 16px; accent-color: var(--uno-red); }
.toggle input:disabled { cursor: not-allowed; }
#lobby-settings.locked .toggle, #lobby-settings.locked .field { opacity: 0.6; }

.lobby-actions { max-width: 620px; margin: 0 auto; display: grid; gap: 10px; }
.lobby-actions .btn { width: 100%; }

/* ---------------- 5. KARTU UNO ---------------- */
.card {
  position: relative;
  width: var(--card-w);
  aspect-ratio: 2 / 3;
  border-radius: calc(var(--card-w) * 0.11);
  background: var(--card-bg, #23262e);
  border: calc(var(--card-w) * 0.035) solid #fff;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  flex: 0 0 auto;
  user-select: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}
.card.red    { --card-bg: var(--uno-red);    --glyph: var(--uno-red); }
.card.yellow { --card-bg: var(--uno-yellow); --glyph: #eab800; }
.card.green  { --card-bg: var(--uno-green);  --glyph: var(--uno-green); }
.card.blue   { --card-bg: var(--uno-blue);   --glyph: var(--uno-blue); }
.card.wild   { --card-bg: #23262e; }

.card::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 170%;
  height: 88%;
  transform: translate(-50%, -50%) rotate(-33deg);
  background: #fff;
  border-radius: 50%;
}
.card-glyph {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  font-size: calc(var(--card-w) * 0.5);
  font-weight: 900;
  font-style: italic;
  line-height: 1;
  color: var(--glyph, #fff);
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.28);
}
.card-corner {
  position: absolute;
  z-index: 1;
  color: #fff;
  font-weight: 900;
  font-style: italic;
  font-size: calc(var(--card-w) * 0.18);
  line-height: 1;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.45);
}
.card-corner.tl { top: 5%; left: 8%; }
.card-corner.br { bottom: 5%; right: 8%; transform: rotate(180deg); }

.wild-wheel {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 1;
  width: 62%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%) rotate(45deg);
  border-radius: 50%;
  background: conic-gradient(var(--uno-red) 0 25%, var(--uno-blue) 0 50%,
                             var(--uno-yellow) 0 75%, var(--uno-green) 0);
  box-shadow: 0 0 0 3px #fff;
}
.wild-badge {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  transform: translate(-50%, -50%);
  background: #23262e;
  color: #fff;
  font-size: calc(var(--card-w) * 0.2);
  font-weight: 900;
  font-style: italic;
  padding: 2px 8px;
  border-radius: 999px;
}

/* Belakang kartu */
.card.back { --card-bg: linear-gradient(160deg, #ff3b30, #b3000c); }
.back-logo {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 900;
  font-style: italic;
  font-size: calc(var(--card-w) * 0.3);
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.35);
}

/* Kartu mini di kursi lawan */
.card.mini { --card-w: 26px; }
.card.mini .card-corner { display: none; }
.card.mini .card-glyph { font-size: 12px; }
.card.mini .back-logo { font-size: 8px; }

/* Kartu di tangan: bisa diklik bila boleh dimainkan */
.card.in-hand { cursor: pointer; }
.card.in-hand.playable:hover { transform: translateY(-14px) scale(1.04); box-shadow: 0 14px 22px rgba(0, 0, 0, 0.5); }
.card.in-hand.not-playable { filter: grayscale(0.65) brightness(0.62); cursor: not-allowed; }
.card.in-hand.selected { transform: translateY(-16px); box-shadow: 0 0 0 3px var(--uno-yellow), 0 14px 22px rgba(0, 0, 0, 0.5); }
.card.deal { animation: deal-in 0.34s cubic-bezier(0.2, 0.9, 0.3, 1.15) backwards; }
@keyframes deal-in { from { opacity: 0; transform: translateY(-46px) scale(0.8); } }

/* Kartu yang sedang terbang: ditempel ke <body> sebagai position:fixed supaya
   tidak terpotong oleh .hand yang overflow-x:auto. Animasi hanya menyentuh
   transform/scale sehingga dikomposit GPU tanpa memicu layout ulang. */
.card.flying {
  position: fixed;
  z-index: 45;
  margin: 0;
  pointer-events: none;
  will-change: transform;
  transform: translate(-50%, -50%);
  box-shadow: 0 18px 30px rgba(0, 0, 0, 0.5);
}

/* ---------------- 6. MEJA PERMAINAN ---------------- */
.table-wrap {
  max-width: 900px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.table-topbar { margin-bottom: 0; }
.round-chip {
  font-size: 13px;
  color: var(--ink-soft);
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
}
.round-chip b { color: #fff; }
.table-top-right { display: flex; gap: 8px; }

/* Kursi lawan di sekeliling meja */
.table-seats { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.opp {
  min-width: 132px;
  max-width: 190px;
  flex: 1 1 132px;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.opp.turn {
  border-color: var(--uno-yellow);
  box-shadow: 0 0 0 2px rgba(255, 222, 0, 0.25), 0 8px 18px rgba(0, 0, 0, 0.35);
  transform: translateY(-3px);
}
.opp.out { opacity: 0.5; }
.opp-head { display: flex; align-items: center; gap: 6px; }
.opp-name { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.opp-count {
  font-size: 11.5px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line);
}
.opp-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 5px; }
.opp-tags .seat-badge { font-size: 10px; padding: 2px 7px; }
.mini-hand { display: flex; margin-top: 6px; }
.mini-hand .card { margin-left: -14px; }
.mini-hand .card:first-child { margin-left: 0; }
.opp-bar { height: 4px; border-radius: 999px; background: rgba(255, 255, 255, 0.12); margin-top: 7px; overflow: hidden; }
.opp-bar span { display: block; height: 100%; background: var(--uno-yellow); width: 0; }

/* Tengah meja: deck & discard */
.table-center {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(14px, 5vw, 46px);
  padding: 18px 10px;
  border-radius: 20px;
  background: radial-gradient(circle at 50% 40%, var(--felt-light), var(--felt-dark));
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.45);
}
.pile { position: relative; display: grid; place-items: center; }
.pile-count {
  position: absolute;
  bottom: -6px;
  right: -6px;
  font-size: 11.5px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid var(--line);
}
.color-count { bottom: auto; top: -8px; right: auto; left: 50%; transform: translateX(-50%); }
.deck-btn { border: 0; padding: 0; cursor: pointer; }
.deck-btn:disabled { cursor: not-allowed; opacity: 0.7; }
.discard-pile { position: relative; width: calc(var(--card-w) * 1.15); aspect-ratio: 2 / 3; }
.discard-pile .card { position: absolute; inset: 0; }
.discard-pile .card.top { animation: drop-in 0.28s ease; }
.discard-pile .card.silent { animation: none; }
.discard-pile .card.landing { opacity: 0; }
.discard-pile .card.pop { animation: pop-in 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.1); }
@keyframes drop-in { from { transform: translateY(-18px) rotate(-6deg); opacity: 0.4; } }
@keyframes pop-in { from { scale: 1.14; } }
.direction-badge { position: absolute; top: 8px; right: 12px; font-size: 20px; color: rgba(255, 255, 255, 0.55); }
.direction-badge.reverse { transform: scaleX(-1); }

/* Bar waktu giliran */
.turn-bar {
  position: relative;
  height: 26px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  overflow: hidden;
}
.turn-fill {
  position: absolute;
  inset: 0;
  width: 100%;
  transform-origin: left center;
  background: linear-gradient(90deg, #38d39f, #ffde00);
  opacity: 0.35;
  transition: transform 0.1s linear;
}
.turn-bar.urgent .turn-fill { background: linear-gradient(90deg, #ffb020, #ed1c24); opacity: 0.55; }
.turn-text {
  position: relative;
  z-index: 1;
  display: block;
  text-align: center;
  line-height: 24px;
  font-size: 12.5px;
  font-weight: 700;
}

.table-banner {
  text-align: center;
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 700;
  background: rgba(255, 222, 0, 0.14);
  border: 1px solid rgba(255, 222, 0, 0.35);
  color: #ffe9a3;
}
.table-banner.danger { background: rgba(237, 28, 36, 0.16); border-color: rgba(237, 28, 36, 0.45); color: #ffb3ae; }
.table-banner.ok { background: rgba(56, 211, 159, 0.14); border-color: rgba(56, 211, 159, 0.4); color: #a9f0d5; }

/* Area pemain sendiri */
.my-area { margin-top: auto; }
.my-seat {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.hand {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  min-height: calc(var(--card-w) * 1.5);
  padding: 16px 6px 6px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.hand .card { margin-left: calc(var(--card-w) * -0.34); }
.hand .card:first-child { margin-left: 0; }
.hand-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 4px; }
.hand-actions .btn { flex: 0 1 150px; }

.table-log { max-width: none; margin: 0 0 12px; }
.table-log summary { cursor: pointer; font-weight: 700; font-size: 13.5px; }
.log-list { list-style: none; margin: 10px 0 0; padding: 0; max-height: 180px; overflow-y: auto; display: grid; gap: 4px; }
.log-list li { font-size: 12.5px; color: var(--ink-soft); }
.log-list li.turn { color: #ffe9a3; }
.log-list li.play { color: #cfe8ff; }

/* ---------------- 7. HASIL AKHIR ---------------- */
.over-wrap { max-width: 560px; margin: 6vh auto 0; }
.over-panel { text-align: center; }
.over-title { font-size: clamp(22px, 5vw, 30px); margin: 4px 0 6px; }
.over-sub { color: var(--ink-soft); font-size: 14px; margin: 0 0 16px; }
.standings { list-style: none; counter-reset: rank; margin: 0 0 18px; padding: 0; display: grid; gap: 7px; }
.standings li {
  counter-increment: rank;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border-radius: 12px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  font-size: 14px;
}
.standings li::before {
  content: counter(rank);
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  font-size: 11.5px;
  font-weight: 800;
}
.standings li.winner { border-color: var(--uno-yellow); background: rgba(255, 222, 0, 0.12); }
.standings .st-cards { margin-left: auto; color: var(--ink-soft); font-size: 12.5px; }

/* ---------------- 8. CHAT & TOAST ---------------- */
.chat-panel {
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 40;
  width: min(340px, calc(100vw - 24px));
  max-height: min(60vh, 460px);
  display: flex;
  flex-direction: column;
  background: #16222e;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}
.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
  background: rgba(255, 255, 255, 0.05);
}
.chat-list {
  list-style: none;
  margin: 0;
  padding: 10px;
  flex: 1;
  overflow-y: auto;
  display: grid;
  gap: 6px;
  align-content: start;
}
.chat-list li { font-size: 13px; line-height: 1.45; word-break: break-word; }
.chat-list li .chat-from { font-weight: 800; color: #ffe9a3; }
.chat-list li.kind-system { color: var(--ink-soft); font-style: italic; font-size: 12.5px; }
.chat-list li.kind-player { background: rgba(255, 255, 255, 0.05); padding: 6px 8px; border-radius: 9px; }
.chat-form { display: flex; gap: 6px; padding: 8px; border-top: 1px solid var(--line); }
.chat-form .input { padding: 9px 11px; font-size: 14px; }
.chat-form .btn { flex: 0 0 auto; }

.toasts {
  position: fixed;
  left: 50%;
  top: 12px;
  transform: translateX(-50%);
  z-index: 60;
  display: grid;
  gap: 8px;
  width: min(420px, calc(100vw - 24px));
  pointer-events: none;
}
.toast {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 600;
  text-align: center;
  background: rgba(22, 34, 46, 0.96);
  border: 1px solid var(--line);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.45);
  animation: toast-in 0.22s ease;
}
.toast.ok { border-color: rgba(56, 211, 159, 0.5); color: #a9f0d5; }
.toast.error { border-color: rgba(237, 28, 36, 0.55); color: #ffb3ae; }
.toast.warn { border-color: rgba(255, 176, 32, 0.5); color: #ffe0a3; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px); } }

.conn-banner {
  position: fixed;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  background: rgba(237, 28, 36, 0.92);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.45);
}
.conn-banner.ok { background: rgba(56, 211, 159, 0.92); color: #06231a; }
.conn-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #fff;
  animation: blink 1s steps(2, start) infinite;
}
@keyframes blink { 50% { opacity: 0.25; } }

/* ---------------- 9. OVERLAY ---------------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(6, 12, 18, 0.72);
  backdrop-filter: blur(3px);
}
.overlay-box {
  width: min(420px, 100%);
  padding: 18px;
  border-radius: var(--radius);
  background: #16222e;
  border: 1px solid var(--line);
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.55);
  text-align: center;
}
.overlay-box h2 { font-size: 17px; margin: 0 0 14px; }
.color-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.color-btn {
  border: 0;
  border-radius: 12px;
  padding: 16px 10px;
  font-size: 15px;
  font-weight: 900;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.35);
}
.color-btn.red { background: var(--uno-red); }
.color-btn.yellow { background: var(--uno-yellow); color: #4a3a00; }
.color-btn.green { background: var(--uno-green); }
.color-btn.blue { background: var(--uno-blue); }
.color-btn:hover { filter: brightness(1.1); }

.target-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.target-list button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  color: #fff;
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;
}
.target-list button:hover { background: rgba(255, 255, 255, 0.16); }
.target-list .tg-count { margin-left: auto; font-size: 12.5px; color: var(--ink-soft); font-weight: 600; }

/* ---------------- 10. RESPONSIVE ---------------- */
@media (max-width: 720px) {
  :root { --card-w: clamp(48px, 13vw, 64px); }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .settings-grid, .toggles { grid-template-columns: 1fr; }
  .table-seats { gap: 6px; }
  .opp { min-width: 104px; flex: 1 1 104px; padding: 6px 8px; }
  .opp-name { font-size: 12px; }
  .table-center { gap: 12px; padding: 12px 8px; }
  .hand { justify-content: flex-start; padding-left: 10px; }
  .hand-actions .btn { flex: 1 1 100px; padding: 11px 10px; font-size: 14px; }
  .chat-panel { right: 8px; left: 8px; width: auto; max-height: 55vh; }
  .over-wrap { margin-top: 3vh; }
  .screen { padding: 12px 10px 22px; }
}

@media (max-width: 420px) {
  .card.mini { --card-w: 22px; }
  .round-chip { font-size: 12px; padding: 5px 9px; }
  .table-top-right .btn-mini { padding: 6px 9px; font-size: 12px; }
}

/* ---------------- 11. GERAK MINIMAL (PREFERS-REDUCED-MOTION) ---------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .card.flying { display: none; }
}

