/* =====================================================================
   MỤC LỤC (thứ tự: token → nền → thành phần → từng màn hình)
   1. Token (:root): màu, cỡ chữ 6 bậc, bo góc 4 bậc, khoảng cách 4px, cao nút 30/34/42/50
   2. Nền: reset, chữ, ô nhập
   3. Thành phần: nút, thẻ, ô nhập, huy hiệu
   4. Màn hình: trang chủ, phòng, bảng điểm, xếp hạng/lịch sử/phòng, hộp thoại
   5. Chế độ 13 lá: bàn, lá, nói chuyện, bàn chờ, kinh, chat, tới lượt, sảnh lớn
   6. TV & pháo hoa/lửa (cuối file, giữ nguyên)
   ===================================================================== */

:root {
    --green: #58CC02;
    --green-dark: #58A700;
    --green-light: #D7FFB8;
    --blue: #1CB0F6;
    --blue-dark: #1899D6;
    --blue-light: #DDF4FF;
    --blue-line: #84D8FF;
    --red: #FF4B4B;
    --red-dark: #EA2B2B;
    --red-light: #FFDFE0;
    --red-line: #FFB2B2;
    --orange: #FF9600;
    --orange-dark: #E08600;
    --orange-light: #FFF0DB;
    --yellow: #FFC800;
    --yellow-dark: #E5B400;
    --yellow-light: #FFF5D3;

    --text: #4B4B4B;
    --muted: #777777;
    --subtle: #AFAFAF;
    --line: #E5E5E5;
    --line-dark: #CECECE;
    --bg: #FFFFFF;
    --bg-soft: #F7F7F7;

    --white: #FFFFFF;
    --gold-deep: #CD7900;
    --red-deep: #C93636;

    /* Cỡ chữ: 6 bậc */
    --fs-2xs: 11px;
    --fs-xs: 12px;
    --fs-sm: 14px;
    --fs-md: 16px;
    --fs-lg: 18px;
    --fs-xl: 22px;
    --fs-2xl: 28px;

    /* Bo góc: 4 bậc */
    --r-sm: 10px;
    --r-md: 14px;
    --r-lg: 20px;
    --r-pill: 999px;
    --radius: var(--r-md);

    /* Khoảng cách: nhịp 4px */
    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-5: 24px;

    /* Chiều cao điều khiển (nút, ô nhập) */
    --h-xs: 30px;
    --h-sm: 34px;
    --h-md: 42px;
    --h-lg: 50px;

    --font: 'Nunito', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    margin: 0;
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-weight: 700;
    -webkit-font-smoothing: antialiased;
    touch-action: manipulation;
}

body {
    overflow: hidden;
}

button,
input {
    font: inherit;
    /* Từ 16px trở lên thì iOS không tự phóng to màn hình khi bấm vào ô nhập */
    font-size: var(--fs-md);
    color: inherit;
}

button {
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
}

[hidden] {
    display: none !important;
}

h1,
h2,
h3,
p {
    margin: 0;
}

.wordmark {
    font-weight: 900;
    color: var(--green);
    letter-spacing: -0.02em;
}

/* ---------- Buttons ---------- */

.btn {
    --b: var(--green);
    --s: var(--green-dark);
    --t: var(--white);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    height: var(--h-lg);
    padding: 0 var(--sp-5);
    margin-bottom: var(--sp-1);
    border: 0;
    border-radius: var(--radius);
    background: var(--b);
    color: var(--t);
    box-shadow: 0 4px 0 var(--s);
    font-size: var(--fs-sm);
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
    transition: filter 0.15s, transform 0.05s, box-shadow 0.05s;
}

.btn:hover:not(:disabled) {
    filter: brightness(1.06);
}

.btn:active:not(:disabled) {
    transform: translateY(4px);
    box-shadow: 0 0 0 var(--s);
}

.btn:disabled {
    --b: var(--line);
    --s: var(--line-dark);
    --t: var(--subtle);
    cursor: not-allowed;
}

.btn-blue { --b: var(--blue); --s: var(--blue-dark); }
.btn-red { --b: var(--red); --s: var(--red-dark); }

.btn-outline,
.btn-outline-red {
    --b: var(--bg);
    --s: var(--line);
    --t: var(--blue);
    border: 2px solid var(--line);
    box-shadow: 0 2px 0 var(--s);
}

.btn-outline-red {
    --t: var(--red);
}

.btn-outline:active:not(:disabled),
.btn-outline-red:active:not(:disabled) {
    transform: translateY(2px);
}

.btn-outline:hover:not(:disabled),
.btn-outline-red:hover:not(:disabled) {
    filter: none;
    background: var(--bg-soft);
}

.btn-sm {
    height: var(--h-md);
    padding: 0 var(--sp-4);
    font-size: var(--fs-sm);
    border-radius: var(--r-md);
}

.btn-block {
    width: 100%;
}

.ibtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    min-width: 42px;
    height: var(--h-md);
    padding: 0 var(--sp-2);
    border: 2px solid var(--line);
    border-bottom-width: 4px;
    border-radius: var(--r-md);
    background: var(--bg);
    color: var(--muted);
    font-size: var(--fs-sm);
    font-weight: 900;
}

.ibtn:hover {
    background: var(--bg-soft);
}

.ibtn:active {
    border-bottom-width: 2px;
    transform: translateY(2px);
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    height: var(--h-sm);
    padding: 0 var(--sp-3);
    border-radius: var(--r-md);
    border: 2px solid transparent;
    font-size: var(--fs-sm);
    font-weight: 900;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.chip-blue {
    background: var(--blue-light);
    border-color: var(--blue-line);
    color: var(--blue-dark);
}

.chip-orange {
    background: var(--orange-light);
    color: var(--orange);
}

.sync-dot {
    flex: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--subtle);
}

.sync-dot.ok { background: var(--green); }
.sync-dot.error { background: var(--red); }
.sync-dot.busy {
    background: var(--yellow);
    animation: pulse 0.9s ease-in-out infinite;
}

@keyframes pulse {
    50% { opacity: 0.35; }
}

.field {
    width: 100%;
    height: var(--h-lg);
    padding: 0 var(--sp-3);
    border: 2px solid var(--line);
    border-radius: var(--r-md);
    background: var(--bg-soft);
    font-size: var(--fs-md);
    font-weight: 700;
    outline: none;
}

.field:focus {
    border-color: var(--blue);
    background: var(--bg);
}

/* ---------- Home ---------- */

.screen {
    height: 100vh;
    height: 100dvh;
}

.home {
    overflow-y: auto;
    display: flex;
    justify-content: center;
    padding: var(--sp-3) var(--sp-4);
    padding-top: max(var(--sp-3), env(safe-area-inset-top));
    padding-bottom: max(var(--sp-3), env(safe-area-inset-bottom));
}

.home-inner {
    width: 100%;
    max-width: 400px;
    margin: auto 0;
    display: flex;
    flex-direction: column;
}

.home-col {
    min-width: 0;
}

.home-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-3);
    margin-bottom: var(--sp-4);
}

.mascot {
    width: 56px;
    height: 56px;
    animation: bob 3s ease-in-out infinite;
}

@keyframes bob {
    50% { transform: translateY(-3px) rotate(-3deg); }
}

.home .wordmark {
    font-size: 32px;
    line-height: 1;
}

.tagline {
    margin-top: var(--sp-1);
    color: var(--muted);
    font-size: var(--fs-sm);
}

.home-label {
    margin: var(--sp-2) 0;
    color: var(--muted);
    font-size: var(--fs-xs);
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* Ô chọn trò chơi: dùng ở trang chủ và đầu trang Chơi */
.game-tiles {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--sp-2);
}

.gtile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 0;
    padding: var(--sp-2) var(--sp-1);
    border: 2px solid var(--line);
    border-bottom-width: 4px;
    border-radius: var(--r-md);
    background: var(--bg);
    text-align: center;
}

/* Mỗi trò một màu (phương án A: linh vật) */
.g13 { --g: #58CC02; --gd: #3E8E00; --gl: #E9FFD6; --gs: #A5E86B; }
.g2 { --g: #FF9600; --gd: #8F4C00; --gl: #FFF7EA; --gs: #FFD9A0; }
.g3 { --g: #A560E8; --gd: #7B3FBF; --gl: #F8F0FF; --gs: #E5C4FF; }

.gtile {
    border-color: var(--gs);
    background: var(--gl);
    font-family: inherit;
}

button.gtile:active:not(:disabled) {
    border-bottom-width: 2px;
    transform: translateY(2px);
}

.gtile.soon {
    border-bottom-width: 4px;
    cursor: default;
}

.gtile-art {
    width: 76px;
    height: 76px;
}

.gtile b {
    font-size: var(--fs-md);
    font-weight: 900;
    white-space: nowrap;
}

.gtile small {
    min-height: 1.4em;
    color: var(--gd);
    font-size: var(--fs-2xs);
    font-weight: 800;
    white-space: nowrap;
}

#createCardsBtn small,
#createTwoBtn small {
    padding: 0 var(--sp-3);
    border-radius: var(--r-pill);
    background: var(--gd);
    color: var(--white);
}

.home-lobby {
    margin-top: var(--sp-3);
    margin-bottom: 0;
    height: var(--h-md);
}

.divider {
    position: relative;
    width: 100%;
    margin: var(--sp-3) 0;
    color: var(--subtle);
    font-size: var(--fs-xs);
    font-weight: 800;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.divider::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    border-top: 2px solid var(--line);
}

.divider span {
    position: relative;
    padding: 0 var(--sp-3);
    background: var(--bg);
}

.code-field {
    position: relative;
    display: block;
    width: 100%;
    cursor: text;
}

.code-field input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    border: 0;
    font-size: var(--fs-md);
}

.code-cells,
.code-display {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-gap: 8px;
}

.code-cells span,
.code-display span {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 64px;
    border: 2px solid var(--line);
    border-bottom-width: 4px;
    border-radius: var(--r-md);
    background: var(--bg-soft);
    font-size: var(--fs-2xl);
    font-weight: 900;
    color: var(--text);
}

.code-cells span.filled {
    background: var(--bg);
}

.code-field.focused .code-cells span.active {
    border-color: var(--blue);
    background: var(--blue-light);
}

.home .code-cells span {
    height: 48px;
    font-size: var(--fs-xl);
}

.home-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-gap: var(--sp-2);
    width: 100%;
    margin-top: var(--sp-3);
}

.home-actions .btn {
    height: var(--h-md);
    padding: 0 var(--sp-2);
    margin-bottom: 0;
}

.recent {
    width: 100%;
    margin-top: var(--sp-2);
}

/* Tối đa 6 phòng (RECENT_MAX) → luôn gói trong 2 hàng */
.recent-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--sp-2);
}

.recent-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 0;
    padding: var(--sp-1);
    border: 2px solid var(--line);
    border-bottom-width: 4px;
    border-radius: var(--r-sm);
    background: var(--bg);
    line-height: 1.25;
}

.recent-item:active {
    border-bottom-width: 2px;
    transform: translateY(2px);
}

.recent-item b {
    font-size: var(--fs-md);
    font-weight: 900;
    letter-spacing: 0.06em;
}

.recent-item small {
    color: var(--subtle);
    font-size: var(--fs-2xs);
    white-space: nowrap;
}

.recent-item small i {
    margin-right: 3px;
}

/* Màn hình thấp (điện thoại nhỏ, trình duyệt còn thanh địa chỉ): thu gọn để vẫn gói trong một màn hình */
@media (max-height: 640px) {
    .home { padding-top: var(--sp-2); padding-bottom: var(--sp-2); }
    .home-brand { margin-bottom: var(--sp-2); }
    .mascot { width: 40px; height: 40px; }
    .home .wordmark { font-size: var(--fs-2xl); }
    .tagline { display: none; }
    .home .btn { height: 38px; }
    .home-label { margin: var(--sp-1) 0; }
    .gtile { flex-direction: row; justify-content: center; column-gap: 2px; padding: var(--sp-1) 2px; }
    .home .gtile-art { width: 40px; height: 40px; }
    .home .gtile b { font-size: var(--fs-sm); }
    .home .gtile small { display: none; }
    .home-lobby { margin-top: var(--sp-2); }
    .divider { margin: var(--sp-2) 0; }
    .home .code-cells span { height: 40px; }
    .home-actions { margin-top: var(--sp-2); }
    .recent { margin-top: var(--sp-1); }
}

/* Điện thoại nằm ngang: chia hai cột */
@media (max-height: 560px) and (min-width: 640px) {
    .home-inner { max-width: 760px; flex-direction: row; align-items: center; gap: var(--sp-5); }
    .home-col { flex: 1; }
}

/* ---------- Room layout ---------- */

.room {
    display: flex;
}

.sidebar {
    display: none;
}

.room-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    flex: none;
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-2) var(--sp-3);
    padding-top: max(var(--sp-2), env(safe-area-inset-top));
    border-bottom: 2px solid var(--line);
}

.topbar-actions {
    margin-left: auto;
    display: flex;
    gap: var(--sp-2);
}

.views {
    flex: 1;
    min-height: 0;
    position: relative;
}

.view {
    height: 100%;
    overflow-y: auto;
    padding: var(--sp-3);
}

.view-text {
    max-width: 720px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: var(--sp-4);
    padding-bottom: 32px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-2) var(--sp-3);
    border: 2px solid transparent;
    border-radius: var(--r-md);
    background: none;
    color: var(--muted);
    font-size: var(--fs-sm);
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.nav-item i {
    width: 28px;
    font-size: var(--fs-xl);
    text-align: center;
}

.nav-item:hover {
    background: var(--bg-soft);
}

@media (hover: none) {
    .nav-item:hover:not(.active),
    .ibtn:hover,
    .btn-outline:hover:not(:disabled),
    .btn-outline-red:hover:not(:disabled) {
        background: var(--bg);
    }
}

.nav-item.active {
    background: var(--blue-light);
    border-color: var(--blue-line);
    color: var(--blue);
}

.bottom-nav {
    flex: none;
    display: flex;
    justify-content: space-around;
    padding: var(--sp-2) var(--sp-2);
    padding-bottom: max(var(--sp-2), env(safe-area-inset-bottom));
    border-top: 2px solid var(--line);
    background: var(--bg);
}

.bottom-nav .nav-item {
    flex: 1;
    max-width: 96px;
    flex-direction: column;
    gap: 2px;
    padding: var(--sp-2) var(--sp-1);
    font-size: var(--fs-2xs);
    letter-spacing: 0;
}

.bottom-nav .nav-item i {
    font-size: var(--fs-lg);
}

@media (min-width: 1024px) {
    .sidebar {
        flex: none;
        display: flex;
        flex-direction: column;
        gap: var(--sp-5);
        width: 248px;
        padding: var(--sp-5) var(--sp-4);
        border-right: 2px solid var(--line);
    }

    .sidebar-brand {
        display: flex;
        align-items: center;
        gap: var(--sp-2);
        padding: 0 var(--sp-3);
    }

    .sidebar-brand .wordmark {
        font-size: var(--fs-2xl);
    }

    .side-nav {
        display: flex;
        flex-direction: column;
        gap: var(--sp-2);
    }

    .bottom-nav {
        display: none;
    }

    .topbar {
        padding: var(--sp-3) var(--sp-5);
    }

    .view {
        padding: var(--sp-4) var(--sp-5);
    }
}

/* ---------- Play board ---------- */

.view-play {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
    overflow: hidden;
}

.board {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
}

.board-row {
    flex: 1;
    min-height: 0;
    display: flex;
    gap: var(--sp-2);
}

.pcard {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
    padding: var(--sp-2);
    border: 2px solid var(--line);
    border-bottom-width: 4px;
    border-radius: var(--r-lg);
    background: var(--bg);
    transition: border-color 0.15s;
}

.pcard:focus-within {
    border-color: var(--pc);
}

.pcard-head {
    flex: none;
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    min-width: 0;
}

.avatar {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--pc);
    box-shadow: inset 0 -3px 0 var(--pcd);
    color: var(--white);
    font-size: var(--fs-sm);
    font-weight: 900;
    text-transform: uppercase;
}

.pcard-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: var(--fs-lg);
    font-weight: 900;
}

.total {
    flex: none;
    padding: 2px var(--sp-2);
    border-radius: var(--r-sm);
    font-size: var(--fs-md);
    font-weight: 900;
    font-variant-numeric: tabular-nums;
}

.tone-pos { color: var(--green-dark); }
.tone-neg { color: var(--red); }
.tone-zero { color: var(--subtle); }

