* { box-sizing: border-box; margin: 0; padding: 0; }
body { 
    background-color: #1a1a1a; 
    color: white; 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; 
    overflow: hidden; 
    user-select: none;
    -webkit-user-select: none;
}
.game-container { 
    position: relative; 
    width: 100vw; 
    height: 100vh; 
    max-width: 600px;
    margin: 0 auto;
    display: flex; 
    flex-direction: column; 
    justify-content: space-between; 
}
.sound-toggle {
    position: absolute;
    top: max(14px, env(safe-area-inset-top));
    right: 16px;
    z-index: 30;
    width: auto;
    min-width: 72px;
    min-height: 40px;
    padding: 8px 12px;
    border-radius: 20px;
    background: rgba(0,0,0,0.58);
    border: 1px solid rgba(255,255,255,0.35);
    color: #fff;
    font-size: 14px;
    box-shadow: 0 3px 8px rgba(0,0,0,0.35);
}
.table { 
    position: relative; 
    flex: 1; 
    background: #0d8233; 
    border: 10px solid #4a2c16; 
    border-radius: 120px; 
    margin: 60px 20px 80px 20px; 
    box-shadow: inset 0 0 40px rgba(0,0,0,0.6), 0 0 20px rgba(0,0,0,0.8); 
}
.pot { 
    position: absolute; 
    top: 50%; 
    left: 50%; 
    transform: translate(-50%, -50%); 
    background: rgba(0,0,0,0.7); 
    padding: 8px 20px; 
    border-radius: 20px; 
    font-size: 16px; 
    font-weight: bold; 
    color: #ffca28; 
    z-index: 10; 
    border: 1px solid #ffca28;
}
.pool-info {
    margin-top: 4px;
    color: #d7f7df;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.25;
    max-width: 210px;
}
.seat { 
    position: absolute; 
    width: 132px; 
    text-align: center; 
}
.seat-top { top: -40px; left: 50%; transform: translateX(-50%); }
.seat-left { top: 50%; left: 0; transform: translateY(-50%); }
.seat-right { top: 50%; right: 0; transform: translateY(-50%); }
.seat-bottom { bottom: -52px; left: 50%; width: 180px; transform: translateX(-50%); }

.avatar { 
    width: 50px; 
    height: 50px; 
    background: linear-gradient(135deg, #444, #222); 
    border-radius: 50%; 
    margin: 0 auto; 
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px; 
    border: 2px solid #aaa; 
    color: #eee;
    white-space: nowrap;
}
.seat.active .avatar { 
    border-color: #ffeb3b; 
    box-shadow: 0 0 15px #ffeb3b; 
}
.seat.time-warning .avatar {
    border-color: #ff7043;
    box-shadow: 0 0 18px #ff7043;
}
.money { 
    font-size: 12px; 
    margin-top: 4px; 
    color: #ffca28; 
    background: rgba(0,0,0,0.6); 
    border-radius: 10px;
    padding: 2px 0;
}
.status { 
    font-size: 12px; 
    color: #fff; 
    height: 16px; 
    margin-top: 2px; 
    text-shadow: 1px 1px 2px #000;
}
.timer {
    display: none;
    position: absolute;
    top: -10px;
    right: 25px;
    z-index: 5;
    min-width: 36px;
    padding: 3px 8px;
    border: 1px solid #4caf50;
    border-radius: 12px;
    background: rgba(26,26,26,0.9);
    color: #4caf50;
    font-size: 13px;
    font-weight: 700;
    line-height: 18px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.6);
    pointer-events: none;
}
.seat.active .timer {
    display: block;
}
.seat.time-warning .timer {
    color: #ff3b30;
    border-color: #ff3b30;
    text-shadow: 0 0 5px rgba(255,59,48,0.5);
    animation: timer-pulse 0.8s infinite alternate;
}
@keyframes timer-pulse {
    from {
        transform: scale(1);
        box-shadow: 0 0 5px rgba(255,59,48,0.6);
    }
    to {
        transform: scale(1.15);
        box-shadow: 0 0 15px rgba(255,59,48,1);
    }
}
.cards { 
    display: flex; 
    justify-content: center; 
    margin-top: 4px; 
    height: 58px; 
}
.card { 
    width: 42px; 
    height: 58px; 
    background: white; 
    border-radius: 4px; 
    border: 1px solid #999; 
    margin-left: -20px; 
    position: relative; 
    color: black; 
    box-shadow: 2px 2px 4px rgba(0,0,0,0.4); 
    z-index: 1;
    flex: 0 0 auto;
    padding: 2px 4px;
}
.card:first-child {
    margin-left: 0;
}
.card:nth-child(1) { transform: rotate(-8deg) translateY(2px); z-index: 1; }
.card:nth-child(2) { transform: rotate(0deg) translateY(-2px); z-index: 2; }
.card:nth-child(3) { transform: rotate(8deg) translateY(2px); z-index: 3; }

.card-value {
    font-size: 15px;
    font-weight: bold;
    line-height: 1;
    text-align: left;
}
.card-suit {
    font-size: 16px;
    line-height: 1;
    text-align: left;
}

.seat-bottom .cards {
    height: 72px;
}

.seat-bottom .card {
    width: 56px;
    height: 78px;
    margin-left: -26px;
    padding: 4px 6px;
}
.seat-bottom .card:first-child {
    margin-left: 0;
}
.seat-bottom .card-value {
    font-size: 18px;
}
.seat.selectable {
    cursor: pointer;
}
.seat.selectable .avatar {
    border-color: #ffeb3b;
    animation: pulse-glow 1s infinite;
}
@keyframes pulse-glow {
    0% { box-shadow: 0 0 6px #ffeb3b; }
    50% { box-shadow: 0 0 18px #ffca28; }
    100% { box-shadow: 0 0 6px #ffeb3b; }
}

.card.back { 
    background: repeating-linear-gradient(45deg, #b71c1c, #b71c1c 5px, #fff 5px, #fff 10px); 
    color: transparent; 
}
.card.red { color: #d32f2f; }
.card.black { color: #212121; }

.action-bar, .start-bar { 
    background: #2a2a2a; 
    padding: 15px 10px calc(15px + env(safe-area-inset-bottom)); 
    display: flex; 
    justify-content: space-around; 
    flex-wrap: wrap; 
    gap: 10px; 
    border-top: 2px solid #111;
}
button { 
    background: linear-gradient(180deg, #ffca28, #f57c00); 
    border: 1px solid #e65100; 
    padding: 12px 10px; 
    border-radius: 8px; 
    font-weight: bold; 
    color: #3e2723; 
    flex: 1 1 30%; 
    min-width: 60px; 
    font-size: 15px; 
    box-shadow: 0 4px 6px rgba(0,0,0,0.4); 
    transition: transform 0.1s, filter 0.1s; 
}
button:active { 
    transform: translateY(2px); 
    box-shadow: 0 1px 3px rgba(0,0,0,0.4); 
}
button:disabled { 
    background: #555; 
    color: #888; 
    border-color: #444;
    box-shadow: none; 
}
#message-box { 
    position: absolute; 
    top: 30%; 
    left: 50%; 
    transform: translate(-50%, -50%); 
    background: rgba(0,0,0,0.85); 
    color: #fff; 
    padding: 12px 24px; 
    border-radius: 8px; 
    font-size: 16px; 
    pointer-events: none; 
    opacity: 0; 
    transition: opacity 0.3s; 
    z-index: 100; 
    text-align: center;
    border: 1px solid #444;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}
