:root {
    --bg: #f6f6f4;
    --paper: #ffffff;
    --paper-soft: #f0f0ee;
    --ink: #171717;
    --muted: #6f6f68;
    --faint: #9b9b94;
    --line: #deded9;
    --line-soft: #ecece8;
    --accent: #111111;
    --accent-2: #4f6f52;
    --danger: #a33a2f;
    --shadow: 0 18px 48px rgba(20, 20, 18, 0.06);
    --font-sans: "Avenir Next", "Manrope", "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    overflow-x: hidden;
    color: var(--ink);
    background:
        linear-gradient(var(--line-soft) 1px, transparent 1px),
        linear-gradient(90deg, var(--line-soft) 1px, transparent 1px),
        var(--bg);
    background-size: 44px 44px;
    font-family: var(--font-sans);
}

body:not(.embed-page) {
    display: flex;
    flex-direction: column;
}

body.modal-open {
    overflow: hidden;
}

body.modal-open .search-stage,
body.modal-open .timeline-workspace,
body.modal-open .details-section,
body.modal-open .site-footer {
    filter: blur(1px);
    opacity: 0.5;
}

body.is-exporting .timeline-workspace {
    background: var(--bg);
}

body.is-exporting .timeline {
    overflow: visible;
}

body.is-exporting [data-export-ignore] {
    display: none !important;
}

button,
input {
    font: inherit;
}

button {
    color: inherit;
}

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

.app-shell {
    flex: 1 0 auto;
    width: 100%;
}

.search-stage {
    display: grid;
    padding: 138px 20px 96px;
}

.search-stage-inner {
    display: grid;
    justify-items: center;
    width: min(980px, calc(100vw - 48px));
    margin: 0 auto;
}

.search-main {
    display: grid;
    justify-items: center;
    text-align: center;
}

.eyebrow {
    margin: 0 0 10px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 760;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 12px;
    font-size: clamp(48px, 7.4vw, 86px);
    font-weight: 600;
    letter-spacing: -0.065em;
    line-height: 0.92;
}

h2 {
    margin-bottom: 0;
    font-size: 30px;
    font-weight: 580;
    letter-spacing: -0.025em;
}

.stage-copy {
    max-width: 640px;
    margin-bottom: 12px;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.55;
}

