:root {
    /* Color */
    --ink: #14171f;
    --ink-soft: #454b5c;
    --paper: #e9ebf1;
    --surface: #ffffff;
    --line: #d7dbe4;
    --line-strong: #b9bfcd;
    --accent: #c1571f;
    --accent-dark: #9c4416;
    --accent-soft: #fbe9dd;
    --teal: #1f6f63;
    --teal-soft: #dbede9;
    --danger: #b8352c;

    /* Type */
    --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', ui-monospace, monospace;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    /* Shape */
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --shadow: 0 1px 2px rgba(20, 23, 31, 0.06), 0 1px 1px rgba(20, 23, 31, 0.04);
    --shadow-md: 0 6px 16px rgba(20, 23, 31, 0.08), 0 2px 4px rgba(20, 23, 31, 0.05);
    --shadow-lg: 0 16px 32px rgba(20, 23, 31, 0.12), 0 4px 8px rgba(20, 23, 31, 0.06);
}

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

body {
    font-family: var(--font-body);
    background: var(--paper);
    color: var(--ink);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 880px;
    margin: 0 auto;
    padding: 0 20px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--ink);
    color: var(--surface);
    padding: 12px 18px;
    border-radius: 0 0 var(--radius-sm) 0;
    z-index: 1000;
    font-weight: 600;
}

.skip-link:focus {
    left: 0;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

code {
    font-family: var(--font-mono);
}

/* Header */
.header {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.logo {
    text-decoration: none;
    color: var(--ink);
}

.logo-mark {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 18px;
    letter-spacing: -0.02em;
}

.logo-mark-accent {
    color: var(--accent);
}

.nav-links {
    display: flex;
    gap: 4px;
}

.nav-links a {
    text-decoration: none;
    color: var(--ink-soft);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 14px;
    transition: background 0.15s, color 0.15s;
}

.nav-links a:hover {
    background: var(--paper);
    color: var(--ink);
}

/* Main */
.main {
    padding: 48px 0 72px;
}

/* Hero */
.hero {
    margin-bottom: 32px;
    max-width: 640px;
}

.eyebrow {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-dark);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 12px;
}

.hero h1 {
    font-family: var(--font-mono);
    font-size: 40px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin-bottom: 14px;
    color: var(--ink);
}

.hero-subtitle {
    font-size: 17px;
    color: var(--ink-soft);
    max-width: 560px;
}

/* Generator Card */
.generator-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow-md);
    margin-bottom: 48px;
    scroll-margin-top: 84px;
}

.field-group {
    margin-bottom: 24px;
}

.field-label {
    display: block;
    font-weight: 600;
    color: var(--ink-soft);
    margin-bottom: 10px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* Segmented control */
.segmented {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 5px;
}

.segmented-btn {
    flex: 1 1 auto;
    white-space: nowrap;
    background: transparent;
    border: none;
    color: var(--ink-soft);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 14px;
    padding: 9px 14px;
    border-radius: calc(var(--radius) - 3px);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.segmented-btn:hover {
    color: var(--ink);
}

.segmented-btn.is-active {
    background: var(--ink);
    color: var(--surface);
    box-shadow: var(--shadow);
}

/* Dynamic fields */
.dynamic-fields {
    margin-bottom: 24px;
}

.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.field-row + .field-row {
    margin-top: 14px;
}

.field-unit {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field-unit label {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-soft);
}

.input-field,
.select-field {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--line-strong);
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-family: var(--font-body);
    font-weight: 500;
    color: var(--ink);
    background: var(--surface);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.select-field {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23454b5c' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

.input-field:hover,
.select-field:hover {
    border-color: var(--ink-soft);
}

.input-field:focus,
.select-field:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.input-field.is-invalid {
    border-color: var(--danger);
}

.field-hint {
    font-size: 13px;
    color: var(--ink-soft);
    margin-top: 8px;
}

.field-hint.is-error {
    color: var(--danger);
}

/* Weekday picker */
.weekday-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.weekday-chip {
    display: inline-flex;
}

.weekday-chip input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.weekday-chip span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 46px;
    padding: 9px 10px;
    border: 1.5px solid var(--line-strong);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-soft);
    cursor: pointer;
    transition: all 0.15s;
}

.weekday-chip input:checked + span {
    background: var(--ink);
    border-color: var(--ink);
    color: var(--surface);
}

.weekday-chip input:focus-visible + span {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Presets */
.presets-section {
    margin-bottom: 28px;
}

.presets-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.preset-btn {
    background: var(--surface);
    border: 1.5px solid var(--line-strong);
    padding: 8px 14px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-soft);
    transition: all 0.15s;
    font-family: var(--font-body);
}

.preset-btn:hover {
    border-color: var(--accent);
    color: var(--accent-dark);
    background: var(--accent-soft);
}

/* Result Box */
.result-box {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: grid;
    gap: 24px;
    grid-template-columns: 1fr 1fr;
}

.result-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-soft);
    margin-bottom: 10px;
    font-weight: 700;
}

