body {
    font-family: 'Segoe UI', sans-serif;
    background-color: #111a11;
    color: white;
    margin: 0;
    padding-top: 60px;
    box-sizing: border-box;
}

header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background-color: #0a150a;
    box-shadow: 0 2px 10px rgba(0,0,0,0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(234,42,51,0.15);
}

.header-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-left button {
    width: 110px;
    height: 38px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    text-align: center;
    font-size: 0.85em;
    box-sizing: border-box;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: #ccc;
    border-radius: 6px;
    transition: all 0.2s;
}

.nav-left button:hover {
    background: rgba(234,42,51,0.15);
    border-color: rgba(234,42,51,0.3);
    color: #ea2a33;
}

#auth-buttons button {
    width: 90px;
    height: 38px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    text-align: center;
    font-size: 0.85em;
    box-sizing: border-box;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    justify-content: flex-end;
}

main {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: calc(100vh - 60px);
    padding: 20px;
    box-sizing: border-box;
}

/* ===== GAME WRAPPER & LAYOUT ===== */

#game-wrapper {
    display: flex;
    flex-direction: row;
    gap: 16px;
    max-width: 1400px;
    width: 100%;
    align-items: flex-start;
}

#center-column {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 0;
}

/* ===== LEFT PANEL: GAME INFO ===== */

#game-info-panel {
    flex: 0 0 300px;
    background: linear-gradient(180deg, #0f1f0f 0%, #0a150a 100%);
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    text-align: left;
    display: flex;
    flex-direction: column;
    position: relative;
    border: 1px solid rgba(255,255,255,0.06);
}

/* ===== RIGHT COLUMN ===== */

#right-column {
    flex: 0 0 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

/* ===== GAME TABLE (FELT) ===== */

#game-container {
    background-color: #1a472a;
    background-image:
        radial-gradient(ellipse at 50% 40%, rgba(255,255,255,0.06) 0%, transparent 60%),
        radial-gradient(circle at 50% 50%, rgba(255,255,255,0.03) 0%, rgba(0,0,0,0.35) 100%);
    border: 14px solid #2a1510;
    border-radius: 28px;
    box-shadow:
        0 20px 50px rgba(0,0,0,0.6),
        inset 0 0 80px rgba(0,0,0,0.15),
        0 0 0 1px rgba(255,255,255,0.08);
    padding: 28px 24px;
    min-height: 500px;
    text-align: center;
    position: relative;
    overflow: hidden;
    min-width: 380px;
}


/* ===== GAME BOARD ===== */

#game-board {
    margin: 16px 0;
    position: relative;
    z-index: 1;
}

/* Area labels (Dealer / Player) */
.area-label {
    display: inline-block;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(6px);
    padding: 5px 18px;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.06);
    font-size: 0.7em;
    color: rgba(255,255,255,0.55);
    text-transform: uppercase;
    letter-spacing: 0.2em;
    font-weight: 600;
    margin-bottom: 8px;
}

/* Keep h2 for backward compatibility but style as area-label */
#game-board h2 {
    display: inline-block;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(6px);
    padding: 5px 18px;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.06);
    font-size: 0.7em;
    color: rgba(255,255,255,0.55);
    text-transform: uppercase;
    letter-spacing: 0.2em;
    font-weight: 600;
    margin: 8px 0;
}

/* ===== CURRENT BET DISPLAY ===== */

#current-bet-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin: 14px 0;
    min-height: 20px;
}

#current-bet-display:empty {
    display: none;
}

.bet-label {
    font-size: 0.6em;
    color: #f59e0b;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    font-weight: 700;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.bet-chips-row {
    display: flex;
    gap: 6px;
    align-items: flex-end;
}

/* ===== PLAYER CHIPS DISPLAY ===== */

#player-chips-display {
    position: absolute;
    right: 12px;
    bottom: 15%;
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
}

#player-chips-display:empty {
    display: none;
}

.player-chips-label {
    font-size: 0.55em;
    color: rgba(255,255,255,0.45);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-weight: 600;
}

.player-chips-stack {
    display: flex;
    flex-direction: column;
    gap: 3px;
    align-items: center;
}

/* ===== CHIP VISUAL ===== */

.chip-visual {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.chip-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 3px dashed;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6em;
    font-weight: 800;
    box-shadow: 0 3px 8px rgba(0,0,0,0.5), inset 0 1px 3px rgba(255,255,255,0.2);
    position: relative;
    flex-shrink: 0;
}

.chip-icon-sm {
    width: 28px;
    height: 28px;
    font-size: 0.4em;
    border-width: 2px;
}

