* {
    box-sizing: border-box;
}

:root {
    --bg-gradient-1: #f0f4f8;
    --bg-gradient-2: #d9e2ec;
    --container-bg: #fff;
    --container-shadow: rgba(0,0,0,0.1);
    --text-primary: #1a1a2e;
    --text-secondary: #333;
    --text-muted: #595959;
    --input-bg: #f5f5f5;
    --input-border: #e0e0e0;
    --input-hover: #e8e8e8;
    --accent: #1a1a2e;
    --accent-gradient-1: #1a1a2e;
    --accent-gradient-2: #16213e;
    --focus-ring: rgba(26, 26, 46, 0.4);
}

[data-theme="dark"] {
    --bg-gradient-1: #1a1a2e;
    --bg-gradient-2: #16213e;
    --container-bg: #2d2d44;
    --container-shadow: rgba(0,0,0,0.4);
    --text-primary: #f0f0f0;
    --text-secondary: #e0e0e0;
    --text-muted: #b0b0b0;
    --input-bg: #3d3d5c;
    --input-border: #4d4d6c;
    --input-hover: #4a4a6a;
    --accent: #6c63ff;
    --accent-gradient-1: #6c63ff;
    --accent-gradient-2: #5a52d5;
    --focus-ring: rgba(108, 99, 255, 0.4);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg-gradient-1: #1a1a2e;
        --bg-gradient-2: #16213e;
        --container-bg: #2d2d44;
        --container-shadow: rgba(0,0,0,0.4);
        --text-primary: #f0f0f0;
        --text-secondary: #e0e0e0;
        --text-muted: #b0b0b0;
        --input-bg: #3d3d5c;
        --input-border: #4d4d6c;
        --input-hover: #4a4a6a;
        --accent: #6c63ff;
        --accent-gradient-1: #6c63ff;
        --accent-gradient-2: #5a52d5;
        --focus-ring: rgba(108, 99, 255, 0.4);
    }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-1) 0%, var(--bg-gradient-2) 100%);
    min-height: 100vh;
    margin: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    transition: background 0.3s;
}

.container {
    background: var(--container-bg);
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 20px 60px var(--container-shadow);
    max-width: 540px;
    width: 100%;
    transition: background 0.3s, box-shadow 0.3s;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

h1 {
    margin: 0;
    color: var(--text-primary);
    font-size: 24px;
    transition: color 0.3s;
}

.tagline {
    margin: 4px 0 0 0;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 400;
    transition: color 0.3s;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.lang-select {
    background: var(--input-bg);
    border: 2px solid var(--input-border);
    border-radius: 30px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
    transition: background 0.3s, border-color 0.3s, color 0.3s;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
    min-width: 105px;
    height: 38px;
}

.lang-select:hover {
    background-color: var(--input-hover);
}

.lang-select:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
}

.theme-toggle {
    background: var(--input-bg);
    border: 2px solid var(--input-border);
    border-radius: 30px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 18px;
    transition: background 0.3s, border-color 0.3s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.theme-toggle:hover {
    background: var(--input-hover);
}

.theme-toggle:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
}

.theme-toggle .icon {
    transition: transform 0.3s;
}

.password-display {
    background: var(--input-bg);
    border: 2px solid var(--input-border);
    border-radius: 8px;
    padding: 15px;
    font-family: 'Courier New', monospace;
    font-size: 18px;
    word-break: break-all;
    min-height: 54px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    position: relative;
    color: var(--text-primary);
    transition: background 0.3s, border-color 0.3s, color 0.3s;
}

.password-display.copied {
    border-color: #4caf50;
    background: rgba(76, 175, 80, 0.2);
}

.copy-btn {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    opacity: 0.6;
    transition: opacity 0.2s;
    border-radius: 4px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.copy-btn:hover {
    opacity: 1;
}

.copy-btn:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
    opacity: 1;
}

.copy-btn .copy-icon {
    width: 20px;
    height: 20px;
}

.setting {
    margin-bottom: 20px;
}

.setting-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: color 0.3s;
}

.length-control {
    display: flex;
    align-items: center;
    gap: 15px;
}

input[type="range"] {
    flex: 1;
    height: 8px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background: var(--input-border);
    border-radius: 4px;
    outline: none;
    transition: background 0.3s;
}

input[type="range"]:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.3s;
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    transition: background 0.3s;
}

.length-value {
    background: var(--accent);
    color: #fff;
    padding: 5px 12px;
    border-radius: 4px;
    min-width: 45px;
    text-align: center;
    font-weight: bold;
    transition: background 0.3s;
}

.checkboxes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: var(--input-bg);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.checkbox-item:hover {
    background: var(--input-hover);
}

.checkbox-item:focus-within {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
}

.checkbox-item input {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--accent);
}

.checkbox-item input:focus {
    outline: none;
}

.checkbox-item span {
    font-size: 14px;
    color: var(--text-secondary);
    transition: color 0.3s;
}

.generate-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, var(--accent-gradient-1) 0%, var(--accent-gradient-2) 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, background 0.3s;
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

.generate-btn:active {
    transform: translateY(0);
}

.generate-btn:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
}

.strength-bar {
    height: 6px;
    background: var(--input-border);
    border-radius: 3px;
    margin-top: 10px;
    overflow: hidden;
    transition: background 0.3s;
}

.strength-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s, background 0.3s;
}

.strength-text {
    font-size: 12px;
    margin-top: 5px;
    text-align: center;
    color: var(--text-muted);
    transition: color 0.3s;
}

.crack-time {
    background: var(--input-bg);
    border: 2px solid var(--input-border);
    border-radius: 8px;
    padding: 15px;
    margin-top: 20px;
    transition: background 0.3s, border-color 0.3s;
}

.crack-time h2 {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    transition: color 0.3s;
}

.crack-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--input-border);
    font-size: 13px;
}

.crack-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.crack-label {
    color: var(--text-muted);
    transition: color 0.3s;
}

.crack-value {
    font-weight: 600;
    color: var(--text-primary);
    font-family: 'Courier New', monospace;
    transition: color 0.3s;
}

.crack-info {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 10px;
    line-height: 1.4;
    transition: color 0.3s;
}

.combinations {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
    margin-top: 8px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.faq-section {
    background: var(--input-bg);
    border: 2px solid var(--input-border);
    border-radius: 8px;
    padding: 15px;
    margin-top: 20px;
    transition: background 0.3s, border-color 0.3s;
}

.faq-section h2 {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    transition: color 0.3s;
}

.faq-item {
    border-bottom: 1px solid var(--input-border);
    padding: 10px 0;
}

.faq-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.faq-item summary {
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: color 0.3s;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::after {
    content: '+';
    font-size: 16px;
    font-weight: 600;
    color: var(--text-muted);
    transition: transform 0.2s, color 0.3s;
}

.faq-item[open] summary::after {
    content: '\2212';
}

.faq-item p {
    margin: 8px 0 0 0;
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-muted);
    transition: color 0.3s;
}

.footer {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    padding: 20px 0 10px 0;
    opacity: 0.8;
    transition: opacity 0.2s, color 0.3s;
}

.footer:hover {
    opacity: 1;
}

.footer a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}

.footer a:hover {
    color: var(--accent);
    text-decoration: underline;
}
