/* ===== 基础 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.4;
    color: #1D2129;
    background: #F6F6F6;
}

.page {
    max-width: 600px;
    margin: 0 auto;
    padding: 16px 14px 40px;
}

/* ===== 顶部温馨提示 ===== */
.tips-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px 14px;
    margin-bottom: 10px;
    background: #fff;
    border: none;
    border-radius: 8px;
}

.tips-icon { display: flex; flex: 0 0 auto; }

.tips-text { font-size: 13.5px; color: #F2281B; }

.tips-text em { font-style: normal; color: #F2281B; }

/* ===== 卡片 ===== */
.rate-card {
    padding: 16px 16px 6px;
    margin-bottom: 14px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 2px 12px rgba(28, 32, 60, .06);
}

.card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.card-head-left {
    display: flex;
    gap: 10px;
    min-width: 0;
}

.card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    margin-top: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8385FF 0%, #4F46E5 100%);
    box-shadow: 0 4px 10px rgba(79, 70, 229, .26);
}

.card-icon svg {
    width: 15px;
    height: 15px;
}

.card-title-wrap { min-width: 0; }

.card-title {
    font-size: 16.5px;
    font-weight: 700;
    letter-spacing: .2px;
    white-space: nowrap;
}

.card-subtitle {
    margin-top: 3px;
    font-size: 12.5px;
    color: #98A0AE;
}

/* ===== 周 / 月 / 年 筛选 ===== */
.period-select { position: relative; flex: 0 0 auto; }

.period-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 11px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    color: #1D2129;
    background: #fff;
    border: 1px solid #E9EAF0;
    border-radius: 10px;
    cursor: pointer;
    transition: border-color .2s, color .2s;
}

.period-btn:hover { border-color: #C6C8F5; color: #4F46E5; }

.period-caret {
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid #9AA0AC;
    transition: transform .2s;
}

.period-select.is-open .period-caret { transform: rotate(180deg); }

.period-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    z-index: 20;
    display: none;
    min-width: 78px;
    padding: 4px;
    list-style: none;
    background: #fff;
    border: 1px solid #EEF0F5;
    border-radius: 10px;
    box-shadow: 0 10px 24px rgba(17, 24, 39, .12);
}

.period-select.is-open .period-menu { display: block; }

.period-menu li {
    padding: 8px 12px;
    font-size: 14px;
    color: #4E5969;
    text-align: center;
    border-radius: 8px;
    cursor: pointer;
}

.period-menu li:hover { background: #F4F5FB; }

.period-menu li.is-active {
    color: #4F46E5;
    font-weight: 600;
    background: #EEF0FF;
}

/* ===== 汇率数值 + 涨跌 ===== */
.rate-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 16px;
}

.rate-value-wrap { min-width: 0; }

.rate-value-line {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

/* 国旗图标容器：26px 圆形灰底 */
.flag {
    position: relative;
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #F0F0F0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    align-self: center;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .12);
}

.flag-icon {
    display: block;
    width: 18px;
    height: 12px;
}

.rate-value {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -.6px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.rate-unit {
    font-size: 13px;
    font-weight: 600;
    color: #86909C;
}

.rate-desc {
    margin-top: 6px;
    /*padding-left: 42px;*/
    font-size: 12.5px;
    color: #98A0AE;
}

.rate-badge-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    flex: 0 0 auto;
}

.rate-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border: 1px solid #FBD5D5;
    border-radius: 14px;
    background: #FFF6F6;
    color: #F53F3F;
}

.rate-badge.is-up {
    border-color: #B7EBCF;
    background: #F1FDF6;
    color: #0DAF6B;
}

.badge-value {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
}

.badge-text {
    font-size: 12px;
    color: #A2A5A4;
    white-space: nowrap;
}

/* 涨跌箭头（纯 CSS 绘制，颜色继承） */
.badge-arrow {
    position: relative;
    display: inline-block;
    width: 10px;
    height: 12px;
}

.badge-arrow::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 1px;
    width: 1.6px;
    height: 8px;
    border-radius: 1px;
    background: currentColor;
    transform: translateX(-50%);
}

.badge-arrow::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 0;
    width: 0;
    height: 0;
    border-left: 3.5px solid transparent;
    border-right: 3.5px solid transparent;
    transform: translateX(-50%);
}

.is-down .badge-arrow::after { border-top: 5px solid currentColor; }
.is-up .badge-arrow { top: 1px; }
.is-up .badge-arrow::before { top: 3px; }
.is-up .badge-arrow::after { top: 0; bottom: auto; border-bottom: 5px solid currentColor; }

/* ===== 图表 ===== */
.chart {
    width: 100%;
    height: 240px;
    margin-top: 6px;
}

.chart-fallback {
    padding-top: 80px;
    font-size: 13px;
    color: #98A0AE;
    text-align: center;
}

/* ECharts hover 提示框内容 */
.chart-tip {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12.5px;
    color: #86909C;
}

.chart-tip b {
    font-size: 14px;
    color: #1D2129;
}

/* ===== 小屏适配 ===== */
@media (max-width: 380px) {
    .page { padding: 12px 10px 32px; }
    .card-title { font-size: 15.5px; }
    .rate-value { font-size: 18px; letter-spacing: -.8px; }
    .rate-unit { font-size: 12px; }
    .rate-desc { font-size: 12px; padding-left: 0; }
    .rate-badge { min-width: 0; padding: 3px 8px; }
    .badge-value { font-size: 13px; }
    .chart { height: 210px; }
}
