:root {
  color-scheme: light;
  --page: #f3f5f7;
  --surface: #ffffff;
  --surface-soft: #f8fafb;
  --ink: #172231;
  --muted: #687586;
  --line: #e2e7ec;
  --navy: #1f3a56;
  --up: #b54a49;
  --up-soft: #faeeee;
  --down: #267666;
  --down-soft: #eaf5f1;
  --warning: #a56a24;
  --warning-soft: #fbf3e8;
  --error: #9f4444;
  --error-soft: #faecec;
  --shadow: 0 16px 40px rgba(31, 49, 68, 0.07);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 85% 2%, rgba(184, 156, 92, 0.10), transparent 25rem),
    var(--page);
  color: var(--ink);
  font-family: Inter, "SF Pro Display", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

button, summary { font: inherit; }

.shell {
  width: min(1220px, calc(100% - 48px));
  margin: 0 auto;
  padding: 56px 0 32px;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.eyebrow {
  margin-bottom: 8px;
  color: #8c7440;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.18em;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 720;
  letter-spacing: -0.035em;
}

.subtitle {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
}

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

.overall-status,
.quote-status {
  display: inline-flex;
  align-items: center;
  border: 1px solid #cfe3dc;
  border-radius: 999px;
  background: #eff7f4;
  color: #256656;
  white-space: nowrap;
}

.overall-status {
  gap: 8px;
  min-height: 40px;
  padding: 0 15px;
  font-size: 13px;
  font-weight: 650;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 4px rgba(37, 102, 86, 0.10);
}

.overall-status.is-warning,
.quote-status.is-warning {
  border-color: #ead8bd;
  background: var(--warning-soft);
  color: var(--warning);
}

.overall-status.is-error,
.quote-status.is-error {
  border-color: #ebcaca;
  background: var(--error-soft);
  color: var(--error);
}

.overall-status.is-closed,
.quote-status.is-closed,
.overall-status.is-loading,
.quote-status.is-loading {
  border-color: #d9e0e7;
  background: #f3f6f8;
  color: #667586;
}

.refresh-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid #d6dde4;
  border-radius: 10px;
  background: var(--surface);
  color: var(--navy);
  font-weight: 650;
  cursor: pointer;
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.refresh-button:hover { border-color: #9eacba; box-shadow: 0 6px 18px rgba(31, 49, 68, 0.07); }
.refresh-button:active { transform: translateY(1px); }
.refresh-button:focus-visible { outline: 3px solid rgba(44, 91, 132, 0.20); outline-offset: 2px; }
.refresh-button:disabled { opacity: 0.6; cursor: wait; }
.refresh-button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.refresh-button.is-spinning svg { animation: spin 800ms linear infinite; }

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

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

.quote-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.card-accent { height: 4px; background: #b69a5b; }
.silver .card-accent { background: #8694a3; }
.oil .card-accent { background: #7f614f; }

.card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 22px 0;
}

.card-heading h2 { margin: 0 0 5px; font-size: 17px; line-height: 1.3; }
.symbol { color: var(--muted); font-size: 12px; font-weight: 650; letter-spacing: 0.06em; }

.quote-status {
  flex: 0 0 auto;
  min-height: 26px;
  padding: 0 9px;
  font-size: 11px;
  font-weight: 700;
}

.price-block { padding: 25px 22px 22px; }
.price-row { display: flex; align-items: baseline; gap: 9px; min-width: 0; }
.price { overflow: hidden; font-size: clamp(32px, 3.2vw, 43px); font-weight: 710; line-height: 1; letter-spacing: -0.045em; text-overflow: ellipsis; }
.unit { flex: 0 0 auto; color: var(--muted); font-size: 11px; font-weight: 650; }

.change-row {
  display: flex;
  gap: 12px;
  margin-top: 14px;
  font-size: 16px;
  font-weight: 700;
}
.change-row.up { color: var(--up); }
.change-row.down { color: var(--down); }
.change-row.neutral { color: var(--muted); }

.details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 0;
  padding: 18px 22px 20px;
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
  gap: 17px 12px;
}
.details div { display: flex; flex-direction: column; gap: 5px; }
.details .time-detail { grid-column: 1 / -1; }
.details dt { color: var(--muted); font-size: 11px; }
.details dd { margin: 0; font-size: 14px; font-weight: 650; }

.card-message {
  padding: 10px 22px;
  border-top: 1px solid #ecd9bd;
  background: var(--warning-soft);
  color: #84561f;
  font-size: 11px;
  line-height: 1.55;
}

.quote-card.is-unavailable .price { color: var(--muted); font-size: 25px; letter-spacing: 0; }

.footer-panel {
  margin-top: 22px;
  padding: 17px 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 12px;
}
.footer-panel p { margin: 10px 0 0; line-height: 1.6; }
.check-time { display: flex; align-items: center; gap: 9px; }
.check-time strong { color: var(--ink); font-size: 13px; }
.footer-panel details { margin-top: 11px; }
.footer-panel summary { width: fit-content; color: var(--navy); cursor: pointer; font-weight: 650; }
.source-list { display: grid; gap: 8px; margin-top: 10px; line-height: 1.55; }
.source-list p { margin: 0; }

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 10;
  max-width: min(360px, calc(100vw - 40px));
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--navy);
  box-shadow: 0 12px 32px rgba(20, 36, 51, 0.22);
  color: white;
  font-size: 13px;
}

@media (max-width: 900px) {
  .shell { width: min(720px, calc(100% - 32px)); padding-top: 36px; }
  .topbar { align-items: flex-start; }
  .header-actions { flex-direction: column-reverse; align-items: flex-end; }
  .market-grid { grid-template-columns: 1fr; }
  .quote-card { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(260px, 0.85fr); }
  .card-accent { position: absolute; top: 0; bottom: 0; left: 0; width: 4px; height: auto; }
  .card-heading { grid-column: 1; padding-left: 24px; }
  .price-block { grid-column: 1; padding-left: 24px; }
  .details { grid-column: 2; grid-row: 1 / span 2; border-top: 0; border-left: 1px solid var(--line); align-content: center; }
  .card-message { grid-column: 1 / -1; }
}

@media (max-width: 620px) {
  .shell { width: calc(100% - 24px); padding: 25px 0 20px; }
  .topbar { display: block; margin-bottom: 20px; }
  .subtitle { font-size: 12px; }
  .header-actions { flex-direction: row; align-items: center; justify-content: space-between; margin-top: 20px; }
  .overall-status { min-height: 36px; padding: 0 12px; font-size: 12px; }
  .refresh-button { min-height: 38px; padding: 0 13px; font-size: 13px; }
  .market-grid { gap: 14px; }
  .quote-card { display: block; border-radius: 14px; }
  .card-accent { position: static; width: auto; height: 4px; }
  .card-heading { padding: 19px 18px 0; }
  .price-block { padding: 25px 18px 20px; }
  .price { font-size: 38px; }
  .details { grid-template-columns: 1fr 1fr; padding: 16px 18px 18px; border-top: 1px solid var(--line); border-left: 0; }
  .card-message { padding-inline: 18px; }
  .footer-panel { margin-top: 16px; padding: 15px 16px; }
}

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