/* --- LAYOUT WRAPPER --- */
#game-board { 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center; 
    width: 100%; 
    height: 100%; 
    position: relative;
    /* Added gap to prevent Top Info, Board, and Controls from bunching up */
    gap: 2vmin; 
}

/* Info bar at the top (Timer, Round, etc.) */
.top-info {
    width: 90%; 
    max-width: 800px;
    display: flex; 
    justify-content: space-between;
    margin-bottom: 0; 
    font-weight: bold; 
    font-size: clamp(1rem, 2.5vmin, 1.5rem); 
    z-index: 10;
    pointer-events: none; 
}

/* The Grid Container */
.game-board-container {
    position: relative; 
    /* CHANGED: Increased bottom margin significantly (10vmin).
       The drill buttons hang off the board edges; this creates space 
       so they don't overlap the "Selection Order" text below. */
    margin: 5vmin auto 10vmin auto; 
    transform-origin: center;
}

/* --- BLOCKS --- */
.block {
    width: var(--block-base); 
    height: var(--block-base);
    background: #333; 
    border: 2px solid #444; 
    border-radius: 12%; 
    display: flex; 
    justify-content: center; 
    align-items: center;
    font-size: calc(var(--block-base) * 0.55); 
    font-weight: bold; 
    color: #555;
    user-select: none; 
    transition: all 0.2s; 
    box-sizing: border-box;
    position: absolute; 
    z-index: 1;
}
.tut-block { position: absolute !important; }

/* Color Grading & States */
.block.revealed { 
    color: #fff; border-color: #fff; background: #444; 
    z-index: 2; transform: scale(1.05); 
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.val-low { color: #888 !important; background: #2a2a2a; }
.val-5 { 
    color: var(--ore-red) !important; background: #2a2a2a; 
    text-shadow: 0 0 10px rgba(214, 73, 59, 0.4); border-color: #ff6b6b; 
}
.val-0 { background: #222; color: #444; }
.block.val-mid-2, .block.val-mid-3, .block.val-mid-4 { text-shadow: none; background: #2a2a2a; }

/* --- BLIND MODE --- */
.blind-mode-active .block {
    color: transparent !important; 
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.1); 
}
.blind-mode-active .block.revealed {
    color: inherit !important; text-shadow: none; border-color: #666;
}

.blind-mode-active .block.revealed.val-low { color: #888 !important; }
.blind-mode-active .block.revealed.val-5 { color: var(--ore-red) !important; }

/* --- DRILL BUTTONS --- */
.drill-btn {
    width: var(--btn-base); 
    height: var(--btn-base);
    /* FIX: Removed hardcoded min-width/height (was 44px).
       This allows the buttons to scale down correctly with --btn-base 
       on very small screens, keeping them smaller than the blocks. */
    min-width: 0; 
    min-height: 0; 
    
    background: #2a2a2a; border: 2px solid #555;
    position: absolute; z-index: 10; cursor: pointer;
    transform: translate(-50%, -50%) rotate(45deg);
    display: flex; justify-content: center; align-items: center;
    box-shadow: 0 4px 8px rgba(0,0,0,0.5);
    transition: all 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.drill-btn span { 
    transform: rotate(-45deg); font-weight: bold; color: #888; 
    font-size: calc(var(--btn-base) * 0.45); pointer-events: none; 
}

.drill-btn.selected {
    background: var(--brand-orange); border-color: white;
    z-index: 20; box-shadow: 0 0 15px var(--brand-orange);
    transform: translate(-50%, -50%) rotate(45deg) scale(1.15);
}
.drill-btn.selected span { color: white; }

/* --- CONTROLS AREA --- */
#controls-area {
    display: flex; flex-direction: column; align-items: center; 
    justify-content: center; width: 100%; 
    margin-top: 0; 
    box-sizing: border-box; 
    z-index: 100; pointer-events: none; 
}
#controls-area > * { pointer-events: auto; }

#manual-wrapper {
    display: flex; flex-direction: column; align-items: center; 
    gap: 10px; width: 100%;
}
#end-game-manual-btn { margin: 0 !important; }

.slots-area {
    width: 100%; display: flex; flex-direction: column; 
    align-items: center; justify-content: center; position: relative;
    /* Added top margin to ensure text is pushed away from drill buttons */
    margin-top: 2vmin;
}

.slots-row { 
    display: flex; gap: 10px; flex-wrap: wrap; 
    justify-content: center; align-items: center;
}

.slot { 
    width: 6vmin; height: 6vmin; 
    min-width: 40px; min-height: 40px;
    border: 2px dashed #444; border-radius: 50%; 
    display: flex; justify-content: center; align-items: center; color: white;
    background-color: var(--slot-empty); transition: all 0.2s;
    font-size: calc(6vmin * 0.5); font-weight: bold;
}
.slot.filled { 
    background: var(--brand-orange); border-style: solid; border-color: white; 
    color: #111; cursor: pointer; 
}

.quit-btn {
    background: rgba(0,0,0,0.5); border: 1px solid #444; color: #888;
    padding: 8px 15px; border-radius: 4px; cursor: pointer; margin-top: 5px;
    font-size: 0.8rem; transition: all 0.2s; backdrop-filter: blur(2px);
}
.quit-btn:hover { border-color: var(--brand-orange); color: var(--brand-orange); }
.quit-container { margin-top: 5px; text-align: center; }

#slots-row #confirmation-panel {
    width: 100%; display: flex; justify-content: center; margin-top: 10px; order: 100; 
}

.game-confirm-btn {
    background: #444; color: #fff; border: none; padding: 1.5vmin 4vmin;
    font-size: clamp(0.9rem, 2.5vmin, 1.2rem); font-weight: bold; 
    border-radius: 50px; cursor: pointer;
    text-transform: uppercase; letter-spacing: 1px; transition: all 0.2s;
}
.game-confirm-btn.active-ready { 
    background: var(--brand-orange); box-shadow: 0 0 15px rgba(242, 101, 34, 0.4); 
}
.game-confirm-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.small-label { margin-bottom: 5px; font-size: 0.75rem; color: #999; letter-spacing: 1px; }

/* Ensure extreme values show their colors when revealed in Blind Mode */
/*
.blind-mode-active .block.revealed.val-low { color: #888 !important; }
.blind-mode-active .block.revealed.val-5 { color: var(--ore-red) !important; }
*/