* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scrollbar-gutter: stable;
}

hr {
    border: none;
    background-color: rgb(188, 188, 188);
    height: 1px;
}

body {
    font-family: 'Open Sans', sans-serif;
    background-color: #f0ede8;
    background-image: radial-gradient(circle, #c8c2ba 1px, transparent 1px);
    background-size: 22px 22px;
    padding: 40px 48px;
    min-height: 100vh;
}

#page-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 32px;
    position: relative;
}
#page-header::before, #page-header::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, transparent, #c8c0b6);
    margin: 0 16px;
}
#page-header::after {
    background: linear-gradient(to left, transparent, #c8c0b6);
}
h1 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #4a4540;
    margin: 0;
    white-space: nowrap;
}

#paper-title-bar {
    text-align: center;
    margin-bottom: 28px;
    padding: 20px 0 18px;
}
.paper-title-main {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: #3a3430;
    letter-spacing: -0.01em;
    line-height: 1.3;
    margin-bottom: 6px;
}
.paper-title-sub {
    display: block;
    font-size: 18px;
    font-weight: 700;
    color: #6a6058;
    line-height: 1.6;
}
.paper-title-divider {
    width: 40px;
    height: 2px;
    background: linear-gradient(to right, #c8b49a, #a09080);
    border-radius: 2px;
    margin: 14px auto 0;
}
#desc-toggle-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    font-weight: 600;
    color: #9a8e80;
    background: #f0ece7;
    border: 1px solid #ddd8d0;
    border-radius: 8px;
    padding: 4px 12px;
    cursor: pointer;
    letter-spacing: 0.02em;
    white-space: nowrap;
    transition: color 0.12s, border-color 0.12s, background 0.12s;
}
#desc-toggle-btn:hover { color: #5a5248; border-color: #aaa49e; background: #ebe6e0; }
#desc-toggle-btn .desc-chevron {
    display: inline-block;
    vertical-align: middle;
    transition: transform 0.18s;
}
#desc-toggle-btn.open .desc-chevron { transform: rotate(180deg); }

#header-left {
    position: absolute;
    left: 10px;
    display: flex;
    gap: 8px;
}

#tasks-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    font-weight: 600;
    color: #9a8e80;
    background: none;
    border: 1px solid #ccc9c3;
    border-radius: 5px;
    padding: 3px 10px;
    cursor: pointer;
    letter-spacing: 0.02em;
    transition: color 0.12s, border-color 0.12s;
}
#tasks-btn:hover { color: #5a5248; border-color: #aaa49e; }

#tasks-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 200;
    align-items: center;
    justify-content: center;
}
#tasks-modal-overlay.visible { display: flex; }
#tasks-modal {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.18);
    padding: 32px 36px;
    max-width: 780px;
    width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
}
#tasks-modal-header {
    position: relative;
    margin-bottom: 24px;
}
#tasks-modal-header h2 {
    font-size: 16px;
    font-weight: 700;
    color: #3a3430;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