.total.tone-pos { background: var(--green-light); }
.total.tone-neg { background: var(--red-light); }
.total.tone-zero { background: var(--bg-soft); }

.score-wrap {
    flex: 1;
    min-height: 0;
    position: relative;
    display: flex;
}

.score-input {
    width: 100%;
    height: 100%;
    min-height: 0;
    padding: 0 var(--sp-2);
    border: 2px solid var(--line);
    border-radius: var(--r-md);
    background: var(--bg-soft);
    color: var(--text);
    font-size: clamp(2.25rem, 7vh, 5.5rem);
    font-weight: 900;
    line-height: 1;
    text-align: center;
    font-variant-numeric: tabular-nums;
    outline: none;
    -moz-appearance: textfield;
    appearance: textfield;
    transition: border-color 0.15s, background 0.15s;
}

.score-input::-webkit-outer-spin-button,
.score-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.score-input:focus {
    border-color: var(--pc);
    background: var(--bg);
}

.score-input.tone-pos { color: var(--green-dark); }
.score-input.tone-neg { color: var(--red); }

.sign-btn {
    position: absolute;
    top: 6px;
    left: 6px;
    width: 30px;
    height: 30px;
    border: 2px solid var(--line);
    border-bottom-width: 3px;
    border-radius: var(--r-sm);
    background: var(--bg);
    color: var(--muted);
    font-size: var(--fs-sm);
    font-weight: 900;
    line-height: 1;
}

.sign-btn:active {
    border-bottom-width: 2px;
    transform: translateY(1px);
}

.quick {
    flex: none;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-gap: 6px;
    height: clamp(68px, 13vh, 108px);
}

.qbtn {
    min-width: 0;
    padding: 0;
    border: 2px solid;
    border-bottom-width: 4px;
    border-radius: var(--r-md);
    font-size: clamp(15px, 2.3vh, 21px);
    font-weight: 900;
    font-variant-numeric: tabular-nums;
}

.qbtn:active {
    border-bottom-width: 2px;
    transform: translateY(2px);
}

.qbtn.minus {
    background: var(--red-light);
    border-color: var(--red-line);
    color: var(--red-dark);
}

.qbtn.plus {
    background: var(--green-light);
    border-color: #A5ED6E;
    color: var(--green-dark);
}

.board[data-size="md"] .score-input { font-size: clamp(2rem, 6vh, 4.5rem); }

.board[data-size="sm"] .score-input { font-size: clamp(1.5rem, 4.5vh, 3.5rem); }
.board[data-size="sm"] .quick { height: clamp(54px, 9vh, 84px); grid-gap: 4px; }
.board[data-size="sm"] .pcard { padding: 8px; gap: 6px; }

@media (max-width: 767px) {
    .board[data-size="md"] .avatar,
    .board[data-size="sm"] .avatar,
    .board[data-size="sm"] .sign-btn {
        display: none;
    }

    /* Thẻ hẹp: tên một dòng, tổng điểm xuống dòng dưới */
    .board[data-size="sm"] .pcard-head {
        flex-wrap: wrap;
        gap: 2px var(--sp-2);
    }

    .board[data-size="sm"] .pcard-name { flex-basis: 100%; font-size: 14px; }
    .board[data-size="sm"] .total { padding: 1px 6px; font-size: 13px; }
    .board[data-size="sm"] .qbtn { font-size: 14px; border-radius: 10px; }
    .board, .board-row { gap: 8px; }
    .pcard { padding: 8px; border-radius: 18px; }
}

.checkbar {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-3) var(--sp-2);
    border-radius: var(--r-lg);
    background: var(--bg-soft);
    transition: background 0.2s;
}

.check-status {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    min-width: 0;
}

.check-icon {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin-bottom: var(--sp-1);
    border-radius: 50%;
    background: var(--bg);
    color: var(--subtle);
    font-size: var(--fs-lg);
}

.check-title {
    font-size: var(--fs-lg);
    font-weight: 900;
    color: var(--muted);
}

.check-sub {
    color: var(--muted);
    font-size: var(--fs-sm);
    font-weight: 700;
}

.checkbar.good { background: var(--green-light); }
.checkbar.good .check-icon,
.checkbar.good .check-title,
.checkbar.good .check-sub { color: var(--green-dark); }

.checkbar.bad { background: var(--red-light); }
.checkbar.bad .check-icon,
.checkbar.bad .check-title,
.checkbar.bad .check-sub { color: var(--red-dark); }

@media (max-width: 480px) {
    .check-sub { display: none; }
    .check-icon { width: 36px; height: 36px; font-size: 16px; }
    .check-title { font-size: 17px; }
    .checkbar .btn { padding: 0 18px; }
    .topbar { gap: 6px; padding-left: 10px; padding-right: 10px; }
    .topbar .chip { padding: 0 9px; font-size: 14px; }
    .topbar-actions { gap: 4px; }
    .ibtn { min-width: 38px; height: 38px; padding: 0 8px; font-size: 14px; }
    .topbar .fs-btn { display: none; }
}

@media (max-width: 360px) {
    #tvBtn { display: none; }
}

/* ---------- Panels: rank, history, room ---------- */

.panel {
    padding: var(--sp-4);
    border: 2px solid var(--line);
    border-radius: var(--r-lg);
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-3);
}

.panel-head .btn {
    margin-bottom: 2px;
}

.panel-title {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    font-size: var(--fs-xl);
    font-weight: 900;
}

.panel > .panel-title,
.panel > .panel-head {
    margin-bottom: var(--sp-3);
}

.panel-sub {
    margin: -6px 0 var(--sp-3);
    color: var(--muted);
    font-size: var(--fs-sm);
    line-height: 1.45;
}

.count-pill {
    padding: 2px var(--sp-2);
    border-radius: var(--r-sm);
    background: var(--blue-light);
    color: var(--blue-dark);
    font-size: var(--fs-sm);
}

.empty {
    padding: var(--sp-5) var(--sp-3);
    color: var(--subtle);
    text-align: center;
    font-size: var(--fs-sm);
}

.empty i {
    display: block;
    margin-bottom: var(--sp-2);
    font-size: 32px;
}

.leaderboard {
    display: flex;
    flex-direction: column;
}

.lb-row {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-2) var(--sp-2);
    border-radius: var(--r-md);
}

.lb-row + .lb-row {
    border-top: 2px solid var(--bg-soft);
}

.lb-rank {
    flex: none;
    width: 32px;
    color: var(--muted);
    font-size: var(--fs-lg);
    font-weight: 900;
    text-align: center;
}

.lb-rank.medal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    border-radius: 50%;
    color: var(--white);
    font-size: var(--fs-sm);
}

.medal-1 { background: var(--yellow); box-shadow: inset 0 -3px 0 var(--yellow-dark); }
.medal-2 { background: #C3CDD6; box-shadow: inset 0 -3px 0 #9DA9B4; }
.medal-3 { background: #E9A26B; box-shadow: inset 0 -3px 0 #C77F49; }

.lb-row .avatar {
    width: 40px;
    height: 40px;
    font-size: var(--fs-lg);
}

.lb-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: var(--fs-lg);
}

.lb-score {
    font-size: var(--fs-lg);
    font-weight: 900;
    font-variant-numeric: tabular-nums;
}

.even-out {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
}

.even-row {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-2) var(--sp-3);
    border: 2px solid var(--line);
    border-radius: var(--r-md);
}

.even-row .avatar {
    width: 32px;
    height: 32px;
}

.even-names {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--sp-1) var(--sp-2);
    font-size: var(--fs-sm);
}

.even-names i {
    color: var(--subtle);
}

.even-amount {
    padding: var(--sp-1) var(--sp-3);
    border-radius: var(--r-sm);
    background: var(--yellow-light);
    color: var(--gold-deep);
    font-weight: 900;
    font-variant-numeric: tabular-nums;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
}

.hist {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-3);
    padding: var(--sp-3);
    border: 2px solid var(--line);
    border-radius: var(--r-md);
}

.hist-badge {
    flex: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 58px;
    padding: var(--sp-2) var(--sp-2);
    border-radius: var(--r-md);
    background: var(--blue-light);
    color: var(--blue-dark);
    font-size: var(--fs-lg);
    font-weight: 900;
    line-height: 1.1;
}

.hist-badge small {
    color: var(--blue);
    font-size: var(--fs-xs);
    font-weight: 800;
}

.hist-scores {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-2);
}

.score-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-1) var(--sp-2) var(--sp-1) var(--sp-1);
    border-radius: 999px;
    background: var(--bg-soft);
    font-size: var(--fs-sm);
}

.score-chip .avatar {
    width: 22px;
    height: 22px;
    font-size: var(--fs-xs);
    box-shadow: none;
}

.score-chip b {
    font-weight: 900;
    font-variant-numeric: tabular-nums;
}

.hist-del {
    flex: none;
    width: 36px;
    height: var(--h-sm);
    border: 2px solid var(--line);
    border-bottom-width: 3px;
    border-radius: var(--r-sm);
    background: var(--bg);
    color: var(--subtle);
}

.hist-del:hover {
    color: var(--red);
    border-color: var(--red-line);
}

.share-panel {
    text-align: center;
}

.share-panel .panel-title {
    justify-content: center;
}

.code-display {
    max-width: 420px;
    margin: 0 auto var(--sp-4);
}

.code-display span {
    height: 72px;
    background: var(--blue-light);
    border-color: var(--blue-line);
    color: var(--blue-dark);
    font-size: 36px;
}

.share-panel .panel-sub {
    margin: 0 auto var(--sp-4);
    max-width: 440px;
}

.qr-box {
    display: inline-block;
    padding: var(--sp-3);
    margin-bottom: var(--sp-4);
    border: 2px solid var(--line);
    border-radius: var(--r-md);
    line-height: 0;
}

.qr-box:empty {
    display: none;
}

.qr-box img,
.qr-box canvas {
    width: 160px;
    height: 160px;
}

.share-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-gap: 12px;
}

.share-actions .btn {
    padding: 0 var(--sp-2);
}

.player-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-2);
}

.player-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-1) var(--sp-3) var(--sp-1) var(--sp-1);
    border: 2px solid var(--line);
    border-radius: 999px;
    font-size: var(--fs-sm);
}

.stack {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
}

/* ---------- Modals, toast, loading ---------- */

.modal-backdrop {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 50;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background: rgba(0, 0, 0, 0.45);
    animation: fade 0.15s ease-out;
}

.modal {
    width: 100%;
    max-width: 460px;
    max-height: 90vh;
    overflow-y: auto;
    padding: var(--sp-5) var(--sp-4) calc(var(--sp-4) + env(safe-area-inset-bottom));
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    background: var(--bg);
    animation: rise 0.2s ease-out;
}

.modal h3 {
    font-size: var(--fs-xl);
    font-weight: 900;
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-close {
    width: 40px;
    height: var(--h-md);
    border: 0;
    border-radius: var(--r-md);
    background: none;
    color: var(--subtle);
    font-size: var(--fs-xl);
}

.modal-sub {
    margin: var(--sp-2) 0 var(--sp-4);
    color: var(--muted);
    font-size: var(--fs-sm);
    line-height: 1.45;
}

.modal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-gap: 12px;
    margin-top: var(--sp-4);
}

.draft-list {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
}

.draft-row {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
}

.draft-row .field {
    height: var(--h-md);
}

.draft-del {
    flex: none;
    width: 46px;
    height: var(--h-md);
    border: 2px solid var(--line);
    border-bottom-width: 4px;
    border-radius: var(--r-md);
    background: var(--bg);
    color: var(--subtle);
    font-size: var(--fs-md);
}

.draft-del:hover {
    color: var(--red);
}

.draft-add {
    display: flex;
    gap: var(--sp-2);
    margin-top: var(--sp-3);
}

.draft-add .btn {
    height: var(--h-lg);
}

@media (min-width: 640px) {
    .modal-backdrop {
        align-items: center;
        padding: var(--sp-4);
    }

    .modal {
        padding-bottom: var(--sp-5);
        border-radius: var(--r-lg);
    }
}

.modal-sm {
    max-width: 400px;
}

@keyframes fade {
    from { opacity: 0; }
}

@keyframes rise {
    from { transform: translateY(24px); opacity: 0; }
}

.toast {
    position: fixed;
    left: 50%;
    top: max(16px, env(safe-area-inset-top));
    z-index: 60;
    max-width: calc(100vw - 32px);
    padding: var(--sp-3) var(--sp-4);
    border-radius: var(--r-md);
    background: var(--text);
    color: var(--white);
    font-size: var(--fs-sm);
    font-weight: 800;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -12px);
    transition: opacity 0.2s, transform 0.2s;
}

.toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

.toast.success { background: var(--green); box-shadow: 0 4px 0 var(--green-dark); }
.toast.error { background: var(--red); box-shadow: 0 4px 0 var(--red-dark); }

.loading {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 40;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--sp-4);
    background: rgba(255, 255, 255, 0.92);
    color: var(--muted);
    font-size: var(--fs-lg);
}

.spinner {
    width: 48px;
    height: 48px;
    border: 6px solid var(--line);
    border-top-color: var(--green);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---------- TV ---------- */

.tv {
    display: flex;
    flex-direction: column;
    background: var(--bg-soft);
}

.tv-head {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2vmin;
    padding: 2vmin 3vmin;
    background: var(--green);
    box-shadow: 0 0.6vmin 0 var(--green-dark);
    color: #FFFFFF;
}

.tv-brand {
    display: flex;
    align-items: center;
    gap: 1.5vmin;
}

.tv-brand img {
    width: 6vmin;
    height: 6vmin;
}

.tv-brand .wordmark {
    color: #FFFFFF;
    font-size: 4.5vmin;
}

.tv-meta {
    display: flex;
    align-items: center;
    gap: 1.5vmin;
}

.tv-pill {
    padding: 0.8vmin 2vmin;
    border-radius: 2vmin;
    background: rgba(255, 255, 255, 0.2);
    font-size: 3vmin;
    font-weight: 800;
}

.tv-pill b {
    font-weight: 900;
    letter-spacing: 0.1em;
}

.tv-meta .sync-dot {
    width: 2vmin;
    height: 2vmin;
    border: 0.4vmin solid #FFFFFF;
}

.tv-meta .sync-dot.ok { background: var(--green-light); }

.tv-actions {
    display: flex;
    gap: 1vmin;
}

.tv-ibtn {
    width: 6vmin;
    height: 6vmin;
    min-width: 40px;
    min-height: 40px;
    border: 0;
    border-radius: 1.6vmin;
    background: rgba(255, 255, 255, 0.2);
    color: #FFFFFF;
    font-size: 2.6vmin;
}

.tv-ibtn:hover,
.tv-ibtn:focus {
    background: rgba(255, 255, 255, 0.35);
    outline: none;
}

.tv-grid {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: repeat(var(--cols, 4), 1fr);
    grid-auto-rows: 1fr;
    grid-gap: 2.4vmin;
    padding: 3.4vmin 3vmin 2vmin;
}

/* Kích thước bên trong thẻ do JS tính theo kích thước thật của thẻ (fitTv) */
.tv-card {
    position: relative;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--gap, 1vmin);
    padding: var(--pad, 2vmin);
    padding-top: calc(var(--pad, 2vmin) + var(--rank, 5vmin) * 1.15);
    border: 0.4vmin solid var(--line);
    border-bottom-width: 1vmin;
    border-radius: 3vmin;
    background: var(--bg);
    transition: transform 0.3s;
}

.tv-card.lead {
    border-color: var(--yellow);
    background: var(--yellow-light);
}

.tv-card.bump {
    animation: bump 0.6s ease-out;
}

@keyframes bump {
    30% { transform: scale(1.04); }
}

.tv-rank {
    position: absolute;
    top: var(--pad, 1.6vmin);
    left: var(--pad, 1.6vmin);
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--rank, 5vmin);
    height: var(--rank, 5vmin);
    border-radius: 50%;
    background: var(--bg-soft);
    color: var(--muted);
    font-size: calc(var(--rank, 5vmin) * 0.5);
    font-weight: 900;
}

