/* ========== 全局样式 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --bg-primary: #0a0e17;
    --bg-secondary: #141a2e;
    --bg-tertiary: #1e2540;
    --bg-card: #161c2e;
    --text-primary: #ffffff;
    --text-secondary: #8b95a7;
    --text-muted: #5a6478;
    --color-up: #00d6a0;
    --color-down: #ff4757;
    --color-accent: #2d80ff;
    --color-gold: #ffb930;
    --color-verified: #00d6a0;
    --border-color: #2a3050;
    --radius: 12px;
    --radius-sm: 8px;
    --safe-bottom: env(safe-area-inset-bottom);
}

html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
img { display: block; max-width: 100%; }
button { border: none; outline: none; cursor: pointer; font-family: inherit; }
input, textarea, select { 
    outline: none; 
    font-family: inherit; 
    border: none; 
    background: none; 
    color: inherit;
}

/* ========== 页面容器 ========== */
.app-container {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--bg-primary);
    position: relative;
    padding-bottom: 70px;
}

/* ========== 底部导航 ========== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    display: flex;
    height: 60px;
    z-index: 100;
    padding-bottom: var(--safe-bottom);
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 12px;
    gap: 4px;
    transition: color 0.2s;
}

.nav-item.active {
    color: var(--color-accent);
}

.nav-item svg {
    width: 24px;
    height: 24px;
}

/* ========== 轮播图 ========== */
.banner-container {
    width: 100%;
    height: 160px;
    overflow: hidden;
    position: relative;
    border-radius: 0;
}

.banner-wrapper {
    display: flex;
    transition: transform 0.5s ease;
    height: 100%;
}

.banner-slide {
    min-width: 100%;
    height: 100%;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.banner-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.banner-slide .banner-placeholder {
    color: var(--text-muted);
    font-size: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.banner-dots {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
}

.banner-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    transition: all 0.3s;
}

.banner-dot.active {
    background: var(--color-accent);
    width: 18px;
    border-radius: 3px;
}

/* ========== 币种列表 ========== */
.section-title {
    padding: 16px 16px 8px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.section-title .subtitle {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-secondary);
}

.coin-list {
    padding: 0 12px;
}

.coin-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 12px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    transition: background 0.2s;
    cursor: pointer;
}

.coin-item:active {
    background: var(--bg-tertiary);
}

.coin-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.coin-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    text-transform: uppercase;
}
    flex-shrink: 0;
}

.coin-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.coin-name {
    font-size: 14px;
    font-weight: 600;
}

.coin-symbol {
    font-size: 12px;
    color: var(--text-muted);
}

.coin-right {
    text-align: right;
}

.coin-price {
    font-size: 14px;
    font-weight: 600;
    font-family: 'SF Mono', monospace;
}

.coin-change {
    font-size: 12px;
    font-weight: 500;
    margin-top: 2px;
}

.change-up { color: var(--color-up); }
.change-down { color: var(--color-down); }

/* ========== 交易页面 ========== */
.trade-header {
    padding: 16px;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.back-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    font-size: 20px;
}

.trade-coin-info {
    flex: 1;
}

.trade-coin-name {
    font-size: 16px;
    font-weight: 600;
}

.trade-coin-price {
    font-size: 14px;
    font-family: 'SF Mono', monospace;
}

.trade-coin-change {
    font-size: 12px;
}

/* K线图容器 */
.chart-container {
    width: 100%;
    height: 300px;
    background: var(--bg-secondary);
    position: relative;
}

#klineChart {
    width: 100%;
    height: 100%;
}

/* 交易控制区 */
.trade-panel {
    padding: 16px;
}

.direction-tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.direction-tab {
    flex: 1;
    padding: 14px;
    border-radius: var(--radius-sm);
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    transition: all 0.2s;
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 2px solid transparent;
}

.direction-tab.active.up {
    background: rgba(0, 214, 160, 0.15);
    color: var(--color-up);
    border-color: var(--color-up);
}

.direction-tab.active.down {
    background: rgba(255, 71, 87, 0.15);
    color: var(--color-down);
    border-color: var(--color-down);
}

.direction-tab .arrow {
    font-size: 20px;
    display: block;
    margin-bottom: 4px;
}

/* 金额选择 */
.amount-section {
    margin-bottom: 20px;
}

