:root {
  color-scheme: light;
  --white: #ffffff;
  --surface: #f5f7fa;
  --ink: #10233f;
  --ink-soft: #52647c;
  --blue: #165fbd;
  --blue-soft: #edf5ff;
  --coral: #c83f3a;
  --green: #166b3b;
  --green-soft: #edf8f1;
  --red: #a62f2f;
  --red-soft: #fff1f0;
  --line: #c8d1dc;
  --line-light: #e2e7ed;
  --focus: #b72b25;
  font-family: "Hiragino Sans", "Yu Gothic UI", system-ui, sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background: var(--white);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  color: inherit;
  font: inherit;
}

button,
a,
input,
select,
summary,
canvas {
  -webkit-tap-highlight-color: transparent;
}

button,
select,
summary,
input[type="radio"],
input[type="color"] {
  cursor: pointer;
}

button {
  border: 0;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

a {
  color: var(--blue);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.screen-reader-only {
  position: absolute;
  overflow: hidden;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  z-index: 200;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.65rem 0.9rem;
  color: var(--white);
  background: var(--ink);
  transform: translateY(-180%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem max(1rem, calc((100vw - 860px) / 2));
  border-bottom: 1px solid var(--line-light);
}

.language-picker {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.75rem;
  margin-left: auto;
  padding-left: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 800;
}

.language-picker svg { width: 1.15rem; height: 1.15rem; fill: none; stroke: var(--blue); stroke-width: 1.8; }

.language-picker select {
  min-height: 2.75rem;
  border: 0;
  border-left: 1px solid var(--line-light);
  border-radius: 0 999px 999px 0;
  background-color: transparent;
  color: var(--ink);
  padding: 0.45rem 1.8rem 0.45rem 0.55rem;
  font: inherit;
  font-weight: 700;
}

.brand,
.home-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  text-decoration: none;
}

.brand {
  gap: 0.55rem;
  color: var(--ink);
}

.brand svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: var(--blue);
  stroke-width: 2.4;
}

.brand strong {
  font-size: 0.98rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.home-link {
  gap: 0.25rem;
  padding: 0 0.25rem;
  font-size: 0.8rem;
  font-weight: 700;
}

.home-link svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

main {
  width: min(calc(100% - 2rem), 860px);
  margin: 0 auto;
  padding: clamp(2.5rem, 7vw, 4.5rem) 0 3.5rem;
}

.intro {
  max-width: 720px;
  margin-bottom: clamp(1.8rem, 5vw, 2.8rem);
}

.intro h1 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 3.35rem);
  font-weight: 800;
  letter-spacing: -0.055em;
  line-height: 1.15;
}

.intro p {
  max-width: 640px;
  margin: 0.9rem 0 0;
  color: var(--ink-soft);
  font-size: clamp(0.95rem, 2vw, 1.05rem);
}

.tool-navigation {
  display: flex;
  gap: 1.75rem;
  margin: -0.5rem 0 1.25rem;
  border-bottom: 1px solid var(--line-light);
}

.tool-navigation a,
.tool-navigation button {
  min-height: 44px;
  padding: 0.55rem 0;
  color: var(--ink);
  background: transparent;
  font-size: 0.9rem;
  font-weight: 800;
  text-decoration: none;
}

.tool-navigation a:first-child { color: var(--blue); border-bottom: 3px solid var(--blue); }

.camera-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.camera-intro h2 { margin: 0; font-size: 1rem; }
.camera-intro p { margin: 0.2rem 0 0; color: var(--ink-soft); font-size: 0.78rem; }
.camera-intro button { min-height: 44px; flex: 0 0 auto; padding: 0.55rem 0.9rem; color: var(--white); background: var(--ink); border-radius: 999px; font-weight: 800; }

