/* ==================================================
   DESIGN TOKENS
================================================== */

:root {
    --bg: #ffffff;
    --surface: #ffffff;
    --surface-secondary: #f7f7f5;
    --surface-hover: #efefed;

    --text: #37352f;
    --text-secondary: #787774;
    --text-tertiary: #9b9a97;

    --border: rgba(55, 53, 47, 0.12);
    --border-strong: rgba(55, 53, 47, 0.22);

    --positive: #448361;
    --positive-bg: #edf5ef;

    --negative: #c14c3c;
    --negative-bg: #faeceb;

    --shadow:
        0 1px 2px rgba(15, 15, 15, 0.04),
        0 4px 12px rgba(15, 15, 15, 0.04);

    --sidebar-width: 250px;
}


/* ==================================================
   DARK THEME
================================================== */

html[data-resolved-theme="dark"] {

    --bg: #191919;
    --surface: #202020;
    --surface-secondary: #252525;
    --surface-hover: #2c2c2c;

    --text: #e8e8e6;
    --text-secondary: #a5a5a2;
    --text-tertiary: #777774;

    --border: rgba(255, 255, 255, 0.09);
    --border-strong: rgba(255, 255, 255, 0.16);

    --positive: #6ba77f;
    --positive-bg: rgba(68, 131, 97, 0.15);

    --negative: #df7163;
    --negative-bg: rgba(193, 76, 60, 0.15);

    --shadow: none;
}


/* ==================================================
   RESET
================================================== */

* {
    box-sizing: border-box;
}

