/* ============================================================
   TG 代理助手 · 用户中心前端样式
   蓝色扁平风格，零依赖，移动端优先响应式
   ============================================================ */

:root {
    --blue: #1a73e8;
    --blue-dark: #1557b0;
    --blue-light: #e8f0fe;
    --bg: #f5f7fa;
    --card: #ffffff;
    --text: #202124;
    --sub: #5f6368;
    --hint: #9aa0a6;
    --divider: #e8eaed;
    --track: #e8eaed;
    --green: #2e7d32;
    --green-light: #e6f4ea;
    --orange: #e65100;
    --orange-light: #fff3e0;
    --red: #c62828;
    --red-light: #fce8e6;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(60, 64, 67, .08);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===================== 布局 ===================== */

.topbar {
    background: var(--blue);
    color: #fff;
    padding: 14px 0;
}

.topbar .inner {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 16px;
    color: #fff;
}

.brand .logo {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: rgba(255, 255, 255, .22);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
}

.topbar .spacer { flex: 1; }

.topbar .who {
    font-size: 13px;
    color: rgba(255, 255, 255, .9);
}

.topbar .link {
    color: #fff;
    font-size: 13px;
    background: rgba(255, 255, 255, .16);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.topbar .link:hover { background: rgba(255, 255, 255, .26); text-decoration: none; }

main {
    max-width: 1080px;
    margin: 0 auto;
    padding: 22px 20px 60px;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    align-items: start;
}

@media (max-width: 820px) {
    .grid-2 { grid-template-columns: 1fr; }
}

/* ===================== 卡片 ===================== */

.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
    margin-bottom: 16px;
}

.card h2 {
    margin: 0 0 14px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card h2 .hint {
    font-size: 12px;
    font-weight: 400;
    color: var(--hint);
}

.card .desc {
    font-size: 12px;
    color: var(--sub);
    margin: -6px 0 12px;
}

.divider {
    height: 1px;
    background: var(--divider);
    margin: 14px 0;
}

/* ===================== 账号头部 ===================== */

.profile {
    display: flex;
    align-items: center;
    gap: 14px;
}

.avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--blue-light);
    color: var(--blue-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
    flex: 0 0 auto;
}

.profile .name {
    font-size: 17px;
    font-weight: 600;
}

.profile .meta {
    font-size: 12px;
    color: var(--sub);
    margin-top: 2px;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 5px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 6px;
    vertical-align: middle;
}

.badge.blue { background: var(--blue-light); color: var(--blue-dark); }
.badge.green { background: var(--green-light); color: var(--green); }
.badge.orange { background: var(--orange-light); color: var(--orange); }
.badge.red { background: var(--red-light); color: var(--red); }

/* ===================== 统计小格 ===================== */

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
}

.stat {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
}

.stat b { display: block; font-size: 15px; font-weight: 600; }
.stat span { font-size: 11px; color: var(--hint); }

/* ===================== 进度条 ===================== */

.bar {
    height: 8px;
    border-radius: 4px;
    background: var(--track);
    overflow: hidden;
}

.bar > i {
    display: block;
    height: 100%;
    border-radius: 4px;
    background: var(--blue);
    transition: width .3s ease;
}

.bar.warn > i { background: var(--orange); }
.bar.danger > i { background: var(--red); }

.bar-row {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--sub);
    margin-bottom: 7px;
}

/* ===================== 表单 ===================== */

label.field {
    display: block;
    font-size: 12px;
    color: var(--sub);
    margin-bottom: 5px;
}

input[type=text], input[type=password], input[type=email], textarea, select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--divider);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    background: #fff;
    outline: none;
    transition: border-color .15s;
}

input:focus, textarea:focus, select:focus { border-color: var(--blue); }

input::placeholder, textarea::placeholder { color: var(--hint); }

textarea { resize: vertical; min-height: 96px; }

.form-row { margin-bottom: 14px; }

.hint-line {
    font-size: 11px;
    margin-top: 5px;
    min-height: 15px;
}

.hint-line.ok { color: var(--green); }
.hint-line.err { color: var(--red); }
.hint-line.muted { color: var(--hint); }

/* ===================== 按钮 ===================== */