.camera-is-open { overflow: hidden; }
.camera-review { position: fixed; z-index: 500; inset: 0; overflow: hidden; color: var(--white); background: #000; }
.camera-review video { width: 100%; height: 100%; object-fit: cover; }
.camera-shade { position: absolute; inset: 0; background: linear-gradient(rgb(0 0 0 / 40%), transparent 20%, transparent 62%, rgb(0 0 0 / 78%)); pointer-events: none; }
.camera-close { position: absolute; top: max(1rem, env(safe-area-inset-top)); right: 1rem; width: 48px; height: 48px; color: var(--white); background: rgb(0 0 0 / 58%); border: 2px solid rgb(255 255 255 / 76%); border-radius: 50%; font-size: 2rem; line-height: 1; }
.camera-target { position: absolute; top: 42%; left: 50%; width: min(38vw, 168px); aspect-ratio: 1; border: 3px solid var(--white); border-radius: 50%; box-shadow: 0 0 0 999px rgb(0 0 0 / 14%); transform: translate(-50%, -50%); }
.camera-target canvas { display: block; width: 100%; height: 100%; border-radius: 50%; image-rendering: auto; }
.camera-target span::before,
.camera-target span::after { position: absolute; top: 50%; left: 50%; content: ""; background: var(--white); transform: translate(-50%, -50%); }
.camera-target span::before { width: 26px; height: 2px; }
.camera-target span::after { width: 2px; height: 26px; }
.camera-feedback { position: absolute; right: 1rem; bottom: max(1rem, env(safe-area-inset-bottom)); left: 1rem; display: grid; place-items: center; gap: 0.4rem; text-align: center; }
.camera-feedback p { margin: 0; }
.camera-mode { padding: 0.2rem 0.55rem; border: 1px solid rgb(255 255 255 / 55%); border-radius: 999px; font-size: 0.7rem; font-weight: 800; }
#camera-guidance { min-height: 1.6em; font-size: 0.88rem; font-weight: 700; }
.camera-result { display: grid; justify-items: center; gap: 0.5rem; }
.camera-result-summary { display: flex; align-items: center; justify-content: center; gap: 0.65rem; }
.camera-result span { font-size: 0.72rem; }
.camera-result strong { font-size: 1.65rem; line-height: 1; }
.camera-colors { display: flex; gap: 0.5rem; }
.camera-color { display: flex; align-items: center; gap: 0.4rem; min-width: 7.6rem; padding: 0.35rem 0.55rem; color: var(--ink); background: rgb(255 255 255 / 92%); border-radius: 9px; text-align: left; }
.camera-color i { width: 2rem; height: 2rem; flex: 0 0 auto; border: 2px solid rgb(9 35 66 / 35%); border-radius: 6px; box-shadow: inset 0 0 0 1px rgb(255 255 255 / 55%); }
.camera-color span { display: grid; gap: 0.1rem; font-weight: 800; }
.camera-color b { font-size: 0.72rem; }
#camera-verdict { padding: 0.2rem 0.55rem; border-radius: 999px; font-weight: 900; }
#camera-verdict[data-status="pass"] { color: #062f1a; background: #8ef0b4; }
#camera-verdict[data-status="fail"] { color: #3e0707; background: #ffaaa6; }
.camera-confirm { display: grid; width: 64px; height: 64px; place-items: center; margin-top: 0.25rem; color: var(--ink); background: var(--white); border: 4px solid rgb(255 255 255 / 45%); border-radius: 50%; background-clip: padding-box; }
.camera-confirm svg { width: 34px; height: 34px; fill: none; stroke: currentColor; stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }

.image-review {
  padding: clamp(1rem, 3vw, 1.5rem);
  margin-bottom: 1.5rem;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.image-review-heading { display: flex; align-items: start; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.image-review-heading h2 { margin: 0; font-size: 1rem; }
.image-review-heading p { margin: 0.25rem 0 0; color: var(--ink-soft); font-size: 0.78rem; }
.local-note { color: var(--green); font-size: 0.72rem; font-weight: 800; white-space: nowrap; }

.image-drop {
  display: grid;
  min-height: 190px;
  place-items: center;
  align-content: center;
  gap: 0.3rem;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px dashed #8d9bad;
  border-radius: 10px;
  text-align: center;
  cursor: pointer;
}
.image-drop:hover { border-color: var(--blue); background: var(--blue-soft); }
.image-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.image-drop svg { width: 36px; height: 36px; fill: none; stroke: var(--blue); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.image-drop span { color: var(--ink-soft); font-size: 0.76rem; }
.image-error { padding: 0.75rem; color: var(--red); background: var(--red-soft); font-weight: 700; }

.review-editor { display: grid; gap: 1rem; }
.review-canvas-wrap { position: relative; overflow: hidden; background: var(--surface); border-radius: 10px; line-height: 0; touch-action: none; }
#review-canvas { display: block; width: 100%; height: auto; max-height: 62vh; object-fit: contain; cursor: crosshair; }
.selection-box { position: absolute; pointer-events: none; border: 3px solid #fff; outline: 2px solid var(--blue); background: rgb(22 95 189 / 12%); }
.candidate-layer { position: absolute; inset: 0; pointer-events: none; }
.region-candidate { position: absolute; min-width: 44px; min-height: 44px; padding: 0; color: var(--white); background: rgb(22 95 189 / 10%); border: 2px solid var(--blue); box-shadow: 0 0 0 2px var(--white); pointer-events: auto; }
.region-candidate span { position: absolute; top: 0; left: 0; padding: 0.1rem 0.35rem; color: var(--white); background: var(--blue); font-size: 0.65rem; font-weight: 800; line-height: 1.5; }
.pdf-page-controls {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem;
  background: var(--surface);
  border: 1px solid var(--line-light);
  border-radius: 9px;
}
.pdf-page-controls[hidden] { display: none; }
.pdf-page-controls button { min-height: 44px; padding: 0.5rem 0.75rem; color: var(--blue); background: var(--white); border: 1px solid var(--line); border-radius: 7px; font-weight: 800; }
.pdf-page-controls button:disabled { color: var(--ink-soft); background: var(--surface); opacity: 0.65; }
.pdf-page-controls label { display: flex; align-items: center; justify-content: center; gap: 0.45rem; color: var(--ink-soft); font-size: 0.75rem; }
.pdf-page-controls input { width: 4.5rem; min-height: 44px; padding: 0.4rem; color: var(--ink); background: var(--white); border: 1px solid var(--line); border-radius: 7px; text-align: center; font: inherit; font-weight: 800; }
.pdf-page-controls strong { color: var(--ink); }
.pdf-page-status { min-height: 1.4em; margin: -0.5rem 0 0; color: var(--ink-soft); font-size: 0.75rem; }
.review-instruction { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.review-instruction p { margin: 0; font-size: 0.78rem; }
.review-instruction p:first-child { display: grid; }
.review-instruction p:first-child span { color: var(--ink-soft); }
.review-instruction button, .review-next-step button { min-height: 44px; padding: 0.55rem 0.8rem; color: var(--blue); background: var(--blue-soft); border-radius: 7px; font-size: 0.78rem; font-weight: 800; }
.review-editor-actions { display: flex; gap: 0.5rem; }
.detection-status { min-height: 1.4em; margin: -0.5rem 0 0; color: var(--ink-soft); font-size: 0.75rem; }

.review-result { margin-top: 1rem; border-top: 1px solid var(--line-light); }
.review-summary { display: grid; grid-template-columns: auto auto 1fr; align-items: center; gap: 1rem; padding: 1rem 0; }
.review-summary > div { display: grid; }
.review-summary span { color: var(--ink-soft); font-size: 0.75rem; }
.review-summary > div:nth-child(2) strong { font-size: 1.65rem; line-height: 1.1; }
.review-result[data-state="pass"] .status-symbol { color: var(--green); background: var(--green-soft); }
.review-result[data-state="fail"] .status-symbol { color: var(--red); background: var(--red-soft); }
.sampled-colors { display: grid; grid-template-columns: 1fr 1fr; border-block: 1px solid var(--line-light); }
.sampled-colors > div { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 0 0.65rem; padding: 0.8rem 0; font-size: 0.76rem; }
.sampled-colors > div + div { padding-left: 1rem; border-left: 1px solid var(--line-light); }
.sampled-colors strong { grid-column: 2; }
.sample-swatch { grid-row: 1 / 3; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 50%; }
.review-next-step { padding: 1rem 0; }
.review-next-step h3 { margin: 0; font-size: 0.8rem; }
.review-next-step p { margin: 0.3rem 0 0.8rem; font-size: 0.86rem; }
.review-caveat { margin: 0; color: var(--ink-soft); font-size: 0.7rem; }

@media (max-width: 620px) {
  .pdf-page-controls { grid-template-columns: 1fr 1.2fr 1fr; gap: 0.4rem; }
  .pdf-page-controls button { padding-inline: 0.4rem; font-size: 0.7rem; }
  .pdf-page-controls label > span:first-child { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .pdf-page-controls input { width: 3.25rem; }
  .review-instruction { align-items: start; flex-direction: column; }
  .review-editor-actions { width: 100%; }
  .review-editor-actions button { flex: 1; }
  .review-summary { grid-template-columns: auto 1fr; }
  .review-summary > div:last-child { grid-column: 1 / -1; }
  .sampled-colors { grid-template-columns: 1fr; }
  .sampled-colors > div + div { padding-left: 0; border-top: 1px solid var(--line-light); border-left: 0; }
}

.workspace {
  padding: clamp(1rem, 3vw, 1.5rem);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.workspace-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.workspace-heading h2,
.suggestions h2,
.advanced-content h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.workspace-heading p {
  margin: 0.25rem 0 0;
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.active-color {
  display: flex;
  flex: 1;
  min-width: 174px;
  gap: 0.25rem;
  padding: 0.3rem;
  margin: 0;
  background: var(--surface);
  border: 0;
  border-radius: 9px;
}

.workspace-tools {
  display: flex;
  align-items: stretch;
  gap: 0.55rem;
}

.pair-preview {
  display: grid;
  width: 48px;
  min-height: 48px;
  flex: 0 0 48px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  box-shadow: inset 0 0 0 2px var(--white);
  font-family: Georgia, serif;
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1;
}

.active-color legend {
  position: absolute;
  overflow: hidden;
  width: 1px;
  height: 1px;
  clip: rect(0, 0, 0, 0);
}

.active-color label {
  position: relative;
  display: grid;
  flex: 1;
  min-height: 44px;
  place-items: center;
  border-radius: 7px;
  font-size: 0.8rem;
  font-weight: 800;
  box-shadow: inset 0 -3px 0 var(--role-color);
}

.foreground-tab { --role-color: var(--blue); }
.background-tab { --role-color: var(--coral); }

.active-color input {
  position: absolute;
  opacity: 0;
}

.active-color label:has(input:checked) {
  color: var(--role-color);
  background: var(--white);
  box-shadow: 0 0 0 2px var(--role-color);
}

.active-color label:has(input:focus-visible) {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.map-frame {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 12 / 7;
  background: var(--surface);
  border: 1px solid var(--ink);
  border-radius: 9px;
}

.persistent-preview {
  position: sticky;
  z-index: 12;
  top: 0.5rem;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  gap: 0.7rem;
  align-items: center;
  min-height: 66px;
  padding: 0.45rem 0.65rem;
  margin-top: 0.85rem;
  background: rgb(255 255 255 / 94%);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgb(16 38 70 / 12%);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.persistent-preview-sample {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: Georgia, serif;
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1;
}

.persistent-preview-copy,
.persistent-preview-ratio {
  display: grid;
  gap: 0.12rem;
}

.persistent-preview-copy strong {
  font-size: 0.78rem;
}

.persistent-preview-copy span {
  color: var(--ink-soft);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.65rem;
}

.persistent-preview-copy b {
  color: inherit;
  font-weight: 700;
}

.persistent-preview-ratio {
  justify-items: end;
}

.persistent-preview-ratio small {
  color: var(--ink-soft);
  font-size: 0.62rem;
}

.persistent-preview-ratio strong {
  font-size: 1rem;
}

#color-map {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
}

.map-pin {
  position: absolute;
  z-index: 3;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  padding: 0;
  background: var(--white);
  border: 4px solid currentColor;
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--white);
  transform: translate(-50%, -50%);
}

.map-pin::after {
  position: absolute;
  inset: 5px;
  background: currentColor;
  border-radius: 50%;
  content: "";
}

.map-pin span {
  position: absolute;
  bottom: calc(100% + 9px);
  left: 50%;
  min-width: 48px;
  padding: 0.25rem 0.45rem;
  color: var(--white);
  background: var(--pin-color);
  border-radius: 5px;
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1;
  text-align: center;
  transform: translateX(-50%);
}

.map-pin span::after {
  position: absolute;
  top: 100%;
  left: 50%;
  border-top: 6px solid var(--pin-color);
  border-right: 5px solid transparent;
  border-left: 5px solid transparent;
  content: "";
  transform: translateX(-50%);
}

.foreground-pin {
  --pin-color: var(--blue);
  color: var(--blue);
}

.background-pin {
  --pin-color: var(--coral);
  color: var(--coral);
}

.map-pin[aria-pressed="false"] span {
  opacity: 0.78;
}

.map-axis {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  margin-top: 0.25rem;
  color: var(--ink-soft);
  font-size: 0.65rem;
  text-align: center;
}

.map-axis span:first-child {
  text-align: left;
}

.map-axis span:last-child {
  text-align: right;
}

.color-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px minmax(0, 1fr);
  gap: 0.65rem;
  align-items: center;
  margin-top: 1rem;
}

.color-control {
  min-width: 0;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 9px;
}

.color-control[data-active="true"] {
  border-color: var(--blue);
  box-shadow: inset 0 0 0 1px var(--blue);
}

.color-control-heading {
  display: flex;
  min-height: 24px;
  align-items: center;
  gap: 0.45rem;
}

.color-control-heading h3,
.numeric-colors h3 {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 800;
}

.color-dot {
  width: 16px;
  height: 16px;
  border: 1px solid rgba(16, 35, 63, 0.32);
  border-radius: 50%;
}

.active-label {
  margin-left: auto;
  color: var(--blue);
  font-size: 0.66rem;
  font-weight: 800;
}

.hex-control {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 0.6rem;
  align-items: end;
  margin-top: 0.55rem;
}

.color-picker-label,
.color-picker-label input {
  display: block;
  width: 48px;
  height: 46px;
}

.color-picker-label input {
  padding: 0;
  background: transparent;
  border: 1px solid var(--ink);
  border-radius: 5px;
}

.color-picker-label input::-webkit-color-swatch-wrapper {
  padding: 3px;
}

.color-picker-label input::-webkit-color-swatch {
  border: 0;
  border-radius: 2px;
}

.hex-control > label:last-child,
.lch-controls label {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.hex-control > label:last-child span,
.lch-controls label span {
  color: var(--ink-soft);
  font-size: 0.65rem;
  font-weight: 700;
}

.hex-control input[type="text"],
.lch-controls input,
.target-control select {
  min-height: 44px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.hex-control input[type="text"] {
  width: 100%;
  padding: 0 0.6rem;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.025em;
  text-transform: uppercase;
}

.swap-button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  padding: 0;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 50%;
}

.swap-button:hover {
  border-color: var(--ink);
}

.swap-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.evaluation {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line-light);
}

.target-control {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr);
  gap: 0.75rem;
  align-items: center;
  font-size: 0.82rem;
  font-weight: 800;
}

.target-control select {
  width: 100%;
  padding: 0 2.2rem 0 0.75rem;
  font-size: 0.86rem;
  font-weight: 700;
}

.result-panel {
  display: grid;
  grid-template-columns: 48px minmax(120px, 0.35fr) minmax(0, 1fr);
  gap: 0.9rem;
  align-items: center;
  margin-top: 0.8rem;
  padding: 1rem;
  background: var(--green-soft);
  border: 1px solid var(--green);
  border-radius: 9px;
}

.result-panel[data-state="fail"] {
  background: var(--red-soft);
  border-color: var(--red);
}

.status-symbol {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  color: var(--white);
  background: var(--green);
  border-radius: 50%;
}

.result-panel[data-state="fail"] .status-symbol {
  background: var(--red);
}

.status-symbol svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
}

.ratio-block,
.status-copy {
  display: grid;
}

.ratio-block span {
  font-size: 0.68rem;
  font-weight: 700;
}

.ratio-block strong {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: clamp(1.8rem, 5vw, 2.7rem);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.07em;
  line-height: 1.05;
}

.status-copy {
  gap: 0.2rem;
  padding-left: 0.9rem;
  border-left: 1px solid currentColor;
}

.status-copy strong {
  color: var(--green);
  font-size: 1rem;
  font-weight: 800;
}

.result-panel[data-state="fail"] .status-copy strong {
  color: var(--red);
}

.status-copy span {
  color: var(--ink-soft);
  font-size: 0.75rem;
}

.suggestions {
  margin-top: 1.5rem;
}

.suggestions-intro {
  margin: 0.35rem 0 0;
  color: var(--ink-soft);
  font-size: 0.74rem;
}

.suggestion-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
  margin-top: 0.65rem;
}

.suggestion-card {
  display: grid;
  gap: 0.7rem;
  padding: 0.8rem;
  background: var(--white);
  border: 2px solid color-mix(in srgb, currentColor 38%, var(--line));
  border-radius: 10px;
}

.suggestion-card[data-selected="true"] {
  border-color: currentColor;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 12%, transparent);
}

.foreground-suggestion {
  --suggestion-color: var(--blue);
  color: var(--blue);
}

.background-suggestion {
  --suggestion-color: var(--coral);
  color: var(--coral);
}

.suggestion-card h3 {
  margin: 0;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 800;
}

.suggestion-comparison {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 0.45rem;
  align-items: end;
}

.suggestion-swatch-block {
  display: grid;
  gap: 0.25rem;
}

.suggestion-swatch-block > span {
  color: var(--ink-soft);
  font-size: 0.62rem;
  font-weight: 700;
}

.suggestion-preview {
  display: grid;
  min-height: 58px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: Georgia, serif;
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1;
}

.suggestion-arrow {
  padding-bottom: 1.1rem;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.suggestion-detail {
  display: flex;
  min-width: 0;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.suggestion-detail small {
  overflow: hidden;
  color: var(--ink-soft);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.62rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.suggestion-detail strong {
  flex: 0 0 auto;
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 800;
}

.suggestion-button {
  min-height: 44px;
  padding: 0.55rem 0.7rem;
  color: var(--white);
  background: var(--suggestion-color);
  border: 1px solid var(--suggestion-color);
  border-radius: 7px;
  font-size: 0.76rem;
  font-weight: 800;
}

.suggestion-button:hover:not(:disabled) {
  filter: brightness(0.92);
}

.suggestion-button:disabled {
  color: var(--ink-soft);
  background: var(--surface);
  border-color: var(--line);
  opacity: 1;
}

.advanced-tools {
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.advanced-tools > summary {
  position: relative;
  display: grid;
  min-height: 64px;
  align-content: center;
  padding: 0.75rem 3rem 0.75rem 1rem;
  list-style: none;
}

.advanced-tools > summary::-webkit-details-marker {
  display: none;
}

.advanced-tools > summary::after {
  position: absolute;
  top: 50%;
  right: 1rem;
  content: "+";
  font-size: 1.35rem;
  line-height: 1;
  transform: translateY(-50%);
}

.advanced-tools[open] > summary::after {
  content: "−";
}

.advanced-tools > summary span {
  font-size: 0.88rem;
  font-weight: 800;
}

.advanced-tools > summary small {
  color: var(--ink-soft);
  font-size: 0.7rem;
}

.advanced-content {
  display: grid;
  gap: 1.75rem;
  padding: 1.25rem;
  border-top: 1px solid var(--line-light);
}

.numeric-colors {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 0.7rem;
}

.numeric-colors > div {
  padding: 0.85rem;
  background: var(--surface);
  border-radius: 8px;
}

.lch-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
  margin-top: 0.55rem;
}

.lch-controls input {
  width: 100%;
  padding: 0 0.35rem;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.78rem;
  text-align: center;
}

.preview-section,
.export-section {
  padding-top: 1.5rem;
  border-top: 1px solid var(--line-light);
}

.preview {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1.25rem;
  align-items: center;
  margin-top: 0.7rem;
  padding: 1.25rem;
  border: 1px solid var(--ink);
  border-radius: 8px;
}

.preview h3 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1.35;
}

.preview p {
  margin: 0.45rem 0;
  font-size: 0.82rem;
}

.preview a {
  font-size: 0.78rem;
  font-weight: 800;
}

.preview > button {
  min-width: 130px;
  min-height: 48px;
  padding: 0.65rem 0.9rem;
  font-weight: 800;
  border: 2px solid currentColor;
  border-radius: 6px;
}

.export-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
  margin-top: 0.7rem;
}

.export-actions button {
  min-height: 44px;
  padding: 0.55rem;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.76rem;
  font-weight: 750;
}

.export-actions button:hover {
  border-color: var(--ink);
}

.criteria-note {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.72rem;
}

footer {
  display: flex;
  width: min(calc(100% - 2rem), 860px);
  min-height: 84px;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 auto;
  padding: 1.2rem 0;
  border-top: 1px solid var(--line-light);
}

.mieru-ad {
  width: min(calc(100% - 2rem), 860px);
  min-height: 110px;
  margin: 1.5rem auto 0;
  padding: 0.75rem 0;
  text-align: center;
}

.mieru-ad > span {
  display: block;
  margin-bottom: 0.4rem;
  color: var(--ink-soft);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
}

.mieru-ad-unit { display: block; min-height: 90px; }

footer p {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.72rem;
}

footer p svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: var(--ink);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

footer nav {
  display: flex;
  gap: 1rem;
  font-size: 0.72rem;
  font-weight: 700;
}

.toast {
  position: fixed;
  z-index: 100;
  right: 1rem;
  bottom: 1rem;
  max-width: min(360px, calc(100vw - 2rem));
  padding: 0.75rem 1rem;
  color: var(--white);
  background: var(--ink);
  border-radius: 7px;
  font-size: 0.78rem;
  font-weight: 700;
}

@media (max-width: 680px) {
  .workspace-heading {
    display: grid;
    align-items: start;
  }

  .active-color {
    width: 100%;
  }

  .color-controls {
    grid-template-columns: 1fr;
  }

  .swap-button {
    justify-self: center;
    transform: rotate(90deg);
  }

  .target-control {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .result-panel {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .status-copy {
    grid-column: 1 / -1;
    padding: 0.7rem 0 0;
    border-top: 1px solid currentColor;
    border-left: 0;
  }

  .suggestion-actions,
  .numeric-colors,
  .export-actions {
    grid-template-columns: 1fr;
  }

  .preview {
    grid-template-columns: 1fr;
  }

  .preview > button {
    width: 100%;
  }
}

@media (max-width: 440px) {
  .site-header {
    padding-right: 0.75rem;
    padding-left: 0.75rem;
  }

  .brand strong {
    font-size: 0.86rem;
  }

  .home-link {
    font-size: 0.72rem;
  }

  .language-picker { gap: 0.3rem; padding-left: 0.6rem; font-size: 0.64rem; }
  .language-picker svg { width: 1rem; height: 1rem; }
  .language-picker select { padding-right: 1.35rem; padding-left: 0.45rem; }

  .tool-navigation { gap: 1rem; overflow-x: auto; }
  .tool-navigation a, .tool-navigation button { flex: 0 0 auto; }
  .camera-intro { align-items: stretch; flex-direction: column; }
  .camera-intro button { width: 100%; }

  main,
  footer {
    width: min(calc(100% - 1.25rem), 860px);
  }

  main {
    padding-top: 2.2rem;
  }

  .persistent-preview {
    grid-template-columns: 48px minmax(0, 1fr) auto;
    gap: 0.55rem;
    padding: 0.4rem 0.5rem;
  }

  .persistent-preview-sample {
    width: 48px;
    height: 48px;
  }

  .persistent-preview-copy span {
    font-size: 0.58rem;
  }

  .persistent-preview-ratio strong {
    font-size: 0.9rem;
  }

  .workspace {
    padding: 0.7rem;
  }

  .map-frame {
    aspect-ratio: 5 / 4;
  }

  footer {
    display: grid;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
