/* 见地 - 全站统一浅色主题 */
:root {
    --bg-color: #f4f6f8;
    --card-bg: #ffffff;
    --primary: #4b0082;
    --text-main: #333333;
    --text-sub: #888888;
    --border: #e8e8e8;
    --success: #f5222d;
    --failed: #52c41a;
    --invalid: #faad14;
}

* { box-sizing: border-box; }
body { background: var(--bg-color); margin: 0; font-family: -apple-system, "PingFang SC", sans-serif; color: var(--text-main); padding-bottom: 65px; }

.card { background: var(--card-bg); border-radius: 12px; padding: 16px; margin: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.04); }
.btn { background: var(--primary); color: #fff; border: none; padding: 12px; width: 100%; border-radius: 8px; font-size: 16px; font-weight: bold; cursor: pointer; text-align: center; text-decoration: none; display: block; transition: opacity 0.2s; }
.btn:active { opacity: 0.8; }
.btn-outline { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn-danger { background: #fff; color: var(--success); border: 1px solid var(--success); }
.btn-gray { background: #fff; color: var(--text-main); border: 1px solid #ddd; }

.input-box { width: 100%; padding: 12px; border: 1px solid #ddd; border-radius: 8px; box-sizing: border-box; margin-bottom: 12px; font-size: 15px; outline: none; background: #fafafa; }
.input-box:focus { border-color: var(--primary); background: #fff; }

/* 顶部栏：固定顶部，logo左+登录右同行 */
.topbar { position: fixed; top: 0; left: 0; right: 0; height: 52px; background: #fff; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; z-index: 1000; box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
.topbar-logo { font-size: 20px; font-weight: bold; color: #4b0082; letter-spacing: 2px; }
.topbar-login { font-size: 13px; font-weight: bold; color: var(--primary); background: #f0f0ff; border: 1px solid #e0e0ff; padding: 6px 16px; border-radius: 16px; text-decoration: none; }
.topbar-login:active { opacity: 0.7; }

/* 内容区给顶部栏留位置 */
body { padding-top: 52px; }

/* 底部导航 */
.tabbar { position: fixed; bottom: 0; width: 100%; height: 60px; background: #fff; display: flex; border-top: 1px solid var(--border); z-index: 100; }
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-sub); text-decoration: none; font-size: 11px; }
.tabbar a.active { color: var(--primary); font-weight: bold; }
.tabbar a i { font-size: 20px; margin-bottom: 2px; font-style: normal; }

/* 悬浮发布按钮 */
.fab { position: fixed; right: 20px; bottom: calc(78px + env(safe-area-inset-bottom, 0px)); background: linear-gradient(135deg, #ff7a45, #ff4d4f); color: #fff; padding: 12px 20px; border-radius: 30px; text-decoration: none; z-index: 99; font-weight: bold; box-shadow: 0 4px 12px rgba(255,77,79,0.4); font-size: 14px; }

/* 数据看板 */
.stats-grid { display: flex; justify-content: space-between; text-align: center; }
.stats-grid div { flex: 1; }
.stats-grid b { font-size: 18px; display: block; margin-bottom: 4px; }
.stats-grid span { font-size: 12px; color: var(--text-sub); }

/* 数字格直接可点：点哪一格就筛哪一类，选中的格子高亮 */
.stats-grid .stat-cell {
    cursor: pointer; border-radius: 8px; padding: 6px 0;
    transition: background 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.stats-grid .stat-cell.on { background: #f0f0ff; }
.stats-grid .stat-cell:active { background: #e6e6ff; }

/* 印章标签 */
.badge { padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: bold; border: 1px solid; }
.badge-success { color: var(--success); border-color: var(--success); background: rgba(245,34,45,0.05); }
.badge-failed { color: var(--failed); border-color: var(--failed); background: rgba(82,196,26,0.05); }
.badge-pending { color: var(--primary); border-color: var(--primary); background: rgba(24,144,255,0.05); }
.badge-invalid { color: var(--invalid); border-color: var(--invalid); background: rgba(250,173,20,0.05); }

/* ===== 手机端自适应 ===== */
body {
    padding-bottom: calc(65px + env(safe-area-inset-bottom, 0px));
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

.tabbar {
    bottom: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    height: calc(60px + env(safe-area-inset-bottom, 0px));
}

.fab {
    bottom: calc(78px + env(safe-area-inset-bottom, 0px));
}

/* 极窄屏 */
@media (max-width: 360px) {
    .card { padding: 14px; margin: 10px; }
    .input-box { padding: 11px; font-size: 14px; }
    .btn { padding: 11px; font-size: 15px; }
    .tabbar a { font-size: 10px; }
    .tabbar a i { font-size: 18px; }
}

/* 平板/桌面 */
@media (min-width: 768px) {
    body { max-width: 560px; margin: 0 auto; box-shadow: 0 0 24px rgba(0,0,0,0.06); min-height: 100vh; }
    .tabbar { max-width: 560px; left: 50%; transform: translateX(-50%); }
    .topbar { max-width: 560px; left: 50%; right: auto; transform: translateX(-50%); border-radius: 0 0 12px 12px; }
}

/* ===== 「我的」折叠行 ===== */
.row-line {
    display: flex; justify-content: space-between; align-items: center;
    padding: 15px 0; margin: 0; cursor: pointer;
    border-bottom: 1px solid #eee; font-size: 15px;
}
.row-line:active { background: #fafafa; }
.row-hint { color: var(--text-sub); font-size: 13px; }

/* ===== 订阅按钮 ===== */
.btn-follow {
    padding: 6px 14px; border: 1px solid var(--primary); color: var(--primary);
    background: #fff; border-radius: 15px; font-size: 12px; cursor: pointer;
    white-space: nowrap; margin-left: 10px;
}
.btn-follow.on { background: #f5f5f5; color: #999; border-color: #ddd; }

/* ===== 发布页：选择方式标签 ===== */
.tag-sel, .tag-self {
    display: inline-block; font-size: 11px; font-weight: normal;
    padding: 1px 6px; border-radius: 4px; margin-left: 6px; vertical-align: middle;
}
.tag-sel { background: #e6f4ff; color: #1890ff; }
.tag-self { background: #fff7e6; color: #d46b08; }

.chip-group { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.chip {
    padding: 6px 14px; border: 1px solid #ddd; border-radius: 16px;
    font-size: 13px; color: #555; background: #fff; cursor: pointer;
}
.chip-on { border-color: var(--primary); color: var(--primary); background: #e6f4ff; font-weight: bold; }

.stop-box {
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
    background: #fff1f0; border: 1px solid #ffccc7; border-radius: 8px;
    padding: 10px 12px; margin-bottom: 12px; font-size: 13px;
}
.stop-box b { color: var(--failed); font-size: 16px; }

select.input-box { appearance: none; -webkit-appearance: none; background-color: #fafafa; }

/* ===== 设置页 ===== */
.set-label { display: block; font-size: 13px; color: var(--text-main); margin-bottom: 6px; font-weight: bold; }

/* ===== 发布页：标签左 + 输入框右 同行布局 ===== */
.field-row { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.field-row-top { align-items: flex-start; }
.field-row .set-label { flex: 0 0 84px; margin: 0; white-space: nowrap; }
.field-row-top .set-label { padding-top: 8px; }
.field-row .input-box { flex: 1; width: auto; min-width: 0; margin-bottom: 0; }
.field-ctrl { flex: 1; position: relative; min-width: 0; }
.field-ctrl .input-box { width: 100%; margin-bottom: 0; }
.field-hint { font-size: 12px; color: #aaa; margin: -6px 0 14px 94px; }

/* 目标涨幅 + 止损位 同一行，一左一右 */
.field-row-stop { align-items: flex-end; }
.stop-main { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; }
.stop-main .set-label { flex: 0 0 84px; margin: 0; white-space: nowrap; }
.stop-main .input-box { flex: 1; width: auto; min-width: 0; margin-bottom: 0; }
.stop-box-inline { flex: 0 0 auto; margin: 0 0 0 12px; }

.set-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 0; margin: 0; font-size: 14px; border-bottom: 1px solid #f0f0f0;
}

/* ===== 搜索框统一样式（首页、广场） ===== */
.search-bar {
    display: flex; align-items: center; gap: 8px;
    background: #fff; border: 1px solid #ddd; border-radius: 24px;
    padding: 10px 16px; margin: 12px;
}
.search-bar input {
    flex: 1; border: none; outline: none; font-size: 15px; background: transparent;
}
.search-bar .search-icon {
    font-size: 18px; color: #999;
}

/* ===== 看板五档筛选条（与首页顶部五个数字一一对应） ===== */
.filter-bar {
    display: flex; gap: 8px; margin: 0 12px 12px;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.filter-bar::-webkit-scrollbar { display: none; }
.filter-bar button {
    flex: 0 0 auto; padding: 7px 16px; font-size: 13px;
    border: 1px solid #e3e3e3; border-radius: 18px;
    background: #fff; color: var(--text-sub); cursor: pointer;
}
.filter-bar button.active {
    background: #4b0082; border-color: #4b0082;
    color: #fff; font-weight: bold;
}

/* ===== 发布页：规则「?」标签 / 触线红条 / 规则弹窗 ===== */
.rule-q {
    display: inline-flex; align-items: center; justify-content: center;
    width: 16px; height: 16px; margin-left: 4px;
    border-radius: 50%; background: #f0f0ff; color: var(--primary);
    font-size: 11px; font-weight: bold; cursor: pointer; vertical-align: middle;
}
.rule-warn {
    background: #fff2f0; border: 1px solid #ffccc7; color: #cf1322;
    font-size: 12px; line-height: 1.6; padding: 10px 12px;
    border-radius: 8px; margin-bottom: 12px;
}
.rule-mask {
    position: fixed; inset: 0; z-index: 2000;
    background: rgba(0, 0, 0, .45);
    align-items: center; justify-content: center; padding: 20px;
}
.rule-modal {
    background: #fff; border-radius: 12px; padding: 18px;
    width: 100%; max-width: 420px; max-height: 76vh; overflow: auto;
}

/* ===== 首页统计数字固定在顶部（滚动时） ===== */
.stats-sticky {
    position: sticky; top: 52px; z-index: 90;
    background: #fff; border-radius: 0 0 12px 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