#tasks-modal-close {
    position: absolute;
    top: 0;
    right: 0;
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: #aaa;
    line-height: 1;
}
#tasks-modal-close:hover { color: #555; }
.tasks-section-heading {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #b0a898;
    margin: 20px 0 10px;
}
.dataset-info-card {
    background: #f8f7f5;
    border: 1px solid #e8e4de;
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 10px;
}
.dataset-desc {
    font-size: 14px;
    color: #4a4540;
    line-height: 1.6;
    margin-bottom: 12px;
}
.dataset-columns {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}
.dataset-col-tag {
    font-size: 12px;
    background: #eee9e2;
    color: #6a6058;
    border-radius: 4px;
    padding: 2px 8px;
    font-weight: 500;
}
.dataset-example-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    color: #5a5048;
    margin-bottom: 12px;
}
.dataset-example-table th {
    text-align: left;
    font-weight: 600;
    color: #9a8e80;
    padding: 4px 8px;
    border-bottom: 1px solid #e0dbd4;
    white-space: nowrap;
}
.dataset-example-table td {
    padding: 4px 8px;
    border-bottom: 1px solid #f0ede8;
    white-space: nowrap;
}
.dataset-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 600;
    color: #7a8ea8;
    text-decoration: none;
    letter-spacing: 0.02em;
}
.dataset-link:hover { color: #4a6888; text-decoration: underline; }
.tasks-dataset {
    margin-bottom: 28px;
}
.tasks-dataset:last-child { margin-bottom: 0; }
.tasks-dataset-label {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #8a8078;
    margin-bottom: 12px;
}
.tasks-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.task-card {
    display: flex;
    gap: 14px;
    background: #f8f7f5;
    border: 1px solid #e8e4de;
    border-radius: 8px;
    padding: 14px 16px;
}
.task-num {
    font-size: 15px;
    font-weight: 700;
    color: #b0a498;
    flex-shrink: 0;
    padding-top: 1px;
    letter-spacing: 0.04em;
}
.task-desc {
    font-size: 14px;
    color: #4a4540;
    line-height: 1.65;
    white-space: pre-line;
}

#app-description {
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.62);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.85);
    border-bottom-color: rgba(200, 193, 182, 0.5);
    border-right-color: rgba(200, 193, 182, 0.5);
    border-radius: 12px;
    font-size: 14px;
    color: #4a4540;
    line-height: 1.65;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06), inset 0 1px 0 rgba(255,255,255,0.9);
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    padding: 0 24px;
    margin-bottom: 0;
    transition: max-height 0.38s ease, opacity 0.28s ease, padding 0.38s ease, margin-bottom 0.38s ease;
}
#app-description.open {
    max-height: 600px;
    opacity: 1;
    padding: 24px 32px 20px;
    margin-bottom: 28px;
}
.desc-sections-row {
    display: flex;
    gap: 32px;
    margin-bottom: 16px;
}
#app-description .desc-section {
    flex: 1;
}
.desc-footer {
    margin-top: 12px;
}
#app-description .desc-section + .desc-section {
    border-left: 1px solid rgba(200, 193, 182, 0.45);
    padding-left: 36px;
}
#app-description .desc-heading {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #9a8e80;
    margin-bottom: 10px;
}
#app-description ul {
    margin: 0;
    padding-left: 18px;
}
#app-description li {
    margin-bottom: 6px;
}
#app-description .tag-inl {
    display: inline-block;
    font-size: 14px;
    padding: 1px 6px;
    border-radius: 3px;
    font-weight: 500;
    vertical-align: middle;
    line-height: 1.6;
}
#app-description .tag-inl.fatal {
    background-color: #ffe0e0;
    color: #934e4e;
    border: 0.5px solid #d85a5a;
}
#app-description .tag-inl.minor {
    background-color: #efefef;
    color: #4e4e4e;
    border: 0.5px solid #c6c6c6;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    margin-bottom: 16px;
    align-items: start;
}

.category {
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #d8d3cc;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08), 0 0 0 1px rgba(255,255,255,0.6);
    height: fit-content;
    --category-accent: #000000;
}

.category-human {
    width: 100%;
}

.category-header {
    padding: 11px 14px;
    font-weight: 700;
    font-size: 15px;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.category-icon {
    font-size: 17px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    background: #fff;
    border-radius: 50%;
    color: #444;
}

.category-items {
    padding: 0;
}

.subcategory-group {
    display: flex;
    flex-direction: column;
}

.subcategory-group:last-child {
    border-bottom: none;
}

.subcategory-label {
    font-size: 12px;
    font-weight: 700;
    color: #494949;
    background: #f6f6f6;
    letter-spacing: 0.3px;
    padding: 8px 14px 6px 14px;
    text-transform: uppercase;
}

.subcategory-items {
    min-width: 0;
}

.code-item {
    padding: 9px 14px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
    line-height: 1.4;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    cursor: pointer;
    transition: background 0.12s;
    background: #fff;
}
.code-item-left {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}
.code-item-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
#panel-desc {
    font-size: 13px;
    color: #888;
    line-height: 1.5;
    margin-top: 6px;
    font-style: italic;
}

.code-item:hover { background: #f0efed; }
.code-item.active { background: #eef4ff; }
.code-item:last-child { border-bottom: none; }

.code-text {
    flex: 1;
    min-width: 0;
    text-transform: capitalize;
}

.code-tags {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    flex-shrink: 0;
    justify-content: flex-end;
}

.tag {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    width: 4.8rem;
    text-align: center;
}

.tag-fatal-issue {
    background-color: #ffe0e0;
    color: #934e4e;
    border: 0.5px solid #d85a5a;
}

.tag-minor-issue {
    background-color: #efefef;
    color: #4e4e4e;
    border: 0.5px solid #c6c6c6;
}

.instance-count {
    font-size: 13px;
    color: #999;
    flex-shrink: 0;
    min-width: 18px;
    text-align: right;
}


#side-panel {
    position: fixed;
    top: 0;
    right: -480px;
    width: 460px;
    height: 100vh;
    background: #fff;
    box-shadow: -4px 0 20px rgba(0,0,0,0.12);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: right 0.25s ease;
}

#side-panel.open { right: 0; }

#panel-header {
    padding: 20px 20px 16px 24px;
    border-bottom: 1px solid #eee;
    border-left: 4px solid #ccc;
    position: relative;
}

