:root {
  color-scheme: light;
  --header: #141c24;
  --header-line: rgba(255, 255, 255, 0.08);
  --hero: #1b2836;
  --canvas: #e7edf2;
  --surface: #ffffff;
  --ink: #1c2833;
  --muted: #5c6b7a;
  --faint: #7d8b99;
  --line: #d5dee6;
  --teal: #1aa58a;
  --sell: #c43d78;
  --buy: #0e8f86;
  --danger: #c0392b;
  --ingame: #1e8f4e;
  --online: #c47b12;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--canvas);
}

button, input, select { font: inherit; color: inherit; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 32px;
  height: 68px;
  padding: 0 28px;
  background: linear-gradient(180deg, #18222c 0%, #121a22 100%);
  color: #fff;
  box-shadow: 0 1px 0 rgba(212, 169, 79, 0.28), 0 8px 24px rgba(0, 0, 0, 0.25);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  text-decoration: none;
}
.emblem {
  width: 44px;
  height: 44px;
  flex: none;
  filter: drop-shadow(0 0 10px rgba(212, 169, 79, 0.28));
  transition: transform 0.4s ease;
}
.brand:hover .emblem { transform: rotate(-8deg) scale(1.04); }
.brand-copy { display: flex; flex-direction: column; line-height: 1.1; }
.brand-copy strong {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: 0.2em;
  background: linear-gradient(180deg, #fff6dc 0%, #e2bd6a 55%, #b08435 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-copy span {
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 11px;
  letter-spacing: 0.16em;
}

.nav { display: flex; align-items: stretch; height: 100%; gap: 2px; }
.tool {
  position: relative;
  height: 100%;
  padding: 0 16px;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  font-size: 15px;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}
.tool::after {
  content: "";
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(90deg, var(--teal), #5ff0d2);
  transform: scaleX(0);
  transition: transform 0.25s ease;
}
.tool:hover { color: #fff; background: rgba(255, 255, 255, 0.04); }
.tool.active { color: #fff; font-weight: 600; }
.tool.active::after { transform: scaleX(1); }

.top-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  color: rgba(255, 255, 255, 0.5);
  font-size: 12px;
}
.pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #3ddc97;
  box-shadow: 0 0 0 0 rgba(61, 220, 151, 0.6);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  70% { box-shadow: 0 0 0 7px rgba(61, 220, 151, 0); }
  100% { box-shadow: 0 0 0 0 rgba(61, 220, 151, 0); }
}

.hero {
  position: relative;
  z-index: 3;
  padding: 44px 24px 40px;
  background:
    radial-gradient(600px 220px at 50% -20%, rgba(95, 240, 210, 0.22), transparent 70%),
    radial-gradient(500px 260px at 90% 120%, rgba(212, 169, 79, 0.16), transparent 70%),
    linear-gradient(180deg, #1d2b39 0%, #16222e 100%);
  color: #fff;
  text-align: center;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse at 50% 30%, #000 20%, transparent 75%);
  pointer-events: none;
}
.hero::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(212, 169, 79, 0.6), transparent);
}
.hero > * { position: relative; }
.hero-kicker {
  display: inline-block;
  margin: 0 0 12px;
  padding: 4px 12px;
  border: 1px solid rgba(95, 240, 210, 0.35);
  border-radius: 999px;
  background: rgba(95, 240, 210, 0.08);
  color: #8ff5df;
  font-size: 12px;
  letter-spacing: 0.08em;
}
h1 {
  margin: 0;
  font-size: 34px;
  font-weight: 750;
  letter-spacing: 0.02em;
  line-height: 1.2;
}
.hero-note {
  margin: 10px auto 22px;
  max-width: 520px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
  line-height: 1.6;
}

.finder {
  position: relative;
  width: min(640px, 100%);
  margin: 0 auto;
}
.search { position: relative; display: block; }
.search::before {
  content: "";
  position: absolute;
  left: 18px;
  top: 50%;
  width: 14px;
  height: 14px;
  border: 2px solid #8a98a6;
  border-radius: 50%;
  transform: translateY(-60%);
  pointer-events: none;
}
.search::after {
  content: "";
  position: absolute;
  left: 31px;
  top: 30px;
  width: 7px;
  height: 2px;
  background: #8a98a6;
  transform: rotate(45deg);
  pointer-events: none;
}
.search input {
  width: 100%;
  height: 52px;
  padding: 0 16px 0 48px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-size: 16px;
  outline: none;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
  transition: box-shadow 0.2s;
}
.search input:focus {
  box-shadow: 0 0 0 4px rgba(95, 240, 210, 0.35), 0 12px 32px rgba(0, 0, 0, 0.28);
}
.status {
  margin: 10px 0 0;
  color: rgba(255, 255, 255, 0.62);
  font-size: 13px;
  text-align: left;
}
.loading {
  margin: 0;
  padding: 28px;
  border: 1px solid #dfe6ec;
  border-radius: 12px;
  background: var(--surface);
  color: var(--muted, #5b6875);
  font-size: 14px;
  text-align: center;
}

.notice {
  margin: 12px 0 0;
  color: var(--danger);
  font-size: 14px;
}

.suggestions {
  position: absolute;
  z-index: 4;
  left: 0;
  right: 0;
  top: 58px;
  margin: 0;
  padding: 6px;
  list-style: none;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  max-height: 360px;
  overflow: auto;
  text-align: left;
}
.suggestions button {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 6px 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.suggestions button[aria-selected="true"],
.suggestions button:hover { background: #f2f6f8; }
.suggestions img, .item-icon {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 4px;
  background: #eef2f5;
}
.suggest-name { display: block; font-size: 14px; }
.suggest-meta { display: block; margin-top: 2px; color: var(--faint); font-size: 12px; }

.canvas {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
  padding: 20px 0 48px;
}

.detail { display: flex; flex-direction: column; gap: 12px; }
.item-card, .rank-block, .empty-state {
  background: var(--surface);
  border: 1px solid #dfe6ec;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(20, 28, 36, 0.04), 0 8px 24px rgba(20, 28, 36, 0.05);
}
.item-card, .rank-block { padding: 20px 22px; }
.item-card { border-top: 3px solid var(--teal); }
.empty-state { margin: 0; padding: 20px; color: var(--muted); }

.item-main {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 14px;
  align-items: center;
}
.item-icon { width: 64px; height: 64px; }
.item-main h2 { margin: 0; font-size: 22px; font-weight: 650; }
.en-name { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.facts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

.chip, .part, .toggle, .filters select, .copy {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--muted);
}
.chip { padding: 2px 8px; font-size: 12px; }
.chip strong { color: var(--ink); font-weight: 600; }
.recipe { margin: 12px 0 0; font-size: 14px; }
.parts, .filters, .scope-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
}
.part, .toggle {
  padding: 6px 10px;
  font-size: 13px;
  cursor: pointer;
}
.part.active, .toggle[aria-pressed="true"] {
  color: #fff;
  background: var(--teal);
  border-color: var(--teal);
}
.filters select { height: 32px; padding: 0 8px; font-size: 13px; }
.check { display: flex; gap: 6px; align-items: center; color: var(--muted); font-size: 13px; }

.rank-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  font-size: 16px;
  font-weight: 700;
}
.rank-title::before {
  content: "";
  width: 4px;
  height: 16px;
  border-radius: 2px;
  background: linear-gradient(180deg, #e2bd6a, #b08435);
}
.summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.summary article {
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid transparent;
}
.summary .sell { background: linear-gradient(135deg, #fdf1f6, #fff 70%); border-color: #f5d5e3; }
.summary .buy { background: linear-gradient(135deg, #ecf8f6, #fff 70%); border-color: #cdeee8; }
.summary p { margin: 0; color: var(--faint); font-size: 12px; }
.summary strong {
  display: block;
  margin-top: 4px;
  font-size: 26px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.summary .sell strong { color: var(--sell); }
.summary .buy strong { color: var(--buy); }
.summary span { color: var(--muted); font-size: 12px; }

.orders {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 14px;
}
.column h3 { margin: 0 0 6px; font-size: 15px; font-weight: 700; }
.sell-list h3 { color: var(--sell); }
.buy-list h3 { color: var(--buy); }
.order {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 8px;
  padding: 12px 10px;
  margin: 0 -10px;
  border-bottom: 1px solid #edf1f4;
  border-radius: 8px;
  transition: background 0.15s;
}
.order:hover { background: #f5f8fa; }
.column h3 + .order::before {
  content: "最优";
  grid-column: 1 / -1;
  width: fit-content;
  padding: 1px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
}
.sell-list h3 + .order { background: #fdf4f8; }
.buy-list h3 + .order { background: #f0faf8; }
.sell-list h3 + .order::before { background: var(--sell); }
.buy-list h3 + .order::before { background: var(--buy); }
.price {
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.sell-list .price { color: var(--sell); }
.buy-list .price { color: var(--buy); }
.unit { display: block; color: var(--faint); font-size: 12px; font-weight: 400; }
.who { margin: 0; font-size: 14px; font-weight: 600; }
.who a { color: var(--ink); text-decoration: none; }
.who a:hover { color: var(--teal); }
.meta { margin: 3px 0 0; color: var(--faint); font-size: 12px; line-height: 1.5; }
.copies { display: flex; gap: 6px; margin-top: 6px; }
.copy {
  height: 26px;
  padding: 0 8px;
  color: var(--teal);
  font-size: 12px;
  cursor: pointer;
}
.copy:hover { background: #e7f7f4; }
.dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 4px;
  border-radius: 50%;
  background: var(--faint);
}
.dot.ingame { background: var(--ingame); }
.dot.online { background: var(--online); }
.empty { margin: 8px 0 0; color: var(--faint); font-size: 13px; }
.external {
  margin-left: auto;
  color: var(--teal);
  font-size: 13px;
  text-decoration: none;
}
.external:hover { text-decoration: underline; }

.item-main { grid-template-columns: 64px 1fr auto; align-items: start; }
.fav-toggle {
  height: 34px;
  padding: 0 14px;
  border: 1px solid #e6cf97;
  border-radius: 8px;
  background: #fffaf0;
  color: #9a7426;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
}
.fav-toggle:hover { background: #fdf1d6; }
.fav-toggle[aria-pressed="true"] {
  border-color: transparent;
  background: linear-gradient(180deg, #e8c36f, #c4963d);
  color: #fff;
  box-shadow: 0 4px 12px rgba(196, 150, 61, 0.35);
}

.favorites { margin-top: 28px; }
.detail:not([hidden]) ~ .favorites { margin-top: 36px; }
.fav-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.fav-head h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}
.fav-head h2::before {
  content: "★";
  color: #d4a94f;
  font-size: 16px;
}
.fav-count { color: var(--faint); font-size: 13px; }
.fav-head .toggle { margin-left: auto; }
.fav-head .toggle:disabled { opacity: 0.6; cursor: default; }

.fav-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
}
.fav-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid #dfe6ec;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(20, 28, 36, 0.04), 0 8px 24px rgba(20, 28, 36, 0.05);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.fav-card:hover {
  transform: translateY(-2px);
  border-color: #c9d6e0;
  box-shadow: 0 12px 28px rgba(20, 28, 36, 0.1);
}
.fav-card.current { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(26, 165, 138, 0.15); }
.fav-open {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 10px;
  align-items: center;
  padding: 0 22px 0 0;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.fav-icon {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 8px;
  background: #eef2f5;
}
.fav-names { min-width: 0; }
.fav-names strong, .fav-names span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fav-names strong { font-size: 15px; font-weight: 650; }
.fav-open:hover strong { color: var(--teal); }
.fav-names span { margin-top: 2px; color: var(--faint); font-size: 12px; }
.fav-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--faint);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s;
}
.fav-card:hover .fav-remove, .fav-remove:focus-visible { opacity: 1; }
.fav-remove:hover { background: #fbeaea; color: var(--danger); }

.fav-prices { display: flex; flex-direction: column; gap: 6px; }
.fav-row {
  display: grid;
  grid-template-columns: 44px 1fr 1fr;
  gap: 6px;
  align-items: center;
}
.fav-rank { color: var(--muted); font-size: 12px; }
.fav-price {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 5px 10px;
  border-radius: 8px;
}
.fav-now { display: flex; align-items: baseline; gap: 6px; }
.fav-delta {
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.fav-delta.good { color: #1e8f4e; }
.fav-delta.bad { color: #d9480f; }
.fav-delta.flat { color: var(--faint); font-weight: 500; }
.fav-mark {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 2px;
  padding-top: 8px;
  border-top: 1px dashed #e3e9ee;
  color: var(--faint);
  font-size: 11px;
}
.fav-remark {
  padding: 2px 6px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--teal);
  font-size: 11px;
  white-space: nowrap;
  cursor: pointer;
}
.fav-remark:hover { background: #e7f7f4; }
.fav-price small { font-size: 11px; opacity: 0.8; }
.fav-price b { font-size: 17px; font-variant-numeric: tabular-nums; }
.fav-price.sell { background: #fdf1f6; color: var(--sell); }
.fav-price.buy { background: #ecf8f6; color: var(--buy); }
.fav-wait { margin: 0; color: var(--faint); font-size: 12px; }
.fav-empty {
  grid-column: 1 / -1;
  padding: 28px;
  border: 1px dashed #c9d6e0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.6);
  text-align: center;
}
.fav-empty strong { font-size: 15px; }
.fav-empty p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }

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

@media (max-width: 800px) {
  .topbar { gap: 12px; padding: 0 12px; overflow: auto; }
  .brand-copy span { display: none; }
  .brand, .nav { flex: none; }
  .tool { padding: 0 10px; }
  .top-note { display: none; }
  .hero { padding: 24px 16px; }
  .canvas { width: min(100% - 20px, 1100px); }
  .summary, .orders, .item-main { grid-template-columns: 1fr; }
  .external { margin-left: 0; }
}
