:root {
  --bg: #f2f5fb;
  --panel: #ffffff;
  --line: #d8e0ed;
  --text: #1f2a44;
  --text-soft: #60728f;
  --primary: #1e4fa6;
  --primary-strong: #163f86;
  --ok-bg: #e6f7ed;
  --ok-text: #1f7a47;
  --err-bg: #fae7e7;
  --err-text: #a33a3a;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  min-height: 100%;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Manrope', 'Noto Sans SC', 'Segoe UI', sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #f6f8fd 0%, var(--bg) 100%);
}

.page-shell {
  min-height: 100vh;
  padding: 16px;
  display: flex;
  flex-direction: column;
}

.container {
  width: min(1100px, 100%);
  margin: 0 auto;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.hero, .panel, .footer {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
}

/* 标题栏：紧凑 */
.hero {
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.hero-main {
  text-align: center;
}

h1 {
  font-size: 20px;
  line-height: 1.3;
}

.hero-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

.meta-pill {
  height: 24px;
  padding: 0 8px;
  border-radius: 12px;
  border: 1px solid #d4deee;
  background: #f6f9ff;
  color: #51678f;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
}

.hero-qrcode { display: none; }

/* 主面板 */
.panel {
  margin-top: 12px;
  padding: 16px;
  flex: 1;
}

/* 核心：PC 端左右布局 */
.layout-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  height: 100%;
}

@media (min-width: 800px) {
  .layout-grid {
    grid-template-columns: 1fr 1fr;
    gap: 20px;
  }
}

.converter-block, .market-block {
  min-width: 0;
}

/* 贵金属选择 */
.metal-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.metal-tab {
  flex: 1;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #f8faff;
  color: #54688f;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.15s;
  font-family: inherit;
}

.metal-tab:hover {
  background: #eef3ff;
}

.metal-tab.active {
  border-color: var(--primary);
  background: #e8f0ff;
  color: var(--primary);
}

.metal-icon { font-size: 14px; }

/* 转换方向 */
.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 12px;
}

