:root {
    --bg: #f7f5f0;
    --ink: #1f2933;
    --muted: #6b7280;
    --violet: #7c3aed;
    --violet-dark: #4c1d95;
    --violet-soft: #f4f0ff;
    --violet-border: #d8c8ff;
    --yellow: #facc15;
    --black: #111827;
    --border: #ded7c8;
}

body {
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, Arial, sans-serif;
}

.mobile-topbar,
.mobile-nav-toggle {
    display: none;
}

.top-left-tools {
    position: absolute;
    top: 18px;
    left: 22px;
    z-index: 1000;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.top-right-uni {
    position: absolute;
    top: 12px;
    right: 22px;
    z-index: 1000;
}

.tool-dropdown,
.uni-dropdown {
    position: relative;
}

.tool-dropdown summary,
.uni-dropdown summary,
.info-button {
    list-style: none;
    cursor: pointer;
    background: white;
    border: 1px solid var(--border);
    border-radius: 999px;
    box-shadow: 0 8px 20px rgba(31, 41, 51, 0.08);
    color: #b7a7df;
    font-size: 15px;
    font-family: Inter, Arial, sans-serif;
    font-weight: 600;
    transition: all 0.18s ease;
}

.tool-dropdown summary {
    width: 64px;
    height: 64px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
}

.tool-dropdown summary:hover,
.uni-dropdown summary:hover,
.info-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 26px rgba(76, 29, 149, 0.14);
    border-color: var(--violet-border);
    background: var(--violet-soft);
}

.info-button:active,
.info-button.info-button-active {
    transform: translateY(-1px);
    background: #111111 !important;
    border-color: #111111 !important;
    color: #ffffff !important;
    box-shadow: 0 12px 28px rgba(17, 24, 39, 0.22) !important;
}

.tool-dropdown summary:focus,
.tool-dropdown summary:focus-visible,
.uni-dropdown summary:focus,
.uni-dropdown summary:focus-visible,
.info-button:focus,
.info-button:focus-visible {
    outline: none;
}

.tool-dropdown[open] > summary {
    background: #111111;
    border-color: #111111;
    color: #ffffff;
    box-shadow: 0 12px 28px rgba(17, 24, 39, 0.22);
}

.tool-dropdown summary::-webkit-details-marker,
.uni-dropdown summary::-webkit-details-marker {
    display: none;
}