/* Las Vegas standard chip colors */
.chip-1    { background: linear-gradient(to bottom, #f5f5f5, #d4d4d4); color: #333; border-color: rgba(0,0,0,0.25); }
.chip-5    { background: linear-gradient(to bottom, #ef4444, #b91c1c); color: #fff; border-color: rgba(255,255,255,0.5); }
.chip-25   { background: linear-gradient(to bottom, #22c55e, #15803d); color: #fff; border-color: rgba(255,255,255,0.5); }
.chip-100  { background: linear-gradient(to bottom, #1f2937, #000000); color: #fff; border-color: rgba(255,255,255,0.5); }
.chip-500  { background: linear-gradient(to bottom, #8b5cf6, #6d28d9); color: #fff; border-color: rgba(255,255,255,0.5); }
.chip-1000 { background: linear-gradient(to bottom, #f97316, #ea580c); color: #fff; border-color: rgba(255,255,255,0.5); }

.chip-count {
    font-size: 0.55em;
    color: rgba(255,255,255,0.55);
    font-weight: 600;
}

/* ===== CARD HANDS ===== */

.hand {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    min-height: 120px;
    background: rgba(20, 60, 30, 0.5);
    border-radius: 16px;
    padding: 12px;
    margin-top: 8px;
    border: 1px solid rgba(255,255,255,0.04);
    backdrop-filter: blur(2px);
}

/* Stacked hand (5+ cards) */
.hand-stacked {
    flex-wrap: nowrap !important;
}

.hand-stacked .card + .card {
    margin-left: -48px;
}

.hand.split-hand {
    border: 2px solid #f59e0b;
    min-width: 45%;
    margin: 5px;
}

.hand.active {
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.4);
}

/* Score display inside hand */
.hand h3 {
    width: 100%;
    text-align: center;
    color: white;
    font-size: 0.8em;
    margin: 0 0 8px 0;
}

.hand .score-badge {
    display: inline-block;
    background: rgba(0,0,0,0.4);
    padding: 4px 14px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.1);
    font-size: 0.8em;
}

#player-hands-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
}

/* ===== PLAYING CARDS ===== */

.card {
    width: 68px;
    height: 98px;
    background-color: white;
    border: none;
    border-radius: 8px;
    margin: 0 3px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 5px;
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(0,0,0,0.35), 0 1px 3px rgba(0,0,0,0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    cursor: default;
    font-size: 0.9em;
    color: black;
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.45);
}

.card-red {
    color: #dc2626;
}

.card-black {
    color: #1a1a1a;
}

.card-corner {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1;
    gap: 0;
}

.card-top-left {
    align-self: flex-start;
}

.card-bottom-right {
    align-self: flex-end;
    transform: rotate(180deg);
}

.card-rank {
    font-size: 1em;
    font-weight: 800;
    line-height: 1.1;
}

.card-suit-small {
    font-size: 0.65em;
    line-height: 1;
}

.card-center-suit {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2em;
    opacity: 0.8;
    pointer-events: none;
}

/* ===== CARD PIP LAYOUT ===== */

.card-pips {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.pip {
    position: absolute;
    transform: translate(-50%, -50%);
    font-size: 0.9em;
    line-height: 1;
    opacity: 0.85;
}

.pip-lg {
    font-size: 2em;
}

.pip-flip {
    transform: translate(-50%, -50%) rotate(180deg);
}

.card-center-face {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.6em;
    font-weight: 900;
    opacity: 0.8;
    text-align: center;
    line-height: 1;
    pointer-events: none;
}

.card-face-suit {
    font-size: 0.55em;
    font-weight: normal;
    margin-top: 2px;
}

/* Card back (hidden/face down) */
.card.hidden-card {
    background: linear-gradient(135deg, #b91c1c 0%, #991b1b 50%, #7f1d1d 100%);
    border: 2px solid rgba(255,255,255,0.2);
    color: transparent;
    overflow: hidden;
}

.card.hidden-card .card-back-pattern {
    position: absolute;
    inset: 4px;
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.15);
    background-image: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 4px,
        rgba(255,255,255,0.08) 4px,
        rgba(255,255,255,0.08) 5px
    );
}

.card.hidden-card .card-back-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid rgba(234,42,51,0.4);
    background: rgba(0,0,0,0.25);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.4);
    font-size: 0.7em;
}

.card.gold-card-back {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 50%, #b45309 100%);
    border: 2px solid rgba(255,255,255,0.3);
}

/* ===== SCORE BUBBLE ===== */

.score-bubble {
    display: inline-block;
    background: #ea2a33;
    color: white;
    font-weight: bold;
    font-size: 0.95em;
    padding: 4px 14px;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(234,42,51,0.4);
    border: 1px solid rgba(255,255,255,0.15);
    margin-bottom: 6px;
}

.score-bubble.bust {
    background: #555;
}

.score-bubble.blackjack {
    background: linear-gradient(135deg, #f59e0b, #ea2a33);
}

/* ===== ACTION BUTTONS (Circular) ===== */

#controls {
    margin-top: 16px;
    position: relative;
    z-index: 2;
}

#action-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
    padding: 8px 0;
    margin-bottom: 0;
}

/* Hand gesture animation */
.hand-gesture {
    position: absolute;
    pointer-events: none;
    font-size: 2.86rem;
    z-index: 100;
    opacity: 0;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.5));
}

/* Hit: 테이블을 톡톡 두드리는 모션 (아래로 탭) */
.hand-gesture.gesture-hit {
    animation: gesture-tap 0.7s ease-out forwards;
}
@keyframes gesture-tap {
    0%   { opacity: 1; transform: translate(-50%, -20px) rotate(0deg); }
    30%  { transform: translate(-50%, 0px) rotate(5deg); }
    50%  { transform: translate(-50%, -10px) rotate(-3deg); }
    70%  { transform: translate(-50%, 0px) rotate(2deg); }
    85%  { opacity: 1; transform: translate(-50%, -5px) rotate(0deg); }
    100% { opacity: 0; transform: translate(-50%, -30px) rotate(0deg); }
}

/* Stand: 손바닥을 좌우로 흔드는 모션 */
.hand-gesture.gesture-stand {
    animation: gesture-wave 0.8s ease-out forwards;
}
@keyframes gesture-wave {
    0%   { opacity: 1; transform: translate(-50%, -10px) rotate(0deg); }
    20%  { transform: translate(-30%, -10px) rotate(-15deg); }
    40%  { transform: translate(-70%, -10px) rotate(15deg); }
    60%  { transform: translate(-35%, -10px) rotate(-10deg); }
    80%  { opacity: 1; transform: translate(-65%, -10px) rotate(10deg); }
    100% { opacity: 0; transform: translate(-50%, -30px) rotate(0deg); }
}

/* Double Down: 손가락 하나를 세우며 아래로 찍는 모션 */
.hand-gesture.gesture-double {
    animation: gesture-point 0.7s ease-out forwards;
}
@keyframes gesture-point {
    0%   { opacity: 1; transform: translate(-50%, -30px) scale(0.8); }
    40%  { transform: translate(-50%, 0px) scale(1.15); }
    60%  { transform: translate(-50%, -5px) scale(1); }
    80%  { opacity: 1; transform: translate(-50%, 0px) scale(1.05); }
    100% { opacity: 0; transform: translate(-50%, -30px) scale(0.8); }
}

/* Split: 두 손가락을 벌리는 V 모션 */
.hand-gesture.gesture-split {
    animation: gesture-split-v 0.8s ease-out forwards;
}
@keyframes gesture-split-v {
    0%   { opacity: 1; transform: translate(-50%, -10px) scale(0.7); }
    30%  { transform: translate(-50%, -5px) scale(1.2); }
    60%  { opacity: 1; transform: translate(-50%, -10px) scale(1.3); }
    100% { opacity: 0; transform: translate(-50%, -30px) scale(1); }
}

/* Surrender: 손을 흔들며 뒤로 빠지는 모션 */
.hand-gesture.gesture-surrender {
    animation: gesture-surrender-wave 0.8s ease-out forwards;
}
@keyframes gesture-surrender-wave {
    0%   { opacity: 1; transform: translate(-50%, -10px) rotate(0deg) scale(1); }
    15%  { transform: translate(-40%, -10px) rotate(-20deg) scale(1); }
    30%  { transform: translate(-60%, -10px) rotate(20deg) scale(1); }
    50%  { transform: translate(-45%, -10px) rotate(-15deg) scale(0.95); }
    70%  { opacity: 0.8; transform: translate(-55%, -15px) rotate(10deg) scale(0.9); }
    100% { opacity: 0; transform: translate(-50%, -40px) rotate(0deg) scale(0.6); }
}

/* Reset all action buttons to circular style */
#action-controls button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    transition: all 0.2s ease;
    padding: 0;
    line-height: 1.2;
    cursor: pointer;
    position: relative;
    overflow: visible;
}

/* Stand button */
#stand-btn {
    width: 44px;
    height: 44px;
    background: linear-gradient(to bottom, #374151, #111827);
    border: 3px dashed #4b5563;
    color: white;
    font-size: 0.5em;
    box-shadow: 0 3px 8px rgba(0,0,0,0.5), inset 0 1px 3px rgba(255,255,255,0.2);
}

#stand-btn:hover:not(:disabled) {
    transform: scale(1.08);
    border-color: #9ca3af;
    box-shadow: 0 4px 12px rgba(0,0,0,0.6);
}

/* Hit button (primary) */
#hit-btn {
    width: 44px;
    height: 44px;
    background: linear-gradient(to bottom, #ea2a33, #b91c1c);
    border: 3px dashed #ef4444;
    color: white;
    font-size: 0.55em;
    box-shadow: 0 3px 8px rgba(234,42,51,0.5), inset 0 1px 3px rgba(255,255,255,0.2);
    z-index: 1;
    position: relative;
}

#hit-btn::after {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(234,42,51,0.15) 0%, transparent 70%);
    pointer-events: none;
}

#hit-btn:hover:not(:disabled) {
    transform: scale(1.12);
    border-color: #f87171;
    box-shadow: 0 4px 16px rgba(234,42,51,0.6);
}