.btn {
    display: inline-block;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    border: none;
    font-size: 14px;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s, opacity .15s;
    text-align: center;
}

.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); }

.btn-ghost { background: var(--bg); color: var(--blue); }
.btn-ghost:hover { background: var(--blue-light); }

.btn-danger { background: var(--red-light); color: var(--red); }
.btn-danger:hover { background: #f7d4d0; }

.btn-block { display: block; width: 100%; }

.btn-sm { padding: 6px 12px; font-size: 12px; }

.btn[disabled] { opacity: .55; cursor: not-allowed; }

.btn-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ===================== 登录 / 注册页 ===================== */

.auth-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--card);
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(60, 64, 67, .1);
    padding: 26px 24px;
}

.auth-brand {
    text-align: center;
    margin-bottom: 22px;
}

.auth-brand .logo {
    width: 58px;
    height: 58px;
    border-radius: 16px;
    background: var(--blue);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
}

.auth-brand h1 {
    font-size: 19px;
    margin: 12px 0 4px;
}

.auth-brand p {
    font-size: 13px;
    color: var(--sub);
    margin: 0;
}

.auth-foot {
    text-align: center;
    font-size: 13px;
    color: var(--sub);
    margin-top: 14px;
}

.agree-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 12px;
    color: var(--sub);
    margin-bottom: 14px;
}

.agree-row input { margin: 3px 0 0; width: auto; }

.copyright {
    font-size: 11px;
    color: var(--hint);
    margin-top: 18px;
    text-align: center;
}

/* ===================== 提示条 ===================== */

.alert {
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font-size: 13px;
    margin-bottom: 14px;
    display: none;
}

.alert.show { display: block; }
.alert.error { background: var(--red-light); color: var(--red); }
.alert.ok { background: var(--green-light); color: var(--green); }
.alert.info { background: var(--blue-light); color: var(--blue-dark); }

/* 浮动提示 */
#toast-wrap {
    position: fixed;
    left: 50%;
    bottom: 28px;
    transform: translateX(-50%);
    z-index: 999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    pointer-events: none;
}

