:root {
  color-scheme: dark;
  --page-bg: #080a0d;
  --panel-bg: rgba(255, 255, 255, 0.025);
  --panel-strong: rgba(255, 255, 255, 0.04);
  --gold: #d8b568;
  --gold-light: #f0d691;
  --gold-dark: #a98231;
  --line: rgba(216, 181, 104, 0.15);
  --line-strong: rgba(216, 181, 104, 0.22);
  --text: #f5f2ea;
  --muted: rgba(255, 255, 255, 0.62);
  --subtle: rgba(255, 255, 255, 0.38);
  --up: #ff5b52;
  --down: #50b96b;
  --online: #4ccb73;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--page-bg);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-width: 320px;
  min-height: 100%;
  background:
    radial-gradient(circle at 50% -10%, rgba(216, 181, 104, 0.055), transparent 34rem),
    var(--page-bg);
}

body {
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

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

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

.site-shell {
  display: grid;
  gap: 0.55rem;
  width: min(100%, 64rem);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 0.75rem;
}

.market-header,
.market-tabs,
.quote-board,
.shop-info,
.service-strip {
  border: 1px solid var(--line-strong);
  border-radius: 0.875rem;
  background: var(--panel-bg);
}

.market-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-height: 6rem;
  padding: max(0.8rem, env(safe-area-inset-top)) 1.15rem 0.8rem;
}

.brand-wrap {
  min-width: 0;
}

.brand-kicker,
.brand-subtitle,
.brand-wrap h1 {
  margin: 0;
}

.brand-kicker {
  color: var(--gold-dark);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.19em;
}

.brand-wrap h1 {
  margin-top: 0.28rem;
  color: var(--gold-light);
  font-size: clamp(1.2rem, 3.3vw, 2rem);
  font-weight: 680;
  line-height: 1.15;
  letter-spacing: 0.035em;
  white-space: nowrap;
}

.brand-subtitle {
  margin-top: 0.3rem;
  color: var(--muted);
  font-size: clamp(0.72rem, 1.8vw, 0.92rem);
}

.market-state {
  display: grid;
  justify-items: end;
  gap: 0.52rem;
}

.market-clock {
  color: rgba(255, 255, 255, 0.9);
  font-size: clamp(0.78rem, 2.3vw, 1.05rem);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.035em;
  white-space: nowrap;
}