/* Double button */
#double-down-btn {
    width: 44px;
    height: 44px;
    background: linear-gradient(to bottom, #d97706, #92400e);
    border: 3px dashed #f59e0b;
    color: white;
    font-size: 0.45em;
    box-shadow: 0 3px 8px rgba(217,119,6,0.4), inset 0 1px 3px rgba(255,255,255,0.2);
}

#double-down-btn:hover:not(:disabled) {
    transform: scale(1.08);
    border-color: #fbbf24;
    box-shadow: 0 4px 12px rgba(217,119,6,0.5);
}

/* Split button */
#split-btn {
    width: 44px;
    height: 44px;
    background: linear-gradient(to bottom, #374151, #1f2937);
    border: 3px dashed #4b5563;
    color: #d1d5db;
    font-size: 0.45em;
    box-shadow: 0 3px 8px rgba(0,0,0,0.4), inset 0 1px 3px rgba(255,255,255,0.2);
}

#split-btn:hover:not(:disabled) {
    transform: scale(1.08);
    border-color: #6b7280;
}

/* Surrender button */
#surrender-btn {
    width: 44px;
    height: 44px;
    background: linear-gradient(to bottom, #374151, #1f2937);
    border: 3px dashed #4b5563;
    color: #d1d5db;
    font-size: 0.42em;
    box-shadow: 0 3px 8px rgba(0,0,0,0.4), inset 0 1px 3px rgba(255,255,255,0.2);
}