.dataset-count {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    margin-bottom: 24px;
    border: 1px solid rgba(222, 222, 217, 0.94);
    border-radius: 999px;
    padding: 0 12px;
    background: rgba(255, 255, 255, 0.64);
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.search-wrapper {
    position: relative;
    width: min(720px, calc(100vw - 32px));
    z-index: 60;
}

.search-main > :not(.search-wrapper),
.preset-sets,
.timeline-workspace,
.details-section {
    transition: filter 160ms ease, opacity 160ms ease;
}

body.search-focused .search-main > :not(.search-wrapper),
body.search-focused .preset-sets,
body.search-focused .timeline-workspace,
body.search-focused .details-section,
body.search-focused .site-footer {
    filter: blur(1px);
    opacity: 0.5;
}

.search-icon {
    position: absolute;
    top: 50%;
    left: 18px;
    width: 14px;
    height: 14px;
    border: 1.7px solid var(--faint);
    border-radius: 50%;
    transform: translateY(-50%);
}

.search-icon::after {
    content: "";
    position: absolute;
    right: -5px;
    bottom: -4px;
    width: 7px;
    height: 1.7px;
    border-radius: 999px;
    background: var(--faint);
    transform: rotate(45deg);
}

.search-input {
    width: 100%;
    height: 56px;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0 22px 0 46px;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: var(--shadow);
    font-size: 15px;
    outline: none;
}

.search-input:focus {
    border-color: #b8b8b0;
    background: #ffffff;
    box-shadow: 0 22px 52px rgba(20, 20, 18, 0.1);
}

.search-wrapper.has-suggestions .search-input {
    border-color: var(--line);
    border-bottom-color: transparent;
    border-radius: 28px 28px 0 0;
    box-shadow: 0 16px 34px rgba(20, 20, 18, 0.075);
}

.suggestions {
    position: absolute;
    top: calc(100% - 1px);
    left: 0;
    right: 0;
    z-index: 40;
    overflow: hidden;
    border: 1px solid var(--line);
    border-top: 0;
    border-radius: 0 0 18px 18px;
    background: #ffffff;
    box-shadow: 0 24px 48px rgba(20, 20, 18, 0.1);
    text-align: left;
}

.suggestions:empty {
    display: none;
}

.suggestion {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 16px;
    width: 100%;
    padding: 14px 16px;
    border: 0;
    border-bottom: 1px solid var(--line-soft);
    background: transparent;
    cursor: pointer;
    text-align: left;
}

.suggestion:last-child {
    border-bottom: 0;
}

.suggestion:hover {
    background: #f7f7f4;
}

.suggestion.is-selected {
    background: #f6f6f3;
    color: #74746c;
}

.suggestion.is-selected:hover {
    background: #f1f1ed;
}

.suggestion.is-limited {
    background: #f4f1ed;
    color: #8a867d;
    cursor: not-allowed;
}

.suggestion.is-limited:hover {
    background: #f0ece6;
}

.suggestion.is-limited .suggestion-title,
.suggestion.is-limited .suggestion-subtitle {
    opacity: 0.68;
}

.suggestion.is-limited .suggestion-meta {
    border: 1px solid rgba(184, 133, 112, 0.28);
    border-radius: 999px;
    padding: 4px 8px;
    background: rgba(244, 221, 210, 0.46);
    color: #8b5f50;
    font-weight: 700;
}

.suggestion-title {
    display: block;
    margin-bottom: 3px;
    font-weight: 700;
}

.suggestion-subtitle,
.suggestion-meta,
.meta {
    color: var(--muted);
    font-size: 12px;
}

.suggestion-side {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.suggestion-remove {
    display: inline-grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border: 1px solid #d9d9d3;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.76);
    color: #77776f;
    cursor: pointer;
    font-size: 17px;
    line-height: 1;
}

.suggestion-remove:hover {
    border-color: #c9b5b0;
    color: var(--danger);
}

.quick-picks {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 18px;
}

.quick-picks-label {
    margin-right: 4px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.quick-pick {
    height: 34px;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0 13px;
    background: rgba(255, 255, 255, 0.76);
    color: #3f3f3b;
    cursor: pointer;
    font-size: 13px;
}

.quick-pick:hover {
    border-color: #bfbfb7;
    background: var(--paper);
}

.preset-sets {
    width: 100%;
    margin-top: 16px;
    display: grid;
    grid-template-columns: 154px 1fr;
    gap: 6px;
    border: 1px solid rgba(220, 220, 214, 0.9);
    border-radius: 20px;
    padding: 6px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(246, 246, 242, 0.74)),
        rgba(255, 255, 255, 0.72);
    box-shadow: 0 14px 36px rgba(20, 20, 18, 0.055);
    text-align: left;
}

.preset-copy {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 62px;
    border-radius: 15px;
    padding: 8px 10px;
    background:
        linear-gradient(180deg, rgba(245, 245, 241, 0.94), rgba(236, 236, 231, 0.72));
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
}

.preset-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
}

.preset-card {
    display: grid;
    align-content: center;
    min-height: 62px;
    border: 1px solid rgba(224, 224, 218, 0.98);
    border-radius: 15px;
    padding: 8px 10px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(250, 250, 248, 0.86)),
        var(--paper);
    box-shadow: 0 8px 18px rgba(20, 20, 18, 0.032);
    cursor: pointer;
    text-align: left;
    transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.preset-more-card {
    position: relative;
    border-style: dashed;
    border-color: rgba(164, 164, 154, 0.98);
    padding-right: 34px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(250, 250, 248, 0.86)),
        var(--paper);
    color: var(--ink);
    text-align: left;
}

.preset-more-card::after {
    content: "→";
    position: absolute;
    top: 50%;
    right: 12px;
    color: var(--muted);
    font-size: 18px;
    line-height: 1;
    transform: translateY(-50%);
}

