:root {
    --bg-page: #f4f4f5; 
    --card-bg: #ffffff;
    --text-primary: #09090b; 
    --text-secondary: #71717a;
    --accent: #0f172a; 
    --border: #e4e4e7;
    --input-bg: #fafafa;
    --shadow-card: 0 12px 32px -12px rgba(0, 0, 0, 0.1), 0 4px 12px -8px rgba(0, 0, 0, 0.05);
    --shadow-btn: 0 4px 6px -1px rgba(15, 23, 42, 0.1), 0 2px 4px -2px rgba(15, 23, 42, 0.1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-page);
    background-image: url('background.svg');
    background-repeat: no-repeat;
    background-position: right bottom;
    background-size: auto;
    background-attachment: fixed;
    color: var(--text-primary);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 40px 20px;
}

.app-wrapper { 
    width: 100%; 
    max-width: 680px; 
    position: relative;
    z-index: 10;
}

.main-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 40px 48px;
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.15), 0 10px 20px -5px rgba(0, 0, 0, 0.1);
}

/* --- 全新 Brand Header 样式 --- */
.header { 
    margin-bottom: 32px; 
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--accent);
    box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}

.brand-icon svg {
    width: 20px;
    height: 20px;
}

.brand h1 { 
    font-size: 24px; 
    font-weight: 700; 
    letter-spacing: -0.04em;
    margin: 0;
    /* 应用现代微渐变，消除纯黑的死板 */
    background: linear-gradient(135deg, var(--accent) 0%, #475569 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
/* -------------------------- */

.display-section { margin-bottom: 40px; }

.password-box {
    background: var(--input-bg);
    border-radius: 12px;
    border: 1px solid var(--border);
    overflow: hidden; 
    position: relative;
}

.password-content {
    padding: 24px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.password-text {
    font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
    word-break: break-all;
    letter-spacing: 0.5px;
}

.actions { display: flex; gap: 8px; flex-shrink: 0; }
.actions button {
    background: var(--card-bg);
    border: 1px solid var(--border);
    width: 40px; height: 40px;
    cursor: pointer;
    border-radius: 8px;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}
.actions button:hover { 
    background: #f4f4f5; 
    color: var(--text-primary);
    border-color: #d4d4d8;
}
.hidden { display: none !important; }

.strength-indicator {
    height: 4px;
    background: var(--border);
    width: 100%;
}
.bar { 
    height: 100%; 
    width: 0%; 
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.4s ease; 
}

.controls-section { margin-bottom: 40px; }

.length-control { margin-bottom: 36px; }
.label-row { 
    display: flex; justify-content: space-between; 
    margin-bottom: 16px; font-size: 15px; font-weight: 500; 
}
#length-val { 
    color: var(--accent); 
    font-weight: 600; font-size: 16px;
}

input[type="range"] {
    -webkit-appearance: none;
    width: 100%; height: 6px;
    background: var(--border);
    border-radius: 6px;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px; height: 20px;
    background: var(--card-bg); 
    border: 2px solid var(--accent);
    border-radius: 50%; cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.1s, border-width 0.1s;
}
input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    border-width: 3px;
}

.options-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
}

.section-title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 16px;
    font-weight: 600;
}

.options-grid { display: flex; flex-direction: column; gap: 16px; }

.switch-wrapper {
    display: flex; justify-content: space-between; align-items: center;
    cursor: pointer; user-select: none;
}
.label-text { font-size: 14px; color: var(--text-primary); font-weight: 500; }
.switch-container input { display: none; }

.switch-slider {
    display: block;
    width: 38px; height: 22px;
    background-color: var(--border);
    border-radius: 22px;
    position: relative;
    transition: background-color 0.3s;
}
.switch-slider::before {
    content: "";
    position: absolute;
    height: 18px; width: 18px;
    left: 2px; bottom: 2px;
    background-color: var(--card-bg);
    border-radius: 50%;
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
input:checked + .switch-slider { background-color: var(--accent); }
input:checked + .switch-slider::before { transform: translateX(16px); }

.primary-button {
    width: 100%;
    background: var(--accent);
    color: #ffffff;
    border: none;
    padding: 16px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-btn);
}
.primary-button:hover { background: #1e293b; transform: translateY(-1px); }
.primary-button:active { transform: translateY(1px); }

.app-footer { margin-top: 24px; text-align: center; }
.app-footer p { font-size: 12px; color: var(--text-secondary); mix-blend-mode: overlay; }

/* MODAL STYLES */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(9, 9, 11, 0.4); 
    backdrop-filter: blur(8px); 
    -webkit-backdrop-filter: blur(8px);
    z-index: 100; 
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease-in-out;
}

.modal-card {
    background: var(--card-bg);
    padding: 32px;
    border-radius: 16px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border: 1px solid var(--border);
    max-width: 400px;
    width: 90%;
    transform: translateY(20px);
    opacity: 0;
    animation: modalShow 0.3s forwards;
}

@keyframes modalShow {
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    color: var(--accent);
}

.modal-title {
    font-size: 16px;
    font-weight: 600;
}

.icon-navy {
    color: var(--accent);
}

.modal-text {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 24px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
}

.secondary-button {
    background: var(--card-bg);
    color: var(--accent);
    border: 1px solid var(--accent);
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.secondary-button:hover {
    background: #f1f5f9;
}

/* Mobile perfekt adaption */
@media (max-width: 768px) {
    body { 
        background-size: 50%;
        background-position: right bottom;
    }
    
    .main-card { padding: 32px 24px; }
    
    .password-content {
        padding: 20px;
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }
    
    .password-text {
        font-size: 20px;
        text-align: center;
    }
    
    .actions { justify-content: center; }
    
    .options-container { 
        grid-template-columns: 1fr; 
        gap: 32px; 
    }
}