/* public/tabletop.css */

/* --- Main Container (Full Screen Immersive) --- */
#tabletop-view {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 2000; /* Sits on top of everything else */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    /* Radial gradient for a 'spotlight' feel */
    background: radial-gradient(circle at center, #34495e 0%, #2c3e50 100%);
    padding: 20px;
    color: white;
    overflow-y: auto; 
}

/* --- Z-Index Fixes for Modals --- */
/* Ensure the specific winner modal sits above the tabletop view */
#tabletop-winner-modal {
    z-index: 2100 !important;
}

/* FIX: Ensure ALL modals sit above the boosted backdrop */
.modal {
    z-index: 2060 !important;
}

/* Ensure the dark background for the modal also sits above the tabletop view */
.modal-backdrop {
    z-index: 2050 !important;
}

/* Spectator Mode */
#tabletop-board-area.spectator-mode {
    filter: grayscale(100%) opacity(0.4);
    pointer-events: none;
}

/* --- Header / Status Area --- */
.tabletop-header {
    text-align: center;
    margin-bottom: 20px;
    width: 100%;
    max-width: 700px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

/* Mute Button */
.tabletop-mute-btn {
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.3);
    transition: background-color 0.2s, transform 0.1s;
    cursor: pointer;
}
.tabletop-mute-btn:hover {
    background-color: rgba(255,255,255,0.2);
}
.tabletop-mute-btn.muted {
    background-color: rgba(220, 53, 69, 0.2);
    border-color: #dc3545;
    color: #dc3545;
}

/* Info Bars */
.tabletop-info-bar, .tabletop-stats-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.4);
    padding: 10px 20px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1.1em;
    width: 100%;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    border: 1px solid rgba(255,255,255,0.05);
}

.tabletop-stats-bar {
    background: rgba(0, 0, 0, 0.25);
    font-size: 1em;
    color: #ecf0f1;
    margin-top: 0 !important;
}

.tabletop-timer {
    font-size: 1.8em;
    color: #f1c40f;
    font-weight: 900;
    margin: 15px 0;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
    background-color: rgba(0,0,0,0.3);
    padding: 5px 20px;
    border-radius: 50px;
}

/* Ball Display */
.tabletop-current-ball {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 4rem;
    font-weight: 900;
    margin: 20px auto;
    box-shadow: inset -10px -10px 20px rgba(0,0,0,0.5), 5px 5px 15px rgba(0,0,0,0.3), 0 0 20px rgba(255,255,255,0.1);
    border: 5px solid rgba(255,255,255,0.3);
    text-shadow: 2px 2px 4px rgba(0,0,0,0.4);
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background-color: #2c3e50;
}

.ball-red { background: radial-gradient(circle at 30% 30%, #ff7675, #d63031); color: white; border-color: #c0392b; }
.ball-yellow { background: radial-gradient(circle at 30% 30%, #ffeaa7, #fdcb6e); color: black; border-color: #e1b12c; }
.ball-blue { background: radial-gradient(circle at 30% 30%, #74b9ff, #0984e3); color: white; border-color: #0984e3; }
.ball-silver { background: radial-gradient(circle at 30% 30%, #dfe6e9, #b2bec3); color: black; border-color: #636e72; }

.pop-in { animation: popIn 0.3s; }
@keyframes popIn {
    0% { transform: scale(0); }
    80% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.tabletop-message {
    min-height: 1.5em;
    font-size: 1.3em;
    margin-top: 10px;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* --- Board Area --- */
#tabletop-board-area {
    display: flex;
    gap: 10px;
    padding: 15px;
    background-color: #34495e;
    border-radius: 15px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.5), inset 0 0 0 1px rgba(255,255,255,0.1);
    margin-bottom: 25px;
    max-width: 100%;
    overflow-x: auto;
    justify-content: center;
}

.tabletop-col {
    display: flex;
    flex-direction: column;
    gap: 6px; /* Space between cells */
    width: 80px; /* Fixed width */
    padding: 6px; /* Uniform padding around the stack of cells */
    border-radius: 8px;
    box-shadow: inset 0 0 15px rgba(0,0,0,0.3);
}

/* Column Backgrounds */
.col-red { background-color: #c0392b; }
.col-yellow { background-color: #f39c12; }
.col-blue { background-color: #2980b9; }
.col-silver { background-color: #7f8c8d; }

.shutter-cell {
    position: relative;
    width: 100%; /* Force it to fill the column width */
    height: 65px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #ecf0f1;
    border-radius: 4px;
    font-size: 1.8rem;
    font-weight: 800;
    overflow: hidden;
    box-shadow: 0 2px 0 rgba(0,0,0,0.2);
    color: #2c3e50;
    /* Fix for slight gaps: Ensure border-box is used */
    box-sizing: border-box; 
}

.shutter {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 0%;
    /* Smoother striped look */
    background: repeating-linear-gradient(
        45deg,
        #2c3e50,
        #2c3e50 10px,
        #34495e 10px,
        #34495e 20px
    );
    border-bottom: 4px solid #1a252f;
    transition: height 0.25s ease-in-out;
    z-index: 10;
    box-shadow: 0 5px 10px rgba(0,0,0,0.5);
}

.shutter-cell.closed .shutter { 
    height: 100%; 
    border-bottom: none; /* Clean look when fully closed */
}

/* Text Colors */
.col-yellow .shutter-cell, .col-silver .shutter-cell { color: #2c3e50; }
.col-red .shutter-cell, .col-blue .shutter-cell { color: #2c3e50; }

.tabletop-controls {
    width: 100%;
    max-width: 400px;
    display: grid;
    gap: 15px;
    justify-content: center;
}

#tabletop-claim-btn {
    font-size: 1.5rem;
    padding: 15px 40px;
    text-transform: uppercase;
    font-weight: 900;
    letter-spacing: 2px;
    border-radius: 50px;
    box-shadow: 0 5px 15px rgba(231, 76, 60, 0.4);
    animation: pulse-red 2s infinite;
    border: none;
    background: linear-gradient(to bottom, #e74c3c, #c0392b);
    color: white;
}

#tabletop-buy-btn {
    font-size: 1.3rem;
    font-weight: 700;
    padding: 12px 30px;
    border-radius: 10px;
    background: linear-gradient(to bottom, #3498db, #2980b9);
    border: none;
    box-shadow: 0 4px 0 #1c5a85;
    transition: transform 0.1s;
    color: white;
}
#tabletop-buy-btn:active {
    transform: translateY(4px);
    box-shadow: none;
}

.shake-anim { animation: shake 0.5s; animation-iteration-count: 1; }
@keyframes shake {
  0% { transform: translate(1px, 1px) rotate(0deg); }
  10% { transform: translate(-1px, -2px) rotate(-1deg); }
  50% { transform: translate(-1px, 2px) rotate(-1deg); }
  100% { transform: translate(1px, -2px) rotate(-1deg); }
}
@keyframes pulse-red {
    0% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.7); }
    70% { box-shadow: 0 0 0 15px rgba(231, 76, 60, 0); }
    100% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0); }
}
.btn-clicked { transform: scale(0.95); filter: brightness(0.9); }

@media (max-width: 400px) {
    .tabletop-col { width: 65px; gap: 4px; padding: 4px; }
    .shutter-cell { height: 55px; font-size: 1.4rem; }
    .tabletop-current-ball { width: 90px; height: 90px; font-size: 3rem; }
    #tabletop-board-area { gap: 6px; padding: 10px; }
}