#panel-title {
    flex: 1;
    font-size: 17px;
    font-weight: 700;
    color: #222;
    text-transform: capitalize;
    line-height: 1.4;
}

#panel-count {
    font-size: 14px;
    color: #888;
    margin-top: 3px;
}

#panel-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #888;
    line-height: 1;
    padding: 0;
    position: absolute;
    top: 16px;
    right: 16px;
}

#panel-close:hover { color: #333; }

#panel-filter {
    display: none;
    padding: 10px 16px;
    border-bottom: 1px solid #eee;
    background: #fafafa;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
#panel-legend {
    border-bottom: 1px solid #eee;
    background: #fafafa;
}
#panel-legend-label {
    font-size: 12px;
    font-weight: 700;
    color: #c0b8b0;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    flex-shrink: 0;
}
#panel-legend-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 20px;
}
#panel-legend-items {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #888;
}
.panel-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.panel-legend-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 19px;
    height: 19px;
    border-radius: 50%;
    flex-shrink: 0;
}
.panel-legend-divider {
    width: 1px;
    height: 14px;
    background: #e0dbd4;
    display: inline-block;
}
#panel-filter.visible { display: flex; }
#panel-filter .filter-label {
    font-size: 11px;
    font-weight: 700;
    color: #aaa;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    margin-right: 2px;
}
.level-filter-btn {
    padding: 4px 13px;
    border-radius: 20px;
    border: 1.5px solid #c2cfe0;
    background: transparent;
    color: #6080aa;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
    letter-spacing: 0.04em;
}
.level-filter-btn:hover { background: #eaf0f8; border-color: #a0b8d8; }
.level-filter-btn.active {
    background: #1e5ca9;
    border-color: #1e5ca9;
    color: #fff;
}

#panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}

.instance-row { border-bottom: 1px solid #f0f0f0; }
.instance-row:last-child { border-bottom: none; }


.instance-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 20px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    transition: background 0.1s;
}

.instance-summary:hover { background: #f8f8f8; }
.instance-summary.active { background: #f0f5ff; }

.instance-participant {
    font-weight: 600;
    color: #444;
    min-width: 60px;
}

.instance-meta { color: #888; font-size: 14px; display: flex; align-items: center; gap: 5px; }
.dataset-icon {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    color: #aaa;
}
.dataset-icon svg { display: block; }

.instance-codes {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
}

.instance-code-tag {
    font-size: 14px;
    color: #888;
    background: #f0f0f0;
    border-radius: 3px;
    padding: 1px 5px;
    font-style: italic;
    white-space: nowrap;
}

.turn-badge {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.turn-badge.reply  { background: #dae4ee; color: #4a6888; }
.turn-badge.prompt { background: #ddd8ce; color: #7a6858; }
.turn-badge svg { display: block; }

.detail-loading { font-size: 14px; color: #aaa; padding: 20px 0; }

.detail-text {
    font-size: 14px;
    color: #333;
    line-height: 1.65;
}

.detail-images {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.detail-images img {
    max-width: 100%;
    max-height: 360px;
    object-fit: contain;
    object-position: left top;
    border-radius: 6px;
    border: 1px solid #eee;
    display: block;
}


#detail-modal {
    position: fixed;
    top: 7vh;
    right: 470px;
    transform: translateY(10px) scale(0.97);
    transition: transform 0.2s ease, opacity 0.18s ease;
    opacity: 0;
    pointer-events: none;

    width: clamp(420px, 55vw, calc(100vw - 510px));
    height: 86vh;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 36px rgba(0,0,0,0.16);
    z-index: 101;
    display: flex;
    flex-direction: column;
}

#detail-modal.open {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: auto;
}

#modal-header {
    padding: 18px 24px 16px;
    border-bottom: 1px solid #eee;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

#modal-meta {
    display: flex;
    align-items: center;
    gap: 10px;
}

#modal-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
}

#modal-participant {
    font-weight: 700;
    font-size: 17px;
    color: #222;
}

#modal-info {
    font-size: 16px;
    color: #555;
    display: flex;
    align-items: center;
    gap: 5px;
}

#task-strip {
    flex-shrink: 0;
    border-bottom: 1px solid #e8e8e8;
    background: #f9f7f4;
    font-size: 14px;
    color: #555;
    line-height: 1.6;
    display: none;
}
#task-strip.visible { display: block; }
#task-strip-dataset {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #888;
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    user-select: none;
    padding: 8px 24px;
}
#task-strip-body {
    padding: 0 24px 14px;
    color: #333;
}
#task-strip-body.collapsed { display: none; }

