/* ============================================= */
/* ====== SOLAR KNIGHT - TITLE SCREEN STYLES ====== */
/* ============================================= */

/* Base setup (assuming html, body are set in style.css) */
#new-title-screen {
    position: fixed; /* Fixed to overlay */
    width: 900px;    /* Native width */
    height: 460px;   /* Native height */
    transform-origin: top left; /* Origin for JS scaling */
    will-change: transform;
    z-index: 1000;
    background: linear-gradient(to bottom, #080818, #0f0f28 60%, #060625);
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Justify content slightly higher than center */
    justify-content: flex-start; /* Changed from center */
    padding-top: 8vh; /* Add padding to push content down */
    overflow: hidden;
    margin: 0;
    box-sizing: border-box; /* Include padding in height */
}

/* --- Background Elements (Simplified) --- */

.celestial-harmonies {
    position: absolute;
    width: 100%; height: 100%; top: 0; left: 0;
    opacity: 0.15; /* Reduced opacity slightly */
    background-image:
        repeating-radial-gradient( circle at 50% 50%, transparent 0px, rgba(120, 100, 180, 0.02) 2px, transparent 4px ), /* Reduced density */
        radial-gradient( circle at 50% 50%, transparent 20%, rgba(80, 40, 120, 0.03) 40%, transparent 65% ); /* Adjusted gradient */
    pointer-events: none;
    z-index: 1;
}

/* Eryndor planet - central visual */
.eryndor-planet {
    position: absolute;
    top: 45%; /* Adjusted position */
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px; /* Slightly smaller */
    height: 200px;
    border-radius: 50%;
    z-index: 3;
}

.planet-core {
    position: absolute; width: 100%; height: 100%; border-radius: 50%;
    background: radial-gradient(circle at 40% 40%, #2F0047 10%, #1A0D2B 50%, #0A0514 90%);
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.6), 0 0 25px rgba(75, 0, 130, 0.25); /* Adjusted shadow */
    overflow: hidden;
}

.celestial-music { /* Container for waves */
    position: absolute; width: 100%; height: 100%; border-radius: 50%;
    overflow: hidden; opacity: 0.6; /* Slightly less opaque */
}

.harmonic-wave {
    position: absolute; width: 200%; height: 120%; top: -10%; left: -50%;
    background: repeating-linear-gradient( 0deg, transparent 0px, transparent 12px, rgba(140, 80, 200, 0.02) 12px, rgba(140, 80, 200, 0.02) 14px ); /* Thinner waves */
    transform-origin: center;
    animation: waveMotion 25s infinite alternate ease-in-out; /* Slower */
}

.planet-glow {
    position: absolute; width: 280px; height: 280px; top: 50%; left: 50%;
    transform: translate(-50%, -50%); border-radius: 50%;
    background: radial-gradient(circle, transparent 55%, rgba(120, 0, 180, 0.12) 75%, transparent 90%); /* Adjusted gradient */
    filter: blur(6px); /* Slightly less blur */
    z-index: 2;
    animation: glowPulse 14s infinite alternate ease-in-out; /* Slower */
}

/* --- Removed Elements' Styles --- */
/* .sacred-geometry, .astrolabe, .zodiac-ring, .celestial-sphere, */
/* .astrolabe-circle, .astrolabe-line, .constellation, .orbital-body, */
/* .orbital-path, .orbit-system, .cosmic-whisper, .resonance-particles { display: none; } */

/* --- Title Content --- */

.title-container {
    position: relative;
    z-index: 5;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px; /* Reduced gap */
    margin-top: 0; /* Adjusted from 10vh */
    width: 90%; /* Allow text to wrap if needed */
    max-width: 700px;
}

.title-text {
    font: bold 60px 'Cinzel', serif; /* Slightly smaller */
    color: #E6E6FA;
    letter-spacing: 2px; /* Reduced spacing */
    text-shadow: 0 0 8px rgba(148, 0, 211, 0.35), 0 0 15px rgba(75, 0, 130, 0.15); /* Adjusted shadow */
    margin: 0;
    animation: titleGlow 8s infinite alternate; /* Changed to alternate */
}

.subtitle-text {
    font: italic 22px 'Cormorant Garamond', serif; /* Slightly smaller */
    color: #D8CFC3;
    text-shadow: 0 0 6px rgba(230, 230, 250, 0.25); /* Adjusted shadow */
    margin: 0 0 15px 0; /* Added bottom margin */
}

