body {
    font-family: Arial, sans-serif;
    margin: 0;
    color: #111;
    background-image: url("/frontend/forest.jpg");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

.query-match {
    background: #d9ecff;
    border-radius: 4px;
    padding: 0 2px;
}

.page {
    max-width: 1440px;
    margin: 0 auto;
    padding: 32px 24px 48px;
    box-sizing: border-box;
    background: transparent;
    min-height: 100vh;
}

h1 {
    font-size: 54px;
    margin: 0;
    text-align: center;
}

h2 {
    font-size: 36px;
    margin: 0 0 22px;
}

h3 {
    font-size: 20px;
    margin: 0 0 12px;
}

.hero-video-section {
    position: relative;
    min-height: 100vh;
    width: 100%;
    overflow: hidden;
    margin-bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-video-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.28);
}

.hero-video-content {
    position: relative;
    z-index: 2;
    text-align: center;
    color: white;
    padding: 24px;
}

.hero-brand {
    font-size: clamp(72px, 11vw, 170px);
    font-weight: 700;
    line-height: 1;
    margin-bottom: 18px;
}

.hero-tagline {
    font-size: clamp(20px, 2.4vw, 34px);
    font-weight: 400;
    line-height: 1.4;
    margin-bottom: 32px;
}

.enter-corpus-btn {
    padding: 14px 28px;
    font-size: 18px;
    border: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
    color: #111;
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: transform 0.15s ease, background 0.15s ease;
}

.enter-corpus-btn:hover {
    background: rgba(255, 255, 255, 0.98);
    transform: translateY(-1px);
}

.hero-video-toggle {
    position: absolute;
    right: 28px;
    bottom: 28px;
    z-index: 3;
    width: 56px;
    height: 56px;
    font-size: 26px;
    border: none;
    border-radius: 0;
    background: rgba(255, 255, 255, 0.92);
    color: #111;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.hero-video-toggle:hover {
    background: rgba(255, 255, 255, 0.98);
}

.hero-video-section {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.7s ease, transform 0.7s ease;
    margin: 0;
}

.hero-video-section.hero-exit {
    opacity: 0;
    transform: translateY(-40px);
    pointer-events: none;
}

.corpus-section {
    padding-top: 36px;
    opacity: 0;
    transform: translateY(60px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}

.corpus-section.corpus-visible {
    opacity: 1;
    transform: translateY(0);
}

.page-title-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}

.page-title-pill {
    display: block;
    width: min(100%, 1320px);
    margin: 0 auto;
    padding: 20px 32px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.84);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.12);
    backdrop-filter: blur(6px);
    text-align: center;
    font-size: clamp(40px, 5vw, 56px);
    font-weight: 700;
    line-height: 1.15;
    white-space: nowrap;
    box-sizing: border-box;
}

.page-title-kicker {
    font-size: 15px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #555;
    margin-bottom: 8px;
}

.page-title-heading {
    font-size: clamp(40px, 5vw, 64px);
    line-height: 1.05;
    margin: 0;
}

.page-title-subtitle {
    margin-top: 10px;
    font-size: 17px;
    color: #555;
}

.page-jump-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    color: #444;
}

.page-jump-input {
    width: 68px;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 8px;
    background: white;
    font-size: 15px;
    text-align: center;
    box-sizing: border-box;
}

/* top search */

.top-search-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 32px;
}

.top-search {
    width: 100%;
    max-width: 920px;
    display: flex;
    gap: 14px;
    align-items: center;
}

.top-search input[type="text"] {
    flex: 1;
    min-width: 280px;
    height: 54px;
    padding: 0 18px;
    font-size: 20px;
    border: 1px solid rgba(180, 180, 180, 0.85);
    border-radius: 14px;
    outline: none;
    background: rgba(255, 255, 255, 0.8);
    box-sizing: border-box;
    backdrop-filter: blur(3px);
}

.top-search button {
    height: 54px;
    padding: 0 24px;
    font-size: 20px;
    border: none;
    border-radius: 14px;
    background: rgba(224, 224, 224, 0.85);
    cursor: pointer;
    backdrop-filter: blur(3px);
}

.top-search button:hover,
button:hover {
    background: #d5d5d5;
}

/* main layout */

.main-layout {
    display: flex;
    gap: 28px;
    align-items: flex-start;
}

/* sidebar */

.sidebar {
    width: 300px;
    flex-shrink: 0;
    background: rgba(243, 243, 243, 0.85);
    border: 1px solid rgba(204, 204, 204, 0.85);
    border-radius: 16px;
    padding: 22px 20px;
    box-sizing: border-box;
    position: sticky;
    top: 18px;
    max-height: calc(100vh - 36px);
    overflow-y: auto;
    backdrop-filter: blur(4px);
}

