:root {
  color-scheme: light;
  --ink: #16201f;
  --muted: #65706e;
  --line: #dce2df;
  --surface: #ffffff;
  --surface-soft: #f4f7f5;
  --accent: #066b58;
  --accent-dark: #044f42;
  --accent-pale: #dcf2eb;
  --warning: #8a5b00;
  --danger: #a52a2a;
  --shadow: 0 16px 45px rgba(21, 50, 44, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 82% -8%, rgba(56, 154, 126, 0.15), transparent 31rem),
    var(--surface-soft);
}

a { color: inherit; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button:disabled, select:disabled, input:disabled { cursor: not-allowed; opacity: 0.55; }

.landing-page {
  display: grid;
  place-items: center;
  padding: 3rem 1.25rem;
}

.landing-shell { width: min(960px, 100%); }
.eyebrow {
  margin: 0 0 0.55rem;
  color: var(--accent);
  font-size: 0.73rem;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.landing-shell h1, .intro h1 {
  margin: 0;
  font-size: clamp(2.5rem, 7vw, 5.25rem);
  line-height: 0.98;
  letter-spacing: -0.06em;
}

.lede, .intro > div > p:last-child {
  max-width: 720px;
  margin: 1.3rem 0 2.5rem;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.65;
}

.primary-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.feature-link {
  display: flex;
  min-height: 210px;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1.6rem;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255,255,255,0.88);
  box-shadow: var(--shadow);
  text-decoration: none;
  transition: border-color 160ms ease, transform 160ms ease;
}

.feature-link:hover { border-color: var(--accent); transform: translateY(-3px); }
.feature-link span { margin-bottom: auto; color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.1em; }
.feature-link strong { font-size: 1.7rem; }
.feature-link small { margin-top: 0.5rem; color: var(--muted); line-height: 1.45; }

.service-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  margin-top: 1.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}
.service-links span { margin-right: 0.5rem; font-weight: 700; color: var(--ink); }
.service-links a:hover { color: var(--accent); }

.topbar {
  display: flex;
  min-height: 58px;
  align-items: center;
  gap: 0.9rem;
  padding: 0 3vw;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(14px);
  font-size: 0.9rem;
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { color: var(--accent); font-weight: 850; text-decoration: none; letter-spacing: -0.02em; }
.divider { width: 1px; height: 18px; background: var(--line); }
.api-link { margin-left: auto; color: var(--muted); }

.console-shell { width: min(1180px, calc(100% - 2rem)); margin: 0 auto; padding: 3.5rem 0 5rem; }
.intro { display: flex; justify-content: space-between; gap: 2rem; align-items: flex-end; margin-bottom: 2rem; }
.intro h1 { font-size: clamp(2.3rem, 5vw, 4.25rem); }
.intro > div > p:last-child { margin-bottom: 0; }
.catalog-state {
  flex: 0 0 auto;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.82rem;
}
.catalog-state.ready { border-color: #a6d6c7; color: var(--accent-dark); background: var(--accent-pale); }
.catalog-state.error { border-color: #e3aaaa; color: var(--danger); background: #fff1f1; }

.console-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.85fr); gap: 1rem; }
.panel { border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,0.94); box-shadow: var(--shadow); }
.selection-panel, .action-panel, .result-panel { padding: clamp(1.2rem, 3vw, 2rem); }
.panel-heading { display: flex; gap: 1rem; align-items: flex-start; }
.panel-heading h2 { margin: 0; font-size: 1.15rem; }
.panel-heading p { margin: 0.35rem 0 0; color: var(--muted); font-size: 0.86rem; line-height: 1.45; }
.step { display: grid; width: 2rem; height: 2rem; flex: 0 0 2rem; place-items: center; border-radius: 50%; background: var(--ink); color: white; font-size: 0.72rem; font-weight: 800; }

.source-choice {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
  margin: 1.8rem 0 0;
  padding: 0;
  border: 0;
}
.source-choice legend { margin-bottom: 0.5rem; color: var(--muted); font-size: 0.78rem; font-weight: 750; }
.source-choice label {
  display: flex;
  min-height: 46px;
  align-items: center;
  gap: 0.65rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid #bdc8c4;
  border-radius: 10px;
  background: white;
  cursor: pointer;
}
.source-choice label:has(input:checked) { border-color: var(--accent); background: var(--accent-pale); }
.source-choice input { width: auto; min-height: 0; margin: 0; accent-color: var(--accent); }
.source-choice label > span { color: var(--ink); font-size: 0.85rem; }

.selectors { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 0.9rem; margin: 1rem 0 1.2rem; }
label { display: grid; gap: 0.45rem; }
label > span, .status-label { color: var(--muted); font-size: 0.78rem; font-weight: 750; }
select, input {
  width: 100%;
  min-height: 44px;
  padding: 0.65rem 0.8rem;
  border: 1px solid #bdc8c4;
  border-radius: 10px;
  background: white;
  color: var(--ink);
}
select:focus, input:focus, button:focus-visible, a:focus-visible { outline: 3px solid rgba(6,107,88,0.22); outline-offset: 2px; }