.preset-card:hover {
    border-color: #b9b9b1;
    background:
        linear-gradient(180deg, #ffffff, rgba(242, 242, 238, 0.94)),
        var(--paper);
    box-shadow: 0 10px 22px rgba(20, 20, 18, 0.06);
}

.preset-more-card:hover {
    border-color: #9d9d94;
    background:
        linear-gradient(180deg, #ffffff, rgba(242, 242, 238, 0.94)),
        var(--paper);
    box-shadow: 0 10px 22px rgba(20, 20, 18, 0.06);
}

.preset-title,
.preset-meta {
    display: block;
}

.preset-title {
    margin-bottom: 4px;
    color: var(--ink);
    font-size: 15px;
    font-weight: 580;
    letter-spacing: -0.008em;
    line-height: 1.08;
}

.preset-meta {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.25;
}

.preset-modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(246, 246, 244, 0.28);
}

.preset-modal.hidden,
.embed-modal.hidden {
    display: none;
}

.preset-modal-panel,
.embed-modal-panel {
    width: min(620px, 100%);
    max-height: min(720px, calc(100vh - 48px));
    overflow: visible;
    border: 1px solid rgba(222, 222, 217, 0.92);
    border-radius: 24px;
    padding: 16px;
    background: #f8f8f5;
    box-shadow: 0 24px 64px rgba(20, 20, 18, 0.13);
}

.preset-modal-header,
.embed-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 16px;
}

.embed-preview-header {
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0;
}

.embed-preview-header .eyebrow {
    margin: 0;
}

.embed-modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(246, 246, 244, 0.28);
}

.embed-preview-modal {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(246, 246, 244, 0.38);
}

.embed-preview-modal.hidden {
    display: none;
}

.embed-modal-panel {
    display: grid;
    gap: 14px;
}

.embed-preview-modal-panel {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 14px;
    width: min(1080px, 100%);
    max-height: min(820px, calc(100vh - 48px));
    overflow: hidden;
    border: 1px solid rgba(222, 222, 217, 0.92);
    border-radius: 24px;
    padding: 16px;
    background: #f8f8f5;
    box-shadow: 0 28px 74px rgba(20, 20, 18, 0.16);
}

.embed-modal-copy {
    margin: -4px 0 0;
    max-width: 520px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.embed-code {
    width: 100%;
    min-height: 150px;
    resize: vertical;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 14px;
    background: #ffffff;
    color: var(--ink);
    box-shadow: inset 0 1px 0 rgba(20, 20, 18, 0.03);
    font-family: "SFMono-Regular", "Cascadia Code", "Liberation Mono", monospace;
    font-size: 12px;
    line-height: 1.55;
    outline: none;
}

.embed-code:focus {
    border-color: #b8b8b0;
}

.embed-modal-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.embed-modal-actions .clear-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.embed-preview-frame-wrap {
    min-height: 0;
    max-height: calc(100vh - 164px);
    overflow-x: hidden;
    overflow-y: auto;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: #ffffff;
    box-shadow: inset 0 1px 0 rgba(20, 20, 18, 0.03);
}

.embed-preview-frame-wrap iframe {
    display: block;
    width: 100%;
    height: 320px;
    border: 0;
    background: var(--bg);
}

.modal-close-button {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.82);
    color: var(--muted);
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
}

.modal-close-button:hover {
    border-color: #bdbdb5;
    color: var(--ink);
}

.preset-search-wrapper {
    position: relative;
}

.preset-search {
    width: 100%;
    height: 56px;
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 0 18px;
    background: #ffffff;
    color: var(--ink);
    box-shadow: 0 16px 34px rgba(20, 20, 18, 0.075);
    outline: none;
}

.preset-search:focus {
    border-color: #b8b8b0;
    box-shadow: 0 14px 32px rgba(20, 20, 18, 0.08);
}

.preset-modal-list {
    display: grid;
    gap: 8px;
    margin-top: 10px;
    padding: 0;
    background: transparent;
}

