/* ===================== UNO No Mercy – Styles ===================== */
:root {
    --bg: #07130e;
    --felt-1: #175c42;
    --felt-2: #062018;
    --panel: rgba(12, 26, 21, .92);
    --panel-line: rgba(255, 255, 255, .08);
    --text: #f3f6f2;
    --muted: #9fb3a8;
    --gold: #f2c14e;
    --red: #e63946;
    --yellow: #f9c74f;
    --green: #43aa8b;
    --blue: #3d8fbf;

    --cw: 84px;
    --ch: 122px;
    --radius: 11px;
    --hand-scale: 1.06;
}

@media (min-width: 900px) {
    :root { --cw: 100px; --ch: 145px; --radius: 13px; }
}

@media (max-width: 640px) {
    :root { --cw: 68px; --ch: 99px; --radius: 9px; --hand-scale: 1.12; }
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background:
        radial-gradient(1200px 700px at 50% -10%, rgba(67, 170, 139, .18), transparent 60%),
        radial-gradient(900px 600px at 50% 110%, rgba(242, 193, 78, .07), transparent 60%),
        var(--bg);
}

#app { min-height: 100dvh; }
.screen { min-height: 100dvh; }
.hidden { display: none !important; }
.muted { color: var(--muted); font-weight: 500; }
.center { text-align: center; }

/* ------------------------------- Buttons ------------------------------- */
.btn {
    border: 1px solid rgba(255, 255, 255, .14);
    background: rgba(255, 255, 255, .07);
    color: var(--text);
    font: inherit;
    font-weight: 700;
    padding: 12px 18px;
    border-radius: 12px;
    cursor: pointer;
    transition: transform .12s ease, background .15s ease, box-shadow .15s ease, opacity .15s;
}

.btn:hover { background: rgba(255, 255, 255, .12); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .4; cursor: not-allowed; }

.btn.primary {
    background: linear-gradient(160deg, #f4c95d, #dfa32b);
    color: #221a05;
    border-color: rgba(0, 0, 0, .2);
    box-shadow: 0 10px 24px rgba(242, 193, 78, .22);
}

.btn.primary:hover { background: linear-gradient(160deg, #ffd777, #eab13c); }
.btn.ghost { background: transparent; border-color: rgba(255, 255, 255, .16); color: var(--muted); }
.btn.danger { border-color: rgba(230, 57, 70, .45); color: #ff9aa2; }
.btn.small { padding: 8px 12px; font-size: .85rem; border-radius: 10px; }
.btn.big { padding: 15px 22px; font-size: 1.05rem; }
.btn.block { width: 100%; }

.icon-btn {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, .12);
    background: rgba(255, 255, 255, .06);
    color: var(--text);
    font-size: 1rem;
    cursor: pointer;
}

.icon-btn:hover { background: rgba(255, 255, 255, .13); }

/* -------------------------------- Inputs -------------------------------- */
.input {
    width: 100%;
    padding: 13px 15px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, .14);
    background: rgba(0, 0, 0, .3);
    color: var(--text);
    font: inherit;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}

.input::placeholder { color: #6f857a; }
.input:focus { border-color: rgba(242, 193, 78, .65); box-shadow: 0 0 0 3px rgba(242, 193, 78, .13); }
.field-label { display: block; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 7px; }
.code-input { text-transform: uppercase; letter-spacing: .35em; font-weight: 800; text-align: center; font-size: 1.1rem; }

/* -------------------------------- Lobby -------------------------------- */
.lobby-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 26px;
    padding: 28px 18px 40px;
}

.brand { text-align: center; }

.logo {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    transform: rotate(-7deg);
    filter: drop-shadow(0 12px 26px rgba(0, 0, 0, .55));
}

.logo-uno {
    font-size: clamp(3.4rem, 13vw, 5.2rem);
    font-weight: 900;
    font-style: italic;
    letter-spacing: -.03em;
    color: #fff;
    background: linear-gradient(180deg, #ff5a5f, #c1121f);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: .9;
    text-shadow: 0 6px 0 rgba(0, 0, 0, .3);
}

.logo-sub {
    margin-top: 4px;
    font-size: clamp(.8rem, 3vw, 1.05rem);
    letter-spacing: .5em;
    font-weight: 800;
    color: var(--gold);
    text-transform: uppercase;
}

.tagline { color: var(--muted); font-size: .85rem; margin: 14px 0 0; }

.panel {
    background: var(--panel);
    border: 1px solid var(--panel-line);
    border-radius: 20px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
    backdrop-filter: blur(8px);
}

.lobby-card {
    width: min(430px, 100%);
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 13px;
}

.divider {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #6f857a;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .12em;
    margin: 4px 0;
}

.divider::before, .divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, .1);
}

.join-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.hint { color: #7d9186; font-size: .8rem; margin: 0; }

/* ------------------------------- Waitroom ------------------------------- */
.room-screen { padding: 22px 18px 40px; max-width: 980px; margin: 0 auto; }

.room-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}

.room-head-actions { display: flex; gap: 8px; }
.label { font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }

.code-big {
    font-size: clamp(1.9rem, 7vw, 2.6rem);
    font-weight: 900;
    letter-spacing: .22em;
    color: var(--gold);
    font-variant-numeric: tabular-nums;
}

.room-body { display: grid; gap: 18px; }
@media (min-width: 760px) { .room-body { grid-template-columns: 1.4fr 1fr; align-items: start; } }

.players-panel { padding: 20px; }
.players-panel h2 { margin: 0 0 14px; font-size: 1rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }

.player-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }

.player-list li {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 11px 13px;
    border-radius: 12px;
    background: rgba(255, 255, 255, .04);
    border: 1px solid transparent;
    animation: slideIn .2s ease;
}

.player-list li.you { border-color: rgba(242, 193, 78, .45); background: rgba(242, 193, 78, .08); }
.player-list .avatar {
    width: 32px; height: 32px; border-radius: 50%;
    display: grid; place-items: center;
    background: linear-gradient(160deg, #2f7d5f, #14523c);
    font-weight: 800; font-size: .85rem;
}
.player-list .badge { margin-left: auto; font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--gold); }
.player-list .off { color: #6b7d73; font-size: .72rem; margin-left: auto; }

.room-actions { display: flex; flex-direction: column; gap: 10px; }

/* -------------------------------- Game -------------------------------- */
.game-screen {
    height: 100dvh;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto 1fr auto;
    overflow: hidden;
    background:
        radial-gradient(100% 70% at 50% 45%, rgba(23, 92, 66, .75), rgba(6, 32, 24, .96) 70%),
        var(--felt-2);
}

.game-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
    background: rgba(0, 0, 0, .22);
}

.room-chip { font-size: .78rem; color: var(--muted); letter-spacing: .06em; }
.room-chip b { color: var(--gold); letter-spacing: .18em; }
.head-mid { display: flex; align-items: center; gap: 10px; }
.head-actions { display: flex; gap: 7px; }

.color-indicator {
    width: 22px; height: 22px; border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, .5);
    background: #444;
    transition: background .25s, box-shadow .25s;
}
.color-indicator.red { background: var(--red); box-shadow: 0 0 14px rgba(230, 57, 70, .7); }
.color-indicator.yellow { background: var(--yellow); box-shadow: 0 0 14px rgba(249, 199, 79, .7); }
.color-indicator.green { background: var(--green); box-shadow: 0 0 14px rgba(67, 170, 139, .7); }
.color-indicator.blue { background: var(--blue); box-shadow: 0 0 14px rgba(61, 143, 191, .7); }

.dir-indicator { font-size: 1.15rem; color: var(--muted); font-weight: 700; }

.opponents {
    display: flex;
    gap: 9px;
    padding: 10px 12px;
    overflow-x: auto;
    scrollbar-width: none;
}
.opponents::-webkit-scrollbar { display: none; }

.opponent {
    flex: 0 0 auto;
    min-width: 108px;
    padding: 8px 10px;
    border-radius: 13px;
    background: rgba(0, 0, 0, .3);
    border: 1px solid rgba(255, 255, 255, .07);
    transition: border-color .2s, box-shadow .2s, opacity .2s;
    position: relative;
}