.lore-text {
    font: italic 15px 'Cormorant Garamond', serif; /* Slightly smaller */
    color: #B19CD9;
    position: absolute;
    bottom: 15px; /* Closer to bottom */
    max-width: 80%;
    text-align: center;
    line-height: 1.5;
    animation: loreFade 5s infinite ease-in-out alternate; /* Changed to alternate */
    z-index: 5;
}

/* === Button Group (2x2 Grid) === */
.title-button-group {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 2 columns */
    grid-template-rows: auto auto; /* 2 rows */
    gap: 12px 15px; /* Row gap, Column gap */
    margin-top: 25px;
    z-index: 10;
    width: 70%; /* Adjust width as needed */
    max-width: 450px; /* Max width for the grid */
}

/* Common Button Style (Standardized) */
.title-button-group button {
    font-family: 'Cinzel', serif;
    color: #E6E6FA;
    border: 1px solid #8A7FAF; /* Standardized border */
    padding: 10px 15px; /* Standardized padding */
    font-size: 15px; /* Standardized size */
    font-weight: normal; /* Standardized weight */
    cursor: pointer;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3); /* Standardized shadow */
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 1px; /* Standardized spacing */
    background: linear-gradient(to bottom, #2A1E33, #1A0D2B);
    text-align: center;
    width: 100%; /* Make buttons fill grid cell */
    box-sizing: border-box;
}

.title-button-group button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(148, 0, 211, 0.25); /* Standardized hover shadow */
    background: linear-gradient(to bottom, #3A2E43, #2A1D3B); /* Subtle hover background */
}

.title-button-group button:active {
    transform: translateY(0px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Optional: Highlight specific buttons if desired */
#start-game-btn {
    border-color: #FFD700;
    color: #FFD700;
}
#start-game-btn:hover {
     box-shadow: 0 4px 10px rgba(255, 215, 0, 0.3);
}

#enter-code-btn {
    border-color: #ffcc66;
    color: #ffcc66;
}
#enter-code-btn:hover {
     box-shadow: 0 4px 10px rgba(255, 204, 102, 0.3);
}


.music-library-btn {
    border-color: #99ff99;
    color: #99ff99;
    /* text-align: center; /* Fallback, but might not be needed */
    display: flex; /* Add Flexbox */
    justify-content: center; /* Center horizontally */
    align-items: center; /* Center vertically (good practice) */
}
.music-library-btn:hover {
     box-shadow: 0 4px 10px rgba(153, 255, 153, 0.3);
}

/* Mobile adjustments for Button Grid */
@media (max-width: 768px), (max-height: 500px) {
    .title-button-group {
        width: 80%; /* Slightly wider on mobile */
        max-width: 350px;
        gap: 8px 10px; /* Tighter gap */
        margin-top: 20px;
    }
    .title-button-group button {
        padding: 8px 10px;
        font-size: 13px;
        letter-spacing: 0.5px;
    }
}

/* --- Animations --- */
@keyframes waveMotion { 0% { transform: rotate(0deg) scaleY(0.95); opacity: 0.15; } 50% { transform: rotate(2deg) scaleY(1.05); opacity: 0.25; } 100% { transform: rotate(-1deg) scaleY(0.98); opacity: 0.2; } }
@keyframes glowPulse { 0% { opacity: 0.4; transform: translate(-50%, -50%) scale(0.98); } 100% { opacity: 0.6; transform: translate(-50%, -50%) scale(1.02); } }
@keyframes titleGlow { 0%, 100% { opacity: 0.85; text-shadow: 0 0 8px rgba(148, 0, 211, 0.3); } 50% { opacity: 1; text-shadow: 0 0 12px rgba(148, 0, 211, 0.45), 0 0 20px rgba(75, 0, 130, 0.15); } }
@keyframes loreFade { 0%, 100% { opacity: 0.7; } 50% { opacity: 0.9; } }
/* Removed unused animations: rotateGeometry, rotateRing, whisperFade, orbit, pulseSphere, pathGlow, particleResonance */


/* --- Modals (Phase Code & Builder - Basic Styles) --- */
.phase-code-modal, .code-builder-modal {
    display: none;
    position: fixed; /* Changed from absolute */
    background: rgba(10, 0, 20, 0.97); /* Slightly more opaque */
    border: 2px solid #cc99ff; /* Adjusted color */
    border-radius: 10px;
    padding: 25px;
    z-index: 10001; /* Ensure above title screen */
    color: #fff;
    font-family: 'Cinzel', serif;
    box-shadow: 0 0 25px rgba(204, 153, 255, 0.35);
    /* Centering */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%; /* Responsive width */
    max-width: 500px; /* Max width */
    max-height: 80vh; /* Prevent overflow */
    overflow-y: auto; /* Allow scroll if needed */
}
.code-builder-modal {
    max-width: 700px; /* Builder can be wider */
}