.preset-list-item {
    display: grid;
    gap: 4px;
    min-height: 64px;
    border: 1px solid rgba(222, 222, 217, 0.94);
    border-radius: 16px;
    padding: 14px 16px;
    background: #ffffff;
    box-shadow: 0 8px 18px rgba(20, 20, 18, 0.028);
    cursor: pointer;
    text-align: left;
    transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.preset-list-item:hover {
    border-color: #bfbfb7;
    background: #ffffff;
    box-shadow: 0 10px 24px rgba(20, 20, 18, 0.055);
}

.preset-list-item:last-child {
    border-bottom: 1px solid rgba(222, 222, 217, 0.94);
}

.preset-list-empty {
    padding: 18px;
    border: 0;
    color: var(--muted);
    font-size: 13px;
    text-align: center;
}

.timeline-workspace {
    width: 100%;
    min-height: 0;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.62);
}

.workspace-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    padding: 28px 28px 18px;
}

.workspace-title-group {
    display: flex;
    align-items: flex-end;
    gap: 14px;
}

.workspace-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.workspace-stats {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0 4px 0 13px;
    background: var(--paper);
    color: var(--muted);
    font-size: 12px;
}

.workspace-stats.is-at-limit {
    border-color: rgba(184, 133, 112, 0.42);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(247, 232, 225, 0.78)),
        var(--paper);
    color: #7d5548;
}

.workspace-stats.is-at-limit #selected-count::after {
    content: "Limit reached";
    margin-left: 8px;
    border: 1px solid rgba(184, 133, 112, 0.26);
    border-radius: 999px;
    padding: 3px 7px;
    background: rgba(255, 255, 255, 0.55);
    color: #8b5f50;
    font-size: 10px;
    font-weight: 760;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.share-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.clear-button {
    height: 36px;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0 13px;
    background: rgba(255, 255, 255, 0.82);
    color: var(--muted);
    cursor: pointer;
    font-size: 12px;
}

.clear-button:hover {
    border-color: #bcbcb4;
    background: var(--paper);
    color: var(--ink);
}

.clear-button-inline {
    height: 28px;
    border-color: #b9b9b1;
    padding: 0 10px;
    background:
        linear-gradient(180deg, #ffffff, rgba(242, 242, 238, 0.94)),
        var(--paper);
    box-shadow: 0 10px 22px rgba(20, 20, 18, 0.06);
    color: var(--ink);
}

.clear-button-inline:hover {
    border-color: #9d9d94;
    box-shadow: 0 12px 26px rgba(20, 20, 18, 0.075);
}

.collection-actions {
    display: inline-flex;
    align-items: center;
    overflow: hidden;
    height: 28px;
    border: 1px solid #b9b9b1;
    border-radius: 999px;
    background:
        linear-gradient(180deg, #ffffff, rgba(242, 242, 238, 0.94)),
        var(--paper);
    box-shadow: 0 10px 22px rgba(20, 20, 18, 0.06);
}

.collection-actions:hover {
    border-color: #9d9d94;
    box-shadow: 0 12px 26px rgba(20, 20, 18, 0.075);
}

.collection-action-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    border: 0;
    border-radius: 0;
    padding: 0 10px;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
    font-size: 12px;
}

.collection-action-button + .collection-action-button {
    border-left: 1px solid rgba(157, 157, 148, 0.48);
}

.collection-action-button:hover {
    background: rgba(255, 255, 255, 0.56);
}

.save-collection-button {
    min-width: 110px;
}

.icon-button {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.82);
    cursor: pointer;
}

.icon-button:hover {
    border-color: #bcbcb4;
    background: var(--paper);
}

.icon-button svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: var(--ink);
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.icon-button .check-icon {
    display: none;
}

.icon-button.is-copied {
    border-color: #b9cbb0;
    background: #f2f7ee;
}

.icon-button.is-copied .copy-icon {
    display: none;
}

.icon-button.is-copied .check-icon {
    display: block;
    stroke: #4f6f52;
}