.info-button {
    width: 64px;
    height: 64px;
    padding: 0;
    font-size: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dropdown-card {
    position: absolute;
    top: 78px;
    left: 0;
    min-width: 260px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 20px 22px;
    box-shadow: 0 16px 36px rgba(31, 41, 51, 0.16);
    font-family: Inter, Arial, sans-serif;
    color: var(--black);
}

.dropdown-card label,
.dropdown-card .control-label,
.dropdown-card .form-check-label {
    font-family: Inter, Arial, sans-serif !important;
    color: var(--black);
    font-size: 16px;
    font-weight: 600;
}

.dropdown-card .control-label {
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 10px;
}

.dropdown-card input[type="radio"] {
    accent-color: var(--violet-dark);
}

.uni-dropdown .dropdown-card {
    right: 0;
    left: auto;
    min-width: 260px;
    top: 82px;
}

.tool-dropdown .dropdown-card {
    min-width: 300px;
    background: #ffffff;
    border: 1px solid #e7e0d8;
    border-radius: 18px;
    padding: 18px 20px;
    box-shadow: 0 14px 34px rgba(31, 41, 51, 0.14);
}

.tool-dropdown .dropdown-card .form-group {
    margin-bottom: 0;
}

.tool-dropdown .dropdown-card .control-label {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 12px;
    color: var(--violet-dark);
}

.tool-dropdown .dropdown-card .form-check {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    padding: 3px 0;
}

.tool-dropdown .dropdown-card .form-check:last-child {
    margin-bottom: 0;
}

.tool-dropdown .dropdown-card .form-check-label {
    font-size: 16px;
    font-weight: 700;
    color: #111827;
}

.tool-dropdown .dropdown-card .form-check-input {
    margin-top: 0;
    width: 20px;
    height: 20px;
    border-color: #9ca3af !important;
}

.tool-dropdown .dropdown-card .form-check-input:checked {
    border-color: #6d28d9 !important;
}

.dropdown-card a {
    display: block;
    color: var(--black);
    text-decoration: none;
    font-weight: 700;
    padding: 8px 6px;
    border-radius: 10px;
    font-family: Inter, Arial, sans-serif;
}

.dropdown-card a:hover {
    background: var(--violet-soft);
    color: var(--violet-dark);
}

.dropdown-muted-link {
    display: block;
    color: #6b7280;
    font-family: Inter, Arial, sans-serif;
    font-weight: 700;
    padding: 8px 6px;
}

.dropdown-card .related-papers-button {
    display: block;
    width: 100%;
    margin: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    color: var(--black);
    font-family: Inter, Arial, sans-serif;
    font-weight: 700;
    text-align: left;
    padding: 8px 6px;
    border-radius: 10px;
}

.dropdown-card .related-papers-button:hover,
.dropdown-card .related-papers-button:focus {
    background: var(--violet-soft);
    color: var(--violet-dark);
    box-shadow: none;
}

.uni-logo {
    height: 78px;
    width: auto;
    max-width: 260px;
    object-fit: contain;
    cursor: pointer;
    display: block;
}

.uni-dropdown summary {
    padding: 8px 16px;
    min-width: 210px;
    height: 92px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.main-header {
    text-align: center;
    padding-top: 32px;
    padding-bottom: 12px;
}

.brand-lockup {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: clamp(8px, 1.4vw, 18px);
}

.main-title {
    font-size: clamp(36px, 4.8vw, 60px);
    font-weight: 800;
    letter-spacing: clamp(1px, 0.45vw, 6px);
    margin-bottom: 8px;
    color: var(--ink);
    line-height: 1;
    white-space: nowrap;
}

.app-logo {
    height: clamp(94px, 14vw, 200px);
    width: auto;
    max-width: min(32vw, 220px);
    object-fit: contain;
    flex: 0 0 auto;
}

.subtitle {
    font-size: 15px;
    color: var(--muted);
    margin-bottom: 22px;
    font-style: italic;
    font-family: Georgia, serif;
}

.nav-tabs {
    justify-content: center;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
}

.nav-tabs .nav-link {
    position: relative;
    color: var(--black);
    font-weight: 700;
    border-radius: 999px;
    margin: 0 4px;
    padding: 8px 16px;
    transition: all 0.18s ease;
    font-family: Inter, Arial, sans-serif;
}

.nav-tabs .nav-link:hover {
    background: var(--violet-soft);
    color: var(--violet-dark);
    border-color: var(--violet-border);
}

.nav-tabs .nav-link.active {
    background: linear-gradient(135deg, var(--violet-dark), var(--violet));
    color: white;
    border-color: var(--violet-dark);
    box-shadow: 0 8px 22px rgba(124, 58, 237, 0.22);
}

@media (max-width: 1080px) {
    body {
        padding-top: 0;
    }

    .mobile-topbar {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 990;
        display: block;
        height: 70px;
        background:
            linear-gradient(135deg, rgba(76, 29, 149, 0.98), rgba(124, 58, 237, 0.96)),
            var(--violet-dark);
        border-bottom: 1px solid rgba(255, 255, 255, 0.18);
        box-shadow: 0 14px 34px rgba(76, 29, 149, 0.28);
    }

    .top-left-tools {
        position: fixed;
        top: 10px;
        left: 12px;
        z-index: 1002;
        gap: 8px;
        align-items: center;
    }

    .tool-dropdown summary,
    .info-button,
    .uni-dropdown summary,
    .mobile-nav-toggle {
        background: rgba(255, 255, 255, 0.96);
        border: 1px solid rgba(255, 255, 255, 0.74);
        box-shadow: 0 9px 22px rgba(31, 20, 65, 0.22);
    }

    .tool-dropdown summary,
    .info-button,
    .mobile-nav-toggle {
        width: 48px;
        height: 48px;
    }

    .tool-dropdown summary {
        font-size: 23px;
    }

    .info-button {
        font-size: 22px;
    }

    .tool-dropdown .dropdown-card {
        top: 58px;
        min-width: min(330px, calc(100vw - 24px));
        max-width: calc(100vw - 24px);
        border-radius: 16px;
    }

    .top-right-uni {
        position: fixed;
        top: 10px;
        right: 70px;
        z-index: 1002;
    }

    .uni-dropdown summary {
        height: 48px;
        min-width: 92px;
        max-width: 118px;
        padding: 6px 10px;
    }

    .uni-logo {
        height: 31px;
        max-width: 96px;
    }

    .uni-dropdown .dropdown-card {
        top: 58px;
        min-width: 246px;
        max-width: calc(100vw - 24px);
        border-radius: 16px;
    }

    .mobile-nav-toggle {
        position: fixed;
        top: 10px;
        right: 12px;
        z-index: 1003;
        display: inline-flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 5px;
        padding: 0;
        border-radius: 999px;
        cursor: pointer;
    }

    .mobile-nav-line {
        display: block;
        width: 20px;
        height: 2px;
        border-radius: 99px;
        background: var(--violet-dark);
        transition: transform 0.18s ease, opacity 0.18s ease;
    }

    body.mobile-nav-open .mobile-nav-line:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }

    body.mobile-nav-open .mobile-nav-line:nth-child(2) {
        opacity: 0;
    }

    body.mobile-nav-open .mobile-nav-line:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    .main-header {
        padding-top: 88px;
        padding-bottom: 10px;
    }

    .brand-lockup {
        gap: 8px;
    }

    .main-title {
        font-size: clamp(31px, 9vw, 44px);
        letter-spacing: clamp(0.5px, 0.9vw, 3px);
    }

    .app-logo {
        height: clamp(66px, 19vw, 92px);
        max-width: 24vw;
    }

    .subtitle {
        max-width: 88vw;
        margin: 8px auto 18px auto;
        font-size: 13px;
        line-height: 1.4;
    }

    .route-nav {
        position: fixed;
        top: 78px;
        left: 12px;
        right: 12px;
        z-index: 1001;
        display: none !important;
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
        max-height: calc(100vh - 94px);
        overflow-y: auto;
        margin: 0;
        padding: 10px;
        background: rgba(255, 255, 255, 0.98);
        border: 1px solid var(--violet-border);
        border-radius: 18px;
        box-shadow: 0 20px 44px rgba(31, 20, 65, 0.2);
    }

    body.mobile-nav-open .route-nav {
        display: flex !important;
    }

    .route-nav .nav-item {
        width: 100%;
    }

    .route-nav .nav-link {
        display: block;
        width: 100%;
        margin: 0;
        padding: 12px 14px;
        border-radius: 13px;
        text-align: left;
        font-size: 15px;
    }

    .custom-tab-tooltip {
        display: none !important;
    }
}

@media (max-width: 430px) {
    .top-right-uni {
        right: 64px;
    }

    .uni-dropdown summary {
        min-width: 76px;
        max-width: 88px;
        padding: 6px 8px;
    }

    .uni-logo {
        height: 27px;
        max-width: 72px;
    }

    .main-title {
        font-size: clamp(27px, 8.3vw, 34px);
        letter-spacing: 0.5px;
    }

    .app-logo {
        height: clamp(56px, 17vw, 72px);
        max-width: 22vw;
    }
}

@media (max-width: 1080px) {
    body:not(.mobile-nav-open) #main_navigation.route-nav.nav.nav-tabs {
        display: none !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }

    body.mobile-nav-open #main_navigation.route-nav.nav.nav-tabs {
        display: flex !important;
        visibility: visible !important;
        pointer-events: auto !important;
    }
}

