:root {
    color-scheme: light;
    --color-bg: #f4f5ff;
    --color-surface: #ffffff;
    --color-border: #e5e7eb;
    --color-text: #111827;
    --color-muted: #6b7280;
    --color-primary: #2563eb;
    --color-primary-dark: #1d4ed8;
    --color-accent: #10b981;
    --radius-lg: 18px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --shadow-soft: 0 16px 44px rgba(15, 23, 42, 0.12);
    --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

[data-theme="dark"] {
    color-scheme: dark;
    --color-bg: #0f172a;
    --color-surface: #1e293b;
    --color-border: #334155;
    --color-text: #f8fafc;
    --color-muted: #cbd5f5;
    --color-primary: #60a5fa;
    --color-primary-dark: #3b82f6;
    --color-accent: #34d399;
    --shadow-soft: 0 16px 44px rgba(2, 6, 23, 0.65);
}

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

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font-sans);
    color: var(--color-text);
    background: linear-gradient(180deg, var(--color-bg) 0%, rgba(255, 255, 255, 0.8) 100%);
    transition: background 0.3s ease, color 0.3s ease;
}

a {
    color: var(--color-primary);
    text-decoration: none;
}

a:hover,
a:focus {
    text-decoration: underline;
}

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

.site-header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}

.site-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 1.25rem 0;
}

.brand {
    display: flex;
    flex-direction: column;
}

.brand__name {
    font-size: 1.6rem;
    font-weight: 700;
}