.share-status {
    color: var(--muted);
    font-size: 12px;
}

.share-status:empty {
    display: none;
}

.selected-items {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 44px;
    padding: 0 28px 18px;
}

.selected-items.empty {
    align-items: center;
    min-height: 0;
    padding-bottom: 0;
    color: var(--muted);
    font-size: 13px;
}

.selected-chip {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-height: 34px;
    border: 1px solid var(--item-border);
    border-radius: 999px;
    padding: 0 7px 0 12px;
    background: color-mix(in srgb, var(--item-color) 36%, white);
    font-size: 13px;
}

.selected-chip-type {
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
}

.remove-btn {
    display: inline-grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border: 0;
    border-radius: 50%;
    background: #ffffff;
    color: var(--muted);
    cursor: pointer;
    line-height: 1;
}

.remove-btn:hover {
    color: var(--danger);
}

.empty-state {
    display: grid;
    place-items: center;
    min-height: 118px;
    margin: 0;
    border: 1px dashed #cfcfca;
    background:
        linear-gradient(var(--line-soft) 1px, transparent 1px),
        linear-gradient(90deg, var(--line-soft) 1px, transparent 1px),
        rgba(250, 250, 248, 0.8);
    background-size: 36px 36px;
    color: var(--muted);
    text-align: center;
}

.empty-state strong {
    display: block;
    margin-bottom: 6px;
    color: var(--ink);
    font-size: 28px;
    font-weight: 720;
    letter-spacing: -0.035em;
}

.empty-state span {
    display: block;
    font-size: 13px;
}

.timeline {
    --timeline-meta-width: 248px;
    --timeline-edge-gutter: 8px;
    width: 100%;
    overflow-x: hidden;
    padding: 0 0 12px;
    min-height: 0;
}

.timeline-axis {
    position: relative;
    width: calc(100% - var(--timeline-meta-width) - (var(--timeline-edge-gutter) * 2));
    min-width: 0;
    height: 24px;
    margin-left: calc(var(--timeline-meta-width) + var(--timeline-edge-gutter));
    padding: 0 0 12px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.timeline-axis span {
    position: absolute;
    top: 0;
    white-space: nowrap;
    transform: translateX(-50%);
}

.timeline-axis span:first-child {
    transform: none;
}

.timeline-axis span:last-child {
    transform: translateX(-100%);
}

.timeline-rows {
    position: relative;
    min-width: 0;
    border-top: 1px solid var(--line);
    background:
        linear-gradient(90deg, transparent 0 247px, var(--line) 247px 248px, transparent 248px),
        rgba(255, 255, 255, 0.62);
}

.timeline-guide-layer {
    position: absolute;
    top: -7px;
    right: var(--timeline-edge-gutter);
    bottom: 0;
    left: calc(var(--timeline-meta-width) + var(--timeline-edge-gutter));
    z-index: 1;
    pointer-events: none;
}

.timeline-guide {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: rgba(88, 88, 82, 0.12);
    transform: translateX(-50%);
}

.timeline-guide:first-child {
    transform: none;
}

.timeline-guide:last-child {
    transform: translateX(-100%);
}

.overlap-layer {
    position: absolute;
    top: 0;
    right: var(--timeline-edge-gutter);
    bottom: 0;
    left: calc(var(--timeline-meta-width) + var(--timeline-edge-gutter));
    z-index: 20;
    pointer-events: none;
}

.overlap-connector {
    position: absolute;
    z-index: 20;
    min-width: 5px;
    border: 0;
    padding: 0;
    background: transparent;
    cursor: help;
    outline: none;
    pointer-events: auto;
}

.overlap-connector.is-point {
    transform: translateX(-50%);
}

.overlap-connector::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    border-right: 1px dashed rgba(146, 146, 138, 0.42);
    border-left: 1px dashed rgba(146, 146, 138, 0.42);
    background: rgba(146, 146, 138, 0.08);
}

.overlap-connector::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: max(22px, 100%);
    transform: translateX(-50%);
}

