@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@600;700;800&family=Roboto+Mono:wght@400;500;700&family=Roboto:wght@300;400;500;700&display=swap');

:root {
    /* --- COLOR PALETTE: COPPER DAWN --- */
    --obsidian: #0D0D0D; 
    --primary-color: #B87333; /* Muted Copper/Bronze */
    --secondary-color: #F5F5DC; /* Cream/Off-White */
    
    /* General Theme Variables */
    --background-color: #1A1A1D; /* Deep Charcoal */
    --card-background: #232328; /* Slightly lighter card for contrast */
    --text-color: var(--secondary-color);
    --border-color: #404040; 
    --high-contrast-divider: #666666; 
    --box-shadow-subtle: 0 4px 15px rgba(0, 0, 0, 0.5); 
    --border-radius-large: 8px; 
    
    /* Strength Colors (Used for Strength Bar, Entropy & Copy Success) */
    --strength-weak: #DC3545; 
    --strength-medium: #FFC107; 
    --strength-strong: #28A745; 
    --strength-excellent: #F5F5DC;
    
    /* Variables controlled by JS for strength bar */
    --strength-width: 0%; 
    --strength-color: transparent;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* --- STABLE PURE CSS DIGITAL BACKGROUND --- */
body {
    background-image: radial-gradient(circle at 10% 90%, rgba(184, 115, 51, 0.08) 1px, transparent 1px),
                      radial-gradient(circle at 90% 10%, rgba(245, 245, 220, 0.05) 1px, transparent 1px);
    background-size: 80px 80px, 80px 80px; 
    
    background-color: var(--background-color); 
    
    color: var(--text-color);
    font-family: 'Roboto', sans-serif;
    display: flex;
    flex-direction: column; 
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 30px;
}

/* --- MAIN CONTAINER (BEVELED EFFECT) --- */
.container {
    background-color: var(--card-background);
    box-shadow: var(--box-shadow-subtle), 
                inset 0 0 15px rgba(0, 0, 0, 0.5); 
    border-radius: var(--border-radius-large);
    padding: 60px; 
    width: 100%;
    max-width: 650px; 
    text-align: center;
    border: 1px solid var(--border-color);
}

h1 {
    margin-bottom: 5px;
    color: var(--primary-color);
    font-weight: 700;
    font-family: 'Orbitron', sans-serif; 
    font-size: 1.5em; /* Default Title Size for Desktop */
}

.subtitle {
    margin-bottom: 30px;
    color: #AAAAAA; 
    font-size: 1.1em;
}

/* --- PASSWORD DISPLAY --- */
.result-container {
    background-color: var(--obsidian); 
    border: 2px solid var(--primary-color); 
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 30px 35px; 
    margin-bottom: 20px;
    border-radius: 6px;
    font-size: 2.2em;
    font-weight: 500;
    box-shadow: 0 0 15px rgba(184, 115, 51, 0.3);
}

#password-display {
    color: var(--secondary-color); 
    flex-grow: 1;
    text-align: left;
    margin-right: 15px;
    font-family: 'Roboto Mono', monospace; 
    word-break: break-all;
    text-shadow: 0 0 5px var(--primary-color); 
}

/* --- BUTTONS --- */
.btn {
    background-color: var(--primary-color);
    color: var(--obsidian); 
    padding: 12px 22px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 700;
    text-transform: uppercase;
}

.btn:hover {
    background-color: #D48E54; 
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(184, 115, 51, 0.5);
}

.btn-large {
    width: 100%;
    padding: 22px 0;
    font-size: 1.4em;
    margin-top: 40px;
}

/* --- TOGGLE BUTTON STYLES --- */
.password-actions {
    display: flex;
    justify-content: flex-end; 
    margin-top: -10px; 
    margin-bottom: 20px;
}

.toggle-btn {
    background-color: transparent;
    color: var(--secondary-color); 
    border: 1px solid var(--secondary-color);
    padding: 8px 15px;
    font-size: 0.9em;
    font-weight: 500;
    text-transform: none; 
}

