
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #eff1f4;
  --text: #15181d;
  --muted: #596170;
  --rule: #e3e6eb;
  --chip-border: #c9ced6;
  --field-border: #8c939e;
  --accent: #1f56a8;
  --accent-strong: #17468c;
  --accent-soft: #e8effa;
  --accent-fill: #1f56a8;
  --accent-fill-strong: #17468c;
  --on-fill: #ffffff;
  --ok: #1e6b3a;
  --error: #b3261e;
  --hover-bg: var(--surface-2);
  --shadow-sm: 0 1px 2px rgb(16 24 40 / 0.06);
  --shadow-md: 0 1px 2px rgb(16 24 40 / 0.05), 0 6px 16px -4px rgb(16 24 40 / 0.08);
  --shadow-lg: 0 2px 6px rgb(16 24 40 / 0.06), 0 18px 40px -12px rgb(16 24 40 / 0.22);

  --sans: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif;
  --display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --r-sm: 3px;
  --r-md: 4px;
  --r-lg: 6px;
  --page: 60rem;
  --pad: clamp(1rem, 3vw, 2rem);
  --measure: none; 
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1114;
    --surface: #161a1f;
    --surface-2: #1e232a;
    --text: #e7eaee;
    --muted: #9ba3ae;
    --rule: #262c34;
    --chip-border: #3b424c;
    --field-border: #646d79;
    --accent: #8ab4f8;
    --accent-strong: #aecbfa;
    --accent-soft: #1b2a40;
    --accent-fill: #2f66c4;
    --accent-fill-strong: #3a72d1;
    --on-fill: #ffffff;
    --ok: #81c995;
    --error: #f2b8b5;
    --shadow-sm: 0 0 0 1px rgb(255 255 255 / 0.02);
    --shadow-md: 0 1px 2px rgb(0 0 0 / 0.4), 0 8px 24px -8px rgb(0 0 0 / 0.5);
    --shadow-lg: 0 2px 6px rgb(0 0 0 / 0.4), 0 18px 40px -12px rgb(0 0 0 / 0.6);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0f1114;
  --surface: #161a1f;
  --surface-2: #1e232a;
  --text: #e7eaee;
  --muted: #9ba3ae;
  --rule: #262c34;
  --chip-border: #3b424c;
  --field-border: #646d79;
  --accent: #8ab4f8;
  --accent-strong: #aecbfa;
  --accent-soft: #1b2a40;
  --accent-fill: #2f66c4;
  --accent-fill-strong: #3a72d1;
  --on-fill: #ffffff;
  --ok: #81c995;
  --error: #f2b8b5;
  --shadow-sm: 0 0 0 1px rgb(255 255 255 / 0.02);
  --shadow-md: 0 1px 2px rgb(0 0 0 / 0.4), 0 8px 24px -8px rgb(0 0 0 / 0.5);
  --shadow-lg: 0 2px 6px rgb(0 0 0 / 0.4), 0 18px 40px -12px rgb(0 0 0 / 0.6);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  color: var(--text);
  background-color: var(--bg);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  overflow-wrap: break-word;
}
@media (min-width: 720px) {
  body { font-size: 1.0625rem; }
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 0.15em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

img { max-width: 100%; }
code { font-family: var(--mono); font-size: 0.875em; }
.nowrap { white-space: nowrap; }
p { margin: 0 0 1rem; }

h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.2; letter-spacing: -0.015em; }
h2 { font-size: clamp(1.25rem, 1.1rem + 0.5vw, 1.5rem); font-weight: 650; margin: 0 0 1.25rem; }
h3 { font-size: 1rem; margin: 0 0 0.35rem; }

.wrap { width: 100%; max-width: calc(var(--page) + 2 * var(--pad)); margin: 0 auto; padding-inline: var(--pad); }

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 10;
  padding: 0.5rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  font-size: 0.875rem;
}
.skip-link:focus { top: 0.5rem; }

.site-header { background: var(--surface); border-bottom: 1px solid var(--rule); }

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.75rem;
  min-height: 3.5rem;
  padding-top: 0.6rem;
  padding-bottom: 0.6rem;
}
.site-name {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--text);
  font-family: var(--display);
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.site-name::before {
  content: "";
  flex: none;
  width: 1.375rem;
  height: 1.375rem;
  background: url("heatmap-icon.svg") center / contain no-repeat;
}
.site-nav { display: flex; gap: 0.125rem; font-size: 0.875rem; }
.site-nav a { padding: 0.35rem 0.65rem; color: var(--muted); text-decoration: none; }
.site-nav a:hover { color: var(--text); text-decoration: underline; }
.site-nav a[aria-current="page"] { color: var(--text); font-weight: 600; }