.sidebar-title {
    font-size: 30px;
    margin: 0 0 20px;
}

.filter-section {
    margin-bottom: 24px;
    padding-bottom: 18px;
    border-bottom: 1px solid #ddd;
}

.filter-section:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.filter-label {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 12px;
}

.filter-label.subheading {
    font-size: 18px;
}

.filter-note {
    font-size: 14px;
    color: #666;
    margin-top: 6px;
    line-height: 1.5;
}

.filter-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 16px;
    line-height: 1.45;
}

.filter-option input[type="checkbox"],
.filter-option input[type="radio"] {
    margin-top: 3px;
    cursor: pointer;
}

.annotation-filter-group {
    margin-top: 14px;
}

.sub-filter-toggle {
    margin-top: 18px;
    padding: 14px 14px 12px;
    background: #ffffff;
    border: 1px solid #d9d9d9;
    border-radius: 12px;
}

.sub-filter-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.45;
    cursor: pointer;
}

.sub-filter-label input[type="checkbox"] {
    margin-top: 3px;
}

.sub-filter-help {
    margin-top: 8px;
    margin-left: 28px;
    font-size: 13px;
    line-height: 1.45;
    color: #666;
}

.sentiment-filter-group {
    margin-top: 12px;
}

.checkbox-list {
    max-height: 280px;
    overflow-y: auto;
    padding-right: 4px;
}

.actions {
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

button {
    padding: 13px 20px;
    font-size: 16px;
    border: none;
    border-radius: 10px;
    background: #e0e0e0;
    cursor: pointer;
}

.apply-btn,
.clear-btn {
    background: #ececec;
}

.hidden {
    display: none !important;
}

/* results */

.results-panel {
    flex: 1;
    min-width: 0;
    background: rgba(243, 243, 243, 0.9);
    border: 1px solid rgba(204, 204, 204, 0.88);
    border-radius: 18px;
    padding: 20px;
    box-sizing: border-box;
    backdrop-filter: blur(4px);
}

.results-header-sticky {
    position: sticky;
    top: 0;
    z-index: 30;
    background: rgba(243, 243, 243, 0.94);
    padding: 10px 0 14px;
    border-bottom: 1px solid rgba(204, 204, 204, 0.85);
    backdrop-filter: blur(4px);
    border-radius: 12px;
}

.results-summary {
    margin-bottom: 12px;
    font-size: 15px;
    color: #555;
}

.sort-legend-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
    margin: 8px 0 16px 0;
}