#ai-compare-links {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
#ai-compare-label {
    font-size: 14px;
    font-weight: 500;
    color: #b0a898;
    letter-spacing: 0.01em;
    margin-right: 2px;
}
.info-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    font-size: 16px;
    color: #bbb;
    cursor: default;
    line-height: 1;
}
.info-icon:hover { color: #888; }
.info-tooltip {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    width: 260px;
    background: #333;
    color: #fff;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.5;
    padding: 8px 11px;
    border-radius: 7px;
    white-space: normal;
    pointer-events: none;
    z-index: 9999;
}
.info-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    right: 6px;
    border: 5px solid transparent;
    border-top-color: #333;
}
.info-icon:hover .info-tooltip { display: block; }
.compare-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    text-decoration: none;
    transition: opacity 0.15s;
    letter-spacing: 0.02em;
}
.compare-link:hover { opacity: 0.75; }
.compare-claude {
    background: #f5ede8;
    color: #a0522d;
    border: 1px solid #e8d0c0;
}
.compare-gemini {
    background: #e8eef8;
    color: #3a5a9a;
    border: 1px solid #c8d8f0;
}
#task-strip-dataset:hover { color: #5a5248; }

#modal-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #aaa;
    line-height: 1;
    padding: 0 2px;
}

#modal-close:hover { color: #333; }

#modal-scroll-area {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}
#modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 0 0;
}
#chat-minimap {
    width: 72px;
    flex-shrink: 0;
    position: relative;
    background: #f5f4f1;
    border-left: 1px solid #ece9e3;
    cursor: grab;
    clip-path: inset(0);   
}
#chat-minimap-inner {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: top left;
    pointer-events: none;
    user-select: none;
    overflow: visible;
}
#chat-minimap-inner * { pointer-events: none !important; }
#chat-minimap-viewport {
    position: absolute;
    left: 0; right: 0;
    background: rgba(100,120,160,0.12);
    border-top: 1.5px solid rgba(80,100,150,0.35);
    border-bottom: 1.5px solid rgba(80,100,150,0.35);
    pointer-events: none;
}