.custom-tab-tooltip {
    position: fixed;
    display: none;
    max-width: min(280px, calc(100vw - 32px));
    background: linear-gradient(135deg, #fbf9ff, #f1eaff);
    color: var(--black);
    border: 1px solid var(--violet-border);
    border-radius: 14px;
    padding: 12px 14px;
    box-shadow: 0 14px 28px rgba(76, 29, 149, 0.16);
    font-family: Inter, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.45;
    z-index: 3000;
    pointer-events: none;
}

.custom-tab-tooltip strong {
    display: block;
    color: var(--violet-dark);
    font-size: 15px;
    font-weight: 800;
    margin-bottom: 4px;
}

.custom-tab-tooltip::after {
    content: "";
    position: absolute;
    bottom: -8px;
    left: var(--tooltip-arrow-left, 36px);
    width: 14px;
    height: 14px;
    background: #f1eaff;
    border-right: 1px solid var(--violet-border);
    border-bottom: 1px solid var(--violet-border);
    transform: translateX(-50%) rotate(45deg);
}

.custom-tab-tooltip.tooltip-below::after {
    top: -8px;
    bottom: auto;
    border-right: 0;
    border-bottom: 0;
    border-left: 1px solid var(--violet-border);
    border-top: 1px solid var(--violet-border);
}

.card {
    background: white;
    border-radius: 22px;
    padding: 24px;
    box-shadow: 0 12px 28px rgba(31, 41, 51, 0.08);
    border: 1px solid #eee8dc;
    margin-bottom: 18px;
}

.guide-box {
    max-width: 900px;
    margin: 0 auto 22px auto;
    background: #fff8db;
    border: 1px solid #f3d86b;
    border-left: 7px solid var(--yellow);
    border-radius: 18px;
    padding: 18px 22px;
    box-shadow: 0 10px 24px rgba(31, 41, 51, 0.06);
    font-family: Inter, Arial, sans-serif;
}

.guide-box h3 {
    margin-top: 0;
    color: var(--violet-dark);
    font-weight: 800;
}

.tab-guide-box {
    max-width: none;
    margin: 4px 0 18px 0;
}

.tab-guide-subtitle {
    margin-top: 18px;
    margin-bottom: 10px;
    color: #4c1d95;
    font-size: 22px;
    font-weight: 800;
}

.tab-guide-format-card {
    margin-top: 8px;
    background: #f6f1ff;
    border: 1px solid #d8c8ff;
    border-radius: 14px;
    padding: 14px 16px 16px 16px;
}

.tab-guide-format-table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
    border: 1px solid #d8c8ff;
}

.tab-guide-format-table th,
.tab-guide-format-table td {
    border: 1px solid #d8c8ff;
    padding: 8px 10px;
    font-size: 16px;
    color: #1f2933;
    text-align: center;
}

.tab-guide-format-table th {
    background: #ece2ff;
    color: #4c1d95;
    font-weight: 800;
}

.tab-guide-format-table th:first-child,
.tab-guide-format-table td:first-child {
    min-width: 190px;
}

.tab-guide-box p:last-child {
    margin-bottom: 0;
}

.page-title {
    font-size: 28px;
    font-weight: 750;
    margin-bottom: 12px;
}

.muted {
    color: var(--muted);
}