.toggle-btn:hover {
    background-color: rgba(245, 245, 220, 0.1); 
    box-shadow: none;
    transform: none;
}

/* --- SETTINGS BOX --- */
.settings-box {
    text-align: left;
    padding: 30px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-large);
    background-color: var(--obsidian);
    margin-top: 25px;
}

.settings-box h3 {
    color: var(--primary-color); 
    margin-bottom: 15px;
    padding-bottom: 10px;
    font-size: 1.4em;
    border-bottom: 1px solid var(--high-contrast-divider); 
    font-family: 'Orbitron', sans-serif; 
    font-weight: 600;
}

.setting-group {
    padding-top: 15px;
    border-top: 1px dashed var(--high-contrast-divider); 
}

.setting {
    margin-bottom: 20px;
}

.setting label {
    font-size: 1.1em;
    transition: color 0.1s;
}

/* --- KEY LENGTH DISPLAY AND SLIDER --- */
.length-control {
    display: flex;
    align-items: center;
    background-color: var(--card-background);
    padding: 10px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.5); 
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    background: var(--border-color); 
    border-radius: 4px;
    margin: 0 15px;
    transition: background 0.2s;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary-color); 
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid var(--obsidian);
    box-shadow: 0 0 5px var(--primary-color);
    transition: background 0.2s;
}

.length-display {
    color: var(--primary-color); 
    font-family: 'Roboto Mono', monospace;
    font-size: 1.1em;
    font-weight: 700;
    min-width: 25px; 
    text-align: right;
}

/* --- CHECKBOX STYLING --- */
.setting-checkbox {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.setting-checkbox input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    margin-right: 10px;
    background-color: var(--obsidian);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    cursor: pointer;
    outline: none;
    transition: all 0.2s;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.5); 
}

.setting-checkbox input[type="checkbox"]:checked {
    background-color: var(--primary-color); 
    border-color: var(--primary-color);
    box-shadow: 0 0 8px var(--primary-color); 
}

.setting-checkbox input[type="checkbox"]:checked::after {
    content: '';
    display: block;
    width: 5px;
    height: 10px;
    border: solid var(--obsidian); 
    border-width: 0 3px 3px 0;
    transform: rotate(45deg) translate(5px, -1px);
}

.setting-checkbox input[type="checkbox"]:checked + label {
    color: var(--primary-color); 
    font-weight: 500;
}

/* --- STRENGTH METER & ENTROPY DISPLAY --- */
.strength-meter-container {
    text-align: left;
    margin-bottom: 25px;
}

#strength-label {
    color: var(--secondary-color);
    font-weight: 500;
}

.strength-bar {
    width: 100%;
    height: 12px;
    background-color: var(--border-color);
    border-radius: 6px;
    overflow: hidden;
}

.strength-bar::before {
    content: '';
    display: block;
    height: 100%;
    width: var(--strength-width); 
    background-color: var(--strength-color);
    transition: width 0.4s ease, background-color 0.4s ease;
    border-radius: 6px;
}

/* --- INFO BLOCK STYLING (For the long security section) --- */
.info-block {
    margin-top: 30px;
    text-align: left;
    font-size: 0.9em;
    padding: 15px;
    border: 1px dashed var(--high-contrast-divider);
    border-radius: 4px;
    background-color: var(--card-background);
}

.info-block summary {
    cursor: pointer;
    color: var(--primary-color);
    font-weight: 700;
    list-style: none;
    padding-bottom: 5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1); 
    margin-bottom: 10px;
}

.info-block summary::before {
    content: "ⓘ "; 
    color: var(--primary-color);
    margin-right: 5px;
}

.info-block p, .info-block ul {
    margin-top: 10px;
    color: #AAAAAA;
    line-height: 1.6;
}

.info-block ul {
    list-style-type: square;
    margin-left: 20px;
    padding-left: 0;
}

.info-block .section-title {
    color: var(--primary-color);
    font-weight: 700;
    margin-top: 20px;
    margin-bottom: 5px;
    font-size: 1em;
}


