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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #e5e5e5;
    background: #000000;
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    padding: 15px 20px;
    color: white;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    margin: 0;
}

main {
    background: #1a1a1a;
    border-radius: 10px;
    padding: 0 0 20px 0;
    /* margin: 20px 0; */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.controls {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.btn {
    padding: 10px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: background 0.3s;
}

.btn:hover {
    background: #5568d3;
}

.btn.active {
    background: #48bb78;
}

.last-update {
    color: #999;
    font-size: 0.9rem;
}

.chart-container {
    margin: 20px 0;
    padding: 0;
    background: #1a1a1a;
    border-radius: 8px;
    height: 500px;
    position: relative;
}

#tradingview_chart {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    overflow: hidden;
}

/* TradingView 상단 영역 숨기기 */
#tradingview_chart .layout__area--top {
    display: none !important;
}

.baccarat-board-container {
    overflow-x: auto;
    margin: 20px 0;
}

.baccarat-board {
    display: inline-block;
    border-radius: 8px;
    background: #1a1a1a;
    min-width: 100%;
}

.baccarat-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid #404040;
    border-radius: 4px;
    background: #2a2a2a;
    position: relative;
    table-layout: fixed;
}

.baccarat-table td {
    padding: 0;
    border: 1px solid #404040;
    text-align: center;
    vertical-align: middle;
    width: calc(100% / 26);
    height: 0;
    padding-bottom: calc(100% / 26);
    position: relative;
    box-sizing: border-box;
    background: #1a1a1a;
    overflow: hidden;
}

.baccarat-cell {
    width: 90%;
    height: 90%;
    min-width: 0;
    min-height: 0;
    max-width: 90%;
    max-height: 90%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: clamp(0.6rem, 1.2vw, 0.9rem);
    color: white;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s;
    cursor: pointer;
    z-index: 1;
    box-sizing: border-box;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1;
}

.baccarat-cell:hover {
    transform: translate(-50%, -50%) scale(1.1);
    z-index: 10;
}

.cell-info {
    margin-top: 20px;
    padding: 20px;
    background: #2a2a2a;
    border-radius: 8px;
    border: 2px solid #404040;
}

.cell-info-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    font-size: 0.95rem;
}

.cell-info-content p {
    margin: 0;
    padding: 8px 0;
    color: #e5e5e5;
}

.cell-info-content .info-label {
    font-weight: 600;
    color: #667eea;
    margin-right: 8px;
}

.cell-info-content .info-value {
    color: #ccc;
}

.baccarat-cell.short {
    background: #FF043C;
}

.baccarat-cell.long {
    background: #009C80;
}

.baccarat-cell.tie {
    background: #38a169;
}

.baccarat-cell .dot {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    bottom: 5px;
    right: 5px;
}

.baccarat-cell.short .dot {
    background: #FF043C;
}

.baccarat-cell.long .dot {
    background: #009C80;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 1.1rem;
}

.info {
    margin-top: 20px;
    margin-left: 20px;
    margin-right: 20px;
    padding-top: 20px;
    border-top: 1px solid #404040;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.legend {
    display: flex;
    gap: 30px;
    justify-content: center;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #e5e5e5;
}

.legend-circle {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    font-size: 0.9rem;
}

.legend-circle.short {
    background: #FF043C;
}

.legend-circle.long {
    background: #009C80;
}

.timeframe-selector {
    display: flex;
    gap: 10px;
    margin-left: auto;
    align-items: center;
}

.timeframe-btn {
    padding: 8px 16px;
    border: 1px solid #404040;
    background: #2a2a2a;
    color: #e5e5e5;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.timeframe-btn:hover {
    background: #333;
    border-color: #555;
}

.timeframe-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

footer {
    text-align: center;
    padding: 20px;
    color: white;
    opacity: 0.9;
}

footer .last-update {
    display: block;
    margin-top: 10px;
    color: white;
    font-size: 0.9rem;
    opacity: 0.8;
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    .container {
        padding: 0;
    }
    
    main {
        padding-bottom: 20px;
    }
    
    .baccarat-cell {
        width: 40px;
        height: 40px;
        font-size: 0.3rem;
    }
    
    .baccarat-grid {
        grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
        gap: 6px;
    }
    
    .info {
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 15px;
    }
    
    .legend {
        justify-content: center;
        flex-direction: column;
        gap: 15px;
        width: 100%;
    }
    
    .legend-item {
        justify-content: center;
    }
    
    .timeframe-selector {
        margin-left: 0;
        justify-content: center;
        width: 100%;
    }
}