.modal-content {
    border-radius: 22px;
    border: 1px solid #d8c8ff;
    background: linear-gradient(180deg, #fcfaff 0%, #f7f2ff 100%);
    font-family: Inter, Arial, sans-serif;
    box-shadow: 0 24px 58px rgba(76, 29, 149, 0.22);
}

.modal-title,
.modal-content h3 {
    color: var(--violet-dark);
    font-weight: 800;
    font-family: Inter, Arial, sans-serif;
}

.modal-content p {
    color: var(--ink);
    font-size: 15px;
    line-height: 1.55;
    font-family: Inter, Arial, sans-serif;
}

.guide-modal-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.guide-modal-intro,
.guide-modal-section {
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid #d8c8ff;
    border-radius: 14px;
    padding: 12px 14px;
}

.guide-modal-body h4 {
    margin: 0 0 8px 0;
    color: #1f4a85;
    font-size: 19px;
    font-weight: 800;
}

.guide-modal-body ul,
.guide-modal-body ol {
    margin: 0;
    padding-left: 22px;
}

.guide-modal-body li {
    font-size: 15px;
    line-height: 1.6;
    color: #1f2933;
    margin-bottom: 6px;
}

.guide-modal-body li:last-child {
    margin-bottom: 0;
}

.related-papers-intro {
    margin-bottom: 0;
}

.related-papers-modal-body {
    max-height: min(72vh, 760px);
    overflow-y: auto;
    padding-right: 4px;
}

.related-papers-list {
    list-style: none;
    padding-left: 0 !important;
}

.related-papers-list li {
    margin-bottom: 14px;
}

.related-papers-list li:last-child {
    margin-bottom: 0;
}

.related-paper-citation {
    color: #1f2933;
}

.related-paper-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 4px;
    color: #5b21b6;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}

.related-paper-link .fa {
    width: 11px;
    height: 11px;
    margin: 0 !important;
}

.related-paper-link:hover,
.related-paper-link:focus {
    color: var(--violet-dark);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.modal-footer .btn {
    border-radius: 999px;
    font-family: Inter, Arial, sans-serif;
    font-weight: 700;
}

.footer-note {
    text-align: center;
    margin-top: 26px;
    margin-bottom: 12px;
    color: #8b8b95;
    font-size: 14px;
    font-family: Inter, Arial, sans-serif;
    opacity: 0.92;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.footer-note::before {
    content: "✦";
    color: #7c3aed;
    font-size: 14px;
}

.footer-note::after {
    content: "✦";
    color: #7c3aed;
    font-size: 14px;
}

/* Explorer */
.explorer-page,
.explorer-results-card {
    width: 100%;
    max-width: none;
    box-sizing: border-box;
}

.explorer-hero {
    background: #ffffff;
    border: 1px solid #e7e0d8;
    border-bottom: none;
    border-radius: 22px 22px 0 0;
    padding: 26px 28px;
    margin-bottom: 0;
    box-shadow: 0 10px 30px rgba(30, 20, 10, 0.04);
}

.explorer-hero + .card {
    margin-top: 0 !important;
    background: #ffffff !important;
    border: 1px solid #e7e0d8 !important;
    border-top: none !important;
    border-radius: 0 0 22px 22px !important;
    box-shadow: 0 10px 30px rgba(30, 20, 10, 0.04);
}

.explorer-hero .page-title {
    margin-bottom: 8px;
}

.explorer-hero-text {
    max-width: 900px;
    margin-bottom: 0;
    font-size: 15px;
    line-height: 1.55;
}

.standardisation-control {
    margin: 12px 0 14px 0;
    padding: 12px 14px;
    background: #fbfaf8;
    border: 1px solid #eee8dc;
    border-radius: 16px;
    display: flex;
    align-items: center;
    min-height: 52px;
}

.standardisation-control .form-check,
.standardisation-control .form-check-label,
.standardisation-control label {
    display: flex;
    align-items: center;
    margin-bottom: 0 !important;
    line-height: 1.25;
}

.standardisation-control input[type="checkbox"] {
    margin-top: 0 !important;
}

.standardisation-control:not(.smoothing-control) {
    --explorer-control-label-width: 280px;
    display: grid;
    grid-template-columns: var(--explorer-control-label-width) minmax(0, 1fr);
    column-gap: 16px;
}

.standardisation-control:not(.smoothing-control) > .shiny-input-container,
.standardisation-control:not(.smoothing-control) > .form-check {
    width: var(--explorer-control-label-width) !important;
    max-width: var(--explorer-control-label-width) !important;
    margin-bottom: 0 !important;
}

.standardisation-control:not(.smoothing-control) > .explorer-control-note {
    align-self: center;
    margin: 0 !important;
}

.smoothing-control {
    display: block;
    min-height: auto;
    padding: 12px 14px 10px 14px;
}

.smoothing-control .form-group,
.smoothing-control .shiny-input-container {
    margin-bottom: 0 !important;
}

@media (max-width: 760px) {
    .standardisation-control:not(.smoothing-control) {
        grid-template-columns: 1fr;
        row-gap: 8px;
    }

    .standardisation-control:not(.smoothing-control) > .shiny-input-container,
    .standardisation-control:not(.smoothing-control) > .form-check {
        width: 100% !important;
        max-width: 100% !important;
    }
}

.explorer-data-notice {
    margin: 0 0 14px 0;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.45;
}

.explorer-data-notice-warning {
    border: 1px solid #f3d08a;
    background: #fff8e6;
    color: #704800;
}

.explorer-data-notice-ready {
    border: 1px solid #c7d2fe;
    background: #eef2ff;
    color: #27346d;
}

.run-analysis-button,
#download_explorer_excel {
    border-radius: 8px !important;
    padding: 9px 18px !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
    box-shadow: none !important;
}

.run-analysis-button {
    margin: 4px 12px 12px 0;
    background: #7c3aed !important;
    border-color: #7c3aed !important;
    color: white !important;
}

.run-analysis-button:disabled {
    background: #a7a3b8 !important;
    border-color: #a7a3b8 !important;
    cursor: not-allowed;
}

.run-analysis-button.is-loading {
    opacity: 0.78;
    cursor: progress;
}

.explorer-loading-state {
    display: none;
    align-items: center;
    gap: 9px;
    margin: 2px 0 10px 0;
    color: #4c1d95;
    font-size: 14px;
    font-weight: 700;
}

.explorer-loading-state.is-visible {
    display: inline-flex;
}

.explorer-loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #d8c8ff;
    border-top-color: #7c3aed;
    border-radius: 50%;
    animation: explorer-loading-spin 0.75s linear infinite;
    flex: 0 0 auto;
}

@keyframes explorer-loading-spin {
    to {
        transform: rotate(360deg);
    }
}

#download_explorer_excel {
    margin: 4px 0 12px 0;
}