.theme-toggle {
  display: flex;
  align-items: center;
  margin-left: auto;
  padding: 3px;
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  font-size: 0.8125rem;
  visibility: hidden;
}
.js .theme-toggle { visibility: visible; }
.theme-toggle button {
  font: inherit;
  color: var(--muted);
  background: none;
  border: 0;
  border-radius: var(--r-sm);
  padding: 0.2rem 0.75rem;
  cursor: pointer;
}
.theme-toggle button:hover { color: var(--text); }
.theme-toggle button[aria-pressed="true"] {
  color: var(--text);
  font-weight: 600;
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--rule);
}

@media (max-width: 719px) {
  .site-nav {
    order: 3;
    flex: 1 0 100%;
    margin-inline: calc(-1 * var(--pad));
    padding-inline: calc(var(--pad) - 0.65rem);
    overflow-x: auto;
    scrollbar-width: none;
  }
  .site-nav::-webkit-scrollbar { display: none; }
  .site-nav a { flex: none; }
}

.hero { padding: clamp(1.5rem, 4vw, 2.5rem) 0 clamp(1.25rem, 3vw, 1.75rem); text-align: center; }
h1 {
  max-width: 24em;
  margin: 0 auto 0.5rem;
  font-size: clamp(1.625rem, 1.4rem + 0.8vw, 2rem);
  line-height: 1.2;
  text-wrap: balance;
}
.subtitle { margin: 0 auto; max-width: 38rem; color: var(--text); }
.page-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.25rem 1.25rem; margin-top: 0.75rem; font-size: 0.875rem; }
.page-links a { padding: 0.25rem 0; }

.section {
  margin-top: clamp(2rem, 4vw, 2.5rem);
  padding-top: clamp(1.25rem, 2.5vw, 1.5rem);
  border-top: 1px solid var(--rule);
  scroll-margin-top: 1rem;
}
#create { margin-top: 0; padding-top: 0; border-top: 0; }


.tool {
  padding: clamp(1rem, 2vw, 1.5rem);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
}

.field { margin-bottom: 1.25rem; }
.field label, .field-label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.875rem;
  font-weight: 600;
}
.opt { font-weight: 400; color: var(--muted); }
.label-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 0 1rem; }
.label-row a { font-size: 0.8125rem; margin-bottom: 0.4rem; }

textarea, input[type="text"], select {
  display: block;
  width: 100%;
  min-height: 2.625rem;
  margin: 0;
  padding: 0.55rem 0.75rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--field-border);
  border-radius: var(--r-md);
  font-family: var(--sans);
  font-size: 0.9375rem;
  line-height: 1.4;
  transition: border-color 0.15s;
}
textarea {
  min-height: 6.5rem;
  resize: vertical;
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.55;
}
textarea:hover, input[type="text"]:hover, select:hover { border-color: var(--muted); }
textarea:focus-visible, input[type="text"]:focus-visible, select:focus-visible { outline-offset: 1px; border-color: var(--accent); }
::placeholder { color: var(--muted); opacity: 1; }
[aria-invalid="true"], [aria-invalid="true"]:hover, [aria-invalid="true"]:focus-visible { border-color: var(--error); }

.hint, .error {
  margin: 0.4rem 0 0;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--muted);
}
.hint.is-ok { color: var(--ok); }
.error { font-size: 0.875rem; color: var(--error); }

.samples { margin: -0.25rem 0 1.4rem; }
.samples-label { display: block; margin-bottom: 0.4rem; font-size: 0.8125rem; color: var(--muted); }
.sample-buttons { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; }
.button-secondary {
  min-height: 2rem;
  padding: 0.25rem 0.2rem;
  font-family: var(--sans);
  font-size: 0.875rem;
  line-height: 1.3;
  color: var(--accent);
  background: none;
  border: 0;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
  cursor: pointer;
}
.button-secondary:hover { text-decoration-thickness: 2px; }

.choices { display: flex; flex-wrap: wrap; gap: 0.375rem; }
.choice {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.125rem;
  padding: 0.3rem 0.75rem;
  font-family: var(--sans);
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.25;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--chip-border);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background-color 0.12s, border-color 0.12s;
}
.choice:hover { background: var(--surface-2); border-color: var(--muted); }
.choice[aria-pressed="true"], .choice[aria-pressed="true"]:hover {
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}
@media (forced-colors: active) {
  .choice[aria-pressed="true"] { forced-color-adjust: none; color: HighlightText; background: Highlight; border-color: Highlight; }
}

