:root {
    --bg-dark: #0f0f0f;
    --bg-card: #171717;
    --bg-elevated: #1f1f1f;
    --bg-panel: rgba(23, 23, 23, 0.9);
    --surface-soft: rgba(31, 31, 31, 0.86);
    --text: #fafafa;
    --text-muted: #a1a1a1;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --warning: #f59e0b;
    --danger: #fb7185;
    --border: rgba(255, 255, 255, 0.08);
    --border-accent: rgba(59, 130, 246, 0.3);
    --shadow: 0 24px 60px rgba(0, 0, 0, 0.32);
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 12px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Space Grotesk", system-ui, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(59, 130, 246, 0.18), transparent 34%),
        radial-gradient(circle at 88% 18%, rgba(59, 130, 246, 0.1), transparent 24%),
        linear-gradient(180deg, #0f0f0f 0%, #111111 52%, #0b0b0b 100%);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background:
        linear-gradient(120deg, rgba(255, 255, 255, 0.02), transparent 40%),
        radial-gradient(circle at 20% 80%, rgba(59, 130, 246, 0.08), transparent 30%);
    pointer-events: none;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input {
    font: inherit;
}

.skip-link {
    position: absolute;
    top: -120px;
    left: 16px;
    z-index: 10;
    padding: 12px 16px;
    border-radius: 999px;
    background: var(--accent);
    color: var(--bg-dark);
    transition: top 0.2s ease;
}

.skip-link:focus {
    top: 16px;
}

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

.container {
    width: min(1300px, 90vw);
    margin: 0 auto;
}

.page-header {
    position: sticky;
    top: 0;
    z-index: 5;
    background: rgba(15, 15, 15, 0.76);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.page-header .container {
    padding: 24px 0;
}

.site-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.minimal-nav {
    justify-content: flex-start;
}

.back-link {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 10px 16px;
    border-radius: 999px;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    transition: all 0.25s ease;
}

.back-link:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.06);
    transform: translateY(-1px);
}

.page-shell {
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
    padding: 72px 0 88px;
}

.intro {
    max-width: 820px;
    margin-bottom: 42px;
    text-align: center;
    margin-left: auto;
    margin-right: auto;
}

.eyebrow,
.panel-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 22px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border);
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.intro h1,
.generator-panel h2 {
    margin: 0;
    font-family: "Fraunces", Georgia, serif;
    letter-spacing: -0.03em;
}

.intro h1 {
    font-size: clamp(2.7rem, 7vw, 5rem);
    line-height: 1.04;
    max-width: 12ch;
    margin: 0 auto;
}

.intro-copy {
    margin: 20px auto 0;
    max-width: 62ch;
    font-size: 1.05rem;
    line-height: 1.75;
    color: var(--text-muted);
}

.intro-points {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 26px;
    justify-content: center;
}

.intro-points span {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.03);
}

.generator-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.95fr);
    gap: 22px;
    align-items: start;
}

.primary-column {
    display: grid;
    gap: 22px;
    align-content: start;
}

.generator-panel,
.controls-panel,
.tips-panel {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.generator-panel {
    padding: 28px;
}

.controls-panel,
.tips-panel {
    padding: 24px;
}

.panel-head {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 26px;
}

.generator-panel h2 {
    font-size: clamp(1.7rem, 3vw, 2.4rem);
}

.primary-button,
.ghost-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0 18px;
    border-radius: 999px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.primary-button {
    background: var(--accent);
    color: var(--text);
    font-weight: 600;
}

.ghost-button {
    background: rgba(255, 255, 255, 0.03);
    border-color: var(--border);
    color: var(--text);
    font-weight: 600;
}

.primary-button:hover,
.ghost-button:hover {
    transform: translateY(-1px);
}

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

.password-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    margin-bottom: 22px;
}

#password {
    width: 100%;
    min-height: 64px;
    padding: 0 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    background: rgba(0, 0, 0, 0.24);
    color: var(--text);
    font-size: clamp(1.05rem, 2vw, 1.35rem);
    letter-spacing: 0.04em;
}

#password::placeholder {
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: normal;
}

.strength-block {
    padding: 18px 18px 16px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.02);
}

.strength-meta {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.strength-meta strong {
    display: block;
    margin-top: 6px;
    font-size: 1rem;
}

.strength-caption,
.summary-card span,
.status-message,
.tips-panel li,
.control-row label,
.options-group legend {
    color: var(--text-muted);
}

.strength-bar {
    width: 100%;
    height: 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.strength-bar span {
    display: block;
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--danger) 0%, var(--warning) 50%, var(--accent) 100%);
    transition: width 0.25s ease;
}

.status-message {
    margin: 12px 0 0;
    line-height: 1.6;
}

.status-message[data-tone="success"] {
    color: #86efac;
}

.status-message[data-tone="error"] {
    color: #fda4af;
}

.controls-panel {
    display: grid;
    gap: 20px;
}

.control-group,
.options-group,
.summary-card {
    padding: 18px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.control-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    font-weight: 600;
}

#lengthDisplay {
    min-width: 40px;
    text-align: right;
    color: var(--text);
}

input[type="range"] {
    width: 100%;
    accent-color: var(--accent);
}

.options-group {
    margin: 0;
    padding-top: 14px;
}

.options-group legend {
    padding: 0 8px;
    font-size: 0.95rem;
    font-weight: 600;
}

.toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    cursor: pointer;
}

.toggle + .toggle {
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.toggle input {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}

.summary-grid {
    display: grid;
    gap: 12px;
}

.summary-card strong {
    display: block;
    margin-top: 10px;
    color: var(--text);
    line-height: 1.5;
}

.tips-panel ul {
    margin: 0;
    padding-left: 18px;
    line-height: 1.8;
}

.tips-panel li + li {
    margin-top: 8px;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
    outline: 2px solid rgba(59, 130, 246, 0.9);
    outline-offset: 3px;
}

@media (max-width: 960px) {
    .generator-layout {
        grid-template-columns: 1fr;
    }

    .primary-column {
        gap: 18px;
    }
}

@media (max-width: 640px) {
    .page-header .container {
        width: min(100% - 24px, 1300px);
        padding: 18px 0;
    }

    .page-shell {
        width: min(100% - 24px, 1180px);
        padding: 28px 0 48px;
    }

    .back-link {
        width: 100%;
        justify-content: center;
    }

    .panel-head,
    .strength-meta,
    .control-row {
        flex-direction: column;
        align-items: stretch;
    }

    .password-row {
        grid-template-columns: 1fr;
    }

    .primary-button,
    .ghost-button {
        width: 100%;
    }

    .intro-points {
        gap: 8px;
    }

    .intro-points span {
        width: 100%;
    }
}
