/* ===========================================================================
   Uno Online — gaya permainan
   Font di-self-host (assets/fonts) supaya tampilan tidak bergantung font sistem
   dan tidak perlu koneksi ke Google Fonts saat bermain.
   =========================================================================== */

@font-face {
    font-family: 'Fredoka';
    src: url('assets/fonts/Fredoka.woff2') format('woff2-variations');
    font-weight: 300 700;
    font-display: swap;
}
@font-face {
    font-family: 'Nunito';
    src: url('assets/fonts/Nunito.woff2') format('woff2-variations');
    font-weight: 200 900;
    font-display: swap;
}

:root {
    --ink:        #10161c;
    --ink-2:      #1a222b;
    --ink-3:      #263039;
    --line:       #33414c;
    --line-soft:  #2a353f;
    --text:       #eef4f7;
    --muted:      #93a3ad;
    --muted-2:    #6d7c86;

    --gold:       #ffc93c;
    --gold-dark:  #c8940c;
    --mint:       #2fe0b0;
    --mint-dark:  #12a37c;
    --coral:      #ff6b6b;
    --coral-dark: #c93f3f;
    --violet:     #8b7bff;

    --radius:     16px;
    --radius-lg:  24px;
    --shadow:     0 18px 40px rgba(0, 0, 0, .45);
    --ring:       0 0 0 3px rgba(47, 224, 176, .35);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
    margin: 0;
    font-family: 'Nunito', system-ui, sans-serif;
    font-size: 16px;
    color: var(--text);
    background-color: #0c1a16;
    background-image:
        radial-gradient(ellipse 120% 80% at 50% 0%, rgba(47, 224, 176, .10), transparent 60%),
        radial-gradient(ellipse 100% 70% at 50% 110%, rgba(0, 0, 0, .55), transparent 65%),
        linear-gradient(rgba(8, 18, 15, .55), rgba(8, 18, 15, .72)),
        url('assets/table/felt.jpg');
    background-size: cover, cover, cover, cover;
    background-position: center;
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
    /* #screenGame memakai 100vw untuk keluar dari kolom; cegah geser horizontal */
    overflow-x: hidden;
}

/* --- Kerangka ------------------------------------------------------------- */
.app {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    padding: 18px 16px 48px;
    min-height: 100%;
    display: flex;
    flex-direction: column;
}

h1, h2, h3, .brand-mark, .btn, .mi-title, .turn-banner, .score-badge {
    font-family: 'Fredoka', 'Nunito', sans-serif;
    font-weight: 600;
    letter-spacing: .2px;
}

h2 { margin: 0 0 6px; font-size: 1.35rem; }
h3 { margin: 0 0 14px; font-size: 1.1rem; }

.hint { color: var(--muted); font-size: .88rem; margin: 4px 0 16px; }
.error-text { color: var(--coral); font-size: .88rem; margin: 8px 0; }

