:root {
  color-scheme: light;
  --typeface: "Space Grotesk", "Segoe UI", sans-serif;
  font-family: var(--typeface);
  color: #21243e;
  background: #edf0f8;
  --text: #21243e;
  --muted: #5d627d;
  --accent: #5c47bb;
  --border: #e0e3f1;
  --panel: #fff;
  --soft: #f5f3fc;
  --input-box-max: 420px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(ellipse at 12% 12%, #eee7fc, transparent 48%),
    radial-gradient(ellipse at 90% 52%, #e0f3f6, transparent 55%), #edf0f8;
}
button, input, select { font: inherit; }
button, select, summary { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
:focus-visible { outline: 2px solid #715ad0; outline-offset: 4px; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: clamp(18px, 4.2vh, 46px) clamp(16px, 3.4vw, 65px) 0;
}
.wordmark, .method-link { display: inline-flex; align-items: center; gap: 10px; }
.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}
.shell:has(.viewport[hidden]) #new-match { display: none; }
.shell:has(.viewport:not([hidden])) :is(.intro, .builder) { display: none; }
.wordmark { color: inherit; text-decoration: none; border-radius: 12px; font-size: clamp(1rem, 2vw, 1.55rem); font-weight: 700; letter-spacing: -.04em; }
.wordmark img { display: block; flex: none; width: clamp(40px, 4vw, 60px); height: auto; }
.method-link { min-height: 42px; padding: 8px 13px; border: 0; border-radius: 12px; background: #f0edfa; color: var(--accent); text-decoration: none; font-size: .84rem; font-weight: 700; }
.method-link:hover { background: #e8e1fa; }

.intro { padding: 31px 30px 25px; }
.intro h1 { margin: 0; font-size: clamp(2.5rem, 5vw, 4.75rem); line-height: .99; letter-spacing: -.075em; }
.intro p { margin: 10px 0 0; color: var(--muted); }
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.65fr) minmax(0, 1fr);
  grid-template-areas: "sidebar viewer results";
  align-items: start;
  gap: 15px;
  padding: 24px clamp(16px, 3.4vw, 65px);
}
.workspace:has(.conversion.is-playing:not([hidden])) {
  grid-template-columns: minmax(0, 620px);
  grid-template-areas: "sidebar";
  justify-content: center;
}
.workspace:has(.conversion.is-playing:not([hidden])) .viewport { display: none; }
.match-sidebar { grid-area: sidebar; display: grid; gap: 15px; min-width: 0; }
#match-names dl { margin: 0; display: grid; gap: 10px; }
#match-names dl div { padding: 8px 11px; border-radius: 9px; background: var(--soft); }
#match-names dt { color: var(--muted); font-size: .78rem; }
#match-names dd { margin: 2px 0 0; font-weight: 700; overflow-wrap: anywhere; }
.builder { grid-area: builder; }
.viewport { grid-area: viewer; min-width: 0; scroll-margin-top: 12px; }
.results { grid-area: results; }
.card, .viewport { min-width: 0; padding: clamp(14px, 1.65vw, 23px); border: 1px solid var(--border); border-radius: 23px; background: var(--panel); }
.builder { background: linear-gradient(165deg, #f8f6ff, #fff 56%); }
h2 { margin: 0 0 18px; font-size: 1.22rem; line-height: 1.14; letter-spacing: -.045em; }
.heading-with-icon { display: flex; align-items: center; gap: 9px; }
.result-icon {
  position: relative;
  flex: 0 0 30px;
  height: 30px;
  border-radius: 9px;
  background: #efeafa;
  color: var(--accent);
}
.icon-molecule::before, .icon-analysis::before {
  content: "";
  position: absolute;
  inset: 6px;
  background-repeat: no-repeat;
}
.icon-molecule::before {
  background:
    radial-gradient(circle at 3px 13px, currentColor 2px, transparent 2.6px),
    radial-gradient(circle at 8px 4px, currentColor 2px, transparent 2.6px),
    radial-gradient(circle at 15px 10px, currentColor 2px, transparent 2.6px),
    linear-gradient(120deg, transparent 43%, currentColor 44% 56%, transparent 57%) 3px 4px / 6px 10px no-repeat,
    linear-gradient(42deg, transparent 43%, currentColor 44% 56%, transparent 57%) 8px 4px / 8px 7px no-repeat;
}
.icon-analysis { background: #eaf4fb; color: #446ba2; }
.icon-analysis::before {
  background:
    linear-gradient(currentColor, currentColor) 2px 12px / 3px 4px,
    linear-gradient(currentColor, currentColor) 7px 8px / 3px 8px,
    linear-gradient(currentColor, currentColor) 12px 3px / 3px 13px;
  background-repeat: no-repeat;
}
.icon-names { background: #eaf6f6; color: #39778a; }
.icon-names::before {
  content: "";
  position: absolute;
  inset: 6px;
  background:
    radial-gradient(circle at 5px 4px, currentColor 2.4px, transparent 3px),
    radial-gradient(circle at 13px 4px, currentColor 2.4px, transparent 3px),
    radial-gradient(ellipse 4px 4.5px at 5px 13px, currentColor 95%, transparent),
    radial-gradient(ellipse 4px 4.5px at 13px 13px, currentColor 95%, transparent);
}
.icon-log { background: #eeedf9; color: #604eab; }
.icon-log::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 11px;
  width: 7px;
  height: 7px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  transform: rotate(45deg);
}
.icon-log::after {
  content: "";
  position: absolute;
  right: 7px;
  bottom: 9px;
  width: 6px;
  border-bottom: 2px solid currentColor;
}
.field { margin-bottom: 15px; }
.field-label { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 6px; }
label, .score-label { font-size: .85rem; font-weight: 700; }
.field-label span { font-size: .73rem; color: var(--muted); }
.hint { font-size: .81rem; line-height: 1.5; color: var(--muted); }
input, select { min-height: 44px; border: 1px solid #d9dcec; padding: 8px 11px; border-radius: 11px; background: #fafaff; color: var(--text); }
input { width: 100%; }
input::placeholder { color: #666c85; }
input[aria-invalid] { border-color: #ab4866; }
.error { margin: 5px 0 0; color: #a13356; font-size: .8rem; }
.builder .hint { margin: 2px 0 17px; }
.primary, #download {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 46px;
  padding: 9px 13px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(115deg, #624bc5, #7555c6);
  color: white;
  font-weight: 700;
  box-shadow: 0 7px 17px #624bc528;
}
.primary { width: 100%; }
.primary:hover, #download:hover:enabled { background: #553bad; }
.primary span { font-size: 1.18rem; }

.results-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.results-head h2 { margin: 0; }
.length { padding: 5px 9px; border-radius: 20px; background: #efeafa; color: var(--accent); font-size: .76rem; white-space: nowrap; }
.model-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 7px; }
.model-footer p, .model-help { margin: 0; }
.model-help { margin-top: 6px; }
.model-controls { display: flex; flex-wrap: wrap; gap: 5px; }
.model-modes { display: flex; gap: 3px; width: fit-content; padding: 3px; margin-top: 9px; border-radius: 13px; background: var(--soft); }
#model .model-modes button { min-height: 36px; border-color: transparent; background: transparent; }
#model .model-modes button[aria-pressed="true"] { border-color: #e0d7f7; background: #fff; color: var(--accent); }
.model button, .chain button, #conversion-skip {
  min-height: 42px;
  min-width: 42px;
  padding: 7px 10px;
  border: 1px solid #dddcec;
  border-radius: 11px;
  background: #f8f7ff;
  color: var(--accent);
  font-size: .8rem;
  font-weight: 700;
}
.model button:hover, .chain button:hover, #conversion-skip:hover { background: #efe9fb; }
.viewer-stage {
  position: relative;
  isolation: isolate;
  height: clamp(237px, calc(34vw - 48px), 417px);
  margin-top: 12px;
  border: 1px solid #e5e2f5;
  border-radius: 20px;
  background: radial-gradient(ellipse at 24% 36%, #e2f7f8 0%, transparent 55%),
    radial-gradient(ellipse at 70% 78%, #e4dafa 0%, transparent 59%),
    radial-gradient(circle, #b4b9d05c 1px, transparent 1.2px) center / 22px 22px, #f6f7fe;
  overflow: hidden;
}
.viewer-stage canvas { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
.viewer-stage canvas:focus-visible { outline-offset: -4px; }
.viewer-stage canvas:active { cursor: grabbing; }
.viewer-empty, .residue-detail { margin: 10px 0; padding: 10px 12px; background: var(--soft); border: 1px solid var(--border); border-radius: 12px; }
.residue-detail { display: flex; justify-content: space-between; gap: 5px 12px; flex-wrap: wrap; font-size: .84rem; }
.residue-detail span { color: var(--accent); }
#repeat-options { margin-top: 12px; padding: 7px 10px; background: #f4f2fc; border-radius: 14px; }

.conversion { background: #f8f8fe; }
.conversion.is-playing { min-height: 315px; }
.conversion-header { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.conversion-header h2 { margin: 0; }
#conversion-toggle { min-height: 34px; padding: 5px 8px; font-size: .78rem; }
.conversion ol { margin: 8px 0 0; padding: 0; list-style: none; }
.conversion li { display: grid; gap: 3px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: .82rem; overflow-wrap: anywhere; }
.conversion li:last-child { border-bottom: 0; }
.conversion code { font: inherit; font-weight: 700; color: var(--accent); }
.conversion li span { color: var(--muted); }

.results > p { margin: 0; }
.bond-profile { padding: 12px; margin-bottom: 10px; border: 1px solid #e7def7; border-radius: 15px; background: linear-gradient(138deg, #f1ebfc, #f8f9ff); }
.bond-profile h3 { margin: 0; font-size: .81rem; }
.bond-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
#bond-info {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #eae3f8;
  color: var(--accent);
}
#bond-info:hover, #bond-info[aria-expanded="true"] { background: #ddd1f6; }
#bond-info span { width: 16px; height: 16px; border: 1px solid currentColor; border-radius: 50%; font-size: .72rem; line-height: 14px; font-weight: 700; }
.bond-profile #bond-explanation { margin-top: 9px; padding-top: 9px; border-top: 1px solid #e2dbed; }
.bond-heading { display: flex; justify-content: space-between; gap: 6px; align-items: baseline; margin-top: 7px; }
#bond-name { font-size: 1rem; letter-spacing: -.03em; }
#bond-value { color: var(--accent); font-size: .83rem; font-weight: 700; white-space: nowrap; }
.bond-pattern { display: flex; gap: 1px; margin-top: 8px; height: 9px; }
.bond-pattern i { flex: 1; min-width: 0; border-radius: 2px; background: #ded8ed; }
.bond-pattern .matched { background: #8c70d9; }
.bond-profile p { margin: 6px 0 0; }
#bond-story { border-top: 1px solid #e2dbed; padding-top: 6px; font-size: .82rem; line-height: 1.45; }
.score { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 10px; border-radius: 15px; background: #eef6fb; }
.score p { margin: 3px 0 0; }
.score .score-explanation { grid-column: 1 / -1; margin: 0; padding-top: 8px; border-top: 1px solid #d7e5ef; }
.score-ring {
  --ring-width: 6px;
  --ring-light: #7860d0;
  position: relative;
  width: 76px;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #fcfcff;
}
.score-arc { position: absolute; inset: 0; border-radius: 50%; border: var(--ring-width) solid #dcdaf3; pointer-events: none; }
.score-arc-fill { position: absolute; inset: calc(-1 * var(--ring-width)); border-radius: 50%; }
.score-arc-fill::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(var(--ring-light) var(--score-sweep, 0deg), transparent 0);
  mask: radial-gradient(circle closest-side, transparent calc(100% - var(--ring-width) - .5px), #000 calc(100% - var(--ring-width) + .5px), #000 calc(100% - .5px), transparent 100%);
}
.score-ring-partial .score-arc::before, .score-ring-partial .score-arc::after {
  content: "";
  position: absolute;
  inset: calc(-1 * var(--ring-width));
  z-index: 1;
  background: radial-gradient(circle at 50% calc(var(--ring-width) / 2), var(--ring-light) calc(var(--ring-width) / 2 - .4px), transparent calc(var(--ring-width) / 2 + .4px));
}
.score-ring-partial .score-arc::after { transform: rotate(var(--score-sweep)); }
.score strong { color: #40317e; font-size: 1.3rem; letter-spacing: -.055em; }
.chain-area { margin-top: 12px; }
.chain-area p { margin: 0; }
.chain { display: flex; flex-wrap: wrap; gap: 5px; max-height: 144px; overflow: auto; margin: 0; padding: 4px; list-style: none; }
.chain button[aria-pressed="true"] { border-color: #a48bdf; background: #e9dffa; }
.sequence-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 7px; margin: 12px 0 7px; }
.results .sequence-controls { margin-top: 24px; }
select { max-width: 100%; font-size: .85rem; }
.result-select {
  appearance: none;
  padding: 9px 38px 9px 13px;
  border-color: #d9d1ed;
  border-radius: 12px;
  background:
    linear-gradient(45deg, transparent 46%, #634cb7 48% 65%, transparent 67%) right 20px center / 5px 6px no-repeat,
    linear-gradient(135deg, transparent 32%, #634cb7 34% 51%, transparent 53%) right 15px center / 5px 6px no-repeat,
    linear-gradient(#fff, #f4f0fc);
  font-weight: 700;
}
.result-select:hover { border-color: #a794d8; }
#format { width: 100%; }
#repeat-count { min-width: 75px; }
@media (forced-colors: active) {
  .result-select { appearance: auto; background: none; padding-inline-end: 13px; }
}
.sequence-box { padding: 16px 9px; margin-bottom: 20px; border: 1px solid var(--border); border-radius: 12px; background: #f8f8fd; }
#sequence { display: block; color: var(--accent); font-size: .87rem; line-height: 1.5; overflow-wrap: anywhere; }
#skipped { margin: 8px 0 0; }
.result-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin-top: 12px; }
.result-actions > :is(#save-match, #download) { justify-content: center; gap: 6px; padding-inline: 8px; text-align: center; font-size: .84rem; }
#pdf-status:empty, #match-status:empty, #profile-status:empty, #clear-data-status:empty { display: none; }
.app-dialog { width: min(100% - 24px, 500px); max-height: calc(100dvh - 24px); padding: 20px; border: 1px solid var(--border); border-radius: 22px; background: var(--panel); color: var(--text); box-shadow: 0 18px 60px #514d8540; }
.app-dialog::backdrop { background: #25214866; }
#profiles { max-width: var(--input-box-max); }
#confirm-clear-data { max-width: 360px; }
.dialog-heading, .profile-create { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dialog-heading h2 { margin: 0; }
#profiles label { display: block; margin: 12px 0 5px; }
#active-profile, .profile-create input { width: 100%; min-width: 0; }
.profile-create button { flex: none; }
#profiles h3 { margin-bottom: 9px; font-size: 1rem; }
#saved-matches { margin: 0; padding: 0; list-style: none; }
#saved-matches li { display: flex; align-items: center; gap: 10px; margin-top: 6px; padding: 8px 10px; border: 1px solid transparent; background: var(--soft); border-radius: 12px; }
#saved-matches li.is-selected { border-color: #a794d8; background: #eee8fc; }
.saved-match-summary { display: flex; align-items: center; gap: 10px; flex: 1; align-self: stretch; min-width: 0; padding: 0; border: 0; background: transparent; color: inherit; text-align: left; overflow-wrap: anywhere; user-select: none; -webkit-touch-callout: none; touch-action: pan-y; }
#saved-matches li span { display: block; }
.saved-match-thumbnail { width: clamp(44px, 12vw, 68px); height: auto; flex: none; border-radius: 8px; background: linear-gradient(135deg, #e3f4f7, #ece4fb); pointer-events: none; }
#saved-matches .thumbnail-placeholder { display: grid; place-items: center; aspect-ratio: 4 / 3; padding: 2px; color: var(--muted); font-size: .66rem; line-height: 1.1; text-align: center; }
.saved-match-scores { margin-top: 3px; color: var(--accent); font-size: .76rem; line-height: 1.35; }
.profile-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
#confirm-clear-data .profile-actions { justify-content: flex-end; }
.export-options .profile-actions button[value="include"] { background: var(--accent); color: #fff; }
.export-options .profile-actions button[value="include"]:hover { background: #553bad; }
.profile-ghost { border: 1px solid #d9cff0; background: transparent; }
.profile-danger { background: #a43856; color: #fff; }
.profile-danger:hover { background: #872a45; }
.app-credit { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 0 28px 20px; color: var(--accent); font-size: .82rem; text-align: center; }
.credit-brand { display: flex; align-items: center; gap: 6px; }
.credit-brand img { flex: none; }
#open-privacy { padding: 5px 0; border: 0; background: transparent; color: inherit; text-decoration: none; text-underline-offset: 3px; }
#open-privacy:is(:hover, :focus-visible) { text-decoration: underline; }
#privacy a { color: var(--accent); }
#load-sample {
  min-height: 32px;
  margin-top: 17px;
  padding: 4px 10px;
  border: 1px solid #aa97d7;
  border-radius: 20px;
  background: transparent;
  color: var(--accent);
  font-size: .73rem;
}
#load-sample:hover { border-color: var(--accent); background: #f6f1fd; }
.shell {
  position: relative;
  isolation: isolate;
  width: 100%;
  min-height: 100svh;
  margin: 0;
  display: flex;
  flex-direction: column;
}
.shell, #method {
  background: radial-gradient(circle, #7667aa25 .65px, transparent 1.15px) center / 17px 17px,
    radial-gradient(ellipse at 100% 0, #cbf4e7 0, transparent 53%),
    radial-gradient(ellipse at 0 100%, #e0f0f7 0, transparent 51%),
    linear-gradient(138deg, #d9d0f7, #d9e4ef 52%, #d6ccf5);
}
#method {
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: clamp(24px, 4vw, 72px);
  border: 0;
  color: var(--text);
  overflow: auto;
}
#method[open] { display: flex; }
.method-content { width: min(100%, 1575px); margin: auto; min-width: 0; }
.method-content .dialog-heading { margin-bottom: 18px; }
.method-content h2 { font-size: clamp(1.35rem, 2vw, 1.8rem); }
.method-steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(16px, 2.8vw, 54px);
  list-style: none;
  margin: 0;
  padding: 0;
}
.method-card {
  padding: clamp(14px, 1.2vw, 23px);
  border-radius: 22px;
  background: var(--panel);
}
.method-card img { display: block; width: 100%; height: auto; border-radius: 18px; }
.method-card h3 { margin: 18px 0 6px; font-size: clamp(1.08rem, 1.57vw, 1.5rem); line-height: 1.2; }
.method-card p { margin: 0 0 12px; color: var(--muted); font-size: .92rem; line-height: 1.4; }
.method-scoring {
  margin-top: clamp(20px, 2.8vw, 40px);
  padding: clamp(18px, 2vw, 30px);
  border-radius: 22px;
  background: var(--panel);
}
.method-scoring h3 { margin: 0 0 8px; font-size: clamp(1.15rem, 1.57vw, 1.5rem); }
.method-scoring h4 { margin: 0 0 6px; font-size: 1rem; }
.method-scoring p { margin: 0; color: var(--muted); font-size: .92rem; line-height: 1.45; }
.scoring-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-block: 14px; }
.scoring-metrics > div { padding: 14px; border-radius: 14px; background: var(--soft); }
.scoring-example strong { color: var(--text); }
.scoring-disclaimer { margin: 20px auto 0; color: var(--accent); font-size: .82rem; line-height: 1.5; text-align: center; }
@media (max-width: 1000px) {
  .method-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .method-content { max-width: 420px; }
  .method-steps { grid-template-columns: minmax(0, 1fr); }
  .scoring-metrics { grid-template-columns: minmax(0, 1fr); }
}
.protein-scene {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.shell:has(.viewport:not([hidden])) .protein-scene { display: none; }
.protein {
  position: absolute;
  width: var(--size);
  aspect-ratio: 1;
  background: url("protein-ribbons.png") var(--crop, 0%) center / 300% 100% no-repeat;
  transform: translate(
    calc(var(--protein-x, 0) * var(--travel)),
    calc(var(--protein-y, 0) * var(--travel))
  ) rotate(var(--angle, 0deg));
}
.protein-far-left {
  --size: clamp(56px, 6vw, 106px); --crop: 100%; --travel: 7px; --angle: 18deg;
  top: 20%; left: 17%; opacity: .61; filter: blur(1px);
}
.protein-far-right {
  --size: clamp(48px, 5vw, 90px); --crop: 0%; --travel: 6px; --angle: -18deg;
  top: 25%; right: 9%; opacity: .58; filter: blur(1px);
}
.protein-middle-left {
  --size: clamp(130px, 19vw, 320px); --crop: 50%; --travel: 23px; --angle: -18deg;
  top: 36%; left: 5%; opacity: .95;
}
.protein-middle-right {
  --size: clamp(130px, 17vw, 285px); --crop: 0%; --travel: 20px; --angle: 21deg;
  top: 39%; right: 6%; opacity: .9;
}
.protein-near {
  --size: clamp(190px, 27vw, 460px); --crop: 100%; --travel: 43px; --angle: -24deg;
  right: -3%; bottom: -12%; opacity: .65; filter: blur(8px);
}
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .protein { transition: transform 180ms ease-out; }
}
@media (prefers-reduced-motion: reduce) {
  .protein-scene { --protein-x: 0; --protein-y: 0; }
}
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .shell:has(.viewport[hidden])::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background: radial-gradient(circle 120px at var(--grid-x, 50%) var(--grid-y, 50%),
      #8056c5 8%, #626bc3 42%, #398d9d 82%);
    mask: radial-gradient(circle, #000 .5px, #0007 1.25px, transparent 2.3px) center / 17px 17px,
      radial-gradient(circle 120px at var(--grid-x, 50%) var(--grid-y, 50%), #000 10%, #0008 55%, transparent 100%);
    mask-composite: intersect;
    opacity: 0;
    transition: opacity 160ms ease-out;
  }
  .shell.grid-active:has(.viewport[hidden])::before { opacity: .58; }
  .shell.grid-active:has(:is(.wordmark, .topbar-actions, .intro h1, .intro p, .builder, .app-credit):hover)::before {
    opacity: 0;
  }
}
.topbar-actions .method-link { border-radius: 28px; background: #f9f5ff; }
.topbar-actions .method-link:hover { background: #e8e1fa; }
#topbar-menu { display: none; }
#new-match { gap: 5px; background: linear-gradient(115deg, #624bc5, #7555c6); color: white; }
#new-match:hover { background: #553bad; }
.dna-emoji { font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; font-size: 1rem; line-height: 1; }
.shell:has(.viewport[hidden]) .intro { padding: clamp(35px, 7.6vh, 82px) 16px clamp(25px, 6.4vh, 69px); text-align: center; }
.shell:has(.viewport[hidden]) .intro h1 { width: fit-content; margin-inline: auto; font-size: clamp(2.1rem, 5vw, 3.7rem); letter-spacing: -.055em; }
.shell:has(.viewport[hidden]) .intro p { max-width: 38rem; margin: clamp(12px, 3vh, 31px) auto 0; color: var(--text); font-size: clamp(.95rem, 1.7vw, 1.2rem); line-height: 1.5; }
.shell:has(.viewport[hidden]) .workspace { display: block; padding: 0 16px 24px; }
.shell:has(.viewport[hidden]) .builder {
  width: min(100%, var(--input-box-max));
  margin: 0 auto;
  padding: clamp(20px, 3vw, 28px);
  border-color: #ffffff88;
  border-radius: 23px;
  background: #fff;
}
.shell:has(.viewport[hidden]) .builder h2 { margin-bottom: 5px; font-size: clamp(1.42rem, 2.2vw, 1.9rem); }
.shell:has(.viewport[hidden]) .builder input { min-height: clamp(48px, 5.7vh, 61px); background: #fff; }
.shell:has(.viewport[hidden]) .builder .primary { min-height: clamp(48px, 5.7vh, 61px); background: #6e50bf; box-shadow: none; }
.shell:has(.viewport[hidden]) .builder .primary:hover { background: #583ca6; }
.shell .app-credit { margin-top: auto; padding: 0 clamp(16px, 5vw, 96px) 30px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

@media (min-width: 721px) {
  .shell:has(.viewport:not([hidden])) > :is(.topbar, .workspace) {
    width: 100%;
    max-width: 1378px;
    margin-inline: auto;
    padding-inline: clamp(16px, 3.4vw, 46.85px);
  }
}
@media (max-width: 1000px) {
  .workspace { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-areas: "viewer viewer" "sidebar results"; }
}
@media (max-width: 720px) {
  .protein-middle-left, .protein-middle-right { display: none; }
  .protein-far-left { left: -18px; top: 25%; }
  .protein-far-right { right: -12px; top: 22%; }
  .protein-near { right: -110px; bottom: -74px; opacity: .42; }
  body {
    --mobile-gutter: clamp(23px, 7vw, 42px);
    --mobile-content-max: 500px;
    --mobile-content-width: min(calc(100% - 2 * var(--mobile-gutter)), var(--mobile-content-max));
  }
  body:has(.viewport[hidden]) { --mobile-content-max: var(--input-box-max); }
  .shell > :is(.topbar, .workspace, .app-credit), .app-dialog {
    width: var(--mobile-content-width);
    margin-inline: auto;
  }
  #confirm-clear-data { width: calc(var(--mobile-content-width) - 32px); }
  .topbar {
    position: relative;
    z-index: 1;
    padding: calc(env(safe-area-inset-top, 0px) + 44px) 0 10px;
  }
  .wordmark { font-size: 1.24rem; }
  .wordmark img { width: 56px; }
  .shell:has(.viewport[hidden]) .intro { padding: 22px 16px 25px; }
  .intro h1 { font-size: clamp(2rem, 8.8vw, 3.05rem); }
  .intro p { font-size: .89rem; }
  .workspace { display: flex; flex-direction: column; align-items: stretch; padding: 18px 0 24px; gap: 18px; }
  .shell:has(.viewport[hidden]) .workspace,
  .shell > .app-credit { padding-inline: 0; }
  .match-sidebar { gap: 18px; }
  .card, .viewport { border-radius: 18px; }
  .viewer-stage { height: clamp(158px, calc(62vw - 32px), 268px); }
  input, select { font-size: 1rem; }
  #topbar-menu {
    display: inline-grid;
    flex: 0 0 42px;
    place-items: center;
    padding: 0;
    border-radius: 50%;
  }
  #topbar-menu span { width: 16px; height: 2px; border-radius: 2px; background: currentColor; box-shadow: 0 -5px 0 currentColor, 0 5px 0 currentColor; }
  #topbar-menu[aria-expanded="false"] + .topbar-actions { display: none; }
  .topbar-actions {
    position: absolute;
    inset-block-start: 100%;
    inset-inline-end: 0;
    display: grid;
    justify-content: stretch;
    width: max-content;
    max-width: 100%;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--panel);
    box-shadow: 0 12px 30px #514d8526;
  }
  .topbar-actions .method-link { width: 100%; padding-inline: 12px; border-radius: 12px; font-size: .82rem; }
}
