
:root {
    color-scheme: dark;

    --background: #0b1014;
    --surface: #111a20;
    --surface-secondary: #17232b;
    --surface-hover: #1d2b34;
    --border: #2a3942;
    --border-strong: #40535d;

    --primary: #65d6c4;
    --primary-hover: #8ae4d6;
    --primary-soft: rgba(101, 214, 196, 0.12);

    --button-bg: #32b8a5;
    --button-hover: #65d6c4;
    --button-text: #071411;

    --text: #f1f5f7;
    --text-secondary: #c0cbd1;
    --text-muted: #9aaab3;

    --success: #4ade80;
    --danger: #f87171;
    --focus: #38bdf8;

    --radius: 12px;
}

[data-theme="light"] {
    color-scheme: light;

    --background: #f5f7f8;
    --surface: #ffffff;
    --surface-secondary: #f5f7f8;
    --surface-hover: #e7efef;
    --border: #d5dfe2;
    --border-strong: #b9c9ce;

    --primary: #087f70;
    --primary-hover: #066b5e;
    --primary-soft: rgba(8, 127, 112, 0.09);

    --button-bg: #087f70;
    --button-hover: #066b5e;
    --button-text: #ffffff;

    --text: #182329;
    --text-secondary: #394950;
    --text-muted: #52646d;

    --success: #15803d;
    --danger: #b91c1c;
    --focus: #087ca7;
}

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

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    background: var(--background);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.6;
    transition: background 0.2s, color 0.2s;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 3px;
}

.app {
    width: min(100% - 40px, 760px);
    min-height: 100vh;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
}

.header {
    min-height: 82px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--text);
    text-decoration: none;
    font-size: 19px;
    font-weight: 800;
    letter-spacing: 1px;
    transition: color 0.2s;
}

.logo:hover {
    color: var(--primary);
}

.logo-icon {
    color: var(--primary);
    font-size: 25px;
}

.version {
    padding: 2px 7px;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: var(--surface-secondary);
    color: var(--text-secondary);
    font-size: 10px;
    letter-spacing: 0;
}

.theme-toggle {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface);
    color: var(--text);
    font-size: 19px;
    transition: background 0.2s, border-color 0.2s;
}

.theme-toggle:hover {
    background: var(--surface-hover);
    border-color: var(--border-strong);
}

.main {
    flex: 1;
    padding: 55px 0 40px;
}

.intro {
    margin-bottom: 30px;
}

.eyebrow {
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 2px;
}

.intro h1 {
    margin-top: 12px;
    font-size: clamp(30px, 6vw, 44px);
    line-height: 1.15;
    letter-spacing: -1.5px;
}

.intro h1 span {
    color: var(--primary);
}

.intro p {
    max-width: 540px;
    margin-top: 14px;
    color: var(--text-secondary);
    font-size: 15px;
}

.generator {
    padding: 26px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
    transition: background 0.2s, border-color 0.2s;
}

.generator h2 {
    margin-bottom: 20px;
    font-size: 19px;
}

.password-result {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
}

.password-result input {
    width: 100%;
    min-width: 0;
    height: 52px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface-secondary);
    color: var(--success);
    font-family: "Courier New", monospace;
    font-size: 16px;
    font-weight: 700;
}

.password-result input::placeholder {
    color: var(--text-muted);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 13px;
    font-weight: 400;
}

.copy-button {
    min-width: 100px;
    min-height: 52px;
    padding: 0 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface-secondary);
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    transition: background 0.2s, border-color 0.2s;
}

.copy-button:hover:not(:disabled) {
    background: var(--surface-hover);
    border-color: var(--border-strong);
}

.copy-button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.settings {
    margin-top: 27px;
}

.length-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 13px;
}

.length-heading label,
.options-heading h3 {
    font-size: 14px;
    font-weight: 700;
}

.length-heading output {
    min-width: 38px;
    padding: 3px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface-secondary);
    color: var(--primary);
    font-size: 13px;
    font-weight: 700;
    text-align: center;
}

#password-length {
    width: 100%;
    height: 8px;
    display: block;
    border-radius: 10px;
    background: var(--border);
    accent-color: var(--primary);
    cursor: pointer;
}

.range-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    color: var(--text-secondary);
    font-size: 11px;
}

.options-heading {
    margin-top: 27px;
    margin-bottom: 14px;
}

.options-heading p {
    margin-top: 3px;
    color: var(--text-secondary);
    font-size: 12px;
}

.options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.option {
    min-height: 67px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 11px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface-secondary);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.option:hover {
    border-color: var(--primary);
    background: var(--surface-hover);
}

.option input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.custom-checkbox {
    width: 19px;
    height: 19px;
    flex: 0 0 19px;
    display: grid;
    place-items: center;
    border: 1px solid var(--text-muted);
    border-radius: 5px;
    background: transparent;
    transition: background 0.2s, border-color 0.2s;
}

.option input:checked + .custom-checkbox {
    border-color: var(--button-bg);
    background: var(--button-bg);
}

.option input:checked + .custom-checkbox::after {
    content: "✓";
    color: var(--button-text);
    font-size: 13px;
    font-weight: 700;
}

.option input:focus-visible + .custom-checkbox {
    outline: 3px solid var(--focus);
    outline-offset: 3px;
}

.option-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.option-text strong {
    font-size: 12px;
    line-height: 1.5;
}

.option-text small {
    color: var(--text-secondary);
    font-size: 11px;
}

.generate-button {
    width: 100%;
    min-height: 49px;
    margin-top: 25px;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    border: 0;
    border-radius: 9px;
    background: var(--button-bg);
    color: var(--button-text);
    font-size: 14px;
    font-weight: 700;
    transition: background 0.2s, transform 0.2s;
}

.generate-button:hover {
    background: var(--button-hover);
}

.generate-button:active {
    transform: scale(0.99);
}

.generate-button span {
    font-size: 20px;
}

.status-message {
    min-height: 24px;
    margin-top: 13px;
    color: var(--text-secondary);
    font-size: 12px;
    text-align: center;
}

.status-message.error {
    color: var(--danger);
}

.info {
    display: flex;
    gap: 14px;
    margin-top: 22px;
    padding: 19px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.info-icon {
    flex-shrink: 0;
    color: var(--primary);
    font-size: 22px;
}

.info h2 {
    margin-bottom: 4px;
    font-size: 14px;
}

.info p {
    color: var(--text-secondary);
    font-size: 12px;
}

.footer {
    min-height: 65px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 11px;
}

.footer span:first-child {
    color: var(--primary);
    font-weight: 700;
    letter-spacing: 1px;
}

.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;
}

@media (max-width: 600px) {
    .app {
        width: min(100% - 28px, 760px);
    }

    .main {
        padding-top: 40px;
    }

    .generator {
        padding: 20px 16px;
    }

    .password-result {
        grid-template-columns: minmax(0, 1fr);
    }

    .copy-button {
        width: 100%;
    }

    .options {
        grid-template-columns: minmax(0, 1fr);
    }

    .footer {
        padding: 16px 0;
        flex-wrap: wrap;
    }
}

@media (max-width: 360px) {
    .intro h1 {
        font-size: 29px;
    }

    .generator {
        padding: 18px 13px;
    }

    .range-labels {
        font-size: 10px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
