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

:root {
    --primary-color: #034078;
    --primary-dark: #0a0908;
    --secondary-color: #f4e285;
    --accent-color: #5e503f;
    --text-primary: #0a0908;
    --text-secondary: #5e503f;
    --bg-primary: #ffffff;
    --bg-secondary: #fff6ec;
    --bg-tertiary: #f4e285;
    --border-color: #f4e285;
    --success-color: #22333b;
    --warning-color: #f4e285;
    --error-color: #0a0908;
    --highlight-color: #f4e285;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

/* Animations */
@keyframes slideIn {
    from {
        width: 0;
    }

    to {
        width: 100%;
    }
}

/* Preloader Styles */
.loader {
    bottom: 0;
    height: 100%;
    left: 0;
    position: fixed;
    right: 0;
    top: 0;
    width: 100%;
    z-index: 1111;
    background: var(--bg-primary);
    overflow-x: hidden;
    transition: opacity 0.5s ease-out;
}

.loader.fade-out {
    opacity: 0;
    pointer-events: none;
}

.loader-inner {
    position: absolute;
    left: 50%;
    top: 50%;
    -webkit-transform: translate(-50%, -50%);
    -ms-transform: translate(-50%, -50%);
    -o-transform: translate(-50%, -50%);
    transform: translate(-50%, -50%);
    height: 50px;
    width: 50px;
}

.circle {
    width: 8vmax;
    height: 8vmax;
    border-right: 4px solid var(--primary-color);
    border-radius: 50%;
    -webkit-animation: spinRight 800ms linear infinite;
    animation: spinRight 800ms linear infinite;
}

.circle:before {
    content: '';
    width: 6vmax;
    height: 6vmax;
    display: block;
    position: absolute;
    top: calc(50% - 3vmax);
    left: calc(50% - 3vmax);
    border-left: 3px solid var(--secondary-color);
    border-radius: 100%;
    -webkit-animation: spinLeft 800ms linear infinite;
    animation: spinLeft 800ms linear infinite;
}

.circle:after {
    content: '';
    width: 4vmax;
    height: 4vmax;
    display: block;
    position: absolute;
    top: calc(50% - 2vmax);
    left: calc(50% - 2vmax);
    border-right: 2px solid var(--accent-color);
    border-radius: 100%;
    -webkit-animation: spinRight 600ms linear infinite;
    animation: spinRight 600ms linear infinite;
}

@-webkit-keyframes spinLeft {
    from {
        -webkit-transform: rotate(0deg);
        transform: rotate(0deg);
    }

    to {
        -webkit-transform: rotate(720deg);
        transform: rotate(720deg);
    }
}

@keyframes spinLeft {
    from {
        -webkit-transform: rotate(0deg);
        transform: rotate(0deg);
    }

    to {
        -webkit-transform: rotate(720deg);
        transform: rotate(720deg);
    }
}

@-webkit-keyframes spinRight {
    from {
        -webkit-transform: rotate(360deg);
        transform: rotate(360deg);
    }

    to {
        -webkit-transform: rotate(0deg);
        transform: rotate(0deg);
    }
}

@keyframes spinRight {
    from {
        -webkit-transform: rotate(360deg);
        transform: rotate(360deg);
    }

    to {
        -webkit-transform: rotate(0deg);
        transform: rotate(0deg);
    }
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
}

/* Navigation */
.navbar {
    background: #001f54;
    box-shadow: var(--shadow-md);
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.nav-logo h2 {
    color: white;
    font-size: 1.8rem;
    font-weight: 700;
}

.nav-logo span {
    color: var(--bg-secondary);
    font-size: 0.9rem;
    display: block;
    margin-top: -5px;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-link {
    text-decoration: none;
    color: white;
    font-weight: 500;
    transition: color 0.3s ease;
    position: relative;
}

.nav-link:hover {
    color: var(--highlight-color);
}

.nav-link:hover:not(.active)::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--highlight-color);
    animation: slideIn 0.3s ease;
}


.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--highlight-color);
}

.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
}

.bar {
    width: 25px;
    height: 3px;
    background-color: white;
    margin: 3px 0;
    transition: 0.3s;
}

/* Main Content */
main {
    margin-top: 70px;
}

.section {
    display: none;
    min-height: calc(100vh - 70px);
    padding: 2rem 0;
}