#trajectory_scale_note,
#indexed_scale_note,
#segmented_scale_note,
#heatmap_scale_note {
    display: block;
    width: 100%;
    margin-top: 8px;
    margin-bottom: 0;
    font-size: 13px;
    font-weight: 650;
    color: #6b7280;
    text-align: center;
}

.analysis-section {
    margin-top: 34px;
    padding-top: 22px;
    border-top: 1px solid #eee8dc;
    overflow: visible;
}

.analysis-section:first-of-type {
    margin-top: 22px;
}

.explorer-chart-section {
    width: 100%;
    max-width: none;
    clear: both;
}

.table-section-title {
    font-size: 22px;
    font-weight: 750;
    color: #1f2933;
    margin-bottom: 6px;
}

.section-description {
    margin-bottom: 16px;
    font-size: 16px;
    line-height: 1.65;
}

.centered-plot-container {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    min-width: 0;
}

.explorer-plot-scroll {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    padding: 14px 2px 10px 2px;
}

.explorer-page .explorer-chart-section .explorer-plot-scroll {
    width: calc(100% + 48px);
    max-width: none;
    margin-left: -24px;
    margin-right: -24px;
    padding-left: 0;
    padding-right: 0;
}

.explorer-plot-inner {
    width: 100%;
    min-width: 100%;
    max-width: none;
    display: block;
}

#trajectory_plot,
#indexed_trajectory_plot,
#segmented_trend_plot,
#correlation_heatmap {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
}

.explorer-heatmap-inner {
    width: 100%;
    min-width: 0;
    margin: 0 auto;
}

.heatmap-section .centered-plot-container {
    display: block;
    width: 100%;
    max-width: 100%;
    padding-left: 0;
    padding-right: 0;
}

.heatmap-section .explorer-heatmap-inner {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
}

.explorer-chart-section .explorer-plot-inner .html-widget,
.explorer-chart-section .explorer-plot-inner .shiny-ipywidget-output,
.explorer-chart-section .explorer-plot-inner .html-fill-item,
.explorer-chart-section .explorer-plot-inner .html-fill-container,
.explorer-chart-section .explorer-plot-inner .plotly,
.explorer-chart-section .explorer-plot-inner .js-plotly-plot,
.explorer-chart-section .explorer-plot-inner .plot-container,
.explorer-chart-section .explorer-plot-inner .svg-container {
    display: block !important;
    width: 100% !important;
    min-width: 100% !important;
    max-width: none !important;
}

.explorer-chart-section .explorer-plot-inner .main-svg {
    width: 100% !important;
}

.heatmap-section .centered-plot-container {
    text-align: center;
}

.heatmap-section .explorer-heatmap-inner {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    text-align: left;
}

.heatmap-section #correlation_heatmap {
    display: flex !important;
    justify-content: center;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    overflow-x: auto;
}

.heatmap-section #correlation_heatmap .js-plotly-plot,
.heatmap-section #correlation_heatmap .plot-container,
.heatmap-section #correlation_heatmap .svg-container,
.heatmap-section #correlation_heatmap .main-svg {
    flex: 0 0 auto;
    margin-left: auto !important;
    margin-right: auto !important;
}

.segmented-filter-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 16px;
}

.segmented-filter-controls .form-group,
.segmented-filter-controls > div {
    min-width: 260px;
    flex: 1;
    font-size: 16px;
}

.segmented-filter-controls input,
.segmented-filter-controls .selectize-control {
    font-size: 16px;
}

.heatmap-section {
    text-align: left;
    padding-bottom: 8px;
}

.shiny-data-grid {
    margin-top: 10px;
}

/* Get Ngram Data */
.ngram-section-card,
.section-card {
    background: #ffffff;
    border-radius: 22px;
    padding: 24px;
    margin-bottom: 20px;
    border: 1px solid #e7e0d8;
    box-shadow: 0 10px 30px rgba(30, 20, 10, 0.04);
}

.ngram-layout-card {
    background: #ffffff;
    border-radius: 22px;
    padding: 22px;
    border: 1px solid #e7e0d8;
    box-shadow: 0 10px 30px rgba(30, 20, 10, 0.04);
}

.ngram-inner-card,
.inner-card {
    background: #fbfaf8;
    border-radius: 18px;
    padding: 16px;
    margin-bottom: 16px;
    border: 1px solid #ebe3da;
    box-shadow: 0 2px 8px rgba(30, 20, 10, 0.03);
}

.ngram-results-card,
.results-card {
    background: #fbfaf8;
    border-radius: 18px;
    padding: 18px;
    border: 1px solid #ebe3da;
}

.ngram-section-card .page-title,
.section-card .page-title {
    margin-bottom: 8px;
}

.ngram-section-card .muted,
.section-card .muted {
    margin-bottom: 0;
}

.section-card .muted.ngram-fetcher-intro {
    margin-bottom: 16px;
}

.ngram-inner-card input,
.ngram-inner-card select,
.ngram-inner-card textarea,
.inner-card input,
.inner-card select,
.inner-card textarea {
    border: 1px solid #d1d5db !important;
    border-radius: 7px !important;
    box-shadow: none !important;
}

.ngram-inner-card input:focus,
.ngram-inner-card select:focus,
.ngram-inner-card textarea:focus,
.inner-card input:focus,
.inner-card select:focus,
.inner-card textarea:focus {
    border-color: #7c3aed !important;
    box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.22) !important;
}

