/* Domino Indonesia — gaya tampilan. Ringan: tanpa gambar, kartu digambar dengan CSS. */
:root {
  --page: #E9EEEC;
  --ink: #111827;
  --muted: #4B5563;
  --line: #E5E7EB;
  --card: #FFFFFF;
  --green: #0B7A55;
  --green-dark: #075C40;
  --team-a: #1D4ED8;
  --team-a-soft: #DBEAFE;
  --team-a-ring: #93C5FD;
  --team-b: #C2410C;
  --team-b-soft: #FFEDD5;
  --team-b-ring: #FDBA74;
  --amber: #B45309;
  --wood: #6B4226;
  --wood-light: #8A5A34;
  --felt: radial-gradient(ellipse at 50% 45%, #1E8E6D 0%, #146E54 65%, #0E5541 100%);
  --pip: #CC1B26;
  --pip-rim: rgba(110, 0, 10, 0.35);
  --tile-face: linear-gradient(180deg, #F6F5F2 0%, #E7E5E0 100%);
  --tile-gray: linear-gradient(180deg, #D3D1CC 0%, #BEBCB6 100%);
  --divider: #A3121E;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--page); color: var(--ink); }
body { min-height: 100vh; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--green); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- tombol umum ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 48px; padding: 0 22px; border-radius: 12px; border: 0; font-size: 15px; font-weight: 800; text-decoration: none; }
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-dark); color: #fff; }
.btn-dark { background: var(--ink); color: #fff; }
.btn-amber { background: var(--amber); color: #fff; }
.btn-round { width: 48px; height: 48px; border-radius: 50%; border: 1.5px solid var(--line); background: #fff; display: inline-flex; align-items: center; justify-content: center; color: var(--ink); flex: 0 0 auto; }
.btn-link { border: 0; background: none; padding: 4px 0; color: var(--muted); font-size: 12px; font-weight: 700; text-decoration: underline; }
:focus-visible { outline: 3px solid #F59E0B; outline-offset: 2px; }

/* ---------- halaman awal ---------- */
.home { max-width: 560px; margin: 0 auto; padding: 40px 20px 56px; display: flex; flex-direction: column; gap: 22px; }
.brand { display: flex; align-items: center; gap: 12px; font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.home h1 { margin: 0; font-size: 34px; line-height: 1.1; letter-spacing: -0.03em; }
.home p { margin: 0; color: var(--muted); line-height: 1.6; }
.panel { background: #fff; border: 1.5px solid var(--line); border-radius: 20px; padding: 22px; display: flex; flex-direction: column; gap: 12px; }
.panel label { font-size: 14px; font-weight: 800; }
.panel input { height: 50px; padding: 0 14px; border-radius: 12px; border: 1.5px solid #D1D5DB; font: inherit; font-size: 16px; font-weight: 700; }
.soon { opacity: 0.75; }
.chip { align-self: flex-start; padding: 4px 10px; border-radius: 999px; background: #F3F4F6; font-size: 12px; font-weight: 800; color: #374151; }
.rules { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.rules li { padding: 12px 14px; border-radius: 12px; background: #fff; font-size: 14px; line-height: 1.5; }

/* ---------- halaman meja ---------- */
.game { max-width: 1240px; margin: 0 auto; padding: 16px 20px 24px; display: flex; flex-direction: column; gap: 14px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.room { display: flex; flex-direction: column; align-items: flex-start; flex: 1 1 auto; min-width: 0; }
.room b { font-size: 15px; }
.room span { font-size: 12px; color: var(--muted); }
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }

.scoreboard { display: flex; align-items: stretch; border-radius: 16px; border: 1.5px solid var(--line); background: #fff; box-shadow: 0 4px 14px rgba(17, 24, 39, 0.06); overflow: hidden; flex: 0 0 auto; }
.sb-round { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 8px 14px; background: var(--ink); color: #fff; min-width: 60px; }
.sb-round small { font-size: 10px; font-weight: 800; letter-spacing: 0.16em; color: #FCD34D; }
.sb-round b { font-size: 30px; line-height: 1; }
.sb-grid { display: grid; grid-template-columns: auto auto auto auto; align-items: center; gap: 3px 14px; padding: 8px 14px; }
.sb-grid .h { font-size: 10px; font-weight: 800; color: #6B7280; text-align: center; }
.sb-grid .t { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 800; }
.sb-grid .t::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.sb-grid .a { color: var(--team-a); }
.sb-grid .b { color: var(--team-b); }
.sb-grid .pts { font-size: 20px; font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; }
.sb-grid .n { font-size: 15px; font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; }

.arena { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: ". atas ." "kiri meja kanan" ". saya ."; gap: 14px 18px; align-items: center; }
.seat-top { grid-area: atas; justify-self: center; }
.seat-left { grid-area: kiri; }
.seat-right { grid-area: kanan; }
.table-wrap { grid-area: meja; min-width: 0; }
.me-area { grid-area: saya; display: flex; flex-direction: column; gap: 10px; }

/* kursi pemain */
.seat { display: flex; flex-direction: column; align-items: center; gap: 5px; text-align: center; width: 96px; }
.seat-top { flex-direction: row; width: auto; gap: 12px; text-align: left; }
.seat-top .info { align-items: flex-start; }
.seat .info { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.seat .name { font-size: 15px; font-weight: 800; }
.seat .team { font-size: 12px; font-weight: 800; }
.seat .badges { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; }
.badge-count { padding: 2px 8px; border-radius: 6px; background: #DC2626; color: #fff; font-size: 12px; font-weight: 800; }
.badge-pass { padding: 2px 8px; border-radius: 999px; background: #fff; font-size: 12px; font-weight: 800; }
.avatar { width: 72px; height: 72px; border-radius: 50%; padding: 4px; flex: 0 0 auto; }
.avatar > span { width: 100%; height: 100%; border-radius: 50%; border: 3px solid #fff; display: flex; align-items: center; justify-content: center; font-size: 21px; font-weight: 800; }
.team-a .team { color: var(--team-a); }
.team-b .team { color: var(--team-b); }

/* meja */
.table-wrap { display: flex; justify-content: center; }
.table { position: relative; width: min(calc(100% - 20px), max(300px, calc((100vh - 450px) * 1000 / 600))); aspect-ratio: 1000 / 600; box-sizing: content-box; border: 10px solid var(--wood); border-radius: 10px; background: var(--felt); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.08), inset 0 0 50px rgba(0, 0, 0, 0.28), 0 12px 28px rgba(17, 24, 39, 0.28); overflow: hidden; touch-action: manipulation; }
.t-tile { position: absolute; background: var(--tile-face); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.16), 0 2px 0 #B5B2AB, 0 4px 8px rgba(0, 0, 0, 0.25); }
.t-tile.new { box-shadow: inset 0 0 0 2px var(--green), 0 2px 0 var(--green), 0 0 0 3px rgba(255, 255, 255, 0.55); }
.t-div { position: absolute; border-radius: 1px; background: var(--divider); }
.t-pip { position: absolute; border-radius: 50%; background: var(--pip); box-shadow: inset 0 0 0 1px var(--pip-rim); }
.ghost { position: absolute; border: 2px dashed #fff; background: rgba(255, 255, 255, 0.22); color: #fff; font-size: 11px; font-weight: 800; padding: 0; animation: denyut 1.2s ease-in-out infinite; }
@keyframes denyut { 50% { background: rgba(255, 255, 255, 0.4); } }

/* kartu di tangan */
.tray { display: flex; gap: 10px; justify-content: center; align-items: flex-end; padding: 14px 20px 10px; border-radius: 18px; background: linear-gradient(180deg, var(--wood-light) 0%, var(--wood) 100%); box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.15), 0 6px 14px rgba(17, 24, 39, 0.22); min-height: 60px; }
.h-tile { position: relative; border: 0; padding: 0; background: var(--tile-face); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.16), 0 3px 0 #B5B2AB, 0 6px 12px rgba(17, 24, 39, 0.18); transition: transform 0.15s ease, box-shadow 0.15s ease; flex: 0 0 auto; }
.h-tile.gray { background: var(--tile-gray); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.16), 0 3px 0 #9C9A94; cursor: not-allowed; }
.h-tile.selected { transform: translateY(-14px); box-shadow: inset 0 0 0 2px var(--amber), 0 3px 0 var(--amber), 0 0 0 3px rgba(180, 83, 9, 0.4), 0 14px 22px rgba(17, 24, 39, 0.22); }
.h-tile:not(.gray):not(.waiting):hover { transform: translateY(-6px); }
.h-tile .t-div, .h-tile .t-pip { pointer-events: none; }

.me-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; }
.me-info { display: flex; align-items: center; gap: 10px; flex: 1 1 0; }
.me-info .info { display: flex; flex-direction: column; gap: 3px; }
.me-actions { display: flex; justify-content: flex-end; gap: 8px; flex: 1 1 0; }
.status { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px; min-height: 46px; }
.status #msg { font-size: 14px; font-weight: 700; text-align: center; }

/* kotak hasil ronde */
.banner { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, 0.38); padding: 16px; z-index: 5; }
.banner[hidden] { display: none; }
.banner-card { max-width: 420px; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 22px 26px; border-radius: 18px; background: #fff; text-align: center; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35); }
.banner-card small { font-size: 12px; font-weight: 800; letter-spacing: 0.12em; color: #6B7280; }
.banner-card strong { font-size: 24px; line-height: 1.2; }
.banner-card p { margin: 0; font-size: 14px; line-height: 1.5; color: #374151; }

/* layar HP diputar tegak */
.rotate { position: fixed; inset: 0; z-index: 20; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; background: rgba(17, 24, 39, 0.92); color: #fff; text-align: center; }
.rotate.show { display: flex; }
.rotate svg { animation: putar 1.6s ease-in-out infinite; }
@keyframes putar { 50% { transform: rotate(90deg); } }

/* ---------- mode HP miring (layar pendek): meja hampir setinggi layar, kartu tangan di dalam meja ---------- */
.compact .game { max-width: none; padding: 6px 8px 0; gap: 0; height: 100vh; height: 100dvh; }
.compact .topbar { display: none; }
.compact .arena { height: 100%; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); grid-template-rows: 24px minmax(0, 1fr); grid-template-areas: "kiri atas kanan" "kiri meja kanan"; gap: 0 6px; align-items: stretch; }
.compact .table { width: auto; height: calc(100% - 12px - 4px); border-width: 6px; }
.compact .seat-top { align-self: center; gap: 6px; }
.compact .seat.seat-top .avatar { width: 22px; height: 22px; padding: 2px; }
.compact .seat.seat-top .avatar > span { border-width: 0; font-size: 8px; }
.compact .seat.seat-top .info { flex-direction: row; align-items: center; gap: 6px; }
.compact .seat-top .name, .compact .seat-top .team { font-size: 12px; }
.compact .side-col { display: flex; flex-direction: column; justify-content: space-between; align-items: center; padding-bottom: 10px; }
.compact .seat { width: auto; gap: 3px; }
.compact .seat .avatar { width: 46px; height: 46px; padding: 3px; }
.compact .seat .avatar > span { border-width: 2px; font-size: 14px; }
.compact .seat .name { font-size: 12px; }
.compact .seat .team { font-size: 10px; }
.compact .badge-count, .compact .badge-pass { font-size: 10px; padding: 1px 6px; }
.compact .me-area { display: none; }
.compact .tray { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); gap: 6px; padding: 6px 10px; border-radius: 12px; z-index: 3; }
.compact .table-msg { position: absolute; left: 8px; bottom: 10px; max-width: 150px; padding: 5px 9px; border-radius: 10px; background: rgba(0, 0, 0, 0.45); color: #fff; font-size: 10px; font-weight: 700; line-height: 1.35; z-index: 3; }
.compact .table-actions { position: absolute; right: 8px; bottom: 10px; display: flex; gap: 6px; z-index: 3; }
.table-msg, .table-actions { display: none; }
.compact .table-msg, .compact .table-actions { display: flex; }
.compact .table-wrap { height: 100%; display: flex; justify-content: center; align-items: flex-start; }
.compact .scoreboard { flex-direction: column; width: 104px; border-radius: 10px; }
.compact .sb-round { padding: 3px 8px; min-width: 0; flex-direction: row; gap: 6px; }
.compact .sb-round small { font-size: 8px; }
.compact .sb-round b { font-size: 15px; }
.compact .sb-grid { gap: 1px 6px; padding: 4px 8px; grid-template-columns: auto auto auto; justify-content: space-between; }
.compact .sb-grid .h, .compact .sb-grid .wins { display: none; }
.compact .sb-grid .pts { font-size: 13px; }
.compact .sb-grid .t { font-size: 11px; }
.compact .sb-grid .n { font-size: 11px; }
.compact .side-col.kiri { grid-area: kiri; }
.compact .side-col.kanan { grid-area: kanan; }
.compact .room-mini { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10px; font-weight: 800; line-height: 1.2; }
.compact .btn-round { width: 44px; height: 44px; }

@media (max-width: 760px) {
  .arena { grid-template-columns: 1fr; grid-template-areas: "atas" "meja" "kiri" "kanan" "saya"; }
  .seat-left, .seat-right { flex-direction: row; width: auto; justify-self: center; }
  .me-row { flex-wrap: wrap; justify-content: center; }
  .topbar { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  .ghost, .rotate svg { animation: none; }
  .h-tile { transition: none; }
}
.me-info .name { font-size: 15px; font-weight: 800; }
.me-info .team { font-size: 12px; font-weight: 800; }
.me-info .badges { display: flex; gap: 4px; }
.team-a .team { color: var(--team-a); }

/* ---------- room online: halaman awal & ruang tunggu ---------- */
.home-online { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.home-online .full { grid-column: 1 / -1; }
.join-row { display: flex; gap: 8px; }
.join-row input { flex: 1 1 auto; min-width: 0; text-transform: uppercase; letter-spacing: 0.2em; }
.btn-outline { background: #fff; color: var(--ink); border: 1.5px solid var(--ink); }
.btn-wa { background: #128C4B; color: #fff; }
.btn-dc { background: #5865F2; color: #fff; }
.btn:disabled { opacity: 0.6; cursor: wait; }
.kicker { font-size: 12px; font-weight: 800; letter-spacing: 0.14em; color: #6B7280; }
.lobby { max-width: 640px; }
.lobby h1 { margin: 4px 0 6px; font-size: 28px; }
.lobby-top { display: flex; align-items: center; justify-content: space-between; }
.l-note { font-size: 13px; color: var(--muted); line-height: 1.5; }
.l-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.l-row input { flex: 1 1 220px; min-width: 0; }
.l-kode { font-size: 40px; font-weight: 800; letter-spacing: 0.18em; line-height: 1; }
.l-suara { display: flex; flex-direction: column; gap: 8px; }
.l-meja { display: grid; grid-template-columns: 1fr 1.2fr 1fr; grid-template-areas: ". atas ." "kiri meja kanan" ". bawah ."; gap: 10px; align-items: center; }
.c-atas { grid-area: atas; } .c-kiri { grid-area: kiri; } .c-kanan { grid-area: kanan; } .c-bawah { grid-area: bawah; }
.c-meja { grid-area: meja; aspect-ratio: 5 / 3; border: 6px solid var(--wood); border-radius: 10px; background: var(--felt); display: flex; align-items: center; justify-content: center; text-align: center; color: #fff; font-size: 12px; font-weight: 800; padding: 6px; }
.l-seat { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; padding: 10px 6px; border-radius: 14px; background: #fff; border: 1.5px solid var(--line); min-height: 112px; justify-content: center; }
.l-seat b { font-size: 14px; word-break: break-word; }
.l-seat .team { font-size: 11px; font-weight: 800; }
.l-seat.saya { border-color: var(--green); box-shadow: 0 0 0 2px rgba(11, 122, 85, 0.18); }
.l-seat.kosong { border-style: dashed; background: rgba(255, 255, 255, 0.55); }
.l-seat .l-note { font-size: 11px; }
.l-av { width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 15px; }
.l-mulai { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.l-mulai .btn { width: 100%; max-width: 360px; height: 54px; font-size: 17px; }
.l-wait { font-weight: 800; padding: 14px; border-radius: 12px; background: #fff; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 30; max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 12px; background: var(--ink); color: #fff; font-size: 14px; font-weight: 700; box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25); }
@media (max-width: 480px) {
  .l-meja { grid-template-columns: 1fr 1fr; grid-template-areas: "atas atas" "kiri kanan" "meja meja" "bawah bawah"; }
  .c-meja { aspect-ratio: auto; min-height: 44px; }
  .home-online { grid-template-columns: 1fr; }
  .l-kode { font-size: 32px; }
}
.compact .sb-grid .t { white-space: nowrap; }
.compact .scoreboard { width: auto; min-width: 104px; }

/* ---------- emoji cepat & obrolan suara di meja ---------- */
.btn-voice { background: #128C4B; border-color: #128C4B; color: #fff; }
.mini-actions { display: flex; gap: 6px; }
.emote-panel { position: absolute; right: 10px; bottom: 10px; z-index: 6; display: grid; grid-template-columns: repeat(6, auto); gap: 6px; padding: 10px; border-radius: 14px; background: #fff; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3); }
.emote-opt { height: 40px; min-width: 44px; padding: 0 10px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; font-size: 13px; font-weight: 800; white-space: nowrap; }
.emote-opt.emo { font-size: 22px; padding: 0 6px; }
.emote-opt:hover { background: #F3F4F6; }
.emote-opt:nth-child(7) { grid-column: 1 / span 2; }
.emote-opt:nth-child(8) { grid-column: 3 / span 2; }
.emote-opt:nth-child(9) { grid-column: 5 / span 2; }
.emote-opt:nth-child(10) { grid-column: 1 / span 2; }
.emote-opt:nth-child(11) { grid-column: 3 / span 2; }
.emote-opt:nth-child(12) { grid-column: 5 / span 2; }
.compact .emote-panel { top: 8px; bottom: auto; right: 8px; padding: 8px; gap: 4px; }
.compact .emote-opt { height: 34px; min-width: 38px; font-size: 12px; }
.compact .emote-opt.emo { font-size: 18px; }
.bubble { position: fixed; z-index: 40; transform: translate(-50%, -100%); max-width: 200px; padding: 6px 12px; border-radius: 14px; background: #fff; color: var(--ink); font-size: 14px; font-weight: 800; text-align: center; box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28); pointer-events: none; animation: gelembung 3s ease forwards; }
.bubble.emo { font-size: 30px; padding: 2px 10px; line-height: 1.2; }
.bubble.bawah { transform: translate(-50%, 0); }
@keyframes gelembung { 0% { opacity: 0; margin-top: 8px; } 10% { opacity: 1; margin-top: 0; } 80% { opacity: 1; } 100% { opacity: 0; margin-top: -10px; } }
@media (prefers-reduced-motion: reduce) { .bubble { animation: none; } }