.upload-control { margin: 0 0 1.2rem; padding: 1rem; border: 1px dashed #9bb2aa; border-radius: 12px; background: #f8fbfa; }
.upload-control input[type="file"] { padding: 0.45rem; }
.upload-control small { display: block; margin-top: 0.65rem; color: var(--muted); font-size: 0.76rem; line-height: 1.45; }
.sample-description { min-height: 2.8rem; color: #46524f; font-size: 0.9rem; line-height: 1.55; }
.input-notice { margin-top: 0.9rem; padding: 0.8rem; border-left: 3px solid #c8880a; border-radius: 4px 9px 9px 4px; color: #684600; background: #fff8e8; font-size: 0.8rem; line-height: 1.5; }
.metadata { display: grid; grid-template-columns: minmax(130px, 0.7fr) minmax(0, 1.3fr); gap: 0; margin: 1.2rem 0 0; border-top: 1px solid var(--line); }
.metadata dt, .metadata dd { margin: 0; padding: 0.62rem 0; border-bottom: 1px solid var(--line); font-size: 0.78rem; }
.metadata dt { color: var(--muted); }
.metadata dd { overflow-wrap: anywhere; font-weight: 650; }
.metadata code { font-size: 0.72rem; }

.action-buttons { display: grid; gap: 0.7rem; margin: 1.8rem 0; }
.button {
  min-height: 44px;
  padding: 0.68rem 1rem;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 750;
}
.button.primary { color: white; background: var(--accent); }
.button.primary:hover { background: var(--accent-dark); }
.button.secondary { border-color: var(--ink); color: var(--ink); background: white; }
.button.secondary:hover { background: var(--surface-soft); }
.button.ghost { border-color: var(--line); color: var(--muted); background: transparent; }
.download-button { display: grid; place-items: center; text-decoration: none; }

.credential-status { display: flex; gap: 1rem; align-items: center; justify-content: space-between; padding-top: 1rem; border-top: 1px solid var(--line); }
.credential-status strong, .credential-status small { display: block; }
.credential-status strong { margin-top: 0.2rem; font-size: 0.88rem; }
.credential-status small { max-width: 300px; margin-top: 0.2rem; color: var(--muted); line-height: 1.35; }

.result-panel { margin-top: 1rem; }
.result-empty { padding: 2rem 0 0.3rem 3rem; color: var(--muted); }
.result-overview { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(180px, 0.4fr); gap: 0.75rem; margin: 1.5rem 0 1rem; }
.result-overview > div { padding: 1rem; border-radius: 12px; background: var(--surface-soft); }
.result-overview span { display: block; margin-bottom: 0.35rem; color: var(--muted); font-size: 0.73rem; }
.result-overview strong { display: block; overflow-wrap: anywhere; font-size: 0.86rem; line-height: 1.45; }
.success { color: var(--accent); }
.failure { color: var(--danger); }
.warning { color: var(--warning); }
.neutral { color: #46524f; }

.semantic-results { display: grid; grid-template-columns: minmax(185px, 0.55fr) minmax(0, 1.45fr); margin: 0 0 1rem; border-top: 1px solid var(--line); }
.semantic-results dt, .semantic-results dd { margin: 0; padding: 0.75rem 0; border-bottom: 1px solid var(--line); font-size: 0.82rem; line-height: 1.45; }
.semantic-results dt { color: var(--muted); font-weight: 700; }
.semantic-results dd { overflow-wrap: anywhere; font-weight: 700; }
.semantic-summary { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.summary-item { padding: 0.43rem 0.65rem; border: 1px solid var(--line); border-radius: 7px; color: #46524f; background: white; font-size: 0.78rem; }
.summary-item b { color: var(--ink); }
.status-item.success { border-color: #a6d6c7; background: #f2fbf8; }
.status-item.warning { border-color: #e5c77f; background: #fff9eb; }
.status-item.failure { border-color: #e3aaaa; background: #fff1f1; }
.status-item.neutral { border-color: #cbd4d1; background: #f7f9f8; }
.raw-result { margin-top: 1.2rem; border-top: 1px solid var(--line); padding-top: 1rem; }
.raw-result summary { cursor: pointer; color: var(--muted); font-size: 0.82rem; font-weight: 700; }
.raw-result pre { max-height: 460px; overflow: auto; margin: 1rem 0 0; padding: 1rem; border-radius: 10px; background: #101816; color: #d8ebe5; font: 0.75rem/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }

.credentials-dialog { width: min(500px, calc(100% - 2rem)); padding: 0; border: 0; border-radius: 18px; box-shadow: 0 30px 90px rgba(0,0,0,0.28); }
.credentials-dialog::backdrop { background: rgba(13,29,25,0.55); backdrop-filter: blur(3px); }
.credentials-dialog form { display: grid; gap: 1rem; padding: 1.5rem; }
.credentials-dialog p { margin: 0; color: var(--muted); font-size: 0.88rem; line-height: 1.5; }
.dialog-heading, .dialog-actions { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.dialog-heading h2 { margin: 0; }
.dialog-actions { justify-content: flex-end; margin-top: 0.5rem; }
.icon-button { width: 2rem; height: 2rem; border: 0; border-radius: 50%; background: var(--surface-soft); font-size: 1.25rem; }
noscript { display: block; margin: 1rem; color: var(--danger); }

@media (max-width: 800px) {
  .console-grid, .primary-links { grid-template-columns: 1fr; }
  .intro { align-items: flex-start; flex-direction: column; }
  .feature-link { min-height: 175px; }
}

@media (max-width: 560px) {
  .source-choice, .selectors, .result-overview, .semantic-results { grid-template-columns: 1fr; }
  .source-choice legend { grid-column: 1; }
  .topbar { padding: 0 1rem; }
  .console-shell { padding-top: 2.3rem; }
  .credential-status { align-items: flex-start; flex-direction: column; }
  .result-empty { padding-left: 0; }
  .semantic-results dt { padding-bottom: 0.2rem; border-bottom: 0; }
  .semantic-results dd { padding-top: 0; }
}

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