.section.active {
    display: block;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Hero Section */
.hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
    align-items: center;
    min-height: 0;
    padding: 1rem 3rem 2rem;
    margin: 0 auto;
    max-width: 1400px;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    border-radius: 0 0 50px 0;
}

.hero-content h1 {
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.hero-content h2 {
    font-size: 1.5rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-weight: 400;
}

.hero-content p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.7;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
}

.btn.primary {
    background-color: var(--primary-color);
    color: white;
}

.btn.primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn.secondary {
    background-color: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn.secondary:hover {
    background-color: var(--primary-color);
    color: white;
}

/* DNA Animation */
.hero-visual {
    display: flex;
    justify-content: center;
    align-items: center;
}

.dna-animation {
    width: 200px;
    height: 300px;
    position: relative;
}

.dna-strand {
    position: absolute;
    width: 4px;
    height: 100%;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    border-radius: 2px;
    animation: rotate 4s linear infinite;
}

.dna-strand:nth-child(1) {
    left: 50%;
    transform-origin: center;
}

.dna-strand:nth-child(2) {
    right: 50%;
    transform-origin: center;
    animation-delay: -2s;
}

@keyframes rotate {
    0% {
        transform: rotateY(0deg);
    }

    100% {
        transform: rotateY(360deg);
    }
}

/* Features Grid */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    padding: 4rem 3rem;
    margin: 0 auto;
    max-width: 1400px;
}

.feature-card {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.feature-icon {
    background: var(--primary-color);
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 1.5rem;
}

.feature-card h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.feature-card p {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Design Section */
.design-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
}

.tab-btn {
    padding: 12px 24px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 2px solid transparent;
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-btn:hover {
    color: var(--primary-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.input-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

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

.input-group label {
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.input-group input,
.input-group select,
.input-group textarea {
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.input-group textarea {
    min-height: 120px;
    resize: vertical;
}

.input-group.full-width,
.input-row.full-width {
    grid-column: 1 / -1;
}

.input-row {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.input-row .input-group {
    flex: 1;
}

.input-help {
    margin-top: 8px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
}

.input-help-left {
    flex: 1;
}

.load-example-btn {
    flex-shrink: 0;
    font-size: 0.9rem;
    padding: 8px 16px;
}

.input-help small {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.input-help input[type="file"] {
    margin-top: 8px;
    padding: 8px;
    background: var(--bg-secondary);
}

/* Parameters Section */
.parameters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.param-group {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 8px;
}

.param-group h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-size: 1.2rem;
}

.param-item {
    margin-bottom: 1.5rem;
}

.param-item label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.param-item input[type="range"] {
    width: 100%;
    margin-bottom: 8px;
}

.range-value {
    color: var(--primary-color);
    font-weight: 600;
}

.param-item input[type="checkbox"] {
    margin-right: 8px;
}

.radio-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.radio-group input[type="radio"] {
    margin-right: 5px;
}

.radio-group input[type="text"] {
    width: 120px;
    margin-left: 10px;
}

.range-display {
    margin-top: 8px;
    text-align: center;
}

.param-item input[type="range"]+input[type="range"] {
    margin-top: 5px;
}

/* Single range sliders styling to match dual-range sliders */
.param-item-inline input[type="range"]:not(.dual-range-min):not(.dual-range-max) {
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: linear-gradient(to right, var(--primary-color) 0%, var(--primary-color) var(--progress), #ddd var(--progress), #ddd 100%);
    border-radius: 3px;
    outline: none;
    margin: 17px 0;
}

.param-item-inline input[type="range"]:not(.dual-range-min):not(.dual-range-max)::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    height: 20px;
    width: 20px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.param-item-inline input[type="range"]:not(.dual-range-min):not(.dual-range-max)::-moz-range-track {
    height: 6px;
    background: #ddd;
    border-radius: 3px;
    border: none;
}

.param-item-inline input[type="range"]:not(.dual-range-min):not(.dual-range-max)::-moz-range-thumb {
    height: 20px;
    width: 20px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* LayUI slider styling to match single-range sliders */
.layui-slider {
    height: 6px;
}

.layui-slider-bar {
    height: 6px !important;
    border-radius: 3px;
}

.layui-slider-step {
    height: 6px !important;
    border-radius: 3px;
}

/* Match the knob/button styling with single-range sliders */
.layui-slider-wrap-btn {
    width: 20px !important;
    height: 20px !important;
    background: var(--primary-color) !important;
    border: 3px solid white !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3) !important;
    border-radius: 50% !important;
}

/* Style radio buttons and checkboxes to match slider colors */
.param-item-inline input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border: 2px solid #ddd;
    border-radius: 50%;
    margin-right: 5px;
    cursor: pointer;
    position: relative;
    vertical-align: middle;
}

.param-item-inline input[type="radio"]:checked {
    border-color: var(--primary-color);
    background-color: var(--primary-color);
}

.param-item-inline input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: white;
}

.param-item-inline input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border: 2px solid #ddd;
    border-radius: 3px;
    margin-right: 8px;
    cursor: pointer;
    position: relative;
    vertical-align: middle;
}

.param-item-inline input[type="checkbox"]:checked {
    border-color: var(--primary-color);
    background-color: var(--primary-color);
}

.param-item-inline input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: -2px;
    left: 1px;
    color: white;
    font-size: 12px;
    font-weight: bold;
}

/* Update PAM label colors to match theme */
.radio-group label[for="pam-ngg"],
.radio-group label[for="pam-ng"] {
    color: var(--primary-color) !important;
    font-weight: 500;
}

/* Style radio buttons in optimization tab to match */
#optimization-tab input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border: 2px solid #ddd;
    border-radius: 50%;
    margin-right: 5px;
    cursor: pointer;
    position: relative;
    vertical-align: middle;
}

#optimization-tab input[type="radio"]:checked {
    border-color: var(--primary-color);
    background-color: var(--primary-color);
}

#optimization-tab input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: white;
}

/* Style primer option labels */
#optimization-tab .radio-group label {
    color: var(--text-primary);
    font-weight: 500;
    cursor: pointer;
}