.ngram-inner-card input[type="checkbox"],
.inner-card input[type="checkbox"],
.form-check-input {
    accent-color: #6d28d9 !important;
}

.form-check-input:checked {
    background-color: #6d28d9 !important;
    border-color: #6d28d9 !important;
}

#download_ngram,
#download_ngram_xlsx,
#run_english_corpus_comparison,
#download_english_corpus_comparison_xlsx,
#cross_run_analysis,
#download_inflections_xlsx,
#download_synonyms_xlsx {
    width: 100% !important;
    height: 46px !important;
    border-radius: 7px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    line-height: 1 !important;
    white-space: nowrap !important;
    text-align: center !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 12px !important;
    transition: all 0.2s ease;
}

#download_ngram,
#run_english_corpus_comparison,
#cross_run_analysis,
#infl_fetch,
#syn_fetch {
    margin-top: 12px;
    margin-bottom: 12px;
    background: #6d28d9 !important;
    border: 1px solid #6d28d9 !important;
    color: white !important;
}

#download_ngram:hover,
#run_english_corpus_comparison:hover,
#cross_run_analysis:hover,
#infl_fetch:hover,
#syn_fetch:hover {
    background: #5b21b6 !important;
    border-color: #5b21b6 !important;
}

#download_ngram_xlsx,
#download_english_corpus_comparison_xlsx,
#download_inflections_xlsx,
#download_synonyms_xlsx {
    background: white !important;
    border: 1.4px solid #111111 !important;
    color: #111111 !important;
}

#download_ngram_xlsx:hover,
#download_english_corpus_comparison_xlsx:hover,
#download_inflections_xlsx:hover,
#download_synonyms_xlsx:hover {
    background: #111111 !important;
    color: white !important;
    border-color: #111111 !important;
}

#download_ngram_xlsx,
#download_ngram_xlsx:hover,
#download_english_corpus_comparison_xlsx,
#download_english_corpus_comparison_xlsx:hover,
#download_inflections_xlsx,
#download_inflections_xlsx:hover,
#download_synonyms_xlsx,
#download_synonyms_xlsx:hover {
    text-decoration: none !important;
}

/* Compare corpora */
.section-card .muted.compare-corpora-intro {
    margin-bottom: 16px;
}

.compare-corpora-controls .shiny-input-container {
    margin-bottom: 12px;
}

.compare-corpora-corpus-group .shiny-options-group {
    margin-top: 8px;
}

.compare-corpora-corpus-group .control-label {
    margin-bottom: 8px;
    display: block;
}

.compare-corpora-controls .form-group:last-child,
.compare-corpora-controls .shiny-input-container:last-child {
    margin-bottom: 0;
}

/* Cross corpus */
.cross-dataset-name-input input::placeholder {
    color: #9ca3af;
    opacity: 1;
}

.cross-dataset-name-input input:focus::placeholder {
    color: transparent;
    opacity: 0;
}

#download_cross_xlsx {
    width: 100% !important;
    height: 46px !important;
    border-radius: 7px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    line-height: 1 !important;
    white-space: nowrap !important;
    text-align: center !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 12px !important;
    transition: all 0.2s ease;
    background: white !important;
    border: 1.4px solid #111111 !important;
    color: #111111 !important;
    text-decoration: none !important;
}

#download_cross_xlsx:hover {
    background: #111111 !important;
    color: white !important;
    border-color: #111111 !important;
    text-decoration: none !important;
}

.cross-resources-note {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 12px;
    margin-bottom: 14px;
    background: #f4f0ff;
    border: 1px solid #d8c8ff;
    border-left: 5px solid #7c3aed;
    border-radius: 12px;
}

.cross-resources-text {
    font-size: 16px;
    line-height: 1.5;
    color: #3b256f;
}

.cross-resources-heading {
    margin-bottom: 4px;
    font-weight: 800;
}

.cross-resources-line {
    margin-bottom: 3px;
}

.cross-resources-line:last-child {
    margin-bottom: 0;
}

.cross-resources-text a {
    color: #4c1d95;
    font-weight: 600;
    text-decoration: none;
}

.cross-resources-text a:hover {
    text-decoration: underline;
}

.cross-resources-close {
    min-width: 28px !important;
    width: 28px !important;
    height: 28px !important;
    padding: 0 !important;
    border-radius: 999px !important;
    border: 1px solid #d1d5db !important;
    background: #ffffff !important;
    color: #6b7280 !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    margin: 0 !important;
    box-shadow: none !important;
}

.cross-resources-close:hover {
    background: #f3f4f6 !important;
    color: #111827 !important;
    border-color: #9ca3af !important;
}

/* Shared language resource notes */
.language-resources-note {
    margin: 0 0 16px 0;
    padding: 12px 13px;
    background: #f4f0ff;
    border: 1px solid #d8c8ff;
    border-left: 5px solid #7c3aed;
    border-radius: 12px;
}

.language-resources-note-title {
    margin-bottom: 4px;
    font-size: 15px;
    line-height: 1.45;
    font-weight: 400;
    color: #3b256f;
}

.language-resources-note-line {
    font-size: 15px;
    line-height: 1.45;
    color: #3b256f;
}

.language-resources-note-line strong {
    font-weight: 800;
}

.language-resources-note a {
    color: #4c1d95;
    font-weight: 600;
    text-decoration: none;
}

.language-resources-note a:hover {
    text-decoration: underline;
}