.opponent.active {
    border-color: var(--gold);
    box-shadow: 0 0 0 1px rgba(242, 193, 78, .3), 0 0 22px rgba(242, 193, 78, .22);
}

.opponent.out { opacity: .38; }
.opp-top { display: flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 700; }
.opp-top .dot { width: 6px; height: 6px; border-radius: 50%; background: #4c5f55; }
.opp-top .dot.on { background: #4ade80; box-shadow: 0 0 6px #4ade80; }
.opp-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 84px; }
.opp-cards { display: flex; align-items: center; gap: 4px; margin-top: 6px; color: var(--muted); font-size: .78rem; font-weight: 700; }
.mini-back {
    width: 15px; height: 22px; border-radius: 3px;
    background: repeating-linear-gradient(45deg, #b3121f, #b3121f 3px, #8d0d18 3px, #8d0d18 6px);
    border: 1px solid rgba(255, 255, 255, .35);
}
.opp-cards b { margin-left: 3px; color: var(--text); }
.opp-score { font-size: .66rem; color: #6f857a; margin-top: 3px; }

.catch-btn {
    position: absolute;
    top: -9px; right: -6px;
    padding: 4px 8px;
    font-size: .66rem;
    font-weight: 900;
    letter-spacing: .06em;
    border-radius: 999px;
    border: 1px solid #fff3;
    background: linear-gradient(160deg, #ff5a5f, #c1121f);
    color: #fff;
    cursor: pointer;
    animation: pulse 1.4s infinite;
}

/* -------------------------------- Table -------------------------------- */
.table {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(18px, 7vw, 80px);
    padding: 6px 14px;
    min-height: 0;
}

.pile-area { display: flex; align-items: center; gap: clamp(14px, 5vw, 40px); }
.pile-wrap { display: flex; flex-direction: column; align-items: center; gap: 7px; }
.pile-count { font-size: .72rem; font-weight: 700; color: #86a294; letter-spacing: .06em; }
.pile-count.dim { color: #5c6f65; }

.draw-pile { cursor: default; transition: transform .12s; }
.draw-pile.active { cursor: pointer; }
.draw-pile.active:hover { transform: translateY(-3px); }
.draw-pile.active .card.back { box-shadow: 0 0 0 2px var(--gold), 0 12px 26px rgba(0, 0, 0, .5); }

.discard-pile { position: relative; width: var(--cw); height: var(--ch); }
.discard-pile .card { position: absolute; inset: 0; }
.discard-pile .card.pop { animation: cardPop .28s ease; }

.center-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 9px;
    max-width: 300px;
    text-align: center;
}

.turn-banner { font-size: clamp(.95rem, 2.4vw, 1.15rem); font-weight: 800; line-height: 1.25; }
.turn-banner.you { color: var(--gold); }
.turn-banner small { display: block; font-weight: 500; font-size: .76rem; color: var(--muted); margin-top: 3px; }

.pending-banner {
    background: rgba(230, 57, 70, .16);
    border: 1px solid rgba(230, 57, 70, .5);
    color: #ffc9cd;
    border-radius: 12px;
    padding: 9px 12px;
    font-size: .8rem;
    font-weight: 600;
    animation: pulseSoft 1.6s infinite;
}

.table-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

/* -------------------------------- Cards -------------------------------- */
.card {
    position: relative;
    width: var(--cw);
    height: var(--ch);
    border-radius: var(--radius);
    background: #fff;
    padding: 4px;
    user-select: none;
    box-shadow: 0 8px 18px rgba(0, 0, 0, .38);
    flex: 0 0 auto;
    transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}

.card .face {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: calc(var(--radius) - 3px);
    display: grid;
    place-items: center;
    overflow: hidden;
}

.card.red .face { background: linear-gradient(160deg, #ef4b4b, #be1e28); }
.card.yellow .face { background: linear-gradient(160deg, #ffd35c, #e0a52a); }
.card.green .face { background: linear-gradient(160deg, #4cc39a, #1f8a68); }
.card.blue .face { background: linear-gradient(160deg, #4a9fd4, #1c6d9e); }

.card.wild .face {
    background: conic-gradient(from 45deg,
        #e63946 0 25%, #f9c74f 0 50%, #43aa8b 0 75%, #277da1 0);
}

.card .oval {
    width: 74%;
    height: 58%;
    border-radius: 50%;
    background: rgba(255, 255, 255, .95);
    transform: rotate(-20deg);
    display: grid;
    place-items: center;
    box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .1);
}

.card.wild .oval { background: #161616; }
.card .glyph {
    transform: rotate(20deg);
    font-weight: 900;
    color: #1b1b1b;
    line-height: .95;
    text-align: center;
    font-size: calc(var(--ch) * .27);
    letter-spacing: -.02em;
}
.card.wild .glyph { color: #fff; }
.card .glyph.small { font-size: calc(var(--ch) * .14); letter-spacing: .02em; line-height: 1.05; }
.card .glyph.mid { font-size: calc(var(--ch) * .2); }

.card .corner {
    position: absolute;
    font-weight: 900;
    font-size: calc(var(--ch) * .13);
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, .55), 0 0 1px rgba(0, 0, 0, .8);
    line-height: 1;
    letter-spacing: -.02em;
}
.card .corner.tl { top: 6%; left: 8%; }
.card .corner.br { bottom: 6%; right: 8%; transform: rotate(180deg); }
.card.wild .corner { color: #fff; }

.card.back {
    background: linear-gradient(150deg, #1c1c1c, #050505);
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .12);
}
.card.back .back-logo {
    color: #e63946;
    font-weight: 900;
    font-style: italic;
    font-size: calc(var(--ch) * .17);
    transform: rotate(-20deg);
    letter-spacing: -.02em;
    text-shadow: 0 2px 0 rgba(0, 0, 0, .5);
}

/* -------------------------------- Hand -------------------------------- */
.hand-area {
    min-width: 0;
    padding: 4px 0 calc(10px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, transparent, rgba(0, 0, 0, .35));
    border-top: 1px solid rgba(255, 255, 255, .05);
}

.hand-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0 16px 4px;
    font-size: .74rem;
}

.uno-hint { color: var(--gold); font-weight: 800; letter-spacing: .08em; }

.hand-info-right { display: flex; align-items: center; gap: 10px; }

.hand-view-btn {
    border: 1px solid rgba(242, 193, 78, .4);
    background: rgba(242, 193, 78, .1);
    color: var(--gold);
    font: inherit;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .04em;
    padding: 5px 11px;
    border-radius: 999px;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s, transform .12s;
}
.hand-view-btn:hover { background: rgba(242, 193, 78, .2); }
.hand-view-btn:active { transform: scale(.96); }

.hand-wrap { position: relative; min-width: 0; }

.hand {
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    padding: 10px 16px 4px;
    overflow-x: auto;
    overflow-y: hidden;
    min-height: calc(var(--ch) * var(--hand-scale) + 18px);
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
    overscroll-behavior-x: contain;
}

.hand.scrollable { cursor: grab; }
.hand.dragging { cursor: grabbing; }
.hand.dragging .card { cursor: grabbing; }

.hand-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 6;
    width: 34px;
    height: 52px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 12px;
    background: rgba(4, 12, 9, .78);
    color: var(--text);
    font: inherit;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    backdrop-filter: blur(4px);
    box-shadow: 0 8px 22px rgba(0, 0, 0, .4);
    transition: background .15s;
}
.hand-nav:hover { background: rgba(20, 45, 35, .95); }
.hand-nav.prev { left: 4px; }
.hand-nav.next { right: 4px; }

.hand .card {
    width: calc(var(--cw) * var(--hand-scale));
    height: calc(var(--ch) * var(--hand-scale));
    margin-left: 0;
    cursor: default;
}

.hand .card:first-child { margin-left: 0; }

.hand .card.playable { cursor: pointer; }
.hand .card.playable:hover,
.hand .card.playable:focus-visible {
    transform: translateY(-5px);
    box-shadow: 0 0 0 2px var(--gold), 0 16px 30px rgba(0, 0, 0, .5);
    z-index: 4;
    outline: none;
}

.hand .card.dead { filter: brightness(.62) saturate(.72); }
.hand .card.playable { box-shadow: 0 0 0 1px rgba(242, 193, 78, .35), 0 8px 18px rgba(0, 0, 0, .38); }

/* Im Fächer ist nur der linke Streifen sichtbar – Eckwert größer */
.hand .card .glyph { font-size: calc(var(--ch) * var(--hand-scale) * .27); }
.hand .card .glyph.small { font-size: calc(var(--ch) * var(--hand-scale) * .14); }
.hand .card .glyph.mid { font-size: calc(var(--ch) * var(--hand-scale) * .2); }
.hand .card .corner { font-size: calc(var(--ch) * var(--hand-scale) * .155); }
.hand .card .corner.tl { top: 5%; left: 9%; }
.hand .card .corner.br { display: none; }

/* ----------------------------- Hand-Übersicht ----------------------------- */
.hand-view-backdrop {
    position: fixed;
    inset: 0;
    z-index: 95;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(3, 9, 7, .82);
    backdrop-filter: blur(6px);
    animation: fadeIn .15s ease;
}

.hand-view-panel {
    width: 100%;
    max-width: 820px;
    max-height: 88dvh;
    display: flex;
    flex-direction: column;
    padding: 18px;
    border-radius: 20px;
    background: linear-gradient(180deg, #12241c, #0a1712);
    border: 1px solid rgba(255, 255, 255, .1);
    box-shadow: 0 30px 70px rgba(0, 0, 0, .6);
    animation: popIn .18s ease;
}

.hand-view-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.hand-view-head h3 { margin: 3px 0 0; font-size: 1.15rem; }
.hand-view-note { color: var(--muted); font-size: .78rem; margin: 8px 0 14px; line-height: 1.4; }

.hand-view-grid {
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    justify-content: center;
    gap: 10px;
    padding: 4px 2px 10px;
    overflow-y: auto;
}

.hand-view-grid .card { cursor: default; }
.hand-view-grid .card.playable { cursor: pointer; }

.hand-view-grid .card.playable:hover,
.hand-view-grid .card.playable:focus-visible {
    transform: translateY(-5px);
    box-shadow: 0 0 0 2px var(--gold), 0 14px 28px rgba(0, 0, 0, .5);
    outline: none;
}

.hand-view-grid .card.dead { filter: brightness(.62) saturate(.72); }
.hand-view-grid .card.playable { box-shadow: 0 0 0 2px #f2c14e, 0 10px 24px rgba(0, 0, 0, .45); }

.hand-view-panel .modal-actions { margin-top: auto; padding-top: 14px; }

/* -------------------------------- Log -------------------------------- */
.log-panel {
    position: fixed;
    top: 54px;
    right: 12px;
    width: 260px;
    max-height: calc(100dvh - 200px);
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(4, 12, 9, .82);
    border: 1px solid rgba(255, 255, 255, .07);
    backdrop-filter: blur(6px);
    overflow: hidden;
    display: none;
    z-index: 20;
}

.log-head { font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: #6f857a; margin-bottom: 6px; }
.log-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column-reverse; gap: 5px; max-height: calc(100dvh - 240px); overflow-y: auto; }
.log-list li { font-size: .72rem; color: #a9bcb0; line-height: 1.3; }

@media (min-width: 1100px) {
    .log-panel { display: block; }
    .game-screen { padding-right: 286px; }
    .log-panel { top: 64px; }
}

.log-panel.open { display: block; }

/* -------------------------------- Modal -------------------------------- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .66);
    backdrop-filter: blur(4px);
    display: grid;
    place-items: center;
    padding: 18px;
    z-index: 100;
    animation: fadeIn .15s ease;
}

.modal {
    width: min(420px, 100%);
    background: linear-gradient(180deg, #12241c, #0a1712);
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 20px;
    padding: 22px;
    box-shadow: 0 30px 70px rgba(0, 0, 0, .6);
    animation: popIn .18s ease;
    max-height: 86dvh;
    overflow-y: auto;
}

.modal h3 { margin: 0 0 6px; font-size: 1.15rem; }
.modal p { color: var(--muted); font-size: .85rem; margin: 0 0 16px; line-height: 1.45; }
.modal-actions { display: flex; gap: 9px; margin-top: 16px; }
.modal-actions .btn { flex: 1; }

.color-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.color-btn {
    height: 66px;
    border-radius: 14px;
    border: 2px solid rgba(255, 255, 255, .22);
    cursor: pointer;
    font-weight: 900;
    color: #fff;
    font-size: .9rem;
    letter-spacing: .08em;
    text-shadow: 0 1px 3px rgba(0, 0, 0, .5);
    transition: transform .12s, box-shadow .12s;
}
.color-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(0, 0, 0, .4); }
.color-btn.red { background: linear-gradient(160deg, #ef4b4b, #b8151f); }
.color-btn.yellow { background: linear-gradient(160deg, #ffd35c, #d69a1c); color: #3a2a00; text-shadow: none; }
.color-btn.green { background: linear-gradient(160deg, #4cc39a, #16795a); }
.color-btn.blue { background: linear-gradient(160deg, #4a9fd4, #175f8c); }

.swap-list { display: flex; flex-direction: column; gap: 8px; }
.swap-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(255, 255, 255, .1);
    color: var(--text);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}
.swap-btn:hover { background: rgba(255, 255, 255, .12); }
.swap-btn span.count { color: var(--gold); font-size: .82rem; }

/* -------------------------------- Toast -------------------------------- */
.toast-root {
    position: fixed;
    left: 50%;
    top: 58px;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 200;
    width: min(420px, calc(100% - 24px));
    pointer-events: none;
}

.toast {
    padding: 11px 15px;
    border-radius: 12px;
    background: rgba(12, 26, 21, .96);
    border: 1px solid rgba(255, 255, 255, .12);
    color: var(--text);
    font-size: .85rem;
    font-weight: 600;
    box-shadow: 0 14px 34px rgba(0, 0, 0, .5);
    animation: toastIn .18s ease;
}
.toast.error { border-color: rgba(230, 57, 70, .6); color: #ffc9cd; }

/* ------------------------------ Game over ------------------------------ */
.overlay {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(3, 9, 7, .8);
    backdrop-filter: blur(6px);
    z-index: 90;
}

.overlay .panel { width: min(440px, 100%); padding: 26px; text-align: center; }
.winner-name { font-size: 1.6rem; font-weight: 900; color: var(--gold); margin: 6px 0 2px; }
.win-points { color: var(--muted); font-size: .85rem; margin-bottom: 18px; }

.score-table { display: flex; flex-direction: column; gap: 6px; margin: 0 0 18px; }
.score-row { display: flex; justify-content: space-between; gap: 10px; font-size: .86rem; padding: 8px 10px; border-radius: 9px; background: rgba(255, 255, 255, .05); }
.score-row.win { background: rgba(242, 193, 78, .14); color: var(--gold); font-weight: 800; }

/* ------------------------------ Animations ------------------------------ */
@keyframes cardPop { 0% { transform: scale(.85) rotate(-6deg); opacity: .4; } 100% { transform: scale(1) rotate(0); opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes slideIn { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
@keyframes pulseSoft { 0%, 100% { opacity: 1; } 50% { opacity: .72; } }

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

/* ------------------------------ Small screens ------------------------------ */
@media (max-width: 560px) {
    .table { flex-direction: column; gap: 12px; padding: 4px 8px; }
    .pile-area { gap: 22px; }
    .center-info { max-width: 92vw; }
    .turn-banner { font-size: .9rem; }
    .pending-banner { font-size: .72rem; padding: 7px 9px; }
    .table-actions .btn { padding: 9px 12px; font-size: .8rem; }
    .hand { padding: 10px 10px 2px; }
    .hand-nav { width: 30px; height: 46px; font-size: 1.25rem; }
    .log-panel { width: min(280px, calc(100% - 24px)); top: 56px; }
    .hand-view-panel { padding: 14px; }
    .hand-view-grid { gap: 8px; }
    .hand-view-btn { font-size: .68rem; padding: 5px 9px; }
}
