:root {
  color-scheme: light;
  --accent: #ee4d2d;
  --accent-dark: #d63d20;
  --accent-soft: #fff0ec;
  --ink: #18212f;
  --muted: #667085;
  --line: #e7eaf0;
  --surface: #ffffff;
  --surface-soft: #f7f8fa;
  --success: #12805c;
  --danger: #c83532;
  --danger-soft: #fff1f0;
  --shadow: 0 18px 50px rgba(24, 33, 47, 0.08);
  --radius-large: 22px;
  --radius-medium: 14px;
  --radius-small: 9px;
  font-family: "Be Vietnam Pro", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: #f4f5f7;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0%, rgba(238, 77, 45, 0.08), transparent 29rem),
    linear-gradient(180deg, #fff 0, #f6f7f9 28rem, #f4f5f7 100%);
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid rgba(238, 77, 45, 0.24);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1180px, calc(100% - 40px));
  min-height: 82px;
  margin: 0 auto;
}

.brand {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(145deg, #ff785b, var(--accent));
  box-shadow: 0 8px 18px rgba(238, 77, 45, 0.25);
  font-size: 1.1rem;
  font-weight: 700;
}

.brand > span:last-child {
  display: grid;
  gap: 1px;
}

.brand strong {
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.brand small {
  color: var(--muted);
  font-size: 0.7rem;
}

.status-pill {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid #dcebe5;
  border-radius: 999px;
  color: var(--success);
  background: #f6fffb;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #23a77a;
  box-shadow: 0 0 0 4px rgba(35, 167, 122, 0.12);
}

.page-shell {
  width: min(1040px, calc(100% - 40px));
  margin: 58px auto 0;
}

.hero {
  width: min(800px, 100%);
  margin: 0 auto 40px;
  text-align: center;
}

.eyebrow {
  margin-bottom: 12px;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.55rem);
  line-height: 1.12;
  letter-spacing: -0.045em;
}

.hero p {
  max-width: 730px;
  margin: 20px auto 0;
  color: var(--muted);
  font-size: clamp(0.95rem, 2vw, 1.08rem);
  line-height: 1.8;
}

.inspector-card,
.progress-panel,
.message-panel,
.results-panel {
  border: 1px solid rgba(220, 224, 232, 0.9);
  border-radius: var(--radius-large);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.inspector-card {
  padding: clamp(24px, 5vw, 42px);
}

.card-heading,
.results-heading {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  justify-content: space-between;
}

.card-heading h2,
.results-heading h2,
.progress-heading h2,
.message-panel h2 {
  margin: 0;
  font-size: 1.14rem;
  letter-spacing: -0.02em;
}

.card-heading p,
.results-heading p,
.progress-heading p,
.message-panel p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.65;
}

.step-label {
  flex: 0 0 auto;
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 0.7rem;
  font-weight: 600;
}

#scrape-form {
  margin-top: 28px;
}

#scrape-form label {
  display: block;
  margin-bottom: 9px;
  font-size: 0.8rem;
  font-weight: 600;
}

.url-control {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  min-height: 58px;
  padding: 5px;
  border: 1px solid #d7dce5;
  border-radius: 13px;
  background: #fff;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.url-control:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(238, 77, 45, 0.1);
}

.url-control.is-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 4px rgba(200, 53, 50, 0.08);
}

.url-icon {
  display: grid;
  width: 44px;
  place-items: center;
  color: #98a2b3;
}

