:root {
  color-scheme: dark;
  --bg: #0a0f14;
  --surface: rgba(18, 26, 34, 0.88);
  --surface-strong: #111820;
  --surface-soft: #17222c;
  --line: rgba(255, 255, 255, 0.09);
  --text: #f3f6f8;
  --muted: #95a3af;
  --accent: #d6ff42;
  --accent-strong: #b9ec19;
  --danger: #ff6b6b;
  --warning: #ffca58;
  --success: #61dda0;
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 15% -10%, rgba(214, 255, 66, 0.12), transparent 34rem),
    radial-gradient(circle at 92% 4%, rgba(70, 150, 255, 0.11), transparent 30rem),
    linear-gradient(180deg, #0c1218 0%, #080c11 100%);
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.page-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 42px;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 58px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(214, 255, 66, 0.45);
  border-radius: 12px;
  color: #10150d;
  background: var(--accent);
  font-size: 24px;
  font-weight: 900;
  box-shadow: 0 0 35px rgba(214, 255, 66, 0.12);
}

.brand-title {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.brand-subtitle {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
  font-size: 12px;
}

.status-pill.ok {
  color: var(--success);
  border-color: rgba(97, 221, 160, 0.22);
  background: rgba(97, 221, 160, 0.06);
}

.status-pill.error {
  color: var(--danger);
  border-color: rgba(255, 107, 107, 0.22);
  background: rgba(255, 107, 107, 0.06);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(430px, 1.1fr);
  align-items: end;
  gap: 60px;
  padding: 34px 0 36px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.hero h1,
.section-heading h2 {
  margin: 0;
}

.hero h1 {
  max-width: 620px;
  font-size: clamp(36px, 5vw, 64px);
  line-height: 1.04;
  letter-spacing: -0.045em;
}

.hero-description {
  max-width: 620px;
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.8;
}

.search-panel {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(16, 23, 30, 0.82);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.search-row input {
  width: 100%;
  min-height: 56px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 16px;
  color: var(--text);
  background: #0b1117;
  font-size: 16px;
}

.search-row input::placeholder {
  color: #6e7a84;
}

.search-row input:focus {
  border-color: rgba(214, 255, 66, 0.44);
}

.search-row button {
  position: relative;
  min-width: 116px;
  min-height: 56px;
  border: 0;
  border-radius: 12px;
  padding: 0 20px;
  color: #11160a;
  background: var(--accent);
  font-weight: 900;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease;
}

.search-row button:hover {
  background: var(--accent-strong);
  transform: translateY(-1px);
}

.search-row button:disabled {
  cursor: wait;
  opacity: 0.75;
  transform: none;
}

.button-spinner {
  display: none;
  width: 18px;
  height: 18px;
  margin: auto;
  border: 2px solid rgba(17, 22, 10, 0.25);
  border-top-color: #11160a;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.search-row button.loading .button-label {
  display: none;
}

.search-row button.loading .button-spinner {
  display: block;
}

.quick-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-top: 12px;
}

.quick-label {
  color: var(--muted);
  font-size: 12px;
}

.quick-item {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 9px;
  color: #c4ced6;
  background: transparent;
  font-size: 11px;
  cursor: pointer;
}

.quick-item:hover {
  border-color: rgba(214, 255, 66, 0.32);
  color: var(--accent);
}

.message-area {
  min-height: 14px;
  margin: 12px 0 18px;
}

.message {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  font-size: 13px;
  line-height: 1.6;
}

.message.error {
  color: #ffb0b0;
  border-color: rgba(255, 107, 107, 0.25);
  background: rgba(255, 107, 107, 0.06);
}

.message.loading {
  color: #d8dfc0;
  border-color: rgba(214, 255, 66, 0.16);
}

.result-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background:
    linear-gradient(145deg, rgba(25, 35, 44, 0.96), rgba(12, 18, 24, 0.96));
  box-shadow: var(--shadow);
}

.item-primary {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 26px;
  padding: 28px;
}

.item-image-wrap {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 150px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    radial-gradient(circle, rgba(214, 255, 66, 0.09), transparent 65%),
    #0d141a;
}

.item-image {
  display: block;
  width: 100%;
  height: 150px;
  object-fit: contain;
  padding: 12px;
}

.item-image-fallback {
  color: rgba(214, 255, 66, 0.4);
  font-size: 52px;
  font-weight: 900;
}

.item-heading {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
}

.item-heading-top {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.item-heading h2 {
  margin: 2px 0 22px;
  font-size: clamp(26px, 4vw, 42px);
  line-height: 1.1;
  letter-spacing: -0.035em;
  overflow-wrap: anywhere;
}

.grade-badge {
  flex: 0 0 auto;
  padding: 5px 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  color: #c9d1d8;
  font-size: 11px;
}

.current-price-block {
  padding-top: 4px;
}

.price-label,
.metric-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.price-line {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
}

.price-line strong {
  color: var(--accent);
  font-size: clamp(42px, 7vw, 72px);
  line-height: 1;
  letter-spacing: -0.05em;
}

.currency-label {
  color: var(--muted);
  font-size: 13px;
}

.change-line {
  margin-top: 10px;
  font-size: 13px;
}

.history-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--line);
}

