/* css/style.css - 카지노 스타일 블랙잭 디자인 */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@600;700;900&family=Noto+Sans+KR:wght@400;500;700&display=swap');

:root {
    --table-green: #0f4c28;
    --table-dark-green: #082915;
    --gold: #d4af37;
    --gold-light: #f7e08b;
    --gold-dark: #aa841e;
    --card-white: #ffffff;
    --card-shadow: rgba(0, 0, 0, 0.4);
    --red-suit: #d32f2f;
    --black-suit: #1a1a1a;
    --btn-bg: #1c2b20;
    --text-light: #f5f5f5;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
}

body {
    font-family: 'Noto Sans KR', sans-serif;
    background: radial-gradient(circle at center, #1b3d26 0%, #091a0e 100%);
    color: var(--text-light);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
}

/* Header */
.game-header {
    width: 100%;
    max-width: 1100px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--gold);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    margin-bottom: 10px;
}

.title-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.title-area h1 {
    font-family: 'Cinzel', serif;
    color: var(--gold);
    font-size: 1.8rem;
    letter-spacing: 2px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.sound-toggle-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--gold-light);
}

.stats-bar {
    display: flex;
    gap: 15px;
    font-size: 0.85rem;
    color: #ccc;
}

.stat-item span {
    color: var(--gold);
    font-weight: bold;
}

/* Main Casino Felt Table */
.casino-table {
    width: 100%;
    max-width: 1100px;
    flex-grow: 1;
    background: radial-gradient(ellipse at center, var(--table-green) 0%, var(--table-dark-green) 100%);
    border: 12px solid #2d1e18;
    outline: 2px solid var(--gold);
    border-radius: 40px;
    box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.7), 0 10px 30px rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

/* Dealer / Player Sections */
.table-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 180px;
    width: 100%;
}

.section-label {
    font-family: 'Cinzel', serif;
    color: var(--gold);
    font-size: 1.1rem;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.score-badge {
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid var(--gold);
    color: #fff;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-family: 'Noto Sans KR', sans-serif;
}

/* Cards Row & CSS Cards Design */
.cards-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: -30px;
    min-height: 145px;
    padding: 5px;
}

.card {
    width: 90px;
    height: 130px;
    background-color: var(--card-white);
    border-radius: 10px;
    box-shadow: 2px 4px 10px var(--card-shadow);
    position: relative;
    font-family: 'Cinzel', serif;
    margin: 0 -15px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: cardDeal 0.3s ease-out forwards;
    transform-style: preserve-3d;
}

.card:hover {
    transform: translateY(-8px);
    z-index: 10;
}

@keyframes cardDeal {
    from {
        opacity: 0;
        transform: translateY(-40px) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.card.red {
    color: var(--red-suit);
}

.card.black {
    color: var(--black-suit);
}

.card-front {
    width: 100%;
    height: 100%;
    position: absolute;
    padding: 6px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    backface-visibility: hidden;
}

.card-corner {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1;
    font-size: 0.95rem;
    font-weight: bold;
}

.card-corner.bottom-right {
    transform: rotate(180deg);
}

.card-center {
    font-size: 2.2rem;
    text-align: center;
    align-self: center;
}

/* 딜러의 엎어진 카드 (Back) */
.card-back {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    background: repeating-linear-gradient(
        45deg,
        #8b0000,
        #8b0000 10px,
        #600000 10px,
        #600000 20px
    );
    border: 3px solid #ffffff;
    border-radius: 10px;
    backface-visibility: hidden;
    transform: rotateY(180deg);
}

.card.hidden .card-front {
    transform: rotateY(180deg);
}

.card.hidden .card-back {
    transform: rotateY(0deg);
}

/* Split 핸드 레이아웃 */
#player-hands-container {
    display: flex;
    justify-content: center;
    gap: 25px;
    width: 100%;
    flex-wrap: wrap;
}

.hand-box {
    padding: 10px 15px;
    border-radius: 16px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px transparent solid;
    transition: all 0.3s ease;
}

.hand-box.active-hand {
    border: 2px solid var(--gold);
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.4);
}

