:root {
  color-scheme: light;
  font: 16px/1.5 Inter, ui-sans-serif, system-ui, sans-serif;
  color: #22233a;
  background: #f7f8fc;
  --muted: #585d75;
  --edge: #dfe2ed;
  --accent: #5741ba;
  --accent-light: #eeebff;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
.start-screen, .workspace { width: 100%; }
.site-footer { margin-top: auto; padding: 16px 24px; border-top: 1px solid var(--edge); color: var(--muted); text-align: center; font-size: .875rem; }
h1, h2, h3, p, figure { margin: 0; }
h1 { font-size: clamp(2.25rem, 5vw, 3.35rem); letter-spacing: -.065em; line-height: 1.1; }
h2 { font-size: 1.23rem; letter-spacing: -.025em; }
h3 { font-size: 1rem; }
p { color: var(--muted); }
.topbar { background: #fff; border-bottom: 1px solid var(--edge); }
.topbar-inner, .start-screen { max-width: 1144px; margin-inline: auto; padding-inline: 28px; }
.start-screen { padding-bottom: 48px; }
.review-open .topbar-inner { max-width: 1680px; }
.topbar-inner { min-height: 65px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: inline-flex; gap: 11px; align-items: center; color: inherit; font-weight: 760; letter-spacing: -.025em; text-decoration: none; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.topbar-actions .demo-badge { white-space: nowrap; }
.new-comparison { padding: 7px 12px; border: 1px solid var(--edge); border-radius: 8px; color: var(--accent); font-size: .875rem; font-weight: 680; text-decoration: none; white-space: nowrap; }
.new-comparison:hover { background: var(--accent-light); }
.mark { flex: none; }
.empty-icon::before, .empty-icon::after { position: absolute; content: ''; width: 10px; height: 10px; border: 1.5px solid currentColor; border-radius: 2px; }
.demo-badge, .viewport, .simulated { display: inline-flex; align-items: center; gap: 7px; font-size: .875rem; font-weight: 650; border-radius: 999px; padding: 5px 12px; }
.demo-badge { background: var(--accent-light); color: #47339c; }
.demo-badge span { background: #7556dc; width: 7px; height: 7px; border-radius: 100%; }
.intro { padding: 59px 0 29px; }
.intro p { margin-top: 10px; font-size: 1.08rem; }
.card { background: white; border: 1px solid var(--edge); border-radius: 16px; box-shadow: 0 3px 10px #29264a06; }
.setup { padding: 25px; }
.setup-heading p { margin-top: 5px; }
.url-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 22px; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 650; font-size: .9rem; }
input, select, button { font: inherit; }
input, select { width: 100%; border: 1px solid #c9cde0; border-radius: 8px; padding: 10px 12px; background: #fff; color: #25263c; font-weight: 450; }
input { font-size: .96rem; }
select { appearance: none; padding-right: 32px; background: linear-gradient(45deg, transparent 50%, #565b73 50%) right 15px center / 5px 5px no-repeat, linear-gradient(135deg, #565b73 50%, transparent 50%) right 10px center / 5px 5px no-repeat, #fff; }
button { cursor: pointer; border: 0; border-radius: 8px; font-weight: 680; }
button:disabled { cursor: wait; opacity: .65; }
:where(a, button, input, select, textarea):focus:not(:focus-visible, .highlight, .match-preview-region) { outline: none; }
:focus-visible { outline: 2px solid #8065e8; outline-offset: 2px; }
select:focus-visible { outline: none; border-color: #8065e8; box-shadow: inset 0 0 0 1px #8065e8; }
#review-title:focus { outline: none; }
input[aria-invalid=true] { border-color: #b4233b; }
.error { margin-top: 9px; color: #a51e35; }
.form-footer { margin-top: 20px; display: flex; justify-content: space-between; align-items: end; gap: 14px; }
.fixture { width: 230px; }
.primary { color: white; background: var(--accent); padding: 11px 18px; }
.primary:hover:not(:disabled) { background: #4632a0; }
.workspace { margin: 0 auto; max-width: 1680px; padding: 26px 28px 36px; }
.workspace-heading h1 { font-size: clamp(1.5rem, 3vw, 2.15rem); letter-spacing: -.045em; }
.workspace-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 18px; }
.viewport, .simulated { color: var(--muted); background: #eceef6; }
.placeholder { display: grid; min-height: min(520px, 65vh); place-items: center; padding: 28px 16px; background: #edf0f7; text-align: center; }
.status-body { width: min(100%, 410px); padding: 28px 20px; border: 1px solid var(--edge); border-radius: 12px; background: white; }
.placeholder p { margin-top: 5px; }
.empty-icon { display: block; margin: 0 auto 12px; width: 48px; height: 48px; background: var(--accent-light); color: var(--accent); border-radius: 13px; position: relative; }
.empty-icon::before, .empty-icon::after { height: 14px; width: 14px; }
.empty-icon::before { top: 13px; left: 13px; }
.empty-icon::after { top: 19px; left: 19px; }
.progress { max-width: 360px; width: 100%; margin: 18px auto 0; height: 7px; display: block; accent-color: var(--accent); }
.review-retry { margin-top: 16px; }
.placeholder .progress-note { margin-top: 12px; color: var(--muted); font-size: .875rem; }
@media (prefers-reduced-motion: no-preference) {
  .loading-mark { animation: loading-mark-pulse 2.4s ease-in-out infinite; }
}
@keyframes loading-mark-pulse {
  50% { transform: scale(1.12); }
}
.report { overflow: hidden; }
.report-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0 16px; padding: 0 16px; border-bottom: 1px solid var(--edge); }
.render-picker { position: relative; display: flex; align-items: center; gap: 8px; max-width: 100%; font-size: .9rem; font-weight: 650; }
#review-target { margin-inline-start: auto; min-width: 0; }
.report-target { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; max-width: 100%; }
.preview-status { position: absolute; z-index: 2; inset: 0; display: grid; place-content: center; justify-items: center; gap: 8px; padding: 12px; text-align: center; pointer-events: none; }
.preview-status button { pointer-events: auto; }
.preview-message { padding: 7px 12px; border: 2px solid #000; border-radius: 8px; color: #25263c; background: #fffffff2; font-size: .875rem; box-shadow: 0 1px 8px #23274322; }
.frame.preview-pending img { filter: grayscale(1); opacity: .55; }
.review-layout { display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; background: #edf0f7; }
.review-layout:has(.explanation:not([hidden])) { grid-template-columns: minmax(0, 1fr) minmax(265px, 24%); align-items: stretch; }
.viewer { min-width: 0; }
.viewer-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 10px 12px; background: white; border-bottom: 1px solid var(--edge); }
.image-switch { display: inline-flex; gap: 4px; padding: 3px; border-radius: 8px; background: #eceef6; }
.image-switch button { padding: 5px 12px; background: transparent; color: var(--muted); font-size: .88rem; }
.image-switch button[aria-pressed=true] { color: #47339c; background: white; box-shadow: 0 1px 3px #29264a22; }
.lens-picker { position: relative; display: flex; align-items: center; gap: 8px; min-width: 0; max-width: 100%; margin-inline-start: auto; }
.lens-trigger { width: 195px; min-width: 0; min-height: 33px; padding: 5px 32px 5px 12px; border: 1px solid #c9cde0; color: #25263c; text-align: left; font-size: .875rem; font-weight: 450; background: linear-gradient(45deg, transparent 50%, #565b73 50%) right 15px center / 5px 5px no-repeat, linear-gradient(135deg, #565b73 50%, transparent 50%) right 10px center / 5px 5px no-repeat, #fff; }
.lens-trigger:focus-visible { outline: none; border-color: #8065e8; box-shadow: inset 0 0 0 1px #8065e8; }
.lens-trigger:disabled { cursor: default; }
.lens-options { position: absolute; z-index: 3; inset-inline-end: 0; top: calc(100% + 5px); width: min(320px, calc(100vw - 68px)); padding: 4px; border: 1px solid var(--edge); border-radius: 8px; background: white; box-shadow: 0 8px 22px #23274326; }
.lens-option { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; padding: 8px; border-radius: 4px; background: white; color: #25263c; font-size: .875rem; font-weight: 450; text-align: left; }
.lens-option[aria-checked=true] { color: var(--accent); font-weight: 650; }
.lens-option:hover, .lens-option:focus-visible { background: var(--accent-light); outline-offset: -2px; }
.lens-alias { visibility: hidden; padding: 2px 5px; border-radius: 4px; background: #383052; color: white; font-size: .75rem; font-weight: 450; }
.lens-option:hover .lens-alias, .lens-option:focus-visible .lens-alias { visibility: visible; }
.preview-trigger { display: inline-flex; align-items: center; gap: 7px; width: auto; }
.preview-target-icon { display: inline-flex; width: 18px; height: 18px; flex: none; }
.preview-target-icon svg { width: 100%; height: 100%; }
.preview-target-options { width: min(240px, calc(100vw - 48px)); }
.preview-target-option { justify-content: flex-start; gap: 10px; }
.preview-target-detail { display: flex; flex-direction: column; }
.preview-target-detail small { color: var(--muted); }
.highlight-toggle { flex-direction: row; align-items: center; gap: 8px; }
.highlight-toggle input { width: 16px; height: 16px; accent-color: var(--accent); }
.image-canvas { display: grid; min-height: min(520px, 65vh); place-items: center; padding: clamp(12px, 2.5vw, 32px); }
.frame { position: relative; width: min(100%, 1120px, max(660px, calc((100dvh - 225px) * 1.5))); aspect-ratio: var(--render-ratio, 1.5); box-shadow: 0 3px 20px #23274321; }
.frame.portrait-frame { width: min(100%, 440px, max(280px, calc((100dvh - 225px) * var(--render-ratio)))); }
.frame img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: contain; }
.image-status { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: .875rem; background: #f6f7fc; }
.highlight { --pulse-color: #8018ac; position: absolute; padding: 0; border: 0; border-radius: 3px; outline: 2px solid #8018ac; background: #d851e96b; }
.highlight::before, .match-preview-region::before { content: ''; position: absolute; top: 50%; left: 50%; width: max(100%, 24px); height: max(100%, 20px); transform: translate(-50%, -50%); }
.highlight:focus-visible { outline-color: #5335d4; outline-offset: 3px; }
.highlight:hover, .highlight[aria-expanded=true] { background: #c132e695; }
.explanation { min-width: 0; padding: 16px; border-left: 1px solid var(--edge); background: white; }
.explanation:focus-visible { outline-offset: -3px; }
.explanation-heading { display: flex; align-items: start; justify-content: space-between; gap: 8px; }
.explanation-heading h3 { padding-top: 4px; }
.panel-close { flex: none; width: 32px; height: 32px; background: #eceef6; color: #3b3d56; font-size: 1.25rem; line-height: 1; }
.panel-close:hover { background: var(--accent-light); }
.explanation p { margin-top: 10px; }
.notice { padding: 10px 16px; border-top: 1px solid var(--edge); background: white; font-size: .875rem; }
.explanation dl { display: grid; gap: 3px; margin: 16px 0 0; padding: 12px; border-radius: 8px; background: #f6f3ff; }
.explanation dd + dt { margin-top: 7px; }
.explanation dt { font-weight: 650; }
.explanation dd { margin: 0; }
.explanation[hidden] { display: none; }
.secondary { font-size: .875rem; background: var(--accent-light); color: #47339c; padding: 8px 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (min-width: 801px) and (min-height: 620px) {
  body.review-open { height: 100dvh; min-height: 0; }
  .review-open .topbar, .review-open .site-footer { flex: none; }
  .review-open .site-footer { padding-block: 9px; }
  .workspace, #result, .report, .viewer { display: flex; flex-direction: column; min-height: 0; }
  .workspace, #result, .report { flex: 1; }
  .workspace { padding-block: 18px 16px; }
  .workspace-heading { flex: none; margin-bottom: 12px; }
  .report-head, .viewer-toolbar { flex: none; }
  .review-layout { flex: 1; min-height: 0; grid-template-rows: minmax(0, 1fr); align-items: stretch; }
  .review-layout .explanation { min-height: 0; overflow: auto; }
  .image-canvas { flex: 1; min-height: 0; padding: 16px; container-type: size; }
  .frame { width: min(1120px, 100cqw, calc(100cqh * var(--render-ratio, 1.5))); }
  .frame.portrait-frame { width: min(440px, 100cqw, calc(100cqh * var(--render-ratio, 1.5))); }
}
@media (max-width: 800px) {
  .review-layout:has(.explanation:not([hidden])) { grid-template-columns: minmax(0, 1fr); }
  .image-canvas { min-height: 0; }
  .explanation { border-left: 0; border-top: 1px solid var(--edge); }
}
@media (max-width: 720px) {
  .topbar-inner, .start-screen, .workspace { padding-inline: 17px; }
  .intro { padding-top: 38px; }
  .setup { padding: 16px; }
  .url-fields { grid-template-columns: 1fr; }
  .form-footer { flex-wrap: wrap; }
  .viewport { white-space: nowrap; }
}
@media (max-width: 420px) {
  .topbar-inner { padding-block: 10px; }
  .topbar-actions { flex-wrap: wrap; justify-content: end; gap: 5px; }
  .workspace-heading { flex-wrap: wrap; }
}

.result-views { display: flex; gap: 16px; }
.result-views button { border-radius: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); padding: 10px 4px; }
.result-views button[aria-pressed=true] { border-bottom-color: var(--accent); color: var(--accent); }
.highlight[aria-pressed=true] { background: #c132e695; }
.explanation > .secondary { margin-top: 16px; }
.cause-picker { margin: 14px 0; }
.element-path { display: block; margin-top: 14px; overflow-wrap: anywhere; }
.cause-details dd { overflow-wrap: anywhere; }
.cause-before { color: #8e303b; }
.cause-after { color: #276448; }

.cause-details code {
  padding: 2px 5px;
  border: 1px solid #29264a24;
  border-radius: 4px;
  background: #ffffffb3;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: .86em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
.cause-details .element-path { width: fit-content; max-width: 100%; }

.match-preview { position: absolute; inset: 0; pointer-events: none; }
.match-preview-region { --pulse-color: #a51aca; position: absolute; padding: 0; border: 0; border-radius: 0; pointer-events: auto; background: #dc52ef82; }
.match-preview-region:hover { background: #c132e695; }
.match-preview-region.element-outline { outline: 2px solid #a51aca; border-radius: 3px; background: #dc52ef64; }

.recent-shares { margin-top: 20px; padding: 20px; }
#recent-share-list { list-style: none; margin: 12px 0 0; padding: 0; }
.recent-share { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 10px 0; border-top: 1px solid var(--edge); }
.recent-share > div { flex: 1 1 180px; min-width: 0; overflow-wrap: anywhere; }
.recent-share-label { display: block; max-width: 100%; padding: 0; background: transparent; color: inherit; text-align: left; font-weight: 650; overflow-wrap: anywhere; }
.recent-share-label:hover, .recent-share-label:focus-visible { text-decoration: underline dotted; text-underline-offset: .2em; }
.recent-share-label:focus-visible { outline: none; }
.share-icon { display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 7px; border-radius: 7px; background: var(--accent-light); color: #47339c; }
.share-icon svg { width: 100%; height: 100%; }
.share-icon:hover { background: #e1d9ff; }
.recent-share small { color: var(--muted); }
#show-all-shares { margin-top: 8px; }
#share-dialog { width: min(460px, calc(100% - 32px)); padding: 24px; border: 1px solid var(--edge); border-radius: 14px; color: inherit; }
#share-dialog::backdrop { background: #22233a55; }
#share-dialog p, #share-dialog label { margin-top: 10px; }
.share-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

.share-rename { display: flex; flex: 1 1 300px; flex-wrap: wrap; align-items: end; gap: 8px; }
.share-rename label { flex: 1 1 170px; }
.share-rename input { padding-block: 6px; }
.revoke-share { color: #a51e35; background: #fff0f3; }
.revoke-share:hover { background: #ffe0e7; }

.share-toast { position: fixed; z-index: 5; inset-inline-end: 24px; bottom: 24px; max-width: calc(100vw - 48px); padding: 10px 14px; border-radius: 8px; color: white; background: #22233a; box-shadow: 0 4px 16px #23274326; font-size: .875rem; pointer-events: none; }
.share-toast:empty { visibility: hidden; }

.highlight-pulse::after { content: ''; position: absolute; z-index: 1; top: 50%; left: 50%; width: clamp(24px, 100%, 64px); aspect-ratio: 1; border: 2px solid var(--pulse-color); border-radius: 50%; pointer-events: none; animation: highlight-ripple 650ms ease-out both; }
@keyframes highlight-ripple {
  from { transform: translate(-50%, -50%) scale(.45); opacity: .9; }
  to { transform: translate(-50%, -50%) scale(2.3); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .highlight-pulse::after { content: none; animation: none; }
}
