:root {
    --cas9-ink: #14262d;
    --cas9-muted: #617178;
    --cas9-paper: #f4f7f5;
    --cas9-panel: #ffffff;
    --cas9-line: #d7e1dd;
    --cas9-green: #176b5b;
    --cas9-green-dark: #0d4e43;
    --cas9-mint: #d9eee7;
    --cas9-amber: #d99028;
    --cas9-blue: #27729b;
    --cas9-red: #b9574d;
    --cas9-shadow: 0 16px 45px rgba(21, 52, 52, 0.09);
}

.cas9-page {
    min-height: 75vh;
    color: var(--cas9-ink);
    background:
        linear-gradient(rgba(20, 38, 45, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(20, 38, 45, 0.025) 1px, transparent 1px),
        var(--cas9-paper);
    background-size: 32px 32px;
    font-family: "Segoe UI", Arial, sans-serif;
    font-variant-numeric: tabular-nums lining-nums;
}

.cas9-page-width {
    width: min(1480px, calc(100% - 48px));
    margin: 0 auto;
}

.cas9-masthead {
    position: relative;
    overflow: hidden;
    color: #f8fffc;
    background: #15383a;
    border-bottom: 5px solid var(--cas9-amber);
}

.cas9-masthead::after {
    content: "";
    position: absolute;
    width: 520px;
    height: 520px;
    right: -180px;
    top: -300px;
    border: 1px solid rgba(219, 242, 235, 0.14);
    border-radius: 50%;
    box-shadow: 0 0 0 54px rgba(219, 242, 235, 0.035), 0 0 0 108px rgba(219, 242, 235, 0.025);
}

.cas9-masthead-grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(360px, 0.8fr) minmax(590px, 1.2fr);
    gap: 72px;
    align-items: center;
    min-height: 290px;
    padding: 52px 0 48px;
}

.cas9-eyebrow,
.cas9-section-label {
    margin: 0 0 8px;
    color: #84cdbd;
    font-family: "Arial Narrow", "Segoe UI", sans-serif;
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.18em;
}

.cas9-title-block h2 {
    margin: 0;
    color: #fff;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2.8rem, 5vw, 5rem);
    font-weight: 400;
    line-height: 0.98;
    letter-spacing: -0.045em;
}

.cas9-title-block > p:last-child {
    max-width: 570px;
    margin: 22px 0 0;
    color: #c9dad7;
    font-size: 1.02rem;
    line-height: 1.7;
}

.cas9-sequence-card {
    padding: 25px 28px 20px;
    border: 1px solid rgba(219, 242, 235, 0.2);
    background: rgba(8, 30, 31, 0.38);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.13);
    backdrop-filter: blur(4px);
}

.cas9-sequence-meta,
.cas9-ruler-notes {
    display: flex;
    justify-content: space-between;
    color: #9ab8b2;
    font-size: 0.73rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.cas9-sequence-ruler {
    position: relative;
    display: grid;
    grid-template-columns: repeat(20, minmax(20px, 1fr)) repeat(3, minmax(24px, 1fr));
    gap: 4px;
    margin: 15px 0 10px;
}

.cas9-sequence-ruler span {
    display: grid;
    place-items: center;
    min-height: 42px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.24);
    color: #d6e5e1;
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: 0.9rem;
    font-weight: 700;
}

.cas9-sequence-ruler .edit-base {
    color: #fff4dc;
    border-bottom-color: var(--cas9-amber);
    background: rgba(217, 144, 40, 0.2);
}

.cas9-sequence-ruler .pam-base {
    color: #102b2b;
    border-bottom-color: #92d4c4;
    background: #92d4c4;
}

.cas9-sequence-ruler .cut-mark {
    position: absolute;
    width: 2px;
    height: 57px;
    left: calc((100% / 23) * 17);
    top: -8px;
    background: var(--cas9-amber);
    transform: rotate(18deg);
}

.cas9-sequence-ruler .cut-mark::before {
    content: "✂";
    position: absolute;
    top: -18px;
    left: -8px;
    color: #f3bd6d;
    font-size: 0.85rem;
    transform: rotate(-18deg);
}

.cas9-ruler-notes {
    display: grid;
    grid-template-columns: 1fr auto 72px;
    text-transform: none;
    letter-spacing: 0;
}

