/* shared/worksheet.css — the "Download worksheet" button (in the share bar) and its dialog (shared/worksheet.js).
   The dialog is the site's dark glass; the preview on the right is white paper so it reads as the printout. */

/* ── button in the share bar ── */
.ws-open {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px 0 13px;
  margin-left: auto; border: 1px solid rgba(45,212,191,.45); border-radius: 10px; cursor: pointer;
  background: linear-gradient(180deg, rgba(45,212,191,.2), rgba(45,212,191,.1)); color: var(--text);
  font: 700 .82rem/1 var(--font); white-space: nowrap;
  transition: transform .18s, box-shadow .18s, background .18s;
}
.ws-open svg { width: 18px; height: 18px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ws-open:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(45,212,191,.25); background: rgba(45,212,191,.24); }
.ws-open:active { transform: scale(.97); }
.ws-open:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ws-open .ws-open-short { display: none; }
.share-bar .ws-open + .btn-report { margin-left: 0; }
/* top banner variant: sits beside the SI | US pills, same height */
.ws-open.ws-open-top { height: 36px; margin-left: 0; padding: 0 14px 0 11px; border-radius: 999px; font-size: .78rem; }
@media (max-width: 767px) {
  .ws-open.ws-open-top { width: 100%; justify-content: center; height: 34px; }
  .ws-open-top .ws-open-long { display: none; }
  .ws-open-top .ws-open-short { display: inline; }
}
@container (max-width: 760px) {
  .share-bar .ws-open .ws-open-long { display: none; }
  .share-bar .ws-open .ws-open-short { display: inline; }
}
@container (max-width: 400px) {
  .share-bar .ws-open { height: 36px; padding: 0 11px 0 9px; border-radius: 8px; }
}

/* ── dialog ── */
html.ws-dlg-open { overflow: hidden; }
.ws-overlay {
  position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(5,8,14,.72); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  opacity: 0; transition: opacity .2s ease;
}
.ws-overlay[hidden] { display: none; }
.ws-overlay.in { opacity: 1; }
.ws-sheet {
  position: relative; display: flex; flex-direction: column; width: min(880px, 100%); max-height: calc(100dvh - 32px);
  background: rgba(22,27,39,.97); border: 1px solid rgba(255,255,255,.1); border-radius: 22px;
  box-shadow: 0 40px 100px rgba(0,0,0,.6); color: var(--text); font-family: var(--font);
  transform: translateY(12px) scale(.98); transition: transform .32s cubic-bezier(.2,.9,.3,1);
}
.ws-overlay.in .ws-sheet { transform: none; }
.ws-close {
  position: absolute; top: 12px; right: 12px; z-index: 2; width: 36px; height: 36px; border: 0; border-radius: 50%;
  background: rgba(255,255,255,.07); color: var(--text-dim); font-size: 1.45rem; line-height: 1; cursor: pointer;
}
.ws-close:hover { background: rgba(255,255,255,.13); color: var(--text); }
.ws-body { display: grid; grid-template-columns: minmax(0, 1fr) 236px; gap: 26px; padding: 26px 26px 6px; overflow-y: auto; overscroll-behavior: contain; }