#theme-buttons { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 30rem; }
#theme-buttons .choice {
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.5rem 0.5rem 0.4rem;
  text-align: center;
}
#theme-buttons .choice::before {
  flex: none;
  width: 100%;
  height: 0.5rem;
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.12);
}
#theme-buttons .choice[data-theme="standard"]::before { content: ""; background: linear-gradient(90deg, #b71126, #d93429, #ed5f3c, #f98e52, #fdb96b, #fedc8c, #fff3ad, #f3fbd4, #dcf1f7, #b6dfec, #8ec2dc, #69a0ca, #4878b6, #384ca0); }
#theme-buttons .choice[data-theme="bold"]::before { content: ""; background: linear-gradient(90deg, #67000d, #a50f15, #cb181d, #ef3b2c, #fb6a4a, #fc9272, #fcbba1, #c6dbef, #9ecae1, #6baed6, #4292c6, #2171b5, #08519c, #08306b); }
#theme-buttons .choice[data-theme="viridis"]::before { content: ""; background: linear-gradient(90deg, #e7e419, #b8de29, #89d548, #5cc863, #3aba76, #24aa83, #1f998a, #24878e, #2a768e, #32658e, #3b518b, #433d84, #482677, #470e61); }

.more-options { border-block: 1px solid var(--rule); }
.more-options > summary {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 0.6rem;
  padding: 0.7rem 2rem 0.7rem 0;
  list-style: none;
  cursor: pointer;
}
.more-options > summary::-webkit-details-marker { display: none; }
.more-options > summary::after {
  content: "";
  position: absolute;
  right: 0.45rem;
  top: 1.05rem;
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.2s;
}
.more-options[open] > summary::after { top: 1.3rem; transform: rotate(-135deg); }
.more-title { font-size: 0.875rem; font-weight: 600; }
.more-options > summary:hover .more-title { color: var(--accent); }
.more-values { font-size: 0.8125rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.more-body { padding: 0.35rem 0 1.1rem; }
.more-body .field:last-child, .more-body .field-grid .field { margin-bottom: 0; }

.field-grid { display: grid; gap: 1rem 1.25rem; }
@media (min-width: 560px) {
  .field-grid { grid-template-columns: 1fr 1fr; }
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.6rem 1.35rem;
  font-family: var(--sans);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--on-fill);
  background: var(--accent-fill);
  border: 1px solid var(--accent-fill);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgb(255 255 255 / 0.12);
  cursor: pointer;
}
.button:hover { background: var(--accent-fill-strong); border-color: var(--accent-fill-strong); }
.button:active { transform: translateY(1px); }
[aria-disabled="true"] { opacity: 0.55; cursor: progress; }
.button[aria-disabled="true"]:active { transform: none; }

.submit-row {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1rem;
  margin-top: 1.25rem;
}
.status {
  flex: 1 1 14rem;
  min-width: 0;
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.status[data-state="done"] { color: var(--text); }
.status[data-state="error"] { color: var(--error); }
.status-time { white-space: nowrap; }

.progress {
  flex: 1 0 100%;
  height: 3px;
  overflow: hidden;
  border-radius: 3px;
  background: var(--rule);
  visibility: hidden;
}
.progress.is-active { visibility: visible; }
.progress span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--accent-fill); transition: width 0.4s ease; }
@media (forced-colors: active) {
  .progress span { forced-color-adjust: none; background: Highlight; }
}

.result-area { min-width: 0; margin-top: 2rem; }

.placeholder {
  position: relative;
  margin: 0;
  padding: 0.5rem 0;
  color: var(--muted);
  text-align: center;
}
.placeholder-text { margin: 0; font-size: 0.9375rem; }
.placeholder-text strong { font-weight: 400; }

.notice {
  margin: 0;
  padding: 1.25rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
}
.notice p { margin: 0 0 0.6rem; }
.notice p:last-child { margin-bottom: 0; }

.result { scroll-margin-top: 1rem; transition: opacity 0.2s ease; }
.result.is-stale { opacity: 0.45; }

figure { margin: 0; }
.figure {
  padding: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
}
.figure figcaption { margin: 0.65rem 0.15rem 0; font-size: 0.875rem; line-height: 1.5; color: var(--muted); }