.section-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.amount-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.amount-btn {
    padding: 10px 4px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    border: 1px solid transparent;
    transition: all 0.2s;
}

.amount-btn.active {
    background: rgba(45, 128, 255, 0.15);
    color: var(--color-accent);
    border-color: var(--color-accent);
}

.amount-input-wrapper {
    margin-top: 10px;
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    padding: 0 14px;
}

.amount-input {
    flex: 1;
    padding: 12px 0;
    font-size: 16px;
    font-weight: 600;
}

.amount-input::placeholder {
    color: var(--text-muted);
}

.amount-unit {
    color: var(--text-secondary);
    font-size: 13px;
}

/* 时间选择 */
.time-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.time-btn {
    padding: 12px 4px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    border: 1px solid transparent;
    transition: all 0.2s;
}

.time-btn.active {
    background: rgba(45, 128, 255, 0.15);
    color: var(--color-accent);
    border-color: var(--color-accent);
}

.time-btn .profit-rate {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
    font-weight: 400;
}

/* 下单按钮 */
.place-order-btn {
    width: 100%;
    padding: 16px;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 700;
    margin-top: 24px;
    color: #fff;
    transition: opacity 0.2s;
}

.place-order-btn:active {
    opacity: 0.8;
}

.place-order-btn.up {
    background: linear-gradient(135deg, #00d6a0, #00a87d);
}

.place-order-btn.down {
    background: linear-gradient(135deg, #ff4757, #cc3543);
}

/* 订单信息 */
.order-info {
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    padding: 14px;
    margin-top: 16px;
}

.order-info-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 13px;
}

.order-info-row .label {
    color: var(--text-secondary);
}

.order-info-row .value {
    font-weight: 600;
}

/* ========== 我的页面 ========== */
.profile-header {
    background: linear-gradient(135deg, #1a2240, #0f1428);
    padding: 30px 20px 24px;
    text-align: center;
}

.profile-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    margin: 0 auto 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--color-accent);
    border: 2px solid var(--border-color);
}

.profile-name {
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.verified-badge {
    background: rgba(0, 214, 160, 0.2);
    color: var(--color-verified);
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 500;
}

.balance-card {
    margin: -16px 16px 20px;
    background: linear-gradient(135deg, #2d80ff, #1a5cd4);
    border-radius: var(--radius);
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.balance-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: rgba(255,255,255,0.05);
}

.balance-label {
    font-size: 13px;
    color: rgba(255,255,255,0.7);
    margin-bottom: 8px;
}

.balance-amount {
    font-size: 32px;
    font-weight: 700;
    color: #fff;
    font-family: 'SF Mono', monospace;
}

.balance-amount .unit {
    font-size: 16px;
    font-weight: 400;
    margin-left: 4px;
}

/* 功能列表 */
.menu-list {
    margin: 0 16px;
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 16px;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 16px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid var(--border-color);
}

.menu-item:last-child {
    border-bottom: none;
}

.menu-item:active {
    background: var(--bg-tertiary);
}

.menu-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    margin-right: 12px;
    flex-shrink: 0;
}

.menu-icon.deposit { background: rgba(0, 214, 160, 0.15); color: var(--color-up); }
.menu-icon.withdraw { background: rgba(255, 71, 87, 0.15); color: var(--color-down); }
.menu-icon.verify { background: rgba(45, 128, 255, 0.15); color: var(--color-accent); }
.menu-icon.service { background: rgba(255, 185, 48, 0.15); color: var(--color-gold); }
.menu-icon.orders { background: rgba(139, 149, 167, 0.15); color: var(--text-secondary); }

.menu-text {
    flex: 1;
    font-size: 15px;
    font-weight: 500;
}

.menu-arrow {
    color: var(--text-muted);
    font-size: 18px;
}

.menu-status {
    font-size: 12px;
    color: var(--text-muted);
    margin-right: 8px;
}

.menu-status.verified { color: var(--color-verified); }
.menu-status.pending { color: var(--color-gold); }

/* ========== 弹窗 ========== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: 200;
    display: none;
    align-items: flex-end;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    width: 100%;
    max-width: 480px;
    border-radius: 20px 20px 0 0;
    padding: 24px 20px;
    max-height: 85vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

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

.modal-title {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 22px;
}

.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    padding: 14px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    font-size: 15px;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    transition: border-color 0.2s;
}

.form-input:focus {
    border-color: var(--color-accent);
}

.form-input::placeholder {
    color: var(--text-muted);
}

textarea.form-input {
    resize: none;
    min-height: 80px;
}

.form-btn {
    width: 100%;
    padding: 14px;
    border-radius: var(--radius-sm);
    background: var(--color-accent);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    transition: opacity 0.2s;
}

.form-btn:active {
    opacity: 0.8;
}

/* 充值二维码展示 */
.deposit-info {
    text-align: center;
    padding: 12px 0;
}

.deposit-qr {
    width: 180px;
    height: 180px;
    background: #fff;
    border-radius: var(--radius-sm);
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.deposit-qr img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.deposit-qr-placeholder {
    color: var(--text-muted);
    font-size: 13px;
}

.deposit-address-box {
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    padding: 14px;
    margin: 12px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.deposit-address-text {
    flex: 1;
    font-size: 13px;
    word-break: break-all;
    font-family: 'SF Mono', monospace;
}

.copy-btn {
    padding: 6px 12px;
    background: var(--color-accent);
    color: #fff;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
}

/* ========== 登录/注册页面 ========== */
.auth-page {
    min-height: 100vh;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 20px;
    max-width: 480px;
    margin: 0 auto;
}

.auth-logo {
    text-align: center;
    margin-bottom: 40px;
}

.auth-logo h1 {
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--color-accent), var(--color-up));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.auth-logo p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 8px;
}

.auth-form {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px 20px;
}

.auth-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 24px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    padding: 4px;
}