#surrender-btn:hover:not(:disabled) {
    transform: scale(1.08);
    background: linear-gradient(to bottom, #7f1d1d, #450a0a);
    border-color: #991b1b;
    color: #fca5a5;
}

/* Disabled state for action buttons */
#action-controls button:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2) !important;
    filter: saturate(0.3);
}

/* Strategy feedback flash/correct overrides */
#action-controls .flashing-red {
    animation: red-flash-ring 0.5s 6;
}

#action-controls .correct-blue {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 20px rgba(59,130,246,0.6) !important;
}

@keyframes red-flash-ring {
    50% { border-color: #ef4444; box-shadow: 0 0 20px rgba(234,42,51,0.7); }
}

/* ===== OPTIONS AREA ===== */

#options-area {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 10px;
}

#options-area label {
    font-size: 0.75em;
    color: rgba(255,255,255,0.5);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

#options-area input[type="number"] {
    width: 55px;
    padding: 5px 8px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(0,0,0,0.3);
    color: white;
    text-align: center;
    font-size: 0.9em;
}

#options-area button {
    padding: 5px 14px;
    border-radius: 8px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.7);
    font-size: 0.75em;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

#options-area button:hover {
    background: rgba(255,255,255,0.15);
    color: white;
}

/* ===== BETTING CONTROLS ===== */

#betting-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    position: relative;
    z-index: 2;
    margin-bottom: 10px;
}

#betting-controls input[type="number"] {
    width: 80px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(0,0,0,0.35);
    color: white;
    text-align: center;
    font-size: 1em;
    font-weight: bold;
}

#betting-controls button {
    padding: 10px 24px;
    border-radius: 10px;
    background: linear-gradient(to bottom, #f59e0b, #d97706);
    border: none;
    color: #1a1a2e;
    font-weight: bold;
    font-size: 0.95em;
    box-shadow: 0 4px 14px rgba(245,158,11,0.35);
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

#betting-controls button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(245,158,11,0.5);
    background: linear-gradient(to bottom, #fbbf24, #f59e0b);
}

/* ===== MESSAGE AREA ===== */

#message-area {
    font-size: 1em;
    font-weight: 600;
    min-height: 30px;
    margin-bottom: 14px;
    padding: 10px 14px;
    background: rgba(234,42,51,0.08);
    border-radius: 10px;
    border-left: 3px solid #ea2a33;
    color: #fca5a5;
}

#log-area {
    font-size: 0.8em;
    height: 140px;
    overflow-y: auto;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 10px;
    margin-top: 8px;
    padding: 8px;
    text-align: left;
    background: rgba(0,0,0,0.2);
    color: rgba(255,255,255,0.7);
}

#log-area::-webkit-scrollbar {
    width: 4px;
}

#log-area::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.15);
    border-radius: 4px;
}

/* ===== CARD DISPLAY AREA ===== */

#card-display-area {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 8px;
    background: rgba(0,0,0,0.15);
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.06);
}

#card-display-toggle-btn {
    margin-bottom: 5px;
    padding: 4px 16px;
    border-radius: 20px;
    background: rgba(234,42,51,0.15);
    border: 1px solid rgba(234,42,51,0.3);
    color: #ea2a33;
    font-size: 0.75em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: all 0.2s;
}

#card-display-toggle-btn:hover {
    background: rgba(234,42,51,0.25);
}

#card-display-content {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2px;
    width: 284px;
    flex-shrink: 0;
    box-sizing: border-box;
}

#card-display-area .mini-card {
    width: 20px;
    height: 30px;
    background-color: white;
    color: black;
    border-radius: 3px;
    font-size: 0.7em;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    box-sizing: border-box;
    transition: opacity 0.3s;
}

#card-display-area .mini-card.dealt-card {
    background-color: #333;
    color: #666;
    opacity: 0.3;
}

/* ===== USER AREA ===== */

#user-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: linear-gradient(180deg, #0f1f0f 0%, #0a150a 100%);
    border-radius: 16px;
    padding: 14px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    width: 100%;
    box-sizing: border-box;
    border: 1px solid rgba(255,255,255,0.06);
}