.tv-rank.medal-1 { background: var(--yellow); box-shadow: inset 0 -0.5vmin 0 var(--yellow-dark); }
.tv-rank.medal-2 { background: #C3CDD6; box-shadow: inset 0 -0.5vmin 0 #9DA9B4; }
.tv-rank.medal-3 { background: #E9A26B; box-shadow: inset 0 -0.5vmin 0 #C77F49; }

.tv-rank.medal-1,
.tv-rank.medal-2,
.tv-rank.medal-3 {
    color: #FFFFFF;
}

.tv-crown {
    position: absolute;
    top: var(--pad, 1.6vmin);
    right: var(--pad, 1.6vmin);
    color: var(--yellow);
    font-size: calc(var(--rank, 5vmin) * 0.85);
}

.tv-avatar {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--avatar, 12vmin);
    height: var(--avatar, 12vmin);
    border-radius: 50%;
    background: var(--pc);
    box-shadow: inset 0 calc(var(--avatar, 12vmin) * -0.06) 0 var(--pcd);
    color: #FFFFFF;
    font-size: calc(var(--avatar, 12vmin) * 0.48);
    font-weight: 900;
    text-transform: uppercase;
}

.tv-name {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: var(--name-fs, 4vmin);
    font-weight: 900;
    line-height: 1.25;
}

.tv-score {
    max-width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--gap, 1vmin);
}

.tv-total {
    max-width: 100%;
    overflow: hidden;
    white-space: nowrap;
    font-size: var(--total-fs, 10vmin);
    font-weight: 900;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.tv-total.tone-zero {
    color: var(--muted);
}

.tv-last {
    max-width: 100%;
    overflow: hidden;
    white-space: nowrap;
    padding: 0.25em 0.6em;
    border-radius: 0.5em;
    background: var(--bg-soft);
    font-size: var(--last-fs, 2.6vmin);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.tv-last.tone-pos { background: var(--green-light); }
.tv-last.tone-neg { background: var(--red-light); }

/* Thẻ dẹt (nhiều người trên màn hình dọc): xếp thành hàng ngang */
.tv-grid.wide .tv-card {
    flex-direction: row;
    justify-content: flex-start;
    padding-top: var(--pad, 2vmin);
}

.tv-grid.wide .tv-rank {
    position: static;
}

.tv-grid.wide .tv-crown {
    display: none;
}

.tv-grid.wide .tv-name {
    flex: 1;
    min-width: 0;
}

.tv-grid.wide .tv-score {
    flex: none;
    align-items: flex-end;
    gap: calc(var(--gap, 1vmin) * 0.5);
}

.tv-empty {
    grid-column: 1 / -1;
    align-self: center;
    color: var(--subtle);
    font-size: 4vmin;
    text-align: center;
}

.tv-foot {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2.4vmin;
    padding: 0 3vmin 2.4vmin;
    color: var(--muted);
    font-size: 2.8vmin;
}

.tv-foot b {
    color: var(--text);
    font-weight: 900;
}

.tv-qr {
    padding: 0.8vmin;
    border-radius: 1.2vmin;
    background: #FFFFFF;
    line-height: 0;
}

.tv-qr:empty {
    display: none;
}

.tv-qr img,
.tv-qr canvas {
    width: 9vmin;
    height: 9vmin;
}

@media (max-width: 640px) and (orientation: portrait) {
    .tv-brand .wordmark,
    .tv-foot .tv-qr {
        display: none;
    }
}

/* ---------- Milestone effects ---------- */

.fx {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 70;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    cursor: pointer;
    animation: fade 0.2s ease-out;
}

.fx-party {
    background: radial-gradient(circle at 50% 40%, rgba(20, 40, 80, 0.75), rgba(5, 10, 25, 0.9));
}

.fx-fire {
    background: linear-gradient(to top, rgba(140, 10, 0, 0.92), rgba(40, 0, 0, 0.88) 60%, rgba(10, 0, 0, 0.85));
}

.fx-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.fx-card {
    position: relative;
    width: 100%;
    max-width: 440px;
    padding: 24px 22px 18px;
    border: 2px solid var(--line);
    border-bottom-width: 6px;
    border-radius: 28px;
    background: var(--bg);
    text-align: center;
    animation: pop 0.45s cubic-bezier(0.2, 1.6, 0.4, 1);
}

.fx-fire .fx-card {
    border-color: #7A1A0E;
    background: #2A0B07;
    color: #FFE3D6;
    animation: pop 0.45s cubic-bezier(0.2, 1.6, 0.4, 1), shake 0.5s 0.45s ease-in-out 3;
}

@keyframes pop {
    from { transform: scale(0.4); opacity: 0; }
}

@keyframes shake {
    25% { transform: translateX(-6px) rotate(-1deg); }
    75% { transform: translateX(6px) rotate(1deg); }
}

.fx-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 76px;
    height: 76px;
    margin-top: -64px;
    margin-bottom: 8px;
    border-radius: 50%;
    background: var(--yellow);
    box-shadow: inset 0 -5px 0 var(--yellow-dark), 0 0 0 6px var(--bg);
    color: #FFFFFF;
    font-size: 36px;
}

.fx-fire .fx-icon {
    background: var(--red);
    box-shadow: inset 0 -5px 0 #B3160E, 0 0 0 6px #2A0B07, 0 0 40px rgba(255, 90, 0, 0.8);
}

.fx-title {
    font-size: 30px;
    font-weight: 900;
    line-height: 1.15;
    color: var(--green);
}

.fx-fire .fx-title {
    color: #FF7A3D;
    text-shadow: 0 0 18px rgba(255, 80, 0, 0.7);
}

.fx-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 18px 0 16px;
}

.fx-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 16px;
    background: var(--bg-soft);
    text-align: left;
}

.fx-fire .fx-row {
    background: rgba(255, 255, 255, 0.06);
}

.fx-row .avatar {
    width: 44px;
    height: 44px;
    font-size: 19px;
}

.fx-row-text {
    flex: 1;
    min-width: 0;
    font-size: 15px;
    line-height: 1.3;
}

.fx-row-text b {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 19px;
    font-weight: 900;
}

.fx-mark {
    flex: none;
    font-size: 30px;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
}

.fx-party .fx-mark { color: var(--green-dark); }
.fx-fire .fx-mark { color: #FF5A2A; }

.fx-bar {
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--line);
}

.fx-fire .fx-bar {
    background: rgba(255, 255, 255, 0.12);
}

.fx-bar span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--green);
    transform-origin: left center;
    animation: drain var(--fx-ms, 5000ms) linear forwards;
}

.fx-fire .fx-bar span {
    background: #FF5A2A;
}

@keyframes drain {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}


/* ---------- Quyền xem / ghi điểm ---------- */

.room .view-only {
    display: none !important;
}

.room.readonly .edit-only {
    display: none !important;
}

.room.readonly .view-only {
    display: inline-flex !important;
}

.room.readonly .panel.view-only {
    display: block !important;
}

.chip-view {
    background: var(--bg-soft);
    border-color: var(--line);
    color: var(--muted);
}

.panel-warn {
    border-color: var(--yellow);
    background: var(--yellow-light);
}

.panel-warn .panel-title i {
    color: var(--gold-deep);
}

.panel-title i {
    font-size: 0.85em;
}

.edit-qr {
    margin-top: var(--sp-4);
    text-align: center;
}

#rotateKeyBtn {
    margin-top: var(--sp-3);
}

.recent-item small i {
    margin-right: var(--sp-1);
}

/* ---------- Tên người chơi tự co chữ / chạy ngang ---------- */

.pcard-name {
    display: block;
    overflow: hidden;
    text-overflow: clip;
}

.name-text {
    display: inline-block;
    white-space: nowrap;
}

.pcard-name.marquee .name-text {
    animation: name-slide var(--dur, 4s) ease-in-out infinite alternate;
}

@keyframes name-slide {
    0%, 15% { transform: translateX(0); }
    85%, 100% { transform: translateX(var(--shift, 0)); }
}

@media (prefers-reduced-motion: reduce) {
    .pcard-name.marquee .name-text {
        animation: none;
    }

    .pcard-name.marquee {
        text-overflow: ellipsis;
    }
}

/* Điện thoại có 3 hàng thẻ: thu gọn nút nhanh và ô số */
@media (max-width: 767px) {
    .board[data-rows="3"] .quick,
    .board[data-rows="4"] .quick {
        height: clamp(52px, 8.5vh, 76px);
        grid-gap: 4px;
    }

    .board[data-rows="3"] .score-input {
        font-size: clamp(1.75rem, 5vh, 3.25rem);
    }

    .board[data-rows="3"] .pcard {
        padding: var(--sp-2);
        gap: var(--sp-2);
    }
}

/* ---------- Chọn mức cộng trừ ---------- */

.segmented {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-gap: 10px;
}

.step-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-gap: var(--sp-3);
    margin-top: var(--sp-3);
    align-items: end;
}

.step-form label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: var(--fs-sm);
    font-weight: 800;
    color: var(--muted);
}

.step-form input,
.step-form .step-big {
    height: 44px;
    padding: 0 var(--sp-3);
    border: 2px solid var(--line);
    border-radius: var(--r-md);
    background: var(--bg);
    color: var(--text);
    font: inherit;
    font-size: var(--fs-md); /* dưới 16px thì iOS tự phóng to trang khi bấm vào ô nhập */
    font-weight: 900;
    display: flex;
    align-items: center;
}

.step-form .step-big { color: var(--muted); }
.step-form .step-big b { color: var(--text); margin-left: 4px; }
.step-form button { grid-column: 1 / -1; }
.step-hint { margin: var(--sp-2) 0 0; }

.segmented button {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: var(--sp-3) var(--sp-2);
    border: 2px solid var(--line);
    border-bottom-width: 4px;
    border-radius: var(--r-md);
    background: var(--bg);
    color: var(--text);
}

.segmented button b {
    font-size: var(--fs-lg);
    font-weight: 900;
}

.segmented button small {
    color: var(--muted);
    font-size: var(--fs-sm);
    font-weight: 800;
}

.segmented button.active {
    border-color: var(--blue-line);
    background: var(--blue-light);
    color: var(--blue-dark);
}

.segmented button.active small {
    color: var(--blue);
}

.segmented button:active {
    border-bottom-width: 2px;
    transform: translateY(2px);
}

.step-note {
    margin: var(--sp-3) 0 0;
}

/* ---------- Danh sách cho điện thoại (từ 5 người) ---------- */

.sign-inline {
    display: none;
}

.board[data-mode="list"] {
    overflow-y: auto;
    gap: var(--sp-2);
    -webkit-overflow-scrolling: touch;
}

.board[data-mode="list"] .board-row {
    flex: none;
    gap: 0;
}

.board[data-mode="list"] .pcard {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 40px 40px minmax(56px, 72px) 40px 40px;
    align-items: center;
    column-gap: var(--sp-1);
    padding: var(--sp-2) var(--sp-2) var(--sp-2) var(--sp-2);
    border-radius: var(--r-md);
}

.board[data-mode="list"] .pcard-head {
    grid-column: 1;
    grid-row: 1;
    flex-wrap: wrap;
    gap: var(--sp-1) var(--sp-2);
    padding-right: var(--sp-1);
}

.board[data-mode="list"] .pcard-head .avatar {
    display: none;
}

.board[data-mode="list"] .pcard-name {
    flex: 1 1 100%;
    font-size: var(--fs-sm);
    line-height: 1.2;
}

.board[data-mode="list"] .total {
    padding: 1px var(--sp-2);
    font-size: var(--fs-sm);
}

.board[data-mode="list"] .sign-inline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: static;
    width: 26px;
    height: 22px;
    border-bottom-width: 2px;
    border-radius: var(--r-sm);
    font-size: var(--fs-sm);
}

.board[data-mode="list"] .score-wrap,
.board[data-mode="list"] .quick {
    display: contents;
}

.board[data-mode="list"] .score-wrap .sign-btn {
    display: none;
}

.board[data-mode="list"] .score-input {
    grid-column: 4;
    grid-row: 1;
    height: var(--h-md);
    padding: 0 var(--sp-1);
    border-radius: var(--r-md);
    font-size: var(--fs-xl);
}

.board[data-mode="list"] .qbtn {
    grid-row: 1;
    height: var(--h-md);
    border-radius: var(--r-md);
    font-size: var(--fs-sm);
}

.board[data-mode="list"] .qbtn.minus.big { grid-column: 2; }
.board[data-mode="list"] .qbtn.minus.small { grid-column: 3; }
.board[data-mode="list"] .qbtn.plus.small { grid-column: 5; }
.board[data-mode="list"] .qbtn.plus.big { grid-column: 6; }

@media (max-width: 360px) {
    .board[data-mode="list"] .pcard {
        grid-template-columns: minmax(0, 1fr) 34px 34px minmax(50px, 64px) 34px 34px;
        column-gap: var(--sp-1);
    }

    .board[data-mode="list"] .qbtn {
        font-size: var(--fs-sm);
    }
}

/* Chừa chỗ hai bên cho nút ± để số không bị che (giữ cân giữa) */
.board[data-mode="grid"] .score-input {
    padding: 0 38px;
}

@media (max-width: 767px) {
    .board[data-mode="grid"][data-size="sm"] .score-input {
        padding: 0 var(--sp-1);
    }
}

/* ---------- Sắp xếp người chơi ---------- */

.draft-move {
    flex: none;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.draft-move button {
    width: 30px;
    height: 21px;
    padding: 0;
    border: 2px solid var(--line);
    border-radius: var(--r-sm);
    background: var(--bg);
    color: var(--muted);
    font-size: var(--fs-xs);
    line-height: 1;
}

.draft-move button:disabled {
    opacity: 0.35;
    cursor: default;
}

.draft-move button:not(:disabled):active {
    background: var(--blue-light);
    border-color: var(--blue-line);
    color: var(--blue-dark);
}

.modal-sub .fa-solid {
    font-size: 0.8em;
    margin: 0 1px;
}

/* ---------- Kỷ lục trên TV ---------- */

.tv-records {
    position: absolute;
    top: var(--pad, 1.6vmin);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: calc(var(--rank, 5vmin) * 0.15);
    max-width: calc(100% - var(--rank, 5vmin) * 2.4 - var(--pad, 1.6vmin) * 2);
    white-space: nowrap;
}

.tv-record {
    display: inline-flex;
    align-items: center;
    gap: 0.3em;
    height: var(--rank, 5vmin);
    padding: 0 0.6em;
    border-radius: 999px;
    font-size: calc(var(--rank, 5vmin) * 0.46);
    font-weight: 900;
    font-variant-numeric: tabular-nums;
}

.tv-record.up {
    background: var(--green);
    box-shadow: inset 0 -0.3vmin 0 var(--green-dark);
    color: #FFFFFF;
}

.tv-record.down {
    background: var(--red);
    box-shadow: inset 0 -0.3vmin 0 var(--red-dark);
    color: #FFFFFF;
}

.tv-grid.wide .tv-records {
    position: static;
    transform: none;
    flex: none;
    max-width: none;
    order: 5;
}

/* ---------- Chế độ 13 lá ---------- */

.view-cards {
    max-width: 720px;
    margin: 0 auto;
    padding-bottom: var(--sp-5);
}

.game-root {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
}

.pick-list,
.seat-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-2);
    margin-bottom: var(--sp-3);
}

.pick-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-1) var(--sp-3) var(--sp-1) var(--sp-1);
    border: 2px solid var(--line);
    border-bottom-width: 4px;
    border-radius: 999px;
    background: var(--bg);
    font-size: var(--fs-sm);
    font-weight: 800;
}

.pick-chip.on {
    border-color: var(--blue-line);
    background: var(--blue-light);
    color: var(--blue-dark);
}

.pick-chip:active,
.seat-btn:not(:disabled):active {
    border-bottom-width: 2px;
    transform: translateY(2px);
}

.seat-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}

.seat-btn {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    column-gap: var(--sp-2);
    align-items: center;
    padding: var(--sp-2);
    border: 2px solid var(--line);
    border-bottom-width: 4px;
    border-radius: var(--r-md);
    background: var(--bg);
    text-align: left;
}

.seat-btn .avatar {
    grid-row: 1 / 3;
    width: 38px;
    height: 38px;
}

.seat-btn > span:not(.avatar) {
    font-size: var(--fs-md);
    font-weight: 900;
}

.seat-btn small {
    color: var(--blue);
    font-size: var(--fs-xs);
    font-weight: 800;
}

.seat-btn:disabled {
    opacity: 0.5;
}

.seat-btn:disabled small {
    color: var(--subtle);
}

.seat-mine {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    font-size: var(--fs-sm);
}

.seat-mine > span:not(.avatar) {
    flex: 1;
    min-width: 0;
}

.seat-mine .avatar {
    flex: none;
    width: 38px;
    height: 38px;
    font-size: var(--fs-md);
}

.seat-note {
    margin: 0;
    font-size: var(--fs-sm);
}

.fold {
    padding: var(--sp-3) var(--sp-4);
}

.fold summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-2);
    list-style: none;
    cursor: pointer;
    font-size: var(--fs-sm);
    font-weight: 900;
}

