/* =========================================================
   遂昌宝聚源珠宝贵金属 —— 前台样式（按设计稿 1:1 还原）
   ---------------------------------------------------------
   自适应方案：所有尺寸用 rem，根字号随视口宽度等比缩放。
   设计基准宽 364px，此时根字号 = 16px，与设计稿 1:1。
   屏幕更宽时整体等比放大（字号、行高、间距一起变大），
   不会出现「内容缩在中间、两边大片黑边」的情况。
   ========================================================= */

html {
    /* 364px 视口 → 16px；封顶 30px（约 1.88 倍），避免超宽屏字大到离谱 */
    font-size: clamp(13px, 4.3956vw, 30px);
}

:root {
    --c-header: #252525;
    --c-black: #000;
    --c-gold: #ffbf24;
    --c-red: #ff0000;
    --c-line: #4b4b4b;
    --c-nav-active: #1a9adc;
    --c-nav: #aaaaaa;
    /* 行情表行高：想更高/更矮只改这两个值（1rem = 设计稿 16px） */
    --row-h: 3.375rem;   /* 54px */
    --head-h: 2.875rem;  /* 46px */
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    margin: 0;
    padding: 0;
    background: #000;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
        "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    color: #fff;
    -webkit-font-smoothing: antialiased;
    text-size-adjust: 100%;
}

img {
    border: 0;
    max-width: 100%;
}

/* 容器宽度同为 rem：与内容一起缩放，不会先撞到固定像素上限 */
.app {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 47.5rem;
    margin: 0 auto;
    min-height: 100vh;
    background: #000;
    padding-bottom: 3.5rem;
}

/* ---------------- 顶部 ---------------- */
.hd {
    background: var(--c-header);
}

.hd-main {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    height: 5.5625rem;
    padding: 0 0.5rem 0 0.8125rem;
}

.hd-title {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    padding-top: 1.5rem;
    font-size: 1.625rem;
    line-height: 1.15;
    font-weight: 800;
    letter-spacing: 0.03em;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.9), 0 0 0.75rem rgba(255, 255, 255, 0.22);
}

.hd-qrs {
    display: flex;
    gap: 0.375rem;
    flex: 0 0 auto;
    /* 在标题行里垂直居中：上下留白相等，不再贴顶 */
    align-self: center;
}

.hd-qr {
    width: 4.5rem;
    height: 4.5rem;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.hd-qr img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.hd-qrs[data-count="2"] .hd-qr {
    width: 3.625rem;
    height: 3.625rem;
}

/* 并排两个二维码时，标题自动缩小，避免挤压 */
.hd.has-2qr .hd-title {
    font-size: 1.3125rem;
    padding-top: 1.875rem;
}

.hd-qr-ph {
    font-size: 0.625rem;
    color: #999;
    text-align: center;
    line-height: 1.2;
}

.hd-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    height: 1.625rem;
    border-top: 1px solid #7d7d7d;
    padding-right: 0.625rem;
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--c-red);
    line-height: 1;
    letter-spacing: 0.2px;
    font-family: Arial, "Helvetica Neue", "Microsoft YaHei", sans-serif;
}

.hd-bar .mkt {
    margin-left: 1px;
}

/* ---------------- 行情表 ---------------- */
.qt {
    background: #000;
}

.qt-head,
.qt-row {
    display: grid;
    grid-template-columns: 30.8% 34.6% 34.6%;
    align-items: stretch;
}

.qt-head {
    height: var(--head-h);
    background: #000;
}

.qt-head span {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: 0.05em;
    border-left: 1px solid var(--c-line);
}

.qt-head span:first-child {
    border-left: 0;
}

.qt-body .qt-row {
    height: var(--row-h);
}

.qt-body .qt-row:nth-child(1) {
    border-top: 1px solid var(--c-line);
}

.qt-body .qt-row:nth-child(odd) {
    background: var(--c-header);
}

.qt-body .qt-row:nth-child(even) {
    background: #000;
}

.qt-row .cell {
    display: flex;
    align-items: center;
    justify-content: center;
    border-left: 1px solid var(--c-line);
    overflow: hidden;
}

.qt-row .cell:first-child {
    border-left: 0;
}

.qt-name {
    font-size: 1.1875rem;
    font-weight: 800;
    color: var(--c-gold);
    letter-spacing: 0.05em;
}

.qt-price {
    display: inline-block;
    padding: 0.125rem 0.4375rem;
    border-radius: 2px;
    font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
    font-size: 1.1875rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #fff;
    transition: background-color 0.45s ease, color 0.45s ease;
    white-space: nowrap;
}

.qt-price.up {
    background: #cf1b1b;
    color: #fff;
}

.qt-price.down {
    background: #0e8b48;
    color: #fff;
}

/* ---------------- 公告文案 ---------------- */
.info {
    flex: 1 1 auto;
    background: var(--c-header);
    padding: 1.25rem 1.125rem 0.75rem;
}

.info p {
    margin: 0 0 0.5625rem;
    font-size: 0.75rem;
    line-height: 0.90625rem;
    color: #f2f2f2;
    word-break: break-word;
}

.info p:last-child {
    margin-bottom: 0;
}

.info .alert {
    color: var(--c-red);
    font-weight: 700;
}

.info .rich a {
    color: #6fc3f7;
}

/* ---------------- 底部小工具 + 公告轮播 ---------------- */
.tools {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    background: var(--c-header);
    padding: 0.25rem 0.75rem 0.625rem;
}