.sort-bar {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.sort-bar select {
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 8px;
    background: white;
    font-size: 14px;
}

.sentiment-legend-inline {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    font-size: 14px;
}

.legend-title-inline {
    margin-right: 2px;
}

.legend-inline-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.legend-swatch {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    display: inline-block;
    border: 1px solid #ccc;
    flex-shrink: 0;
}

.legend-positive {
    background: #dff5e4;
    border-color: #9fd2ab;
}

.legend-negative {
    background: #ffe680;
    border-color: #e1b900;
}

.legend-neutral {
    background: #ececec;
    border-color: #c9c9c9;
}

.legend-overlap {
    background: #fff;
    border: 2px dashed rgba(80, 80, 80, 0.55);
}

.legend-query-chip {
    background: #d9ecff;
    border: 1px solid #8bbbe8;
    border-radius: 6px;
    padding: 2px 8px;
}

.message {
    padding: 14px 16px;
    border-radius: 10px;
    margin-bottom: 16px;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(221, 221, 221, 0.8);
    backdrop-filter: blur(3px);
}

.error {
    color: #b00020;
    background: #fff3f4;
    border-color: #f0c2c7;
}

.muted {
    color: #666;
}

.result {
    background: rgba(243, 243, 243, 0.85);
    border: 1px solid rgba(204, 204, 204, 0.85);
    border-radius: 12px;
    padding: 18px 20px;
    margin-bottom: 18px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    backdrop-filter: blur(4px);
}

.result-top {
    display: flex;
    gap: 18px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.result-image {
    width: 140px;
    min-width: 140px;
}

.result-image img {
    width: 140px;
    height: 140px;
    object-fit: contain;
    border: 1px solid #e3e3e3;
    border-radius: 10px;
    background: #fff;
}

.result-image .image-placeholder {
    width: 140px;
    height: 140px;
    border: 1px solid #e3e3e3;
    border-radius: 10px;
    background: #f7f7f7;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    box-sizing: border-box;
}

.result-image .image-placeholder img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border: none;
    background: transparent;
}

.result-main {
    flex: 1;
    min-width: 320px;
}

.result-line {
    margin-bottom: 8px;
    line-height: 1.5;
}

.result-line strong {
    display: inline-block;
}

.snippet {
    color: #333;
    margin-top: 6px;
}

.score {
    color: #666;
    font-size: 14px;
}

.rating {
    color: #333;
    font-size: 15px;
}

.result-actions {
    margin-top: 14px;
}

.annotations {
    margin-top: 14px;
    padding: 14px 16px;
    background: rgba(250, 250, 250, 0.85);
    border: 1px solid rgba(238, 238, 238, 0.85);
    border-radius: 10px;
    backdrop-filter: blur(3px);
}

.annotations h4 {
    margin: 0 0 12px 0;
    font-size: 16px;
}

.annotation-section {
    margin-bottom: 14px;
}

.annotation-section:last-child {
    margin-bottom: 0;
}

.annotation-section-title {
    font-weight: bold;
    margin-bottom: 8px;
    color: #333;
}

.annotation-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.annotation-chip {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 999px;
    background: #f0f0f0;
    border: 1px solid #ddd;
    font-size: 14px;
    line-height: 1.4;
}

.annotation-chip .span-text {
    font-weight: bold;
}

.annotation-chip .meta {
    color: #555;
    margin-left: 6px;
}

/* pagination */

.pagination-controls {
    margin-top: 20px;
    margin-bottom: 24px;
    padding: 16px 18px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(221, 221, 221, 0.8);
    border-radius: 12px;
    backdrop-filter: blur(3px);
}

.result-range {
    font-size: 14px;
    color: #666;
    margin-bottom: 6px;
}

.pagination-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.page-size-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-size-control select {
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 8px;
    background: white;
    font-size: 15px;
}

.page-nav {
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-nav button {
    padding: 10px 16px;
    font-size: 15px;
}

.page-nav button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-info {
    font-size: 15px;
    color: #444;
}

/* details */

.details-heading {
    margin-top: 40px;
}

.details-panel {
    margin-top: 16px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(221, 221, 221, 0.85);
    border-radius: 12px;
    padding: 22px;
    white-space: pre-wrap;
    overflow-x: auto;
    backdrop-filter: blur(4px);
}

/* review highlight */

.review-highlight-box {
    padding: 12px 14px;
    border: 1px solid #e8e1b5;
    background: #fffdf6;
    border-radius: 10px;
    line-height: 1.8;
    white-space: normal;
    word-break: break-word;
}

.review-segment {
    display: inline;
    padding: 1px 2px;
    border-radius: 4px;
    transition: box-shadow 0.15s ease, filter 0.15s ease;
}

.review-segment.annotated {
    font-weight: 600;
    cursor: help;
}

.review-segment.sentiment-positive {
    background: #dff5e4;
    box-shadow: inset 0 0 0 1px #9fd2ab;
}

.review-segment.sentiment-negative {
    background: #ffe680;
    box-shadow: inset 0 0 0 1px #e1b900;
}

.review-segment.sentiment-neutral {
    background: #ececec;
    box-shadow: inset 0 0 0 1px #c9c9c9;
}

.review-segment.overlap {
    box-shadow:
        inset 0 0 0 1px currentColor,
        0 0 0 1.5px rgba(80, 80, 80, 0.35);
    border-bottom: 2px dashed rgba(80, 80, 80, 0.55);
}

.review-segment.annotated:hover {
    filter: brightness(0.97);
}

.review-legend {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.review-legend-item {
    font-size: 13px;
    padding: 5px 8px;
    border-radius: 999px;
    background: #f2f2f2;
    border: 1px solid #ddd;
}

/* tooltip */

.tooltip {
    position: relative;
    cursor: help;
    border-bottom: 1px dotted #888;
}

.tooltip-text {
    visibility: hidden;
    width: 260px;
    background-color: #333;
    color: #fff;
    text-align: left;
    padding: 8px 10px;
    border-radius: 6px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 0;
    font-size: 13px;
    line-height: 1.4;
    opacity: 0;
    transition: opacity 0.2s;
}

.tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

.back-to-top-btn {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 2000;
    padding: 12px 18px;
    font-size: 15px;
    border: none;
    border-radius: 999px;
    background: rgba(243, 243, 243, 0.98);
    border: 1px solid rgba(204, 204, 204, 0.95);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.22);
    backdrop-filter: blur(4px);
    cursor: pointer;
}

.back-to-top-btn:hover {
    background: rgba(224, 224, 224, 0.98);
}

@media (max-width: 980px) {
    .main-layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        position: static;
        max-height: none;
    }

    .result-top {
        flex-direction: column;
    }

    .result-image {
        width: 140px;
        min-width: 140px;
    }

    .results-header-sticky {
        position: static;
    }
    
    .hero-video-section {
        min-height: 100vh;
    }
    
    .hero-video-toggle {
        right: 18px;
        bottom: 18px;
        width: 50px;
        height: 50px;
        font-size: 22px;
    }
    
    .enter-corpus-btn {
        font-size: 16px;
        padding: 12px 22px;
    }
}

.results-toolbar {
    margin-top: 8px;
}

.sentiment-legend-box {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.legend-title {
    font-weight: 700;
}

.legend-inline {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.result {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(210, 210, 210, 0.9);
    border-radius: 18px;
    padding: 22px 22px 20px;
    margin-bottom: 18px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.04);
    backdrop-filter: blur(4px);
}

.result-top {
    display: grid;
    grid-template-columns: 160px minmax(0, 1fr);
    gap: 22px;
    align-items: start;
}

.result-image {
    width: 160px;
    min-width: 160px;
}

.result-image img,
.result-image .image-placeholder {
    width: 160px;
    height: 160px;
}

.result-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.result-header {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.result-title {
    font-size: 30px;
    font-weight: 700;
    line-height: 1.2;
    color: #111;
    word-break: break-word;
    margin-bottom: 12px;
}

.result-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.meta-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: 999px;
    background: #f2f2f2;
    border: 1px solid #dedede;
    font-size: 14px;
    color: #444;
}

.result-snippet-block {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.result-section-label {
    font-size: 14px;
    font-weight: 700;
    color: #444;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.result-snippet-box {
    padding: 14px 16px;
    border-radius: 12px;
    background: #fafafa;
    border: 1px solid #e6e6e6;
    color: #333;
    line-height: 1.65;
}

.result-score-line {
    font-size: 14px;
    color: #666;
}

.result-actions {
    margin-top: 4px;
}

.result-actions button {
    background: #ededed;
    border: 1px solid #d7d7d7;
}

@media (max-width: 980px) {
    .page-title-pill {
        width: 100%;
    }

    .result-top {
        grid-template-columns: 1fr;
    }

    .result-image {
        width: 140px;
        min-width: 140px;
    }

    .result-image img,
    .result-image .image-placeholder {
        width: 140px;
        height: 140px;
    }

    .result-title {
        font-size: 24px;
    }
}

.pagination-bottom-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.pagination-left {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.pagination-right {
    margin-left: auto;
    display: flex;
    align-items: center;
}

.about-corpus-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(204, 204, 204, 0.9);
    color: #1f4f3d;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s ease, transform 0.15s ease;
}

.about-corpus-link:hover {
    background: rgba(255, 255, 255, 0.98);
    transform: translateY(-1px);
}

@media (max-width: 980px) {
    .pagination-bottom-row {
        flex-direction: column;
        align-items: stretch;
    }

    .pagination-right {
        margin-left: 0;
        justify-content: flex-start;
    }

    .about-corpus-subtle {
    position: static;
    display: inline-block;
    margin-bottom: 12px;
    }
}

.corpus-info-page {
    padding-top: 36px;
}

.corpus-info-header {
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.corpus-info-panel {
    max-width: 1080px;
    margin: 0 auto;
}

.about-back-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(204, 204, 204, 0.9);
    color: #1f4f3d;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s ease, transform 0.15s ease;
}

.about-back-link:hover {
    background: rgba(255, 255, 255, 0.98);
    transform: translateY(-1px);
}

.corpus-info-text {
    line-height: 1.75;
    font-size: 17px;
}

.corpus-info-text p {
    margin: 0 0 12px 0;
}

.corpus-info-text p:last-child {
    margin-bottom: 0;
}

.results-header-sticky {
    position: sticky;
    top: 0;
    z-index: 30;
    background: rgba(243, 243, 243, 0.94);
    padding: 10px 0 14px;
    border-bottom: 1px solid rgba(204, 204, 204, 0.85);
    backdrop-filter: blur(4px);
    border-radius: 12px;
    position: relative;
}

.results-header-top {
    display: flex;
    align-items: center;
}

.results-header-top h2 {
    margin: 0 0 22px;
}

.about-corpus-subtle {
    position: absolute;
    top: 14px;
    right: 6px;
    font-size: 15px;
    color: #6f6f6f;
    text-decoration: underline;
    text-underline-offset: 2px;
    white-space: nowrap;
    cursor: pointer;
    transition: color 0.15s ease, opacity 0.15s ease;
}

.about-corpus-subtle:hover {
    color: #333;
    opacity: 0.9;
}