.fold summary::-webkit-details-marker {
    display: none;
}

.fold summary::after {
    content: '▾';
    color: var(--subtle);
}

.fold[open] summary::after {
    content: '▴';
}

.fold summary small {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    color: var(--muted);
    font-size: var(--fs-xs);
    text-align: right;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fold summary > span {
    flex: none;
    margin-right: auto;
}

.fold-body {
    margin-top: var(--sp-3);
}

.fold-body .narrator-box {
    margin-bottom: 0;
}

.rules ul {
    margin: var(--sp-2) 0 0;
    padding-left: var(--sp-4);
    color: var(--muted);
    font-size: var(--fs-sm);
    line-height: 1.5;
}

/* Lá */
.pcard-c {
    flex: none;
    position: relative;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 72px;
    padding: 0;
    border: 2px solid var(--line);
    border-bottom-width: 4px;
    border-radius: var(--r-sm);
    background: var(--white);
    color: var(--text);
    line-height: 1;
    font-variant-numeric: tabular-nums;
    transition: transform 0.12s;
}

.pcard-c b {
    font-size: var(--fs-lg);
    font-weight: 900;
}

.pcard-c i {
    font-style: normal;
    font-size: var(--fs-lg);
}

.pcard-c.red {
    color: var(--red);
}

/* Lá J, Q, K có hình mặt lá; chỉ số rank/chất nằm trong ô trắng nhỏ ở góc trái */
.pcard-c.has-face {
    overflow: hidden;
}

.pcard-c .face {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: none;
}

.pcard-c .idx {
    position: absolute;
    left: 2px;
    top: 2px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    padding: 2px 3px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.92);
}

.pcard-c.has-face .idx b {
    font-size: 14px;
}

.pcard-c.has-face .idx i {
    font-size: 12px;
}

.trick-cards .pcard-c {
    width: 44px;
    height: 62px;
}

.trick-cards .pcard-c b,
.trick-cards .pcard-c i {
    font-size: var(--fs-lg);
}

/* Đối thủ */
.opps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
    gap: var(--sp-2);
}

.opps.opps-2col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.opp {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    min-width: 0;
    padding: var(--sp-2);
    border: 2px solid var(--line);
    border-radius: var(--r-md);
    background: var(--bg);
}

.opp.turn {
    border-color: var(--blue-line);
    background: var(--blue-light);
}

.opp.done {
    opacity: 0.55;
}

.opp .avatar {
    width: 30px;
    height: 30px;
}

.opp-info {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.opp-info b {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: var(--fs-sm);
    font-weight: 900;
}

.opp-info small {
    color: var(--muted);
    font-size: var(--fs-xs);
    font-weight: 800;
    white-space: nowrap;
}

/* Mặt bàn */
.table-felt {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    gap: var(--sp-2);
    /* Cỡ cố định: tên người đánh + một hàng lá + một dòng tin, không đổi theo số lá hay có/không có tin */
    box-sizing: border-box;
    height: 164px;
    overflow: hidden;
    padding: var(--sp-3);
    border-radius: var(--r-lg);
    background: var(--green);
    box-shadow: inset 0 -6px 0 var(--green-dark);
    color: var(--white);
    text-align: center;
}

.trick-by {
    font-size: var(--fs-sm);
    font-weight: 900;
}

.trick-cards {
    /* Luôn một hàng: nhiều lá thì chồng lên nhau cho vừa bề ngang (tối đa 13 lá) */
    container-type: inline-size;
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    width: 100%;
    height: 66px;
    --n: 1;
}

.trick-cards .pcard-c + .pcard-c {
    margin-left: min(4px, calc((100cqw - var(--n) * 44px) / (var(--n) - 1)));
}

.trick-empty {
    font-size: var(--fs-lg);
    font-weight: 900;
    line-height: 1.3;
}

.trick-empty small {
    font-size: var(--fs-sm);
    font-weight: 800;
    opacity: 0.85;
}

.table-note {
    min-height: 1.3em;
    font-size: var(--fs-sm);
    font-weight: 800;
    line-height: 1.3;
    opacity: 0.85;
}

/* Lá của mình */
.me-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* Cao cố định để lúc tới lượt (chữ to hơn) lá trên tay không bị đẩy xuống */
    box-sizing: border-box;
    min-height: 44px;
    padding: 0 var(--sp-3);
    border-radius: var(--r-md);
    background: var(--bg-soft);
    color: var(--muted);
    font-size: var(--fs-sm);
}

.me-bar b {
    font-weight: 900;
}

.me-done {
    padding: var(--sp-3);
    border-radius: var(--r-md);
    background: var(--green-light);
    color: var(--green-dark);
    font-size: var(--fs-sm);
    font-weight: 800;
    text-align: center;
}

.hand {
    --overlap: -18px;
    display: flex;
    justify-content: center;
    padding: var(--sp-3) 0 2px;
}

.hand .pcard-c + .pcard-c {
    margin-left: var(--overlap);
}

.hand .pcard-c {
    box-shadow: -2px 0 4px rgba(0, 0, 0, 0.06);
}

.hand .pcard-c {
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    transition: transform 0.12s, translate 0.12s;
}

.hand .pcard-c.dragging {
    z-index: 20;
    transition: none;
    cursor: grabbing;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.28);
}

.hand-hint {
    margin: 0;
    text-align: center;
    color: var(--muted);
    font-size: var(--fs-sm);
}

.hand .pcard-c.selected {
    transform: translateY(-16px);
    border-color: var(--blue);
    background: var(--blue-light);
}

.hand-actions {
    display: grid;
    grid-template-columns: 1fr 1fr 1.3fr;
    gap: var(--sp-2);
}

.hand-actions .btn {
    height: 44px;
    padding: 0 var(--sp-2);
    font-size: var(--fs-sm);
}

.stop-btn {
    height: var(--h-sm);
    margin-top: 0;
    font-size: var(--fs-sm);
}

@media (min-width: 640px) {
    .pcard-c {
        width: 60px;
        height: 86px;
    }

    .pcard-c b,
    .pcard-c i {
        font-size: var(--fs-xl);
    }
    .pcard-c.has-face .idx b {
        font-size: 17px;
    }

    .pcard-c.has-face .idx i {
        font-size: 15px;
    }
}

/* 5 mục trên thanh dưới cùng */
.bottom-nav .nav-item span {
    white-space: nowrap;
}

/* Lá trên tay: số và chất ở góc trên trái để vẫn đọc được khi xếp chồng */
.hand .pcard-c {
    align-items: flex-start;
    justify-content: flex-start;
    gap: 1px;
    padding: var(--sp-1) 0 0 var(--sp-1);
}

.hand .pcard-c b {
    font-size: var(--fs-lg);
    letter-spacing: -0.04em;
}

.hand .pcard-c i {
    font-size: var(--fs-md);
}

@media (min-width: 640px) {
    .hand .pcard-c b {
        font-size: var(--fs-xl);
    }

    .hand .pcard-c i {
        font-size: var(--fs-lg);
    }
}

.me-done.cong {
    background: var(--red-light);
    color: var(--red-dark);
}

/* ---------- Tới lượt mình ---------- */

.me-bar.turn {
    padding: 0 var(--sp-4);
    background: var(--yellow);
    color: var(--white);
    font-size: var(--fs-lg);
    box-shadow: 0 4px 0 var(--yellow-dark);
}

.me-bar.turn i {
    animation: ring 0.8s ease-in-out infinite;
}

@keyframes ring {
    25% { transform: rotate(-18deg); }
    75% { transform: rotate(18deg); }
}

@media (prefers-reduced-motion: reduce) {
    .me-bar.turn i {
        animation: none;
    }
}

/* Nút tới trắng */
.btn-yellow {
    --b: var(--yellow);
    --s: var(--yellow-dark);
}

.white-btn {
    height: 56px;
    font-size: var(--fs-lg);
    animation: bump 0.6s ease-out;
}

.white-cards {
    margin-bottom: var(--sp-3);
}

/* ---------- Đồng hồ lượt 10 giây ---------- */

.opp {
    position: relative;
    overflow: hidden;
}

.opp-timer {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 4px;
    width: 100%;
    background: var(--yellow);
    transform-origin: left center;
    animation-name: timer-bar;
    animation-timing-function: linear;
    animation-fill-mode: forwards;
}

@keyframes timer-bar {
    80% { background: var(--orange); }
    to { transform: scaleX(0); background: var(--red); }
}

/* ---------- Hết ván: lật lá ---------- */

.done-felt {
    min-height: 110px;
}

.done-list {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
}

.done-row {
    padding: var(--sp-2) var(--sp-3);
    border: 2px solid var(--line);
    border-radius: var(--r-md);
}

.done-row.win {
    border-color: var(--yellow);
    background: var(--yellow-light);
}

.done-head {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
}

.done-head b {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: var(--fs-md);
}

.done-place {
    padding: 2px var(--sp-2);
    border-radius: 999px;
    background: var(--bg-soft);
    color: var(--muted);
    font-size: var(--fs-xs);
    font-weight: 900;
    text-transform: uppercase;
}

.done-cards {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-1);
    margin-top: var(--sp-2);
}

.done-cards .pcard-c {
    width: 34px;
    height: 48px;
    border-radius: var(--r-sm);
    border-bottom-width: 3px;
}

.done-cards .pcard-c b,
.done-cards .pcard-c i {
    font-size: var(--fs-sm);
}

.done-empty {
    margin-top: var(--sp-2);
    color: var(--subtle);
    font-size: var(--fs-sm);
    font-weight: 800;
}

.thoi-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-2);
    margin-top: var(--sp-2);
}

.thoi-chip {
    padding: var(--sp-1) var(--sp-2);
    border-radius: 999px;
    background: var(--red);
    color: var(--white);
    font-size: var(--fs-sm);
    font-weight: 900;
}

.done-actions {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: var(--sp-2);
}

.done-wait {
    margin: 0;
    text-align: center;
}

.done-title {
    font-size: var(--fs-lg);
    font-weight: 900;
    line-height: 1.3;
}

.done-title small {
    font-size: var(--fs-sm);
    font-weight: 800;
    opacity: 0.85;
}

/* ---------- Nói chuyện ---------- */

.voice-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-2);
    padding: var(--sp-2) var(--sp-2) var(--sp-2) var(--sp-3);
    border: 2px solid var(--line);
    border-radius: var(--r-md);
}

.voice-bar.on {
    border-color: var(--blue-line);
    background: var(--blue-light);
}

.voice-info {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    color: var(--muted);
    font-size: var(--fs-sm);
}

.voice-info i {
    color: var(--blue);
    font-size: var(--fs-lg);
}

.voice-bar .btn {
    margin-bottom: 2px;
}

.voice-people {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-2);
    min-width: 0;
}

.voice-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-1) var(--sp-2) var(--sp-1) var(--sp-1);
    border: 2px solid transparent;
    border-radius: 999px;
    background: var(--bg);
    font-size: var(--fs-sm);
    font-weight: 900;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.voice-chip .avatar {
    width: 26px;
    height: 26px;
    font-size: var(--fs-xs);
}

.voice-chip i {
    color: var(--subtle);
    font-size: var(--fs-xs);
}

.voice-chip.pending {
    opacity: 0.5;
}

.voice-chip.muted i {
    color: var(--red);
}

.voice-wait {
    align-self: center;
    color: var(--blue-dark);
    font-size: var(--fs-sm);
}

.voice-actions {
    flex: none;
    display: flex;
    gap: var(--sp-2);
}

.voice-actions .ibtn.danger {
    border-color: var(--red-line);
    background: var(--red-light);
    color: var(--red);
}

/* Đang nói: vòng xanh nhấp nháy quanh avatar của người đó */
[data-vname] .avatar {
    transition: outline-color 0.15s;
    outline: 3px solid transparent;
    outline-offset: 2px;
}

[data-vname].speaking .avatar {
    outline-color: var(--green);
    animation: talk 0.6s ease-in-out infinite alternate;
}

@keyframes talk {
    from { box-shadow: inset 0 -3px 0 var(--pcd), 0 0 0 2px rgba(88, 204, 2, 0.55); }
    to { box-shadow: inset 0 -3px 0 var(--pcd), 0 0 0 9px rgba(88, 204, 2, 0); }
}

/* Đang trong cuộc nói chuyện: huy hiệu mic nhỏ ở góc avatar */
.opp,
.tseat {
    position: relative;
}

.opp.in-voice .avatar,
.tseat.in-voice .avatar {
    position: relative;
}

.opp.in-voice .avatar::after,
.tseat.in-voice .avatar::after {
    content: '\f130';
    position: absolute;
    right: -5px;
    bottom: -4px;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: var(--blue);
    border: 2px solid var(--bg);
    color: var(--white);
    font: 900 8px/11px 'Font Awesome 6 Free';
    text-align: center;
}

.opp.in-voice.speaking .avatar::after,
.tseat.in-voice.speaking .avatar::after {
    background: var(--green);
}

@media (prefers-reduced-motion: reduce) {
    [data-vname].speaking .avatar { animation: none; }
}

/* Nút mic / cúp máy ở góc trên phải, chỉ ở tab 13 lá */
.voice-btns {
    display: flex;
    gap: var(--sp-2);
}

.voice-btns[hidden] {
    display: none;
}

.cards-mode .chip-view,
.cards-mode #clearBtn,
.cards-mode #playersBtn,
.cards-mode #tvBtn {
    display: none;
}

/* Người chỉ xem ở tab 13 lá: ẩn chip "Chỉ xem" để không che nút mic/loa
   (luật .room.readonly .view-only ở trên dùng !important nên cần ghi đè tại đây) */
.room.readonly.cards-mode .chip-view {
    display: none !important;
}

.ibtn-mic {
    border-color: var(--blue-line);
    background: var(--blue);
    color: var(--white);
    border-bottom-color: var(--blue-dark, #1899D6);
}

.ibtn-mic:hover {
    background: var(--blue);
    filter: brightness(1.05);
}

.ibtn-mic span {
    white-space: nowrap;
    font-size: var(--fs-sm);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.ibtn-mic.on {
    border-color: var(--green-line, #58A700);
    background: var(--green);
    position: relative;
}

.ibtn-mic.on.muted {
    border-color: var(--red-line);
    background: var(--red-light);
    color: var(--red);
}

.ibtn-mic.on.speaking {
    animation: mic-talk 0.6s ease-in-out infinite alternate;
}

@keyframes mic-talk {
    from { box-shadow: 0 0 0 0 rgba(88, 204, 2, 0.7); }
    to { box-shadow: 0 0 0 7px rgba(88, 204, 2, 0); }
}

.voice-count {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-1);
    font-size: var(--fs-sm);
}

.voice-count i {
    font-size: var(--fs-xs);
}

.ibtn-hangup {
    border-color: var(--red-line);
    background: var(--red);
    color: var(--white);
    border-bottom-color: var(--red-deep);
}

.ibtn-hangup:hover {
    background: var(--red);
    filter: brightness(1.05);
}

/* ---------- Bàn chờ 13 lá ---------- */
.lobby-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-2);
}

.lobby-head .panel-title {
    margin-bottom: 0;
}

.lobby-count {
    padding: var(--sp-1) var(--sp-2);
    border-radius: var(--r-sm);
    background: var(--blue-light);
    color: var(--blue);
    font-weight: 900;
    font-size: var(--fs-sm);
}

.lobby-panel > .panel-sub {
    margin-top: var(--sp-2);
}

.seat-tools { align-self: center; }

.table-seats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: var(--sp-2);
    margin: var(--sp-3) 0;
}

.tseat {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    min-width: 0;
    padding: var(--sp-2);
    border: 2px solid var(--line);
    border-radius: var(--r-md);
    background: var(--bg);
}

.tseat .avatar {
    width: 36px;
    height: 36px;
    font-size: var(--fs-md);
}

.tseat.me {
    border-color: var(--blue-line);
    background: var(--blue-light);
}

.tseat-av {
    position: relative;
    flex: none;
    display: inline-flex;
}

.tseat-dot {
    position: absolute;
    left: -3px;
    top: -3px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--green);
    border: 2px solid var(--bg);
}

.tseat.away .tseat-dot {
    background: #AFAFAF;
}

.tseat.away .avatar {
    filter: grayscale(0.8);
    opacity: 0.6;
}

.tseat.empty {
    border-style: dashed;
    background: transparent;
}

.tseat-empty {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-soft);
    color: #AFAFAF;
    font-size: var(--fs-sm);
}

.tseat-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.tseat-info b {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 900;
}