.icon-btn {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.875rem;
    height: 1.875rem;
    padding: 0;
    border: 0;
    background: none;
    color: #fff;
    cursor: pointer;
    opacity: 0.92;
}

.icon-btn svg {
    width: 1.375rem;
    height: 1.375rem;
    fill: currentColor;
}

.icon-btn:active {
    opacity: 0.6;
}

/* 没有公告时两个图标仍分列左右 */
.tools .icon-btn:last-child {
    margin-left: auto;
}

/* 公告条：夹在喇叭图标与二维码图标之间，左右无缝循环滚动 */
.notice-bar {
    flex: 1 1 auto;
    min-width: 0;
    height: 1.75rem;
    display: flex;
    align-items: center;
    overflow: hidden;
    /* 两端淡出，滚动不会硬生生被切断 */
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 4%, #000 96%, transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0, #000 4%, #000 96%, transparent 100%);
}

.notice-track {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    white-space: nowrap;
    will-change: transform;
    animation: notice-scroll var(--marquee-dur, 18s) linear infinite;
}

/* 一份完整内容；JS 可能克隆更多份，位移量随之变成 -100%/份数 */
.notice-group {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    white-space: nowrap;
}

@keyframes notice-scroll {
    from {
        transform: translate3d(0, 0, 0);
    }
    to {
        transform: translate3d(var(--marquee-shift, -50%), 0, 0);
    }
}

.notice-item {
    flex: 0 0 auto;
    display: inline-block;
    font-size: 0.8125rem;
    line-height: 1.75rem;
    color: var(--notice-color, #ffd451);
    letter-spacing: 0.02em;
    text-decoration: none;
}

a.notice-item {
    text-decoration: underline;
    text-underline-offset: 0.15em;
}

.notice-sep {
    flex: 0 0 auto;
    display: inline-block;
    width: 0.25rem;
    height: 0.25rem;
    margin: 0 0.625rem;
    border-radius: 50%;
    background: #8a8a8a;
    vertical-align: middle;
}

.notice-bar:hover .notice-track {
    animation-play-state: paused;
}

/*
 * 系统开了「减弱动态效果」时不能直接 animation:none：
 * 公告是 overflow:hidden 的单行，停住就看不全了。
 * 这里改成放慢 2.5 倍，既照顾晕动症也能读完内容。
 */
@media (prefers-reduced-motion: reduce) {
    .notice-track {
        animation-duration: calc(var(--marquee-dur, 18s) * 2.5);
    }
}

/* ---------------- 底部导航 ---------------- */
.tabbar {
    position: fixed;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    z-index: 60;
    display: flex;
    width: 100%;
    max-width: 47.5rem;
    height: 3.5rem;
    background: #000;
    border-top: 1px solid #1b1b1b;
}

.tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.125rem;
    text-decoration: none;
    color: var(--c-nav);
    font-size: 0.8125rem;
    line-height: 1;
}

.tab svg {
    width: 1.375rem;
    height: 1.375rem;
    fill: currentColor;
}

.tab.active {
    color: var(--c-nav-active);
}

/* ---------------- 弹层 ---------------- */
.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.82);
    padding: 1.5rem;
}

.modal.show {
    display: flex;
}

.modal-box {
    width: 100%;
    max-width: 22.5rem;
    background: #1c1c1c;
    border: 1px solid #333;
    border-radius: 0.5rem;
    padding: 1rem;
    color: #eee;
    max-height: 82vh;
    overflow: auto;
}

.modal-box h3 {
    margin: 0 0 0.75rem;
    font-size: 1rem;
    color: #fff;
    font-weight: 700;
}

.modal-box p {
    margin: 0 0 0.5625rem;
    font-size: 0.8125rem;
    line-height: 1.7;
    color: #ddd;
}

.modal-qrs {
    display: flex;
    gap: 0.875rem;
    justify-content: center;
    flex-wrap: wrap;
}

.modal-qrs figure {
    margin: 0;
    text-align: center;
}

.modal-qrs img {
    width: 8.25rem;
    height: 8.25rem;
    background: #fff;
    padding: 0.375rem;
    object-fit: contain;
}

.modal-qrs figcaption {
    margin-top: 0.375rem;
    font-size: 0.75rem;
    color: #bbb;
}

.modal-close {
    display: block;
    width: 100%;
    margin-top: 0.875rem;
    padding: 0.5625rem 0;
    border: 0;
    border-radius: 0.25rem;
    background: #333;
    color: #fff;
    font-size: 0.875rem;
    cursor: pointer;
}

/* 离线 / 数据异常提示 */
.stale-tip {
    display: none;
    padding: 0.375rem 0.875rem;
    background: #3a2c00;
    color: #ffcf5c;
    font-size: 0.75rem;
    line-height: 1.5;
}

.stale-tip.show {
    display: block;
}

/* ---------------- 资讯页 ---------------- */
.news-wrap {
    background: var(--c-header);
    padding: 1rem 0.875rem 1.5rem;
    min-height: calc(100vh - 7.25rem - 3.5rem);
}

.news-wrap h2 {
    margin: 0 0 0.75rem;
    font-size: 1.0625rem;
    color: #fff;
}

.news-wrap .news-body {
    font-size: 0.84375rem;
    line-height: 1.75;
    color: #eee;
    word-break: break-word;
}

.news-wrap .news-body img {
    max-width: 100%;
    height: auto;
}

.news-empty {
    color: #999;
    font-size: 0.8125rem;
}