.detail-html ul, .detail-html ol { padding-left: 20px; margin: 6px 0; }
.detail-html li { margin: 3px 0; line-height: 1.5; }
.detail-html li > p { margin: 0; }
.detail-html p  { margin: 6px 0; }
.detail-html code { background: #f0f0f0; padding: 1px 4px; border-radius: 3px; font-size: 13px; }
.detail-html pre  { background: #f0f0f0; padding: 8px; border-radius: 4px; overflow-x: auto; font-size: 13px; margin: 6px 0; white-space: pre-wrap; }
.detail-html strong { font-weight: 600; }
.detail-html h1, .detail-html h2, .detail-html h3 { font-size: 14px; font-weight: 600; margin: 10px 0 4px; }

.detail-unavailable {
    font-size: 14px;
    color: #bbb;
    font-style: italic;
    padding: 20px 24px;
}

.chat-turn {
    padding: 4px 20px;
    border-bottom: none;
    display: flex;
    flex-direction: column;
}
.chat-turn + .chat-turn { margin-top: 8px; }
.chat-turn:last-child { margin-bottom: 16px; }

.chat-turn.prompt { align-items: flex-end; }
.chat-turn.reply  { align-items: flex-start; }

.chat-bubble {
    max-width: 78%;
    padding: 12px 16px;
    border-radius: 14px;
    line-height: 1.55;
}
.chat-turn.prompt .chat-bubble {
    background: #f6f6f6;
    border-bottom-right-radius: 4px;
}
.chat-turn.reply .chat-bubble {
    background: #ffffff;
    border: 1px solid #e8e5e0;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.chat-turn-header {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 9px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.chat-turn.prompt .chat-turn-header { color: #7a6e62; }
.chat-turn.reply  .chat-turn-header { color: #8898a8; }

.chat-avatar {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.chat-turn.prompt .chat-avatar { background: #ddd8ce; color: #7a6858; }
.chat-turn.reply  .chat-avatar { background: #dae4ee; color: #4a6888; }
.chat-avatar svg { display: block; }

.chat-turn.highlighted {
    padding: 0 16px 6px;
}
.chat-turn.highlighted .chat-bubble {
    border: 1px solid #e0d494;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.chat-annotated-banner-top {
    margin: -12px -16px 12px -16px;
    padding: 6px 16px;
    border-radius: 14px 14px 0 0;
    background: #f8f4e3;
    color: #7a6030;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(190,160,80,0.3);
}
.chat-turn.highlighted.prompt .chat-annotated-banner-top { border-radius: 10px 10px 0 0; }
.chat-turn.highlighted.reply  .chat-annotated-banner-top { border-radius: 10px 10px 0 0; }
.chat-annotated-banner-bottom {
    margin: 10px -16px -12px -16px;
    padding: 7px 16px;
    border-top: 1px solid rgba(190,160,80,0.3);
    border-radius: 0 0 14px 14px;
    background: #f8f4e3;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}
.chat-turn.highlighted.prompt .chat-annotated-banner-bottom { border-radius: 0 0 4px 14px; }
.chat-turn.highlighted.reply  .chat-annotated-banner-bottom { border-radius: 0 0 14px 4px; }

.chat-code-tag {
    font-size: 12px;
    font-weight: 600;
    padding: 2px 9px;
    border-radius: 5px;
    letter-spacing: 0;
    text-transform: none;
    cursor: default;
    white-space: nowrap;
    opacity: 0.88;
    position: relative;
}
.chip-tooltip-float {
    position: fixed;
    width: 230px;
    background: #edeae4;
    color: #333;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.5;
    padding: 9px 12px;
    border-radius: 8px;
    border: 1px solid #d4d0c8;
    box-shadow: 0 4px 14px rgba(0,0,0,0.12);
    white-space: normal;
    word-break: break-word;
    pointer-events: none;
    z-index: 99999;
}
.chip-tooltip-cat {
    display: block;
    font-size: 13px;
    font-weight: 700;
    font-style: normal;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 5px;
}
.chat-code-tag:hover { opacity: 1; }

.chat-turn.context {
    opacity: 1;
}

.chat-turn-annot-strip {
    margin: 10px -16px -12px -16px;
    padding: 7px 16px;
    border-top: 1px solid rgba(0,0,0,0.07);
    border-radius: 0 0 14px 14px;
    background: rgba(0,0,0,0.03);
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}
.chat-turn.prompt .chat-turn-annot-strip { border-radius: 0 0 4px 14px; }
.chat-turn.reply  .chat-turn-annot-strip { border-radius: 0 0 14px 4px; }

.chat-annotated-badge {
    display: none;
}


#overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.15);
    z-index: 99;
}

#overlay.visible { display: block; }

@media print {
    body { padding: 10px; }
    h1 { margin-bottom: 10px; font-size: 16px; }
    .categories-grid { gap: 10px; }
    #side-panel, #overlay { display: none !important; }
}

/* ── Tablet ─────────────────────────────── */
@media (max-width: 900px) {
    #header-left { display: none; }
    #tasks-btn   { display: none; }
    #icon-legend { display: none !important; }

    .categories-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    /* Detail modal takes most of the screen when panel is closed */
    #detail-modal {
        right: 20px;
        left: 20px;
        width: auto;
    }
}

/* ── Mobile ──────────────────────────────── */
@media (max-width: 640px) {
    body {
        padding: 16px 14px;
    }

    .paper-title-main { font-size: 18px; }
    .paper-title-sub  { font-size: 14px; }

    h1 { font-size: 15px; }

    #desc-toggle-btn {
        font-size: 10px;
        padding: 3px 7px;
    }

    #app-description {
        flex-direction: column;
        gap: 14px;
    }
    #app-description .desc-section + .desc-section {
        border-left: none;
        border-top: 1px solid #e4e0da;
        padding-left: 0;
        padding-top: 12px;
    }

    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    #side-panel {
        width: 100%;
        right: -100%;
    }

    /* Modal slides up full screen */
    #detail-modal {
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
        transform: translateY(100%);
        transition: transform 0.25s ease, opacity 0.2s ease;
    }
    #detail-modal.open {
        transform: translateY(0);
        opacity: 1;
    }

    /* Simplify modal header — switch to flex, hide compare & scenario btn */
    #modal-header {
        display: flex;
        padding: 14px 16px;
    }
    #modal-meta { flex: 1; }
    #ai-compare-links { display: none; }

    #modal-header-right { gap: 4px; }

    .chat-bubble { max-width: 92%; }

    /* Tasks modal full width */
    #tasks-modal {
        width: 95vw;
        padding: 20px 18px;
        max-height: 90vh;
    }
}

/* ── Very small ──────────────────────────── */
@media (max-width: 380px) {
    .categories-grid {
        grid-template-columns: 1fr;
    }
}