#user-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
    font-size: 0.85em;
}

#user-chips-line {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #f59e0b;
    font-weight: 600;
}

#card-stats-line {
    color: rgba(255,255,255,0.6);
    font-size: 0.85em;
}

#user-area-toggle-btn,
#strategy-guide-toggle-btn {
    padding: 4px 16px;
    border-radius: 20px;
    background: rgba(234,42,51,0.15);
    border: 1px solid rgba(234,42,51,0.3);
    color: #ea2a33;
    font-size: 0.75em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: all 0.2s;
}

#user-area-toggle-btn:hover,
#strategy-guide-toggle-btn:hover {
    background: rgba(234,42,51,0.25);
}

/* ===== STRATEGY GUIDE PANEL ===== */

#strategy-guide-panel {
    background: linear-gradient(180deg, #0f1f0f 0%, #0a150a 100%);
    border-radius: 16px;
    padding: 14px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    text-align: left;
    height: fit-content;
    width: 100%;
    box-sizing: border-box;
    border: 1px solid rgba(255,255,255,0.06);
}

#strategy-guide-panel h3 {
    text-align: center;
    margin-top: 0;
    color: #ea2a33;
    font-size: 1em;
    letter-spacing: 0.05em;
}

#strategy-guide-panel h4 {
    margin-top: 12px;
    margin-bottom: 5px;
    color: #f59e0b;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    padding-bottom: 5px;
    font-size: 0.85em;
}

.strategy-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75em;
    margin-bottom: 12px;
}

.strategy-table th, .strategy-table td {
    border: 1px solid rgba(255,255,255,0.08);
    padding: 4px;
    text-align: center;
}

.strategy-table th {
    background-color: rgba(0,0,0,0.3);
    color: rgba(255,255,255,0.6);
}

.strategy-table .player-hand-col {
    background-color: rgba(0,0,0,0.3);
    font-weight: bold;
    color: rgba(255,255,255,0.6);
}

/* ===== STORY CONTENT ===== */

.story-content {
    background: linear-gradient(180deg, #0f1f0f 0%, #0a150a 100%);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    max-width: 800px;
    width: 100%;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.06);
}

/* Hand signal table in settings page */
.hand-signal-table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0 8px;
    font-size: 0.95em;
}

.hand-signal-table th,
.hand-signal-table td {
    padding: 10px 14px;
    border: 1px solid rgba(255,255,255,0.1);
    text-align: center;
}

.hand-signal-table thead th {
    background: rgba(234,42,51,0.15);
    color: #f87171;
    font-weight: bold;
    letter-spacing: 0.03em;
}

.hand-signal-table tbody tr:nth-child(odd) {
    background: rgba(255,255,255,0.03);
}

.hand-signal-table tbody tr:nth-child(even) {
    background: rgba(0,0,0,0.15);
}

.hand-signal-table tbody td:nth-child(2) {
    font-size: 1.5em;
}

/* ===== UTILITY CLASSES ===== */

.hidden {
    display: none !important;
}

.invisible-element {
    visibility: hidden;
}

/* ===== ANIMATIONS ===== */

@keyframes red-flash {
    50% { background-color: #d9534f; }
}

.flashing-red {
    animation: red-flash 0.5s 6;
}

.correct-blue {
    background-color: #007bff !important;
}

/* ===== AUTH STYLES ===== */

#auth-buttons {
    display: flex;
    align-items: center;
}

#auth-buttons button {
    margin-left: 10px;
    background: rgba(234,42,51,0.15);
    border: 1px solid rgba(234,42,51,0.3);
    color: #ea2a33;
    border-radius: 6px;
    transition: all 0.2s;
}

#auth-buttons button:hover {
    background: rgba(234,42,51,0.25);
}

#login-btn {
    background: linear-gradient(to bottom, #ea2a33, #b91c1c) !important;
    border: none !important;
    color: white !important;
    border-radius: 6px !important;
}

#login-btn:hover {
    background: linear-gradient(to bottom, #ef4444, #dc2626) !important;
}

.login-form {
    display: flex;
    align-items: center;
    gap: 5px;
}

.login-form input {
    width: 110px;
    height: 30px;
    padding: 2px 8px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(0,0,0,0.3);
    color: white;
    font-size: 0.8em;
    box-sizing: border-box;
}

.login-form input::placeholder {
    color: rgba(255,255,255,0.35);
}

#header-username {
    color: #f59e0b;
    font-weight: bold;
    font-size: 0.9em;
    margin-left: 5px;
}

.language-selector {
    display: flex;
    align-items: center;
    cursor: pointer;
    margin-left: 10px;
    height: 30px;
}

.language-selector img {
    width: 30px;
    height: 20px;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 4px;
    box-shadow: 0 0 5px rgba(0,0,0,0.3);
    transition: transform 0.2s;
}

.language-selector img:hover {
    transform: scale(1.1);
}

.language-selector img.hidden {
    display: none;
}

/* ===== FORM STYLES ===== */

.form-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 350px;
    margin: 0 auto;
    text-align: left;
}

