:root {
    --bg: #f6f8fb;
    --surface: #ffffff;
    --text: #172033;
    --muted: #64748b;
    --border: #dbe2ea;
    --primary: #b8860b;
    --primary-dark: #8f6808;
    --shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family:
        Inter,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    background:
        radial-gradient(
            circle at top,
            #ffffff 0,
            var(--bg) 55%,
            #eef2f7 100%
        );

    color: var(--text);
}

button,
input {
    font: inherit;
}

.research-tool {
    width: min(100% - 32px, 1000px);
    margin: 0 auto;
    padding: 70px 0 35px;
}

.hero {
    text-align: center;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 82px;
    height: 82px;

    margin-bottom: 18px;

    border-radius: 50%;

    background: #ffffff;

    overflow: hidden;

    box-shadow:
        0 8px 24px rgba(15, 23, 42, 0.10);
}

.brand-mark img {
    width: 100%;
    height: 100%;

    object-fit: contain;

    display: block;
}

.badge {
    display: inline-block;

    padding: 6px 12px;

    border-radius: 999px;

    background: #fff8df;
    color: var(--primary-dark);

    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

h1 {
    margin: 18px 0 12px;

    font-size: clamp(34px, 6vw, 56px);
    line-height: 1.05;
    letter-spacing: -0.035em;
}

.subtitle {
    max-width: 650px;
    margin: 0 auto;

    color: var(--muted);

    font-size: 17px;
    line-height: 1.7;
}

.search-container {
    max-width: 800px;
    margin: 36px auto 0;
}

.search-box {
    display: flex;
    align-items: center;

    padding: 7px;

    background: var(--surface);

    border: 1px solid var(--border);
    border-radius: 16px;

    box-shadow: var(--shadow);

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.search-box:focus-within {
    border-color: var(--primary);

    box-shadow:
        0 0 0 4px rgba(184, 134, 11, 0.10),
        var(--shadow);
}

.search-icon {
    padding-left: 15px;
    padding-right: 8px;

    font-size: 20px;
}

.search-box input {
    flex: 1;

    min-width: 0;

    border: 0;
    outline: 0;

    padding: 15px 10px;

    background: transparent;

    color: var(--text);

    font-size: 16px;
}

.search-box input::placeholder {
    color: #94a3b8;
}

.search-box button {
    border: 0;
    border-radius: 11px;

    padding: 13px 23px;

    background: var(--primary);
    color: white;

    font-weight: 700;

    cursor: pointer;

    transition:
        background 0.2s ease,
        transform 0.2s ease;
}

.search-box button:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.search-box button:active {
    transform: translateY(0);
}

.search-hint {
    margin-top: 12px;

    color: var(--muted);

    font-size: 13px;
}

.trust-note {
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;

    line-height: 1.6;
}

.search-examples {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;

    margin-top: 14px;
}

.search-examples-label {
    color: var(--muted);
    font-size: 13px;
}

.example-search {
    padding: 6px 12px;

    border: 1px solid var(--border);
    border-radius: 999px;

    background: var(--surface);
    color: var(--primary-dark);

    font-size: 13px;
    cursor: pointer;

    transition:
        border-color 0.2s ease,
        background 0.2s ease;
}

.example-search:hover {
    border-color: var(--primary);
    background: #fff8df;
}

.how-it-works {
    max-width: 420px;
    margin: 18px auto 0;
    padding-left: 20px;

    text-align: left;

    color: var(--muted);

    font-size: 14px;
    line-height: 1.8;
}

.selection-toolbar {
    max-width: 700px;
    margin: 40px auto 0;
    padding: 18px 22px;

    display: flex;
    flex-direction: column;
    gap: 12px;

    background: rgba(255, 255, 255, 0.75);

    border: 1px solid var(--border);
    border-radius: 18px;
}

.selection-toolbar-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.selection-toolbar-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;

    font-weight: 700;
    font-size: 14px;
    color: var(--primary-dark);
}

.duplicate-note {
    font-weight: 600;
    font-size: 12.5px;
    color: var(--muted);
}

.selection-toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.selection-toolbar button {
    padding: 9px 16px;

    border: 1px solid var(--border);
    border-radius: 10px;

    background: var(--surface);
    color: var(--primary-dark);

    font-weight: 700;
    font-size: 13px;
    cursor: pointer;

    transition:
        border-color 0.2s ease,
        background 0.2s ease;
}

.selection-toolbar button:hover:not(:disabled) {
    border-color: var(--primary);
    background: #fff8df;
}

.selection-toolbar button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.selection-toolbar button.primary-action {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

.selection-toolbar button.primary-action:hover:not(:disabled) {
    background: var(--primary-dark);
}

.selection-toolbar-hint {
    margin: 0;

    color: var(--muted);

    font-size: 12.5px;
    line-height: 1.6;
}

.select-row {
    display: flex;
    align-items: center;
    gap: 8px;

    margin: 0 0 12px;
}

.select-row label {
    font-size: 13px;
    font-weight: 700;
    color: var(--primary-dark);
    cursor: pointer;
}

.article-select-checkbox {
    width: 18px;
    height: 18px;
    margin: 0;

    cursor: pointer;
    accent-color: var(--primary);
}

.add-to-collection-note {
    font-size: 13px;
    font-weight: 700;
    color: var(--primary-dark);
}

.collection-panel {
    max-width: 700px;
    margin: 20px auto 0;

    background: rgba(255, 255, 255, 0.75);

    border: 1px solid var(--border);
    border-radius: 18px;

    overflow: hidden;
}

.collection-toggle-btn {
    display: block;
    width: 100%;

    padding: 16px 22px;

    border: 0;
    border-radius: 0;

    background: transparent;
    color: var(--primary-dark);

    font-weight: 700;
    font-size: 15px;
    text-align: left;
    cursor: pointer;

    transition: background 0.2s ease;
}

.collection-toggle-btn:hover {
    background: #fff8df;
}

.collection-body {
    padding: 0 22px 22px;

    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* .collection-body's own `display: flex` above has the same specificity as
   the browser's built-in `[hidden] { display: none }` rule, and an author
   rule always wins a same-specificity tie against a user-agent rule — so
   without this, toggling the `hidden` attribute never actually hides the
   panel. The extra `[hidden]` in the selector raises specificity just
   enough to win instead. */
.collection-body[hidden] {
    display: none;
}

.collection-summary {
    margin: 0;

    color: var(--primary-dark);

    font-weight: 700;
    font-size: 14px;
}

.collection-filter-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.collection-filter-row label {
    font-weight: 700;
    font-size: 12.5px;
    color: var(--primary-dark);
}

.collection-filter-row input {
    padding: 10px 12px;

    border: 1px solid var(--border);
    border-radius: 10px;

    background: var(--surface);
    color: var(--text);

    font: inherit;
    font-size: 14px;
}

/* Scoped to .collection-body (not the whole .collection-panel) so these
   rules never apply to .collection-toggle-btn, which needs its own
   full-width plain-header look above. */
.collection-body button {
    padding: 9px 16px;

    border: 1px solid var(--border);
    border-radius: 10px;

    background: var(--surface);
    color: var(--primary-dark);

    font-weight: 700;
    font-size: 13px;
    cursor: pointer;

    transition:
        border-color 0.2s ease,
        background 0.2s ease;
}

.collection-body button:hover:not(:disabled) {
    border-color: var(--primary);
    background: #fff8df;
}

.collection-body button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.collection-body button.primary-action {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

.collection-body button.primary-action:hover:not(:disabled) {
    background: var(--primary-dark);
}

.collection-body button.danger-action {
    background: #b23b3b;
    color: #ffffff;
    border-color: #b23b3b;
}

.collection-body button.danger-action:hover:not(:disabled) {
    background: #8f2e2e;
}

.collection-storage-warning {
    margin: 0;
    padding: 10px 14px;

    background: #fffbeb;
    border: 1px solid #f59e0b;
    border-radius: 10px;

    color: #92400e;
    font-size: 13px;
    font-weight: 600;
}

.collection-clear-confirm {
    padding: 12px 14px;

    background: #fff5f5;
    border: 1px solid #f3b4b4;
    border-radius: 12px;
}

.collection-clear-confirm p {
    margin: 0 0 10px;

    color: #8a2c2c;
    font-size: 13.5px;
    font-weight: 600;
}

.collection-clear-confirm-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.collection-empty-note {
    margin: 0;
    padding: 10px 0;

    color: var(--muted);

    font-size: 13.5px;
    text-align: center;
}

.collection-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.collection-item {
    padding: 14px 0;
    border-top: 1px solid var(--border);
}

.collection-item:first-child {
    border-top: 0;
}

.collection-cap-hint {
    padding: 12px 0 0;

    color: var(--muted);

    font-size: 12.5px;
    text-align: center;
}

.results-section {
    margin-top: 30px;
}

.empty-state {
    max-width: 700px;

    margin: 0 auto;
    padding: 45px 30px;

    text-align: center;

    background: rgba(255, 255, 255, 0.75);

    border: 1px solid var(--border);
    border-radius: 20px;
}

.empty-icon {
    font-size: 42px;
    margin-bottom: 12px;
}

.empty-state h2 {
    margin: 0 0 10px;

    font-size: 22px;
}

.empty-state p {
    max-width: 540px;

    margin: 0 auto;

    color: var(--muted);

    line-height: 1.7;
}

.tool-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;

    margin-top: 60px;

    color: #94a3b8;

    font-size: 13px;
}

.tool-footer p {
    margin: 0;
}

@media (max-width: 640px) {

    .research-tool {
        width: min(100% - 20px, 1000px);
        padding-top: 45px;
    }

    .search-box {
        padding: 6px;
    }

    .search-box input {
        font-size: 15px;
    }

    .search-box button {
        padding: 12px 16px;
    }

    .search-icon {
        display: none;
    }

    .empty-state {
        padding: 35px 20px;
    }

    .selection-toolbar {
        padding: 16px;
    }

    .selection-toolbar-row {
        justify-content: flex-start;
    }

    .selection-toolbar button {
        flex: 1 1 auto;
    }

    .collection-toggle-btn {
        padding: 14px 16px;
        font-size: 14px;
    }

    .collection-body {
        padding: 0 16px 18px;
    }

    .collection-body button {
        flex: 1 1 auto;
    }

    .collection-clear-confirm-actions button {
        width: 100%;
    }

    .tool-footer {
        flex-direction: column;
        gap: 4px;
    }
}
