:root {
  --bg: #0a2416;
  --felt: #22874f;
  --felt-dark: #0f4a2c;
  --wood: #6b3f1f;
  --text: #f5f0e1;
  --gold: #f5c451;
  --red: #d32f2f;
  --ink: #1d1d1f;
  --cw: 64px;          /* lebar kartu */
  --ch: 90px;          /* tinggi kartu */
  --overlap: .45;      /* tumpukan kartu di tangan */
}
@media (max-width: 600px) {
  :root { --cw: 44px; --ch: 62px; --overlap: .5; }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text);
  background: radial-gradient(ellipse at 50% 0%, #1e5b3c 0%, var(--bg) 70%) fixed;
}
.hidden { display: none !important; }

button {
  font: inherit;
  font-weight: 700;
  padding: .55em 1.1em;
  border: 0;
  border-radius: 10px;
  color: #3a2600;
  background: linear-gradient(180deg, #ffdc80, #e8a92c);
  box-shadow: 0 3px 0 #a8741a, 0 6px 12px rgba(0, 0, 0, .3);
  cursor: pointer;
  transition: transform .08s, box-shadow .08s, opacity .2s;
}
button:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 0 0 #a8741a, 0 2px 6px rgba(0, 0, 0, .3); }
button:disabled { opacity: .35; cursor: default; }
button.ghost { background: rgba(255, 255, 255, .12); color: var(--text); box-shadow: 0 3px 0 rgba(0, 0, 0, .3); }
button.big { padding: .7em 1.8em; font-size: 1.05em; }
input {
  font: inherit;
  padding: .65em .9em;
  border: 2px solid transparent;
  border-radius: 10px;
  background: rgba(255, 255, 255, .92);
  outline: none;
}
input:focus { border-color: var(--gold); }
.err { color: #ffb4a8; min-height: 1.2em; margin: 0; text-align: center; }

.panel {
  padding: 20px;
  border: 2px solid rgba(245, 196, 81, .7);
  border-radius: 20px;
  background: linear-gradient(180deg, #1f5e3e, #103a26);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}

/* ---------- Home ---------- */
#home {
  max-width: 360px;
  margin: 0 auto;
  padding: 7vh 16px 24px;
  text-align: center;
}
#home h1 { margin: 10px 0 20px; font-size: 40px; letter-spacing: .02em; text-shadow: 0 4px 12px rgba(0, 0, 0, .5); }
#home h1 span { color: var(--gold); }
#home h1 { margin-bottom: 4px; }
#home .tagline { margin: 0 0 18px; font-size: 13px; opacity: .75; }
#home .form { display: flex; flex-direction: column; gap: 12px; }
#home .row { display: flex; gap: 8px; }
#home .row input { flex: 1; min-width: 0; text-transform: uppercase; letter-spacing: .15em; }
#home .row input::placeholder { text-transform: none; letter-spacing: normal; }
.howlink { display: inline-block; margin-top: 18px; color: var(--gold); font-weight: 700; text-decoration: none; }
.howlink:hover { text-decoration: underline; }
#home .about { margin-top: 28px; font-size: 12.5px; line-height: 1.55; opacity: .62; }
#home .about h2 { margin: 0 0 6px; font-size: 13px; }
#home .about p { margin: 0; }
.hbtn { padding: .4em .7em; border-radius: 10px; font-size: 14px; text-decoration: none; background: rgba(255, 255, 255, .12); box-shadow: 0 3px 0 rgba(0, 0, 0, .3); }
/* Kartu pilihan mode: yang terpilih menyala emas, yang lain diredupkan. */
.modecards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mcwrap { position: relative; display: flex; }
.modecard { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 8px 12px;
  border-radius: 14px; border: 2px solid rgba(255, 255, 255, .12); background: rgba(0, 0, 0, .25); color: var(--text);
  box-shadow: none; opacity: .6; filter: saturate(.6); transition: opacity .2s, filter .2s, transform .2s, border-color .2s, box-shadow .2s; }
.modecard:hover { opacity: .85; }
.modecard:active:not(:disabled) { transform: scale(.97); box-shadow: none; }
.modecard .mc-icon { font-size: 34px; line-height: 1.1; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .4)); }
.modecard b { font-size: 15px; letter-spacing: .02em; }
.modecard small { font-size: 11.5px; font-weight: 500; line-height: 1.3; opacity: .85; }
.modecard.on { opacity: 1; filter: none; transform: translateY(-2px); border-color: var(--gold);
  background: linear-gradient(180deg, rgba(245, 196, 81, .22), rgba(0, 0, 0, .2));
  box-shadow: 0 0 0 1px rgba(245, 196, 81, .35), 0 6px 18px rgba(245, 196, 81, .25); }
.modecard.on b { color: var(--gold); }
.modecard.on::after { content: '✓'; position: absolute; top: -8px; left: -6px; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; font-size: 13px; font-weight: 900; color: #3a2600; background: var(--gold); box-shadow: 0 2px 6px rgba(0, 0, 0, .4); }
.modecard.ks.on { background: linear-gradient(180deg, rgba(255, 194, 51, .3), rgba(90, 40, 0, .35)); }
.modecard.ks.on .mc-icon { animation: crown 2.4s ease-in-out infinite; }
@keyframes crown { 0%, 100% { transform: none; } 50% { transform: translateY(-3px) rotate(-6deg); filter: drop-shadow(0 0 8px rgba(255, 210, 80, .8)); } }
.mc-info { position: absolute; top: 6px; right: 6px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  font: italic 700 12px Georgia, serif; color: var(--text); text-decoration: none; background: rgba(255, 255, 255, .15); }
.mc-info:hover { background: var(--gold); color: #3a2600; }
/* Tombol halaman depan: jelas bisa diklik (Buat Room tidak terlihat seperti nonaktif) dan menyala saat hover. */
#home .form button:not(.modecard) { transition: transform .12s, box-shadow .12s, filter .15s, background .15s, border-color .15s; }
#btnCreate { border: 1.5px solid rgba(245, 196, 81, .5); background: rgba(255, 255, 255, .1); }
#home .form button:not(.modecard):focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
@media (hover: hover) {
  #home .form button:not(.modecard):not(.ghost):hover:not(:disabled) { transform: translateY(-2px); filter: brightness(1.08);
    box-shadow: 0 5px 0 #a8741a, 0 10px 20px rgba(0, 0, 0, .35), 0 0 0 3px rgba(245, 196, 81, .35); }
  #home .form button.ghost:hover:not(:disabled) { transform: translateY(-2px); color: #fff; border-color: var(--gold);
    background: linear-gradient(180deg, rgba(245, 196, 81, .42), rgba(245, 196, 81, .22)); box-shadow: 0 5px 0 rgba(0, 0, 0, .3), 0 0 20px rgba(245, 196, 81, .55); }
  .modecard:not(.on):hover { opacity: .9; filter: saturate(.9); border-color: rgba(245, 196, 81, .55); transform: translateY(-1px); }
  /* Tombol transparan lain (meja, lobby, hasil) ikut sedikit terang saat hover. */
  button.ghost:hover:not(:disabled) { background: rgba(255, 255, 255, .2); }
}
#home .divider { display: flex; align-items: center; gap: 10px; margin-top: 4px; font-size: 12px; opacity: .7; }
#home .divider::before, #home .divider::after { content: ''; flex: 1; height: 1px; background: rgba(255, 255, 255, .25); }
@media (prefers-reduced-motion: reduce) { .modecard.ks.on .mc-icon { animation: none; } }
.logo { display: flex; justify-content: center; height: 120px; padding-top: 10px; padding-left: 30px; animation: float 3s ease-in-out infinite; }
.logo .slot { margin-left: -30px; transform: rotate(var(--r)); transform-origin: 50% 130%; }
.logo .card { --cw: 64px; --ch: 90px; }

/* ---------- Meja ---------- */
#game {
  max-width: 900px;
  margin: 0 auto;
  padding: 10px 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
header { display: flex; align-items: center; gap: 8px; }
header .spacer { flex: 1; }
header button { padding: .45em .8em; font-size: 14px; }
.chip { padding: 6px 12px; border-radius: 999px; background: rgba(0, 0, 0, .3); font-size: 14px; }
.chip b { color: var(--gold); letter-spacing: .12em; }

#arena { position: relative; height: clamp(300px, 52vh, 460px); }
#felt {
  position: absolute;
  inset: 44px 56px;
  border-radius: 999px;
  border: 12px solid var(--wood);
  background: radial-gradient(ellipse at 50% 40%, var(--felt), var(--felt-dark));
  box-shadow: inset 0 0 50px rgba(0, 0, 0, .55), 0 0 0 3px #3b210f, 0 14px 40px rgba(0, 0, 0, .6);
}
#felt::after {
  content: "";
  position: absolute;
  inset: 14px;
  border-radius: inherit;
  border: 2px dashed rgba(255, 255, 255, .1);
}
#felt { transition: filter .8s; }
#arena.reversed #felt { filter: hue-rotate(150deg) saturate(.9); }
#revBadge {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .5);
  background: rgba(70, 20, 90, .7);
  font-size: 12px;
  white-space: nowrap;
  animation: pulse 1.6s ease-in-out infinite;
}
#revBadge small { font-size: 11px; opacity: .85; }
#tripleBadge {
  position: absolute;
  right: 0;
  top: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 140, 120, .6);
  background: rgba(120, 20, 20, .7);
  font-size: 12px;
  white-space: nowrap;
  animation: popin .4s cubic-bezier(.2, 1.4, .4, 1);
}
#tripleBadge small { font-size: 11px; opacity: .85; }
.modal {
  position: fixed;
  inset: 0;
  z-index: 65;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, .55);
  animation: fadein .2s;
}
.modal .panel { width: min(360px, 100%); text-align: center; animation: popin .35s cubic-bezier(.2, 1.4, .4, 1); }
.modal h2 { margin: 0 0 6px; color: var(--gold); font-size: 30px; }
.modal p { margin: 0 0 16px; line-height: 1.45; }