/* Tooltip for range sliders */
.range-tooltip {
    position: absolute;
    background: var(--text-primary);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    pointer-events: none;
    z-index: 1000;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s ease;
    transform: translateX(-50%);
}

.range-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: var(--text-primary);
}

.range-tooltip.visible {
    opacity: 1;
}

.param-item-inline {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: 20px;
    margin-bottom: 15px;
}

.param-item-inline>label {
    margin-bottom: 0;
    justify-self: start;
    align-self: center;
}

.param-item-inline>input,
.param-item-inline>.radio-group,
.param-item-inline>.dual-range-container {
    justify-self: start;
    align-self: center;
}

#parameters-tab {
    font-size: 0.9rem;
}

#parameters-tab input,
#parameters-tab select,
#parameters-tab label {
    font-size: 0.9rem;
}

.primer-input-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.primer-input-group input {
    flex: 1;
    min-width: 120px;
}

.primer-connector {
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
}

.custom-primer-section {
    margin-top: 15px;
}

#optimization-tab {
    font-size: 0.9rem;
}

#optimization-tab input,
#optimization-tab select,
#optimization-tab label {
    font-size: 0.9rem;
}

.param-item-inline input[type="number"] {
    width: 60px;
    max-width: 60px;
}

.param-actions {
    text-align: center;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.dual-range-container {
    position: relative;
    width: 100%;
    height: 40px;
    margin: 10px 0;
}

.dual-range-slider {
    position: relative;
    width: 100%;
    height: 6px;
    background: #ddd;
    border-radius: 3px;
    margin: 0;
    top: 17px;
}

.dual-range-track {
    position: absolute;
    height: 6px;
    background: var(--primary-color);
    border-radius: 3px;
    top: 0;
}

.dual-range-container input[type="range"] {
    position: absolute;
    width: 100%;
    height: 6px;
    top: 17px;
    left: 0;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    pointer-events: none;
    margin: 0;
    padding: 0;
}

.dual-range-container input[type="range"]::-webkit-slider-track {
    background: transparent;
    border: none;
    height: 6px;
    margin: 0;
    padding: 0;
}

.dual-range-container input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    height: 20px;
    width: 20px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    pointer-events: auto;
    border: 3px solid white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 2;
    margin-top: -7px;
    transform: none;
}

.dual-range-container input[type="range"]::-moz-range-track {
    background: transparent;
    border: none;
    height: 6px;
    margin: 0;
    padding: 0;
}

.dual-range-container input[type="range"]::-moz-range-thumb {
    height: 20px;
    width: 20px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    pointer-events: auto;
    border: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 2;
    transform: none;
}

.dual-range-container .dual-range-max::-webkit-slider-thumb {
    background: var(--accent-color);
    margin-top: -7px;
    transform: none;
}

