html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden; /* prevent scrollbars */
}
body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background: radial-gradient(circle at 30% 30%, #303d55 0%, #151a24 70%);
    color: #fff;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    background-attachment: fixed;
}
#uiWrapper {
    padding-top: 40px;
    transition: opacity 0.55s ease, transform 0.6s cubic-bezier(.16,.72,.18,1.12);
    max-width: 760px;
    width: 100%;
}
#gameTitle {
    font-size: 64px;
    line-height: 1;
    margin: 0;
    letter-spacing: 2px;
    background: linear-gradient(90deg,#ffdc6b,#ffa14d,#ff6578,#7aa9ff);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 4px 10px rgba(0,0,0,0.55));
    animation: titleGlow 6s linear infinite;
}
@keyframes titleGlow {
  0%,100% { filter: drop-shadow(0 4px 10px rgba(0,0,0,0.55)) hue-rotate(0deg); }
  50% { filter: drop-shadow(0 6px 14px rgba(0,0,0,0.75)) hue-rotate(40deg); }
}
body.game-active #uiWrapper {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-40px);
    height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
}
/* Removed extra closing brace; optional display removal can be handled via JS if needed */
#canvasWrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
    position: relative; /* anchor loader overlay */
}
#gameCanvas {
    background: #333;
    border: 2px solid #fff;
    display: block;
    margin: 0 auto;
    max-width: 1000px;
    /* Height handled dynamically in JS (95% viewport minus hidden UI) */
}
/* Loader overlay centered over the canvas */
#loaderOverlay {
        position: absolute;
        inset: 0;
        display: none;
        align-items: center;
        justify-content: center;
        pointer-events: none;
}
#loaderOverlay.active { display: flex; }
#loaderOverlay::before {
        content: '';
        position: absolute;
        inset: 0;
        background: rgba(8, 10, 14, 0.55);
        backdrop-filter: blur(2px);
}
#loaderText {
        position: relative;
        margin-top: 10px;
        color: #e9eefc;
        font-weight: 600;
        text-shadow: 0 1px 2px rgba(0,0,0,0.35);
}
.spinner {
        position: relative;
        width: 64px;
        height: 64px;
        border-radius: 50%;
        background:
            conic-gradient(from 0deg, #7aa9ff, #ffdc6b, #ff6578, #7aa9ff);
        -webkit-mask:
            radial-gradient(farthest-side, transparent calc(100% - 10px), #000 0);
        mask:
            radial-gradient(farthest-side, transparent calc(100% - 10px), #000 0);
        animation: spin 0.9s linear infinite;
        box-shadow: 0 0 30px rgba(122,169,255,0.25);
}
@keyframes spin { to { transform: rotate(360deg); } }
#controls {
    margin-top: 32px;
    display: flex;
    gap: 22px;
    justify-content: center;
    flex-wrap: wrap;
}
button {
    --btn-bg: linear-gradient(135deg,#485a7a,#2c3544);
    --btn-bg-hover: linear-gradient(135deg,#5f7aa1,#394656);
    position: relative;
    padding: 14px 30px;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: .5px;
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: 14px;
    background: var(--btn-bg);
    color: #f5f7fa;
    cursor: pointer;
    backdrop-filter: blur(6px) brightness(1.15);
    -webkit-backdrop-filter: blur(6px) brightness(1.15);
    box-shadow: 0 6px 18px -6px rgba(0,0,0,0.5), 0 2px 4px rgba(0,0,0,0.4) inset;
    transition: background .35s, transform .25s, box-shadow .35s, border-color .35s;
    overflow: hidden;
}
button::before {
    content: '';
    position: absolute;
    top: 0; left: -40%;
    width: 40%; height: 100%;
    background: linear-gradient(90deg,rgba(255,255,255,0.0),rgba(255,255,255,0.35),rgba(255,255,255,0));
    transform: skewX(-25deg);
    opacity: 0;
}
button:hover::before { animation: sheen 0.9s forwards; }
@keyframes sheen { 0% { left:-40%; opacity:0; } 20% { opacity:1; } 100% { left:110%; opacity:0; } }
button:hover { background: var(--btn-bg-hover); transform: translateY(-4px); box-shadow: 0 10px 24px -6px rgba(0,0,0,0.55), 0 2px 4px rgba(255,255,255,0.08) inset; border-color: rgba(255,255,255,0.35); }
button:active { transform: translateY(0); box-shadow: 0 4px 10px -3px rgba(0,0,0,0.6); }
button:focus { outline: 2px solid #ffc463; outline-offset: 3px; }
/* Remove old basic button style (overridden above) */
