:root {
    --bg: #0c1218;
    --bg-soft: #101820;
    --surface: #151f29;
    --surface-raised: #1a2632;
    --surface-soft: #111a23;
    --surface-press: #202e3b;
    --text: #e9f1f5;
    --text-soft: #c0ccd5;
    --muted: #8e9eaa;
    --dim: #667782;
    --accent: #63d8f4;
    --accent-strong: #49c9e8;
    --accent-soft: rgba(99, 216, 244, 0.10);
    --success: #55dda3;
    --warning: #f0c96b;
    --danger: #ff7582;
    --border: rgba(177, 209, 223, 0.14);
    --border-strong: rgba(177, 209, 223, 0.23);
    --border-focus: rgba(99, 216, 244, 0.58);
    --shadow: 0 22px 60px rgba(0, 0, 0, 0.30);
    --shadow-soft: 0 10px 28px rgba(0, 0, 0, 0.20);
    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-sm: 10px;
    --content-max: 700px;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: var(--bg);
    color-scheme: dark;
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100svh;
    color: var(--text);
    background:
        radial-gradient(circle at 12% 0%, rgba(99, 216, 244, 0.07), transparent 34rem),
        radial-gradient(circle at 88% 100%, rgba(92, 79, 170, 0.055), transparent 30rem),
        linear-gradient(180deg, #0e151d 0%, var(--bg) 48%, #0b1117 100%);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

button,
input {
    font: inherit;
}

button {
    -webkit-tap-highlight-color: transparent;
}

button:disabled {
    cursor: not-allowed;
}

.page-shell {
    width: min(calc(100% - clamp(24px, 6vw, 72px)), 900px);
    margin-inline: auto;
    min-height: 100svh;
    padding-block: clamp(18px, 5vw, 58px) max(18px, env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.generator-card {
    width: min(100%, var(--content-max));
    margin-inline: auto;
    padding: clamp(20px, 4vw, 38px);
    background: linear-gradient(180deg, rgba(25, 37, 48, 0.98), rgba(19, 29, 39, 0.98));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.brand-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: clamp(22px, 4vw, 30px);
}

.brand-mark {
    flex: 0 0 auto;
    min-width: 56px;
    height: 44px;
    padding-inline: 12px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(99, 216, 244, 0.30);
    border-radius: var(--radius-sm);
    background: linear-gradient(180deg, rgba(99, 216, 244, 0.12), rgba(99, 216, 244, 0.05));
    color: var(--accent);
    font-size: 0.82rem;
    font-weight: 850;
    letter-spacing: 0.13em;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

h1,
h2,
p {
    margin: 0;
}

h1 {
    font-size: clamp(1.28rem, 3.6vw, 1.72rem);
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.eyebrow {
    margin-top: 5px;
    color: var(--muted);
    font-size: 0.67rem;
    font-weight: 700;
    letter-spacing: 0.14em;
}

.section-label-row,
.section-title-row,
.password-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.section-label,
.section-title-row h2 {
    font-size: 0.96rem;
    font-weight: 760;
}

.section-label-row {
    margin-bottom: 10px;
}

.security-tag {
    flex: 0 0 auto;
    color: var(--success);
    font-size: 0.74rem;
    font-weight: 750;
    white-space: nowrap;
}

.password-display-wrapper {
    display: flex;
    align-items: stretch;
    gap: 12px;
    min-width: 0;
    padding: clamp(15px, 3vw, 19px);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    background: linear-gradient(180deg, rgba(10, 17, 24, 0.85), rgba(13, 21, 29, 0.92));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
    transition: border-color 140ms ease, box-shadow 140ms ease;
}

.password-display-wrapper:focus-within {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 4px rgba(99, 216, 244, 0.07), inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

.password-display {
    flex: 1 1 auto;
    min-width: 0;
    align-self: center;
    color: #f2f8fb;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: clamp(0.98rem, 3vw, 1.28rem);
    font-weight: 700;
    letter-spacing: 0.015em;
    line-height: 1.58;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.copy-btn,
.refresh-btn,
.step-btn {
    min-height: 44px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease, transform 100ms ease, box-shadow 140ms ease;
}

.copy-btn {
    flex: 0 0 auto;
    min-width: 122px;
    padding-inline: 17px;
    border: 1px solid rgba(99, 216, 244, 0.22);
    background: linear-gradient(180deg, var(--accent), var(--accent-strong));
    color: #071116;
    font-weight: 800;
    box-shadow: 0 8px 20px rgba(99, 216, 244, 0.11);
}

.copy-btn:hover {
    box-shadow: 0 10px 24px rgba(99, 216, 244, 0.15);
}

.copy-btn:active,
.refresh-btn:active,
.step-btn:active {
    transform: translateY(1px);
}

.password-meta {
    margin-top: 12px;
}

.strength-indicator {
    min-width: 92px;
    min-height: 34px;
    padding: 7px 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 0.79rem;
    font-weight: 800;
}

.strength-indicator.weak {
    color: var(--danger);
    background: rgba(255, 117, 130, 0.085);
    border-color: rgba(255, 117, 130, 0.16);
}

.strength-indicator.medium {
    color: var(--warning);
    background: rgba(240, 201, 107, 0.085);
    border-color: rgba(240, 201, 107, 0.15);
}

.strength-indicator.strong,
.strength-indicator.ultra {
    color: var(--success);
    background: rgba(85, 221, 163, 0.08);
    border-color: rgba(85, 221, 163, 0.15);
}

.refresh-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 132px;
    padding-inline: 15px;
    background: rgba(255, 255, 255, 0.015);
    color: var(--text-soft);
    border: 1px solid var(--border-strong);
    font-weight: 700;
}

.refresh-btn:hover {
    border-color: rgba(99, 216, 244, 0.44);
    color: var(--accent);
    background: rgba(99, 216, 244, 0.045);
}

.generator-hint {
    margin-top: 9px;
    color: var(--dim);
    font-size: 0.72rem;
    line-height: 1.55;
}

.section-divider {
    height: 1px;
    margin-block: clamp(24px, 4vw, 32px);
    background: var(--border);
}

.section-title-row--options {
    margin-bottom: 10px;
}

.section-title-row--options p {
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.74rem;
}

.length-control {
    margin-bottom: clamp(26px, 5vw, 34px);
}

.section-title-row {
    margin-bottom: 12px;
}

.length-value {
    min-width: 3ch;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
    font-size: 1.04rem;
    font-weight: 820;
    text-align: right;
}

.slider-wrapper {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
}

.step-btn {
    width: 44px;
    border: 1px solid var(--border-strong);
    background: var(--surface-raised);
    color: var(--text-soft);
    font-size: 1.13rem;
    font-weight: 700;
}

.step-btn:hover:not(:disabled) {
    border-color: rgba(99, 216, 244, 0.48);
    color: var(--accent);
    background: var(--surface-press);
}

.step-btn:disabled {
    opacity: 0.42;
}

input[type="range"] {
    --range-progress: 14.5%;
    width: 100%;
    min-width: 0;
    height: 6px;
    margin: 0;
    appearance: none;
    -webkit-appearance: none;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--accent) 0 var(--range-progress), #31404d var(--range-progress) 100%);
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    width: 20px;
    height: 20px;
    appearance: none;
    -webkit-appearance: none;
    border: 3px solid var(--surface);
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.34);
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border: 3px solid var(--surface);
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.34);
}

.range-labels {
    margin-top: 6px;
    padding-inline: 54px;
    display: flex;
    justify-content: space-between;
    color: var(--dim);
    font-size: 0.68rem;
    font-variant-numeric: tabular-nums;
}

.options-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr));
    border-top: 1px solid var(--border);
}

.option-item {
    min-width: 0;
    min-height: 68px;
    padding: 12px 2px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid var(--border);
}

.option-copy {
    min-width: 0;
}

.option-title,
.option-note {
    display: block;
}

.option-title {
    font-size: 0.9rem;
    font-weight: 730;
}

.option-note {
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.68rem;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.toggle-switch {
    position: relative;
    flex: 0 0 auto;
    width: 48px;
    height: 28px;
}

.toggle-switch input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.slider-toggle {
    position: absolute;
    inset: 0;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    background: #263541;
    cursor: pointer;
    transition: background-color 140ms ease, border-color 140ms ease;
}

.slider-toggle::before {
    content: "";
    position: absolute;
    top: 4px;
    left: 4px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #dce6eb;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.34);
    transition: transform 140ms ease;
}

.toggle-switch input:checked + .slider-toggle {
    border-color: rgba(99, 216, 244, 0.50);
    background: rgba(99, 216, 244, 0.34);
}

.toggle-switch input:checked + .slider-toggle::before {
    transform: translateX(20px);
    background: #f3fbfe;
}

.copy-message {
    position: fixed;
    inset: auto max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) auto;
    z-index: 20;
    max-width: min(320px, calc(100vw - 32px));
    padding: 11px 14px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: #17232e;
    box-shadow: var(--shadow-soft);
    color: var(--text);
    font-size: 0.8rem;
    font-weight: 700;
    opacity: 0;
    transform: translateY(6px);
    pointer-events: none;
    transition: opacity 140ms ease, transform 140ms ease;
}

.copy-message.visible {
    opacity: 1;
    transform: translateY(0);
}

.copy-message.success {
    border-color: rgba(85, 221, 163, 0.28);
}

.copy-message.error {
    border-color: rgba(255, 117, 130, 0.28);
    color: var(--danger);
}

.site-footer {
    width: min(100%, var(--content-max));
    margin: clamp(14px, 3vw, 20px) auto 0;
    padding-inline: 4px;
    text-align: center;
    font-size: 0.74rem;
}

.site-footer a {
    color: var(--dim);
    text-decoration: none;
    transition: color 140ms ease;
}

.site-footer a:hover {
    color: var(--accent);
}

.site-footer .username {
    color: var(--accent);
    font-weight: 750;
}

button:focus-visible,
input[type="range"]:focus-visible,
.toggle-switch input:focus-visible + .slider-toggle,
.site-footer a:focus-visible {
    outline: 3px solid rgba(99, 216, 244, 0.28);
    outline-offset: 3px;
}

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

@media (max-width: 620px) {
    .page-shell {
        width: min(calc(100% - 24px), 700px);
        justify-content: flex-start;
    }

    .generator-card {
        padding: 20px;
    }

    .password-display-wrapper {
        flex-direction: column;
        gap: 10px;
    }

    .copy-btn {
        width: 100%;
    }

    .password-meta {
        align-items: stretch;
    }

    .refresh-btn {
        min-width: 0;
        flex: 1 1 160px;
    }

    .options-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 390px) {
    .generator-card {
        padding: 17px;
        border-radius: 16px;
    }

    .brand-header {
        gap: 11px;
    }

    .brand-mark {
        min-width: 49px;
        height: 39px;
        padding-inline: 8px;
        font-size: 0.74rem;
    }

    .password-meta {
        flex-wrap: wrap;
    }

    .strength-indicator,
    .refresh-btn {
        min-width: 0;
    }

    .refresh-btn {
        flex: 1 1 160px;
    }
}

@media (max-width: 350px) {
    .page-shell {
        width: calc(100% - 16px);
    }

    .generator-card {
        padding: 15px;
    }

    .password-display {
        font-size: 0.95rem;
    }
}

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