* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #6366f1;
    --primary-hover: #5558e3;
    --secondary-color: #64748b;
    --background: #ffffff;
    --surface: #f8fafc;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.1);
}

@media (prefers-color-scheme: dark) {
    :root {
        --background: #0f172a;
        --surface: #1e293b;
        --text-primary: #f1f5f9;
        --text-secondary: #94a3b8;
        --border: #334155;
        --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
        --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.3);
    }
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(99, 102, 241, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(99, 102, 241, 0.05) 0%, transparent 50%);
}

.container {
    width: 100%;
    max-width: 480px;
}

header {
    text-align: center;
    margin-bottom: 40px;
}

h1 {
    font-size: 32px;
    font-weight: 600;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 16px;
}

main {
    background: var(--surface);
    border-radius: 24px;
    padding: 32px;
    box-shadow: var(--shadow-lg);
}

.password-display {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

#passwordOutput {
    flex: 1;
    padding: 16px;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 16px;
    font-family: 'Monaco', 'Courier New', monospace;
    background: var(--background);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

#passwordOutput:focus {
    outline: none;
    border-color: var(--primary-color);
}

.copy-btn {
    padding: 16px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.copy-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

.copy-btn:active {
    transform: translateY(0);
}

.strength-indicator {
    margin-bottom: 30px;
}

.strength-bar {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.strength-fill {
    height: 100%;
    width: 0;
    transition: all 0.3s ease;
    border-radius: 3px;
}

.strength-text {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.controls {
    margin-bottom: 30px;
}

.control-group {
    margin-bottom: 24px;
}

.control-group label {
    display: block;
    margin-bottom: 12px;
    font-weight: 500;
    color: var(--text-primary);
}

#lengthValue {
    color: var(--primary-color);
    font-weight: 600;
}

input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--border);
    outline: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    transition: all 0.3s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.options {
    display: grid;
    gap: 16px;
}

.checkbox {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 12px;
    border-radius: 8px;
    transition: background 0.3s ease;
}

.checkbox:hover {
    background: var(--background);
}

.checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.checkbox span {
    font-size: 14px;
    color: var(--text-primary);
}

.buttons {
    display: grid;
    gap: 12px;
    margin-bottom: 30px;
}

.btn {
    padding: 16px 24px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.3);
}

.btn-secondary {
    background: var(--background);
    color: var(--text-primary);
    border: 2px solid var(--border);
}

.btn-secondary:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.saved-passwords {
    border-top: 1px solid var(--border);
    padding-top: 24px;
}

.saved-passwords h3 {
    font-size: 18px;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.saved-list {
    display: grid;
    gap: 12px;
    max-height: 300px;
    overflow-y: auto;
}

.saved-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: var(--background);
    border-radius: 8px;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 14px;
}

.saved-item-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 12px;
}

.saved-item-actions {
    display: flex;
    gap: 8px;
}

.saved-item button {
    padding: 8px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.saved-item button:hover {
    background: var(--surface);
    color: var(--primary-color);
}

.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--surface);
    color: var(--text-primary);
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transition: all 0.3s ease;
    border: 1px solid var(--border);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

@media (max-width: 480px) {
    main {
        padding: 24px;
        border-radius: 20px;
    }
    
    h1 {
        font-size: 28px;
    }
    
    .buttons {
        grid-template-columns: 1fr;
    }
}