.phase-code-modal h2, .code-builder-modal h2 {
    color: #cc99ff; text-align: center; margin-top: 0; margin-bottom: 15px;
}
.phase-code-modal p, .code-builder-modal p {
    text-align: center; margin-bottom: 20px; font-size: 0.9em; color: #ddd;
}
.phase-code-modal input[type="text"], .code-builder-modal input, .code-builder-modal select {
    width: 100%; padding: 10px; background: rgba(0, 0, 0, 0.7);
    border: 1px solid #8855aa; color: #ffccff; margin-bottom: 15px;
    font-family: monospace; text-align: center; box-sizing: border-box;
    border-radius: 4px;
}
.code-builder-modal input, .code-builder-modal select {
    text-align: left; font-family: 'Quicksand', sans-serif;
}
.phase-code-modal button, .code-builder-modal button {
    font-family: 'Cinzel', serif; border: none; padding: 8px 18px;
    margin: 5px; cursor: pointer; border-radius: 4px;
    transition: background-color 0.2s ease, transform 0.2s ease;
}
.phase-code-modal button:hover, .code-builder-modal button:hover { transform: translateY(-1px); }
#start-with-code-btn, #title-generate-code-btn, #title-start-code-btn { background: #663399; color: white; }
#cancel-code-btn, #title-close-builder-btn { background: #444; color: white; }
#custom-code-builder-btn { background: #884488; color: white; }
#title-copy-code-btn { background: #336633; color: white; }