.cas9-ruler-notes .edit-note { color: #efbc70; }
.cas9-ruler-notes span:last-child { text-align: right; }

.cas9-workbench {
    display: grid;
    grid-template-columns: minmax(330px, 410px) minmax(0, 1fr);
    gap: 24px;
    align-items: start;
    padding: 34px 0 64px;
}

.cas9-query-card,
.cas9-results-card {
    border: 1px solid var(--cas9-line);
    background: var(--cas9-panel);
    box-shadow: var(--cas9-shadow);
}

.cas9-query-card { padding: 28px; }
.cas9-results-card { min-height: 760px; overflow: hidden; }

.cas9-card-head,
.cas9-filter-head,
.cas9-results-head {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: flex-start;
}

.cas9-section-label { color: var(--cas9-green); }

.cas9-card-head h3,
.cas9-results-head h3 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.52rem;
    font-weight: 400;
}

.cas9-step {
    color: #b3c3bf;
    font-family: "Arial Narrow", Arial, sans-serif;
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.cas9-field { min-width: 0; }
.cas9-card-head + .cas9-field { margin-top: 25px; }

.cas9-field label,
.cas9-mode-switch legend,
.cas9-region-types legend,
.cas9-label-row > label {
    display: block;
    margin: 0 0 7px;
    color: #33484e;
    font-size: 0.78rem;
    font-weight: 700;
}

.cas9-field input,
.cas9-field select,
.cas9-select-wrap select {
    width: 100%;
    height: 43px;
    padding: 0 12px;
    color: var(--cas9-ink);
    border: 1px solid #cbd8d4;
    border-radius: 4px;
    outline: none;
    background: #fbfdfc;
    font: inherit;
    font-size: 0.9rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.cas9-field input:focus,
.cas9-field select:focus,
.cas9-select-wrap select:focus {
    border-color: var(--cas9-green);
    box-shadow: 0 0 0 3px rgba(23, 107, 91, 0.12);
}

.cas9-select-wrap { position: relative; }
.cas9-select-wrap select { appearance: none; padding-right: 36px; }
.cas9-select-wrap > i { position: absolute; right: 13px; top: 15px; color: var(--cas9-green); font-size: 0.72rem; pointer-events: none; }

.cas9-genome-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 5px 12px;
    min-height: 34px;
    margin-top: 9px;
    color: var(--cas9-muted);
    font-size: 0.72rem;
    line-height: 1.5;
}

.cas9-genome-meta span + span::before { content: "·"; margin-right: 12px; color: #a3b1ad; }
.cas9-genome-meta strong { color: var(--cas9-green-dark); font-weight: 700; }

.cas9-mode-switch { margin: 22px 0 20px; padding: 0; border: 0; }
.cas9-mode-buttons { display: grid; grid-template-columns: repeat(3, 1fr); padding: 3px; border-radius: 5px; background: #eaf0ee; }

.cas9-mode {
    min-height: 40px;
    padding: 5px 8px;
    color: #65757a;
    border: 0;
    border-radius: 3px;
    background: transparent;
    font-size: 0.8rem;
    font-weight: 700;
}

.cas9-mode i { margin-right: 5px; }
.cas9-mode.active { color: var(--cas9-green-dark); background: #fff; box-shadow: 0 1px 5px rgba(28, 57, 54, 0.12); }
.cas9-mode:focus-visible, .cas9-example:focus-visible, .cas9-submit:focus-visible, .cas9-download:focus-visible, .cas9-copy:focus-visible { outline: 3px solid rgba(39, 114, 155, 0.3); outline-offset: 2px; }

.cas9-mode-panel { min-height: 119px; }
.cas9-mode-panel .cas9-field + .cas9-field { margin-top: 15px; }
.cas9-label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }

.cas9-example {
    padding: 0;
    color: var(--cas9-green);
    border: 0;
    border-bottom: 1px dotted currentColor;
    background: transparent;
    font-size: 0.72rem;
    font-weight: 700;
}

.cas9-unit-input { position: relative; }
.cas9-unit-input input { padding-right: 44px; }
.cas9-unit-input span { position: absolute; right: 12px; top: 12px; color: #79898d; font-size: 0.75rem; }

.cas9-region-grid { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 9px; }
.cas9-sublabel { display: block; margin-bottom: 5px; color: #728186; font-size: 0.68rem; text-transform: uppercase; }
.cas9-field-note { margin: 8px 0 0; color: #78878b; font-size: 0.7rem; }

.cas9-sequence-input { text-transform: uppercase; font-family: "SFMono-Regular", Consolas, monospace !important; letter-spacing: 0.09em; }
.cas9-guide-meter { display: flex; justify-content: space-between; margin-top: 7px; color: #7b898d; font-size: 0.69rem; }

.cas9-filter-section { margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--cas9-line); }
.cas9-filter-head h4 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 1.15rem; font-weight: 400; }
.cas9-region-types { display: flex; flex-wrap: wrap; gap: 7px; margin: 18px 0 16px; padding: 0; border: 0; }
.cas9-region-types legend { width: 100%; }
.cas9-region-types label { margin: 0; }
.cas9-region-types input { position: absolute; opacity: 0; }
.cas9-region-types span { display: block; padding: 5px 9px; color: #68787c; border: 1px solid #d1dcd8; border-radius: 3px; background: #fff; font-size: 0.69rem; font-weight: 700; cursor: pointer; }
.cas9-region-types input:checked + span { color: #fff; border-color: var(--cas9-green); background: var(--cas9-green); }
.cas9-region-types input:focus-visible + span { outline: 3px solid rgba(39, 114, 155, 0.25); }

.cas9-filter-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px 10px; }

.cas9-submit {
    width: 100%;
    height: 48px;
    margin-top: 24px;
    color: #fff;
    border: 0;
    border-radius: 4px;
    background: var(--cas9-green-dark);
    box-shadow: 0 8px 18px rgba(13, 78, 67, 0.2);
    font-size: 0.9rem;
    font-weight: 750;
    letter-spacing: 0.01em;
    transition: background 0.15s, transform 0.15s;
}

.cas9-submit:hover { background: var(--cas9-green); transform: translateY(-1px); }
.cas9-submit:disabled { cursor: wait; opacity: 0.72; transform: none; }
.cas9-submit i { margin-right: 8px; }

.cas9-status { margin-top: 14px; padding: 11px 12px; color: #7b302b; border-left: 3px solid var(--cas9-red); background: #fff0ee; font-size: 0.79rem; line-height: 1.45; }

.cas9-results-head { min-height: 105px; padding: 27px 30px 23px; border-bottom: 1px solid var(--cas9-line); }
.cas9-results-head p:last-child { margin: 7px 0 0; color: var(--cas9-muted); font-size: 0.8rem; }

.cas9-download {
    flex: 0 0 auto;
    padding: 8px 12px;
    color: var(--cas9-green-dark);
    border: 1px solid #b9cbc5;
    border-radius: 3px;
    background: #fff;
    font-size: 0.75rem;
    font-weight: 750;
}

.cas9-download i { margin-right: 6px; }
.cas9-download:disabled { color: #a1afab; cursor: not-allowed; background: #f7f9f8; }

.cas9-result-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border-bottom: 1px solid var(--cas9-line);
    background: #f9fbfa;
}

.cas9-result-summary div { padding: 16px 24px; border-right: 1px solid var(--cas9-line); }
.cas9-result-summary div:last-child { border-right: 0; }
.cas9-result-summary strong { display: block; color: var(--cas9-green-dark); font-size: 1.15rem; line-height: 1.15; }
.cas9-result-summary span { color: #78878b; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.07em; }

.cas9-locus-note { padding: 10px 30px; color: #4b6268; border-bottom: 1px solid var(--cas9-line); background: #eef6f3; font-size: 0.76rem; }

.cas9-empty-state,
.cas9-no-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 555px;
    padding: 60px 25px;
    text-align: center;
}

.cas9-empty-icon {
    position: relative;
    display: grid;
    place-items: center;
    width: 82px;
    height: 82px;
    margin-bottom: 22px;
    color: var(--cas9-green);
    border: 1px solid #bdd4cc;
    border-radius: 50%;
    font-size: 1.7rem;
}

.cas9-empty-icon::before,
.cas9-empty-icon::after { content: ""; position: absolute; width: 110px; height: 1px; left: -14px; background: #d8e4e0; }
.cas9-empty-icon::before { transform: rotate(22deg); }
.cas9-empty-icon::after { transform: rotate(-22deg); }
.cas9-empty-state h4, .cas9-no-results h4 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 1.35rem; font-weight: 400; }
.cas9-empty-state > p, .cas9-no-results p { max-width: 520px; margin: 10px 0 25px; color: var(--cas9-muted); font-size: 0.86rem; line-height: 1.6; }
.cas9-empty-state ol { display: flex; gap: 22px; margin: 0; padding: 0; list-style: none; }
.cas9-empty-state li { display: flex; align-items: center; gap: 7px; color: #66787c; font-size: 0.72rem; }
.cas9-empty-state li span { display: grid; place-items: center; width: 20px; height: 20px; color: var(--cas9-green-dark); border: 1px solid #a7c5bb; border-radius: 50%; font-weight: 800; }

.cas9-table-wrap { overflow-x: auto; }
.cas9-table { width: 100%; border-collapse: collapse; font-size: 0.76rem; }
.cas9-table th { padding: 12px 10px; color: #607176; border-bottom: 1px solid #cddad6; background: #f4f8f6; font-size: 0.66rem; font-weight: 800; letter-spacing: 0.04em; text-align: left; text-transform: uppercase; white-space: nowrap; }
.cas9-table th:first-child, .cas9-table td:first-child { padding-left: 20px; }
.cas9-table td { padding: 11px 10px; color: #354a50; border-bottom: 1px solid #e4ebe8; vertical-align: middle; white-space: nowrap; }
.cas9-table tbody tr:hover { background: #f5faf8; }

.cas9-rank { color: #91a19d; font-weight: 700; }
.cas9-guide-seq { display: flex; align-items: center; gap: 1px; font-family: "SFMono-Regular", Consolas, monospace; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.015em; }
.cas9-guide-seq span { display: inline-grid; place-items: center; min-width: 8px; }
.cas9-guide-seq .base-a { color: #28735e; }
.cas9-guide-seq .base-c { color: var(--cas9-blue); }
.cas9-guide-seq .base-g { color: #a16512; }
.cas9-guide-seq .base-t { color: var(--cas9-red); }
.cas9-pam { padding: 3px 6px; color: #174d44; border-radius: 2px; background: var(--cas9-mint); font-family: "SFMono-Regular", Consolas, monospace; font-weight: 800; }
.cas9-position { color: #243e45; font-family: "SFMono-Regular", Consolas, monospace; }
.cas9-strand { display: inline-grid; place-items: center; width: 24px; height: 24px; color: var(--cas9-green-dark); border-radius: 50%; background: #e7f2ee; font-weight: 800; }
.cas9-region-tag { color: #53666b; text-transform: capitalize; }
.cas9-hit-count { color: #31545a; font-weight: 800; }
.cas9-hit-count.unique { color: var(--cas9-green); }
.cas9-copy { width: 28px; height: 28px; color: #78898d; border: 1px solid #d3dfdb; border-radius: 3px; background: #fff; }
.cas9-copy:hover { color: var(--cas9-green-dark); border-color: #91b5aa; }

.cas9-no-results { min-height: 480px; }
.cas9-no-results > i { margin-bottom: 18px; color: #93aaa3; font-size: 2rem; }

@media (max-width: 1180px) {
    .cas9-masthead-grid { grid-template-columns: 1fr; gap: 35px; }
    .cas9-sequence-card { max-width: 820px; }
    .cas9-workbench { grid-template-columns: 350px minmax(0, 1fr); }
    .cas9-empty-state ol { flex-direction: column; gap: 9px; text-align: left; }
}

@media (max-width: 900px) {
    .cas9-page-width { width: min(100% - 28px, 760px); }
    .cas9-masthead-grid { min-height: 0; padding: 42px 0; }
    .cas9-sequence-ruler { grid-template-columns: repeat(20, minmax(13px, 1fr)) repeat(3, minmax(16px, 1fr)); gap: 2px; }
    .cas9-sequence-ruler span { min-height: 35px; font-size: 0.7rem; }
    .cas9-workbench { grid-template-columns: 1fr; }
    .cas9-results-card { min-height: 600px; }
}

@media (max-width: 560px) {
    .cas9-page-width { width: calc(100% - 20px); }
    .cas9-masthead-grid { padding: 34px 0; }
    .cas9-title-block h2 { font-size: 2.7rem; }
    .cas9-sequence-card { padding: 17px 12px; overflow: hidden; }
    .cas9-sequence-meta, .cas9-ruler-notes { font-size: 0.6rem; }
    .cas9-sequence-ruler { grid-template-columns: repeat(20, minmax(0, 1fr)) repeat(3, minmax(0, 1fr)); }
    .cas9-sequence-ruler span { min-width: 0; font-size: 0.58rem; }
    .cas9-query-card { padding: 22px 18px; }
    .cas9-region-grid { grid-template-columns: 1fr 1fr; }
    .cas9-region-grid .cas9-field:first-child { grid-column: 1 / -1; }
    .cas9-filter-grid { grid-template-columns: 1fr; }
    .cas9-results-head { padding: 22px 18px; }
    .cas9-result-summary div { padding: 13px 10px; }
    .cas9-result-summary span { letter-spacing: 0; text-transform: none; }
    .cas9-locus-note { padding: 10px 18px; }
}

@media (prefers-reduced-motion: reduce) {
    .cas9-page *, .cas9-page *::before, .cas9-page *::after { scroll-behavior: auto !important; transition: none !important; animation-duration: 0.01ms !important; }
}