.overlap-tooltip {
    position: absolute;
    left: 50%;
    top: 10px;
    z-index: 40;
    display: grid;
    gap: 6px;
    min-width: 220px;
    max-width: 280px;
    padding: 11px 12px 12px;
    border: 1px solid rgba(222, 222, 217, 0.92);
    border-radius: 12px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 248, 245, 0.96)),
        var(--paper);
    box-shadow: 0 14px 34px rgba(20, 20, 18, 0.09);
    color: var(--ink);
    text-align: left;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -4px);
    transition: opacity 140ms ease, transform 140ms ease;
}

.overlap-connector:hover,
.overlap-connector:focus-visible {
    z-index: 50;
}

.overlap-connector:hover::before,
.overlap-connector:focus-visible::before {
    border-color: rgba(102, 102, 96, 0.58);
    background: rgba(126, 126, 118, 0.12);
}

.overlap-connector:hover .overlap-tooltip,
.overlap-connector:focus-visible .overlap-tooltip {
    opacity: 1;
    transform: translate(-50%, 0);
}

.overlap-connector.near-start .overlap-tooltip {
    left: 0;
    transform: translate(0, -4px);
}

.overlap-connector.near-start:hover .overlap-tooltip,
.overlap-connector.near-start:focus-visible .overlap-tooltip {
    transform: translate(0, 0);
}

.overlap-connector.near-end .overlap-tooltip {
    right: 2px;
    left: auto;
    transform: translate(0, -4px);
}

.overlap-connector.near-end:hover .overlap-tooltip,
.overlap-connector.near-end:focus-visible .overlap-tooltip {
    transform: translate(0, 0);
}

.overlap-tooltip-title {
    display: grid;
    gap: 4px;
    font-size: 12px;
    font-weight: 620;
    line-height: 1.25;
}

.overlap-tooltip-title::before {
    content: "Period overlap";
    color: var(--muted);
    font-size: 10px;
    font-weight: 760;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.overlap-tooltip-range {
    justify-self: start;
    min-height: 24px;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.72);
    color: #565650;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
}

.timeline-row {
    position: relative;
    display: grid;
    grid-template-columns: 248px 1fr;
    min-height: 62px;
    border-bottom: 1px solid var(--line-soft);
    transition: background 160ms ease;
}

.timeline-row:hover,
.timeline-row.is-hover-match {
    background: color-mix(in srgb, var(--item-color) 12%, white);
}

.timeline-row-label {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    padding: 0 20px 0 28px;
    background: rgba(246, 246, 244, 0.76);
    transition: background 160ms ease;
}

.timeline-row:hover .timeline-row-label,
.timeline-row.is-hover-match .timeline-row-label {
    background: color-mix(in srgb, var(--item-color) 18%, white);
}

.timeline-row:hover .timeline-row-title,
.timeline-row.is-hover-match .timeline-row-title {
    color: #11110f;
}

.timeline-row-title {
    overflow: hidden;
    color: var(--ink);
    font-size: 13px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.timeline-row-meta {
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.timeline-track {
    position: relative;
    margin: 0 var(--timeline-edge-gutter);
    background:
        repeating-linear-gradient(90deg, transparent 0 calc((100% / 18) - 1px), rgba(0, 0, 0, 0.035) calc((100% / 18) - 1px) calc(100% / 18)),
        repeating-linear-gradient(0deg, transparent 0 39px, rgba(0, 0, 0, 0.026) 39px 40px);
}

.timeline-track::before,
.timeline-track::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    z-index: 1;
    width: var(--timeline-edge-gutter);
    pointer-events: none;
    background:
        repeating-linear-gradient(
            135deg,
            rgba(88, 88, 82, 0.08) 0 1px,
            transparent 1px 5px
        );
}

.timeline-track::before {
    right: 100%;
}

.timeline-track::after {
    left: 100%;
}

.timeline-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 20px;
    z-index: 3;
    height: 20px;
    min-width: 3px;
    border: 1px solid var(--item-border);
    border-radius: 999px;
    background: color-mix(in srgb, var(--item-color) 48%, white);
    box-shadow: 0 6px 16px rgba(20, 20, 18, 0.055);
    transition: background 160ms ease, border-color 160ms ease;
}