/* Code Builder Specifics */
.code-builder-modal h3 { color: #cc99ff; margin-top: 15px; margin-bottom: 8px; font-size: 1.1em; }
.code-builder-modal label { color: #eee; font-size: 0.9em; }
.code-builder-modal div[style*="grid-template-columns"] { gap: 10px 15px; }
#title-special-abilities { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-bottom: 15px; }
#title-special-abilities label { display: block; background: rgba(255,255,255,0.05); padding: 5px 8px; border-radius: 4px; transition: background-color 0.2s ease; cursor: pointer; }
#title-special-abilities label:hover { background: rgba(255,255,255,0.1); }
#title-special-abilities input[type="checkbox"] { margin-right: 5px; vertical-align: middle; }
#title-special-abilities input[type="checkbox"]:checked + span { color: #ffcc66; } /* Assuming text is wrapped in span */
#title-generated-code-container { margin-top: 20px; text-align: center; display: none; }
#title-generated-code { width: 95%; padding: 10px; background: #111; color: #cc99ff; border: 1px solid #444; font-family: monospace; text-align: center; margin-bottom: 10px; }


/* ============================================= */
/* ====== MOBILE TITLE SCREEN ADJUSTMENTS ====== */
/* ============================================= */

@media (max-width: 768px), (max-height: 500px) {

    .title-text {
        font-size: 36px; /* Significantly smaller */
        letter-spacing: 1px;
        margin-top: 15vh;
    }
    .subtitle-text {
        font-size: 16px;
        margin-bottom: 10px;
    }
    .title-container {
        gap: 8px;
        margin-top: 3vh; /* Lower */
        width: 95%;
    }

    /* Button Group Layout */
    .title-button-group {
        flex-direction: column; /* Stack buttons */
        gap: 8px;
        margin-top: 15px;
        width: 70%; /* Limit width of stacked buttons */
        max-width: 300px;
    }
    .title-button-group button {
        padding: 8px 15px; /* Smaller padding */
        font-size: 14px; /* Smaller font */
        letter-spacing: 1px;
        width: 100%; /* Make buttons full width of container */
    }

    /* Scale down background elements */
    .eryndor-planet {
        transform: translate(-50%, -50%) scale(0.6); /* Smaller */
        top: 48%; /* Adjust vertical position */
    }
    /* Hide complex background elements on mobile */
    .celestial-harmonies, .planet-glow {
        display: none;
    }

    .lore-text {
        font-size: 13px;
        bottom: 8px;
        max-width: 90%;
        line-height: 1.4;
    }
} /* End Title Screen Media Query */

/* === Restored Background Elements === */

/* Sacred geometry overlay */
.sacred-geometry {
    position: absolute; width: 100%; height: 100%; top: 0; left: 0;
    z-index: 2; opacity: 0.07;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="600" height="600" viewBox="0 0 600 600"><circle cx="300" cy="300" r="280" fill="none" stroke="rgb(150,130,220)" stroke-width="0.5"/><circle cx="300" cy="300" r="230" fill="none" stroke="rgb(150,130,220)" stroke-width="0.5"/><circle cx="300" cy="300" r="180" fill="none" stroke="rgb(150,130,220)" stroke-width="0.5"/><polygon points="300,20 550,460 50,460" fill="none" stroke="rgb(150,130,220)" stroke-width="0.5"/><polygon points="300,580 50,140 550,140" fill="none" stroke="rgb(150,130,220)" stroke-width="0.5"/></svg>');
    background-position: center; background-repeat: no-repeat;
    mix-blend-mode: screen; pointer-events: none;
    animation: rotateGeometry 240s linear infinite;
}

/* Zodiac ring */
.zodiac-ring {
    position: absolute; top: 40%; left: 50%;
    transform: translate(-50%, -50%); width: 400px; height: 400px;
    border-radius: 50%; border: 1px solid rgba(150, 100, 200, 0.1);
    z-index: 2; animation: rotateRing 180s linear infinite;
}

.celestial-sphere {
    position: absolute; width: 8px; height: 8px; border-radius: 50%;
    background: radial-gradient(circle, rgba(220, 200, 255, 0.8) 0%, rgba(180, 160, 220, 0.4) 70%, transparent 100%);
    box-shadow: 0 0 8px rgba(180, 160, 220, 0.6);
    transform: translate(-50%, -50%);
}

/* Astrolabe elements */
.astrolabe {
    position: absolute; top: 40%; left: 50%; width: 500px; height: 500px;
    transform: translate(-50%, -50%); z-index: 1; opacity: 0.15;
}

.astrolabe-circle {
    position: absolute; border-radius: 50%; border: 1px solid rgba(180, 160, 220, 0.2);
    top: 50%; left: 50%; transform: translate(-50%, -50%);
}

.astrolabe-line {
    position: absolute; background: linear-gradient(90deg, transparent, rgba(180, 160, 220, 0.2), transparent);
    height: 1px; top: 50%; left: 0; width: 100%; transform-origin: center;
}

/* Constellation / Orbits */
.constellation { position: absolute; width: 100%; height: 100%; z-index: 1; }
.orbital-body { position: absolute; border-radius: 50%; background: radial-gradient(circle, rgba(220, 200, 255, 0.7) 0%, rgba(180, 160, 220, 0.3) 70%, transparent 100%); box-shadow: 0 0 8px rgba(180, 160, 220, 0.5); transform-origin: center; animation: pulseSphere 8s infinite alternate ease-in-out; }
.orbital-path { position: absolute; border: 1px dashed rgba(180, 160, 220, 0.15); border-radius: 50%; transform: translate(-50%, -50%); }
.orbit-system { position: absolute; width: 0; height: 0; }

/* --- Restored Animations --- */
@keyframes rotateGeometry { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
@keyframes rotateRing { 0% { transform: translate(-50%, -50%) rotate(0deg); } 100% { transform: translate(-50%, -50%) rotate(360deg); } }
@keyframes pulseSphere { 0% { opacity: 0.5; transform: scale(0.9); } 100% { opacity: 0.8; transform: scale(1.1); } }
@keyframes pathGlow { 0% { border-color: rgba(180, 160, 220, 0.1); } 50% { border-color: rgba(180, 160, 220, 0.25); } 100% { border-color: rgba(180, 160, 220, 0.1); } }
@keyframes orbit { from { transform: rotate(0deg) translateX(var(--orbit-radius)) rotate(0deg); } to { transform: rotate(360deg) translateX(var(--orbit-radius)) rotate(-360deg); } }

/* Ensure they are not hidden on mobile */
@media (max-width: 768px), (max-height: 500px) {
    .sacred-geometry, .astrolabe, .zodiac-ring, .constellation {
        display: block; /* Or initial, if they have another display type */
        /* Adjust scale if needed for mobile */
        transform: translate(-50%, -50%) scale(0.6); /* Example scale down */
        top: 45%; /* Match planet position */
    }
    .celestial-harmonies { display: block; } /* Ensure this is visible too */
}