/* Inflections */
.inflections-scale-note {
    margin: 0 0 16px 0;
    padding: 11px 13px;
    background: #f4f0ff;
    border: 1px solid #d8c8ff;
    border-left: 5px solid #7c3aed;
    border-radius: 12px;
    color: #3b256f;
    font-size: 15px;
    line-height: 1.45;
    font-weight: 650;
}

.inflections-source-controls {
    align-items: stretch !important;
}

.inflections-source-controls > div {
    display: flex;
}

.inflections-manual-entry,
.inflections-file-entry {
    margin: 14px 0 16px 0;
    padding: 16px;
    background: #ffffff;
    border: 1px solid #ebe3da;
    border-radius: 14px;
    box-sizing: border-box;
    min-height: 218px;
    height: 100%;
    width: 100%;
}

.inflections-manual-entry .shiny-input-container,
.inflections-file-entry .shiny-input-container {
    margin-bottom: 0 !important;
    width: 100%;
}

.inflections-manual-entry textarea,
.inflections-file-entry input {
    border: 1px solid #d1d5db !important;
    border-radius: 7px !important;
    box-shadow: none !important;
}

.inflections-manual-entry textarea:focus,
.inflections-file-entry input:focus {
    border-color: #7c3aed !important;
    box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.22) !important;
}

.inflections-file-hint {
    margin-top: 10px;
    margin-bottom: 0 !important;
    font-size: 14px;
    line-height: 1.45;
}

.inflections-alternative-note {
    margin: 10px 0 12px 0;
    padding: 12px 13px;
    background: #f4f0ff;
    border: 1px solid #d8c8ff;
    border-left: 5px solid #7c3aed;
    border-radius: 12px;
    color: #3b256f;
    font-size: 15px;
    line-height: 1.45;
}

.inflections-alternative-note a {
    color: #4c1d95;
    font-weight: 700;
    text-decoration: none;
}

.inflections-alternative-note a:hover {
    text-decoration: underline;
}

.inflections-datamuse-controls {
    display: flex;
    align-items: flex-end;
    gap: 14px;
    width: fit-content;
    max-width: 100%;
    margin: 0 0 16px 0;
    padding: 16px;
    background: #ffffff;
    border: 1px solid #ebe3da;
    border-radius: 14px;
}

.inflections-datamuse-controls .shiny-input-container {
    width: 280px !important;
    margin-bottom: 0 !important;
}

.inflections-datamuse-controls input::placeholder,
.inflections-manual-entry textarea::placeholder {
    color: #9ca3af;
    opacity: 1;
}

.inflections-datamuse-controls input:focus::placeholder,
.inflections-manual-entry textarea:focus::placeholder {
    color: transparent;
    opacity: 0;
}

#infl_generate {
    width: 260px !important;
    height: 38px !important;
    margin: 0 !important;
    border-radius: 7px !important;
    border: 1.4px solid #111111 !important;
    background: white !important;
    color: #111111 !important;
    font-size: 14px !important;
    font-weight: 600 !important;
}

#infl_generate:hover {
    background: #111111 !important;
    color: white !important;
    border-color: #111111 !important;
}

.inflections-candidate-list {
    margin: 14px 0 12px 0;
    padding: 14px 16px;
    background: #fbfaf8;
    border: 1px solid #ebe3da;
    border-radius: 14px;
}

.inflections-candidate-list .control-label {
    display: block;
    margin-bottom: 10px;
    font-weight: 750;
    color: #1f2933;
}

.inflections-candidate-list .shiny-options-group {
    column-count: 2;
    column-gap: 28px;
}

.inflections-candidate-list .form-check {
    break-inside: avoid;
    margin-bottom: 8px;
}

.inflections-selection-actions {
    margin-bottom: 4px;
}

#infl_select_all,
#infl_select_none {
    width: 100% !important;
    height: 38px !important;
    border-radius: 7px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
}

#infl_fetch {
    width: 100% !important;
    height: 46px !important;
    border-radius: 7px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    line-height: 1 !important;
    white-space: nowrap !important;
    text-align: center !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 12px !important;
    transition: all 0.2s ease;
}

#download_inflections_xlsx {
    margin: 0 0 16px 0;
}

.inflections-plot-container {
    width: calc(100% + 48px);
    max-width: none;
    margin-left: -24px;
    margin-right: -24px;
    overflow-x: auto;
    overflow-y: visible;
    padding: 12px 0 4px 0;
}

.inflections-plot-container .html-widget,
.inflections-plot-container .shiny-ipywidget-output,
.inflections-plot-container .html-fill-item,
.inflections-plot-container .html-fill-container,
.inflections-plot-container .plotly,
.inflections-plot-container .js-plotly-plot,
.inflections-plot-container .plot-container,
.inflections-plot-container .svg-container {
    display: block !important;
    width: 100% !important;
    min-width: 100% !important;
    max-width: none !important;
}

.inflections-plot-container .main-svg {
    width: 100% !important;
}

@media (max-width: 700px) {
    .inflections-candidate-list .shiny-options-group {
        column-count: 1;
    }

    .inflections-datamuse-controls {
        width: 100%;
        display: block;
    }

    .inflections-datamuse-controls .shiny-input-container {
        width: 100% !important;
        margin-bottom: 12px !important;
    }

    #infl_generate {
        width: 100% !important;
    }
}

/* Synonyms */
.synonyms-scale-note {
    margin: 0 0 16px 0;
    padding: 11px 13px;
    background: #f4f0ff;
    border: 1px solid #d8c8ff;
    border-left: 5px solid #7c3aed;
    border-radius: 12px;
    color: #3b256f;
    font-size: 15px;
    line-height: 1.45;
    font-weight: 650;
}