.ws-kicker { display: flex; align-items: center; gap: 8px; font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.ws-kicker-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(45,212,191,.18); }
.ws-main h2 { margin: 6px 0 4px; font-size: 1.45rem; line-height: 1.2; letter-spacing: -.01em; }
.ws-lede { margin: 0 0 10px; color: #aab3c7; font-size: .88rem; line-height: 1.5; }
.ws-facts, .ws-topics { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; padding: 0; list-style: none; }
.ws-facts li { padding: 4px 10px; border-radius: 999px; background: rgba(255,255,255,.06); font-size: .76rem; color: #aab3c7; }
.ws-facts strong { color: var(--text); }
.ws-topics li { padding: 3px 9px; border-radius: 7px; border: 1px solid var(--border); font-size: .72rem; color: #c3cad9; }

.ws-fields { min-width: 0; margin: 14px 0 0; padding: 14px 16px 12px; border: 1px solid var(--border); border-radius: 14px; background: rgba(255,255,255,.025); }
.ws-fields legend { padding: 0 6px; margin-left: -6px; font-weight: 700; font-size: .92rem; }
.ws-opt { margin-left: 6px; padding: 2px 8px; border-radius: 999px; background: rgba(45,212,191,.14); color: var(--accent); font-size: .68rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; vertical-align: 2px; }
.ws-hint { margin: 2px 0 10px; font-size: .78rem; color: #8f99ae; line-height: 1.45; }
.ws-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.ws-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ws-field span { font-size: .74rem; font-weight: 600; color: #aab3c7; }
.ws-field input {
  height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border); background: rgba(5,8,14,.45);
  color: var(--text); font: 500 .9rem var(--font); min-width: 0; transition: border-color .15s, box-shadow .15s;
}
.ws-field input::placeholder { color: #5d6782; }
.ws-field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(45,212,191,.18); }
.ws-privacy { display: flex; gap: 10px; align-items: flex-start; margin: 12px 0 0; padding: 10px 12px; border-radius: 10px; background: rgba(61,220,132,.08); border: 1px solid rgba(61,220,132,.22); font-size: .78rem; line-height: 1.45; color: #b9e9cd; }
.ws-privacy svg { flex: none; width: 16px; height: 16px; margin-top: 1px; fill: var(--green); }
.ws-privacy strong { color: #dff7e9; }

.ws-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0 8px; }
.ws-check { position: relative; display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); cursor: pointer; font-size: .84rem; }
.ws-check:hover { border-color: #3a4366; }
.ws-check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ws-check-box { flex: none; width: 20px; height: 20px; margin-top: 1px; border-radius: 6px; border: 1.5px solid #4a5580; background: rgba(5,8,14,.45); transition: background .15s, border-color .15s; }
.ws-check input:checked + .ws-check-box { background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5' fill='none' stroke='%230d1117' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/16px no-repeat; border-color: var(--accent); }
.ws-check input:focus-visible + .ws-check-box { outline: 2px solid var(--accent); outline-offset: 2px; }
.ws-check small, .ws-version small { display: block; margin-top: 2px; font-size: .72rem; color: #8f99ae; line-height: 1.4; }
.ws-version { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); font-size: .84rem; }
.ws-version label { font-weight: 700; }
.ws-version input { width: 64px; height: 32px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--border); background: rgba(5,8,14,.45); color: var(--text); font: 600 .9rem ui-monospace, SFMono-Regular, Menlo, monospace; text-align: center; }
.ws-version input:focus { outline: none; border-color: var(--accent); }
.ws-shuffle { height: 32px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--border); background: rgba(255,255,255,.05); color: var(--text); font: 600 .78rem var(--font); cursor: pointer; }
.ws-shuffle:hover { background: rgba(255,255,255,.1); }
.ws-version small { flex-basis: 100%; }

/* ── questions and marks ── */
.ws-marks { margin: 6px 0 0; }
.ws-sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 0 0 8px; }
.ws-sec-head h3 { margin: 0; font-size: .92rem; }
.ws-total { font-size: .8rem; color: #aab3c7; }
.ws-total b { color: var(--accent); font-size: 1rem; }
.ws-presets { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.ws-preset {
  display: flex; align-items: center; gap: 10px; min-height: 58px; padding: 8px 10px; text-align: left; cursor: pointer;
  border: 1px solid var(--border); border-radius: 12px; background: rgba(255,255,255,.025); color: var(--text); font-family: var(--font);
  transition: border-color .15s, background .15s, transform .1s;
}
.ws-preset:hover { border-color: #3a4366; background: rgba(255,255,255,.05); }
.ws-preset:active { transform: scale(.98); }
.ws-preset.on { border-color: var(--accent); background: rgba(45,212,191,.1); box-shadow: 0 0 0 1px var(--accent) inset; }
.ws-preset:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ws-pm { flex: none; display: grid; place-items: center; width: 44px; height: 42px; border-radius: 10px; background: rgba(255,255,255,.06); line-height: 1; }
.ws-pm b { font-size: 1.15rem; }
.ws-pm i { font-style: normal; font-size: .58rem; color: #8f99ae; text-transform: uppercase; letter-spacing: .05em; }
.ws-preset.on .ws-pm { background: var(--accent); color: #062420; }
.ws-preset.on .ws-pm i { color: #0b4a40; }
.ws-pt { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ws-pt strong { font-size: .82rem; }
.ws-pt small { font-size: .7rem; color: #8f99ae; line-height: 1.3; }
.ws-preset-custom:not(.on) { border-style: dashed; }
.ws-custom { margin-top: 10px; border: 1px solid var(--border); border-radius: 12px; background: rgba(255,255,255,.02); }
.ws-custom summary { display: flex; align-items: center; gap: 8px; padding: 10px 12px; cursor: pointer; font-size: .82rem; font-weight: 600; color: #c3cad9; list-style: none; }
.ws-custom summary::-webkit-details-marker { display: none; }
.ws-custom summary::before { content: ''; width: 7px; height: 7px; border-right: 2px solid var(--accent); border-bottom: 2px solid var(--accent); transform: rotate(-45deg); transition: transform .15s; }
.ws-custom[open] summary::before { transform: rotate(45deg); }
.ws-custom summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 12px; }
.ws-qlist { margin: 0; padding: 0 12px 4px; list-style: none; counter-reset: q; }
.ws-qlist li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid rgba(255,255,255,.06); }
.ws-qcheck { position: relative; flex: 1; min-width: 0; display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.ws-qcheck input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ws-qcheck input:checked + .ws-check-box { background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5' fill='none' stroke='%230d1117' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/16px no-repeat; border-color: var(--accent); }
.ws-qcheck input:focus-visible + .ws-check-box { outline: 2px solid var(--accent); outline-offset: 2px; }
.ws-qt { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ws-qt strong { font-size: .84rem; }
.ws-qt small { font-size: .72rem; color: #8f99ae; line-height: 1.35; }
.ws-qlist li.off .ws-qt { opacity: .55; }
.ws-step { flex: none; display: flex; align-items: center; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.ws-step button { width: 34px; height: 34px; border: 0; background: rgba(255,255,255,.05); color: var(--text); font: 700 1rem var(--font); cursor: pointer; }
.ws-step button:hover:not(:disabled) { background: rgba(45,212,191,.18); }
.ws-step button:disabled { opacity: .3; cursor: default; }
.ws-step button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.ws-step output { min-width: 34px; text-align: center; font: 700 .92rem ui-monospace, SFMono-Regular, Menlo, monospace; }
.ws-qnote { margin: 6px 12px 10px; }

/* ── live paper preview ── */
.ws-preview { align-self: start; position: sticky; top: 0; padding-top: 30px; }
.ws-paper {
  aspect-ratio: 210 / 297; padding: 9% 8% 6%; border-radius: 4px; background: #fff; color: #181c28;
  box-shadow: 0 1px 0 rgba(255,255,255,.4) inset, 0 20px 50px rgba(0,0,0,.45); font-family: Helvetica, Arial, sans-serif;
  display: flex; flex-direction: column; overflow: hidden; transform: rotate(-1.2deg);
}
.ws-p-head { display: flex; align-items: center; gap: 5px; }
.ws-p-head img { width: 15px; height: 15px; }
.ws-p-head b { display: block; font-size: 7.5px; }
.ws-p-head i { display: block; font-style: normal; font-size: 5px; color: #6a7286; }
.ws-p-qr { margin-left: auto; width: 34px; height: 34px; border: 1px solid #dde1e8; border-radius: 3px; padding: 2px; background: #fff; }
.ws-p-qr canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; }
.ws-p-school { min-height: 0; margin-top: 3px; font-size: 6.5px; font-weight: 700; color: #0b7a5c; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-p-kick { font-size: 4.6px; font-weight: 700; letter-spacing: .06em; color: #0b7a5c; margin-top: 1px; }
.ws-p-title { font-size: 10px; font-weight: 700; line-height: 1.15; margin: 1px 0 5px; }
.ws-p-box { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 6px; padding: 5px 6px; border: 1px solid #dde1e8; border-radius: 3px; background: #f4f6f9; }
.ws-p-box div { display: flex; align-items: flex-end; gap: 3px; min-width: 0; font-size: 5px; color: #6a7286; }
.ws-p-box em { flex: 1; min-width: 0; height: 7px; border-bottom: 0.7px solid #a3a9b6; font-style: normal; font-weight: 700; font-size: 5.6px; color: #181c28; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 7px; }
.ws-p-box em.ws-p-filled { color: #181c28; animation: ws-ink .35s ease; }
@keyframes ws-ink { from { background: rgba(45,212,191,.35); } to { background: transparent; } }
.ws-p-score { justify-content: center; font-weight: 700; color: #0b7a5c !important; }
.ws-p-q { display: flex; align-items: center; gap: 4px; margin-top: 7px; }
.ws-p-q b { display: grid; place-items: center; width: 8px; height: 7px; border-radius: 1.5px; background: #0d9488; color: #fff; font-size: 5px; }
.ws-p-q i { height: 3px; width: 60%; border-radius: 2px; background: #c9ced8; }
.ws-p-lines { margin: 4px 0 0 12px; }
.ws-p-lines i { display: block; height: 0; border-bottom: .7px solid #dde1e8; margin-top: 6px; }
.ws-p-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin: 5px 0 0 12px; }
.ws-p-cards i { aspect-ratio: 1; border: 1px solid #dde1e8; border-radius: 3px; background: linear-gradient(#eaf7f3, #eaf7f3) center 40%/45% 45% no-repeat; }
.ws-p-foot { display: flex; justify-content: space-between; margin-top: auto; padding-top: 3px; border-top: .7px solid #dde1e8; font-size: 4.4px; color: #8a91a2; }
.ws-p-foot span:first-child::before { content: 'visualizebiology.com'; }
.ws-p-cap { margin: 12px 0 0; text-align: center; font-size: .72rem; color: #6b7a99; }

/* ── footer: status + buttons ── */
.ws-foot { display: flex; align-items: center; gap: 14px; padding: 14px 26px 18px; border-top: 1px solid rgba(255,255,255,.07); }
.ws-status { flex: 1; min-width: 0; margin: 0; font-size: .8rem; line-height: 1.45; color: #aab3c7; }
.ws-status.ws-ok strong { color: var(--green); }
.ws-status.ws-err { color: #ff8a8a; }
.ws-status a { color: var(--accent); }
.ws-btns { display: flex; gap: 10px; flex: none; }
.ws-skip, .ws-go { height: 44px; padding: 0 18px; border-radius: 12px; font: 700 .88rem var(--font); cursor: pointer; transition: transform .1s, filter .15s, background .15s; }
.ws-skip { border: 1px solid var(--border); background: transparent; color: var(--text); }
.ws-skip:hover { background: rgba(255,255,255,.06); }
.ws-go { display: inline-flex; align-items: center; gap: 8px; border: 0; background: var(--accent); color: #062420; box-shadow: 0 8px 22px rgba(45,212,191,.28); }
.ws-go svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.ws-go:hover { filter: brightness(1.08); }
.ws-skip:active, .ws-go:active { transform: scale(.97); }
.ws-skip:disabled, .ws-go:disabled { opacity: .55; cursor: progress; }
.ws-skip:focus-visible, .ws-go:focus-visible, .ws-close:focus-visible, .ws-shuffle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ws-spin { display: inline-block; width: 13px; height: 13px; margin-right: 8px; vertical-align: -2px; border-radius: 50%; border: 2px solid rgba(45,212,191,.3); border-top-color: var(--accent); animation: ws-spin .8s linear infinite; }
@keyframes ws-spin { to { transform: rotate(360deg); } }

/* ── narrow windows: the form alone ── */
@media (max-width: 860px) {
  .ws-body { grid-template-columns: minmax(0, 1fr); }
  .ws-preview { display: none; }
}
/* ── phones: one column, no preview, buttons stacked full width ── */
@media (max-width: 720px) {
  .ws-overlay { padding: 0; align-items: flex-end; }
  .ws-sheet { width: 100%; max-height: 94dvh; border-radius: 20px 20px 0 0; border-bottom: 0; }
  .ws-body { grid-template-columns: 1fr; padding: 22px 16px 4px; }
  .ws-preview { display: none; }
  .ws-main h2 { font-size: 1.25rem; padding-right: 36px; }
  .ws-grid, .ws-opts { grid-template-columns: 1fr; }
  .ws-presets { grid-template-columns: 1fr 1fr; }
  .ws-step button { width: 40px; height: 40px; }
  .ws-field input { font-size: 16px; }    /* iOS does not zoom into a 16 px field */
  .ws-foot { flex-direction: column-reverse; align-items: stretch; gap: 10px; padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); }
  .ws-btns { flex-direction: column-reverse; }
  .ws-skip, .ws-go { width: 100%; justify-content: center; }
  .ws-status:empty { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .ws-overlay, .ws-sheet, .ws-open { transition: none; }
  .ws-sheet { transform: none; }
  .ws-p-box em.ws-p-filled, .ws-spin { animation: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .ws-overlay { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(5,8,14,.92); }
}