.live-status {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

.status-dot {
  width: 0.46rem;
  height: 0.46rem;
  border-radius: 50%;
  background: var(--online);
  box-shadow: 0 0 0 0 rgba(76, 203, 115, 0.28);
  animation: status-pulse 2.4s ease-out infinite;
}

.live-status.is-stale .status-dot {
  background: var(--gold);
  box-shadow: none;
  animation: none;
}

.live-status.is-offline .status-dot {
  background: #8b9098;
  box-shadow: none;
  animation: none;
}

@keyframes status-pulse {
  65% {
    box-shadow: 0 0 0 0.34rem rgba(76, 203, 115, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(76, 203, 115, 0);
  }
}

.market-tabs {
  display: grid;
  grid-template-columns: 1fr 0.62fr auto;
  min-height: 2.8rem;
  padding: 0.26rem;
}

.market-tab {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  border-radius: 0.62rem;
  color: var(--subtle);
  font-size: 0.86rem;
  font-weight: 600;
  white-space: nowrap;
}

.market-tab.is-active {
  background: rgba(216, 181, 104, 0.065);
  color: var(--gold-light);
}

.market-tab.is-active::after {
  position: absolute;
  right: 22%;
  bottom: 0.08rem;
  left: 22%;
  height: 1px;
  background: var(--gold);
  content: "";
}

.market-tab-state {
  min-width: 9rem;
  padding-inline: 0.75rem;
  color: rgba(255, 255, 255, 0.8);
}

.market-tab-state.closed {
  color: rgba(255, 255, 255, 0.44);
}

.market-main {
  display: grid;
  gap: 0.55rem;
}

.quote-board {
  overflow: hidden;
}

.quote-head,
.quote-row {
  display: grid;
  grid-template-columns: 1.16fr 1fr 1fr 0.94fr;
  align-items: stretch;
  text-align: center;
}

.quote-head {
  min-height: 3.4rem;
  border-bottom: 1px solid var(--line-strong);
  background: rgba(0, 0, 0, 0.2);
  color: var(--gold);
  font-size: clamp(0.82rem, 2.3vw, 1rem);
  font-weight: 650;
  letter-spacing: 0.02em;
}

.quote-head > div,
.quote-row > div {
  display: grid;
  place-content: center;
  min-width: 0;
  padding: 0.45rem 0.3rem;
}

.quote-row {
  min-height: 4.8rem;
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}

.quote-row:last-child {
  border-bottom: 0;
}

.quote-row:nth-child(even) {
  background: rgba(255, 255, 255, 0.012);
}

.item-name {
  justify-items: start;
  padding-left: clamp(0.7rem, 2.4vw, 1.25rem) !important;
  text-align: left;
}

.item-name-main {
  color: var(--text);
  font-size: clamp(1rem, 3vw, 1.22rem);
  font-weight: 650;
  line-height: 1.1;
  white-space: nowrap;
}

.item-code {
  margin-top: 0.28rem;
  color: var(--subtle);
  font-size: clamp(0.66rem, 1.8vw, 0.78rem);
  font-weight: 560;
  line-height: 1;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.price-cell {
  position: relative;
  color: var(--gold-light);
  font-size: clamp(1.15rem, 4vw, 1.62rem);
  font-weight: 680;
  line-height: 1;
  letter-spacing: -0.025em;
  white-space: nowrap;
  transition: color 300ms ease, opacity 300ms ease;
}

.price-up {
  color: var(--up);
  animation: price-change 300ms ease both;
}

.price-down {
  color: var(--down);
  animation: price-change 300ms ease both;
}

.price-up::after,
.price-down::after {
  position: absolute;
  top: 50%;
  margin-left: 0.18rem;
  font-size: 0.45em;
  transform: translateY(-58%);
}

.price-up::after {
  content: "▲";
}

.price-down::after {
  content: "▼";
}

.price-neutral {
  color: var(--gold-light);
}

@keyframes price-change {
  from {
    opacity: 0.42;
  }
  to {
    opacity: 1;
  }
}

.high-low {
  gap: 0.22rem;
  color: var(--muted);
  font-size: clamp(0.72rem, 2vw, 0.88rem);
  line-height: 1.08;
}

.range-line {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  white-space: nowrap;
}

.range-line small {
  color: var(--subtle);
  font-size: 0.72em;
  font-weight: 600;
}

.range-line b {
  color: rgba(255, 255, 255, 0.68);
  font-weight: 560;
}

.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  min-height: 12rem;
  color: var(--gold-light);
  font-size: 0.95rem;
}

.loading-dot {
  width: 0.48rem;
  height: 0.48rem;
  border-radius: 50%;
  background: var(--online);
  animation: status-pulse 2.4s ease-out infinite;
}

.load-message {
  margin: 0;
  border: 1px solid rgba(216, 181, 104, 0.28);
  border-radius: 0.75rem;
  padding: 0.8rem;
  background: rgba(41, 35, 23, 0.94);
  color: var(--gold-light);
  text-align: center;
}

.load-message strong,
.load-message span {
  display: block;
}

.load-message span {
  margin-top: 0.22rem;
  color: var(--muted);
}

.load-message button,
.disclaimer-dialog button {
  margin-top: 0.65rem;
  border: 1px solid var(--line-strong);
  border-radius: 0.55rem;
  padding: 0.48rem 0.9rem;
  background: rgba(216, 181, 104, 0.12);
  color: var(--gold-light);
  font-weight: 650;
}

.shop-info {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.1rem;
}

.shop-copy {
  min-width: 0;
  color: rgba(240, 214, 145, 0.82);
  font-size: clamp(0.76rem, 2vw, 0.94rem);
  line-height: 1.45;
}

.shop-copy p {
  margin: 0.12rem 0;
}

.source-note {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.78em;
}

.source-note::before {
  width: 0.38rem;
  height: 0.38rem;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--online);
  content: "";
}

.wechat-card {
  margin: 0;
  color: var(--gold);
  text-align: center;
}

.wechat-qr-window {
  width: clamp(6.6rem, 15vw, 8.5rem);
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 0.45rem;
  background: #fff;
  line-height: 0;
}

.wechat-card img {
  display: block;
  width: 133.75%;
  max-width: none;
  height: auto;
  transform: translate(-12.6%, -25.8%);
}

.wechat-card figcaption {
  margin-top: 0.3rem;
  font-size: 0.78rem;
}

.service-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  min-height: 3.5rem;
  padding: 0.45rem 0.6rem;
}

