:root {
  color-scheme: light;
  --ink: #17323b;
  --muted: #52646b;
  --accent: #176d71;
  --wash: #edf4f1;
  --line: #d6e2df;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  color: var(--ink);
  background: #f8faf9;
  font-size: 16px;
  line-height: 1.75;
}
body[data-group="B"],
body[data-group="G"] {
  --accent: #315b99;
  --wash: #eef3fb;
  --line: #d8e2ef;
}
body[data-group="C"],
body[data-group="H"] {
  --accent: #7f4775;
  --wash: #f6eff5;
  --line: #e8dce5;
}
body[data-group="D"],
body[data-group="J"] {
  --accent: #8c571e;
  --wash: #f9f2e7;
  --line: #e7ddcd;
}
body[data-group="E"],
body[data-group="F"] {
  --accent: #386e51;
  --wash: #eff6ee;
  --line: #d9e5d7;
}
a {
  color: var(--accent);
  text-underline-offset: 3px;
}
button,
input,
textarea,
select {
  font: inherit;
}
button,
a,
input,
textarea,
select,
summary {
  -webkit-tap-highlight-color: transparent;
}
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}
.skip-link {
  position: absolute;
  z-index: 100;
  left: 16px;
  top: -100px;
  padding: 10px;
  background: white;
}
.skip-link:focus {
  top: 8px;
}
.site-header {
  border-bottom: 1px solid var(--line);
  background: white;
}
.header-inner,
.page,
.footer-inner {
  width: min(100% - 48px, 1040px);
  margin: auto;
}
.header-inner {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  color: var(--ink);
  font-size: 18px;
  font-weight: 750;
  text-decoration: none;
}
.brand-mark {
  color: var(--accent);
  margin-right: 8px;
}
.top-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}
.top-nav a {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  font-size: 14px;
  text-decoration: none;
}
.intro {
  padding: 38px 0 24px;
  max-width: 900px;
}
.eyebrow {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 650;
  color: var(--accent);
  letter-spacing: 0.06em;
}
h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}
h1 {
  margin: 0 0 16px;
  font-size: clamp(25px, 3.5vw, 37px);
  line-height: 1.4;
  letter-spacing: -0.025em;
}
.lead {
  margin: 0;
  color: var(--muted);
  line-height: 1.85;
}
h2 {
  margin: 0 0 14px;
  font-size: 23px;
  line-height: 1.45;
}
h3 {
  margin: 0 0 8px;
  font-size: 18px;
  line-height: 1.6;
}
.tool-panel {
  background: white;
  border: 1px solid var(--line);
  border-top: 4px solid var(--accent);
  border-radius: 10px;
  padding: 28px;
}
.tool-heading {
  margin: 0 0 7px;
  font-size: 22px;
}
.tool-purpose,
.hint {
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 18px;
}
.fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}
.field {
  min-width: 0;
}
.field.wide {
  grid-column: 1 / -1;
}
.field > label {
  display: block;
  font-size: 15px;
  font-weight: 650;
  margin-bottom: 7px;
}
input:not([type="checkbox"]),
textarea,
select {
  width: 100%;
  max-width: 100%;
  min-height: 46px;
  border: 1px solid #aebfbd;
  border-radius: 6px;
  padding: 10px 12px;
  background: white;
  color: var(--ink);
}
textarea {
  resize: vertical;
  line-height: 1.6;
  tab-size: 2;
}
input[type="color"] {
  height: 49px;
  padding: 5px;
  cursor: pointer;
}
input[type="file"] {
  padding: 8px;
  font-size: 14px;
}
input::file-selector-button {
  padding: 7px 10px;
  border: 0;
  background: var(--wash);
  color: var(--ink);
  border-radius: 4px;
  margin-right: 10px;
}
.check-label {
  display: flex !important;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-weight: 500 !important;
}
input[type="checkbox"] {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  accent-color: var(--accent);
}
.field .hint {
  margin: 6px 0 0;
  font-size: 13px;
}
.form-actions,
.result-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}
button,
.download-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 46px;
  border: 1px solid transparent;
  padding: 9px 20px;
  border-radius: 6px;
  font-weight: 650;
  cursor: pointer;
  text-decoration: none;
}
button.primary {
  color: white;
  background: var(--accent);
}
button.secondary,
.download-link {
  color: var(--accent);
  background: var(--wash);
  border-color: var(--line);
}
button:disabled {
  opacity: 0.65;
  cursor: wait;
}
.processing-note {
  margin: 13px 0 0;
  color: var(--muted);
  font-size: 12px;
}
.tool-status {
  margin: 18px 0 0;
  min-height: 26px;
  font-size: 14px;
  color: var(--accent);
}
.tool-status.error {
  color: #a92525;
}
.tool-output:empty {
  display: none;
}
.tool-output {
  border-top: 1px solid var(--line);
  margin-top: 22px;
  padding-top: 22px;
  min-width: 0;
}
.result-summary {
  margin: 0 0 16px;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 16px 0;
}
.metric {
  min-width: 0;
  padding: 14px 16px;
  background: var(--wash);
  border-radius: 6px;
}
.metric dt {
  font-size: 13px;
  color: var(--muted);
}
.metric dd {
  margin: 5px 0 0;
  font-size: 20px;
  line-height: 1.5;
  font-weight: 700;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.result-label {
  display: block;
  font-weight: 650;
  margin: 14px 0 8px;
}
.result-text {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 14px;
}
.table-scroll {
  overflow: auto;
  max-width: 100%;
  max-height: 520px;
  margin-top: 18px;
  border: 1px solid var(--line);
}
.result-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.result-table th,
.result-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
  max-width: 500px;
  white-space: pre-wrap;
}
.result-table th {
  background: var(--wash);
  position: sticky;
  top: 0;
}
.image-preview {
  display: block;
  max-width: 100%;
  height: auto;
  margin-top: 18px;
  border: 1px solid var(--line);
  background: repeating-conic-gradient(#eee 0% 25%, #fff 0% 50%) 50% / 16px 16px;
}
.pixel-picker {
  cursor: crosshair;
}
.demo-shell {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 200px;
  max-width: 100%;
  overflow: hidden;
  padding: 32px;
  margin-top: 20px;
  border: 1px solid var(--line);
  background: #f1f4f6;
}
.demo-box {
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  width: 240px;
  max-width: 100%;
  height: 140px;
  color: white;
  background: var(--accent);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.result-note {
  color: var(--muted);
  border-left: 3px solid var(--line);
  padding-left: 12px;
  font-size: 14px;
}
.reading {
  max-width: 820px;
  padding: 38px 0 20px;
}
.reading section {
  margin: 0 0 32px;
}
.reading section + section {
  border-top: 1px solid var(--line);
  padding-top: 28px;
}
.reading p {
  margin: 0 0 14px;
}
.reading li {
  margin: 7px 0;
}
.reading ol,
.reading ul {
  padding-left: 24px;
}
.example {
  padding: 18px 20px;
  background: var(--wash);
  border-radius: 6px;
  margin: 14px 0;
}
.example p:last-child {
  margin-bottom: 0;
}
.faq-item {
  margin-bottom: 20px;
}
.references a {
  display: inline-block;
  min-height: 44px;
  padding: 8px 0;
}
.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 16px;
}
.footer-inner {
  padding: 24px 0 32px;
  color: var(--muted);
  font-size: 13px;
}
.footer-inner p {
  margin: 0 0 7px;
}
@media (max-width: 600px) {
  .header-inner,
  .page,
  .footer-inner {
    width: calc(100% - 32px);
  }
  .header-inner {
    min-height: 64px;
    gap: 8px;
  }
  .brand {
    font-size: 16px;
  }
  .top-nav {
    gap: 12px;
  }
  .top-nav a {
    font-size: 13px;
  }
  .intro {
    padding-top: 26px;
  }
  .tool-panel {
    padding: 20px 16px;
  }
  .fields {
    grid-template-columns: minmax(0, 1fr);
    gap: 17px;
  }
  .metrics {
    grid-template-columns: minmax(0, 1fr);
  }
  .form-actions button {
    flex: 1;
  }
  .reading {
    padding-top: 30px;
  }
  .example {
    padding: 16px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
  }
}