.cron-expression {
    font-size: 28px;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--ink);
    letter-spacing: 0.02em;
    margin-bottom: 10px;
    word-break: break-all;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
}

.cron-token-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    margin-bottom: 14px;
}

.cron-token {
    text-align: center;
    font-size: 10px;
    color: var(--ink-soft);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}

.cron-description {
    font-size: 15px;
    color: var(--ink-soft);
    margin-bottom: 18px;
}

.copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--ink);
    color: var(--surface);
    border: none;
    padding: 11px 18px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font-body);
    transition: background 0.15s, transform 0.1s;
}

.copy-btn:hover {
    background: var(--accent-dark);
}

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

/* Timeline */
.timeline {
    list-style: none;
    border-left: 2px solid var(--line-strong);
    padding-left: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 12px;
}

.timeline-item {
    position: relative;
    font-size: 14px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -23px;
    top: 5px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--teal);
    border: 2px solid var(--paper);
}

.timeline-item:first-child::before {
    background: var(--accent);
}

.timeline-date {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--ink);
    display: block;
}

.timeline-relative {
    color: var(--ink-soft);
    font-size: 12.5px;
}

.timeline-note {
    font-size: 12.5px;
    color: var(--ink-soft);
    line-height: 1.5;
}

/* Reference sections */
.reference-section,
.faq-section {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 28px;
    margin-bottom: 24px;
    scroll-margin-top: 84px;
}

.reference-section h2,
.faq-section h2 {
    font-family: var(--font-mono);
    font-size: 22px;
    margin-bottom: 12px;
    color: var(--ink);
}

.reference-section h3 {
    font-size: 16px;
    margin: 24px 0 12px;
    color: var(--ink);
}

.reference-section p {
    color: var(--ink-soft);
    line-height: 1.7;
}

.field-table {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-top: 16px;
}

.field-table-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    padding: 12px 16px;
    border-top: 1px solid var(--line);
    font-size: 14px;
}

#examples .field-table-row {
    grid-template-columns: 1fr 1.4fr;
}

.field-table-row:first-child {
    border-top: none;
}

.field-table-head {
    background: var(--paper);
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ink-soft);
}

.field-table-row code {
    background: var(--paper);
    padding: 2px 7px;
    border-radius: 4px;
    color: var(--accent-dark);
    font-weight: 600;
    font-size: 13px;
}

.chip-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin-top: 16px;
}

.chip-card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 14px;
    text-align: center;
}

.chip-card code {
    display: block;
    font-size: 17px;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 6px;
}

.chip-card span {
    font-size: 12.5px;
    color: var(--ink-soft);
}

/* FAQ */
.faq-item {
    border-top: 1px solid var(--line);
    padding: 16px 0;
}

.faq-item:first-of-type {
    border-top: none;
    padding-top: 4px;
}

.faq-item summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 15.5px;
    color: var(--ink);
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::after {
    content: '+';
    font-size: 20px;
    color: var(--accent);
    font-weight: 400;
    margin-left: 12px;
    flex-shrink: 0;
}

.faq-item[open] summary::after {
    content: '\2212';
}

.faq-item p {
    color: var(--ink-soft);
    margin-top: 12px;
    line-height: 1.7;
    font-size: 14.5px;
}

/* Footer */
.footer {
    border-top: 1px solid var(--line);
    padding: 32px 0 24px;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 15px;
    color: var(--ink);
}

.footer-brand p {
    color: var(--ink-soft);
    font-size: 13px;
    margin-top: 6px;
}

.footer-bottom {
    border-top: 1px solid var(--line);
    padding-top: 16px;
    color: var(--ink-soft);
    font-size: 13px;
}

.footer-bottom a {
    color: var(--accent-dark);
    text-decoration: none;
    font-weight: 600;
}

.footer-bottom a:hover {
    text-decoration: underline;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--ink);
    color: var(--surface);
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 13.5px;
    box-shadow: var(--shadow-lg);
    transform: translateY(16px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.2s ease, opacity 0.2s ease;
    z-index: 1000;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

/* Responsive */
@media (max-width: 720px) {
    .result-box {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .hero h1 {
        font-size: 30px;
    }

    .hero-subtitle {
        font-size: 15.5px;
    }

    .generator-card,
    .reference-section,
    .faq-section {
        padding: 18px;
    }

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

    .cron-expression {
        font-size: 20px;
    }

    .cron-token-row {
        display: none;
    }

    .field-table-row {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .field-table-row span[data-label]::before {
        content: attr(data-label) ': ';
        font-weight: 700;
        color: var(--ink-soft);
    }

    .field-table-head {
        display: none;
    }

    .header-inner {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .nav-links {
        flex-wrap: wrap;
    }
}

@media (max-width: 420px) {
    .presets-grid {
        gap: 6px;
    }
}