.zoom { position: relative; }
.map-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-bottom: 0.6rem; }
.tool-button {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.125rem;
  padding: 0.3rem 0.8rem;
  font-size: 0.8125rem;
  font-weight: 600;
}
.zoom-controls {
  display: flex;
  margin-left: auto;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--field-border);
  border-radius: var(--r-md);
}
.zoom-controls button {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.125rem;
  padding: 0;
  font-family: var(--sans);
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: 0;
  cursor: pointer;
}
.zoom-controls button + button { border-left: 1px solid var(--rule); }
.zoom-controls svg { width: 1rem; height: 1rem; }
.zoom-controls button:hover { background: var(--surface-2); }
.zoom-controls .zoom-reset { width: auto; padding: 0 0.75rem; font-size: 0.75rem; font-weight: 600; }
.zoom-controls [aria-disabled="true"] { opacity: 1; color: var(--chip-border); cursor: default; }
.zoom-controls [aria-disabled="true"]:hover { background: transparent; }

.zoom-frame {
  position: relative;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  cursor: zoom-in;
  touch-action: pan-x pan-y; 
  -webkit-user-select: none;
  user-select: none;
}
.zoom-frame.is-zoomed { cursor: grab; touch-action: none; }
.zoom-frame.is-dragging { cursor: grabbing; }
.zoom-frame img { display: block; width: 100%; height: auto; transform-origin: 0 0; -webkit-user-drag: none; }
.zoom-frame img.is-animated { transition: transform 0.18s ease-out; }

.result-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 1rem; }
.button-outline {
  font-family: var(--sans);
  line-height: 1.3;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--field-border);
  border-radius: var(--r-md);
  cursor: pointer;
}
.button-outline:hover { background: var(--surface-2); }
.button-outline[aria-disabled="true"] { opacity: 0.5; cursor: default; }
.button-outline[aria-disabled="true"]:hover { background: var(--surface); }
.button-outline.is-on, .button-outline.is-on:hover {
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 2.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
}
.action-icon { width: 1.05em; height: 1.05em; flex: none; }
a.button.action-button, a.button.action-button:hover { color: var(--on-fill); }
.result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  margin: 0 0 0 auto;
  font-size: 0.8125rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.result-hint { max-width: var(--measure); margin-top: 0.75rem; }

.data-table {
  width: 100%;
  margin: 2rem 0 0;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.9375rem;
  font-variant-numeric: lining-nums tabular-nums;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
}
.data-table caption { caption-side: top; padding: 0 0 0.6rem; text-align: left; font-weight: 600; line-height: 1.5; }
.data-table caption .opt { font-size: 0.8125rem; }
.data-table th, .data-table td {
  padding: 0.45rem 0.9rem;
  line-height: 1.4;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--rule);
}
.data-table thead th {
  padding-top: 0.6rem;
  padding-bottom: 0.6rem;
  font-size: 0.8125rem;
  font-weight: 600;
}
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table td:first-child { color: var(--muted); }
.data-table tbody tr:first-child td { background: var(--accent-soft); }
.data-table .num { text-align: right; white-space: nowrap; }

.sources-overlay {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  transform-origin: 0 0;
  pointer-events: none;
}
.sources-overlay.is-animated { transition: transform 0.18s ease-out; }
.sources-overlay circle { fill: #111111; stroke: #ffffff; pointer-events: visiblePainted; }

.source-card {
  position: absolute;
  z-index: 2;
  width: 19rem;
  max-width: calc(100% - 12px);
  padding: 0.6rem 0.8rem 0.75rem;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
}
.source-card p { margin: 0; }
.source-card-name { padding-right: 1.75rem; font-size: 0.875rem; font-weight: 600; }
.source-card-meta { color: var(--muted); }
.source-card-g25 {
  display: block;
  max-height: 4.4em;
  margin-top: 0.45rem;
  padding: 0.3rem 0.45rem;
  overflow-y: auto;
  font-size: 0.75rem;
  line-height: 1.45;
  word-break: break-all;
  background: var(--surface-2);
  border-radius: 4px;
}
.source-card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.75rem; margin-top: 0.5rem; }
.source-card-actions .button-outline { padding: 0.25rem 0.7rem; font-size: 0.8125rem; font-weight: 600; }
.source-card-close {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  color: var(--muted);
  background: none;
  border: 0;
  border-radius: var(--r-sm);
  cursor: pointer;
}
.source-card-close svg { width: 0.9rem; height: 0.9rem; }
.source-card-close:hover { color: var(--text); background: var(--surface-2); }
.copy-status { font-size: 0.8125rem; color: var(--ok); }
.sources-overlay.is-settling, .source-card.is-settling { visibility: hidden; }