.tseat-info small {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--muted);
    font-size: var(--fs-xs);
    font-weight: 800;
}

.tseat.away .tseat-info small {
    color: #AFAFAF;
}

.tseat-kick {
    flex: none;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #AFAFAF;
    font-size: var(--fs-sm);
}

.tseat-kick:hover {
    background: var(--red-light);
    color: var(--red);
}

.join-form {
    display: flex;
    gap: var(--sp-2);
    margin-bottom: var(--sp-3);
}

.join-form input {
    flex: 1;
    min-width: 0;
    height: var(--h-lg);
    padding: 0 var(--sp-3);
    border: 2px solid var(--line);
    border-radius: var(--r-md);
    background: var(--bg-soft);
    color: var(--text);
    font: inherit;
    font-size: var(--fs-lg);
    font-weight: 800;
}

.join-form input:focus {
    outline: none;
    border-color: var(--blue);
    background: var(--bg);
}

.join-form .btn {
    flex: none;
}

.join-names {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--sp-2);
    margin-bottom: var(--sp-3);
}

.join-names small {
    width: 100%;
    color: var(--muted);
    font-weight: 800;
}

.join-note {
    margin: 0 0 var(--sp-3);
}

.lobby-wait {
    margin: 0;
    text-align: center;
    font-weight: 900;
}

.link-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    border: 0;
    background: none;
    padding: var(--sp-2) 0;
    color: var(--muted);
    font: inherit;
    font-size: var(--fs-sm);
    font-weight: 800;
    cursor: pointer;
}

.link-btn:hover {
    color: var(--red);
}

.lobby-leave {
    margin-top: var(--sp-2);
}

.invite-actions {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: var(--sp-2);
}

.invite-qr {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--sp-2);
    margin-top: var(--sp-3);
}

.invite-qr #inviteQr {
    padding: var(--sp-2);
    border-radius: var(--r-md);
    background: var(--white);
}

.done-actions .done-wait {
    flex: 1;
}

/* Hiệu ứng chia lá: từng lá bay vào tay */
.hand.dealing .pcard-c {
    animation: deal-in 0.35s cubic-bezier(0.2, 0.8, 0.3, 1.2) backwards;
}

@keyframes deal-in {
    from {
        opacity: 0;
        transform: translateY(-60px) rotate(-12deg) scale(0.6);
    }
}

@media (prefers-reduced-motion: reduce) {
    .hand.dealing .pcard-c {
        animation: none;
    }
}

/* ---------- Kinh ---------- */

.cut-panel {
    position: relative;
    overflow: hidden;
    text-align: center;
}

.cut-chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--sp-2);
    margin-bottom: var(--sp-2);
}

.cut-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-1) var(--sp-2) var(--sp-1) var(--sp-1);
    border: 2px solid var(--line);
    border-radius: 999px;
    background: var(--bg);
    font-size: var(--fs-sm);
    opacity: 0.6;
    transition: transform 0.1s, opacity 0.1s;
}

.cut-chip.lit {
    opacity: 1;
    transform: scale(1.1);
    border-color: var(--yellow);
    background: var(--yellow-light);
}

.cut-line {
    margin: var(--sp-2) 0 var(--sp-1);
    font-size: var(--fs-lg);
    line-height: 1.35;
}

.cut-line small,
.cut-sub {
    color: var(--muted);
    font-size: var(--fs-sm);
}

.cut-sub {
    margin: 0;
}

.cut-n {
    display: inline-block;
    min-width: 1.6em;
    padding: 0 var(--sp-2);
    border-radius: var(--r-sm);
    background: var(--yellow);
    color: var(--white);
    font-weight: 900;
    font-size: var(--fs-xl);
    animation: pop 0.5s 0.6s backwards;
}

.cut-form {
    max-width: 280px;
    margin: var(--sp-2) auto var(--sp-2);
}

.cut-form input {
    text-align: center;
}

.cut-timer {
    display: block;
    height: 6px;
    margin-top: var(--sp-2);
    border-radius: 3px;
    background: var(--yellow);
    transform-origin: left center;
    animation-name: timer-bar;
    animation-timing-function: linear;
    animation-fill-mode: forwards;
}

.cut-toggle {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    margin-bottom: var(--sp-2);
    font-size: var(--fs-sm);
    cursor: pointer;
}

.cut-toggle input {
    flex: none;
    width: 20px;
    height: 20px;
    accent-color: var(--green);
}

.cut-toggle small {
    display: block;
    color: var(--muted);
    font-size: var(--fs-xs);
    font-weight: 700;
}

/* Bộ lá úp: hai nửa, nửa trên nhấc ra rồi chồng xuống nửa dưới */
.cut-deck {
    position: relative;
    height: 140px;
    margin: var(--sp-2) auto 0;
    width: 160px;
}

.cd-half {
    position: absolute;
    left: 50%;
    bottom: 6px;
    width: 50px;
    height: 72px;
    margin-left: -25px;
}

.cd-card {
    position: absolute;
    left: 0;
    top: calc(var(--i) * -3px);
    width: 100%;
    height: 100%;
    border: 2px solid var(--white);
    border-radius: var(--r-sm);
    background: repeating-linear-gradient(45deg, var(--blue) 0 6px, var(--blue-dark) 6px 12px);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.18);
}

.cd-half.high {
    bottom: 26px;
}

.cut-deck.wait .cd-half.high,
.cut-deck.idle .cd-half.high {
    animation: cd-wiggle 1.2s ease-in-out infinite;
}

.cut-deck.idle .cd-half.low {
    animation: cd-shuffle 0.24s linear infinite;
}

.cut-deck.cut .cd-half.high {
    animation: cd-cut-high 2.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.cut-deck.cut .cd-half.low {
    animation: cd-cut-low 2.4s ease-in-out forwards;
}

@keyframes cd-wiggle {
    0%, 100% { transform: translateY(0) rotate(0); }
    50% { transform: translateY(-4px) rotate(-2deg); }
}

@keyframes cd-shuffle {
    0%, 100% { transform: translateX(-2px); }
    50% { transform: translateX(2px); }
}

@keyframes cd-cut-high {
    0% { transform: translate(0, 0); }
    30% { transform: translate(-60px, -14px) rotate(-8deg); }
    55% { transform: translate(-60px, -14px) rotate(-8deg); }
    80% { transform: translate(0, -26px) rotate(0); }
    100% { transform: translate(0, 16px); }
}

@keyframes cd-cut-low {
    0%, 55% { transform: translateX(0); }
    70% { transform: translateX(6px); }
    100% { transform: translateX(0); }
}

@media (prefers-reduced-motion: reduce) {
    .cut-deck .cd-half,
    .cut-n {
        animation: none !important;
    }
}

/* ---------- Nhắn tin và emoji react (dải cao cố định 48px, không đẩy bàn chơi) ---------- */

.chat-bar {
    flex: none;
    height: 40px;
    margin-bottom: var(--sp-2);
}

.chat-bar[hidden] {
    display: none;
}

.chat-row {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    height: 100%;
    padding: 0 var(--sp-2) 0 var(--sp-3);
    border: 2px solid var(--line);
    border-radius: var(--r-md);
    background: var(--bg-soft);
}

.chat-lines {
    flex: 1;
    min-width: 0;
    line-height: 1.25;
}

.chat-line {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: var(--fs-sm);
    font-weight: 700;
    color: var(--text);
}

.chat-line b {
    font-weight: 900;
    color: var(--blue-dark);
}

.chat-line.mine b {
    color: var(--green-dark);
}

.chat-line.chat-empty {
    color: var(--subtle);
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.chat-btn {
    flex: none;
    min-width: var(--h-sm);
    height: var(--h-xs);
    padding: 0 var(--sp-2);
    border: 2px solid var(--line);
    border-bottom-width: 3px;
    border-radius: var(--r-md);
    background: var(--bg);
    color: var(--muted);
    font-size: var(--fs-sm);
    font-weight: 900;
    cursor: pointer;
}

.chat-btn.send {
    border-color: var(--blue-line);
    background: var(--blue);
    color: var(--white);
}

.chat-btn.wide {
    padding: 0 var(--sp-3);
    font-size: var(--fs-sm);
}

.chat-row input {
    flex: 1;
    min-width: 0;
    height: var(--h-xs);
    padding: 0 var(--sp-2);
    border: 0;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: var(--fs-md);
    font-weight: 800;
}

.chat-row input:focus {
    outline: none;
}

.react-tray {
    justify-content: space-between;
    padding-left: var(--sp-2);
}

.react-pick {
    flex: 1;
    max-width: 52px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: var(--r-sm);
    background: transparent;
    font-size: var(--fs-2xl);
    line-height: 1;
    cursor: pointer;
    transition: transform 0.12s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.react-pick:active,
.react-pick:hover {
    transform: scale(1.3);
}

.react-fly {
    position: fixed;
    z-index: 60;
    pointer-events: none;
    font-size: 38px;
    line-height: 1;
    transform: translate(-50%, -50%);
    animation: react-fly 2.4s ease-out forwards;
}

@keyframes react-fly {
    0% { opacity: 0; transform: translate(-50%, -30%) scale(0.4); }
    12% { opacity: 1; transform: translate(-50%, -60%) scale(1.25); }
    30% { transform: translate(-50%, -90%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -330%) scale(1.1); }
}

@media (prefers-reduced-motion: reduce) {
    .react-fly {
        animation-duration: 1.2s;
    }
}

/* ---------- Tới lượt: bàn vàng, vàng rút dần từ phải sang trái để lộ xanh lá ---------- */

.turn-fill {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    border-radius: inherit;
    background: var(--yellow);
    box-shadow: inset 0 -6px 0 var(--yellow-dark);
    pointer-events: none;
    animation-name: turn-wipe;
    animation-timing-function: linear;
    animation-fill-mode: both;
}

.table-felt > :not(.turn-fill) {
    position: relative;
    z-index: 1;
}

/* Cùng màu vàng với ô "Tới lượt bạn"; bóng chữ nhẹ để chữ trắng vẫn dễ đọc */
.table-felt.timing .trick-by,
.table-felt.timing .trick-empty,
.table-felt.timing .table-note {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

@keyframes turn-wipe {
    from { clip-path: inset(0 0 0 0 round 20px); }
    to { clip-path: inset(0 100% 0 0 round 20px); }
}

/* Không tắt khi bật "giảm chuyển động": đây là đồng hồ đếm giờ, không chỉ là trang trí. */

.rx {
    display: block;
    width: 1em;
    height: 1em;
}

.react-btn .rx {
    width: 34px;
    height: 30px;
}

/* Biểu tượng đã có khung riêng: bỏ khung của nút, cùng cỡ với nút gửi bên cạnh */
.chat-btn.react-btn {
    min-width: 34px;
    width: 34px;
    height: 30px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    font-size: var(--fs-lg);
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
}

@media (max-height: 640px) {
    .table-felt { height: 150px; }
    .opp { padding: 5px 8px; }
}

/* ---------- Sảnh lớn ---------- */

.lobby-badge {
    margin-left: var(--sp-1);
    padding: 2px var(--sp-2);
    border-radius: 999px;
    background: var(--green);
    color: var(--white);
    font-size: var(--fs-xs);
    letter-spacing: 0.02em;
    text-transform: none;
}

.lobby-screen {
    overflow-y: auto;
    display: flex;
    justify-content: center;
    padding: var(--sp-4) var(--sp-4) calc(var(--sp-5) + env(safe-area-inset-bottom));
}

.lobby-inner {
    width: 100%;
    max-width: 480px;
}

.lobby-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-2);
}

.lobby-top h1 {
    margin: 0;
    font-size: var(--fs-2xl);
    font-weight: 900;
}

.lobby-sub {
    margin: var(--sp-2) 0 var(--sp-4);
    color: var(--muted);
    font-size: var(--fs-sm);
    line-height: 1.4;
}

.lobby-list {
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
}

.lobby-card {
    display: block;
    width: 100%;
    padding: var(--sp-3) var(--sp-4);
    border: 2px solid var(--line);
    border-bottom-width: 4px;
    border-radius: var(--r-lg);
    background: var(--bg);
    text-align: left;
    cursor: pointer;
}

.lobby-card:active {
    border-bottom-width: 2px;
    transform: translateY(3px);
}

.lobby-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-2);
}

.lobby-card-top b {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: var(--fs-lg);
    font-weight: 900;
}

.lobby-seats {
    flex: none;
    padding: var(--sp-1) var(--sp-2);
    border-radius: var(--r-sm);
    background: var(--blue-light);
    color: var(--blue);
    font-weight: 900;
}

.lobby-avs {
    display: flex;
    gap: var(--sp-2);
    margin: var(--sp-3) 0;
}

.lobby-av {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--sp-1);
    width: 52px;
    min-width: 0;
}

.lobby-av small {
    max-width: 100%;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    color: var(--muted);
    font-size: var(--fs-xs);
}

.lobby-slot {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
    align-self: flex-start;
    height: 36px;
    box-sizing: border-box;
    border: 2px dashed var(--line-dark);
    border-radius: 50%;
    width: 36px;
    margin: 0 var(--sp-2) 0 0;
    color: var(--subtle);
    font-size: var(--fs-sm);
}

.lobby-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-2);
}

.lobby-card-foot small {
    color: var(--subtle);
    font-size: var(--fs-xs);
}

.lobby-go {
    flex: none;
    color: var(--green-dark);
    font-weight: 900;
    font-size: var(--fs-sm);
}

.lobby-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--sp-2);
    padding: 36px var(--sp-4);
    border: 2px dashed var(--line-dark);
    border-radius: var(--r-lg);
    color: var(--muted);
    text-align: center;
    font-size: var(--fs-sm);
}

.lobby-empty > i {
    font-size: 34px;
    color: var(--subtle);
}

.lobby-empty b {
    color: var(--text);
    font-size: var(--fs-lg);
}

.pub-box {
    margin-bottom: var(--sp-2);
}

.pub-form {
    margin: 0 0 var(--sp-2) 30px;
}

.pub-form input,
.pub-form .btn {
    height: var(--h-md);
}

/* Ô nhập và nút trong cùng một hàng bằng chiều cao, nút không có lề dưới */
.join-form {
    align-items: flex-start;
}

.join-form .btn {
    margin-bottom: 0;
}

.lobby-slot {
    flex: none;
    width: 36px;
    min-width: 36px;
    height: 36px;
    min-height: 36px;
    aspect-ratio: 1;
    align-self: flex-start;
}

/* =====================================================================
   TV & PHÁO HOA / LỬA: dùng đơn vị vmin, KHÔNG theo token — giữ nguyên
   ===================================================================== */

/* ---------- Hiệu ứng cấp cao (×2 trở lên) ---------- */

.fx.mega::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    pointer-events: none;
    animation: mega-flash 1.3s ease-out infinite;
}

.fx-party.mega::before {
    background: radial-gradient(circle at 50% 40%, rgba(255, 255, 255, 0.9), rgba(255, 220, 120, 0.25) 45%, transparent 70%);
}

.fx-fire.mega::before {
    background: radial-gradient(circle at 50% 100%, rgba(255, 60, 0, 0.85), rgba(160, 0, 0, 0.35) 50%, transparent 75%);
}

@keyframes mega-flash {
    0% { opacity: 1; }
    25% { opacity: 0.15; }
    100% { opacity: 0; }
}

.fx.mega .fx-card {
    border-width: 3px;
    border-bottom-width: 8px;
}

.fx-party.mega .fx-card {
    border-color: var(--yellow);
    box-shadow: 0 0 0 6px rgba(255, 200, 0, 0.35), 0 0 80px rgba(255, 220, 120, 0.8);
}

.fx-fire.mega .fx-card {
    border-color: #FF3B1F;
    box-shadow: 0 0 0 6px rgba(255, 60, 30, 0.35), 0 0 90px rgba(255, 60, 0, 0.9);
}

.fx.mega .fx-title {
    font-size: 40px;
    letter-spacing: -0.01em;
}

