:root {
    --black: #0a0a0a;
    --white: #ffffff;
    --gray-50: #fafafa;
    --gray-100: #f4f4f4;
    --gray-300: #e2e2e2;
    --gray-500: #8a8a8a;
    --gray-600: #6b6b6b;
    --border: #e6e6e6;
    --radius-lg: 12px;
    --radius-md: 8px;
    --radius-sm: 6px;
    --font-sans: 'Inter', Corbel, 'Segoe UI', system-ui, -apple-system, Helvetica, Arial, sans-serif;
    --font-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
}

body {
    background: var(--white);
    color: var(--black);
    font-family: var(--font-sans);
    line-height: 1.5;
    font-size: 15px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

.wrap {
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Header */
.site-header {
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: saturate(180%) blur(8px);
    -webkit-backdrop-filter: saturate(180%) blur(8px);
    z-index: 10;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    gap: 16px;
}

.brand {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--black);
    text-decoration: none;
    letter-spacing: -0.02em;
    flex-shrink: 0;
    font-family: var(--font-mono);
}

.brand span {
    color: var(--gray-500);
    font-weight: 500;
}

.site-nav {
    display: flex;
    gap: clamp(14px, 4vw, 22px);
}

.site-nav a {
    color: var(--gray-600);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 500;
    padding: 6px 0;
    border-bottom: 1px solid transparent;
    transition: color 0.15s ease, border-color 0.15s ease;
    white-space: nowrap;
}

.site-nav a:hover,
.site-nav a.active {
    color: var(--black);
    border-bottom-color: var(--black);
}

/* Main */
main.wrap {
    flex: 1;
    padding-top: clamp(26px, 5vw, 42px);
    padding-bottom: 40px;
}

h1 {
    font-size: clamp(1.35rem, 4vw, 1.75rem);
    font-weight: 700;
    margin: 0 0 6px;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.subtitle {
    color: var(--gray-600);
    margin: 0 0 24px;
    font-size: 0.88rem;
    max-width: 48ch;
}

/* Generator card */
.card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: clamp(14px, 3vw, 20px);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.token-output {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
}

.token-field-wrap {
    flex: 1;
    min-width: 0;
    background: var(--black);
    border-radius: var(--radius-md);
    padding: 1px;
}

#tokenField {
    width: 100%;
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: clamp(0.78rem, 2.2vw, 0.9rem);
    padding: 11px 13px;
    border: none;
    border-radius: calc(var(--radius-md) - 1px);
    background: var(--black);
    color: var(--white);
    letter-spacing: 0.01em;
    overflow-x: auto;
    white-space: nowrap;
    height: 100%;
}

#tokenField:focus {
    outline: 2px solid var(--gray-500);
    outline-offset: 2px;
}

.btn {
    appearance: none;
    border: 1px solid var(--black);
    background: var(--black);
    color: var(--white);
    padding: 9px 14px;
    border-radius: var(--radius-md);
    font-size: 0.82rem;
    font-family: var(--font-sans);
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: opacity 0.15s ease, transform 0.1s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn svg {
    width: 14px;
    height: 14px;
}

.btn:hover {
    opacity: 0.8;
}

.btn:active {
    transform: scale(0.98);
}

.btn.secondary {
    background: var(--white);
    color: var(--black);
    border-color: var(--gray-300);
    flex-shrink: 0;
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.field-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.field-row label {
    font-weight: 600;
    font-size: 0.78rem;
    color: var(--gray-600);
    flex-shrink: 0;
}

#lengthInput {
    width: 52px;
    padding: 5px 4px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-family: var(--font-mono);
    font-weight: 600;
    text-align: center;
    flex-shrink: 0;
}

#lengthRange {
    flex: 1;
    min-width: 0;
    -webkit-appearance: none;
    appearance: none;
    height: 3px;
    border-radius: 999px;
    background: var(--gray-300);
    outline: none;
}

#lengthRange::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--black);
    cursor: pointer;
    border: 2px solid var(--white);
    box-shadow: 0 0 0 1px var(--black);
}

#lengthRange::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--black);
    cursor: pointer;
    border: 2px solid var(--white);
    box-shadow: 0 0 0 1px var(--black);
}

.chip-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.chip {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.78rem;
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--gray-600);
    background: var(--white);
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    user-select: none;
}

.chip input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.chip:hover {
    border-color: var(--gray-500);
}

.chip:has(input:checked) {
    background: var(--black);
    border-color: var(--black);
    color: var(--white);
}

.chip:has(input:focus-visible) {
    outline: 2px solid var(--black);
    outline-offset: 2px;
}

.generate-btn {
    width: 100%;
    padding: 11px;
    font-size: 0.85rem;
    margin-top: 2px;
}

.stat-line {
    margin-top: 16px;
    text-align: center;
    color: var(--gray-500);
    font-size: 0.76rem;
    min-height: 1.2em;
}

/* About page */
.story p {
    margin: 0 0 14px;
    font-size: 0.9rem;
    max-width: 60ch;
    color: #262626;
}

.divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 32px 0;
}

.contact-pitch h2 {
    font-size: clamp(1rem, 3vw, 1.15rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0 0 6px;
    max-width: 26ch;
}

.contact-pitch .subtitle {
    margin-bottom: 20px;
}

.contact-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.contact-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: border-color 0.15s ease;
}

.contact-list li:hover {
    border-color: var(--gray-500);
}

.contact-list .icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--gray-50);
    color: var(--black);
    flex-shrink: 0;
}

.contact-list .icon svg {
    width: 14px;
    height: 14px;
}

.contact-list .label {
    font-weight: 600;
    color: var(--gray-500);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex-shrink: 0;
    width: 100px;
}

.contact-list a {
    color: var(--black);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.86rem;
    border-bottom: 1px solid transparent;
    transition: border-color 0.15s ease, color 0.15s ease;
    overflow-wrap: anywhere;
}

.contact-list a:hover {
    border-bottom-color: var(--black);
}

/* Footer */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 18px 0;
    color: var(--gray-500);
    font-size: 0.76rem;
    text-align: center;
}

/* Responsive */
@media (max-width: 640px) {
    .field-row {
        flex-wrap: wrap;
    }

    .field-row label {
        width: 100%;
    }
}

@media (max-width: 560px) {
    .token-output {
        flex-direction: column;
    }

    .btn.secondary {
        width: 100%;
    }

    .header-inner {
        flex-wrap: wrap;
        justify-content: center;
        text-align: center;
        padding: 12px 20px;
    }

    .site-nav {
        gap: 18px;
    }
}

@media (max-width: 460px) {
    .contact-list li {
        flex-wrap: wrap;
    }

    .contact-list .label {
        width: auto;
        order: 2;
    }

    .contact-list a {
        order: 3;
        width: 100%;
        padding-left: 42px;
        margin-top: -4px;
    }
}