.auth-tab {
    flex: 1;
    padding: 10px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    border-radius: 6px;
    transition: all 0.2s;
}

.auth-tab.active {
    background: var(--color-accent);
    color: #fff;
}

/* ========== Toast 提示 ========== */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.85);
    color: #fff;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    white-space: nowrap;
}

.toast.show {
    opacity: 1;
}

/* ========== 订单结果 ========== */
.result-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    z-index: 300;
    display: none;
    align-items: center;
    justify-content: center;
}

.result-overlay.active {
    display: flex;
}

.result-card {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 32px 24px;
    text-align: center;
    width: 90%;
    max-width: 320px;
    animation: scaleIn 0.3s ease;
}

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

.result-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
}

.result-icon.win {
    background: rgba(0, 214, 160, 0.15);
    color: var(--color-up);
}

.result-icon.loss {
    background: rgba(255, 71, 87, 0.15);
    color: var(--color-down);
}

.result-icon.tie {
    background: rgba(139, 149, 167, 0.15);
    color: var(--text-secondary);
}

.result-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
}

.result-amount {
    font-size: 28px;
    font-weight: 700;
    font-family: 'SF Mono', monospace;
    margin-bottom: 16px;
}

.result-amount.win { color: var(--color-up); }
.result-amount.loss { color: var(--color-down); }

.result-details {
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-bottom: 20px;
    text-align: left;
}

.result-detail-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 13px;
}

.result-detail-row .label {
    color: var(--text-secondary);
}

.result-detail-row .value {
    font-weight: 600;
    font-family: 'SF Mono', monospace;
}

.result-btn {
    width: 100%;
    padding: 14px;
    border-radius: var(--radius-sm);
    background: var(--color-accent);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
}

/* ========== 倒计时 ========== */
.countdown-display {
    text-align: center;
    padding: 20px;
}

.countdown-number {
    font-size: 48px;
    font-weight: 700;
    font-family: 'SF Mono', monospace;
    color: var(--color-accent);
}

.countdown-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ========== 文件上传 ========== */
.file-upload-area {
    position: relative;
    width: 100%;
    height: 120px;
    background: var(--bg-card);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.2s;
    overflow: hidden;
}

.file-upload-area:active {
    border-color: var(--color-accent);
}

.file-upload-area img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.file-upload-icon {
    font-size: 28px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.file-upload-text {
    font-size: 12px;
    color: var(--text-muted);
}

.file-upload-area input[type="file"] {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* ========== 滚动加载 ========== */
.loading-more {
    text-align: center;
    padding: 16px;
    color: var(--text-muted);
    font-size: 13px;
}

.no-data {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 14px;
}

/* ========== 响应式 ========== */
@media (max-width: 480px) {
    .app-container {
        padding-bottom: 70px;
    }
}

/* 滚动条隐藏 */
::-webkit-scrollbar {
    width: 0;
    display: none;
}
