* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
    font-family: 'Plus Jakarta Sans', sans-serif; 
    user-select: none; 
    -webkit-user-select: none; 
}

html { -webkit-text-size-adjust: 100%; }
button, .uno-card, .deck-stack, .coin-pill, .avatar-opt {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --bg-main: #060913;
    --primary-blue: #0b4bc1;
    --accent-blue: #38bdf8;
    --gold: #facc15;
    --green: #10b981;
    --red: #ef4444;
    --table-felt: radial-gradient(ellipse at center, #1b4d3e 0%, #0d281f 70%, #061510 100%);
}

body {
    background: var(--bg-main);
    color: #ffffff;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* 1. TOP NAVBAR */
.game-nav {
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
    color: #0f172a;
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--primary-blue);
    font-family: 'Outfit', sans-serif;
    font-size: 19px;
    font-weight: 900;
}

.brand-tag {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1d4ed8;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 999px;
    font-weight: 800;
    text-transform: uppercase;
}

.nav-right-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.user-status-text { font-size: 13px; font-weight: 700; color: #0f172a; }
.user-status-text b { color: var(--primary-blue); }

.music-bar-container {
    background: #0d1a38;
    border: 1.5px solid #1e3a8a;
    border-radius: 50px;
    padding: 4px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 10px rgba(2, 132, 199, 0.2);
}
.music-btn {
    background: #0284c7;
    color: #ffffff;
    border: none;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: 0.2s;
}
.music-btn:hover { background: #0369a1; }
.music-btn.playing { background: #16a34a; }
.volume-slider { cursor: pointer; accent-color: #facc15; width: 65px; }

.coin-pill {
    background: #fef3c7;
    border: 1.5px solid #f59e0b;
    color: #92400e;
    padding: 5px 12px;
    border-radius: 999px;
    font-weight: 800;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.2);
    transition: transform 0.15s;
}
.coin-pill:hover { transform: scale(1.04); }

.btn-action {
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 800;
    text-decoration: none;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s ease;
}

.btn-leave-table { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }
.btn-leave-table:hover { background: #fecaca; }
.btn-game-dash { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }

/* 2. ARENA CONTAINER */
.arena-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px;
    position: relative;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.table-info-strip {
    display: flex;
    justify-content: space-between;
    width: 100%;
    max-width: 1120px;
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 700;
    color: #94a3b8;
    padding: 0 10px;
}

/* 3. CASINO OVAL TABLE */
.oval-table-wrapper {
    width: 100%;
    max-width: 1120px;
    height: 640px;
    position: relative;
    background: #2b1810;
    border-radius: 320px / 215px;
    padding: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9), inset 0 0 25px rgba(0, 0, 0, 0.9);
    border: 10px solid #522e17;
    display: flex;
    align-items: center;
    justify-content: center;
}

.table-felt {
    width: 100%;
    height: 100%;
    background: var(--table-felt);
    border-radius: 300px / 195px;
    border: 3px dashed rgba(250, 204, 21, 0.35);
    box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.7);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.uno-alert-slot { display: contents; } /* desktop: no effect, mobile: reserves space */

.uno-alert-banner {
    position: absolute;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #ef4444, #b91c1c);
    color: #ffffff;
    border: 2px solid #facc15;
    padding: 8px 22px;
    border-radius: 999px;
    font-size: 13.5px;
    font-weight: 900;
    box-shadow: 0 0 30px rgba(239, 68, 68, 0.85);
    z-index: 60;
    display: none;
    animation: pulseBanner 0.5s infinite alternate;
    text-align: center;
}
@keyframes unoButtonBlinkMobile {
    from { transform: scale(1); box-shadow: 0 0 14px #ef4444; }
    to   { transform: scale(1.03); box-shadow: 0 0 26px #facc15; }
}
@keyframes pulseBannerMobile {
    from { box-shadow: 0 0 8px rgba(239, 68, 68, 0.5); }
    to   { box-shadow: 0 0 22px rgba(239, 68, 68, 0.95); }
}
@keyframes pulseBanner {
    from { transform: translateX(-50%) scale(1); }
    to { transform: translateX(-50%) scale(1.06); }
}

.table-center-hub {
    display: flex;
    align-items: center;
    gap: 20px;
    z-index: 10;
    background: rgba(0, 0, 0, 0.45);
    padding: 16px 22px;
    border-radius: 20px;
    border: 1.5px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 10px 30px rgba(0,0,0,0.6);
    position: relative;
}

.stack-counter-badge {
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #ef4444, #b91c1c);
    color: #fff;
    padding: 4px 14px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 900;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.6);
    border: 1.5px solid #fecaca;
    display: none;
    white-space: nowrap;
}

.color-indicator-ring {
    position: absolute;
    width: 155px;
    height: 155px;
    border-radius: 50%;
    border: 6px solid #eab308;
    pointer-events: none;
    opacity: 0.45;
    animation: ringSpin 8s linear infinite;
}
@keyframes ringSpin { 100% { transform: rotate(360deg); } }

/* 7-PLAYER SEATS WITH CIRCULAR PROGRESS RING */
.seat {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    z-index: 20;
    transition: all 0.3s ease;
}

.seat-ring-wrap {
    position: relative;
    width: 72px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.timer-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 72px;
    height: 72px;
    transform: rotate(-90deg);
    pointer-events: none;
}

.timer-circle-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.12);
    stroke-width: 4;
}

.timer-circle-progress {
    fill: none;
    stroke: #38bdf8;
    stroke-width: 4.5;
    stroke-linecap: round;
    stroke-dasharray: 201;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear, stroke 0.3s ease;
}

.timer-sec {
    position: absolute;
    bottom: -4px;
    right: -8px;
    z-index: 3;
    background: #0f172a;
    border: 1.5px solid #38bdf8;
    color: #ffffff;
    font-family: 'Outfit', sans-serif;
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
    padding: 2px 5px;
    border-radius: 999px;
    pointer-events: none;
}

.seat-avatar-box {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: #1e293b;
    border: 2.5px solid #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 16px rgba(0,0,0,0.6);
    overflow: hidden;
    z-index: 2;
}

.seat-avatar-box svg { width: 80%; height: 80%; display: block; }

.seat.vacant .seat-avatar-box {
    border: 2px dashed #94a3b8;
    background: rgba(15, 23, 42, 0.4);
    box-shadow: none;
}

.seat.active-turn .seat-avatar-box {
    border-color: #38bdf8;
    box-shadow: 0 0 25px rgba(56, 189, 248, 0.7);
    transform: scale(1.08);
}

.seat-name {
    font-size: 11px;
    font-weight: 800;
    background: rgba(15, 23, 42, 0.88);
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    max-width: 95px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}

.seat-card-count-badge {
    background: #d97706;
    color: #fff;
    font-size: 10px;
    font-weight: 900;
    padding: 1px 7px;
    border-radius: 6px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

.opp-card-pile {
    display: flex;
    margin-top: -6px;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.6));
}
.uno-card-back-mini {
    width: 20px;
    height: 30px;
    background: #0f172a;
    border: 1px solid #ffffff;
    border-radius: 3px;
    margin-left: -12px;
    background-image: radial-gradient(#ef4444 35%, #991b1b 100%);
}

.seat-0 { bottom: 8px; left: 50%; transform: translateX(-50%); }
.seat-1 { bottom: 75px; left: 13%; }
.seat-2 { top: 95px; left: 13%; }
.seat-3 { top: 12px; left: 34%; }
.seat-4 { top: 12px; right: 34%; }
.seat-5 { top: 95px; right: 13%; }
.seat-6 { bottom: 75px; right: 13%; }

/* 4. PLAYER HAND (MOBILE-FRIENDLY RESPONSIVE FIX) */
.human-hand-wrapper {
    position: absolute;
    bottom: -10px;
    display: flex;
    justify-content: flex-start;
    align-items: flex-end;
    z-index: 30;
    width: 96%;
    max-width: 820px;
    overflow-x: auto;
    overflow-y: visible;
    padding: 15px 12px 25px 12px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(56, 189, 248, 0.4) transparent;
}

.human-hand-wrapper::-webkit-scrollbar {
    height: 5px;
}
.human-hand-wrapper::-webkit-scrollbar-thumb {
    background: rgba(56, 189, 248, 0.4);
    border-radius: 10px;
}

.uno-card {
    width: 72px;
    height: 108px;
    border-radius: 8px;
    padding: 4px;
    box-shadow: 0 8px 18px rgba(0,0,0,0.6);
    cursor: pointer;
    border: 2.5px solid #ffffff;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.18s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    flex-shrink: 0;
    opacity: 1;
    margin-right: -16px; /* Card overlapping effect so all fit cleanly */
}

.uno-card:last-child {
    margin-right: 0;
}

.uno-card:hover { 
    transform: translateY(-20px) scale(1.12); 
    z-index: 50; 
    margin-right: 2px;
}

.uno-card.not-turn { opacity: 0.9 !important; filter: contrast(0.95); cursor: default; }
.uno-card.disabled { opacity: 0.65 !important; filter: grayscale(0.3); cursor: not-allowed; }

.uno-card.red    { background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%); }
.uno-card.blue   { background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%); }
.uno-card.green  { background: linear-gradient(135deg, #22c55e 0%, #15803d 100%); }
.uno-card.yellow { background: linear-gradient(135deg, #fde047 0%, #facc15 55%, #eab308 100%); }
.uno-card.wild   { background: #0f172a; }

.card-inner-oval {
    width: 100%;
    height: 100%;
    background: #ffffff;
    border-radius: 50%;
    transform: rotate(26deg);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.center-glyph {
    font-size: 34px;
    font-weight: 900;
    font-style: italic;
    transform: rotate(-26deg);
    font-family: 'Outfit', sans-serif;
    pointer-events: none;
}

.red .center-glyph    { color: #dc2626; }
.blue .center-glyph   { color: #2563eb; }
.green .center-glyph  { color: #16a34a; }
.yellow .center-glyph { color: #b45309; }
.yellow .card-corner  { color: #713f12; text-shadow: none; }
/* ---- WILD CARD: 4 colours in the middle ---- */
.uno-card.wild .card-inner-oval {
    position: relative;
    overflow: hidden;
    background: #0f172a;
    border: 2px solid #ffffff;
    box-sizing: border-box;
}
.wild-q { position: absolute; width: 50%; height: 50%; transition: opacity 0.25s, filter 0.25s; }
.wild-q.q-red    { top: 0;    left: 0;  background: #ef4444; }
.wild-q.q-blue   { top: 0;    right: 0; background: #3b82f6; }
.wild-q.q-yellow { bottom: 0; left: 0;  background: #facc15; }
.wild-q.q-green  { bottom: 0; right: 0; background: #22c55e; }
.wild .center-glyph {
    position: relative;
    z-index: 2;
    color: #ffffff;
    text-shadow: 0 1px 3px rgba(0,0,0,0.95), 0 0 5px rgba(0,0,0,0.85);
}

/* ---- WILD CARD ON TABLE: chosen colour is highlighted, the other 3 fade ---- */
.uno-card.yellow.disabled, .uno-card.yellow.not-turn { opacity: 0.85 !important; }
.uno-card.wild.picked .wild-q { opacity: 0.3; filter: grayscale(0.75); }
.uno-card.wild.picked::after {
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    padding: 1px 8px;
    border-radius: 999px;
    border: 1.5px solid #ffffff;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 0.5px;
    color: #ffffff;
    z-index: 6;
    pointer-events: none;
    white-space: nowrap;
}
.uno-card.wild.pick-red::after    { content: 'RED';    background: #dc2626; }
.uno-card.wild.pick-blue::after   { content: 'BLUE';   background: #2563eb; }
.uno-card.wild.pick-green::after  { content: 'GREEN';  background: #16a34a; }
.uno-card.wild.pick-yellow::after { content: 'YELLOW'; background: #ca8a04; }
.uno-card.wild.pick-red    .q-red,
.uno-card.wild.pick-blue   .q-blue,
.uno-card.wild.pick-yellow .q-yellow,
.uno-card.wild.pick-green  .q-green {
    opacity: 1;
    filter: none;
    box-shadow: inset 0 0 0 3px rgba(255,255,255,0.9);
}
.uno-card.wild.pick-red    { border-color: #ef4444; box-shadow: 0 0 0 3px #ef4444, 0 0 22px 5px rgba(239,68,68,0.9); }
.uno-card.wild.pick-blue   { border-color: #3b82f6; box-shadow: 0 0 0 3px #3b82f6, 0 0 22px 5px rgba(59,130,246,0.9); }
.uno-card.wild.pick-green  { border-color: #22c55e; box-shadow: 0 0 0 3px #22c55e, 0 0 22px 5px rgba(34,197,94,0.9); }
.uno-card.wild.pick-yellow { border-color: #facc15; box-shadow: 0 0 0 3px #facc15, 0 0 22px 5px rgba(250,204,21,0.95); }

/* waiting-for-players status */
.table-wait-status { color: #facc15; font-weight: 800; text-align: center; }

.card-corner {
    position: absolute;
    font-size: 11px;
    font-weight: 900;
    color: #ffffff;
    font-style: italic;
    font-family: 'Outfit', sans-serif;
    pointer-events: none;
}
.corner-tl { top: 4px; left: 5px; }
.corner-br { bottom: 4px; right: 5px; transform: rotate(180deg); }

.deck-stack {
    width: 72px;
    height: 108px;
    border-radius: 8px;
    background: #0f172a;
    border: 2.5px solid #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: -4px 6px 12px rgba(0,0,0,0.7), -8px 10px 0px #1e293b;
    cursor: pointer;
    transition: transform 0.15s;
}
.deck-stack:hover { transform: scale(1.05); }

/* UNO SHOUT BUTTON & NOTICE WRAPPER */
.uno-control-group {
    position: absolute;
    right: 20px;
    bottom: 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    z-index: 50;
    max-width: 250px;
}

.uno-warning-note {
    background: rgba(15, 23, 42, 0.95);
    border: 1.5px solid #facc15;
    color: #fde047;
    padding: 6px 10px;
    border-radius: 10px;
    font-size: 10.5px;
    line-height: 1.4;
    font-weight: 800;
    text-align: right;
    margin-bottom: 6px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.8);
}

.btn-uno-shout {
    background: linear-gradient(135deg, #ea580c, #dc2626);
    color: #ffffff;
    font-family: 'Outfit', sans-serif;
    font-size: 20px;
    font-weight: 900;
    padding: 12px 28px;
    border-radius: 999px;
    border: 3px solid #fef08a;
    box-shadow: 0 0 25px rgba(234, 88, 12, 0.7);
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-uno-shout:hover { transform: scale(1.06); box-shadow: 0 0 35px #facc15; }
.btn-uno-shout.active-blink {
    animation: unoButtonBlink 0.4s infinite alternate;
}
@keyframes unoButtonBlink {
    from { transform: scale(1); box-shadow: 0 0 20px #ef4444; }
    to { transform: scale(1.1); box-shadow: 0 0 40px #facc15; }
}

/* MODALS */
.modal-screen {
    position: fixed;
    inset: 0;
    background: rgba(3, 7, 18, 0.92);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.modal-box {
    background: #0f172a;
    border: 2px solid #334155;
    border-radius: 20px;
    padding: 22px 20px;
    max-width: 500px;
    width: 92%;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0,0,0,0.85);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-box h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 24px;
    color: var(--accent-blue);
    margin-bottom: 4px;
    font-weight: 900;
}

.modal-tabs {
    display: flex;
    gap: 6px;
    background: #1e293b;
    padding: 4px;
    border-radius: 12px;
    margin: 14px 0;
}
.tab-btn {
    flex: 1;
    padding: 8px 6px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: #94a3b8;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s;
}
.tab-btn.active {
    background: #0b4bc1;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(11, 75, 193, 0.4);
}

.tab-content { display: none; text-align: left; }
.tab-content.active { display: block; }

.avatar-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin: 12px 0;
}

.avatar-opt {
    background: #1e293b;
    border: 2px solid #334155;
    border-radius: 12px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}
.avatar-opt:hover, .avatar-opt.active {
    border-color: #38bdf8;
    background: #0284c7;
    transform: scale(1.06);
}
.avatar-opt svg { width: 75%; height: 75%; }

.btn-primary-action {
    width: 100%;
    background: linear-gradient(135deg, #0284c7, #2563eb);
    color: #ffffff;
    border: none;
    padding: 13px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 900;
    cursor: pointer;
    text-transform: uppercase;
    box-shadow: 0 4px 18px rgba(2, 132, 199, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
}

.recharge-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin: 10px 0;
}
.recharge-card {
    background: #1e293b;
    border: 1.5px solid #334155;
    border-radius: 12px;
    padding: 12px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
}
.recharge-card.active-pack { border-color: #22c55e; }
.recharge-card.inactive-pack { opacity: 0.45; cursor: not-allowed; border-style: dashed; }

.recharge-card .coin-val { font-size: 16px; font-weight: 900; color: #facc15; font-family:'Outfit'; }
.recharge-card .price-tag {
    background: #059669;
    color: #fff;
    padding: 6px 14px;
    border-radius: 8px;
    font-weight: 900;
    font-size: 13px;
}

.rules-card {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 8px;
    font-size: 12px;
    line-height: 1.6;
    color: #cbd5e1;
}
.rules-card b { color: #facc15; }

.color-pick-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 16px 0;
}
.btn-color-pick {
    height: 60px;
    border-radius: 12px;
    border: 2px solid #fff;
    cursor: pointer;
    font-weight: 900;
    font-size: 16px;
    color: #fff;
}

/* ================= MOBILE LAYOUT (<= 850px) =================
   Idea: nothing floats or overlaps. Page flows top-to-bottom:
   nav -> info -> alert -> UNO button -> table (seats ring + hub + you + your cards)
   Seats sit in a grid around the centre hub, cards wrap into rows (no hidden/scroll cards). */
@media (max-width: 850px) {
    :root { --mc-w: 54px; --mc-h: 81px; }

    body { min-height: 100vh; min-height: 100dvh; }

    /* ---- NAVBAR: compact, not sticky (so it never covers the table) ---- */
    .game-nav {
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-between;
        align-items: center;
        gap: 8px;
        padding: 8px 10px;
    }
    .nav-right-actions { display: contents; }
    .brand-link        { order: 1; }
    .coin-pill         { order: 2; padding: 4px 10px; font-size: 12px; }
    .music-bar-container { order: 3; flex: 1 1 100%; justify-content: space-between; padding: 3px 10px; }
    .volume-slider     { flex: 1; width: auto; max-width: 160px; }
    .user-status-text  { order: 4; flex: 1 1 0; min-width: 0; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .btn-leave-table   { order: 5; }
    .btn-game-dash     { order: 6; }
    .btn-action        { padding: 6px 9px; font-size: 11px; }

    /* ---- ARENA: simple vertical flow ---- */
    .arena-container {
        justify-content: flex-start;
        padding: 8px 8px calc(16px + env(safe-area-inset-bottom, 0px));
    }
    .table-info-strip {
        order: 1;
        flex-direction: column;
        align-items: center;
        gap: 2px;
        text-align: center;
        font-size: 11px;
        padding: 0;
        margin-bottom: 6px;
    }

    /* UNO alert: in-flow (not floating). Space is reserved so the table never jumps. */
    .uno-alert-slot { display: block; order: 3; width: 100%; min-height: 34px; margin: 10px 0 6px; }
    .uno-alert-banner {
        position: static;
        transform: none;
        width: 100%;
        font-size: 11.5px;
        line-height: 1.25;
        padding: 6px 10px;
        border-radius: 14px;
        animation: pulseBannerMobile 0.5s infinite alternate;
    }

    /* Order on mobile: table -> UNO alert -> UNO button -> instruction note (right under the button) */
    .uno-control-group { display: contents; }
    .btn-uno-shout {
        order: 4;
        width: 100%;
        margin-bottom: 8px;
        font-size: 16px;
        padding: 7px 18px;
    }
    .btn-uno-shout:hover { transform: none; }
    .btn-uno-shout.active-blink { animation-name: unoButtonBlinkMobile; }
    .uno-warning-note {
        order: 5;
        width: 100%;
        margin: 0;
        text-align: center;
        font-size: 10.5px;
        line-height: 1.45;
        padding: 7px 10px;
    }

    /* ---- TABLE: rounded box, grid inside ---- */
    .oval-table-wrapper {
        order: 2;
        height: auto;
        border-radius: 30px;
        border-width: 5px;
        padding: 5px;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), inset 0 0 14px rgba(0, 0, 0, 0.8);
    }
    .table-felt {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        grid-template-areas:
            "s2 s3 s4 s5"
            "s1 hub hub s6"
            "s0 s0 s0 s0"
            "hand hand hand hand";
        gap: 10px 8px;
        align-items: start;
        justify-items: center;
        padding: 10px 6px 8px;
        border-radius: 24px;
        border-width: 2px;
    }

    /* ---- SEATS: normal grid items, no absolute positions ---- */
    .table-felt .seat {
        position: static;
        top: auto; right: auto; bottom: auto; left: auto;
        transform: none;
        width: 100%;
        min-width: 0;
        gap: 2px;
    }
    .table-felt .seat-0 { grid-area: s0; flex-direction: row; justify-content: center; gap: 10px; }
    .table-felt .seat-1 { grid-area: s1; }
    .table-felt .seat-2 { grid-area: s2; }
    .table-felt .seat-3 { grid-area: s3; }
    .table-felt .seat-4 { grid-area: s4; }
    .table-felt .seat-5 { grid-area: s5; }
    .table-felt .seat-6 { grid-area: s6; }

    .seat-ring-wrap, .timer-svg { width: 54px; height: 54px; }
    .seat-avatar-box { width: 40px; height: 40px; border-width: 2px; }
    .seat-ring-wrap { flex-shrink: 0; }
    .timer-circle-bg { stroke: rgba(255, 255, 255, 0.22); stroke-width: 5.5; }
    .timer-circle-progress { stroke-width: 6; }
    .seat:not(.active-turn) .timer-circle-progress { opacity: 0.35; }
    .timer-sec { font-size: 9px; padding: 2px 4px; right: -6px; }
    .seat-name { font-size: 10px; max-width: 100%; padding: 1px 6px; }
    .seat-card-count-badge { font-size: 9px; padding: 1px 6px; }
    .seat.vacant .seat-name { white-space: normal; line-height: 1.15; border-radius: 10px; text-align: center; }
    .opp-card-pile { margin-top: 0; min-height: 21px; }
    .uno-card-back-mini { width: 14px; height: 21px; margin-left: -8px; }
    .opp-card-pile .uno-card-back-mini:first-child { margin-left: 0; }

    /* ---- CENTRE HUB: deck + discard ---- */
    .table-center-hub {
        grid-area: hub;
        width: 100%;
        justify-content: center;
        gap: 10px;
        padding: 30px 8px 10px; /* top space is reserved for the +2/+4 stack badge */
        border-radius: 16px;
    }
    .stack-counter-badge {
        top: 7px; left: 6px; right: 6px;
        transform: none;
        text-align: center;
        font-size: 10px;
        padding: 3px 4px;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    /* active colour is shown as a colour border around the hub (JS still sets borderColor) */
    .color-indicator-ring {
        inset: -2px;
        width: auto;
        height: auto;
        border-radius: 18px;
        border-width: 4px;
        opacity: 0.9;
        animation: none;
    }
    .deck-stack {
        width: var(--mc-w);
        height: var(--mc-h);
        box-shadow: -3px 4px 8px rgba(0, 0, 0, 0.7), -5px 6px 0 #1e293b;
    }
    .deck-stack div { font-size: 14px !important; }

    /* ---- YOUR HAND: wraps into rows - every card visible, no overlap, no sideways scroll ---- */
    .human-hand-wrapper {
        grid-area: hand;
        position: static;
        width: 100%;
        max-width: none;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        align-items: flex-start;
        gap: 6px;
        overflow: visible;
        padding: 8px 0 2px;
        border-top: 1px dashed rgba(255, 255, 255, 0.15);
    }
    .uno-card {
        width: var(--mc-w);
        height: var(--mc-h);
        margin: 0;
        border-width: 2px;
        border-radius: 7px;
    }
    .uno-card:hover  { transform: none; margin: 0; }
    .uno-card:active { transform: scale(0.94); }
    .uno-card.playable { box-shadow: 0 0 0 2px #38bdf8, 0 0 12px rgba(56, 189, 248, 0.8); }
    .center-glyph { font-size: 22px; }
    .card-corner  { font-size: 9px; }
    .corner-tl { top: 2px; left: 3px; }
    .corner-br { bottom: 2px; right: 3px; }

    /* ---- MODALS: fit the screen, nothing cut off ---- */
    .modal-screen { padding: 8px; }
    .modal-box { width: 100%; max-height: 92vh; max-height: 92dvh; padding: 16px 14px; }
    .modal-box h2 { font-size: 21px; }
    .modal-tabs { display: grid; grid-template-columns: 1fr 1fr; }
    .avatar-opt { height: 52px; }
}

/* very small phones */
@media (max-width: 380px) {
    :root { --mc-w: 46px; --mc-h: 69px; }
    .center-glyph { font-size: 19px; }
    .brand-tag { font-size: 10px; }
    .uno-warning-note { font-size: 9px; }
    .btn-uno-shout { font-size: 15px; padding: 8px 14px; }
}