.url-icon svg,
.scope-notice svg {
  width: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.url-control input {
  min-width: 0;
  height: 46px;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 0.9rem;
}

.url-control input::placeholder {
  color: #a3aab7;
}

.url-control button,
.secondary-button {
  border: 0;
  border-radius: var(--radius-small);
  cursor: pointer;
  font-weight: 600;
  transition: background 160ms ease, transform 160ms ease, opacity 160ms ease;
}

.url-control button {
  display: inline-flex;
  gap: 9px;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 20px;
  color: #fff;
  background: var(--accent);
  font-size: 0.82rem;
}

.url-control button:hover:not(:disabled) {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

.url-control button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.button-spinner {
  display: none;
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.url-control button.is-loading .button-spinner {
  display: inline-block;
}

.field-help {
  min-height: 18px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.72rem;
}

.field-help.is-error {
  color: var(--danger);
}

.scope-notice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-top: 24px;
  padding: 14px 16px;
  border: 1px solid #e7e8ed;
  border-radius: 11px;
  color: #596273;
  background: #fafbfc;
}

.scope-notice svg {
  flex: 0 0 auto;
  margin-top: 1px;
  color: #7a8495;
}

.scope-notice p {
  margin: 0;
  font-size: 0.73rem;
  line-height: 1.7;
}

.progress-panel,
.message-panel,
.results-panel {
  margin-top: 24px;
  padding: clamp(22px, 4vw, 34px);
}

.progress-heading,
.message-panel {
  display: flex;
  gap: 16px;
  align-items: center;
}

.loader {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border: 3px solid var(--accent-soft);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 850ms linear infinite;
}

.progress-track {
  height: 6px;
  margin-top: 22px;
  overflow: hidden;
  border-radius: 999px;
  background: #f0f1f4;
}

.progress-track span {
  display: block;
  width: 38%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #ff896f);
  animation: progress 1.8s ease-in-out infinite;
}

.progress-hint {
  margin: 11px 0 0;
  color: #8a93a2;
  font-size: 0.7rem;
  text-align: center;
}

.error-panel {
  align-items: flex-start;
  border-color: #f3cbc8;
  background: var(--danger-soft);
  box-shadow: none;
}

.message-icon {
  display: grid;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--danger);
  font-weight: 700;
}

.error-panel h2 {
  color: #9f2724;
}

.error-panel p {
  color: #81413f;
}

.results-heading {
  padding-bottom: 24px;
}

.results-heading .eyebrow {
  margin-bottom: 7px;
}

.secondary-button {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid #dfe3e9;
  color: #485264;
  background: #fff;
  font-size: 0.72rem;
}

.secondary-button:hover {
  border-color: #cfd5de;
  background: var(--surface-soft);
}

.tab-list {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 5px;
  border-radius: 12px;
  background: var(--surface-soft);
  scrollbar-width: thin;
}

.tab-list button {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  color: #697386;
  background: transparent;
  cursor: pointer;
  font-size: 0.73rem;
  font-weight: 600;
}

.tab-list button[aria-selected="true"] {
  color: var(--ink);
  background: #fff;
  box-shadow: 0 3px 9px rgba(24, 33, 47, 0.07);
}

.tab-panel {
  min-height: 170px;
  padding-top: 26px;
}

.data-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.data-card {
  min-width: 0;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.data-card.is-wide {
  grid-column: 1 / -1;
}

.data-label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.025em;
  text-transform: uppercase;
}

.data-value {
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 0.85rem;
  line-height: 1.6;
}

.price-value {
  color: var(--accent);
  font-size: 1.05rem;
  font-weight: 700;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
  white-space: nowrap;
}

.data-table th,
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.data-table th {
  color: var(--muted);
  background: #fafbfc;
  font-weight: 600;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.media-item {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}

.media-item img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.media-item a {
  display: block;
  overflow: hidden;
  padding: 9px 11px;
  color: #566174;
  font-size: 0.65rem;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.json-block {
  position: relative;
}

.json-block pre {
  max-height: 560px;
  margin: 0;
  overflow: auto;
  padding: 18px;
  border: 1px solid #313c4e;
  border-radius: 12px;
  color: #dce5f2;
  background: #18212f;
  font: 0.72rem/1.65 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  tab-size: 2;
}

.empty-state {
  display: grid;
  min-height: 150px;
  place-items: center;
  padding: 30px;
  border: 1px dashed #d9dde5;
  border-radius: 12px;
  color: var(--muted);
  background: #fafbfc;
  font-size: 0.8rem;
  text-align: center;
}

.site-footer {
  width: min(1040px, calc(100% - 40px));
  margin: 38px auto 0;
  padding: 26px 0 34px;
  color: #8a93a2;
  font-size: 0.7rem;
  text-align: center;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  max-width: min(360px, calc(100% - 44px));
  padding: 12px 16px;
  border-radius: 10px;
  color: #fff;
  background: #202b3b;
  box-shadow: 0 12px 34px rgba(24, 33, 47, 0.23);
  font-size: 0.75rem;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes progress {
  0% {
    transform: translateX(-110%);
  }
  50% {
    transform: translateX(115%);
  }
  100% {
    transform: translateX(310%);
  }
}

@media (max-width: 720px) {
  .site-header,
  .page-shell,
  .site-footer {
    width: min(100% - 28px, 1040px);
  }

  .site-header {
    min-height: 72px;
  }

  .brand small,
  .status-pill {
    display: none;
  }

  .page-shell {
    margin-top: 36px;
  }

  .hero {
    margin-bottom: 28px;
    text-align: left;
  }

  .hero p {
    margin-top: 14px;
  }

  .card-heading,
  .results-heading {
    display: block;
  }

  .step-label {
    display: inline-block;
    margin-top: 14px;
  }

  .url-control {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .url-control button {
    grid-column: 1 / -1;
    width: 100%;
    margin-top: 5px;
  }

  .secondary-button {
    margin-top: 15px;
  }

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

  .progress-panel,
  .message-panel,
  .results-panel {
    padding: 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