html {
    font-family:
        Inter,
        ui-sans-serif,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

body {
    margin: 0;

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

    transition:
        background 180ms ease,
        color 180ms ease;
}

button,
textarea {
    font: inherit;
}

button {
    color: inherit;
}


/* ==================================================
   APP
================================================== */

.app-shell {
    min-height: 100vh;
}

.sidebar {

    position: fixed;
    inset: 0 auto 0 0;

    width: var(--sidebar-width);

    padding: 14px 10px;

    background: var(--surface-secondary);

    border-right: 1px solid var(--border);

    display: flex;
    flex-direction: column;

    z-index: 50;
}

.main {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.content {
    width: min(820px, calc(100% - 48px));

    margin: 0 auto;

    padding:
        82px 0 50px;
}


/* ==================================================
   SIDEBAR
================================================== */

.brand {

    display: flex;
    align-items: center;

    gap: 10px;

    padding: 6px 8px 16px;
}

.brand-icon {

    width: 30px;
    height: 30px;

    border-radius: 7px;

    display: grid;
    place-items: center;

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

    font-weight: 700;
}

.brand strong {
    display: block;
    font-size: 14px;
}

.brand span {
    display: block;

    color: var(--text-secondary);

    font-size: 11px;

    margin-top: 2px;
}

.new-analysis {

    width: 100%;

    display: flex;
    align-items: center;

    gap: 8px;

    border: 0;
    border-radius: 6px;

    background: transparent;

    padding: 8px;

    cursor: pointer;

    text-align: left;

    font-weight: 500;
}

.new-analysis:hover,
.sidebar-item:hover {
    background: var(--surface-hover);
}

.sidebar-section {
    margin-top: 22px;
}

.sidebar-label {

    margin: 0 8px 8px;

    color: var(--text-tertiary);

    font-size: 10px;
    font-weight: 600;

    letter-spacing: 0.08em;
}

.history-list {

    display: flex;
    flex-direction: column;

    gap: 2px;
}

.history-empty {

    padding: 8px;

    color: var(--text-tertiary);

    font-size: 12px;
}

.history-item {

    width: 100%;

    border: 0;
    background: transparent;

    padding: 7px 8px;

    border-radius: 6px;

    display: flex;
    align-items: center;

    gap: 7px;

    cursor: pointer;

    color: var(--text-secondary);

    text-align: left;
}

.history-item:hover {
    background: var(--surface-hover);
}

.history-item span:last-child {

    overflow: hidden;

    white-space: nowrap;
    text-overflow: ellipsis;

    font-size: 12px;
}

.sidebar-bottom {

    margin-top: auto;

    display: flex;
    flex-direction: column;

    gap: 2px;
}

.sidebar-item {

    width: 100%;

    display: flex;
    align-items: center;

    gap: 9px;

    border: 0;
    background: transparent;

    border-radius: 6px;

    padding: 8px;

    text-decoration: none;

    cursor: pointer;

    font-size: 13px;

    color: var(--text-secondary);
}

.theme-control {

    display: grid;
    grid-template-columns: repeat(3, 1fr);

    margin-top: 8px;

    padding: 3px;

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

.theme-control button {

    border: 0;
    background: transparent;

    padding: 5px;

    border-radius: 5px;

    cursor: pointer;

    color: var(--text-secondary);
}

.theme-control button.active {

    background: var(--surface);

    box-shadow: var(--shadow);

    color: var(--text);
}


/* ==================================================
   HERO
================================================== */

.hero {
    margin-bottom: 36px;
}

.eyebrow {

    color: var(--text-tertiary);

    font-size: 10px;
    font-weight: 600;

    letter-spacing: 0.11em;
}

.hero h1 {

    margin:
        10px 0 10px;

    font-size: clamp(34px, 5vw, 48px);

    letter-spacing: -0.035em;

    line-height: 1.08;

    font-weight: 650;
}

.hero p {

    margin: 0;

    max-width: 620px;

    color: var(--text-secondary);

    font-size: 16px;

    line-height: 1.65;
}


/* ==================================================
   COMPOSER
================================================== */

.composer {

    border: 1px solid var(--border-strong);

    border-radius: 10px;

    background: var(--surface);

    box-shadow: var(--shadow);

    overflow: hidden;
}

textarea {

    display: block;

    width: 100%;
    min-height: 180px;

    padding: 20px;

    resize: vertical;

    border: 0;
    outline: 0;

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

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

textarea::placeholder {
    color: var(--text-tertiary);
}

.composer:focus-within {
    border-color: var(--text-secondary);
}

.composer-footer {

    min-height: 52px;

    padding: 8px 10px 8px 16px;

    border-top: 1px solid var(--border);

    display: flex;
    align-items: center;
    justify-content: space-between;
}

#characterCount {

    color: var(--text-tertiary);

    font-size: 11px;
}


/* ==================================================
   BUTTONS
================================================== */

.primary-button,
.secondary-button {

    border-radius: 6px;

    padding: 8px 12px;

    cursor: pointer;

    font-weight: 550;
}

.primary-button {

    border: 1px solid var(--text);

    background: var(--text);
    color: var(--bg);
}

.primary-button:disabled {
    opacity: 0.5;
    cursor: wait;
}

.secondary-button {

    border: 1px solid var(--border-strong);

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

.secondary-button:hover {
    background: var(--surface-hover);
}

kbd {

    margin-left: 8px;

    opacity: 0.6;

    font-family: inherit;
    font-size: 10px;
}


/* ==================================================
   SECTION
================================================== */

.examples-section,
.result-section {
    margin-top: 38px;
}

.section-heading {

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 15px;

    margin-bottom: 12px;
}

.section-heading h2 {

    margin: 0;

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


/* ==================================================
   EXAMPLES
================================================== */

.example-tabs {

    display: flex;

    gap: 2px;
}

.example-tab {

    border: 0;
    background: transparent;

    border-radius: 5px;

    padding: 5px 8px;

    cursor: pointer;

    color: var(--text-secondary);

    font-size: 11px;
}

.example-tab:hover,
.example-tab.active {

    background: var(--surface-secondary);

    color: var(--text);
}

.example-cards {

    display: grid;
    grid-template-columns: repeat(2, 1fr);

    gap: 8px;
}

.example-card {

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

    border-radius: 8px;

    padding: 13px;

    background: var(--surface);

    cursor: pointer;

    color: var(--text-secondary);

    text-align: left;

    line-height: 1.45;
}

.example-card:hover {

    background: var(--surface-secondary);

    border-color: var(--border-strong);
}


/* ==================================================
   RESULT
================================================== */

.result-card {

    padding: 22px;

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

    border-radius: 10px;

    background: var(--surface);
}

.prediction-header {

    display: flex;
    align-items: center;

    gap: 15px;

    padding-bottom: 22px;
}

.sentiment-icon {

    width: 46px;
    height: 46px;

    display: grid;
    place-items: center;

    border-radius: 9px;

    background: var(--surface-secondary);

    font-size: 23px;
}

.muted-label {

    color: var(--text-tertiary);

    font-size: 9px;
    font-weight: 650;

    letter-spacing: 0.1em;
}

.prediction-header h3 {

    margin: 3px 0;

    font-size: 24px;
}

.prediction-header p {

    margin: 0;

    color: var(--text-secondary);

    font-size: 13px;
}

.probability-section {

    padding:
        18px 0;

    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.probability-row+.probability-row {
    margin-top: 15px;
}

.probability-label {

    display: flex;
    justify-content: space-between;

    margin-bottom: 7px;

    font-size: 12px;
}

.progress-track {

    height: 6px;

    background: var(--surface-secondary);

    border-radius: 999px;

    overflow: hidden;
}

.progress-fill {

    width: 0;
    height: 100%;

    border-radius: inherit;

    transition: width 600ms ease;
}

.progress-fill.positive {
    background: var(--positive);
}

.progress-fill.negative {
    background: var(--negative);
}

.feedback {

    padding-top: 16px;

    display: flex;
    align-items: center;

    flex-wrap: wrap;

    gap: 7px;

    color: var(--text-secondary);

    font-size: 12px;
}

.feedback button {

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

    border-radius: 5px;

    padding: 4px 8px;

    background: transparent;

    cursor: pointer;

    color: var(--text-secondary);
}

.feedback button:hover {
    background: var(--surface-secondary);
}

.feedback-message {
    color: var(--text-tertiary);
}


/* ==================================================
   EXPLANATION
================================================== */

.explanation {

    margin-top: 10px;

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

    border-radius: 8px;

    overflow: hidden;
}

.explanation summary {

    padding: 13px 15px;

    cursor: pointer;

    font-size: 12px;

    color: var(--text-secondary);
}

.explanation-content {

    padding: 4px 16px 16px;

    border-top: 1px solid var(--border);
}

.explanation-block {

    padding: 14px 0;

    border-bottom: 1px solid var(--border);
}

.explanation-block p {

    margin: 6px 0 0;

    font-size: 13px;

    line-height: 1.55;
}

.token-list {

    display: flex;
    flex-wrap: wrap;

    gap: 5px;

    margin-top: 8px;
}

.token {

    padding: 4px 7px;

    border-radius: 5px;

    background: var(--surface-secondary);

    font-size: 11px;
}

.token small {

    color: var(--text-tertiary);

    margin-left: 4px;
}

.sequence-info {

    display: flex;
    justify-content: space-between;

    margin-top: 12px;

    color: var(--text-tertiary);

    font-size: 10px;
}


/* ==================================================
   CHALLENGE
================================================== */

.challenge-card {

    margin-top: 48px;

    padding: 22px;

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

    border-radius: 10px;

    background: var(--surface-secondary);

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 25px;
}

.challenge-card h2 {

    margin: 6px 0;

    font-size: 18px;
}

.challenge-card p {

    margin: 0;

    max-width: 500px;

    color: var(--text-secondary);

    line-height: 1.5;

    font-size: 13px;
}


/* ==================================================
   MODAL
================================================== */

.modal-backdrop {

    position: fixed;
    inset: 0;

    z-index: 100;

    display: grid;
    place-items: center;

    padding: 20px;

    background: rgba(0, 0, 0, 0.35);
}

.modal {

    width: min(540px, 100%);

    max-height: 85vh;

    overflow-y: auto;

    padding: 24px;

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

    border-radius: 12px;

    background: var(--surface);

    box-shadow:
        0 16px 48px rgba(0, 0, 0, 0.18);
}

.modal-header {

    display: flex;
    justify-content: space-between;

    gap: 20px;
}

.modal-header h2 {

    margin: 5px 0 20px;
}

.icon-button {

    border: 0;
    background: transparent;

    cursor: pointer;

    color: var(--text-secondary);

    font-size: 18px;
}

.model-grid {

    display: grid;
    grid-template-columns: repeat(2, 1fr);

    gap: 8px;
}

.model-grid div {

    padding: 12px;

    border-radius: 7px;

    background: var(--surface-secondary);
}

.model-grid span {

    display: block;

    color: var(--text-tertiary);

    font-size: 10px;

    margin-bottom: 4px;
}

.model-grid strong {
    font-size: 13px;
}

.architecture {

    margin: 24px 0;

    display: flex;
    flex-direction: column;
    align-items: center;

    gap: 6px;
}

.architecture div {

    width: 190px;

    padding: 8px;

    text-align: center;

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

    border-radius: 6px;

    font-size: 11px;
}

.architecture span {
    color: var(--text-tertiary);
}

.limitations {

    border-top: 1px solid var(--border);

    padding-top: 16px;
}

.limitations h3 {
    font-size: 13px;
}

.limitations li {

    margin: 7px 0;

    color: var(--text-secondary);

    font-size: 12px;

    line-height: 1.45;
}


/* ==================================================
   FOOTER
================================================== */

footer {

    margin-top: 48px;

    padding-top: 18px;

    border-top: 1px solid var(--border);

    display: flex;
    justify-content: space-between;

    gap: 15px;

    color: var(--text-tertiary);

    font-size: 10px;
}


/* ==================================================
   MOBILE
================================================== */

.mobile-header {
    display: none;
}

.hidden {
    display: none !important;
}


@media (max-width: 760px) {

    .sidebar {

        transform: translateX(-100%);

        transition: transform 180ms ease;

        box-shadow:
            10px 0 30px rgba(0, 0, 0, 0.12);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main {
        margin-left: 0;
    }

    .mobile-header {

        height: 50px;

        padding: 0 14px;

        display: flex;
        align-items: center;
        justify-content: space-between;

        border-bottom: 1px solid var(--border);

        background: var(--bg);

        position: sticky;
        top: 0;

        z-index: 40;
    }

    .content {

        width: min(100% - 30px, 820px);

        padding-top: 45px;
    }

    .example-cards {
        grid-template-columns: 1fr;
    }

    .section-heading {

        align-items: flex-start;
        flex-direction: column;
    }

    .example-tabs {

        max-width: 100%;

        overflow-x: auto;
    }

    .challenge-card {

        align-items: flex-start;
        flex-direction: column;
    }

    footer {
        flex-direction: column;
    }

}