.service-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-width: 0;
  border-right: 1px solid var(--line);
  color: rgba(255, 255, 255, 0.7);
  font-size: clamp(0.72rem, 1.8vw, 0.88rem);
  font-weight: 560;
  white-space: nowrap;
}

.service-item:last-child {
  border-right: 0;
}

.service-item svg {
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--gold);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.45;
}

.site-footer {
  display: flex;
  min-height: 2rem;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0 0.5rem max(0.2rem, env(safe-area-inset-bottom));
  color: var(--subtle);
  font-size: 0.7rem;
  text-align: center;
}

.site-footer p {
  margin: 0;
}

.text-button {
  border: 0;
  padding: 0.25rem 0.6rem;
  background: transparent;
  color: rgba(216, 181, 104, 0.72);
}

.disclaimer-dialog {
  width: min(30rem, calc(100vw - 2rem));
  border: 1px solid var(--line-strong);
  border-radius: 0.875rem;
  padding: 0;
  background: #101216;
  color: var(--text);
}

.disclaimer-dialog::backdrop {
  background: rgba(0, 0, 0, 0.78);
}

.disclaimer-dialog article {
  padding: 1.3rem;
}

.disclaimer-dialog h2 {
  margin: 0 0 0.8rem;
  color: var(--gold-light);
}

.disclaimer-dialog p {
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.65;
}

noscript {
  display: block;
  padding: 1rem;
  background: #4a1e1e;
  text-align: center;
}