.synonyms-source-controls {
    align-items: stretch !important;
}

.synonyms-source-controls > div {
    display: flex;
}

.synonyms-manual-entry,
.synonyms-file-entry {
    margin: 14px 0 16px 0;
    padding: 16px;
    background: #ffffff;
    border: 1px solid #ebe3da;
    border-radius: 14px;
    box-sizing: border-box;
    min-height: 218px;
    height: 100%;
    width: 100%;
}

.synonyms-manual-entry .shiny-input-container,
.synonyms-file-entry .shiny-input-container {
    margin-bottom: 0 !important;
    width: 100%;
}

.synonyms-manual-entry textarea,
.synonyms-file-entry input {
    border: 1px solid #d1d5db !important;
    border-radius: 7px !important;
    box-shadow: none !important;
}

.synonyms-manual-entry textarea:focus,
.synonyms-file-entry input:focus {
    border-color: #7c3aed !important;
    box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.22) !important;
}

.synonyms-file-hint {
    margin-top: 10px;
    margin-bottom: 0 !important;
    font-size: 14px;
    line-height: 1.45;
}

.synonyms-alternative-note {
    margin: 10px 0 12px 0;
    padding: 12px 13px;
    background: #f4f0ff;
    border: 1px solid #d8c8ff;
    border-left: 5px solid #7c3aed;
    border-radius: 12px;
    color: #3b256f;
    font-size: 15px;
    line-height: 1.45;
}

.synonyms-alternative-note a {
    color: #4c1d95;
    font-weight: 700;
    text-decoration: none;
}

.synonyms-alternative-note a:hover {
    text-decoration: underline;
}

.synonyms-datamuse-controls {
    display: flex;
    align-items: flex-end;
    gap: 14px;
    width: fit-content;
    max-width: 100%;
    margin: 0 0 16px 0;
    padding: 16px;
    background: #ffffff;
    border: 1px solid #ebe3da;
    border-radius: 14px;
}

.synonyms-datamuse-controls .shiny-input-container {
    width: 280px !important;
    margin-bottom: 0 !important;
}

.synonyms-datamuse-controls input::placeholder,
.synonyms-manual-entry textarea::placeholder {
    color: #9ca3af;
    opacity: 1;
}

.synonyms-datamuse-controls input:focus::placeholder,
.synonyms-manual-entry textarea:focus::placeholder {
    color: transparent;
    opacity: 0;
}

#syn_find {
    width: 260px !important;
    height: 38px !important;
    margin: 0 !important;
    border-radius: 7px !important;
    border: 1.4px solid #111111 !important;
    background: white !important;
    color: #111111 !important;
    font-size: 14px !important;
    font-weight: 600 !important;
}

#syn_find:hover {
    background: #111111 !important;
    color: white !important;
    border-color: #111111 !important;
}

.synonyms-candidate-list {
    margin: 14px 0 12px 0;
    padding: 14px 16px;
    background: #fbfaf8;
    border: 1px solid #ebe3da;
    border-radius: 14px;
}

.synonyms-candidate-list .control-label {
    display: block;
    margin-bottom: 10px;
    font-weight: 750;
    color: #1f2933;
}

.synonyms-candidate-list .shiny-options-group {
    column-count: 2;
    column-gap: 28px;
}

.synonyms-candidate-list .form-check {
    break-inside: avoid;
    margin-bottom: 8px;
}

.synonyms-selection-actions {
    margin-bottom: 4px;
}

#syn_select_all,
#syn_select_none {
    width: 100% !important;
    height: 38px !important;
    border-radius: 7px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
}

#syn_fetch {
    width: 100% !important;
    height: 46px !important;
    border-radius: 7px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    line-height: 1 !important;
    white-space: nowrap !important;
    text-align: center !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 12px !important;
    transition: all 0.2s ease;
}

#download_synonyms_xlsx {
    margin: 0 0 16px 0;
}

.synonyms-plot-container {
    width: calc(100% + 48px);
    max-width: none;
    margin-left: -24px;
    margin-right: -24px;
    overflow-x: auto;
    overflow-y: visible;
    padding: 12px 0 4px 0;
}

.synonyms-plot-container .html-widget,
.synonyms-plot-container .shiny-ipywidget-output,
.synonyms-plot-container .html-fill-item,
.synonyms-plot-container .html-fill-container,
.synonyms-plot-container .plotly,
.synonyms-plot-container .js-plotly-plot,
.synonyms-plot-container .plot-container,
.synonyms-plot-container .svg-container {
    display: block !important;
    width: 100% !important;
    min-width: 100% !important;
    max-width: none !important;
}

.synonyms-plot-container .main-svg {
    width: 100% !important;
}

@media (max-width: 700px) {
    .synonyms-candidate-list .shiny-options-group {
        column-count: 1;
    }

    .synonyms-datamuse-controls {
        width: 100%;
        display: block;
    }

    .synonyms-datamuse-controls .shiny-input-container {
        width: 100% !important;
        margin-bottom: 12px !important;
    }

    #syn_find {
        width: 100% !important;
    }
}

@media (max-width: 1080px) {
    body:not(.mobile-nav-open) #main_navigation.route-nav.nav.nav-tabs {
        display: none !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }

    body.mobile-nav-open #main_navigation.route-nav.nav.nav-tabs {
        display: flex !important;
        visibility: visible !important;
        pointer-events: auto !important;
    }
}