/* --- FINAL FOOTER STYLING (Including Disclaimer) --- */
.site-footer {
    width: 100%;
    max-width: 650px;
    margin-top: 30px;
    padding-top: 10px;
    text-align: center;
}

.site-footer p {
    /* Set to primary color for branding */
    color: var(--primary-color); 
    font-size: 0.85em;
    font-family: 'Roboto Mono', monospace;
    line-height: 1.5;
}

.site-footer .disclaimer {
    color: var(--strength-weak); /* Use red for warning/legal text */
    font-size: 0.75em;
    margin-top: 5px;
}

/* ======================================================= */
/* ====== VISUAL CUE: SHAKE & GLOW ANIMATION ====== */
/* ======================================================= */

.generate-animation {
    animation: shake 0.3s ease-in-out, 
               glow-pulse 0.3s ease-out;
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-2px);
    }
    75% {
        transform: translateX(2px);
    }
}

@keyframes glow-pulse {
    0% {
        box-shadow: 0 0 15px rgba(184, 115, 51, 0.3);
    }
    50% {
        box-shadow: 0 0 25px var(--primary-color), 0 0 5px var(--secondary-color);
    }
    100% {
        box-shadow: 0 0 15px rgba(184, 115, 51, 0.3);
    }
}


/* ======================================================= */
/* ====== MOBILE RESPONSIVENESS (Portrait Fixes) ====== */
/* ======================================================= */

@media (max-width: 580px) {
    
    .container {
        padding: 25px;
        border-radius: 8px;
    }
    
    h1 {
        font-size: 1.2em; /* Reduced Title Size for Portrait */
    }
    .subtitle {
        font-size: 1em;
        margin-bottom: 20px;
    }

    .result-container {
        flex-direction: column; 
        align-items: stretch;
        padding: 18px 20px; 
        font-size: 1.5em; 
    }
    
    #password-display {
        text-align: center;
        margin-right: 0;
        margin-bottom: 15px; 
        word-break: break-all; 
        word-wrap: break-word; 
        font-size: 1.2em;
    }
    
    #copy-btn {
        width: 100%; 
        padding: 10px 0;
    }

    .btn-large {
        padding: 18px 0;
        font-size: 1.2em;
        margin-top: 25px;
    }

    .settings-box {
        padding: 15px;
    }

    .settings-box h3 {
        font-size: 1.2em;
    }

    .setting-checkbox label {
        font-size: 1em; 
    }
    
    .password-actions {
        justify-content: center; 
        margin-top: -5px; 
        margin-bottom: 15px;
    }
    
    .strength-meter-container {
        margin-bottom: 15px;
    }
    
    #entropy-label {
        margin-top: 3px !important;
        font-size: 0.8em !important;
    }
}


/* ======================================================= */
/* ====== LANDSCAPE MOBILE OPTIMIZATION (Final Fix) ====== */
/* ======================================================= */

@media (max-width: 800px) and (orientation: landscape) {
    
    /* Reduce overall container padding and box height */
    .container {
        padding: 20px 25px; 
    }
    
    /* Shrink the main title aggressively */
    h1 {
        font-size: 0.9em; /* **CRITICAL FIX**: Aggressively Reduced Title Size for Landscape to ensure fit */
    }
    .subtitle {
        margin-bottom: 15px;
    }
    
    /* Tighter spacing for the main button */
    .btn-large {
        padding: 15px 0;
        font-size: 1.1em;
        margin-top: 15px;
    }

    /* Shrink the password display area */
    .result-container {
        padding: 15px 18px; 
        font-size: 1.2em;
    }
    
    #password-display {
        font-size: 1em;
    }


    /* Tighten the settings box */
    .settings-box {
        padding: 15px;
        margin-top: 15px;
    }

    /* Stack checkboxes horizontally to save vertical space */
    .setting-group {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px 5px;
    }
    
    .setting-checkbox {
        margin-bottom: 0;
    }

    /* Condense the long info block */
    .info-block {
        margin-top: 15px;
        font-size: 0.8em;
    }
    
    /* Make the footer less obtrusive */
    .site-footer {
        margin-top: 10px;
    }
}