/* ============================================================
   组件样式：行情卡片 / 状态提示 / 设置面板 / 开关
   ============================================================ */

/* ---------- 行情卡片列表 ---------- */
.hq-list {
    display: grid;
    gap: .75rem;
}

/* ---------- 行情卡片 ---------- */
.hq-card {
    background: #fff;
    border: 1px solid #f3f4f6;
    border-radius: 1rem;
    padding: .95rem 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .04);
    transition: transform .15s, box-shadow .15s;
}
.hq-card:active { transform: scale(.985); }
.dark .hq-card {
    background: #1f2937;
    border-color: #374151;
    box-shadow: none;
}

/* 三行布局：行1 名称代号|价格，行2 涨跌|高低，行3 购买回收（居中） */
.hq-card__row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: .75rem;
}
.hq-card__row + .hq-card__row { margin-top: .45rem; }

.hq-card__left {
    display: flex;
    align-items: baseline;
    gap: .45rem;
    min-width: 0;
}
.hq-card__name { font-weight: 600; font-size: 1rem; line-height: 1.3; }
.hq-card__code { font-size: .7rem; color: #9ca3af; letter-spacing: .02em; }

.hq-card__change {
    font-weight: 600;
    font-size: .9rem;
    font-variant-numeric: tabular-nums;
}

.hq-card__price {
    display: flex;
    align-items: baseline;
    gap: .12rem;
    flex-wrap: wrap;
    justify-content: flex-end;
    margin-left: auto;
}
.hq-card__cur { font-size: .8rem; font-weight: 600; }
.hq-card__value {
    font-size: 1rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: -.01em;
    line-height: 1.15;
}
.hq-card__unit { font-size: .72rem; color: #6b7280; }
.dark .hq-card__unit { color: #9ca3af; }

.hq-card__meta {
    font-size: .7rem;
    color: #9ca3af;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.hq-card__meta b { font-weight: 500; }

/* 国内金属：购买 / 回收（右对齐，价差为 0 时整行不渲染） */
.hq-card__trade {
    margin-top: .5rem;
    display: flex;
    justify-content: flex-end;
    gap: 1.5rem;
    font-size: .88rem;
    font-variant-numeric: tabular-nums;
}
.hq-card__trade b { font-weight: 600; }

/* ---------- 状态提示条 ---------- */
.hq-tip {
    margin-bottom: .75rem;
}
.hq-tip__inner {
    border-radius: .6rem;
    padding: .5rem .8rem;
    font-size: .8rem;
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}
.dark .hq-tip__inner {
    background: rgba(127, 29, 29, .3);
    color: #fca5a5;
    border-color: rgba(127, 29, 29, .5);
}

/* ---------- 设置面板（我的页面） ---------- */
.hq-panel {
    background: #fff;
    border: 1px solid #f3f4f6;
    border-radius: 1rem;
    overflow: hidden;
}
.dark .hq-panel { background: #1f2937; border-color: #374151; }

.hq-cell {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .9rem 1rem;
    min-height: 52px;
    border-bottom: 1px solid #f3f4f6;
    font-size: .95rem;
}
.hq-cell:last-child { border-bottom: none; }
.dark .hq-cell { border-bottom-color: #374151; }

.hq-cell__value { color: #6b7280; font-size: .85rem; text-align: right; word-break: break-all; }
.dark .hq-cell__value { color: #9ca3af; }

/* 行式设置单元：图标方块 + 主副标题 + 右侧控件/箭头 */
.hq-cell__body { flex: 1; min-width: 0; }
.hq-cell__title { font-weight: 500; }
.hq-cell__sub { font-size: .74rem; color: #9ca3af; margin-top: .15rem; }
.hq-cell__icon {
    width: 34px;
    height: 34px;
    border-radius: .6rem;
    background: #f3f4f6;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #d97706;
    flex: none;
}
.hq-cell__icon svg { width: 1.05rem; height: 1.05rem; }
.dark .hq-cell__icon { background: #374151; color: #f59e0b; }

/* 可点击行（切换主题 / 联系方式） */
.hq-cell--link { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.hq-cell--link:active { background: #f9fafb; }
.dark .hq-cell--link:active { background: #111827; }
.hq-cell__arrow { color: #d1d5db; flex: none; display: inline-flex; }
.hq-cell__arrow svg { width: 1rem; height: 1rem; }
.dark .hq-cell__arrow { color: #4b5563; }

/* ---------- 开关 ---------- */
.hq-switch { position: relative; width: 46px; height: 26px; flex: none; }
.hq-switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.hq-switch__track {
    position: absolute; inset: 0;
    border-radius: 999px;
    background: #d1d5db;
    transition: background-color .25s;
}
.dark .hq-switch__track { background: #4b5563; }
.hq-switch__thumb {
    position: absolute; top: 3px; left: 3px;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
    transition: transform .25s;
}
.hq-switch input:checked ~ .hq-switch__track { background: #f59e0b; }
.hq-switch input:checked ~ .hq-switch__thumb { transform: translateX(20px); }

/* ---------- 区块标题 ---------- */
.hq-section-title {
    font-size: .8rem;
    color: #9ca3af;
    margin: 1.1rem .25rem .5rem;
}

/* ---------- 长文本 ---------- */
.hq-text {
    padding: .9rem 1rem;
    font-size: .85rem;
    line-height: 1.7;
    color: #6b7280;
    margin: 0;
}
.dark .hq-text { color: #9ca3af; }

/* ---------- 微信二维码 ---------- */
.hq-qr {
    padding: .5rem 1rem 1.1rem;
    text-align: center;
}
.hq-qr img {
    width: 180px;
    height: 180px;
    border-radius: .75rem;
    border: 1px solid #f3f4f6;
}
.dark .hq-qr img { border-color: #374151; }

/* ---------- 弹窗（联系我们 / iOS 教程） ---------- */
.hq-modal {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, .55);
    z-index: 80;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}
.hq-modal.is-open { display: flex; }
.hq-modal__card {
    background: #fff;
    border-radius: 1rem;
    padding: 1.25rem 1.25rem 1rem;
    width: 100%;
    max-width: 340px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, .25);
}
.dark .hq-modal__card { background: #1f2937; }
.hq-modal__title {
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: .9rem;
}
.hq-modal__close {
    width: 100%;
    border: none;
    border-radius: .6rem;
    background: #f3f4f6;
    color: #4b5563;
    font-size: .88rem;
    padding: .6rem;
    margin-top: 1rem;
    cursor: pointer;
}
.hq-modal__close:active { transform: scale(.98); }
.dark .hq-modal__close { background: #374151; color: #d1d5db; }

/* 弹窗内联系方式行 */
.hq-contact-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .6rem 0;
    border-bottom: 1px solid #f3f4f6;
    font-size: .88rem;
}
.dark .hq-contact-item { border-bottom-color: #374151; }
.hq-contact-item__label { color: #6b7280; flex: none; }
.dark .hq-contact-item__label { color: #9ca3af; }
.hq-contact-item__value {
    color: #111827;
    font-weight: 500;
    text-decoration: none;
    word-break: break-all;
    text-align: right;
}
.hq-contact-item__value:hover { color: #d97706; }
.dark .hq-contact-item__value { color: #f3f4f6; }
.hq-contact-item__copy {
    border: none;
    background: transparent;
    padding: 0;
    font: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
}
.hq-contact-item__copy span {
    flex: none;
    font-size: .72rem;
    color: #d97706;
    border: 1px solid #fcd34d;
    border-radius: .4rem;
    padding: .1rem .5rem;
}
/* 门店地址：左对齐、可换行（地址通常较长） */
.hq-contact-item__address { text-align: left; white-space: normal; line-height: 1.5; }
.hq-modal .hq-qr { padding: 1rem 0 .2rem; }

/* ---------- 下载按钮区（我的页：三按钮一排，紧凑） ---------- */
.hq-btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    padding: .85rem .9rem;
}
.hq-btn {
    flex: 1;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .3rem;
    border-radius: .55rem;
    font-size: .74rem;
    padding: .48rem .3rem;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: transform .15s, box-shadow .2s;
}
.hq-btn:active { transform: scale(.97); }
.hq-btn svg { width: .8rem; height: .8rem; flex: none; }
.hq-btn--primary {
    border: none;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 3px 10px rgba(245, 158, 11, .3);
}
.hq-btn--primary:disabled {
    background: #e5e7eb;
    color: #9ca3af;
    box-shadow: none;
    cursor: default;
    transform: none;
}
.dark .hq-btn--primary:disabled { background: #374151; }
.hq-btn--ghost {
    border: 1px solid #e5e7eb;
    background: #fff;
    color: #4b5563;
}
.dark .hq-btn--ghost { background: #1f2937; border-color: #374151; color: #d1d5db; }

/* 极窄屏兜底：按钮换行显示 */
@media (max-width: 340px) {
    .hq-btn { flex: 1 1 100%; }
}

/* 免责声明色块（下载模块内） */
.hq-about-disclaimer {
    margin: 0 .9rem .95rem;
    border-radius: .75rem;
    background: #eff6ff;
    padding: .8rem .95rem;
}
.dark .hq-about-disclaimer { background: rgba(59, 130, 246, .12); }
.hq-about-disclaimer__title {
    font-size: .8rem;
    font-weight: 600;
    color: #1d4ed8;
    margin-bottom: .3rem;
}
.dark .hq-about-disclaimer__title { color: #93c5fd; }
.hq-about-disclaimer .hq-text { padding: 0; font-size: .78rem; }

/* iOS 教程步骤 */
.hq-steps {
    margin: 0;
    padding-left: 1.3rem;
    font-size: .86rem;
    line-height: 2;
    color: #4b5563;
}
.dark .hq-steps { color: #d1d5db; }

/* ---------- 行情工具栏（新鲜度 + 排序 + 手动刷新） ---------- */
.hq-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: .55rem;
    min-height: 32px;
}
.hq-toolbar__updated {
    font-size: .76rem;
    color: #9ca3af;
    font-variant-numeric: tabular-nums;
    border-radius: .3rem;
}

/* 数据更新时新鲜度文案红色闪烁提示 */
@keyframes hq-updated-flash {
    0% { color: #ef4444; opacity: .4; }
    100% { color: #9ca3af; opacity: 1; }
}
.hq-updated-flash { animation: hq-updated-flash 1.2s ease-out; }

.hq-sort-btn {
    border: 1px solid #e5e7eb;
    background: #fff;
    color: #4b5563;
    border-radius: 999px;
    padding: .22rem .75rem;
    font-size: .72rem;
    cursor: pointer;
    transition: border-color .2s, color .2s;
}
.hq-sort-btn:active { transform: scale(.96); }
.dark .hq-sort-btn { background: #1f2937; border-color: #374151; color: #9ca3af; }

/* ---------- 骨架态卡片（缓存为空时数值 shimmer 占位） ---------- */
.hq-card.is-loading .hq-card__value,
.hq-card.is-loading .hq-card__change,
.hq-card.is-loading .hq-card__meta b,
.hq-card.is-loading .js-buy,
.hq-card.is-loading .js-sell {
    color: transparent !important; /* 需覆盖涨跌色 */
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: hq-shimmer 1.4s infinite;
    border-radius: .35rem;
    min-width: 3.2rem;
}
.dark .hq-card.is-loading .hq-card__value,
.dark .hq-card.is-loading .hq-card__change,
.dark .hq-card.is-loading .hq-card__meta b,
.dark .hq-card.is-loading .js-buy,
.dark .hq-card.is-loading .js-sell {
    background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
    background-size: 200% 100%;
}

/* ---------- 下拉刷新指示条 ---------- */
.hq-pull {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 0;
    overflow: hidden;
    z-index: 60;
    pointer-events: none;
    text-align: center;
}
.hq-pull__inner {
    padding: .4rem 0;
    font-size: .75rem;
    color: #6b7280;
}
.dark .hq-pull__inner { color: #9ca3af; }

/* ---------- 错误提示重试按钮 ---------- */
.hq-tip__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
}
.hq-retry {
    flex: none;
    border: 1px solid #fca5a5;
    background: transparent;
    color: #b91c1c;
    border-radius: .45rem;
    padding: .22rem .7rem;
    font-size: .75rem;
    cursor: pointer;
}
.hq-retry:active { transform: scale(.96); }
.dark .hq-retry { border-color: rgba(252, 165, 165, .4); color: #fca5a5; }

/* ---------- 分段控件（字体大小选择） ---------- */
.hq-seg {
    display: inline-flex;
    border: 1px solid #e5e7eb;
    border-radius: .5rem;
    overflow: hidden;
    flex: none;
}
.dark .hq-seg { border-color: #374151; }
.hq-seg button {
    border: none;
    background: transparent;
    color: #6b7280;
    font-size: .8rem;
    padding: .28rem .85rem;
    cursor: pointer;
    min-width: 44px;
}
.hq-seg button + button { border-left: 1px solid #e5e7eb; }
.dark .hq-seg button + button { border-left-color: #374151; }
.hq-seg button.is-active {
    background: #f59e0b;
    color: #fff;
    font-weight: 600;
}

/* ---------- 空状态 ---------- */
.hq-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: #9ca3af;
    font-size: .9rem;
}