#center {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(60%, 420px);
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  z-index: 3;   /* kartu di meja selalu di atas info kursi */
}
#center .cards { display: flex; justify-content: center; padding-left: calc(var(--cw) * .25); }
#center .slot { margin-left: calc(var(--cw) * -.25); transform: rotate(var(--r)); }
.combo { padding: 3px 12px; border-radius: 999px; background: rgba(0, 0, 0, .35); font-size: 13px; font-weight: 700; }
.hint { padding: 8px 14px; border-radius: 12px; background: rgba(0, 0, 0, .25); font-size: 14px; }
.lobby { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.lobby .chips, .lobby .actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.lobby .actions { margin-top: 2px; }
.lobby .actions button { padding: .55em 1.1em; }
.lobby .hint.small { margin-top: -2px; }
.pill {
  padding: 4px 10px;
  border-radius: 999px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 800;
  white-space: nowrap;
  color: var(--text);
  background: rgba(0, 0, 0, .3);
  box-shadow: none;
}
button.pill { cursor: pointer; transition: transform .15s, background .2s; }
button.pill:hover { transform: translateY(-1px); background: rgba(0, 0, 0, .45); }
.pill.mode.kingslave { color: #3a2600; background: linear-gradient(90deg, #ffe082, #ffb300); }
button.pill.mode.kingslave:hover { background: linear-gradient(90deg, #fff0b3, #ffc233); }
.lobby .label { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; opacity: .75; }
.lobby .code { margin-top: -6px; font-size: 34px; font-weight: 900; letter-spacing: .2em; color: var(--gold); text-shadow: 0 3px 10px rgba(0, 0, 0, .5); }
/* Matchmaking: cincin hitung mundur (--p = sisa waktu 1..0) */
.lobby .mmtitle { font-size: 18px; font-weight: 800; }
.mmring { --p: 1; position: relative; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--gold) calc(var(--p) * 360deg), rgba(255, 255, 255, .12) 0); }
.mmring::before { content: ''; position: absolute; inset: 6px; border-radius: 50%; background: var(--felt-dark); }
.mmring b { position: relative; font-size: 22px; font-weight: 900; color: var(--gold); }
.lobby.match:not(.failed) .mmtitle { animation: mmpulse 1.6s ease-in-out infinite; }
@keyframes mmpulse { 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .lobby.match .mmtitle { animation: none; } }

/* ---------- Kursi pemain ---------- */
.seat {
  position: absolute;
  z-index: 2;
  width: 110px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.seat[data-pos="0"] { bottom: 0; left: 50%; transform: translateX(-50%); }
.seat[data-pos="2"] { top: 0; left: 50%; transform: translateX(-50%); }
.seat[data-pos="1"] { left: 0; top: 50%; transform: translateY(-50%); }
.seat[data-pos="3"] { right: 0; top: 50%; transform: translateY(-50%); }
.avatar {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  border: 3px solid rgba(255, 255, 255, .85);
  background: linear-gradient(145deg, hsl(var(--hue, 200) 70% 58%), hsl(var(--hue, 200) 65% 34%));
  box-shadow: 0 4px 10px rgba(0, 0, 0, .45);
}
/* Cincin batas waktu di kursi yang sedang giliran (--p = sisa waktu 1..0). */
.avatar .tring { position: absolute; inset: -8px; border-radius: 50%; pointer-events: none;
  background: conic-gradient(var(--tc, #8ef0a6) calc(var(--p, 1) * 360deg), rgba(0, 0, 0, .35) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3.5px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3.5px)); }
.avatar .tring.low { --tc: #ff5a4f; animation: tblink .5s ease-in-out infinite alternate; }
@keyframes tblink { to { opacity: .45; } }
#timebar { position: relative; height: 6px; margin: 4px auto 0; width: min(420px, 80%); border-radius: 3px; background: rgba(0, 0, 0, .35); }
#timebar i { display: block; height: 100%; width: 100%; border-radius: 3px; background: linear-gradient(90deg, #8ef0a6, #f5c451); transition: width .1s linear; }
#timebar.low i { background: #ff5a4f; }
#timebar::after { content: attr(data-left); position: absolute; right: -34px; top: -6px; font-size: 12px; font-weight: 800; opacity: .8; }
#timebar.low::after { color: #ff8a80; opacity: 1; }
/* Hitung mundur 5..0: besar, transparan, tidak bisa diklik. */
#countdown { position: fixed; left: 50%; top: 50%; z-index: 95; pointer-events: none; font-size: clamp(110px, 30vmin, 240px);
  font-weight: 900; line-height: 1; color: rgba(255, 90, 79, .55); -webkit-text-stroke: 3px rgba(255, 255, 255, .75);
  text-shadow: 0 0 30px rgba(255, 60, 40, .7), 0 8px 24px rgba(0, 0, 0, .5); transform: translate(-50%, -50%); }
#countdown.zero { color: rgba(255, 196, 81, .7); -webkit-text-stroke: 0; }
body.hurry::before { content: ''; position: fixed; inset: 0; z-index: 94; pointer-events: none;
  box-shadow: inset 0 0 90px rgba(255, 40, 40, .55); animation: hurry 1s ease-in-out infinite; }
@keyframes hurry { 50% { box-shadow: inset 0 0 40px rgba(255, 40, 40, .2); } }
@media (prefers-reduced-motion: reduce) { body.hurry::before, .avatar .tring.low { animation: none; } }
.avatar.empty { background: rgba(255, 255, 255, .08); border-style: dashed; color: rgba(255, 255, 255, .45); }
.seat.turn .avatar::before {
  content: "";
  position: absolute;
  inset: -9px;
  z-index: -1;
  border-radius: 50%;
  background: conic-gradient(var(--gold), transparent 55%, var(--gold));
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
  animation: spin 1.1s linear infinite;
}
.seat.turn .avatar { box-shadow: 0 0 22px rgba(245, 196, 81, .75); }
.seat.turn .name { color: var(--gold); }
.seat.done .avatar { filter: saturate(.5) brightness(.9); }
.seat.offline .avatar { filter: grayscale(1) brightness(.7); }
.tag.auto { color: #9be7ff; }
#conn:not(.hidden) { display: flex; align-items: center; gap: 10px; }
#conn button { padding: .3em .8em; font-size: 13px; }
#home .resume { font-weight: 800; background: linear-gradient(180deg, #4dd0e1, #1e9bb0); color: #04252b; box-shadow: 0 3px 0 #136b7a;
  animation: pulse 1.6s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { #home .resume { animation: none; } }
#conn {
  position: fixed;
  top: 10px;
  left: 50%;
  z-index: 80;
  transform: translateX(-50%);
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid #ff8a80;
  background: #2b0d0d;
  color: #ffd2cc;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  animation: pulse 1.2s ease-in-out infinite;
}
.count {
  position: absolute;
  right: -9px;
  bottom: -5px;
  min-width: 24px;
  height: 22px;
  padding: 0 5px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-size: 12px;
  color: #fff;
  background: var(--ink);
  border: 2px solid var(--gold);
}
.medal { position: absolute; top: -12px; right: -12px; font-size: 22px; }
.name {
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 700;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .7);
}
.tag { padding: 1px 8px; border-radius: 6px; background: rgba(0, 0, 0, .5); color: #ffb4a8; font-size: 11px; font-weight: 800; letter-spacing: .08em; }
.backs { display: flex; height: 24px; padding-left: 11px; }
.backs i { width: 16px; height: 23px; margin-left: -11px; border-radius: 3px; box-shadow: 0 1px 2px rgba(0, 0, 0, .4); }

/* ---------- Kartu ---------- */
.card {
  position: relative;
  width: var(--cw);
  height: var(--ch);
  border-radius: calc(var(--cw) * .12);
  color: var(--ink);
  background: linear-gradient(160deg, #fff, #efe9dc);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .35), inset 0 0 0 1px rgba(0, 0, 0, .08);
  font-family: Georgia, "Times New Roman", serif;
  user-select: none;
}
.card.red { color: var(--red); }
.card .corner {
  position: absolute;
  top: 4px;
  left: 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: calc(var(--cw) * .24);
  font-weight: 700;
  line-height: .95;
}
.card .corner i { font-style: normal; font-size: .85em; }
.card .corner:last-child { top: auto; left: auto; right: 5px; bottom: 4px; transform: rotate(180deg); }
.card .pip { position: absolute; inset: 0; display: grid; place-items: center; font-size: calc(var(--cw) * .55); }
.card.back, .backs i {
  border: 3px solid #fff;
  background:
    radial-gradient(circle, rgba(255, 255, 255, .18) 0 28%, transparent 30%),
    repeating-linear-gradient(45deg, #9c1f30 0 4px, #b8323f 4px 8px);
}
.backs i { border-width: 1.5px; }

/* ---------- Kartu di tangan ---------- */
#status { min-height: 1.4em; text-align: center; font-weight: 800; }
#status.turn { color: var(--gold); animation: pulse 1.2s ease-in-out infinite; }
#status.ok { color: #8ef0a6; }
#status.bad { color: #ffb4a8; }
#hand {
  display: flex;
  justify-content: center;
  min-height: calc(var(--ch) + 60px);
  align-items: flex-start;
  gap: 6px;
  padding: 26px 0 22px;
}
#hand.grouped { padding-bottom: 26px; }
#hand.many { --overlap: .55; }
/* Kelompok kartu: tiap kelompok mengimbangi tumpukan kartu pertamanya sendiri. */
#hand .group {
  position: relative;
  display: flex;
  padding: 0 4px 0 calc(var(--cw) * var(--overlap) + 4px);
  border-radius: 12px;
  transition: background .15s, box-shadow .15s;
}
#hand .group:not(.loose):not(.newgroup) {
  background: color-mix(in srgb, var(--gc) 14%, transparent);
  box-shadow: inset 0 -3px 0 var(--gc);
}
#hand .group.newgroup { display: none; }
#hand.dragging .group.newgroup {
  display: flex;
  align-items: center;
  justify-content: center;
  width: calc(var(--cw) + 16px);
  height: var(--ch);
  padding: 0;
  border: 2px dashed rgba(255, 255, 255, .45);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
  opacity: .8;
}
#hand.dragging .group { outline: 2px dashed rgba(255, 255, 255, .18); outline-offset: 2px; }
#hand .group.over { background: rgba(245, 196, 81, .22); outline: 2px solid var(--gold); }
#hand .glabel {
  position: absolute;
  left: 50%;
  bottom: -22px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 1px 4px 1px 8px;
  border-radius: 99px;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 800;
  color: #222;
  background: var(--gc);
  cursor: pointer;
  z-index: 2;
}
#hand .ungroup {
  width: 16px;
  height: 16px;
  padding: 0;
  border-radius: 50%;
  font-size: 12px;
  line-height: 16px;
  color: #222;
  background: rgba(0, 0, 0, .15);
  box-shadow: none;
}
#hand .slot.lifted { opacity: .3; }
.dragghost { display: flex; pointer-events: none; transform: translate(-50%, -60%) rotate(-4deg); filter: drop-shadow(0 12px 16px rgba(0, 0, 0, .5)); }
.dragghost .card + .card { margin-left: calc(var(--cw) * -.6); }
#hand .slot {
  margin-left: calc(var(--cw) * var(--overlap) * -1);
  transform: translateY(var(--y)) rotate(var(--r));
  transform-origin: 50% 130%;
  transition: transform .18s ease;
  cursor: pointer;
  touch-action: none;
}
@media (hover: hover) {
  #hand .slot:hover { transform: translateY(calc(var(--y) - 8px)) rotate(var(--r)); }
}
#hand .slot.sel { transform: translateY(calc(var(--y) - 24px)) rotate(var(--r)); }
#hand .slot.sel .card { box-shadow: 0 0 0 3px var(--gold), 0 10px 18px rgba(0, 0, 0, .45); }
#hand .card { backface-visibility: hidden; }
#hand.myturn { filter: drop-shadow(0 0 10px rgba(245, 196, 81, .35)); }

#bar { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; align-items: center; }
.keys { margin: 0; text-align: center; font-size: 12px; opacity: .5; }
@media (hover: none) { .keys { display: none; } }

#logbox { border-radius: 12px; background: rgba(0, 0, 0, .22); font-size: 13px; }
#logbox summary { padding: 8px 12px; cursor: pointer; opacity: .8; }
#log { list-style: none; margin: 0; padding: 0 12px 10px; max-height: 160px; overflow: auto; }
#log li { padding: 2px 0; }
#log li:first-child { color: var(--gold); }

/* ---------- Hasil akhir ---------- */
#results {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(3px);
  animation: fadein .3s;
}
#results .panel { width: min(420px, 100%); text-align: center; animation: popin .5s cubic-bezier(.2, 1.4, .4, 1); }
#results h2 { margin: 0; color: var(--gold); }
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 8px; margin: 22px 0 10px; }
.step { width: 100px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.step .block {
  width: 100%;
  display: grid;
  place-items: center;
  border-radius: 8px 8px 0 0;
  font-size: 26px;
  font-weight: 900;
  color: rgba(0, 0, 0, .55);
  transform-origin: bottom;
  animation: rise .6s cubic-bezier(.2, 1.2, .4, 1) backwards;
}
.step.p1 .block { height: 96px; background: linear-gradient(180deg, #ffe08a, #d39b22); animation-delay: .5s; }
.step.p2 .block { height: 66px; background: linear-gradient(180deg, #eef1f5, #a9b2bd); animation-delay: .3s; }
.step.p3 .block { height: 44px; background: linear-gradient(180deg, #f0b483, #b06a35); animation-delay: .1s; }
.last { margin-bottom: 16px; font-size: 14px; opacity: .8; }
.actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ---------- Efek ---------- */
#fx { position: fixed; inset: 0; z-index: 70; overflow: hidden; pointer-events: none; }
#fx > * { position: fixed; }
.flying { width: 40px; height: 56px; margin: -28px 0 0 -20px; }
.bubble {
  padding: 4px 12px;
  border-radius: 999px;
  color: var(--ink);
  background: #fff;
  font-size: 14px;
  font-weight: 900;
  white-space: nowrap;
  box-shadow: 0 4px 10px rgba(0, 0, 0, .4);
}
.bubble.gold { background: var(--gold); }
.banner {
  font-size: clamp(26px, 7vw, 52px);
  font-weight: 900;
  letter-spacing: .04em;
  white-space: nowrap;
  color: var(--gold);
  text-shadow: 0 3px 0 #8a5a00, 0 8px 22px rgba(0, 0, 0, .7);
}
.banner.heavy { color: #fff; text-shadow: 0 3px 0 #a00, 0 0 26px #ff4d4d, 0 8px 22px rgba(0, 0, 0, .7); }
.confetti { width: 8px; height: 12px; border-radius: 2px; }
.toast {
  left: 50%;
  bottom: 24px;
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  border: 1px solid #ff8a80;
  border-radius: 12px;
  color: #ffd2cc;
  background: #2b0d0d;
  font-weight: 600;
  text-align: center;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .55; } }
@keyframes float { 50% { transform: translateY(-8px); } }
@keyframes fadein { from { opacity: 0; } }
@keyframes popin { from { opacity: 0; transform: scale(.7); } }
@keyframes rise { from { transform: scaleY(0); } }

@media (max-width: 600px) {
  #felt { inset: 40px 34px; border-width: 8px; }
  #center { width: 56%; }
  .seat { width: 72px; }
  .seat[data-pos="1"], .seat[data-pos="3"] { width: 64px; }
  .avatar { width: 40px; height: 40px; font-size: 17px; }
  .name { max-width: 72px; font-size: 12px; }
  .backs { display: none; }
  #hand { gap: 4px; }
  #hand.grouped { --overlap: .62; }
  #hand.many { --overlap: .6; }
  #hand.many.grouped { --overlap: .68; }
  #hand .group { padding: 0 2px 0 calc(var(--cw) * var(--overlap) + 2px); }
  #bar { gap: 6px; }
  #bar button:not(.big) { padding: .5em .75em; font-size: .9em; }
  .lobby .code { font-size: 26px; }
  #home h1 { font-size: 34px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before { animation: none !important; transition: none !important; }
}

/* ---------- Kemenangan spesial ---------- */
.tag.gold { color: var(--gold); animation: pulse 1s ease-in-out infinite; }
.panel.claim { width: min(400px, 100%); }
.claim-icon { font-size: 64px; line-height: 1; animation: float 1.6s ease-in-out infinite; }
.panel.claim.dflush { border-color: #ffd54f; background: linear-gradient(180deg, #4a3500, #140c00); }
.panel.claim.capsa { border-color: #ffcc66; background: linear-gradient(180deg, #8b1414, #3d0505); }
.panel.claim.lucky { border-color: #8ef0a6; background: linear-gradient(180deg, #116b3a, #053018); }
.panel.claim.under { border-color: #7cc7ff; background: linear-gradient(180deg, #1c2a6b, #090d26); }
.panel.claim .actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

.showcase {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px;
  overflow: hidden;
  text-align: center;
  cursor: pointer;
  animation: fadein .35s;
  --cw: 46px;
  --ch: 64px;
}
@media (max-width: 600px) { .showcase { --cw: 32px; --ch: 45px; } }
.sc-stage { position: absolute; inset: 0; pointer-events: none; }
.sc-p { position: absolute; font-size: 30px; line-height: 1; will-change: transform; }
.sc-p.gold { color: #ffe27a; font-size: 22px; text-shadow: 0 0 10px #ffb300; }
.sc-p.lantern { font-size: 46px; filter: drop-shadow(0 0 14px rgba(255, 80, 40, .8)); }
.sc-icon { position: relative; font-size: clamp(60px, 14vw, 110px); line-height: 1; animation: popin .6s cubic-bezier(.2, 1.5, .4, 1); }
.sc-title {
  position: relative;
  display: flex;
  font-size: clamp(34px, 9vw, 76px);
  font-weight: 900;
  letter-spacing: .04em;
  line-height: 1;
}
.sc-title span { display: inline-block; }
.sc-who { position: relative; font-size: clamp(16px, 3.5vw, 22px); font-weight: 800; }
.sc-sub { position: relative; opacity: .85; }
.sc-cards { position: relative; display: flex; justify-content: center; padding: 18px 0 0 calc(var(--cw) * .3); }
.sc-cards > .card, .sc-pair { margin-left: calc(var(--cw) * -.3); }
.sc-pair { display: flex; gap: 2px; margin-right: calc(var(--cw) * .45); }
.sc-pair .card { margin: 0; }
.sc-skip { position: absolute; bottom: 14px; font-size: 12px; opacity: .5; }

/* Dragon Flush: emas & hitam, naga menyemburkan api */
.showcase.dflush { background: radial-gradient(ellipse at 50% 45%, rgba(120, 80, 0, 1), rgba(10, 5, 0, 1) 70%); }
.dflush .sc-title span {
  background: linear-gradient(180deg, #fff6c8, #ffd54f 40%, #c98a00 60%, #fff1a8);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 14px rgba(255, 190, 40, .9)) drop-shadow(0 4px 0 #6b4400);
}
.dflush .sc-cards .card { box-shadow: 0 0 0 2px #ffd54f, 0 0 18px rgba(255, 200, 60, .8); }
.sc-dragon { position: absolute; left: 0; top: 0; font-size: clamp(90px, 18vw, 160px); filter: drop-shadow(0 0 20px rgba(255, 170, 0, .9)); }

/* Capsa: merah & emas ala Imlek, sinar berputar */
.showcase.capsa { background: radial-gradient(ellipse at 50% 45%, rgba(200, 30, 30, 1), rgba(60, 0, 0, 1) 70%); }
.sc-rays {
  position: absolute;
  left: 50%;
  top: 45%;
  width: 260vmax;
  height: 260vmax;
  margin: -130vmax 0 0 -130vmax;
  background: repeating-conic-gradient(rgba(255, 210, 90, .16) 0 10deg, transparent 10deg 20deg);
  animation: spin 14s linear infinite;
}
.capsa .sc-title { color: #ffd76a; text-shadow: 0 4px 0 #8a1a00, 0 0 24px rgba(255, 200, 80, .8); }

/* Lucky Pair: hijau zamrud, semanggi & koin */
.showcase.lucky { background: radial-gradient(ellipse at 50% 45%, rgba(30, 160, 90, 1), rgba(0, 40, 20, 1) 70%); }
.lucky .sc-title { color: #eaffd9; text-shadow: 0 4px 0 #0b6b2e, 0 0 26px rgba(140, 255, 160, .9); }
.lucky .sc-title span { animation: bob 1.2s ease-in-out infinite; animation-delay: calc(var(--i) * 80ms); }

/* Under Jack: malam biru, neon berkedip, kartu besar dicap */
.showcase.under { background: radial-gradient(ellipse at 50% 45%, rgba(40, 50, 140, 1), rgba(5, 5, 25, 1) 70%); }
.under .sc-title { color: #e8f6ff; text-shadow: 0 0 6px #7cc7ff, 0 0 18px #3aa0ff, 0 0 40px #b14dff; animation: neon 2.2s infinite; }
.sc-royals { position: absolute; left: 50%; top: 14%; display: flex; gap: 10px; transform: translateX(-50%); --cw: 66px; --ch: 92px; }
@media (max-width: 600px) { .sc-royals { --cw: 46px; --ch: 64px; gap: 6px; } }
.sc-royal { position: relative; }
.sc-stamp {
  position: absolute;
  left: 50%;
  top: 50%;
  font-size: calc(var(--cw) * 1.2);
  font-weight: 900;
  color: #ff3b3b;
  text-shadow: 0 0 10px rgba(255, 0, 0, .7);
}

@keyframes bob { 50% { transform: translateY(-8px); } }
@keyframes neon { 0%, 18%, 22%, 60%, 64%, 100% { opacity: 1; } 20%, 62% { opacity: .35; } }

@media (max-width: 600px) {
  header { gap: 6px; }
  header button, .hbtn { padding: .4em .55em; font-size: 13px; white-space: nowrap; }
  .chip { padding: 5px 9px; font-size: 13px; white-space: nowrap; }
  .lobby { gap: 6px; }
  .lobby .big { padding: .55em 1em; font-size: 14px; }
  .lobby button.ghost { padding: .45em .9em; font-size: 13px; }
}

/* ---------- Mode & King Slave ---------- */
.modes { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.seg { display: flex; gap: 4px; padding: 3px; border-radius: 12px; background: rgba(0, 0, 0, .3); }
.seg button { padding: .35em .8em; font-size: 13px; white-space: nowrap; box-shadow: none; background: transparent; color: var(--text); }
.seg button.on { color: #3a2600; background: var(--gold); }
.seg button:disabled { cursor: default; opacity: 1; }
.seg button:disabled:not(.on) { opacity: .45; }
.hint.small { max-width: 280px; font-size: 12px; opacity: .75; }
#results .modes { margin: 4px 0 12px; }

/* Ikon jabatan di atas avatar + label di bawah nama */
.roleicon {
  position: absolute;
  left: 50%;
  top: -24px;
  font-size: 24px;
  line-height: 1;
  transform: translateX(-50%);
  pointer-events: none;
}
.rolepill {
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: .06em;
  white-space: nowrap;
}
.seat[data-role="king"] .rolepill, .rolepill.king { color: #3a2600; background: linear-gradient(90deg, #ffe082, #ffb300, #ffe082); background-size: 200% 100%; animation: shine 2.4s linear infinite; }
.seat[data-role="queen"] .rolepill, .rolepill.queen { color: #fff; background: linear-gradient(90deg, #d16bff, #ff6fae); }
.seat[data-role="slave1"] .rolepill, .rolepill.slave1 { color: #e8e8e8; background: linear-gradient(90deg, #616a75, #8b949e); }
.seat[data-role="slave2"] .rolepill, .rolepill.slave2 { color: #f3e3cf; background: linear-gradient(90deg, #6b4a2b, #8d6a45); }

/* King: mahkota emas melayang dengan kilau, avatar bercahaya emas */
.seat[data-role="king"] .avatar { border-color: #ffd54f; box-shadow: 0 0 0 2px #ffb300, 0 0 22px rgba(255, 200, 60, .75); }
.seat[data-role="king"] .roleicon { font-size: 30px; top: -30px; filter: drop-shadow(0 0 8px rgba(255, 200, 40, .9)); animation: crown 2s ease-in-out infinite; }
/* Queen: tiara berkilau ungu-merah muda */
.seat[data-role="queen"] .avatar { border-color: #f3a6ff; box-shadow: 0 0 0 2px #c050ff, 0 0 18px rgba(220, 100, 255, .6); }
.seat[data-role="queen"] .roleicon { filter: drop-shadow(0 0 6px rgba(230, 120, 255, .9)); animation: sparkle 1.8s ease-in-out infinite; }
/* Slave 1: rantai berayun, avatar kusam */
.seat[data-role="slave1"] .avatar { border-color: #8b949e; filter: saturate(.55); }
.seat[data-role="slave1"] .roleicon { top: auto; bottom: -10px; left: -8px; font-size: 20px; transform: none; transform-origin: 50% 0; animation: swing 1.6s ease-in-out infinite; }
/* Slave 2: sapu menyapu, avatar paling kusam */
.seat[data-role="slave2"] .avatar { border-color: #8d6a45; filter: saturate(.35) brightness(.9); }
.seat[data-role="slave2"] .roleicon { top: auto; bottom: -8px; left: -14px; font-size: 22px; transform: none; transform-origin: 50% 90%; animation: sweep 1.2s ease-in-out infinite; }

/* Kartu yang baru diterima dari tukar kartu */
#hand .slot.got .card { box-shadow: 0 0 0 3px #7cf0ff, 0 0 16px rgba(124, 240, 255, .8); }
#hand .slot.got::after {
  content: attr(data-new);
  position: absolute;
  left: 50%;
  top: -16px;
  padding: 0 5px;
  border-radius: 5px;
  transform: translateX(-50%);
  font-size: 9px;
  font-weight: 900;
  color: #073b45;
  background: #7cf0ff;
}
#hand .slot { position: relative; }

.nextroles { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 6px 0 4px; }
.nextroles .rolepill { font-size: 12px; padding: 2px 10px; }

@keyframes shine { to { background-position: -200% 0; } }
@keyframes crown { 0%, 100% { transform: translateX(-50%) translateY(0) rotate(-6deg); } 50% { transform: translateX(-50%) translateY(-5px) rotate(6deg); } }
@keyframes sparkle { 0%, 100% { transform: translateX(-50%) scale(1); filter: drop-shadow(0 0 4px #e070ff); } 50% { transform: translateX(-50%) scale(1.15); filter: drop-shadow(0 0 12px #ff9ee0); } }
@keyframes swing { 0%, 100% { transform: rotate(-18deg); } 50% { transform: rotate(18deg); } }
@keyframes sweep { 0%, 100% { transform: rotate(-25deg) translateX(-2px); } 50% { transform: rotate(20deg) translateX(3px); } }
@media (max-width: 600px) {
  .seg button { padding: .3em .55em; font-size: 12px; }
  .rolepill { font-size: 9px; padding: 0 6px; }
}

/* Pemain atas: avatar di kiri, nama/jabatan/kartu tertutup di kanan, supaya tidak menjorok ke meja. */
.seat[data-pos="2"] {
  display: grid;
  grid-template-columns: auto auto;
  grid-auto-flow: row;
  column-gap: 8px;
  row-gap: 2px;
  align-items: center;
  justify-items: start;
  width: auto;
}
.seat[data-pos="2"] .avatar { grid-row: span 4; }
.seat[data-pos="2"] > :not(.avatar) { grid-column: 2; }

/* Pilihan bahasa */
.langseg { gap: 2px; padding: 2px; }
.langseg button { padding: .25em .55em; font-size: 12px; }
#home { position: relative; }
#home > .langseg { position: absolute; top: 12px; right: 16px; }
header .langseg { flex: none; }
@media (max-width: 420px) {
  header { gap: 4px; }
  header button, .hbtn { padding: .35em .45em; font-size: 12px; }
  header .langseg button { padding: .2em .4em; font-size: 11px; }
  .chip { padding: 4px 7px; font-size: 12px; }
  .chip .chiplabel { display: none; }
}

/* ---------- Tidak ada yang bisa melawan: tombol Pass menyala ---------- */
#btnPass.nudge:not(:disabled) { color: #fff; border-color: var(--gold); animation: nudge 1.2s ease-in-out infinite; }
@keyframes nudge { 50% { box-shadow: 0 0 0 4px rgba(245, 196, 81, .35), 0 0 18px rgba(245, 196, 81, .55); } }

/* ---------- Emoji reaksi ---------- */
#btnReact { position: absolute; z-index: 4; left: calc(50% + 50px); bottom: 18px; width: 38px; height: 38px; padding: 0;
  border-radius: 50%; font-size: 19px; line-height: 1; }
#reactBar { position: absolute; z-index: 6; left: 50%; bottom: 64px; transform: translateX(-50%); display: flex; gap: 4px;
  padding: 6px; border-radius: 999px; background: rgba(10, 36, 22, .95); border: 1px solid rgba(255, 255, 255, .2);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .5); animation: popin .18s ease-out; }
#reactBar button, .reactrow button { min-width: 40px; height: 40px; padding: 0 6px; border-radius: 999px; font-size: 20px; font-weight: 900; line-height: 1; }
.reactrow { display: flex; justify-content: center; gap: 6px; margin: 4px 0 12px; }
.reactrow button { min-width: 36px; height: 34px; font-size: 17px; }
.bubble.react { padding: 2px 10px; font-size: 26px; background: rgba(255, 255, 255, .95); }

/* ---------- Papan skor room di layar hasil ---------- */
table.score { width: 100%; margin: 4px 0 12px; border-collapse: collapse; font-size: 13px; }
table.score th { padding: 4px 6px; font-size: 12px; font-weight: 700; opacity: .75; text-align: center; }
table.score th:first-child, table.score td:first-child { text-align: left; }
table.score td { padding: 4px 6px; text-align: center; border-top: 1px solid rgba(255, 255, 255, .1); font-variant-numeric: tabular-nums; }
table.score td:first-child { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
table.score tr.me td { color: var(--gold); }

/* ---------- Lobby: meja lebih besar, tidak ada ruang kosong untuk kartu ---------- */
#game.idle #arena { height: clamp(320px, 64vh, 560px); }
#game.idle #hand, #game.idle #timebar { display: none; }

/* Kursiku di bawah tengah punya ruang lebar: nama panjang + "(kamu)" tidak terpotong. */
.seat[data-pos="0"] { width: 190px; }
.seat[data-pos="0"] .name { max-width: 190px; }
@media (max-width: 600px) {
  .seat[data-pos="0"] { width: 150px; }
  .seat[data-pos="0"] .name { max-width: 150px; }
  #btnReact { left: calc(50% + 40px); bottom: 20px; width: 34px; height: 34px; font-size: 17px; }
  #reactBar { bottom: 58px; }
  #reactBar button { min-width: 36px; height: 36px; font-size: 18px; }
}

/* ---------- HP miring (landscape) ----------
   Tinggi layar HP miring tinggal ±300–360px (dipotong address bar), jadi pakai lebarnya:
   baris atas = header, tengah = meja (bentuk lonjong dikunci aspect-ratio supaya tidak gepeng),
   bawah = kartu di kiri | status + timer + tombol di kanan. */
@media (orientation: landscape) and (max-height: 500px) {
  :root { --cw: 42px; --ch: 59px; }
  #game { max-width: none; height: 100vh; height: 100dvh; padding: 4px 12px 4px; gap: 2px 12px;
    display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto minmax(0, 1fr) auto auto auto; }
  #game > header { grid-column: 1 / -1; grid-row: 1; }
  header button, .hbtn { padding: .25em .6em; font-size: 12px; }
  .chip { padding: 3px 10px; font-size: 12px; }
  #arena { grid-column: 1 / -1; grid-row: 2; height: auto; min-height: 0; container-type: size; }
  #game.idle #arena { height: auto; grid-row: 2 / span 4; }
  /* Ukuran dari tinggi/lebar area meja (cqh/cqw), bukan transform: animasi revolusi memakai transform. */
  #felt { inset: 0; margin: auto; border-width: 7px;
    height: min(100cqh - 20px, (100cqw - 240px) / 2.3); width: min((100cqh - 20px) * 2.3, 100cqw - 240px); }
  #felt::after { inset: 7px; }
  #center { width: min(40%, 320px); gap: 4px; }
  #center .card { --cw: 36px; --ch: 50px; }
  #center .combo { padding: 2px 10px; font-size: 11px; }
  #center .hint { padding: 5px 10px; font-size: 12px; }
  .lobby { gap: 4px; }
  .lobby .code { font-size: 24px; margin-top: -4px; }
  .lobby .actions button { padding: .4em .9em; }
  .seat { width: 96px; gap: 1px; }
  .seat[data-pos="2"] { top: 0; }
  .seat[data-pos="1"] { left: 8px; }
  .seat[data-pos="3"] { right: 8px; }
  .seat[data-pos="0"] { left: 8px; bottom: 2px; transform: none; flex-direction: row; width: auto; gap: 6px; }
  .seat[data-pos="0"] .name { max-width: 170px; }
  .avatar { width: 36px; height: 36px; font-size: 15px; border-width: 2px; }
  .name { font-size: 11px; }
  .tag { font-size: 10px; }
  .backs { display: none; }
  .roleicon { font-size: 18px; top: -18px; }
  #btnReact { left: auto; right: 8px; bottom: 2px; width: 32px; height: 32px; font-size: 16px; }
  #reactBar { left: auto; right: 0; bottom: 40px; transform: none; }
  #revBadge, #tripleBadge { font-size: 10px; padding: 2px 8px; }
  #revBadge small, #tripleBadge small { display: none; }
  /* Baris bawah: kartu di kiri (3 baris grid), status/timer/tombol bertumpuk di kanan. */
  #hand { grid-column: 1; grid-row: 3 / span 3; align-self: end; min-height: 0; padding: 16px 0 11px; }
  #hand.grouped { padding-bottom: 20px; }
  /* Kipas kartu lebih datar: ujung kipas tidak turun keluar layar yang pendek. */
  #hand .slot { transform: translateY(calc(var(--y) * .35)) rotate(calc(var(--r) * .5)); }
  #hand .slot.sel { transform: translateY(calc(var(--y) * .35 - 16px)) rotate(calc(var(--r) * .5)); }
  #status { grid-column: 2; grid-row: 3; align-self: end; max-width: 270px; min-height: 0; font-size: 12px; line-height: 1.25; }
  #timebar { grid-column: 2; grid-row: 4; width: 100%; margin: 2px 0; }
  #timebar::after { right: 0; top: -15px; font-size: 10px; }
  #bar { grid-column: 2; grid-row: 5; display: grid; grid-template-columns: repeat(3, auto); gap: 4px; padding-bottom: 2px; }
  #bar button:not(.big) { padding: .35em .55em; font-size: 11px; }
  #bar .big { padding: .5em .8em; font-size: 15px; }
  #btnPass { grid-column: 1 / span 2; }
  .keys, #logbox { display: none; }
  /* Pertunjukan kemenangan spesial: ukuran mengikuti tinggi layar. */
  .showcase { gap: 2px; padding: 8px; --cw: 30px; --ch: 42px; }
  .sc-icon { font-size: 16vh; }
  .sc-title { font-size: min(14vh, 9vw); }
  .sc-who { font-size: 5vh; }
  .sc-sub { font-size: 12px; }
  .sc-cards { padding-top: 6px; }
  .sc-royals { top: 2%; gap: 6px; --cw: 30px; --ch: 42px; }
  .sc-dragon { font-size: 28vh; }
  .sc-skip { bottom: 4px; }
}
/* Layar hasil lebih tinggi dari layar (HP miring): bisa digulir, tetap di tengah kalau muat. */
#results { display: flex; overflow-y: auto; }
#results .panel { margin: auto; }
@media (orientation: landscape) and (max-height: 500px) {
  #results { padding: 8px; }
  #results .panel { width: min(560px, 100%); padding: 12px 16px; }
  .podium { margin: 10px 0 4px; }
  .step .block { font-size: 18px; }
  .step.p1 .block { height: 52px; } .step.p2 .block { height: 38px; } .step.p3 .block { height: 26px; }
}