.form-container input[type="text"],
.form-container input[type="email"],
.form-container input[type="password"],
.form-container select {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(0,0,0,0.3);
    font-size: 0.95em;
    box-sizing: border-box;
    color: white;
}

.form-container input::placeholder {
    color: rgba(255,255,255,0.35);
}

.form-container select {
    background-color: #1a2a1a;
    color: white;
    cursor: pointer;
}

#username-check-message {
    font-size: 0.85em;
    min-height: 1.2em;
    margin: -5px 0;
}

#check-username-btn {
    width: 100%;
    padding: 8px;
    font-size: 0.9em;
}

.error-message {
    color: #ef4444;
    font-size: 0.85em;
    min-height: 1.2em;
}

/* ===== GENERAL BUTTON DEFAULT ===== */

button {
    padding: 10px 15px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(to bottom, #f59e0b, #d97706);
    color: #1a1a2e;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

button:hover {
    background: linear-gradient(to bottom, #fbbf24, #f59e0b);
    transform: translateY(-1px);
}

button:disabled {
    background: #333;
    color: #666;
    cursor: not-allowed;
    transform: none;
}

input[type="number"] {
    width: 80px;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(0,0,0,0.3);
    color: white;
}

/* ===== TABLES (Story content) ===== */

#story-1-content table {
    border: 1px solid rgba(255,255,255,0.15);
    border-collapse: collapse;
}

#story-1-content table th,
#story-1-content table td {
    border: 1px solid rgba(255,255,255,0.15);
    padding: 8px;
}

.card-counting-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px auto;
    max-width: 300px;
}

.card-counting-table th,
.card-counting-table td {
    border: 1px solid rgba(255,255,255,0.15);
    padding: 8px;
    text-align: center;
}

.card-counting-table th {
    background-color: rgba(0,0,0,0.3);
}

.basic-strategy-highlight {
    background-color: rgba(245,158,11,0.35);
    color: white;
    font-weight: bold;
}

/* ===== FOOTER ===== */

footer {
    background-color: #0a150a;
    border-top: 1px solid rgba(255,255,255,0.06);
    padding: 20px;
    text-align: center;
    margin-top: 40px;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
}

.footer-nav {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 15px;
}

.footer-nav button {
    background: none;
    border: 1px solid rgba(255,255,255,0.1);
    color: #888;
    padding: 8px 16px;
    font-size: 0.85em;
    cursor: pointer;
    border-radius: 8px;
}

.footer-nav button:hover {
    color: #ea2a33;
    border-color: rgba(234,42,51,0.3);
    background: rgba(234,42,51,0.08);
    transform: none;
}

/* Footer share buttons */
.footer-share {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
}

.footer-share-label {
    font-size: 0.8em;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.footer-share-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.share-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.06);
    color: #aaa;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
}

.share-btn:hover {
    transform: translateY(-2px);
}

.share-x:hover {
    background: #000;
    border-color: #555;
    color: #fff;
}

.share-facebook:hover {
    background: #1877f2;
    border-color: #1877f2;
    color: #fff;
}

.share-line:hover {
    background: #06c755;
    border-color: #06c755;
    color: #fff;
}

.share-kakao:hover {
    background: #fee500;
    border-color: #fee500;
    color: #3c1e1e;
}

.share-copy:hover {
    background: rgba(234,42,51,0.15);
    border-color: rgba(234,42,51,0.4);
    color: #ea2a33;
}

.footer-disclaimer {
    color: #555;
    font-size: 0.8em;
    line-height: 1.5;
    max-width: 700px;
    margin: 10px auto;
}

.footer-copyright {
    color: #444;
    font-size: 0.75em;
    margin-top: 10px;
}

/* ===== CONTENT HELPERS ===== */

.content-updated {
    color: #888;
    font-size: 0.8em;
    margin: -5px 0 5px 0;
    font-style: italic;
}

.content-summary {
    background-color: rgba(234,42,51,0.08);
    border-left: 3px solid #ea2a33;
    padding: 10px 15px;
    margin: 10px 0;
    font-size: 0.95em;
    line-height: 1.6;
    border-radius: 0 8px 8px 0;
    text-align: left;
}

/* ===== CONTACT FORM ===== */

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 450px;
    margin: 20px auto 0;
    text-align: left;
}

.contact-form label {
    font-weight: bold;
    color: #f59e0b;
    font-size: 0.95em;
}

.contact-form input[type="email"],
.contact-form input[type="text"],
.contact-form textarea {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(0,0,0,0.3);
    font-size: 0.95em;
    box-sizing: border-box;
    color: white;
}

.contact-form input::placeholder,
.contact-form textarea::placeholder {
    color: rgba(255,255,255,0.35);
}

.contact-form textarea {
    resize: vertical;
    font-family: inherit;
}