@media (max-width: 560px) {
  html,
  body {
    width: 100%;
    height: 100%;
    overflow: hidden;
  }

  .site-shell {
    grid-template-rows: auto auto minmax(0, 1fr) auto auto;
    gap: 0.25rem;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    padding: max(0.25rem, env(safe-area-inset-top)) 0.25rem max(0.2rem, env(safe-area-inset-bottom));
    overflow: hidden;
  }

  .market-header,
  .market-tabs,
  .quote-board,
  .shop-info,
  .service-strip {
    border-radius: 0.62rem;
  }

  .market-header {
    min-height: 0;
    height: clamp(3.35rem, 7.9dvh, 4.2rem);
    gap: 0.3rem;
    padding: 0.32rem 0.55rem;
  }

  .brand-kicker {
    font-size: clamp(0.42rem, 1.8vw, 0.56rem);
    letter-spacing: 0.12em;
  }

  .brand-wrap h1 {
    margin-top: 0.14rem;
    font-size: clamp(0.88rem, 4.15vw, 1.08rem);
    letter-spacing: 0.015em;
  }

  .brand-subtitle {
    margin-top: 0.16rem;
    font-size: clamp(0.54rem, 2.45vw, 0.66rem);
  }

  .market-state {
    gap: 0.28rem;
  }

  .market-clock {
    font-size: clamp(0.62rem, 2.8vw, 0.76rem);
  }

  .live-status {
    gap: 0.3rem;
    font-size: clamp(0.58rem, 2.5vw, 0.68rem);
  }

  .status-dot {
    width: 0.38rem;
    height: 0.38rem;
  }

  .market-tabs {
    min-height: 0;
    height: clamp(1.88rem, 4.25dvh, 2.25rem);
    padding: 0.16rem;
  }

  .market-tab {
    border-radius: 0.44rem;
    font-size: clamp(0.62rem, 2.75vw, 0.74rem);
  }

  .market-tab-state {
    min-width: 7.7rem;
    padding-inline: 0.34rem;
  }

  .market-main {
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 0.25rem;
    min-height: 0;
    overflow: hidden;
  }

  .quote-board {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 0;
  }

  .quote-head,
  .quote-row {
    grid-template-columns: 1.16fr 1fr 1fr 0.94fr;
  }

  .quote-head {
    min-height: 0;
    height: clamp(1.88rem, 4.35dvh, 2.35rem);
    font-size: clamp(0.62rem, 2.85vw, 0.76rem);
  }

  .quote-head > div,
  .quote-row > div {
    padding: 0.12rem 0.08rem;
  }

  .quote-rows {
    display: grid;
    grid-template-rows: repeat(var(--quote-row-count, 8), minmax(0, 1fr));
    min-height: 0;
    overflow: hidden;
  }

  .quote-row {
    min-height: 0;
  }

  .item-name {
    align-content: center;
    padding-left: clamp(0.36rem, 2vw, 0.58rem) !important;
  }

  .item-name-main {
    font-size: clamp(0.77rem, 4vw, 1rem);
  }

  .item-code {
    margin-top: clamp(0.08rem, 0.65dvh, 0.2rem);
    font-size: clamp(0.47rem, 2.2vw, 0.62rem);
  }

  .price-cell {
    font-size: clamp(0.86rem, 4.45vw, 1.16rem);
  }

  .price-up::after,
  .price-down::after {
    margin-left: 0.08rem;
  }

  .high-low {
    gap: 0;
    font-size: clamp(0.53rem, 2.45vw, 0.68rem);
    line-height: 1;
  }

  .range-line {
    gap: 0.16rem;
  }

  .loading-state {
    grid-row: 1 / -1;
    min-height: 0;
  }

  .shop-info {
    height: clamp(6.1rem, 15dvh, 8rem);
    gap: 0.35rem;
    padding: 0.28rem 0.42rem;
    overflow: hidden;
  }

  .shop-copy {
    font-size: clamp(0.55rem, 2.55vw, 0.69rem);
    line-height: 1.22;
  }

  .shop-copy p {
    margin: 0.04rem 0;
  }

  .source-note {
    gap: 0.24rem;
  }

  .source-note::before {
    width: 0.3rem;
    height: 0.3rem;
  }

  .wechat-qr-window {
    width: clamp(4.15rem, 20vw, 5.5rem);
    border-radius: 0.28rem;
  }

  .wechat-card figcaption {
    margin-top: 0.1rem;
    font-size: clamp(0.54rem, 2.25vw, 0.64rem);
    line-height: 1;
  }

  .service-strip {
    min-height: 0;
    height: clamp(2rem, 4.45dvh, 2.5rem);
    padding: 0.18rem;
  }

  .service-item {
    gap: clamp(0.14rem, 1vw, 0.28rem);
    font-size: clamp(0.52rem, 2.45vw, 0.66rem);
  }

  .service-item svg {
    width: clamp(0.7rem, 3vw, 0.86rem);
    height: clamp(0.7rem, 3vw, 0.86rem);
  }

  .site-footer {
    min-height: 0;
    height: clamp(1.2rem, 2.8dvh, 1.5rem);
    padding: 0;
    font-size: 0.55rem;
  }

  .text-button {
    padding: 0.08rem 0.42rem;
    font-size: 0.58rem;
  }

  .load-message {
    position: absolute;
    inset: 50% 0.75rem auto;
    z-index: 25;
    margin: 0;
    transform: translateY(-50%);
  }

  body.has-quotes .load-message {
    display: none;
  }
}

@media (max-width: 360px) {
  .market-tab-state {
    min-width: 7.15rem;
  }

  .shop-copy {
    font-size: 0.52rem;
  }
}

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