.fx-party.mega .fx-title {
    background: linear-gradient(90deg, #FF4B4B, #FF9600, #FFC800, #58CC02, #1CB0F6, #CE82FF, #FF4B4B);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: rainbow 1.2s linear infinite;
}

.fx-fire.mega .fx-title {
    color: #FF4A1C;
    text-shadow: 0 0 12px rgba(255, 90, 0, 0.9), 0 0 30px rgba(255, 30, 0, 0.8);
    animation: hell-pulse 0.5s ease-in-out infinite alternate;
}

@keyframes rainbow {
    to { background-position: 200% 0; }
}

@keyframes hell-pulse {
    to { transform: scale(1.06); }
}

.fx.mega .fx-icon {
    width: 92px;
    height: 92px;
    margin-top: -76px;
    font-size: 44px;
    animation: bump 0.6s ease-out infinite;
}

.fx.mega .fx-mark {
    font-size: 38px;
}

/* Rung cả màn hình */
body.quake .screen:not([hidden]) {
    animation: quake 0.45s linear infinite;
}

.fx.mega .fx-card {
    animation: pop 0.45s cubic-bezier(0.2, 1.6, 0.4, 1), quake 0.4s 0.45s linear infinite;
}

@keyframes quake {
    0%, 100% { transform: translate(0, 0) rotate(0); }
    20% { transform: translate(-7px, 4px) rotate(-0.6deg); }
    40% { transform: translate(6px, -5px) rotate(0.5deg); }
    60% { transform: translate(-5px, -3px) rotate(-0.4deg); }
    80% { transform: translate(5px, 5px) rotate(0.6deg); }
}

@media (prefers-reduced-motion: reduce) {
    body.quake .screen:not([hidden]),
    .fx.mega .fx-card,
    .fx.mega::before,
    .fx.mega .fx-title,
    .fx.mega .fx-icon {
        animation: none;
    }
}

/* Nút bật âm thanh trên TV */
.tv-sound {
    height: 6vmin;
    min-height: 40px;
    padding: 0 2vmin;
    border: 0;
    border-radius: 1.6vmin;
    background: #FFFFFF;
    color: var(--green-dark);
    font-size: 2.2vmin;
    font-weight: 900;
    white-space: nowrap;
    animation: pulse 1.4s ease-in-out infinite;
}

/* ---------- Huy hiệu chuỗi trên TV ---------- */

.tv-line {
    max-width: 100%;
    display: inline-flex;
    align-items: center;
    gap: 0.35em;
    overflow: hidden;
    white-space: nowrap;
    font-size: var(--last-fs, 2.6vmin);
}

.tv-line .tv-last {
    font-size: 1em;
}

.tv-streak {
    display: inline-flex;
    align-items: center;
    gap: 0.3em;
    padding: 0.25em 0.6em;
    border-radius: 0.5em;
    color: #FFFFFF;
    font-weight: 900;
}

.tv-streak.hot { background: var(--orange); box-shadow: inset 0 -0.15em 0 var(--orange-dark); }
.tv-streak.cold { background: var(--blue); box-shadow: inset 0 -0.15em 0 var(--blue-dark); }
.tv-streak.up { background: var(--green); box-shadow: inset 0 -0.15em 0 var(--green-dark); }
.tv-streak.down { background: var(--red); box-shadow: inset 0 -0.15em 0 var(--red-dark); }

.tv-grid.wide .tv-line {
    justify-content: flex-end;
}

/* ---------- Thông báo mốc: cỡ chữ theo màn hình, đọc rõ trên TV ---------- */

.fx {
    padding: 4vmin;
}

.fx-card {
    width: min(94vw, 1300px);
    max-width: none;
    padding: 7vmin 5vmin 3.5vmin;
    border-width: 0.5vmin;
    border-bottom-width: 1.4vmin;
    border-radius: 5vmin;
}

.fx-icon {
    width: 19vmin;
    height: 19vmin;
    margin-top: -16vmin;
    margin-bottom: 2vmin;
    font-size: 9.5vmin;
    box-shadow: inset 0 -1.2vmin 0 var(--yellow-dark), 0 0 0 1.4vmin var(--bg);
}

.fx-fire .fx-icon {
    box-shadow: inset 0 -1.2vmin 0 #B3160E, 0 0 0 1.4vmin #2A0B07, 0 0 8vmin rgba(255, 90, 0, 0.8);
}

.fx-title,
.fx.mega .fx-title {
    font-size: clamp(34px, 10vmin, 160px);
    line-height: 1.05;
    letter-spacing: -0.02em;
    /* Chữ tô gradient chỉ vẽ trong khung: chừa chỗ cho dấu chồng (Ề, Ỗ, Ặ...) */
    padding: 0.2em 0.05em 0.08em;
    margin-top: -0.12em;
}

.fx-list {
    gap: 2vmin;
    margin: 4vmin 0 3.5vmin;
}

.fx-row {
    gap: 3vmin;
    padding: 2.4vmin 3.5vmin;
    border-radius: 3.5vmin;
}

.fx-row .avatar {
    width: 14vmin;
    height: 14vmin;
    font-size: 7vmin;
    box-shadow: inset 0 -1vmin 0 var(--pcd);
}

.fx-row-text {
    font-size: clamp(14px, 3.8vmin, 60px);
    font-weight: 800;
    line-height: 1.15;
}

.fx-row-text b {
    font-size: clamp(22px, 7.5vmin, 120px);
    line-height: 1.1;
}

.fx-mark,
.fx.mega .fx-mark {
    font-size: clamp(30px, 12vmin, 190px);
    line-height: 1;
}

.fx-bar {
    height: 1.5vmin;
    min-height: 6px;
}

.fx.mega .fx-icon {
    width: 22vmin;
    height: 22vmin;
    margin-top: -18vmin;
    font-size: 11vmin;
}

/* Siêu pháo hoa: vàng kim trên nền xanh đêm */
.fx-party.mega {
    background: radial-gradient(circle at 50% 35%, rgba(60, 40, 0, 0.75), rgba(4, 6, 24, 0.95) 70%);
}

.fx-party.mega .fx-card {
    border-color: #FFC800;
    background: linear-gradient(180deg, #FFFBEA, #FFF1C2);
    box-shadow: 0 0 0 1vmin rgba(255, 200, 0, 0.35), 0 0 12vmin rgba(255, 210, 90, 0.85);
}

.fx-party.mega .fx-row {
    background: rgba(255, 255, 255, 0.75);
}

.fx-party.mega .fx-title {
    background: linear-gradient(90deg, #9A5B00, #D98A00, #F0A800, #D98A00, #9A5B00);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 0.5vmin 0 rgba(150, 100, 0, 0.35));
}

.fx-party.mega .fx-mark {
    color: #C98A00;
}

.fx-party.mega::before {
    background: radial-gradient(circle at 50% 40%, rgba(255, 245, 200, 0.85), rgba(255, 200, 60, 0.2) 45%, transparent 70%);
}

/* Địa ngục tầng 2 trở lên: lửa tím */
.fx-fire.mega {
    background: linear-gradient(to top, rgba(70, 0, 130, 0.94), rgba(25, 0, 50, 0.9) 60%, rgba(8, 0, 18, 0.88));
}

.fx-fire.mega::before {
    background: radial-gradient(circle at 50% 100%, rgba(190, 70, 255, 0.85), rgba(90, 0, 160, 0.35) 50%, transparent 75%);
}

.fx-fire.mega .fx-card {
    border-color: #B44CFF;
    background: #1A0630;
    color: #F3DDFF;
    box-shadow: 0 0 0 1vmin rgba(180, 76, 255, 0.35), 0 0 12vmin rgba(160, 50, 255, 0.9);
}

.fx-fire.mega .fx-icon {
    background: #9B30FF;
    box-shadow: inset 0 -1.2vmin 0 #6A0DBA, 0 0 0 1.4vmin #1A0630, 0 0 8vmin rgba(180, 70, 255, 0.9);
}

.fx-fire.mega .fx-title {
    color: #D88BFF;
    text-shadow: 0 0 2vmin rgba(190, 80, 255, 0.95), 0 0 5vmin rgba(130, 0, 255, 0.8);
}

.fx-fire.mega .fx-mark {
    color: #E0A0FF;
}

.fx-fire.mega .fx-row {
    background: rgba(255, 255, 255, 0.07);
}

.fx-fire.mega .fx-bar span {
    background: #B44CFF;
}

/* ---------- Tầng 3, 4, 5+ ---------- */

/* Rung mạnh (tầng 4 trở lên) */
body.quake-strong .screen:not([hidden]) {
    animation: quake-strong 0.4s linear infinite;
}

.fx.tier-4 .fx-card,
.fx.tier-5 .fx-card {
    animation: pop 0.45s cubic-bezier(0.2, 1.6, 0.4, 1), quake-strong 0.38s 0.45s linear infinite;
}

@keyframes quake-strong {
    0%, 100% { transform: translate(0, 0) rotate(0); }
    20% { transform: translate(-14px, 8px) rotate(-1.2deg); }
    40% { transform: translate(12px, -10px) rotate(1deg); }
    60% { transform: translate(-10px, -6px) rotate(-0.8deg); }
    80% { transform: translate(10px, 10px) rotate(1.2deg); }
}

/* Pháo hoa ×3: Mưa sao băng (băng, trắng xám) */
.fx-party.tier-3 {
    background: radial-gradient(circle at 50% 30%, rgba(20, 60, 110, 0.8), rgba(2, 8, 28, 0.96) 70%);
}

.fx-party.tier-3::before {
    background: radial-gradient(circle at 50% 40%, rgba(200, 240, 255, 0.8), rgba(90, 200, 255, 0.2) 45%, transparent 70%);
}

.fx-party.tier-3 .fx-card {
    border-color: #5CCBFF;
    background: linear-gradient(180deg, #F4FCFF, #DDF4FF);
    box-shadow: 0 0 0 1vmin rgba(92, 203, 255, 0.35), 0 0 12vmin rgba(150, 225, 255, 0.85);
}

.fx-party.tier-3 .fx-title {
    background: linear-gradient(90deg, #0B4F8F, #1E8FD0, #3FB4F0, #1E8FD0, #0B4F8F);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.fx-party.tier-3 .fx-icon {
    background: #5CCBFF;
    box-shadow: inset 0 -1.2vmin 0 #1E8FD0, 0 0 0 1.4vmin #F4FCFF;
}

.fx-party.tier-3 .fx-mark { color: #1E8FD0; }
.fx-party.tier-3 .fx-bar span { background: #5CCBFF; }

/* Pháo hoa ×4 và ×5: nền chuyển màu cầu vồng */
.fx-party.tier-4,
.fx-party.tier-5 {
    background: linear-gradient(120deg, rgba(40, 6, 70, 0.95), rgba(4, 40, 80, 0.95), rgba(6, 60, 30, 0.95), rgba(70, 40, 0, 0.95), rgba(70, 6, 40, 0.95));
    background-size: 400% 400%;
    animation: fade 0.2s ease-out, bg-shift 5s ease infinite;
}

@keyframes bg-shift {
    50% { background-position: 100% 50%; }
}

.fx-party.tier-4::before,
.fx-party.tier-5::before {
    background: radial-gradient(circle at 50% 40%, rgba(255, 255, 255, 0.75), rgba(255, 150, 220, 0.2) 45%, transparent 70%);
}

.fx-party.tier-4 .fx-card {
    border-color: #FF86D0;
    background: #FFFFFF;
    box-shadow: 0 0 0 1vmin rgba(255, 134, 208, 0.35), 0 0 12vmin rgba(255, 160, 230, 0.85);
}

.fx-party.tier-4 .fx-title,
.fx-party.tier-5 .fx-title {
    background: linear-gradient(90deg, #FF4B4B, #FF9600, #FFC800, #58CC02, #1CB0F6, #CE82FF, #FF4B4B);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.fx-party.tier-4 .fx-icon {
    background: #FF4B91;
    box-shadow: inset 0 -1.2vmin 0 #D61F6E, 0 0 0 1.4vmin #FFFFFF;
}

.fx-party.tier-4 .fx-mark { color: #E0157A; }
.fx-party.tier-4 .fx-bar span { background: linear-gradient(90deg, #FF4B4B, #FFC800, #58CC02, #1CB0F6, #CE82FF); }

/* Pháo hoa ×5+: Huyền thoại (vàng + cầu vồng, vương miện khổng lồ) */
.fx-party.tier-5 .fx-card {
    border-color: #FFC800;
    background: linear-gradient(180deg, #FFFDF2, #FFF0B8);
    box-shadow: 0 0 0 1.2vmin rgba(255, 200, 0, 0.45), 0 0 16vmin rgba(255, 210, 90, 0.95);
}

.fx-party.tier-5 .fx-icon {
    width: 28vmin;
    height: 28vmin;
    margin-top: -24vmin;
    font-size: 15vmin;
    background: linear-gradient(180deg, #FFE066, #FFB800);
    box-shadow: inset 0 -1.4vmin 0 #D99800, 0 0 0 1.6vmin #FFFDF2, 0 0 10vmin rgba(255, 210, 0, 0.9);
    animation: crown-drop 0.9s cubic-bezier(0.3, 1.5, 0.5, 1), bump 0.8s 0.9s ease-out infinite;
}

@keyframes crown-drop {
    from { transform: translateY(-80vh) rotate(-25deg); }
}

.fx-party.tier-5 .fx-title {
    font-size: clamp(38px, 12vmin, 190px);
}

.fx-party.tier-5 .fx-mark { color: #C98A00; }

/* Địa ngục ×3: lửa xanh lục quỷ */
.fx-fire.tier-3 {
    background: linear-gradient(to top, rgba(0, 70, 10, 0.94), rgba(0, 30, 6, 0.9) 60%, rgba(0, 10, 2, 0.88));
}

.fx-fire.tier-3::before {
    background: radial-gradient(circle at 50% 100%, rgba(80, 255, 60, 0.6), rgba(0, 120, 20, 0.3) 50%, transparent 75%);
}

.fx-fire.tier-3 .fx-card {
    border-color: #39FF14;
    background: #071D07;
    color: #DFFFD6;
    box-shadow: 0 0 0 1vmin rgba(57, 255, 20, 0.3), 0 0 12vmin rgba(60, 255, 40, 0.8);
}

.fx-fire.tier-3 .fx-icon {
    background: #2BC41A;
    box-shadow: inset 0 -1.2vmin 0 #168A0B, 0 0 0 1.4vmin #071D07, 0 0 8vmin rgba(60, 255, 40, 0.9);
}

.fx-fire.tier-3 .fx-title {
    color: #7CFF5C;
    text-shadow: 0 0 2vmin rgba(80, 255, 60, 0.95), 0 0 5vmin rgba(20, 200, 20, 0.8);
}

.fx-fire.tier-3 .fx-mark { color: #9CFF80; }
.fx-fire.tier-3 .fx-bar span { background: #39FF14; }

/* Địa ngục ×4: lửa xanh lam, sét */
.fx-fire.tier-4 {
    background: linear-gradient(to top, rgba(0, 30, 110, 0.94), rgba(0, 12, 50, 0.9) 60%, rgba(0, 4, 18, 0.9));
}

.fx-fire.tier-4::before {
    background: radial-gradient(circle at 50% 100%, rgba(90, 170, 255, 0.7), rgba(20, 60, 200, 0.3) 50%, transparent 75%);
}

.fx-fire.tier-4 .fx-card {
    border-color: #3FA9FF;
    background: #06142E;
    color: #DDEEFF;
    box-shadow: 0 0 0 1vmin rgba(63, 169, 255, 0.35), 0 0 12vmin rgba(80, 170, 255, 0.85);
}

.fx-fire.tier-4 .fx-icon {
    background: #2F80FF;
    box-shadow: inset 0 -1.2vmin 0 #1453C4, 0 0 0 1.4vmin #06142E, 0 0 8vmin rgba(90, 170, 255, 0.9);
}

.fx-fire.tier-4 .fx-title {
    color: #9CD3FF;
    text-shadow: 0 0 2vmin rgba(110, 190, 255, 0.95), 0 0 5vmin rgba(30, 110, 255, 0.8);
}

.fx-fire.tier-4 .fx-mark { color: #A8D8FF; }
.fx-fire.tier-4 .fx-bar span { background: #3FA9FF; }

/* Địa ngục ×5+: đáy địa ngục (đỏ thẫm, đen, khung nứt) */
.fx-fire.tier-5 {
    background: radial-gradient(circle at 50% 120%, rgba(120, 0, 0, 0.9), rgba(8, 0, 0, 0.97) 65%);
}

.fx-fire.tier-5::before {
    background: radial-gradient(circle at 50% 100%, rgba(255, 30, 0, 0.75), rgba(120, 0, 0, 0.35) 50%, transparent 75%);
    animation: mega-flash 1.1s ease-out infinite;
}

.fx-fire.tier-5 .fx-card {
    border-color: #B00000;
    background: #140000;
    color: #FFD9D9;
    box-shadow: 0 0 0 1vmin rgba(176, 0, 0, 0.45), 0 0 14vmin rgba(255, 20, 0, 0.85);
}

/* Vết nứt trên khung */
.fx-fire.tier-5 .fx-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    border-radius: inherit;
    pointer-events: none;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 60' preserveAspectRatio='none'%3E%3Cg fill='none' stroke='%23FF5A3C' stroke-width='0.5' stroke-linecap='round' opacity='0.75'%3E%3Cpath d='M0 8 L12 14 L18 11 L27 20 L33 18 L41 27'/%3E%3Cpath d='M100 5 L90 12 L84 10 L76 19 L70 17 L63 25'/%3E%3Cpath d='M18 11 L20 3'/%3E%3Cpath d='M84 10 L86 1'/%3E%3Cpath d='M0 52 L9 47 L15 50 L22 43'/%3E%3Cpath d='M100 55 L91 49 L86 52 L79 45'/%3E%3C/g%3E%3C/svg%3E") center / 100% 100% no-repeat;
}

.fx-fire.tier-5 .fx-icon {
    background: #8B0000;
    box-shadow: inset 0 -1.2vmin 0 #4A0000, 0 0 0 1.4vmin #140000, 0 0 10vmin rgba(255, 40, 0, 0.95);
}

.fx-fire.tier-5 .fx-title {
    color: #FF3B2F;
    font-size: clamp(38px, 12vmin, 190px);
    text-shadow: 0 0 2vmin rgba(255, 40, 20, 0.95), 0 0 6vmin rgba(160, 0, 0, 0.9);
}

.fx-fire.tier-5 .fx-mark { color: #FF6B5C; }
.fx-fire.tier-5 .fx-bar span { background: #E01B00; }

@media (prefers-reduced-motion: reduce) {
    body.quake-strong .screen:not([hidden]),
    .fx.tier-4 .fx-card,
    .fx.tier-5 .fx-card,
    .fx-party.tier-4,
    .fx-party.tier-5,
    .fx-party.tier-5 .fx-icon {
        animation: none;
    }
}

/* ---------- Hiệu ứng chặt bằng hàng (chặt chồng thì mạnh dần, lvl1 → lvl5) ---------- */

.chop-fx {
    position: fixed;
    inset: 0;
    z-index: 9000;
    pointer-events: none;
    overflow: hidden;
}

.chop-fx svg {
    position: absolute;
    left: 50%;
    top: 46%;
    width: min(100vw, 460px);
    aspect-ratio: 360 / 420;
    transform: translate(-50%, -50%);
    overflow: visible;
}

#gameRoot.chop-shake.lvl1 { animation: cfShake 0.45s linear 1; }
#gameRoot.chop-shake.lvl2 { animation: cfShake 0.6s linear 1; --cf-amp: 1.6; }
#gameRoot.chop-shake.lvl3 { animation: cfShake 0.8s linear 1; --cf-amp: 2.4; }
#gameRoot.chop-shake.lvl4 { animation: cfShake 1.1s linear 1; --cf-amp: 3.2; }
#gameRoot.chop-shake.lvl5 { animation: cfShake 1.5s linear 1; --cf-amp: 4.2; }

@keyframes cfShake {
    0%, 100% { transform: translate(0, 0); }
    10% { transform: translate(calc(-7px * var(--cf-amp, 1)), calc(4px * var(--cf-amp, 1))); }
    20% { transform: translate(calc(6px * var(--cf-amp, 1)), calc(-5px * var(--cf-amp, 1))); }
    30% { transform: translate(calc(-5px * var(--cf-amp, 1)), calc(-3px * var(--cf-amp, 1))); }
    45% { transform: translate(calc(4px * var(--cf-amp, 1)), calc(5px * var(--cf-amp, 1))); }
    60% { transform: translate(calc(-3px * var(--cf-amp, 1)), calc(2px * var(--cf-amp, 1))); }
    80% { transform: translate(calc(2px * var(--cf-amp, 1)), calc(-2px * var(--cf-amp, 1))); }
}

@media (prefers-reduced-motion: reduce) {
    #gameRoot.chop-shake { animation: none; }
}

/* ---------- Gợi ý mở bằng trình duyệt (khi đang trong Messenger, Facebook, Zalo…) ---------- */

.iab-bar {
    position: relative;
    z-index: 70;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--sp-2) var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
    padding-top: max(var(--sp-3), env(safe-area-inset-top));
    border-bottom: 2px solid var(--blue-line);
    background: var(--blue-light);
    color: var(--text);
}

.iab-text {
    flex: 1 1 220px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: var(--fs-sm);
    line-height: 1.35;
}

.iab-text b { font-size: var(--fs-md); font-weight: 900; color: var(--blue-dark); }

.iab-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }

.iab-bar button {
    height: 36px;
    padding: 0 var(--sp-3);
    border: 2px solid var(--line);
    border-bottom-width: 4px;
    border-radius: var(--r-sm);
    background: var(--white);
    color: var(--blue);
    font: inherit;
    font-size: var(--fs-sm);
    font-weight: 900;
    cursor: pointer;
}

.iab-bar .iab-go { border-color: var(--blue-dark); background: var(--blue); color: var(--white); }
.iab-bar .iab-x { border-color: transparent; background: transparent; color: var(--muted); border-bottom-width: 2px; }

/* ---------- Chỉnh cỡ chữ thông báo mốc, từ ghép không bị tách dòng, khung rung không lệch khỏi màn hình ---------- */

/* Chừa lề lớn hơn biên độ rung (14px + xoay) để khung không bị lệch ra ngoài màn hình */
.fx {
    box-sizing: border-box;
    overflow: hidden;
    padding: max(4vmin, 28px);
}

.fx-card {
    box-sizing: border-box;
    width: min(100%, 1300px);
    max-height: 100%;
}

/* #fx để thắng các luật theo tầng (tier-3, tier-4, tier-5) ở trên */
#fx .fx-title {
    font-size: clamp(24px, 6.2vmin, 96px);
    letter-spacing: -0.01em;
    text-wrap: balance;
    word-break: keep-all;
    overflow-wrap: normal;
}

/* Dòng người trong thông báo mốc không còn avatar: tên bên trái, điểm bên phải */
.fx-row {
    justify-content: space-between;
}

/* Chọn giọng đọc ở sảnh chờ 13 lá */
.narrator-box {
    margin: var(--sp-2) 0 var(--sp-3);
}

.narrator-box > small {
    display: block;
    margin-bottom: var(--sp-1);
    font-size: var(--fs-sm);
    font-weight: 900;
}

.narrator-box > small span {
    color: var(--muted);
    font-size: var(--fs-xs);
    font-weight: 700;
}

.narrator-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-2);
}

.pick-chip.narrator-chip {
    padding: var(--sp-2) var(--sp-3);
}

/* Làm mới sảnh lớn: nút xanh trong lúc tải, danh sách mờ đi */
.ibtn.busy {
    border-color: var(--blue-line);
    background: var(--blue-light);
    color: var(--blue);
    cursor: progress;
}

.lobby-list {
    transition: opacity 0.2s;
}

.lobby-list.refreshing {
    opacity: 0.45;
    pointer-events: none;
}

/* ---------- Trang Chơi: chọn trò + bàn chờ gọn ---------- */
.game-picker {
    margin-bottom: var(--sp-2);
}

.game-picker .gtile {
    flex-direction: row;
    justify-content: center;
    column-gap: 2px;
    padding: var(--sp-1) 2px;
}

.game-picker .gtile-art {
    width: 40px;
    height: 40px;
}

.game-picker .gtile b {
    font-size: var(--fs-sm);
}

.game-picker .gtile small {
    display: none;
}

.game-picker .gtile.on {
    border-color: var(--g);
    border-bottom-color: var(--gd);
    box-shadow: 0 0 0 2px var(--g);
}

.game-picker .gtile:not(.on) {
    opacity: 0.6;
}

.lobby-panel {
    padding: var(--sp-3) var(--sp-4);
}

.lobby-panel .panel-title {
    font-size: var(--fs-lg);
}

.lobby-panel > .panel-sub {
    margin: var(--sp-1) 0 var(--sp-3);
}

.lobby-panel .table-seats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 0 0 var(--sp-3);
}

.invite-box {
    margin-bottom: var(--sp-3);
}

.invite-actions .btn {
    margin-bottom: 0;
}

.start-btn {
    margin-bottom: var(--sp-1);
}

.lobby-panel > .lobby-wait {
    margin: 0;
}

.lobby-leave {
    display: flex;
    margin: var(--sp-1) auto 0;
    padding-bottom: 0;
}

/* Ghế trống trùng tên lớp với khối "chưa có dữ liệu" (.empty): trả lại cỡ của ghế */
.tseat.empty {
    padding: var(--sp-2);
    text-align: left;
}

.tseat-empty i {
    display: inline;
    margin: 0;
    font-size: var(--fs-sm);
}

/* Chừa chỗ cho đáy nút Vào phòng / Xem trên TV */
.home .recent {
    margin-top: var(--sp-3);
}

@media (max-height: 640px) {
    .home .recent { margin-top: var(--sp-2); }
}

/* Màn hình rất hẹp: bỏ icon ở phòng gần đây để chữ không tràn ô */
@media (max-width: 340px) {
    .recent-item small i { display: none; }
}

/* ---------- Trò 2 lá ---------- */
.sprite { position: absolute; }
.sprite text, .gtile-art text { font-family: var(--font); }

@media (max-width: 340px) {
    .home .gtile-art, .game-picker .gtile-art { width: 30px; height: 30px; }
}

.btn-orange { --b: var(--orange); --s: var(--orange-dark); }

.lobby-creates { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--sp-2); }
.lobby-ico { width: 28px; height: 28px; margin-right: 6px; vertical-align: middle; }

.level-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--sp-2);
    width: 100%;
}

.level-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--sp-3) var(--sp-1);
    border: 2px solid var(--line);
    border-bottom-width: 5px;
    border-radius: var(--r-md);
    background: var(--bg);
}

.level-btn b { font-size: var(--fs-2xl); font-weight: 900; }
.level-btn small { color: var(--muted); font-size: var(--fs-xs); }
.level-btn.on { border-color: var(--orange); background: var(--orange-light); }

.pcard-c.back {
    border-color: var(--white);
    background: repeating-linear-gradient(45deg, #FF9600 0 5px, #FFB547 5px 10px);
}

.res { padding: 2px var(--sp-2); border-radius: var(--r-pill); background: var(--line); font-size: var(--fs-xs); font-weight: 900; }
.res.up { background: var(--green-light); color: #2F6E00; }
.res.down { background: var(--red-light); color: var(--red-deep); }

.cut-chip small { font-weight: 900; }

/* Hiệu ứng bộ mạnh */
.fx2 {
    --c: #FF9600;
    --cd: #8F4C00;
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    pointer-events: none;
    animation: fx2-out 2.6s ease forwards;
}

.fx2-bang { --c: #FF4B4B; --cd: #9E1C1C; }
.fx2-ngu { --c: #A560E8; --cd: #5C2A94; }

.fx2-rays {
    position: absolute;
    width: 180vmax;
    height: 180vmax;
    border-radius: 50%;
    background: repeating-conic-gradient(var(--c) 0 9deg, transparent 9deg 22deg);
    opacity: 0.35;
    animation: fx2-spin 6s linear infinite;
}

.fx2-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--sp-1);
    min-width: 240px;
    padding: var(--sp-4) var(--sp-5);
    border: 4px solid var(--white);
    border-bottom: 10px solid var(--cd);
    border-radius: 28px;
    background: var(--c);
    color: var(--white);
    animation: fx2-pop 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.5) both;
}

.fx2-card svg { width: 110px; height: 110px; padding: 4px; border-radius: 50%; background: var(--white); }
.fx2-card b { font-size: 34px; font-weight: 900; text-shadow: 0 3px 0 var(--cd); }
.fx2-card span { font-size: var(--fs-2xl); font-weight: 900; line-height: 1.2; }

@keyframes fx2-pop { from { transform: scale(0) rotate(-14deg); } }
@keyframes fx2-spin { to { transform: rotate(360deg); } }
@keyframes fx2-out { 0%, 85% { opacity: 1; } 100% { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
    .fx2-rays, .fx2-card { animation: none; }
}

/* ---------- Bàn 2 lá: ô trắng nổi khối quanh xấp lá, mình ở dưới ---------- */
/* Bề ngang một lá, dùng chung cho mọi lá và xấp lá trên bàn */
@property --cw { syntax: '<length>'; inherits: true; initial-value: 28px; }

.two-live .view-cards:not([hidden]) { display: flex; flex-direction: column; padding: var(--sp-2) var(--sp-2) var(--sp-1); }
.two-live .chat-bar { flex: none; margin-bottom: 6px; }
.two-live .game-root { position: relative; flex: 1 0 auto; height: 0; gap: 6px; }
.two-live .game-root > * { flex: none; }

.game-root > .t2-table { container-type: size; flex: 1 1 0; display: flex; flex-direction: column; gap: 8px; min-height: 260px; }

.t2-row {
    /* Vừa cả 5 lá một hàng trong cột hẹp nhất, và vừa bề cao của một hàng ghế */
    --cw: max(18px, min(calc((100cqw / 3 - 18px) / 3.4), calc((100cqh / 3.2 - 62px) / 1.5), 36px));
    display: flex;
    flex: 1 1 0;
    justify-content: center;
    gap: 6px;
    min-height: 0;
}

.t2-table[data-n="2"] .t2-row { --cw: max(18px, min(calc((100cqw - 40px) / 5.5), calc((100cqh / 3.2 - 62px) / 1.5), 46px)); }
.t2-row.middle { flex-grow: 1.05; }
.t2-row.bottom { flex-grow: 1.15; }
.t2-row > * { flex: 1 1 0; min-width: 0; }

.spot-gap { visibility: hidden; }

.spot {
    position: relative;
    container-type: size;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 7px 3px 6px;
    border: 2px solid var(--line);
    border-bottom-width: 5px;
    border-radius: var(--r-md);
    background: var(--bg);
}

.spot > .spot-name,
.spot > .spot-cards,
.spot > .spot-foot { position: relative; z-index: 1; }

.spot.mine { border-color: var(--blue-line); background: var(--blue-light); }
.spot.dealer { border-color: #FFD9A0; background: var(--orange-light); }
/* Người khác tới lượt: như ô đối thủ bên 13 lá, có thanh đếm giờ ở đáy */
.spot.turn { border-color: var(--blue-line); background: var(--blue-light); }
.spot.checkable { border-color: var(--orange); }
/* Tới lượt mình: ô chuyển vàng rồi vàng rút dần để lộ xanh lá, giống bàn 13 lá */
.spot.mine.turn { border: 2px solid transparent; border-bottom-width: 5px; background: var(--green) padding-box; color: var(--white); }
.spot-fill { position: absolute; inset: -2px -2px -5px; border-radius: inherit; background: var(--yellow); box-shadow: inset 0 -5px 0 var(--yellow-dark); pointer-events: none; animation-name: turn-wipe; animation-timing-function: linear; animation-fill-mode: both; }
.spot.mine.turn { box-shadow: inset 0 -5px 0 var(--green-dark); }
.spot.mine.turn .spot-name b,
.spot.mine.turn .spot-foot > :not(.res) { color: var(--white); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); }

.spot-cards { flex: 1 1 0; }

/* Mọi ô dùng chung một cỡ chữ để tên chủ, tên mình không to hơn người khác */
.spot-name { display: flex; flex: none; align-items: center; align-self: center; justify-content: center; gap: 3px; min-width: 0; max-width: 100%; height: 18px; padding: 0 6px; border-radius: var(--r-pill); }
.spot-name .avatar { flex: none; width: 16px; height: 16px; font-size: 8px; }
.spot-name b { overflow: hidden; font-size: var(--fs-xs); font-weight: 900; text-overflow: ellipsis; white-space: nowrap; }
.spot-level { padding: 0 5px; border-radius: var(--r-pill); background: var(--line); color: var(--text); font-size: 10px; font-weight: 900; }
.spot.mine .spot-level { background: var(--white); }
.spot.dealer .spot-name { background: #B35F00; color: var(--white); }
.spot.dealer .spot-name .avatar { display: none; }
.spot-crown { flex: none; font-size: 9px; }

.spot-foot { display: flex; flex: none; flex-wrap: wrap; align-items: center; justify-content: center; column-gap: 4px; min-height: 17px; line-height: 1.3; }
.spot-state, .spot-label { font-size: 11px; font-weight: 900; white-space: nowrap; }
.spot-state { color: var(--muted); }
.spot-sep { color: var(--subtle); font-weight: 900; }
.spot-label.k-bang, .spot-label.k-dach, .spot-label.k-ngu { padding: 0 6px; border-radius: var(--r-pill); background: var(--yellow); color: #5F3A17; text-shadow: none; }
.spot-label.k-qua { padding: 0 6px; border-radius: var(--r-pill); background: var(--red); color: var(--white); }
.spot-foot .res { padding: 0 7px; font-size: 11px; }
.spot-foot .res.up { background: var(--green-light); color: #2F6E00; }
.spot-foot .res.down { background: var(--red-light); color: var(--red-deep); }
/* Chỗ hẹp: bỏ ảnh đại diện để tên đủ chỗ; quá hẹp thì dòng dưới xếp hai hàng, bỏ dấu ngăn */
@container (max-width: 150px) {
    .spot-name .avatar { display: none; }
}
@container (max-width: 104px) {
    .spot-foot { flex-direction: column; }
    .spot-sep { display: none; }
}
@container (max-width: 140px) {
    .spot-foot.long { flex-direction: column; }
    .spot-foot.long .spot-sep { display: none; }
}

/* Hàng lá: mọi lá một cỡ; từ 3 lá thì chồng lên nhau, số và chất dồn về góc trái cho khỏi bị che */
.fit { display: flex; justify-content: center; align-items: center; min-width: 0; min-height: 0; }

.fit .pcard-c {
    --w: var(--cw);
    --s: 1.1;
    flex: none;
    width: var(--w);
    height: calc(var(--w) * 1.5);
    min-width: 0;
    padding: 0;
    border-radius: calc(var(--w) * 0.18);
}

.fit.fan .pcard-c { --s: 0.6; justify-content: flex-start; align-items: flex-start; padding-top: calc(var(--w) * 0.1); }
.fit .pcard-c + .pcard-c { margin-left: calc(var(--w) * (var(--s) - 1)); }
.fit .pcard-c b { font-size: calc(var(--w) * 0.48); }
.fit .pcard-c i { font-size: calc(var(--w) * 0.42); }
.fit .pcard-c.has-face .face { display: none; }
.fit .pcard-c.has-face .idx { position: static; align-items: center; padding: 0; background: none; }
.fit .pcard-c.has-face .idx b { font-size: calc(var(--w) * 0.48); }
.fit .pcard-c.has-face .idx i { font-size: calc(var(--w) * 0.42); }
.fit.fan .pcard-c > b,
.fit.fan .pcard-c > i,
.fit.fan .pcard-c.has-face .idx { width: calc(var(--w) * 0.6); text-align: center; }
.fit.fan .pcard-c b { letter-spacing: -0.06em; }
.fit .pcard-c.back { border-color: var(--orange-dark); }

/* Xấp lá giữa bàn */
.spot-deck { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; border-radius: var(--r-lg); background: var(--bg-soft); }

.deck {
    position: relative;
    z-index: 1;
    isolation: isolate;
    flex: none;
    width: var(--cw);
    height: calc(var(--cw) * 1.5);
    padding: 0;
    border: 0;
    background: none;
}

.deck span,
.fly2 {
    border: 2px solid var(--orange-dark);
    border-radius: 7px;
    background: repeating-linear-gradient(45deg, #FF9600 0 5px, #FFB547 5px 10px);
}

.deck span { position: absolute; inset: 0; }
.deck span:nth-child(2) { transform: translate(2px, 2px); z-index: -1; }
.deck span:nth-child(3) { transform: translate(4px, 4px); z-index: -2; }
.deck span:nth-child(4) { transform: translate(6px, 6px); z-index: -3; }
.deck .deck-top { transition: transform 0.18s cubic-bezier(0.2, 0.9, 0.3, 1.5); }
.deck.can { cursor: pointer; animation: deck-call 1.4s ease-in-out infinite; }
.deck.peek { animation: none; }
.deck.peek .deck-top { transform: translate(8px, -14px) rotate(9deg); }

@keyframes deck-call { 50% { transform: scale(1.07); } }

.deck-note { max-width: 100%; overflow: hidden; padding: 0 8px; border: 2px solid var(--line); border-radius: var(--r-pill); background: var(--bg); color: var(--muted); font-size: 11px; font-weight: 900; text-overflow: ellipsis; white-space: nowrap; }

.fly2 { position: fixed; z-index: 55; pointer-events: none; }

/* Lá mình vừa bốc: phóng to giữa màn hình kèm tổng mới */
.zoom2-veil { position: fixed; inset: 0; z-index: 55; background: rgba(19, 31, 36, 0.55); pointer-events: none; }
.zoom2 { --zw: min(46vw, 28vh, 190px); position: fixed; z-index: 56; left: calc(50% - var(--zw) / 2); top: calc(50% - var(--zw) * 0.85); width: var(--zw); height: calc(var(--zw) * 1.42); pointer-events: none; }
.zoom2 .pcard-c { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; height: 100%; margin: 0; padding: 0; border-width: 3px; border-bottom-width: 8px; border-radius: calc(var(--zw) * 0.11); font-size: calc(var(--zw) * 0.3); box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35); }
.zoom2 .pcard-c > b { font-size: calc(var(--zw) * 0.46); line-height: 1.1; }
.zoom2 .pcard-c > i { font-size: calc(var(--zw) * 0.42); line-height: 1.1; }
.zoom2 .pcard-c.has-face .idx b, .zoom2 .pcard-c.has-face .idx i { font-size: calc(var(--zw) * 0.17); }
.zoom2-total { position: absolute; left: 50%; top: calc(100% + 18px); transform: translateX(-50%); padding: 6px 22px; border: 4px solid var(--white); border-radius: var(--r-pill); background: var(--green); color: var(--white); font-size: clamp(22px, 7vw, 32px); font-weight: 900; white-space: nowrap; }
.zoom2-total.k-ngu { background: var(--yellow); color: #5F3A17; }
.zoom2-total.k-qua { background: var(--red); }

/* Chọn người để xét: chạm vào lá thì lá nhô lên, chạm lần nữa mới xét */
.spot-cards[data-game] { cursor: pointer; }
.spot.picked { background: var(--orange-light); }
.spot.picked .spot-cards .pcard-c { transform: translateY(-6px); border-color: var(--orange-dark); box-shadow: 0 6px 0 rgba(224, 134, 0, 0.35); animation: card-lift 0.16s ease-out; }
.spot-hint { padding: 0 8px; border-radius: var(--r-pill); background: var(--orange); color: var(--white); font-size: clamp(10px, 8cqw, 13px); font-weight: 900; white-space: nowrap; }

@keyframes card-lift { from { transform: translateY(0); } }

/* Thanh dưới bàn: nút của lượt mình, chọn mức, hoặc ván mới */
.t2-bar { position: relative; display: flex; flex-direction: column; justify-content: center; min-height: calc(var(--h-md) + 6px); margin-top: 4px; }
.t2-bar > .btn { height: var(--h-md); margin-bottom: 4px; }
.t2-wait { margin: 0; padding: var(--sp-2); border-radius: var(--r-md); background: var(--bg-soft); color: var(--muted); font-size: var(--fs-sm); text-align: center; }
.t2-bar .level-row { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.t2-bar .level-btn { display: block; height: var(--h-md); padding: 0; line-height: calc(var(--h-md) - 7px); text-align: center; white-space: nowrap; }
.t2-bar .level-btn b { font-size: var(--fs-lg); }
.t2-bar .level-btn small { display: block; overflow: hidden; font-size: 10px; font-weight: 900; line-height: 12px; white-space: nowrap; }
/* Bốn mức điểm, mỗi mức một màu: nút chọn, số to giữa ô và nhãn cạnh tên dùng chung. */
.lv1 { --lv: #1CB0F6; --lvd: #1479A8; }
.lv2 { --lv: #58CC02; --lvd: #3E8E00; }
.lv3 { --lv: #A560E8; --lvd: #7B3FBF; }
.lv4 { --lv: #FF4B4B; --lvd: #C62F2F; }
.t2-bar .level-btn[class*="lv"] { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 46px; border-color: var(--lv); background: var(--white); color: var(--lvd); line-height: 1; }
.t2-bar .level-btn[class*="lv"] b { font-size: var(--fs-lg); line-height: 1.1; }
.t2-bar .level-btn[class*="lv"] small { color: inherit; }
.t2-bar .level-btn[class*="lv"].on { border-color: var(--lvd); background: var(--lv); color: var(--white); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); }
.spot-pick { display: flex; align-items: center; justify-content: center; min-height: 0; container-type: size; }
.spot-pick b { min-width: 1.9em; padding: 0 0.25em; border-bottom: 0.14em solid var(--lvd); border-radius: 0.4em; background: var(--lv); box-shadow: 0 0 0 2px var(--white); color: var(--white); font-size: clamp(14px, min(40cqw, 62cqh), 46px); font-weight: 900; line-height: 1.3; text-align: center; text-shadow: 0 2px 2px rgba(0, 0, 0, 0.25); }
.spot .spot-level[class*="lv"] { background: var(--lv); color: var(--white); }
.t2-bar .cut-timer { display: block; position: static; margin-bottom: 4px; }

.t2-bar.done-actions.two-done { display: grid; grid-template-columns: 1fr 1fr; align-items: start; margin-bottom: 0; }
.two-done .btn { height: var(--h-md); margin-bottom: 4px; }
.two-done .done-wait { display: flex; align-items: center; justify-content: center; height: var(--h-md); margin: 0 0 4px; white-space: nowrap; }

/* Nút dừng ván: ngoài phần màn hình đang thấy, kéo xuống mới tới */
.game-root > .stop-far { position: absolute; top: 100%; left: 0; right: 0; padding: 72px 0 var(--sp-4); }
.stop-far .stop-btn { margin: 0; }

/* Điện thoại thấp (vd. trình duyệt còn thanh địa chỉ) */
@media (max-height: 620px) {
    .two-live .topbar { padding-top: 4px; padding-bottom: 4px; }
    .two-live .bottom-nav { padding-top: 2px; padding-bottom: 2px; }
    .two-live .view-cards:not([hidden]) { padding-top: 4px; padding-bottom: 0; }
    .two-live .chat-bar { height: 34px; margin-bottom: 4px; }
    .two-live .game-root { gap: 4px; }
    .game-root > .t2-table { gap: 4px; }
    .t2-row { gap: 4px; }
    .spot { padding: 4px 2px 5px; gap: 0; border-bottom-width: 3px; }
    .deck-note { font-size: 10px; }
    .spot-foot { min-height: 14px; }
    .t2-bar { min-height: 38px; margin-top: 2px; }
    .t2-bar > .btn, .two-done .btn, .two-done .done-wait, .t2-bar .level-btn { height: 34px; margin-bottom: 3px; }
    .t2-bar .level-btn[class*="lv"] { height: 38px; }
    .t2-wait { padding: 4px; }
}

/* Hết ván 2 lá: ô xanh (thắng), đỏ (thua), xám (hoà), điểm ghi rõ và dải chữ ở đáy */
.t2-table.done .t2-row { --cw: max(16px, min(calc((100cqw / 3 - 18px) / 3.4), calc((100cqh / 3.2 - 84px) / 1.5), 32px)); }
.t2-table.done[data-n="2"] .t2-row { --cw: max(16px, min(calc((100cqw - 40px) / 5.5), calc((100cqh / 3.2 - 84px) / 1.5), 42px)); }
.spot.done.res-w { --c: #58CC02; --d: #3E8E00; }
.spot.done.res-l { --c: #FF4B4B; --d: #C62F2F; }
.spot.done.res-h { --c: #8E9BA5; --d: #66737D; }
.spot.done { gap: 1px; padding: 4px 0 0; border: 0; border-bottom: 4px solid var(--d); background: var(--c); color: var(--white); }
.spot.done .spot-name { height: 15px; background: none; color: var(--white); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); }
.spot.done .pcard-c { text-shadow: none; }
.spot.done .pcard-c:not(.red):not(.back) { color: var(--text); }
.spot.done .spot-foot { min-height: 15px; }
.spot.done .spot-label { padding: 0 6px; border-radius: var(--r-pill); background: rgba(255, 255, 255, 0.9); color: var(--text); font-size: 10px; text-shadow: none; }
.spot.done .spot-label.k-bang, .spot.done .spot-label.k-dach, .spot.done .spot-label.k-ngu { background: var(--yellow); color: #5F3A17; }
.spot.done .spot-label.k-qua { background: #5E760A; color: var(--white); }
.spot-score { flex: none; align-self: center; font-size: clamp(16px, min(19cqh, 24cqw), 28px); font-weight: 900; line-height: 1.1; text-shadow: 0 2px 2px rgba(0, 0, 0, 0.25); }
.spot.mine .spot-score { font-size: clamp(18px, 22cqh, 34px); }
.spot-verdict { flex: none; background: var(--d); font-size: 11px; font-weight: 900; line-height: 15px; letter-spacing: 0.14em; text-align: center; text-transform: uppercase; }
@container (max-height: 96px) {
    .spot-verdict { line-height: 13px; font-size: 10px; }
    .spot.done .spot-name, .spot.done .spot-foot { height: 13px; min-height: 13px; }
}
.done-sum { gap: 2px; font-size: var(--fs-sm); line-height: 1.25; text-align: center; }
.done-sum small { color: var(--muted); font-size: 10px; font-weight: 900; }
.done-sum b { font-weight: 900; }
.done-sum b.up { color: #3E8E00; }
.done-sum b.down { color: var(--red-deep); }

/* ---------- Người tham gia ---------- */
.room.granted .master-only { display: none; }

.people-list { display: flex; flex-direction: column; gap: var(--sp-2); max-height: 50vh; overflow-y: auto; }
.person-row { display: flex; flex: none; align-items: stretch; gap: var(--sp-2); }
.person-move { display: flex; flex: none; flex-direction: column; gap: 2px; }
.person-move button { flex: 1; width: 34px; border: 2px solid var(--line); border-radius: var(--r-sm); background: var(--bg); color: var(--muted); }
.person-move button:disabled { opacity: 0.35; }
.person { display: flex; flex: 1; min-width: 0; align-items: center; gap: var(--sp-3); padding: var(--sp-2) var(--sp-3); border: 2px solid var(--line); border-bottom-width: 4px; border-radius: var(--r-md); background: var(--bg); text-align: left; }
.person.granted { border-color: var(--orange); background: var(--orange-light); }
.person-info { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.person-info b { overflow: hidden; font-weight: 900; text-overflow: ellipsis; white-space: nowrap; }
.person-info small { color: var(--muted); font-size: var(--fs-xs); }
.person-tag { flex: none; color: var(--muted); font-size: var(--fs-xs); font-weight: 900; }
.person.granted .person-tag { color: #8F4C00; }

/* Bị thúi: chỗ đó đóng dấu và bốc khói */
.stink { position: fixed; z-index: 58; display: flex; align-items: center; justify-content: center; pointer-events: none; animation: stink-out 2s ease forwards; }
.stink b { padding: 2px 10px; border: 3px solid var(--white); border-radius: var(--r-md); background: #7A6A12; box-shadow: 0 4px 0 #4E430A; color: var(--white); font-size: var(--fs-lg); font-weight: 900; text-transform: uppercase; white-space: nowrap; animation: stink-stamp 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.6) both, stink-shake 0.5s 0.45s 2; }
.stink span { position: absolute; bottom: 20%; width: 26px; height: 26px; border-radius: 50%; background: #B8C93A; opacity: 0; animation: stink-puff 1.4s ease-out forwards; }
.stink span:nth-child(1) { left: 8%; }
.stink span:nth-child(2) { left: 28%; width: 34px; height: 34px; animation-delay: 0.15s; background: #8FA02A; }
.stink span:nth-child(3) { left: 46%; animation-delay: 0.3s; }
.stink span:nth-child(4) { left: 62%; width: 36px; height: 36px; animation-delay: 0.08s; background: #8FA02A; }
.stink span:nth-child(5) { left: 76%; animation-delay: 0.22s; }

@keyframes stink-puff { 0% { transform: translateY(0) scale(0.3); opacity: 0; } 25% { opacity: 0.85; } 100% { transform: translateY(-70px) scale(1.5); opacity: 0; } }
@keyframes stink-stamp { from { transform: scale(2.6) rotate(-20deg); opacity: 0; } to { transform: scale(1) rotate(-9deg); opacity: 1; } }
@keyframes stink-shake { 0%, 100% { transform: rotate(-9deg); } 25% { transform: rotate(-16deg) translateX(-4px); } 75% { transform: rotate(-2deg) translateX(4px); } }
@keyframes stink-out { 0%, 85% { opacity: 1; } 100% { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
    .stink span { display: none; }
    .stink b { animation: none; transform: rotate(-9deg); }
}