/* --- Logo ----------------------------------------------------------------- */
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 22px;
}
.logo-uno {
    font-family: 'Fredoka', sans-serif;
    font-weight: 700;
    font-size: 1.6rem;
    line-height: 1;
    padding: 10px 16px;
    color: #2b1d00;
    background: linear-gradient(180deg, var(--gold), #f0a800);
    border-radius: 13px;
    box-shadow: 0 5px 0 var(--gold-dark), 0 12px 24px rgba(0, 0, 0, .4);
    transform: rotate(-3deg);
    letter-spacing: 1px;
}
.brand-sub { font-family: 'Fredoka', sans-serif; color: #bfe9dd; font-size: 1.05rem; }
.conn {
    margin-left: auto;
    font-size: .74rem;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--ink-3);
    color: var(--muted);
    border: 1px solid var(--line-soft);
}
.conn.ok  { background: rgba(47,224,176,.16); color: #8ff0d3; border-color: rgba(47,224,176,.4); }
.conn.bad { background: rgba(255,107,107,.16); color: #ffb4b4; border-color: rgba(255,107,107,.4); }

/* --- Layar ---------------------------------------------------------------- */
.screen { animation: screen-in .22s ease-out; }
@keyframes screen-in { from { opacity: 0; transform: translateY(8px); } }

.centered { text-align: center; padding: 28px 0; }

.row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 16px; }

/* --- Tombol --------------------------------------------------------------- */
.btn, button {
    font-family: 'Fredoka', sans-serif;
    font-weight: 600;
    font-size: .95rem;
    color: #06211a;
    background: linear-gradient(180deg, #46eec2, var(--mint));
    border: none;
    border-radius: 13px;
    padding: 12px 20px;
    cursor: pointer;
    box-shadow: 0 4px 0 var(--mint-dark), 0 8px 18px rgba(0, 0, 0, .3);
    transition: transform .08s ease, box-shadow .08s ease, filter .15s ease;
}
button:hover:not(:disabled) { filter: brightness(1.07); }
button:active:not(:disabled) {
    transform: translateY(3px);
    box-shadow: 0 1px 0 var(--mint-dark), 0 4px 10px rgba(0, 0, 0, .3);
}
button:disabled { opacity: .4; cursor: not-allowed; box-shadow: 0 4px 0 rgba(0,0,0,.25); }

button.primary {
    background: linear-gradient(180deg, #ffd964, var(--gold));
    color: #3a2a00;
    box-shadow: 0 4px 0 var(--gold-dark), 0 8px 18px rgba(0, 0, 0, .3);
}
button.primary:active:not(:disabled) { box-shadow: 0 1px 0 var(--gold-dark); }

button.secondary {
    background: linear-gradient(180deg, #3b4650, var(--ink-3));
    color: var(--text);
    box-shadow: 0 4px 0 #151c22, 0 8px 18px rgba(0, 0, 0, .3);
}
button.secondary:active:not(:disabled) { box-shadow: 0 1px 0 #151c22; }

button.wide { width: 100%; padding: 15px; font-size: 1.05rem; }

.link {
    font-family: 'Nunito', sans-serif;
    background: none;
    box-shadow: none;
    color: var(--mint);
    padding: 2px 0;
    font-weight: 700;
    font-size: .84rem;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.link:hover:not(:disabled) { background: none; transform: none; filter: none; color: #7ff3d3; }
.link.danger { color: var(--coral); }

/* --- Form ----------------------------------------------------------------- */
.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-size: .82rem; color: var(--muted); margin-bottom: 7px; }

input[type="text"] {
    width: 100%;
    padding: 13px 15px;
    border-radius: 12px;
    border: 1.5px solid var(--line);
    background: rgba(9, 14, 18, .75);
    color: var(--text);
    font-family: 'Nunito', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    transition: border-color .15s, box-shadow .15s;
}
input[type="text"]::placeholder { color: var(--muted-2); font-weight: 400; }
input[type="text"]:focus { outline: none; border-color: var(--mint); box-shadow: var(--ring); }

/* --- Kartu (aset gambar) --------------------------------------------------- */
.card.image-card {
    width: 76px;
    height: 118px;
    padding: 0;
    background: none;
    border: none;
    box-shadow: none;
    display: block;
    cursor: default;
    position: relative;
    transition: transform .18s cubic-bezier(.2, .9, .3, 1.3);
}
.card.image-card.small { width: 76px; height: 118px; }
.card.image-card img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
    filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .55));
}
.card.image-card.playable { cursor: pointer; }
.card.image-card.dim { opacity: .5; filter: saturate(.6); }
.card.empty {
    background: rgba(255, 255, 255, .06);
    border: 2px dashed var(--line);
    border-radius: 12px;
}

/* --- Avatar --------------------------------------------------------------- */
.avatar-ring {
    border-radius: 50%;
    padding: 3px;
    background: linear-gradient(160deg, rgba(255,255,255,.5), rgba(255,255,255,.06));
    display: inline-flex;
    flex: none;
}
.avatar-ring img {
    display: block;
    border-radius: 50%;
    width: 100%;
    height: 100%;
    background: #0c1216;
}

/* --- Layar profil ---------------------------------------------------------- */
.panel {
    background: linear-gradient(180deg, rgba(27, 35, 42, .92), rgba(17, 23, 29, .94));
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-lg);
    padding: 22px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(6px);
}

.custom-avatar {
    display: flex;
    align-items: center;
    gap: 16px;
    background: rgba(9, 14, 18, .55);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 18px;
}
.custom-avatar .avatar-ring { width: 84px; height: 84px; }
.ca-text { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-width: 0; }
.ca-text strong { font-family: 'Fredoka', sans-serif; }
.ca-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ca-text .hint { margin: 0; font-size: .82rem; }
.upload-info  { color: var(--muted); }
.upload-ok    { color: var(--mint); }
.upload-error { color: var(--coral); }

.avatar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}
.avatar-choice {
    padding: 3px;
    border: none;
    background: none;
    box-shadow: none;
    border-radius: 50%;
    cursor: pointer;
    line-height: 0;
    transition: transform .12s ease, background .12s ease;
}
.avatar-choice img { width: 100%; height: auto; border-radius: 50%; display: block; }
.avatar-choice:hover:not(:disabled) { transform: translateY(-4px) scale(1.04); filter: none; background: none; }
.avatar-choice.selected {
    background: linear-gradient(160deg, var(--gold), var(--mint));
    box-shadow: 0 0 18px rgba(255, 201, 60, .5);
}

/* --- Menu utama ----------------------------------------------------------- */
.profile-chip {
    display: flex;
    align-items: center;
    gap: 14px;
    background: linear-gradient(180deg, rgba(27, 35, 42, .92), rgba(17, 23, 29, .94));
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-lg);
    padding: 14px 18px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}
.profile-chip .avatar-ring { width: 62px; height: 62px; }
.pc-text { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.pc-text strong { font-family: 'Fredoka', sans-serif; font-size: 1.15rem; }

.menu { display: grid; gap: 13px; }
.menu-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    text-align: left;
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    color: var(--text);
    background: linear-gradient(180deg, rgba(38, 48, 57, .95), rgba(24, 31, 38, .95));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 17px 20px;
    box-shadow: 0 5px 0 rgba(0, 0, 0, .35), 0 12px 24px rgba(0, 0, 0, .28);
    transition: transform .1s ease, border-color .15s, box-shadow .1s;
}
.menu-item:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--mint); filter: none; }
.menu-item:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.35); }
.menu-item.accent {
    background: linear-gradient(180deg, #2c6b5c, #1d4f43);
    border-color: rgba(47, 224, 176, .5);
}
.menu-item .mi-title { font-size: 1.12rem; }
.menu-item .mi-sub { font-family: 'Nunito', sans-serif; font-size: .87rem; font-weight: 500; color: #b9c8cf; }

.join-item { cursor: default; }
.join-item:hover { transform: none; border-color: var(--line); }
.join-row { display: flex; gap: 9px; width: 100%; margin-top: 10px; }
.join-row input { flex: 1; min-width: 0; text-align: center; letter-spacing: 6px; font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 1.15rem; text-transform: uppercase; }

/* --- Mencari lawan -------------------------------------------------------- */
.radar {
    width: 92px;
    height: 92px;
    margin: 0 auto 22px;
    border-radius: 50%;
    border: 3px solid rgba(47, 224, 176, .25);
    position: relative;
}
.radar::before, .radar::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 3px solid var(--mint);
    animation: radar 1.8s ease-out infinite;
}
.radar::after { animation-delay: .9s; }
@keyframes radar { from { transform: scale(.35); opacity: .9; } to { transform: scale(1.15); opacity: 0; } }
.radar span {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: 2rem;
}

/* --- Lobby ---------------------------------------------------------------- */
.room-code {
    font-family: 'Fredoka', sans-serif;
    font-weight: 700;
    color: #2b1d00;
    background: linear-gradient(180deg, var(--gold), #f0a800);
    padding: 4px 14px;
    border-radius: 10px;
    letter-spacing: 4px;
    box-shadow: 0 3px 0 var(--gold-dark);
}
.player-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin-bottom: 8px; }
.player-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(180deg, rgba(38, 48, 57, .9), rgba(22, 29, 35, .9));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px 14px;
}
.player-card .avatar-ring { width: 50px; height: 50px; }
.player-card.is-me { border-color: var(--mint); box-shadow: 0 0 0 1px rgba(47,224,176,.3), 0 0 22px rgba(47,224,176,.15); }
.player-card.is-host { background: linear-gradient(180deg, rgba(64, 56, 24, .9), rgba(34, 30, 14, .9)); }
.player-card.is-bot { opacity: .95; }
.pc-info { display: flex; flex-direction: column; gap: 3px; overflow: hidden; flex: 1; }
.pc-info strong { font-family: 'Fredoka', sans-serif; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag { font-size: .68rem; font-weight: 800; letter-spacing: 1.2px; color: var(--muted); }
.tag.host { color: var(--gold); }
.tag.bot  { color: var(--violet); }

/* --- Meja permainan ------------------------------------------------------- */
/* Layar permainan keluar dari kolom .app supaya duduk LANGSUNG di atas felt,
   bukan berada di dalam kotak panel. */
#screenGame {
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    padding: 0 clamp(8px, 2.5vw, 32px);
}