.dual-range-container .dual-range-max::-moz-range-thumb {
    background: var(--accent-color);
    transform: none;
}

.dual-range-values {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 5px;
}

.dual-range-values span {
    display: inline-block;
    line-height: 1;
}

/* Design Actions */
.design-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    margin: 2rem 0;
}

/* Results Section */
.results-section {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: 12px;
    margin-top: 2rem;
}

.results-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.result-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
}

.result-card h4 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.sequence-display {
    background: var(--bg-tertiary);
    padding: 1rem;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    word-break: break-all;
}

.scores {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.score-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.score-bar {
    width: 100px;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}

.score-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--error-color), var(--warning-color), var(--success-color));
    transition: width 0.3s ease;
}

.result-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* Visualization Section */
.visualization-controls {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 8px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-group label {
    font-weight: 500;
    color: var(--text-primary);
}

.visualization-container {
    position: relative;
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
    overflow: hidden;
}

#structure-viewer {
    width: 100%;
    height: 500px;
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--primary-color) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
}

.viewer-controls {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.viewer-controls button {
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.viewer-controls button:hover {
    background: white;
    transform: scale(1.1);
}

.structure-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.info-panel {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 8px;
}

.info-panel h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.detail-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.secondary-structure {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 8px;
}

#dot-bracket-notation {
    font-family: 'Courier New', monospace;
    background: white;
    padding: 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    word-break: break-all;
}

/* Analysis Section */
.analysis-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
}

.analysis-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.chart-container {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
}

.chart-container h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

#efficiency-chart {
    width: 100%;
    height: 300px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}

.metrics-panel {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 8px;
}