.contact-form button[type="submit"] {
    padding: 10px 20px;
    background: linear-gradient(to bottom, #f59e0b, #d97706);
    color: #1a1a2e;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.contact-form button[type="submit"]:hover {
    background: linear-gradient(to bottom, #fbbf24, #f59e0b);
    transform: translateY(-2px);
}

/* ===== MOBILE-ONLY ELEMENTS (hidden on desktop) ===== */

.mobile-menu-btn {
    display: none;
    background: none;
    border: 1px solid rgba(255,255,255,0.15);
    color: #ccc;
    font-size: 1.4em;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    line-height: 1;
    flex-shrink: 0;
}

.mobile-menu-btn:hover {
    background: rgba(234,42,51,0.15);
    color: #ea2a33;
    transform: none;
}

.mobile-tip-row {
    display: none;
}

/* ===== RESPONSIVE: TABLET / MOBILE (≤ 768px) ===== */

@media (max-width: 768px) {

    /* --- Header & Nav --- */
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    header { height: 50px; }
    body { padding-top: 50px; }
    .header-nav { padding: 0 10px; }

    .nav-left {
        display: none;
        position: absolute;
        top: 50px;
        left: 0;
        width: 100%;
        background-color: #0a150a;
        flex-direction: column;
        padding: 8px 10px;
        gap: 4px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.5);
        border-bottom: 1px solid rgba(234,42,51,0.15);
        z-index: 999;
        box-sizing: border-box;
    }

    .nav-left.mobile-open { display: flex; }

    .nav-left button {
        width: 100%;
        height: 40px;
        font-size: 0.9em;
    }

    .nav-right { gap: 6px; }

    .login-form input {
        width: 80px;
        height: 28px;
        font-size: 0.75em;
    }

    #auth-buttons button {
        width: 70px;
        height: 34px;
        font-size: 0.75em;
        margin-left: 4px;
    }

    .language-selector { margin-left: 4px; }

    /* --- Main --- */
    main {
        padding: 4px;
        min-height: calc(100vh - 50px);
    }

    /* --- Game wrapper: 1-column, reordered --- */
    #game-wrapper {
        flex-direction: column;
        gap: 8px;
    }

    #center-column {
        order: -2;
        width: 100%;
    }

    .mobile-tip-row {
        order: -1;
        display: flex;
        gap: 6px;
        width: 100%;
    }

    .mobile-tip-row button {
        flex: 1;
        height: 34px;
        font-size: 0.72em;
        padding: 0 4px;
        border-radius: 8px;
        background: rgba(234,42,51,0.12);
        border: 1px solid rgba(234,42,51,0.25);
        color: #ea2a33;
        font-weight: 600;
        letter-spacing: 0.03em;
        white-space: nowrap;
    }

    .mobile-tip-row button:hover {
        background: rgba(234,42,51,0.25);
        transform: none;
    }

    #game-info-panel {
        order: 0;
        flex: auto;
        width: 100%;
        box-sizing: border-box;
    }

    #right-column {
        order: 1;
        flex: auto;
        width: 100%;
        box-sizing: border-box;
    }

    /* Hide original tip buttons on mobile */
    #card-display-toggle-btn,
    #user-area-toggle-btn,
    #strategy-guide-toggle-btn {
        display: none !important;
    }

    /* --- GAME CONTAINER: viewport-height, flex column --- */
    #game-container {
        min-width: auto;
        width: 100%;
        box-sizing: border-box;
        border-width: 8px;
        border-radius: 18px;
        padding: 8px 8px;
        /* Fill viewport: 100vh minus header(50) + main-pad(8) + border(16) + container-pad(16) */
        height: calc(100vh - 50px - 8px);
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    /* Options: compact, no shrink */
    #options-area {
        flex-shrink: 0;
        margin-bottom: 4px;
    }

    /* Game board: fill remaining space, internal scroll if needed */
    #game-board {
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: space-evenly;
        min-height: 0;
        overflow-y: auto;
        margin: 4px 0;
    }

    #game-board h2 {
        padding: 2px 12px;
        font-size: 0.6em;
        margin: 2px 0;
    }

    #current-bet-display {
        margin: 4px 0;
        min-height: 14px;
    }

    /* Controls: FIXED height — betting & action share same space */
    #controls {
        flex-shrink: 0;
        height: 80px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        margin-top: 4px;
    }

    /* --- Cards: smaller --- */
    .card {
        width: 48px;
        height: 70px;
        border-radius: 6px;
        padding: 3px;
        font-size: 0.7em;
        margin: 0 2px;
    }

    .card:hover { transform: none; box-shadow: 0 4px 10px rgba(0,0,0,0.35); }

    .card-center-suit { font-size: 1.4em; }
    .card-rank { font-size: 0.85em; }
    .card-suit-small { font-size: 0.5em; }

    .pip { font-size: 0.65em; }
    .pip-lg { font-size: 1.4em; }
    .card-center-face { font-size: 1.2em; }
    .card-face-suit { font-size: 0.5em; }

    .hand-stacked .card + .card { margin-left: -32px; }

    .card.hidden-card .card-back-icon {
        width: 22px; height: 22px; font-size: 0.55em;
    }

    .hand {
        min-height: 60px;
        padding: 4px;
        border-radius: 10px;
        margin-top: 2px;
    }

    .hand h3 { font-size: 0.7em; margin: 0 0 4px 0; }

    /* --- Chips --- */
    .chip-icon {
        width: 32px; height: 32px; font-size: 0.45em; border-width: 2px;
    }
    .chip-icon-sm {
        width: 20px; height: 20px; font-size: 0.3em;
    }

    #player-chips-display {
        right: 6px;
        bottom: 10%;
    }

    /* --- Action buttons: max size without text overlap --- */
    #action-controls { gap: 6px; padding: 0; }

    #hit-btn {
        width: 60px; height: 60px; font-size: 0.72em;
    }
    #hit-btn::after { inset: -4px; }

    #stand-btn {
        width: 60px; height: 60px; font-size: 0.6em;
    }

    #double-down-btn {
        width: 60px; height: 60px; font-size: 0.55em;
    }

    #split-btn {
        width: 60px; height: 60px; font-size: 0.6em;
    }

    #surrender-btn {
        width: 60px; height: 60px; font-size: 0.45em;
    }

    /* --- Betting controls: match action button layout --- */
    #betting-controls {
        margin-bottom: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
    }
    #betting-controls input[type="number"] {
        width: 52px;
        padding: 6px 4px;
        font-size: 0.85em;
        border-radius: 50%;
        height: 52px;
        text-align: center;
    }
    #betting-controls button {
        width: 66px;
        height: 66px;
        border-radius: 50%;
        padding: 0 4px;
        font-size: 0.6em;
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
        line-height: 1.2;
        box-shadow: 0 4px 16px rgba(245,158,11,0.4);
    }

    /* --- Story content --- */
    .story-content {
        max-width: 100%;
        padding: 16px;
        border-radius: 12px;
    }

    .story-content table,
    #story-1-content table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .strategy-table { font-size: 0.65em; }

    .hand-signal-table { font-size: 0.8em; }
    .hand-signal-table th,
    .hand-signal-table td { padding: 6px 8px; }

    #card-display-content { width: 100%; }

    /* --- Forms full width --- */
    .form-container { max-width: 100%; }
    .contact-form { max-width: 100%; }
    #register-section { max-width: 100%; }

    /* --- Footer --- */
    .footer-nav { flex-wrap: wrap; gap: 8px; }
    .footer-nav button { padding: 6px 12px; font-size: 0.8em; }
    footer { padding: 14px; }
    .footer-disclaimer { font-size: 0.75em; }
}