.table-wrap { display: block; }

/* Meja tidak punya latar sendiri — felt halaman yang jadi mejanya. */
.table-felt {
    position: relative;
    width: 100%;
    padding: 14px 14px 10px;
}
.table-felt::after {
    content: '';
    position: absolute;
    inset: 2px;
    border: 2px dashed rgba(255, 255, 255, .10);
    border-radius: 30px;
    box-shadow: inset 0 0 90px rgba(0, 0, 0, .40);
    pointer-events: none;
}

/* Kursi lawan */
.seats {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 14px;
    margin-bottom: 14px;
    min-height: 10px;
}
.seat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    padding: 10px 12px;
    border-radius: var(--radius);
    background: rgba(0, 0, 0, .3);
    border: 2px solid transparent;
    min-width: 100px;
    transition: border-color .2s, box-shadow .2s, transform .2s;
}
.seat .avatar-ring { width: 52px; height: 52px; }
.seat .seat-name {
    font-family: 'Fredoka', sans-serif;
    font-size: .82rem;
    max-width: 104px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.seat .seat-cards { display: flex; align-items: center; gap: 5px; }
.seat .mini-stack { display: flex; }
.seat .mini-stack i {
    display: block;
    width: 11px;
    height: 17px;
    margin-left: -5px;
    border-radius: 3px;
    background: repeating-linear-gradient(45deg, #37506b 0 3px, #26374d 3px 6px);
    border: 1px solid rgba(255, 255, 255, .22);
}
.seat .mini-stack i:first-child { margin-left: 0; }
.seat .count-badge {
    font-family: 'Fredoka', sans-serif;
    font-size: .78rem;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .12);
}
.seat.active {
    border-color: var(--gold);
    background: rgba(255, 201, 60, .12);
    box-shadow: 0 0 26px rgba(255, 201, 60, .3);
    transform: translateY(-3px);
}
.seat.out { opacity: .45; filter: grayscale(.6); }

/* Tumpukan di tengah */
.table-center {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: clamp(44px, 9vw, 96px);
    padding: 20px 0 8px;
    min-height: 172px;
}
.pile { display: flex; flex-direction: column; align-items: center; gap: 9px; min-width: 108px; }
.pile-label {
    font-family: 'Fredoka', sans-serif;
    font-size: .78rem;
    font-weight: 600;
    padding: 3px 12px;
    border-radius: 999px;
    background: rgba(0, 0, 0, .45);
    border: 1px solid rgba(255, 255, 255, .12);
    color: #cfe0e6;
}
.card-back-img {
    width: 92px;
    height: 142px;
    object-fit: contain;
    border-radius: 11px;
    cursor: pointer;
    user-select: none;
    -webkit-user-drag: none;
    transition: transform .16s ease, filter .16s ease;
    filter: drop-shadow(0 10px 14px rgba(0, 0, 0, .6));
}
.card-back-img:hover { transform: translateY(-6px) rotate(-2deg); filter: drop-shadow(0 14px 18px rgba(0,0,0,.65)) brightness(1.08); }
/* Tumpukan berdenyut saat giliranmu — ini satu-satunya cara mengambil kartu,
   jadi harus jelas terlihat bisa diklik. */
.card-back-img.can-draw {
    cursor: pointer;
    animation: deck-nudge 1.8s ease-in-out infinite;
    filter: drop-shadow(0 0 16px var(--mint)) drop-shadow(0 10px 14px rgba(0, 0, 0, .6));
}
@keyframes deck-nudge {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50%      { transform: translateY(-8px) rotate(-2.5deg); }
}
/* Kartu di tumpukan buangan dibuat seukuran punggung kartu */
.card-display .card.image-card,
.card-display .card.image-card.small { width: 92px; height: 142px; }
.card-display { display: flex; align-items: center; }
.card-display .card.image-card {
    animation: play-in .28s cubic-bezier(.2, .9, .3, 1.35);
    filter: drop-shadow(0 0 22px var(--glow, transparent));
}
@keyframes play-in {
    from { transform: translateY(-26px) scale(.86) rotate(-8deg); opacity: 0; }
}

/* Pita giliran */
.turn-banner {
    position: relative;
    margin: 20px auto 8px;
    width: fit-content;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 20px;
    border-radius: 999px;
    font-size: .95rem;
    white-space: nowrap;
    background: rgba(6, 16, 13, .85);
    border: 1px solid rgba(255, 255, 255, .12);
    box-shadow: 0 8px 20px rgba(0, 0, 0, .45);
}
.turn-banner .avatar-ring { width: 28px; height: 28px; }
.turn-banner.mine {
    background: linear-gradient(180deg, #46eec2, var(--mint));
    color: #04231b;
    border-color: transparent;
    animation: banner-pulse 1.6s ease-in-out infinite;
}
@keyframes banner-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(47, 224, 176, .55), 0 8px 20px rgba(0,0,0,.45); }
    50%      { box-shadow: 0 0 0 14px rgba(47, 224, 176, 0), 0 8px 20px rgba(0,0,0,.45); }
}