.metric-card {
  padding: 20px 28px;
  background: rgba(10, 15, 20, 0.74);
}

.metric-card strong {
  display: block;
  margin: 5px 0 7px;
  font-size: 23px;
}

.metric-change,
.change-line {
  font-weight: 700;
}

.positive {
  color: var(--success);
}

.negative {
  color: var(--danger);
}

.neutral {
  color: var(--muted);
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  padding: 18px 28px;
}

.secondary-button,
.ghost-button,
.text-button {
  border-radius: 10px;
  cursor: pointer;
}

.secondary-button {
  border: 1px solid rgba(214, 255, 66, 0.24);
  padding: 9px 12px;
  color: var(--accent);
  background: rgba(214, 255, 66, 0.06);
}

.ghost-button {
  border: 1px solid var(--line);
  padding: 9px 12px;
  color: #cad2d8;
  background: transparent;
}

.secondary-button:hover,
.ghost-button:hover {
  border-color: rgba(214, 255, 66, 0.32);
}

.diagnostics {
  border-top: 1px solid var(--line);
  padding: 0 28px 22px;
}

.diagnostics summary {
  padding: 16px 0;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}

.diagnostic-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 18px;
  margin: 0;
}

.diagnostic-grid div {
  min-width: 0;
  padding: 10px 0;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
}

.diagnostic-grid dt {
  margin-bottom: 4px;
  color: #687681;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.diagnostic-grid dd {
  margin: 0;
  color: #b9c4cc;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.recent-section {
  margin-top: 28px;
  padding: 22px 0;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 12px;
}

.section-heading h2 {
  font-size: 20px;
}

.text-button {
  border: 0;
  padding: 7px 0;
  color: var(--muted);
  background: none;
  font-size: 12px;
}

.text-button:hover {
  color: var(--text);
}

.recent-empty {
  border: 1px dashed var(--line);
  border-radius: 13px;
  padding: 16px;
  color: #697780;
  font-size: 12px;
}

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

.recent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 12px 13px;
  background: rgba(255, 255, 255, 0.025);
  cursor: pointer;
}

.recent-item:hover {
  border-color: rgba(214, 255, 66, 0.22);
  background: rgba(214, 255, 66, 0.03);
}

.recent-name {
  min-width: 0;
  color: #c9d2d9;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-price {
  flex: 0 0 auto;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

footer {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: #6c7882;
  font-size: 11px;
  line-height: 1.6;
}

footer p {
  margin: 5px 0;
}

footer code {
  color: #9baaaf;
}

.footer-note {
  max-width: 800px;
}

.hidden {
  display: none !important;
}

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

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

@media (max-width: 840px) {
  .site-header {
    margin-bottom: 26px;
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 28px;
    padding-top: 18px;
  }

  .recent-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 580px) {
  .page-shell {
    width: min(100% - 22px, 1120px);
    padding-top: 14px;
  }

  .site-header {
    align-items: flex-start;
  }

  .brand-mark {
    width: 40px;
    height: 40px;
  }

  .status-pill {
    padding: 6px 9px;
    font-size: 10px;
  }

  .hero h1 {
    font-size: 38px;
  }

  .search-row {
    grid-template-columns: 1fr;
  }

  .search-row button {
    width: 100%;
  }

  .item-primary {
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 16px;
    padding: 18px;
  }

  .item-image-wrap,
  .item-image {
    min-height: 96px;
    height: 96px;
  }

  .item-image {
    padding: 8px;
  }

  .item-heading-top {
    display: block;
  }

  .item-heading h2 {
    margin-bottom: 16px;
    font-size: 26px;
  }

  .grade-badge {
    display: inline-flex;
    margin-bottom: 8px;
  }

  .price-line strong {
    font-size: 42px;
  }

  .metric-card {
    padding: 16px 18px;
  }

  .result-actions,
  .diagnostics {
    padding-left: 18px;
    padding-right: 18px;
  }

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

  .recent-list {
    grid-template-columns: 1fr;
  }
}
