:root {
  --black: #09090b;
  --black-soft: #12110f;
  --black-raised: #17150f;
  --gold: #c8aa4b;
  --gold-bright: #e3c565;
  --gold-muted: #695a2d;
  --gold-soft: #28220f;
  --ink: #f2eee5;
  --muted: #a69e90;
  --line: #332e24;
  --danger: #e7cda0;
}

* { box-sizing: border-box; }

html { background: var(--black); scroll-behavior: smooth; }

body {
  min-width: 0;
  margin: 0;
  background:
    radial-gradient(circle at 12% -6%, #201a0a 0, transparent 24rem),
    var(--black);
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

button,
input { font: inherit; }

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

.app {
  width: min(100% - 24px, 520px);
  margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top)) 0 calc(40px + env(safe-area-inset-bottom));
}

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

.search-box {
  position: sticky;
  top: max(8px, env(safe-area-inset-top));
  z-index: 2;
  display: block;
  width: 100%;
  border: 2px solid var(--gold);
  border-radius: 3px;
  background: rgba(18, 17, 15, 0.95);
  box-shadow: 0 0 0 1px rgba(255, 239, 185, 0.07) inset, 0 8px 24px rgba(0, 0, 0, 0.28);
}

.search-box input {
  width: 100%;
  height: 54px;
  padding: 0 48px 0 16px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
}

.search-box input::placeholder { color: #827b6f; font-weight: 500; }

.search-box:focus-within { border-color: var(--gold-bright); }

.search-mark {
  position: absolute;
  top: 50%;
  right: 16px;
  transform: translateY(-50%);
  color: var(--gold);
  font-size: 26px;
  line-height: 1;
  pointer-events: none;
}

.status-row {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.status-copy {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.status-actions { display: flex; flex: 0 0 auto; gap: 12px; }

.text-button {
  padding: 5px 0;
  border: 0;
  background: transparent;
  color: var(--gold-bright);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.text-button:focus-visible,
.card:focus-visible,
.details-summary:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 3px;
}

.card-field {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  align-items: start;
}

.card {
  appearance: none;
  display: flex;
  min-height: 0;
  aspect-ratio: 0.7;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 10px 4px;
  border: 1px solid var(--gold-muted);
  border-radius: 2px;
  background: linear-gradient(145deg, #17140f, var(--black-soft));
  color: var(--ink);
  cursor: pointer;
  text-align: center;
  transition: transform 120ms ease, border-color 120ms ease, background-color 120ms ease;
}

.card:hover { border-color: var(--gold); background: #1c180d; transform: translateY(-2px); }

.card.is-selected {
  border-color: var(--gold-bright);
  background: var(--gold-soft);
  box-shadow: 0 6px 18px rgba(200, 170, 75, 0.16);
}

.card-number {
  margin-bottom: 12px;
  color: #a39461;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.card-name {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.empty-state,
.error-state {
  margin: 18px 0 0;
  padding: 20px 16px;
  border: 1px dashed var(--line);
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.error-state { border-color: #715a37; color: var(--danger); }

.results { scroll-margin-top: 84px; }

.section-rule {
  height: 1px;
  margin: 36px 0 24px;
  background: linear-gradient(90deg, transparent, var(--gold-muted) 12%, var(--gold-muted) 88%, transparent);
}

.results h2 {
  margin: 0;
  color: var(--ink);
  font-size: 20px;
  line-height: 1.25;
}

.results-boundary {
  margin: 10px 0 22px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.result-list { display: grid; gap: 14px; }

.result-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--black-soft);
}

.result-heading {
  display: flex;
  align-items: baseline;
  gap: 9px;
  padding: 16px 16px 13px;
  border-bottom: 1px solid var(--line);
}

.result-number {
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.result-name { color: var(--ink); font-size: 18px; }

.shared-source-note {
  margin: 0;
  padding: 10px 16px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.result-block { padding: 16px; }

.result-block + .result-block { border-top: 1px solid var(--line); }

.result-label {
  display: block;
  margin-bottom: 8px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.result-copy {
  margin: 0;
  color: #d5d0c4;
  font-size: 14px;
  line-height: 1.75;
  white-space: pre-wrap;
}

.source-details { border-top: 1px solid var(--line); }

.details-summary {
  display: block;
  padding: 15px 16px;
  color: var(--ink);
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  list-style: none;
}

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

.details-summary::after {
  float: right;
  color: var(--gold);
  content: "+";
  font-size: 18px;
  line-height: 1;
}

details[open] .details-summary::after { content: "−"; }

.full-source {
  margin: 0;
  padding: 0 16px 20px;
  color: #beb8ab;
  font: inherit;
  font-size: 13px;
  line-height: 1.75;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (max-width: 360px) {
  .app { width: min(100% - 20px, 520px); }
  .card-field { gap: 8px; }
  .card-name { font-size: 14px; }
  .status-actions { gap: 9px; }
}

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