/* --- Tangan pemain (dikipas) ---------------------------------------------- */
.hand-zone { margin-top: 20px; text-align: center; }
.hand-cards {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    min-height: 150px;
    padding: 16px 6px 6px;
}
.hand-cards .card.image-card {
    margin: 0 calc(var(--overlap, 10px) / -2);
    transform: rotate(var(--rot, 0deg)) translateY(var(--lift, 0px));
    transform-origin: 50% 145%;
    z-index: var(--z, 1);
}
.hand-cards .card.image-card.playable:hover {
    transform: rotate(var(--rot, 0deg)) translateY(calc(var(--lift, 0px) - 26px)) scale(1.09);
    z-index: 200;
}
.hand-cards .card.image-card.playable:hover img {
    filter: drop-shadow(0 0 14px var(--mint)) drop-shadow(0 10px 14px rgba(0, 0, 0, .5));
}
.deal-in { animation: deal-in .3s cubic-bezier(.2, .9, .3, 1.2) backwards; }
@keyframes deal-in { from { transform: translateY(70px) scale(.7); opacity: 0; } }

.game-actions { margin-top: 18px; }

/* --- Obrolan -------------------------------------------------------------- */
.chat-panel {
    margin-top: 18px;
    background: linear-gradient(180deg, rgba(27, 35, 42, .94), rgba(16, 22, 27, .96));
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
}
.chat-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(0, 0, 0, .28);
    border-bottom: 1px solid var(--line-soft);
    font-family: 'Fredoka', sans-serif;
    font-size: .92rem;
    color: var(--mint);
}
.chat-hint { font-family: 'Nunito', sans-serif; color: var(--muted-2); font-size: .76rem; }
.chat-log { height: 168px; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 9px; }
.chat-line { display: flex; gap: 9px; align-items: flex-start; animation: screen-in .18s ease-out; }
.chat-line.mine { flex-direction: row-reverse; }
.chat-line .avatar-ring { width: 30px; height: 30px; }
.chat-bubble {
    display: flex;
    flex-direction: column;
    gap: 1px;
    background: rgba(255, 255, 255, .07);
    border-radius: 12px;
    padding: 6px 12px;
    max-width: 76%;
    word-break: break-word;
}
.chat-line.mine .chat-bubble { background: rgba(47, 224, 176, .16); }
.chat-author { font-size: .7rem; font-weight: 800; color: var(--muted); }
.chat-line.mine .chat-author { color: #8ff0d3; }
.chat-text { font-size: .92rem; }
.chat-form { display: flex; gap: 9px; padding: 12px; border-top: 1px solid var(--line-soft); }
.chat-form input { flex: 1; min-width: 0; }
.chat-form button { flex: none; padding: 12px 18px; }

/* --- Log kejadian --------------------------------------------------------- */
.messages {
    margin-top: 18px;
    background: rgba(9, 14, 18, .6);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    padding: 10px 12px;
    min-height: 44px;
    max-height: 150px;
    overflow-y: auto;
    font-size: .86rem;
    text-align: left;
}
.message-item {
    padding: 7px 11px;
    border-radius: 9px;
    margin: 4px 0;
    color: #fff;
    background: rgba(255, 255, 255, .06);
    animation: screen-in .18s ease-out;
}
.message-item.info    { background: rgba(74, 150, 214, .22); border-left: 3px solid #4a96d6; }
.message-item.success { background: rgba(47, 176, 130, .22); border-left: 3px solid var(--mint); }
.message-item.warning { background: rgba(200, 148, 12, .22); border-left: 3px solid var(--gold); }
.message-item.error   { background: rgba(201, 63, 63, .24); border-left: 3px solid var(--coral); }

/* --- Modal pilih warna ---------------------------------------------------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .75);
    backdrop-filter: blur(3px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    padding: 16px;
}
.modal {
    background: linear-gradient(180deg, rgba(30, 39, 47, .98), rgba(16, 22, 27, .98));
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 24px;
    text-align: center;
    width: min(360px, 100%);
    box-shadow: var(--shadow);
    animation: screen-in .2s ease-out;
}
.color-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; margin-bottom: 16px; }
.color-choice {
    font-family: 'Fredoka', sans-serif;
    padding: 20px 10px;
    border-radius: 14px;
    font-size: 1rem;
    box-shadow: 0 4px 0 rgba(0, 0, 0, .35);
}
.color-choice.RED    { background: linear-gradient(180deg, #ff6b6b, #e04545); color: #fff; }
.color-choice.YELLOW { background: linear-gradient(180deg, #ffd964, #f0a800); color: #3a2a00; }
.color-choice.GREEN  { background: linear-gradient(180deg, #56d98a, #1ea55e); color: #04261a; }
.color-choice.BLUE   { background: linear-gradient(180deg, #5aa8f5, #2b7fd4); color: #fff; }
.color-choice:hover:not(:disabled) { filter: brightness(1.1); }

/* --- Aturan rumahan (lobby) ------------------------------------------------ */
.rules-box {
    margin: 6px 0 4px;
    background: rgba(9, 14, 18, .5);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    padding: 14px 16px;
}
.switch-row { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.switch-row input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 46px;
    height: 27px;
    border-radius: 999px;
    background: var(--ink-3);
    border: 1px solid var(--line);
    position: relative;
    flex: none;
    margin-top: 2px;
    cursor: pointer;
    transition: background .18s ease, border-color .18s ease;
}
.switch-row input[type="checkbox"]::after {
    content: '';
    position: absolute;
    top: 2px; left: 2px;
    width: 21px; height: 21px;
    border-radius: 50%;
    background: #cdd8dd;
    transition: transform .18s cubic-bezier(.3,.9,.3,1.3), background .18s;
}
.switch-row input[type="checkbox"]:checked {
    background: linear-gradient(180deg, #46eec2, var(--mint));
    border-color: var(--mint-dark);
}
.switch-row input[type="checkbox"]:checked::after { transform: translateX(19px); background: #04241c; }
.switch-row input[type="checkbox"]:disabled { opacity: .45; cursor: not-allowed; }
.switch-text { display: flex; flex-direction: column; gap: 3px; }
.switch-text strong { font-family: 'Fredoka', sans-serif; font-size: 1rem; }
.switch-text small { color: var(--muted); font-size: .82rem; line-height: 1.45; }
.rules-box .hint { margin: 8px 0 0; }

/* --- Pilihan banyak kartu -------------------------------------------------- */
.hand-actions {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.hand-hint { color: var(--muted); font-size: .82rem; }

.card.image-card.selected {
    transform: rotate(var(--rot, 0deg)) translateY(calc(var(--lift, 0px) - 34px)) scale(1.07);
    z-index: 300;
}
.card.image-card.selected img {
    filter: drop-shadow(0 0 16px var(--gold)) drop-shadow(0 10px 14px rgba(0, 0, 0, .5));
}

/* --- Peringatan hukuman menggantung --------------------------------------- */
.penalty-banner {
    margin: 6px auto 0;
    width: fit-content;
    max-width: 92%;
    text-align: center;
    padding: 9px 18px;
    border-radius: 999px;
    font-family: 'Fredoka', sans-serif;
    font-size: .88rem;
    color: #ffe9b8;
    background: rgba(201, 63, 63, .28);
    border: 1px solid rgba(255, 107, 107, .55);
    animation: penalty-pulse 1.6s ease-in-out infinite;
}
@keyframes penalty-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 107, 107, .45); }
    50%      { box-shadow: 0 0 0 12px rgba(255, 107, 107, 0); }
}

/* --- Animasi kartu dilempar ke meja --------------------------------------- */
.fly-card {
    position: fixed;
    z-index: 900;
    pointer-events: none;
    border-radius: 10px;
    transform-origin: 50% 60%;
    filter: drop-shadow(0 14px 20px rgba(0, 0, 0, .65));
    transition:
        left .42s cubic-bezier(.22, .68, .3, 1),
        top .42s cubic-bezier(.22, .68, .3, 1),
        width .42s ease,
        height .42s ease,
        transform .42s cubic-bezier(.3, .7, .4, 1);
}

/* --- Responsif ------------------------------------------------------------ */
@media (max-width: 640px) {
    body { font-size: 15px; }
    .app { padding: 12px 10px 36px; }
    .card.image-card { width: 62px; height: 96px; }
    .card.image-card.small { width: 62px; height: 96px; }
    .card-display .card.image-card,
    .card-display .card.image-card.small { width: 72px; height: 111px; }
    .card-back-img { width: 72px; height: 111px; }
    .table-center { gap: 40px; min-height: 136px; }
    .pile { min-width: 84px; }
    .seat { min-width: 84px; padding: 8px; }
    .seat .avatar-ring { width: 42px; height: 42px; }
    .hand-cards { min-height: 116px; }
    .turn-banner { font-size: .85rem; padding: 7px 15px; margin-top: 14px; }
    .chat-log { height: 132px; }
    .player-grid { grid-template-columns: 1fr; }
    .brand-sub { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
