@charset "UTF-8";
:root {
  color-scheme: light;
  --background: #f3f6fa;
  --surface: #fff;
  --ink: #1e293b;
  --muted: #526478;
  --border: #dce4ed;
  --accent: #284d62;
  --mask: #e600a9;
  font-family:
    Inter,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Arial,
    sans-serif;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--background);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
}
button,
input,
select {
  font: inherit;
}
button,
a,
input,
select {
  touch-action: manipulation;
}
button {
  cursor: pointer;
  color: inherit;
}
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
a {
  color: inherit;
  text-decoration: none;
}
[hidden] {
  display: none !important;
}
button:focus-visible,
a:focus-visible,
summary:focus-visible,
select:focus-visible,
input:focus-visible,
canvas:focus-visible {
  outline: 3px solid #2c769e;
  outline-offset: 3px;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
p {
  margin-bottom: 12px;
}
h2 {
  line-height: 1.25;
}
summary {
  cursor: pointer;
  font-weight: 550;
}
details[open] > summary {
  margin-bottom: 12px;
}
.app {
  max-width: 1600px;
  margin: auto;
  padding: 0 36px 24px;
}
.header {
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--border);
}
.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 26px;
  font-weight: 750;
  letter-spacing: -1px;
}
.brand-icon {
  display: block;
  width: 48px;
  height: 48px;
  object-fit: contain;
  flex-shrink: 0;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 24px;
  color: var(--muted);
  font-size: 14px;
}
.header-subtitle {
  color: var(--muted);
  font-size: 14px;
  margin-right: auto;
}
.header-actions button,
.header-actions a {
  border: 0;
  padding: 8px 0;
  background: transparent;
  white-space: nowrap;
}
.header-actions button:hover,
.header-actions a:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 4px;
}
.about-dialog {
  width: min(480px, calc(100% - 32px));
  max-height: calc(100% - 32px);
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  color: var(--ink);
}
.about-dialog[open] {
  animation: about-dialog-open 220ms ease-out both;
}
.about-dialog::backdrop {
  background: #14283a80;
  animation: about-backdrop-open 220ms ease-out both;
}
@keyframes about-dialog-open {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes about-backdrop-open {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
.about-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.about-heading h2 {
  font-size: 22px;
  margin: 0;
}
.about-dialog .about-close {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 44px;
  min-width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
}
.project-authors {
  list-style: none;
  margin: 0;
  padding: 0;
}
.project-authors li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
}
.project-authors li + li {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.project-authors strong {
  font-size: 16px;
}
.author-links {
  display: flex;
  flex-shrink: 0;
  gap: 4px;
}
.author-links a {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
}
.author-links a:hover,
.about-dialog .about-close:hover {
  background: var(--background);
}
.author-links img {
  display: block;
}
.intro {
  text-align: center;
  margin: 52px auto 28px;
}
.intro h1 {
  font-size: clamp(28px, 3vw, 42px);
  font-weight: 650;
  letter-spacing: -1.3px;
  line-height: 1.17;
  margin: 14px 0 18px;
}
.intro p {
  font-size: 17px;
  color: var(--muted);
  line-height: 1.6;
}
.workspace {
  max-width: 740px;
  margin: 0 auto;
  background: white;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}
.workspace.dragging {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}
.workspace.has-image {
  max-width: 100%;
  margin-top: 28px;
}
.upload-area {
  border: 0;
  background: transparent;
  width: 100%;
  padding: 30px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.empty-state:hover {
  background: #f8fafc;
}
.upload-area:focus-visible {
  outline-offset: -5px;
  border-radius: 14px;
}
.upload-area svg {
  width: 34px;
  height: 34px;
  color: var(--muted);
}
.upload-area strong {
  font-size: 19px;
  font-weight: 550;
}
.upload-link {
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.upload-area small {
  font-size: 13px;
  color: var(--muted);
}
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
}
.file-meta {
  display: flex;
  align-items: baseline;
  gap: 16px;
  min-width: 0;
}
.file-meta strong {
  max-width: 45vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 550;
}
.file-meta span {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 550;
  line-height: 1.4;
}
.primary {
  background: var(--accent);
  color: white;
}
.primary:hover {
  background: #193d51;
}
.secondary {
  background: white;
  border-color: #cbd6e2;
}
.secondary:hover {
  background: #f3f6fa;
}
.compact {
  padding: 6px 10px;
  min-height: 36px;
  background: transparent;
}
.wide {
  width: 100%;
}
.inspection-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
}
.image-column {
  min-width: 0;
  background: #f8fafc;
}
.viewer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 18px;
}
.view-controls {
  display: flex;
  gap: 3px;
  padding: 3px;
  border-radius: 8px;
  background: #e9eef3;
}
.view-controls button {
  border: 0;
  border-radius: 6px;
  padding: 7px 13px;
  background: transparent;
  font-size: 14px;
  color: #415369;
}
.view-controls button.selected {
  background: white;
  box-shadow: 0 1px 3px #14283a18;
  color: var(--ink);
}
.zoom-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}
.zoom-controls output {
  font-size: 13px;
  min-width: 48px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.icon-button {
  height: 36px;
  min-width: 36px;
  border: 1px solid var(--border);
  background: white;
  border-radius: 6px;
  font-size: 20px;
}
.image-stage {
  position: relative;
  height: clamp(420px, 65vh, 820px);
  min-width: 0;
  background: #e9eef3;
  overflow: hidden;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
#inspection-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}
#inspection-canvas.dragging {
  cursor: grabbing;
}
.display-options {
  padding: 15px 18px;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  flex-wrap: wrap;
  font-size: 13px;
}
.mask-settings {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.mask-settings label {
  display: flex;
  align-items: center;
  gap: 8px;
}
.mask-settings select {
  appearance: none;
  height: 32px;
  font-size: 13px;
  padding: 5px 30px 5px 10px;
  border: 1px solid #cbd6e2;
  border-radius: 5px;
  background: white
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='m1 1 4 4 4-4' fill='none' stroke='%23526478' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    right 10px center / 10px 6px no-repeat;
  max-width: 100%;
}
.opacity-label input {
  width: 78px;
  accent-color: var(--accent);
}
.opacity-label output {
  min-width: 30px;
}
.viewer-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  padding: 0 18px;
  font-size: 12px;
  color: var(--muted);
}
.viewer-legend > span,
.viewer-legend > button {
  display: flex;
  align-items: center;
  gap: 7px;
}
.viewer-legend > button {
  border: 0;
  padding: 0;
  background: none;
  color: inherit;
  font-size: inherit;
  line-height: inherit;
}
#roi-legend[aria-pressed="false"] span {
  text-decoration: line-through;
}
.mask-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  background: var(--mask);
  border: 1px solid #29313d;
  border-radius: 2px;
}
.roi-swatch {
  width: 17px;
  height: 12px;
  border: 2px dashed #b58a17;
}
.result-panel {
  padding: 16px;
  border-left: 1px solid var(--border);
  min-width: 0;
}
.result-panel h2 {
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.6px;
  margin: 10px 0 8px;
}
.result-skeleton {
  display: grid;
  gap: 16px;
  animation: loading-pulse 1.8s ease-in-out infinite;
}
.skeleton {
  display: block;
  height: 14px;
  border-radius: 5px;
  background: #e9eef3;
}
.skeleton-badge {
  width: 110px;
  height: 24px;
}
.skeleton-heading {
  width: 80%;
  height: 26px;
}
.skeleton-metrics,
.skeleton-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.skeleton-metrics {
  margin: 6px 0;
}
.skeleton-metrics .skeleton {
  width: 70%;
  height: 44px;
}
.skeleton-button {
  height: 36px;
}
.skeleton-source {
  display: grid;
  gap: 10px;
  padding: 16px 0 4px;
  border-top: 1px solid var(--border);
}
.skeleton-source .skeleton:first-child {
  width: 60%;
}
.skeleton-source .skeleton:last-child {
  width: 85%;
  height: 20px;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 12px;
  line-height: 1.6;
}
.status-badge {
  display: inline-block;
  background: #f5e9f2;
  color: #813966;
  font-size: 12px;
  font-weight: 650;
  padding: 4px 9px;
  border-radius: 5px;
}
.status-badge.clean {
  background: #e8f2ee;
  color: #346756;
}
.metrics {
  display: flex;
  gap: 22px;
  margin: 14px 0;
}
.metrics > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.metrics span {
  font-size: 12px;
  color: var(--muted);
}
.metrics strong {
  font-size: 22px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.region-section {
  margin-top: 8px;
}
.inspection-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  width: 100%;
}
#hold-original {
  touch-action: none;
  user-select: none;
}
#hold-original[aria-pressed="true"] {
  background: var(--accent);
  color: white;
}
.region-markers {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.region-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 28px;
  height: 28px;
  border: 2px solid white;
  border-radius: 50%;
  background: #1e293b;
  color: white;
  font-size: 13px;
  font-weight: 700;
  padding: 0;
  pointer-events: auto;
  box-shadow:
    0 0 0 1px #1e293b,
    0 2px 5px #0008;
}
.region-marker[aria-pressed="true"],
.region-marker.hovered {
  background: #a6007d;
  outline: 2px solid white;
}
.region-highlight {
  position: absolute;
  pointer-events: none;
  border: 2px solid white;
  outline: 2px solid #a6007d;
  background: #e600a90d;
}
.region-item.hovered {
  border-color: #a6007d;
  background: #fff0fb;
}
.regions {
  position: relative;
}
#copy-fallback {
  width: 100%;
  min-height: 110px;
  padding: 8px;
  font: inherit;
}
.explanation-panel {
  margin: 16px 0;
  padding: 14px;
  background: #f3f6fa;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.explanation-panel h3 {
  margin: 0 0 8px;
  font-size: 16px;
}
.explanation-panel p {
  margin: 0 0 8px;
  line-height: 1.55;
}
.region-item img {
  width: 72px;
  height: 54px;
  object-fit: contain;
  border-radius: 4px;
  flex-shrink: 0;
}
.region-copy {
  display: grid;
  flex: 1;
  min-width: 0;
  gap: 2px;
}
.region-location {
  font-size: 12px;
}
.regions {
  display: grid;
  gap: 6px;
  max-height: 240px;
  overflow-y: auto;
}
.region-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--border);
  background: #fafbfd;
  border-radius: 6px;
  padding: 7px 10px;
  text-align: left;
  font-size: 13px;
}
.region-item:hover,
.region-item[aria-pressed="true"] {
  background: #eff4f7;
  border-color: #718e9f;
}
.region-item span:last-child {
  color: var(--muted);
  white-space: normal;
}
.attribution-section {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.attribution-section h3 {
  font-size: 12px;
  color: var(--muted);
  font-weight: 550;
  margin-bottom: 5px;
}
.attribution-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 6px;
}
.attribution-section .muted {
  font-size: 13px;
  margin-bottom: 8px;
}
.attribution-section details {
  font-size: 13px;
  margin-top: 10px;
}
.class-probabilities {
  display: grid;
  gap: 6px;
}
.class-probabilities > div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
}
.class-probabilities dt {
  color: var(--muted);
}
.class-probabilities dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
}
.probability-meter {
  grid-column: 1/-1;
  height: 4px;
  background: #e9eef3;
  border-radius: 2px;
  overflow: hidden;
}
.probability-meter span {
  display: block;
  height: 100%;
  background: #627c8f;
}
.export-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 16px;
}
.export-actions #download-report {
  grid-column: 1 / -1;
}
.analyzing-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: #e9eef370;
  backdrop-filter: blur(3px);
}
.analysis-card {
  display: flex;
  gap: 12px;
  align-items: center;
  background: white;
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px #27354514;
  border-radius: 10px;
  padding: 14px 18px;
  max-width: 360px;
}
.analysis-card strong {
  font-size: 14px;
  font-weight: 550;
}
.spinner {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border: 2px solid #dae4ec;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
.error-message {
  padding: 16px 22px;
  background: #fff2e9;
  color: #8a3e1f;
  border-top: 1px solid #f1d5c2;
}
.retry {
  margin: 12px 22px;
}
.examples {
  max-width: 740px;
  margin: 30px auto;
}
.examples h2 {
  font-size: 16px;
  margin: 0 0 14px;
  font-weight: 600;
}
.example-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.example {
  display: flex;
  gap: 14px;
  align-items: center;
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  text-align: left;
  min-width: 0;
}
.example:hover {
  border-color: #8fa9ba;
  background: #fcfdff;
}
.example img {
  width: 84px;
  height: 65px;
  object-fit: cover;
  border-radius: 5px;
}
.example span {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.example strong {
  font-size: 14px;
  font-weight: 600;
}
.example small {
  font-size: 12px;
  color: var(--muted);
}
.error-message:empty {
  display: none;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes loading-pulse {
  50% {
    opacity: 0.45;
  }
}
@media (max-width: 1100px) {
  .app {
    padding: 0 20px 24px;
  }
  .inspection-grid {
    grid-template-columns: minmax(0, 1fr) 300px;
  }
  .viewer-toolbar {
    padding: 12px;
  }
  .display-options {
    padding: 12px;
  }
  .mask-settings {
    gap: 8px;
  }
  .image-stage {
    height: clamp(360px, 58vh, 720px);
  }
}
@media (max-width: 850px) {
  .inspection-grid {
    grid-template-columns: 1fr;
  }
  .result-panel {
    border-left: 0;
    border-top: 1px solid var(--border);
  }
  .image-stage {
    height: clamp(330px, 60vh, 680px);
  }
  .result-panel h2 {
    font-size: 22px;
  }
  .intro {
    margin-top: 34px;
  }
  .desktop-break {
    display: none;
  }
}
@media (max-width: 520px) {
  .app {
    padding: 0 12px 20px;
  }
  .header {
    height: auto;
    min-height: 68px;
    padding: 10px 0;
    flex-wrap: wrap;
  }
  .brand {
    font-size: 23px;
  }
  .header-actions {
    gap: 14px;
    margin-left: auto;
    font-size: 13px;
  }
  .intro h1 {
    font-size: 29px;
    letter-spacing: -0.7px;
  }
  .intro p {
    font-size: 15px;
  }
  .workspace {
    border-radius: 10px;
  }
  .toolbar {
    padding: 12px;
  }
  .file-meta {
    flex-direction: column;
    gap: 2px;
  }
  .file-meta strong {
    max-width: 48vw;
    font-size: 13px;
  }
  .file-meta span {
    font-size: 12px;
  }
  .viewer-toolbar {
    gap: 10px;
  }
  .view-controls button {
    padding: 7px 10px;
    font-size: 13px;
  }
  .zoom-controls {
    margin-left: auto;
  }
  .display-options {
    gap: 12px;
  }
  .mask-settings {
    gap: 12px;
  }
  .example-grid {
    grid-template-columns: 1fr;
  }
  .upload-area strong {
    font-size: 17px;
  }
  .image-stage {
    height: 380px;
    max-height: 65vh;
  }
  .result-panel {
    padding: 20px;
  }
  .intro {
    margin-top: 28px;
  }
}
@media (min-width: 851px) {
  .app:has(.workspace.has-image) {
    padding-bottom: 16px;
  }
  .app:has(.workspace.has-image) .header {
    height: 64px;
  }
  .workspace.has-image {
    margin-top: 16px;
  }
  .has-image .toolbar {
    padding: 10px 16px;
  }
  .has-image .button {
    min-height: 36px;
    padding: 7px 12px;
    font-size: 13px;
  }
  .inspection-grid {
    height: calc(100dvh - 155px);
    min-height: 360px;
  }
  .image-column {
    display: flex;
    flex-direction: column;
    min-height: 0;
  }
  .viewer-toolbar {
    padding: 10px 12px;
  }
  .image-stage {
    flex: 1;
    height: auto;
    min-height: 0;
  }
  .display-options {
    padding: 10px 12px;
  }
  .viewer-legend {
    padding: 0 12px 12px;
  }
  .result-panel {
    min-height: 0;
    overflow-y: auto;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  ::backdrop {
    animation: none !important;
    scroll-behavior: auto !important;
  }
}