.metric-item {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.metric-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.metric-value {
    margin-top: 0.5rem;
}

.metric-value span {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.confidence-interval {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.recommendations {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 8px;
}

/* Off-target Analysis */
.offtarget-search {
    text-align: center;
    margin-bottom: 2rem;
}

.results-summary {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.summary-stats {
    display: flex;
    justify-content: space-around;
    margin-top: 1rem;
}

.stat-item {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.offtarget-table {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background: var(--bg-secondary);
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
}

td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

tr:hover {
    background: var(--bg-tertiary);
}

/* Help Section */
.help-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.help-card {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
}

.help-card h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.help-card p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.help-card ul {
    list-style: none;
    padding-left: 0;
}

.help-card li {
    padding: 0.5rem 0;
    color: var(--text-secondary);
    position: relative;
    padding-left: 1.5rem;
}

.help-card li::before {
    content: '•';
    color: var(--primary-color);
    position: absolute;
    left: 0;
}

.faq-section {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: 12px;
}

.faq-item {
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.faq-question {
    width: 100%;
    padding: 1rem;
    background: white;
    border: none;
    text-align: left;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.faq-question:hover {
    background: var(--bg-tertiary);
}

.faq-answer {
    padding: 1rem;
    background: var(--bg-tertiary);
    display: none;
}

.faq-answer.active {
    display: block;
}

/* Footer */
footer {
    background: var(--text-primary);
    color: white;
    padding: 3rem 0 1rem;
    margin-top: 4rem;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.footer-section h3 {
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section ul li a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-section ul li a:hover {
    color: white;
}

.footer-bottom {
    border-top: 1px solid var(--border-color);
    margin-top: 2rem;
    padding-top: 1rem;
    text-align: center;
    color: var(--text-secondary);
}

/* Responsive Design */
@media (max-width: 768px) {
    .hamburger {
        display: flex;
    }

    .nav-menu {
        position: fixed;
        left: -100%;
        top: 70px;
        flex-direction: column;
        background-color: var(--bg-primary);
        width: 100%;
        text-align: center;
        transition: 0.3s;
        box-shadow: var(--shadow-md);
        padding: 1rem 0;
    }

    .nav-menu.active {
        left: 0;
    }

    .nav-menu li {
        margin: 0.5rem 0;
    }

    .nav-menu .nav-link {
        color: var(--text-primary);
        padding: 0.5rem 1rem;
        display: block;
        border-radius: 5px;
        transition: all 0.3s ease;
    }

    .nav-menu .nav-link:hover,
    .nav-menu .nav-link.active {
        background-color: var(--primary-color);
        color: white;
    }

    /* Nav logo responsive styles */
    .nav-logo h2 {
        font-size: 1.4rem;
    }

    .nav-logo span {
        font-size: 0.7rem;
        line-height: 1.2;
    }

    .hero {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .hero-content h1 {
        font-size: 2.5rem;
    }

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

    .parameters-grid {
        grid-template-columns: 1fr;
    }

    .results-grid {
        grid-template-columns: 1fr;
    }

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

    .structure-info {
        grid-template-columns: 1fr;
    }

    .visualization-controls {
        flex-direction: column;
        gap: 1rem;
    }

    .control-group {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .summary-stats {
        flex-direction: column;
        gap: 1rem;
    }
}

@media (max-width: 600px) {

    /* Further reduce nav-logo for smaller screens */
    .nav-logo h2 {
        font-size: 1.2rem;
    }

    .nav-logo span {
        font-size: 0.6rem;
        display: block;
        max-width: 180px;
        word-wrap: break-word;
        line-height: 1.1;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }

    .hero-content h1 {
        font-size: 2rem;
    }

    .hero-buttons {
        flex-direction: column;
    }

    /* Even smaller nav-logo for very small screens */
    .nav-logo h2 {
        font-size: 1rem;
    }

    .nav-logo span {
        font-size: 0.5rem;
        max-width: 150px;
    }

    .design-tabs {
        flex-direction: column;
    }

    .analysis-tabs {
        flex-direction: column;
    }

    .viewer-controls {
        flex-direction: row;
        bottom: 1rem;
        top: auto;
        right: 50%;
        transform: translateX(50%);
    }
}

/* Loading States */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(37, 99, 235, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

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

/* Success/Error States */
.success {
    color: var(--success-color);
    background-color: rgba(5, 150, 105, 0.1);
    padding: 0.5rem;
    border-radius: 6px;
    border-left: 4px solid var(--success-color);
}

.error {
    color: var(--error-color);
    background-color: rgba(220, 38, 38, 0.1);
    padding: 0.5rem;
    border-radius: 6px;
    border-left: 4px solid var(--error-color);
}

.warning {
    color: var(--warning-color);
    background-color: rgba(217, 119, 6, 0.1);
    padding: 0.5rem;
    border-radius: 6px;
    border-left: 4px solid var(--warning-color);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* Tooltips */
.tooltip {
    position: relative;
    cursor: help;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-primary);
    color: white;
    padding: 0.5rem;
    border-radius: 6px;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
}

.tooltip:hover::after {
    opacity: 1;
    visibility: visible;
    bottom: calc(100% + 5px);
}

/* pegRNA Design Results Styles */
.result-card.full-width {
    grid-column: 1 / -1;
}

.pegrna-results-content {
    max-height: 600px;
    overflow-y: auto;
    padding: 1rem;
    background: #fafafa;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.pegrna-results-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.pegrna-results-content table th,
.pegrna-results-content table td {
    padding: 0.5rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.pegrna-results-content table th {
    background: var(--bg-secondary);
    font-weight: 600;
}

.mutation-info {
    padding: 1rem;
}

.mutation-info code.sequence-display {
    display: block;
    word-break: break-all;
    white-space: pre-wrap;
    font-size: 0.85rem;
    max-height: 100px;
    overflow-y: auto;
}

.success-text {
    color: var(--success-color);
    font-weight: 500;
}

.info-text {
    color: var(--text-secondary);
}

/* Hide PlantPegDesigner header/footer in results */
.pegrna-results-content #header,
.pegrna-results-content #footer {
    display: none;
}

.pegrna-results-content #section {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
}

/* Style PlantPegDesigner tables */
.pegrna-results-content table[frame="hsides"] {
    border: none;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.pegrna-results-content span[style*="color:red"] {
    color: var(--error-color) !important;
    font-weight: 600;
}

.pegrna-results-content span[style*="color:blue"] {
    color: var(--primary-color) !important;
}

.pegrna-results-content span[style*="color:#7A09FA"] {
    color: var(--accent-color) !important;
}

.pegrna-results-content span[style*="color:#c51b8a"] {
    color: #c51b8a;
    font-weight: 500;
}

.pegrna-results-content span[style*="background-color:#8FBC8F"] {
    background-color: var(--success-color) !important;
    color: white;
    padding: 2px 4px;
    border-radius: 3px;
}

/* ================================================
   pegRNA Structure Visualization Modal
   ================================================ */

.pegrna-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.pegrna-modal.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.pegrna-modal-content {
    background: white;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-width: 1000px;
    width: 95%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
    overflow: hidden;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pegrna-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    background: var(--primary-color);
    color: white;
}

.pegrna-modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pegrna-modal-header h3 i {
    font-size: 1.1rem;
}

.pegrna-modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 1.5rem;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.pegrna-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.pegrna-modal-body {
    flex: 1;
    overflow: auto;
    padding: 0;
}

.pegrna-info-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.pegrna-info-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pegrna-info-item .label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.pegrna-info-item .value {
    font-family: 'Courier New', monospace;
    background: white;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    color: var(--primary-color);
    border: 1px solid var(--border-color);
    word-break: break-all;
}

#pegrna-visualization-container {
    padding: 1.5rem;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

#pegrna-visualization-container svg {
    max-width: 100%;
    height: auto;
    max-height: 500px;
}

.pegrna-error {
    color: var(--error-color);
    text-align: center;
    padding: 2rem;
    font-style: italic;
}

.pegrna-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

/* View Structure Button (for results page) */
.pegrna-results-content .view-structure-btn,
.view-structure-btn {
    background: var(--primary-color) !important;
    background-image: none !important;
    background-color: var(--primary-color) !important;
    color: white !important;
    border: none !important;
    padding: 6px 12px !important;
    border-radius: 6px !important;
    font-size: 0.8rem !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    transition: all 0.2s ease !important;
    font-weight: 500 !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    text-decoration: none !important;
}

.pegrna-results-content .view-structure-btn:hover,
.view-structure-btn:hover {
    background: var(--secondary-color) !important;
    background-color: var(--secondary-color) !important;
    color: var(--primary-color) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(244, 226, 133, 0.4);
}

.view-structure-btn i {
    font-size: 0.75rem;
}


/* pegRNA Structure Visualization Modal */
.pegrna-modal {
    display: none !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.7) !important;
    z-index: 10000 !important;
    overflow: auto;
    padding: 2rem;
    backdrop-filter: blur(4px);
}

.pegrna-modal.active {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    align-items: center;
    justify-content: center;
}

.pegrna-modal-content {
    background: white;
    border-radius: 12px;
    max-width: 950px;
    width: 100%;
    max-height: 90vh;
    overflow: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Modal header and close button styles are defined above - removed duplicates */

.pegrna-modal-body {
    padding: 1.5rem 2rem;
}

.pegrna-info-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border: 1px solid #e5e7eb;
}

.pegrna-info-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
}

.pegrna-info-item .label {
    font-weight: 600;
    color: #6b7280;
}

.pegrna-info-item .value {
    color: #1f2937;
    background: #e5e7eb;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    word-break: break-all;
}

.pegrna-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1.5rem 2rem;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
    border-radius: 0 0 12px 12px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .pegrna-modal-content {
        width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .pegrna-info-bar {
        flex-direction: column;
        gap: 0.5rem;
    }

    .pegrna-info-item .value {
        flex: 1;
    }

    #pegrna-visualization-container {
        padding: 1rem;
    }

    .pegrna-modal-footer {
        flex-direction: column;
    }

    .pegrna-modal-footer .btn {
        width: 100%;
        justify-content: center;
    }
}

/* =========================================================================
 * Mobile-friendly additions (added 2026-04-29)
 *
 * One consolidated block of targeted fixes to make the whole site usable on
 * phones and tablets without touching legacy media-query blocks above. Order
 * here mirrors the order pages are typically visited.
 * ========================================================================= */

/* --- Brand block in the navbar ---------------------------------------- */
/* nav-brand wraps the PNG logo + the nav-logo title block so they sit
 * side-by-side as one flex item inside the (also-flex) nav-container.
 * The PNG already has a transparent background — we just have to make sure
 * no rule paints a fill behind it. */
.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 1;
    min-width: 0;
}

/* --- Institutional ICAR logo ------------------------------------------ */
/* On desktop the ICAR emblem floats to the LEFT of the navbar (outside the
 * 1200 px container, hanging off-edge). On mobile we collapse that absolute
 * positioning and slot the emblem inline between the title block and the
 * hamburger button so it stays visible. */
.nav-icar-logo {
    position: absolute;
    left: -140px;
    top: 50%;
    transform: translateY(-50%);
    height: 56px;
    width: auto;
    object-fit: contain;
    border-radius: 8px;
}

@media (max-width: 768px) {
    .nav-icar-logo {
        position: static;
        left: auto;
        transform: none;
        height: 38px;
        /* Scale rounded-corner radius with the logo height (~14% of height,
         * matching the desktop 8px / 56px ratio) so the emblem keeps the same
         * visual amount of corner rounding it has at full size. */
        border-radius: 5px;
        order: 1;
        margin-left: auto;
        margin-right: 0.5rem;
    }
    .hamburger {
        order: 2;
    }
}

@media (max-width: 480px) {
    .nav-icar-logo {
        height: 32px;
        border-radius: 4px;
    }
}

@media (max-width: 360px) {
    .nav-icar-logo {
        height: 28px;
        border-radius: 4px;
        margin-right: 0.4rem;
    }
}

.nav-brand .propeg-logo {
    height: 52px;
    width: auto;
    background: transparent;
    border: none;
    object-fit: contain;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .nav-brand {
        gap: 0.5rem;
    }
    .nav-brand .propeg-logo {
        height: 42px;
    }
}

@media (max-width: 480px) {
    .nav-brand .propeg-logo {
        height: 36px;
    }
}

@media (max-width: 360px) {
    .nav-brand .propeg-logo {
        height: 30px;
    }
}

/* --- Hero showcase: gepegRNA SVG on the right ------------------------- */
/* The gepegRNA secondary-structure SVG is the headline visual on index.php.
 * It lives in the right column of the hero grid and gets a subtle entrance
 * fade-in plus a continuous gentle float to feel alive without distracting
 * from the primary call-to-action on the left. The right side of the
 * source SVG carries empty space; we trim it visually with object-fit
 * so the rendered structure fills the column without excess whitespace. */
.hero-showcase {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
}

.hero-showcase-frame {
    position: relative;
    width: 100%;
    max-width: none;
    padding: 0.5rem;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(2px);
    box-shadow: 0 18px 40px -12px rgba(3, 64, 120, 0.18);
    overflow: hidden;
}

/* Static radial halo behind the SVG — subtle, sits behind everything. */
.hero-showcase-glow {
    position: absolute;
    inset: -10%;
    background: radial-gradient(circle at 50% 50%,
        rgba(227, 210, 53, 0.28) 0%,
        rgba(3, 64, 120, 0.18) 35%,
        transparent 70%);
    z-index: 0;
    pointer-events: none;
}

.hero-showcase-svg {
    position: relative;
    z-index: 1;
    display: block;
    width: 100%;
    height: auto;
    background: transparent;
    transition: transform 0.35s ease, filter 0.35s ease;
    filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.12));
}

.hero-showcase-svg:hover {
    transform: scale(1.025);
    filter: drop-shadow(0 10px 26px rgba(0, 0, 0, 0.18));
}

.hero-showcase-caption {
    margin: 0;
    text-align: center;
    font-size: 0.95rem;
    color: var(--primary-color);
    letter-spacing: 0.01em;
}
.hero-showcase-caption i {
    margin-right: 0.4rem;
}
.hero-showcase-caption strong {
    color: var(--primary-color);
}


/* --- Descriptive feature card stacked below the hero buttons ---------- */
/* Lives inside .hero-content (the left column), gives breathing room
 * between the primary CTAs and the long-form description. */
.hero-feature-card {
    margin-top: 1.5rem;
}

/* Legacy class — kept so any other page that used it still has a sane base */
.hero-feature-box {
    flex: 1;
    margin-left: 50px;
    max-width: 600px;
}

/* --- pegRNA / gpegRNA / gepegRNA visualization containers -------------- */
/* Make every viz container fluid by default; fix the SVG aspect on mobile. */
#pegrna-visualization-container,
#gpegrna-visualization-container,
#gepegrna-visualization-container,
#pegrna-viz-container,
#gpegrna-viz-container,
#gepegrna-viz-container,
.pegrna-viz-container {
    max-width: 100%;
    overflow-x: auto;
}

#pegrna-visualization-container svg,
#gpegrna-visualization-container svg,
#gepegrna-visualization-container svg,
#pegrna-viz-container svg,
#gpegrna-viz-container svg,
#gepegrna-viz-container svg,
.pegrna-viz-container svg {
    max-width: 100%;
    height: auto;
    display: block;
}

/* --- Tablet / mobile (≤ 768 px) ---------------------------------------- */
@media (max-width: 768px) {
    /* Hero — kill the desktop margin that pushes the feature card off-screen */
    .hero-feature-box {
        margin-left: 0;
        margin-top: 2rem;
        max-width: 100%;
    }

    /* In-column descriptive card eases padding on tablet */
    .hero-feature-card {
        padding: 22px 24px !important;
        margin-top: 1.25rem;
    }

    /* Showcase frame slimmer on mobile, restore natural aspect (no cropping
     * needed once it's stacked under the text — the column is narrower) */
    .hero-showcase {
        margin-top: 1rem;
    }
    .hero-showcase-frame {
        max-width: 560px;
        padding: 0.75rem;
    }
    .hero-showcase-svg {
        aspect-ratio: auto;
    }

    /* Force the design page's results table area to scroll horizontally */
    .pegrna-results-content {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .pegrna-results-content table {
        min-width: 600px;
    }

    /* Mutation summary card on results page should stack */
    .mutation-details {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    .mutation-type-badge {
        align-self: flex-start;
    }

    /* Help-card 2-column lists in tutorial.php collapse to one column */
    .help-card ul[style*="grid"] {
        grid-template-columns: 1fr !important;
    }

    /* Visualization viewport: tighter padding, smaller default minimum */
    #pegrna-visualization-container,
    #gpegrna-visualization-container,
    #gepegrna-visualization-container,
    #pegrna-viz-container,
    #gpegrna-viz-container,
    #gepegrna-viz-container {
        min-height: 280px;
        padding: 0.5rem !important;
    }

    /* Modal info-bar items should not flex into uneven widths on phones */
    .pegrna-info-item {
        flex: 1 1 100%;
    }

    /* design.php — file-upload action buttons that overlap inputs */
    .file-upload-actions {
        position: static !important;
        margin-top: 0.5rem;
        text-align: right;
    }

    /* design.php — three Design <variant> buttons + Clear All wrap into rows */
    .design-actions {
        gap: 0.75rem;
        margin: 1.25rem 0;
    }
    .design-actions .btn {
        flex: 1 1 calc(50% - 0.75rem);
        min-width: 140px;
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
        justify-content: center;
    }

    /* design.php — PRIDICT loading overlay text */
    #pridict-loading-overlay > div,
    #pridict-loading-overlay p {
        max-width: 90vw;
    }
}

/* --- Phone (≤ 480 px) -------------------------------------------------- */
@media (max-width: 480px) {
    /* Visualization SVGs in modal/inline get an even smaller min-height */
    #pegrna-visualization-container,
    #gpegrna-visualization-container,
    #gepegrna-visualization-container,
    #pegrna-viz-container,
    #gpegrna-viz-container,
    #gepegrna-viz-container {
        min-height: 220px;
    }

    /* Modal title ellipsizes if too long */
    .pegrna-modal-header h3 {
        font-size: 1rem;
        line-height: 1.2;
    }

    /* Tutorial / index hero feature card padding trim */
    .hero-feature-box .feature-card,
    .hero-feature-card {
        padding: 1.25rem !important;
    }

    /* Showcase frame even slimmer on phones */
    .hero-showcase-frame {
        max-width: 360px;
    }
    .hero-showcase-caption {
        font-size: 0.85rem;
    }

    /* Team page header */
    .team-header h1 {
        font-size: 1.5rem;
    }
    .team-image-container {
        height: 200px;
    }
    .team-card {
        margin: 0;
    }

    /* Contact card icons */
    .contact-card .card-icon {
        width: 60px;
        height: 60px;
    }
    .contact-card .card-icon i {
        font-size: 1.5rem;
    }

    /* Feedback alert */
    .feedback-alert-box {
        padding: 1.5rem;
    }
    .feedback-alert-box h3 {
        font-size: 1.1rem;
    }
    .alert-icon {
        font-size: 2rem;
    }

    /* design.php — primer input row stacks */
    .primer-input-group {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    .primer-connector {
        display: none;
    }

    /* design.php — Layui dual-range slider knobs are easier to grab */
    .layui-slider-wrap-btn {
        width: 18px !important;
        height: 18px !important;
    }

    /* design.php — Design buttons stack full-width on phone */
    .design-actions {
        flex-direction: column;
        align-items: stretch;
    }
    .design-actions .btn {
        width: 100%;
        flex: 0 0 auto;
    }
}

/* --- Very small phones (≤ 360 px) -------------------------------------- */
@media (max-width: 360px) {
    .nav-container {
        padding: 0 10px;
    }
    .pegrna-results-content table {
        min-width: 480px;
    }
    .hero-feature-box .feature-card,
    .hero-feature-card {
        padding: 1rem !important;
    }
}