.brand__tagline {
    font-size: 0.85rem;
    color: var(--color-muted);
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.site-nav__link {
    padding: 0.4rem 0.9rem;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.site-nav__link:hover,
.site-nav__link:focus-visible {
    background: rgba(37, 99, 235, 0.12);
    border-color: rgba(37, 99, 235, 0.3);
}

.site-nav__link--active {
    font-weight: 600;
    background: rgba(37, 99, 235, 0.15);
    border-color: rgba(37, 99, 235, 0.35);
}

.site-nav__separator {
    color: var(--color-muted);
}

.theme-toggle {
    border: 1px solid var(--color-border);
    border-radius: 999px;
    padding: 0.35rem 0.75rem;
    background: transparent;
    color: var(--color-text);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.theme-toggle__icon {
    font-size: 1.1rem;
}

.site-main {
    padding: 2.75rem 0 4rem;
}

.intro {
    text-align: center;
    margin-bottom: 2.5rem;
}

.intro h1 {
    font-size: clamp(2.2rem, 5vw, 3rem);
    margin: 0 0 0.85rem;
}

.intro p {
    margin: 0 auto;
    max-width: 620px;
    color: var(--color-muted);
    line-height: 1.6;
}

.tool {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    gap: 2rem;
    align-items: start;
}

.tool-form {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: clamp(1.75rem, 3vw, 2.5rem);
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.tool-form fieldset {
    border: none;
    margin: 0;
    padding: 0;
}

.tool-form legend {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.tool-form__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.tool-form__grid--output {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.tool-form__field {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.tool-form__label {
    font-weight: 600;
    font-size: 0.95rem;
}

.field-help {
    font-size: 0.8rem;
    color: var(--color-muted);
}

input[type="text"],
input[type="number"],
select {
    font: inherit;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    background: rgba(255, 255, 255, 0.8);
    color: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

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

input:focus,
select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
    outline: none;
}

.checkbox-grid {
    display: grid;
    gap: 0.4rem;
}

.tool-form__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.btn {
    font: inherit;
    border-radius: var(--radius-sm);
    padding: 0.75rem 1.5rem;
    border: 1px solid transparent;
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn--primary {
    background: var(--color-primary);
    color: #ffffff;
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.3);
}

.btn--primary:hover:not(:disabled),
.btn--primary:focus-visible:not(:disabled) {
    background: var(--color-primary-dark);
    transform: translateY(-1px);
}

.btn--ghost {
    background: transparent;
    border-color: rgba(37, 99, 235, 0.35);
    color: var(--color-primary);
}

.btn--ghost:hover:not(:disabled),
.btn--ghost:focus-visible:not(:disabled) {
    background: rgba(37, 99, 235, 0.12);
}

.btn--link {
    background: transparent;
    color: var(--color-muted);
    padding: 0.5rem 1rem;
}

.mode-switch {
    display: inline-flex;
    gap: 1rem;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    padding: 0.4rem 0.8rem;
    background: rgba(37, 99, 235, 0.08);
    align-self: flex-start;
}

.mode-switch label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
    cursor: pointer;
}

.strength {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    background: rgba(37, 99, 235, 0.08);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
}

.strength__label {
    font-weight: 600;
}

.strength__bar {
    background: rgba(37, 99, 235, 0.2);
    border-radius: 999px;
    height: 8px;
    overflow: hidden;
}

.strength__bar span {
    display: block;
    height: 100%;
    width: 0;
    background: var(--color-accent);
    transition: width 0.3s ease, background 0.3s ease;
}

.strength__entropy {
    font-size: 0.8rem;
    color: var(--color-muted);
}

.tool-preview {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: clamp(1.75rem, 3vw, 2.5rem);
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.preview-help {
    color: var(--color-muted);
    margin: 0;
}

.results {
    display: grid;
    gap: 1rem;
}

.result-item {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 1rem;
    display: grid;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.8);
}

.result-item__row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.result-item__text {
    font-family: "JetBrains Mono", "Fira Code", monospace;
    font-size: 0.95rem;
    word-break: break-all;
    flex: 1;
    color: var(--color-text);
}

.result-item__actions {
    display: flex;
    gap: 0.5rem;
}

.strength-pill {
    background: rgba(16, 185, 129, 0.18);
    color: var(--color-accent);
    border-radius: 999px;
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
}

.strength-pill--medium {
    background: rgba(245, 158, 11, 0.18);
    color: #f59e0b;
}

.strength-pill--weak {
    background: rgba(239, 68, 68, 0.18);
    color: #ef4444;
}

.history {
    border-top: 1px solid var(--color-border);
    padding-top: 1.25rem;
}

.history__header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.history__header h3 {
    margin: 0;
}

.history__list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.5rem;
}

.history__list li {
    font-family: "JetBrains Mono", "Fira Code", monospace;
    font-size: 0.85rem;
    color: var(--color-muted);
    word-break: break-all;
}

.qr-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1.5rem;
    z-index: 200;
}

.qr-modal__inner {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    padding: 2rem;
    max-width: 360px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    align-items: center;
}

.qr-modal[hidden],
[hidden] {
    display: none !important;
}

.qr-modal__canvas {
    width: 220px;
    height: 220px;
}

.seo-content {
    margin-top: 3rem;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    padding: clamp(1.75rem, 3vw, 2.5rem);
    display: flex;
    flex-direction: column;
    gap: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.seo-content__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 2rem;
}

.seo-content__list {
    margin: 1rem 0 0;
    padding-left: 1.2rem;
    line-height: 1.6;
}

.seo-content__list--ordered {
    list-style: decimal;
}

.seo-content__faq details {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 0.85rem 1rem;
    background: rgba(37, 99, 235, 0.09);
}

.seo-content__faq details + details {
    margin-top: 0.85rem;
}

.seo-content__faq summary {
    cursor: pointer;
    font-weight: 600;
}

.seo-content__faq p {
    margin: 0.75rem 0 0;
    color: var(--color-muted);
}

.site-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(15, 23, 42, 0.9);
    color: rgba(255, 255, 255, 0.9);
    padding: 2rem 0;
}

.site-footer__inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.site-footer__contact {
    color: #cbd5f5;
}

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

@media (max-width: 720px) {
    .site-header__inner {
        flex-wrap: wrap;
    }

    .theme-toggle {
        order: 3;
    }
}
