:root {
    --flap-bg: #000000; 
    --flap-text: #e2e8f0;
    --char-width: 1.15rem; 
    --flap-height: 1.8rem;
    --flap-font-size: 1.1rem;
    --flap-radius: 2px;
    --board-purple: #7564ce;
    --gap: 1px;
    --board-bg: #333333; /* Lighter board background for flap separation contrast */
    --total-width: calc(72 * var(--char-width) + 71 * var(--gap));
}

body {
    font-family: 'Orbitron', sans-serif;
    color: #fff;
    margin: 0;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    overflow-x: hidden;
    background: url('../images/bg.png') no-repeat center center fixed; /* Path structured for assets/css directory context */
    background-size: cover;
}

/* Darkening layer for background image */
.overlay-bg {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.65);
    z-index: -1;
}

/* Logo and branding link */
.logo-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    text-decoration: none;
    color: white;
    transition: opacity 0.2s;
}
.logo-link img { width: 45px; height: auto; border-radius: 50%; }
.logo-link .name {
    font-size: 1.4rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Glassmorphic control bubble right above the board container */
.controls-bubble {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(117, 100, 206, 0.2);
    padding: 1.25rem 2rem;
    border-radius: 50px; /* Pillow bubble style */
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: auto;
    max-width: 95%;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
    z-index: 10;
    position: relative;
}

/* Segmented controller buttons */
.active-btn {
    background-color: var(--board-purple) !important;
    color: #ffffff !important;
    box-shadow: 0 0 10px rgba(117, 100, 206, 0.5);
}
.inactive-btn {
    background-color: transparent;
    color: #888888;
}
.inactive-btn:hover {
    color: #ffffff;
}

/* Main board container */
.board-container {
    background: var(--board-bg);
    border: 12px solid #3d3d3d; /* Adjusted border to match board contrast */
    border-radius: 12px;
    padding: 2rem;
    width: var(--total-width);
    box-shadow: 0 30px 60px -12px rgba(0, 0, 0, 0.8), inset 0 0 20px rgba(0,0,0,0.5);
    box-sizing: content-box;
    position: relative;
}

/* Split-flap display header */
.board-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start; 
    margin-bottom: 2.5rem;
    width: 100%;
}

/* Title text within board */
.board-title {
    color: var(--board-purple);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 4px;
    flex-grow: 1;
    line-height: 1;
    padding-top: 0; 
}
.board-title .main-t { display: block; font-size: 1.4rem; font-weight: 700; }
.board-title .sub-t { display: block; font-size: 0.8rem; font-weight: 400; opacity: 0.8; margin-top: 8px; }

.flap-row { display: flex; gap: var(--gap); margin-bottom: 4px; }
.flap-group { display: flex; gap: var(--gap); }

/* Individual split-flap character styling */
.flap {
    position: relative;
    width: var(--char-width);
    height: var(--flap-height);
    background: var(--flap-bg);
    color: var(--flap-text);
    text-align: center;
    line-height: var(--flap-height);
    font-family: 'JetBrains Mono', monospace;
    font-size: var(--flap-font-size);
    font-weight: 800;
    border-radius: var(--flap-radius);
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
    overflow: hidden;
    border: 1px solid #111;
}

/* Horizontal split line across the flaps */
.flap::after {
    content: '';
    position: absolute;
    top: 54%; 
    left: 0; 
    width: 100%; 
    height: 1px;
    background: rgba(0,0,0,0.8);
    z-index: 5;
}

/* Labels above columns */
.grid-headers {
    display: flex;
    gap: var(--gap);
    margin-bottom: 0.5rem;
    color: var(--board-purple);
    font-size: 0.7rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid #333;
    padding-bottom: 0.5rem;
}

.header-col { text-align: center; flex-shrink: 0; }

/* Footer styling conforming with standard main.css properties */
footer { 
    text-align: center; 
    padding: 2rem 1rem; 
    color: #aaa; 
    font-family: 'Orbitron', sans-serif;
    position: relative;
}
.footer-updated { color: #888; font-size: 0.75rem; margin-bottom: 0.8rem; font-weight: bold; text-transform: uppercase; letter-spacing: 2px; }
footer p { 
    font-size: 0.8rem; 
    color: #aaa; 
    letter-spacing: 1px; 
    margin-top: 1.5rem; 
}

/* Tablet and Mobile adjustments */
@media (max-width: 900px) {
    :root {
        --char-width: 0.75rem;
        --flap-height: 1.2rem;
        --flap-font-size: 0.75rem;
    }
    body { padding: 0.5rem; }
    .board-container { padding: 1rem; border-width: 6px; }
    .controls-bubble { border-radius: 20px; width: 95%; gap: 10px; padding: 15px; }
    .select-dropdown-wrapper { width: 100%; }
    .logo-link .name { font-size: 1.1rem; }
    .board-title .main-t { font-size: 1.1rem; }
    .board-header { flex-direction: column; align-items: center; gap: 15px; margin-bottom: 1rem; }
    .grid-headers { display: none; } 
}

/* Scaling for small phones */
@media (max-width: 600px) {
    .board-container {
        transform: scale(0.9);
        transform-origin: top center;
    }
}