.timeline-row:hover .timeline-bar,
.timeline-row.is-hover-match .timeline-bar {
    border-color: color-mix(in srgb, var(--item-border) 70%, #111111);
    background: color-mix(in srgb, var(--item-color) 82%, white);
}

.timeline-bar.point {
    width: 18px !important;
    border-radius: 50%;
    transform: translateX(-50%);
}

.timeline-bar-time {
    position: absolute;
    left: 50%;
    top: -18px;
    color: #4a4a45;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1;
    white-space: nowrap;
    transform: translateX(-50%);
}

.timeline-bar-time.near-start {
    left: 0;
    transform: none;
}

.timeline-bar-time.near-end {
    left: auto;
    right: 0;
    transform: none;
}

.timeline-bar.point .timeline-bar-time {
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
}

.timeline-bar.point .timeline-bar-time.near-start {
    left: 24px;
    right: auto;
    transform: translateY(-50%);
}

.timeline-bar.point .timeline-bar-time.near-end {
    left: auto;
    right: 24px;
    transform: translateY(-50%);
}

.embed-page {
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    background:
        linear-gradient(var(--line-soft) 1px, transparent 1px),
        linear-gradient(90deg, var(--line-soft) 1px, transparent 1px),
        var(--bg);
    background-size: 36px 36px;
}

.embed-shell {
    width: 100%;
    padding: 0;
}

.embed-timeline-workspace {
    min-height: 0;
    border: 0;
    background: rgba(255, 255, 255, 0.76);
}

.embed-page .selected-items {
    padding-bottom: 10px;
}

.embed-page .timeline {
    padding-bottom: 0;
}

.embed-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding: 22px 24px 16px;
}

.embed-header h1 {
    margin: 0;
    font-size: clamp(24px, 5vw, 42px);
    font-weight: 580;
    letter-spacing: -0.045em;
    line-height: 0.98;
}

.embed-watermark {
    flex: 0 0 auto;
    min-height: 32px;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.8);
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}

.embed-chip {
    padding-right: 11px;
}

.details-section {
    display: grid;
    grid-template-columns: 248px minmax(0, 1fr);
    gap: 0;
    padding: 12px 28px 38px 0;
}

.details-header {
    position: sticky;
    top: 94px;
    align-self: start;
    padding-left: 28px;
}

.details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
}

.details.empty {
    display: block;
    min-height: 140px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.72);
    padding: 18px;
    color: var(--muted);
    font-size: 13px;
}

.detail-card {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--line);
    border-top: 4px solid var(--item-border);
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--item-color) 9%, white), rgba(255, 255, 255, 0.78) 72px),
        rgba(255, 255, 255, 0.78);
    padding: 14px;
    transition: border-color 160ms ease, filter 160ms ease, opacity 160ms ease;
}

.details.is-comparing-hover .detail-card {
    filter: blur(1px);
    opacity: 0.5;
}

.details.is-comparing-hover .detail-card.is-hover-match {
    border-color: var(--item-border);
    filter: none;
    opacity: 1;
}

.detail-card h3 {
    margin-bottom: 8px;
    font-size: 16px;
    font-weight: 580;
    letter-spacing: -0.01em;
}

.detail-card p {
    margin-bottom: 12px;
    color: #3f3f3b;
    font-size: 13px;
    line-height: 1.5;
}

.detail-description {
    margin-bottom: 4px;
}

.detail-description p:last-child {
    margin-bottom: 10px;
}

.detail-source {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: auto;
    padding-top: 4px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.detail-source-link {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.64);
    color: var(--ink);
}

.detail-source-link:hover {
    border-color: var(--item-border);
    background: #ffffff;
}

.detail-source-text {
    color: var(--muted);
}