.toast {
    background: #323232;
    color: #fff;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    max-width: 88vw;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .2);
    animation: toast-in .18s ease;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===================== 订阅 / 节点 ===================== */

.copy-box {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.copy-box input {
    font-size: 12px;
    background: var(--bg);
    color: var(--sub);
    min-width: 0;
}

.copy-box .btn {
    flex: 0 0 auto;
    white-space: nowrap;
}

/* 移动端顶栏：品牌与用户名都可收缩省略，避免挤成两行 */
.brand span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar .who {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar .link { white-space: nowrap; }

@media (max-width: 600px) {
    .topbar .inner { padding: 0 14px; gap: 8px; }
    .brand { font-size: 14px; min-width: 0; }
    .brand span { display: none; }
    .topbar .who { max-width: 96px; font-size: 12px; }
    main { padding: 16px 14px 48px; }
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

th, td {
    text-align: left;
    padding: 9px 8px;
    border-bottom: 1px solid var(--divider);
}

th {
    font-size: 12px;
    color: var(--hint);
    font-weight: 500;
}

tbody tr:last-child td { border-bottom: none; }

.tag {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 4px;
    background: var(--blue-light);
    color: var(--blue-dark);
    font-size: 10px;
    font-weight: 600;
}

.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    word-break: break-all;
}

.empty {
    text-align: center;
    color: var(--hint);
    font-size: 13px;
    padding: 18px 0;
}

/* ===================== 反馈列表 ===================== */

.fb-item { padding: 12px 0; border-bottom: 1px solid var(--divider); }
.fb-item:last-child { border-bottom: none; padding-bottom: 0; }

.fb-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.fb-time { font-size: 11px; color: var(--hint); }

.fb-content { font-size: 13px; }

.fb-reply {
    margin-top: 8px;
    background: var(--blue-light);
    color: var(--blue-dark);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    font-size: 12px;
}

/* ===================== 骨架屏 / 遮罩 ===================== */

.loading {
    text-align: center;
    color: var(--hint);
    font-size: 13px;
    padding: 40px 0;
}

.veil {
    position: fixed;
    inset: 0;
    background: rgba(245, 247, 250, .7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 900;
}

.veil.show { display: flex; }

.spinner {
    width: 26px;
    height: 26px;
    border: 3px solid var(--blue-light);
    border-top-color: var(--blue);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ===================== 收藏节点 ===================== */

.fav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--divider);
}

.fav-item:last-child { border-bottom: none; padding-bottom: 0; }

.fav-info { flex: 1; min-width: 0; }

.fav-name {
    font-size: 13px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fav-sub {
    font-size: 11px;
    color: var(--hint);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fav-btns {
    display: flex;
    gap: 6px;
    flex: 0 0 auto;
}

@media (max-width: 480px) {
    .fav-item { flex-wrap: wrap; }
    .fav-btns { width: 100%; }
    .fav-btns .btn { flex: 1; }
}

/* ============================================================
   App 下载 / 发布页（release.html）
   ============================================================ */

/* ---- 顶部主卡片 ---- */

.hero { padding: 22px; }

.hero-main {
    display: flex;
    gap: 18px;
    align-items: flex-start;
}

.app-icon {
    width: 68px;
    height: 68px;
    flex: 0 0 auto;
    border-radius: 16px;
    background: var(--blue);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: .5px;
}

.hero-info { flex: 1; min-width: 0; }

.hero-info h1 {
    font-size: 19px;
    font-weight: 600;
    margin: 0 0 6px;
}

.hero-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--sub);
    margin-bottom: 14px;
}

.hero-meta .badge { margin-left: 0; }

.hero-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-lg {
    padding: 12px 26px;
    font-size: 15px;
    font-weight: 600;
}

/* 下载地址无效时（外链或文件缺失）给出明确提示，别让用户点了 404 */
.dl-warn {
    margin-top: 10px;
    background: var(--orange-light);
    color: var(--orange);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    font-size: 12px;
}

/* ---- 更新日志 ---- */

.changelog {
    margin: 0;
    font-family: inherit;
    font-size: 13px;
    line-height: 1.75;
    color: var(--text);
    white-space: pre-wrap;
    word-break: break-word;
}

/* ---- 历史版本 ---- */

.ver-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--divider);
    font-size: 13px;
}

.ver-item:last-child { border-bottom: none; padding-bottom: 0; }

.ver-item .vname {
    font-weight: 600;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ver-item .vsize { font-size: 12px; color: var(--hint); white-space: nowrap; }

/* ---- 二维码 ---- */

.qr-tabs {
    display: inline-flex;
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 3px;
    margin-bottom: 12px;
}

.qr-tab {
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 12px;
    color: var(--sub);
    padding: 5px 12px;
    border-radius: 6px;
    cursor: pointer;
}

.qr-tab.on {
    background: #fff;
    color: var(--blue-dark);
    font-weight: 600;
    box-shadow: var(--shadow);
}

.qr-box {
    display: flex;
    justify-content: center;
    padding: 14px;
    background: var(--bg);
    border-radius: var(--radius-sm);
}

.qr-box canvas {
    display: block;
    max-width: 100%;
    height: auto !important;
    border-radius: 6px;
}

/* ---- 键值行（哈希 / 大小等） ---- */

.kv {
    display: flex;
    gap: 10px;
    font-size: 12px;
    padding: 7px 0;
    border-bottom: 1px solid var(--divider);
}

.kv:last-child { border-bottom: none; }

.kv .k { color: var(--hint); flex: 0 0 68px; }
.kv .v { flex: 1; min-width: 0; word-break: break-all; }

/* ---- 安装步骤 ---- */

.steps {
    margin: 0;
    padding-left: 20px;
    font-size: 13px;
    color: var(--sub);
}

.steps li { margin-bottom: 7px; }
.steps li:last-child { margin-bottom: 0; }
.steps b { color: var(--text); }

@media (max-width: 600px) {
    .hero { padding: 18px 16px; }
    .app-icon { width: 56px; height: 56px; font-size: 21px; border-radius: 14px; }
    .hero-info h1 { font-size: 16px; }
    .btn-lg { width: 100%; }
    .hero-actions { width: 100%; }
}