.hand-title {
    font-size: 0.85rem;
    color: var(--gold-light);
    margin-bottom: 5px;
    text-align: center;
}

/* Center Status Message Banner */
.status-container {
    margin: 10px 0;
    text-align: center;
}

.status-message {
    font-size: 1.1rem;
    font-weight: 500;
    padding: 8px 24px;
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid var(--gold);
    display: inline-block;
    color: #fff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

.status-message.win {
    color: #4caf50;
    border-color: #4caf50;
    box-shadow: 0 0 15px rgba(76, 175, 80, 0.5);
}

.status-message.lose {
    color: #f44336;
    border-color: #f44336;
}

.status-message.push {
    color: #ffb74d;
    border-color: #ffb74d;
}

.status-message.warning {
    color: #ff9800;
}

/* Bottom Control Panel & Betting Info */
.control-panel {
    width: 100%;
    max-width: 1100px;
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--gold-dark);
    padding: 15px;
    border-radius: 16px;
}

.betting-display {
    display: flex;
    justify-content: space-around;
    align-items: center;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 10px;
    padding: 8px 20px;
    font-family: 'Cinzel', serif;
}

.chip-info {
    font-size: 1.1rem;
    color: var(--gold-light);
}

.chip-info span {
    color: #fff;
    font-weight: bold;
}

/* Chips selection buttons */
.chips-container {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.chip-btn {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    border: 4px dashed #fff;
    color: #fff;
    font-weight: bold;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6);
    transition: transform 0.15s ease, filter 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Cinzel', serif;
}

.chip-btn:hover:not(:disabled) {
    transform: translateY(-4px) scale(1.05);
}

.chip-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    filter: grayscale(80%);
}

.chip-btn[data-amount="10"] { background: #2196f3; }
.chip-btn[data-amount="50"] { background: #e91e63; }
.chip-btn[data-amount="100"] { background: #9c27b0; }
.chip-btn[data-amount="500"] { background: #ff9800; }

/* Action Buttons */
.actions-container {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-action {
    padding: 10px 22px;
    font-size: 1rem;
    font-weight: bold;
    border: 1px solid var(--gold);
    border-radius: 8px;
    background: linear-gradient(180deg, #2a4030 0%, #152419 100%);
    color: var(--gold-light);
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    transition: all 0.2s ease;
    font-family: 'Cinzel', serif;
    letter-spacing: 1px;
}

.btn-action:hover:not(:disabled) {
    background: linear-gradient(180deg, #3d5e46 0%, #203626 100%);
    box-shadow: 0 0 12px var(--gold);
    transform: translateY(-2px);
}

.btn-action:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    border-color: #555;
    color: #888;
}

.btn-action.btn-deal {
    background: linear-gradient(180deg, #c5a028 0%, #7e630f 100%);
    color: #000;
}

.btn-action.btn-deal:hover:not(:disabled) {
    background: linear-gradient(180deg, #e7c247 0%, #9e7d18 100%);
    box-shadow: 0 0 15px var(--gold-light);
}

.btn-action.btn-danger {
    background: linear-gradient(180deg, #8b1d1d 0%, #4a0d0d 100%);
    color: #fff;
    border-color: #e57373;
}

/* Responsive Media Queries */
@media (max-width: 768px) {
    .title-area h1 {
        font-size: 1.3rem;
    }
    .stats-bar {
        font-size: 0.75rem;
        gap: 8px;
    }
    .card {
        width: 70px;
        height: 102px;
        margin: 0 -12px;
    }
    .card-center {
        font-size: 1.6rem;
    }
    .card-corner {
        font-size: 0.8rem;
    }
    .chip-btn {
        width: 44px;
        height: 44px;
        font-size: 0.8rem;
    }
    .btn-action {
        padding: 8px 14px;
        font-size: 0.85rem;
    }
    .status-message {
        font-size: 0.9rem;
        padding: 6px 14px;
    }
}