/* ===== RESPONSIVE: SMALL MOBILE (≤ 480px) ===== */

@media (max-width: 480px) {

    .header-nav { padding: 0 6px; }
    .mobile-menu-btn { font-size: 1.2em; padding: 3px 8px; }

    .login-form input {
        width: 60px; height: 26px; font-size: 0.7em; padding: 2px 4px;
    }
    #auth-buttons button {
        width: 52px; height: 30px; font-size: 0.65em; margin-left: 3px;
    }
    .language-selector img { width: 24px; height: 16px; }

    .mobile-tip-row button { height: 30px; font-size: 0.62em; }

    /* Game container: thinner border */
    #game-container {
        border-width: 6px;
        border-radius: 14px;
        padding: 6px;
        height: calc(100vh - 50px - 8px);
    }

    #controls { height: 70px; }

    .card {
        width: 42px; height: 62px; padding: 2px; font-size: 0.65em;
    }
    .card-center-suit { font-size: 1.2em; }
    .pip { font-size: 0.55em; }
    .pip-lg { font-size: 1.2em; }
    .card-center-face { font-size: 1em; }

    .hand-stacked .card + .card { margin-left: -28px; }

    .hand { min-height: 50px; padding: 3px; }

    #action-controls { gap: 4px; }
    #hit-btn { width: 48px; height: 48px; font-size: 0.62em; }
    #hit-btn::after { inset: -3px; }
    #stand-btn { width: 48px; height: 48px; font-size: 0.52em; }
    #double-down-btn { width: 48px; height: 48px; font-size: 0.48em; }
    #split-btn { width: 48px; height: 48px; font-size: 0.52em; }
    #surrender-btn { width: 48px; height: 48px; font-size: 0.38em; }

    #betting-controls { gap: 6px; }
    #betting-controls input[type="number"] { width: 50px; padding: 6px 2px; font-size: 0.9em; }
    #betting-controls button { padding: 6px 10px; font-size: 0.78em; }

    #options-area { gap: 4px; }
    #options-area label { font-size: 0.65em; }
    #options-area input[type="number"] { width: 40px; padding: 3px 4px; font-size: 0.8em; }
    #options-area button { padding: 3px 8px; font-size: 0.65em; }

    #game-info-panel { padding: 10px; border-radius: 12px; }
    #message-area { font-size: 0.85em; padding: 8px 10px; }
    #log-area { height: 100px; font-size: 0.75em; }

    .story-content { padding: 12px; }
    .content-summary { font-size: 0.85em; padding: 8px 10px; }

    footer { padding: 10px; margin-top: 20px; }
    .footer-nav button { padding: 5px 8px; font-size: 0.7em; }
    .footer-disclaimer { font-size: 0.7em; }
    .footer-copyright { font-size: 0.65em; }
}

