body {
    font-family: Inter, Arial, sans-serif;
    background: linear-gradient(135deg, #dbe3f0, #e8edf5);
    color: #1f2937;
    margin: 0;
    padding: 48px 24px;
}


main {
    max-width: 1480px;
    margin: 0 auto;
}

.hero {
    margin-bottom: 28px;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 13px;
    font-weight: 700;
    color: #6366f1;
    margin-bottom: 8px;
}

.hero h1 {
    font-size: 56px;
    line-height: 1;
    margin: 0;
    letter-spacing: -0.04em;
}

.hero-text {
    max-width: 680px;
    font-size: 18px;
    line-height: 1.6;
    color: #4b5563;
    margin-top: 16px;
}

.workspace-grid {
    display: grid;
    grid-template-columns: minmax(180px, 0.68fr) minmax(430px, 1.5fr) minmax(260px, 0.82fr);
    gap: 20px;
    align-items: start;
}

.main-column {
    display: grid;
    gap: 20px;
    min-width: 0;
}

.left-column {
    display: grid;
    gap: 20px;
}

.right-column {
    display: grid;
    gap: 20px;
}

.panel {
    background: #ffffff;
    border: 1px solid #d6dce7;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.12);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    margin-bottom: 20px;
}

.panel-header.compact {
    margin-bottom: 12px;
}

.icon-action {
    align-self: flex-start;
    padding: 7px 10px;
    border: 1px solid #dbe3f0;
    border-radius: 8px;
    background: #f8fafc;
    color: #374151;
    font-size: 12px;
    font-weight: 800;
}

.icon-action:hover {
    background: #eef2ff;
    color: #4f46e5;
}

.panel-kicker {
    margin: 0 0 6px;
    color: #6366f1;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.panel h2 {
    margin: 0;
    font-size: 24px;
}

.protein-info {
    display: grid;
    gap: 14px;
}

.empty-state {
    margin: 0;
    color: #6b7280;
    font-size: 14px;
    line-height: 1.5;
}

.protein-match h3 {
    margin: 12px 0 16px;
    font-size: 17px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.match-badge {
    display: inline-flex;
    padding: 5px 9px;
    border-radius: 999px;
    background: #dcfce7;
    color: #166534;
    font-size: 12px;
    font-weight: 800;
}

.protein-match dl {
    display: grid;
    gap: 10px;
    margin: 0;
}

.protein-match dl div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding-top: 10px;
    border-top: 1px solid #e5e7eb;
}

.protein-match dt {
    color: #6b7280;
    font-size: 13px;
    font-weight: 700;
}

.protein-match dd {
    margin: 0;
    color: #111827;
    font-size: 13px;
    font-weight: 800;
    text-align: right;
}

.sequence-library {
    display: grid;
    gap: 12px;
}

.sequence-library h3 {
    margin: 0;
    font-size: 15px;
}

.sequence-list {
    display: grid;
    gap: 8px;
}

.structure-panel {
    overflow: hidden;
}

.structure-viewer {
    position: relative;
    contain: layout paint;
    width: 100%;
    aspect-ratio: 1 / 1;
    min-height: 220px;
    margin-bottom: 12px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #f8fafc;
}

.structure-viewer canvas,
.structure-viewer > div {
    display: block;
    position: absolute !important;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
}

.structure-panel.expanded {
    position: fixed;
    inset: 28px;
    z-index: 20;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    max-width: none;
    overflow: hidden;
}

.structure-panel.expanded .structure-viewer {
    aspect-ratio: auto;
    min-height: 0;
    height: 100%;
}

.structure-panel.expanded::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background: rgba(15, 23, 42, 0.34);
}

.sequence-preset {
    width: 100%;
    padding: 10px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #fafafa;
    color: #111827;
    text-align: left;
}

.sequence-preset:hover {
    background: #eef2ff;
}

.sequence-preset strong {
    display: block;
    font-size: 13px;
}

.sequence-preset span {
    display: block;
    margin-top: 4px;
    color: #6b7280;
    font-size: 12px;
    font-weight: 600;
}