.lead { max-width: var(--measure); color: var(--muted); }
.gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-top: 1.5rem; }
@media (min-width: 60rem) {
  .gallery { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 22.5rem) {
  .gallery { grid-template-columns: 1fr; }
}
.example {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  transition: border-color 0.15s;
}
.example:hover, .example:focus-visible { border-color: var(--field-border); }
.example:hover .example-title { text-decoration: underline; }
.example figure { display: flex; flex: 1; flex-direction: column; }
.example-thumb { display: grid; flex: 1; place-items: center; padding: 0.375rem; background: #ffffff; border-bottom: 1px solid var(--rule); }
.example-thumb img { display: block; width: 100%; height: auto; }
.example figcaption { padding: 0.65rem 0.9rem 0.8rem; font-size: 0.875rem; line-height: 1.4; }
.example-title { display: block; font-weight: 600; }
.example-note { display: block; color: var(--muted); }

.steps { max-width: var(--measure); margin: 0; padding-left: 1.4rem; }
.steps li { margin-bottom: 0.9rem; padding-left: 0.2rem; }
.steps li::marker { font-weight: 600; color: var(--text); }
.steps p { margin: 0; font-size: 0.9375rem; color: var(--muted); }

.faq { max-width: var(--measure); border-top: 1px solid var(--rule); }
.faq details { border-bottom: 1px solid var(--rule); }
.faq summary {
  position: relative;
  padding: 0.95rem 2.25rem 0.95rem 0;
  font-weight: 600;
  list-style: none;
  cursor: pointer;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "";
  position: absolute;
  right: 0.5rem;
  top: 1.3rem;
  width: 0.5rem;
  height: 0.5rem;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.2s;
}
.faq details[open] > summary::after { top: 1.55rem; transform: rotate(-135deg); }
.faq summary:hover { color: var(--accent); }
.faq details p { margin: 0 0 1.2rem; color: var(--muted); }
.faq details p strong { color: var(--text); }

.credits { max-width: var(--measure); margin: 0 0 1.5rem; padding: 0; list-style: none; font-size: 0.9375rem; color: var(--muted); }
.credits li { margin-bottom: 0.6rem; }
.credits strong { font-weight: 600; color: var(--text); }
.disclaimer { max-width: var(--measure); font-size: 0.9375rem; color: var(--muted); }

.site-footer {
  margin-top: clamp(3rem, 6vw, 4.5rem);
  padding: 1.75rem 0 2.25rem;
  background: var(--surface);
  border-top: 1px solid var(--rule);
  font-size: 0.8125rem;
  color: var(--muted);
  text-align: center;
}
.site-footer p { margin: 0; }
.site-footer a { color: inherit; }

@media (max-width: 719px) {
  .choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(6.5rem, 1fr)); }
  .choice { justify-content: center; padding-inline: 0.5rem; text-align: center; text-wrap: balance; }
  .result-actions .action-button { flex: 1 1 9rem; padding-inline: 0.75rem; white-space: nowrap; }
  .result-actions #download { flex-basis: 100%; }
  .result-meta { margin-left: 0; }
}

@media (max-width: 40rem) {
  .tool { padding: 0; background: none; border: 0; border-radius: 0; box-shadow: none; }
  .figure { margin-inline: calc(-1 * var(--pad)); padding: 0.75rem 0; border-inline: 0; border-radius: 0; box-shadow: none; }
  .zoom-frame { border-inline: 0; border-radius: 0; }
  .map-toolbar, .figure figcaption { margin-inline: var(--pad); }

  .submit-row {
    position: sticky;
    bottom: 0;
    z-index: 3;
    flex-wrap: nowrap;
    margin: 1.25rem calc(-1 * var(--pad)) 0;
    padding: 0.6rem var(--pad);
    background: var(--bg);
    border-top: 1px solid var(--rule);
  }
  .submit-row .button { flex: none; }
  .status { flex: 1 1 0; font-size: 0.8125rem; }
  .progress { position: absolute; left: 0; right: 0; top: -2px; border-radius: 0; }
  html { scroll-padding-bottom: 5.5rem; }
}

@media (pointer: coarse) {
  textarea, input[type="text"], select { font-size: 1rem; }
  .choice, .button-secondary, .tool-button, .source-card-actions .button-outline { min-height: 2.75rem; }
  .theme-toggle button { min-height: 2.25rem; min-width: 2.75rem; }
  .site-nav a { padding-block: 0.6rem; }
  .zoom-controls button { width: 2.75rem; height: 2.75rem; }
  .zoom-controls .zoom-reset { width: auto; padding: 0 1rem; }
  .source-card-close { top: 0; right: 0; width: 2.75rem; height: 2.75rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