.mode-btn {
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #f4f8ff;
  color: #54688f;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}

.mode-btn:hover {
  background: #eef3ff;
}

.mode-btn.active {
  color: #fff;
  border-color: var(--primary);
  background: var(--primary);
}

/* 输入区 */
.input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.input-group { margin: 0; }
.flex-1 { min-width: 0; }

.input-label {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  font-weight: 700;
  color: #3f567f;
}

.input-wrapper {
  display: flex;
  gap: 6px;
}

.input-wrapper input {
  flex: 1;
  min-width: 0;
}

input {
  width: 100%;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 0 10px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s;
}

input:focus {
  outline: none;
  border-color: var(--primary);
}

/* 按钮 */
.btn {
  height: 38px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-sm {
  height: 32px !important;
  padding: 0 10px !important;
  font-size: 12px !important;
}

.btn-primary {
  color: #fff;
  background: var(--primary);
}

.btn-primary:hover {
  background: var(--primary-strong);
}

.btn-secondary {
  color: #415882;
  border-color: var(--line);
  background: #f3f7ff;
}

.btn-secondary:hover {
  background: #e8f0ff;
}

/* 操作行 */
.action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
}

.action-buttons {
  display: flex;
  gap: 6px;
}

.decimals-control {
  display: inline-flex;
  gap: 2px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7faff;
  padding: 2px;
}

.decimals-control .btn {
  height: 26px;
  min-width: 26px;
  padding: 0;
  border-color: var(--line);
  background: #fff;
  font-size: 13px;
}

.decimals-value {
  min-width: 32px;
  text-align: center;
  font-weight: 700;
  font-size: 11px;
  color: var(--text-soft);
}

/* 结果框 */
.result-box {
  margin-top: 12px;
  border-radius: 10px;
  background: linear-gradient(135deg, #2f69cf 0%, #1d4ea8 100%);
  padding: 14px 16px;
}

.result-box.compact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.result-box.compact .result-label {
  font-size: 12px;
  color: rgba(255,255,255,0.85);
  font-weight: 600;
}

.result-box.compact .result-main {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.result-box.compact .result-value {
  font-size: 32px;
  font-weight: 800;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.result-box.compact .result-unit {
  font-size: 13px;
  color: rgba(255,255,255,0.9);
  font-weight: 600;
}

/* 市场数据 */
.market-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 14px;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.market-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.market-title {
  font-size: 14px;
  font-weight: 800;
}

.market-status {
  height: 22px;
  padding: 0 8px;
  border-radius: 11px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid #b6e4c7;
  background: var(--ok-bg);
  color: var(--ok-text);
  display: inline-flex;
  align-items: center;
}

.market-status.error {
  border-color: #ebb6b6;
  background: var(--err-bg);
  color: var(--err-text);
}

.market-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  flex: 1;
}

.market-item {
  border: 1px solid #e8eef6;
  border-radius: 8px;
  background: #fafcff;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.market-label {
  font-size: 11px;
  color: var(--text-soft);
  font-weight: 600;
}

.market-value {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.market-value.small {
  font-size: 14px;
}

.market-meta {
  font-size: 10px;
  color: var(--text-soft);
}

.market-card.loading .market-value,
.market-card.loading .market-meta,
.market-card.loading .market-status {
  color: transparent;
  background: linear-gradient(90deg, #dbe5f6, #edf2fb, #dbe5f6);
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
  border-radius: 4px;
}

/* 底部区域 */
.footer {
  width: min(1100px, 100%);
  margin: 12px auto 0;
  padding: 8px 12px;
}

.info-section {
  width: min(1100px, 100%);
  margin: 12px auto 0;
}

.info-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

@media (max-width: 800px) {
  .info-container {
    grid-template-columns: 1fr;
  }
}

.info-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}

.info-card:not([open]) {
  padding: 8px 12px;
}

.info-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  list-style: none;
}

.info-title::-webkit-details-marker { display: none; }

.info-title::after {
  content: '▼';
  margin-left: auto;
  font-size: 10px;
  color: var(--text-soft);
  transition: transform 0.2s;
}

.info-card[open] .info-title::after {
  transform: rotate(180deg);
}

.info-icon { font-size: 16px; }

.info-content {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #eef3fb;
}

.info-list {
  margin: 0;
  padding-left: 16px;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.5;
}

.info-list li { margin-bottom: 4px; }
.info-list strong { color: var(--text); font-weight: 700; }

.info-qa {
  margin: 0;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.5;
}

.info-qa dt {
  margin-top: 6px;
  font-weight: 700;
  color: var(--primary);
}

.info-qa dt:first-child { margin-top: 0; }

.info-qa dd {
  margin: 2px 0 0 0;
  padding-left: 12px;
}

/* 相关推荐 */
.related-section {
  width: min(1100px, 100%);
  margin: 12px auto 0;
}

.related-container {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
}

.related-heading {
  font-size: 14px;
  font-weight: 800;
  margin: 0 0 10px 0;
  text-align: center;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

@media (max-width: 600px) {
  .related-grid {
    grid-template-columns: 1fr;
  }
}

.related-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 12px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fafcff;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s;
}

.related-card:hover {
  border-color: var(--primary);
  background: #f0f5ff;
}

.related-icon {
  font-size: 24px;
  margin-bottom: 4px;
}

.related-title {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 2px;
}

.related-desc {
  font-size: 11px;
  color: var(--text-soft);
  line-height: 1.3;
}

/* 备案 */
.beian-info {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  align-items: center;
}

.beian-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.beian-info a {
  color: #4b618c;
  text-decoration: none;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.beian-divider { color: #a9bad8; }
.beian-icon { width: 12px; height: 12px; }
.copyright { font-size: 10px; color: #7a8cab; }

/* 悬浮按钮 */
.float-buttons-group {
  position: fixed;
  bottom: max(20px, env(safe-area-inset-bottom));
  right: max(20px, env(safe-area-inset-right));
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 100;
}

.float-button {
  height: 48px;
  padding: 0 16px;
  border-radius: 24px;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: #fff;
  box-shadow: 0 4px 12px rgba(30, 79, 166, 0.35);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  font-family: inherit;
  transition: all 0.2s;
}

.float-button:hover {
  transform: translateX(-3px);
  box-shadow: 0 6px 16px rgba(30, 79, 166, 0.45);
}

.float-button.donate {
  background: linear-gradient(135deg, #ff6b6b, #ee5a52);
  box-shadow: 0 4px 12px rgba(238, 90, 82, 0.35);
}

.float-button.contact {
  background: linear-gradient(135deg, #51cf66, #37b24d);
  box-shadow: 0 4px 12px rgba(55, 178, 77, 0.35);
}

.float-button svg {
  width: 20px;
  height: 20px;
}

.float-button-text {
  font-size: 13px;
  font-weight: 700;
}

/* 悬浮面板 */
.float-panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(2px);
}

.float-panel {
  background: #fff;
  border-radius: 14px;
  width: min(480px, 100%);
  max-height: 85vh;
  overflow: auto;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.25);
}

.float-panel-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.float-panel-title {
  font-size: 15px;
  font-weight: 800;
}

.float-panel-close {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #f3f7ff;
  color: #415882;
  font-size: 20px;
  line-height: 26px;
  cursor: pointer;
}

.float-panel-content {
  padding: 20px;
}

.float-panel-qr-container {
  display: flex;
  justify-content: center;
}

.float-panel-qr-item {
  margin: 0;
  display: grid;
  gap: 10px;
  justify-items: center;
  max-width: 280px;
}

.float-panel-qr-item img {
  width: 100%;
  max-width: 240px;
  aspect-ratio: 1;
  border-radius: 10px;
  border: 1px solid var(--line);
}

.float-panel-qr-item figcaption {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-soft);
}

.float-panel-contact {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
}

.float-panel-donate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 20px;
  justify-items: center;
}

.float-panel-donate-item {
  margin: 0;
  display: grid;
  gap: 10px;
  justify-items: center;
  width: 100%;
}

.float-panel-donate-item img {
  width: 100%;
  max-width: 200px;
  aspect-ratio: 1;
  border-radius: 10px;
  border: 1px solid var(--line);
}

.float-panel-donate-item figcaption {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-soft);
}

.float-panel-contact-label {
  font-size: 12px;
  font-weight: 800;
  color: #3f567f;
}

.float-panel-contact-value {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
}

.float-panel-copy {
  height: 28px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #f3f7ff;
  color: #415882;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

/* Vue 过渡 */
.float-panel-enter-active,
.float-panel-leave-active {
  transition: opacity 0.25s;
}

.float-panel-enter-active .float-panel,
.float-panel-leave-active .float-panel {
  transition: transform 0.25s;
}

.float-panel-enter-from,
.float-panel-leave-to {
  opacity: 0;
}

.float-panel-enter-from .float-panel,
.float-panel-leave-to .float-panel {
  transform: scale(0.95) translateY(10px);
}

.hero-qrcode .qr-thumb { display: none; }

/* QR Modal */
.qr-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.qr-modal-content {
  background: #fff;
  border-radius: 14px;
  padding: 16px;
  width: min(560px, 92vw);
  max-height: 85vh;
  overflow: auto;
  text-align: center;
}

.qr-modal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  justify-items: center;
}

.qr-modal-item {
  margin: 0;
  display: grid;
  gap: 8px;
  justify-items: center;
}

.qr-modal-content img {
  width: min(240px, 100%);
  aspect-ratio: 1;
  border-radius: 10px;
}

.qr-modal-caption {
  font-size: 13px;
  font-weight: 800;
}

.qr-modal-contact {
  margin-top: 12px;
  border-top: 1px dashed var(--line);
  padding-top: 12px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
}

.qr-modal-contact-label {
  font-size: 11px;
  font-weight: 800;
  color: #3f567f;
}

.qr-modal-contact-value {
  font-size: 11px;
  font-weight: 700;
}

.qr-modal-copy {
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #f3f7ff;
  color: #415882;
  font-weight: 800;
  padding: 0 10px;
  cursor: pointer;
}

.qr-modal-title {
  margin-top: 12px;
  font-size: 15px;
  font-weight: 700;
}

.qr-modal-desc {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-soft);
}

/* ========== 响应式 ========== */

/* 大屏 PC */
@media (min-width: 1000px) {
  .layout-grid {
    grid-template-columns: 1.1fr 1fr;
  }

  .market-value {
    font-size: 20px;
  }

  .result-box.compact .result-value {
    font-size: 36px;
  }
}

/* 平板 */
@media (max-width: 799px) {
  .layout-grid {
    grid-template-columns: 1fr;
  }

  .market-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* 手机 */
@media (max-width: 600px) {
  .page-shell {
    padding: 8px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }

  .hero {
    padding: 6px 10px;
  }

  h1 {
    font-size: 16px;
  }

  .meta-pill {
    height: 20px;
    padding: 0 6px;
    font-size: 10px;
  }

  .panel {
    margin-top: 8px;
    padding: 10px;
  }

  .metal-tabs {
    margin-bottom: 8px;
  }

  .metal-tab {
    height: 32px;
    font-size: 12px;
  }

  .mode-switch {
    margin-bottom: 8px;
  }

  .mode-btn {
    height: 32px;
    font-size: 12px;
  }

  .input-row {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .input-label {
    font-size: 11px;
    margin-bottom: 3px;
  }

  input {
    height: 36px;
    font-size: 14px;
    padding: 0 8px;
  }

  .btn {
    height: 36px;
    font-size: 12px;
    padding: 0 10px;
  }

  .action-row {
    margin-top: 8px;
    gap: 8px;
  }

  .decimals-control .btn {
    height: 24px;
    min-width: 24px;
  }

  .decimals-value {
    min-width: 28px;
    font-size: 10px;
  }

  .result-box {
    margin-top: 8px;
    padding: 10px 12px;
    border-radius: 8px;
  }

  .result-box.compact .result-label {
    font-size: 11px;
  }

  .result-box.compact .result-value {
    font-size: 26px;
  }

  .result-box.compact .result-unit {
    font-size: 11px;
  }

  .layout-grid {
    gap: 10px;
  }

  .market-card {
    padding: 10px;
  }

  .market-header {
    margin-bottom: 8px;
  }

  .market-title {
    font-size: 13px;
  }

  .market-status {
    height: 20px;
    padding: 0 6px;
    font-size: 10px;
  }

  .market-grid {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .market-item {
    padding: 8px;
    border-radius: 6px;
  }

  .market-label {
    font-size: 10px;
  }

  .market-value {
    font-size: 15px;
  }

  .market-value.small {
    font-size: 12px;
  }

  .market-meta {
    font-size: 9px;
  }

  /* 隐藏次要内容 */
  .info-section,
  .related-section {
    display: none;
  }

  .footer {
    margin-top: 8px;
    padding: 6px 10px;
  }

  .beian-info a {
    font-size: 10px;
  }

  .beian-icon {
    width: 10px;
    height: 10px;
  }

  .float-buttons-group {
    bottom: max(12px, env(safe-area-inset-bottom));
    right: max(12px, env(safe-area-inset-right));
    gap: 8px;
  }

  .float-button {
    height: 40px;
    padding: 0 12px;
    border-radius: 20px;
  }

  .float-button svg {
    width: 16px;
    height: 16px;
  }

  .float-button-text {
    font-size: 12px;
  }
}

@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}