.sequence-input-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.analysis-actions {
    display: grid;
    gap: 14px;
    margin-top: 20px;
}

.analysis-option {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 18px;
    align-items: start;
    padding: 16px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #fafafa;
}

.analysis-option h3 {
    margin: 0 0 6px;
    font-size: 17px;
}

.analysis-option p {
    margin: 0;
    color: #4b5563;
    font-size: 14px;
    line-height: 1.5;
}

.deep-analysis {
    background: #f8fafc;
}

label {
    display: block;
    margin-top: 0;
    font-weight: bold;
}

textarea {
    width: 100%;
    margin-top: 8px;
    padding: 12px;
    font-family: monospace;
    font-size: 16px;
    box-sizing: border-box;
}

button {
    margin-top: 0;
    padding: 12px 18px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    border-radius: 12px;
    background: #4f46e5;
    color: white;
}

.tool-drawer {
    border-top: 1px solid #e5e7eb;
    padding-top: 14px;
    margin-top: 14px;
}

.tool-drawer summary {
    cursor: pointer;
    color: #374151;
    font-size: 15px;
    font-weight: 700;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.tool-drawer summary::-webkit-details-marker {
    display: none;
}

.tool-drawer summary::after {
    content: "+";
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #eef2ff;
    color: #4f46e5;
}

.tool-drawer[open] summary::after {
    content: "-";
}

.tool-drawer[open] summary {
    margin-bottom: 16px;
}

.tool-drawer h3 {
    margin: 18px 0 0;
    font-size: 16px;
}

.tool-drawer label {
    margin-top: 0;
    color: #4b5563;
    font-size: 13px;
    font-weight: 600;
}

.insert-slot {
    width: 24px;
    height: 34px;
    border-radius: 8px;
    border: 1px dashed #9ca3af;
    background: #f9fafb;
    color: #6b7280;
    font-weight: bold;
    padding: 0;
    margin-top: 0;
}

.insert-slot:hover {
    background: #e0e7ff;
    border-color: #4f46e5;
    color: #4f46e5;
}

.insert-slot.selected-insert-slot {
    background: #4f46e5;
    border-color: #4f46e5;
    color: white;
}

.editable-residue:disabled {
    cursor: default;
    opacity: 1;
}

button:hover {
    background: #4338ca;
}

button:disabled {
    cursor: wait;
    opacity: 0.65;
}

.homolog-search {
    display: grid;
    gap: 10px;
    margin-bottom: 18px;
}

.homolog-search button {
    justify-self: start;
}

.tool-status {
    margin: 0;
    color: #4b5563;
    font-size: 14px;
    line-height: 1.5;
}

.tool-description {
    margin: 0;
    color: #4b5563;
    font-size: 14px;
    line-height: 1.5;
}

.tool-status.error {
    color: darkred;
    font-weight: 700;
}

.tool-status.success {
    color: #166534;
    font-weight: 700;
}

.tool-status.success::before {
    content: "✓";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-right: 6px;
    border-radius: 50%;
    background: #dcfce7;
    color: #166534;
    font-size: 12px;
}

.progress-bar {
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: #e5e7eb;
}

.progress-bar span {
    display: block;
    width: 42%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #818cf8, #4f46e5);
    animation: progress-slide 1.25s ease-in-out infinite;
}

@keyframes progress-slide {
    0% {
        transform: translateX(-110%);
    }

    100% {
        transform: translateX(260%);
    }
}

.editable-residue,
.amino-acid-block {
    margin-top: 0;
    padding: 0;
    color: #1f2937;
}
.mutation-modes {
    display: flex;
    gap: 10px;
    margin-top: 18px;
    margin-bottom: 18px;
}

.mutation-modes button {
    background: #e5e7eb;
    color: #111827;
}

.mutation-modes button:hover {
    background: #d1d5db;
}
.mutation-modes button.active-mode {
    background: #cb9763;
    color: white;
}


#results {
    min-width: 0;
    padding: 24px;
    border: 1px solid #d6dce7;
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.12);
}

li {
    margin-bottom: 20px;
}