.detail-source-text:hover {
    color: var(--ink);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.detail-source-link svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.source-popover-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.source-popover-trigger {
    border: 0;
    border-radius: 999px;
    padding: 0;
    background: transparent;
    color: #565650;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

.source-popover-trigger:hover,
.source-popover-trigger:focus-visible,
.source-popover-trigger[aria-expanded="true"] {
    color: var(--ink);
    outline: none;
}

.source-popover {
    position: absolute;
    right: 0;
    bottom: calc(100% + 8px);
    z-index: 80;
    width: min(280px, calc(100vw - 32px));
    border: 1px solid rgba(222, 222, 217, 0.96);
    border-radius: 14px;
    padding: 11px 12px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 248, 245, 0.96)),
        var(--paper);
    box-shadow: 0 18px 42px rgba(20, 20, 18, 0.11);
    color: #4c4c46;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.45;
}

.site-footer {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-height: 56px;
    border-top: 1px solid var(--line-soft);
    padding: 0 28px;
    background: rgba(255, 255, 255, 0.86);
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    transition: filter 160ms ease, opacity 160ms ease;
}

.site-footer a:hover {
    color: var(--ink);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.legal-shell {
    flex: 1 0 auto;
    width: min(860px, calc(100vw - 40px));
    margin: 0 auto;
    padding: 56px 0 72px;
}

.legal-back-link {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    margin-bottom: 18px;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0 13px;
    background: rgba(255, 255, 255, 0.72);
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.legal-back-link:hover {
    border-color: #bfbfb7;
    color: var(--ink);
}

.legal-card {
    border: 1px solid rgba(222, 222, 217, 0.92);
    border-radius: 28px;
    padding: clamp(24px, 5vw, 52px);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(250, 250, 248, 0.74)),
        var(--paper);
    box-shadow: 0 24px 64px rgba(20, 20, 18, 0.08);
}

.legal-card h1 {
    margin: 0 0 22px;
    font-size: clamp(46px, 7vw, 84px);
    font-weight: 540;
    letter-spacing: -0.07em;
    line-height: 0.92;
}

.legal-card h2 {
    margin: 34px 0 12px;
    font-size: 22px;
    font-weight: 580;
    letter-spacing: -0.02em;
}

.legal-card p {
    margin: 0 0 14px;
    color: #3f3f3b;
    font-size: 15px;
    line-height: 1.72;
}

.hidden {
    display: none;
}

@media (max-width: 980px) {
    .preset-sets {
        grid-template-columns: 1fr;
    }

    .preset-copy {
        min-height: auto;
    }

    .preset-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .search-stage {
        padding: 54px 16px 64px;
    }

    .search-stage-inner {
        gap: 24px;
        width: 100%;
    }

    .search-main {
        justify-items: center;
        text-align: center;
    }

    h1 {
        font-size: 58px;
    }

    .workspace-header {
        align-items: start;
        flex-direction: column;
        padding: 22px 16px 14px;
    }

    .workspace-title-group,
    .workspace-actions {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .selected-items {
        padding: 0 16px 16px;
    }

    .quick-picks {
        justify-content: center;
    }

    .preset-sets {
        margin: 24px auto 0;
    }

    .preset-copy {
        text-align: left;
    }

    .preset-grid {
        grid-template-columns: 1fr;
    }

    .empty-state {
        margin: 0;
    }

    .timeline {
        --timeline-meta-width: 188px;
    }

    .timeline-axis {
        min-width: 0;
    }

    .timeline-rows {
        min-width: 0;
        background:
            linear-gradient(90deg, transparent 0 187px, var(--line) 187px 188px, transparent 188px),
            rgba(255, 255, 255, 0.62);
    }

    .timeline-row {
        grid-template-columns: 188px 1fr;
    }

    .timeline-row-label {
        padding-left: 16px;
    }

    .details-section {
        grid-template-columns: 1fr;
        padding: 28px 16px 48px;
    }

    .details-header {
        position: static;
        padding-left: 0;
    }

    .embed-header {
        flex-direction: column;
        padding: 18px 16px 14px;
    }

    .embed-modal-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .embed-modal-actions .clear-button {
        width: 100%;
    }
}