.error {
    color: darkred;
    font-weight: bold;
}

.sequence-visualization {
    margin-top: 16px;
    margin-bottom: 28px;
    padding: 12px;
    background: #fafafa;
    border: 1px solid #ddd;
    border-radius: 10px;
    max-height: 150px;
    max-width: 100%;
    overflow: auto;
}

.sequence-row {
    display: flex;
    align-items: flex-start;
    margin-bottom: 8px;
    width: max-content;
    max-width: none;
}

.sequence-label {
    position: sticky;
    left: 0;
    z-index: 1;
    width: 42px;
    font-weight: bold;
    font-family: monospace;
    background: #fafafa;
}

.sequence-tiles {
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
}

.residue-tile {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    font-size: 13px;
    font-family: monospace;
    font-weight: bold;
    background: #e8e8e8;
    border-radius: 6px;
    border: 1px solid #ccc;
}

.residue-tile.changed {
    background: #ffd6a5;
    border-color: #cc7a00;
}

.conservation-heatmap {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 12px;
    margin-bottom: 28px;
    padding: 16px;
    background: #fafafa;
    border: 1px solid #ddd;
    border-radius: 10px;
}

.conservation-legend {
    display: grid;
    grid-template-columns: auto minmax(140px, 240px) auto;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    color: #4b5563;
    font-size: 13px;
    font-weight: 700;
}

.conservation-gradient {
    height: 10px;
    border-radius: 999px;
    border: 1px solid #fecdd3;
    background: linear-gradient(90deg, hsl(350, 48%, 96%), hsl(350, 90%, 44%));
}

.conservation-tile {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    font-size: 13px;
    border-radius: 6px;
    border: 1px solid #ccc;
    font-family: monospace;
    font-weight: bold;
}

.functional-region-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0 28px;
}

.functional-region-chip {
    padding: 6px 9px;
    border: 1px solid #c7d2fe;
    border-radius: 999px;
    background: #eef2ff;
    color: #3730a3;
    font-size: 13px;
    font-weight: 700;
}

.substitution-list {
    display: grid;
    gap: 16px;
}

.substitution-card {
    padding: 18px;
    border-radius: 12px;
    border: 1px solid #ddd;
    background: #fafafa;
}

.substitution-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.substitution-header strong {
    font-size: 20px;
    font-family: monospace;
}

.substitution-header span {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: bold;
    text-transform: uppercase;
}

.substitution-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
    margin-top: 14px;
}

.substitution-details div {
    padding: 10px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.severity-low .substitution-header span {
    background: #d8f3dc;
    color: #1b5e20;
}

.severity-moderate .substitution-header span {
    background: #fff3bf;
    color: #7a4f00;
}

.severity-high .substitution-header span {
    background: #ffd6d6;
    color: #8a0000;
}

#sequence-editor,
#amino-acid-palette {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
    margin-bottom: 24px;
}

.editable-residue,
.amino-acid-block {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid #ccc;
    background: #eeeeee;
    font-family: monospace;
    font-weight: bold;
    cursor: pointer;
}

.editable-residue:hover,
.amino-acid-block:hover {
    background: #ddd;
}

.editable-residue.selected {
    background: #bde0fe;
    border-color: #0077b6;
}

.aa-nonpolar {
    background: #d8f3dc;
    border-color: #95d5b2;
}

.aa-polar {
    background: #dbeafe;
    border-color: #93c5fd;
}

.aa-positive {
    background: #fde2e2;
    border-color: #fca5a5;
}

.aa-negative {
    background: #ede9fe;
    border-color: #c4b5fd;
}

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}

.legend-item {
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid #ccc;
    font-size: 13px;
    font-weight: bold;
}
.hidden {
    display: none;
}

@media (max-width: 780px) {
    body {
        padding: 32px 16px;
    }

    .workspace-grid,
    .sequence-input-grid {
        grid-template-columns: 1fr;
    }

    .panel-header {
        display: block;
    }

    .analysis-option {
        grid-template-columns: 1fr;
    }

    .analysis-option button {
        margin-top: 16px;
        width: 100%;
    }
}
