/* ============================================================
   DeenBank - 基础布局与组件
   颜色/字体等通过 CSS 变量定义，由各主题文件覆盖。
   ============================================================ */

:root {
    /* 默认变量占位（实际值在 themes/default.css 中定义） */
    --bg: #f4f6fb;
    --bg-2: #eaeef6;
    --surface: #ffffff;
    --surface-2: #f7f9fc;
    --text: #1a2238;
    --text-muted: #6b7488;
    --border: #e2e7f0;
    --primary: #0a2540;
    --primary-2: #1a4d8c;
    --primary-text: #ffffff;
    --gold: #c9a961;
    --gold-soft: #e7d9b1;
    --success: #1f9d63;
    --danger: #d64545;
    --warning: #d98a1f;
    --shadow: 0 10px 30px rgba(10, 37, 64, 0.08);
    --shadow-sm: 0 2px 8px rgba(10, 37, 64, 0.06);
    --radius: 14px;
    --radius-sm: 9px;
    --font-body: "Segoe UI", system-ui, -apple-system, "Microsoft YaHei", sans-serif;
    --font-display: Georgia, "Times New Roman", "Segoe UI", serif;
    --hero-from: #0a2540;
    --hero-to: #1a4d8c;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    /* 用户偏好：字体加大 2px */
    font-size: 17px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-image:
        radial-gradient(1200px 600px at 100% -10%, color-mix(in srgb, var(--primary-2) 8%, transparent), transparent 60%),
        radial-gradient(900px 500px at -10% 0%, color-mix(in srgb, var(--gold) 7%, transparent), transparent 55%);
    background-attachment: fixed;
}

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

h1, h2, h3 { font-weight: 700; line-height: 1.25; margin: 0 0 .5em; }

.container {
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    padding: 26px 22px 48px;
    flex: 1 0 auto;
}

.muted { color: var(--text-muted); font-size: .92em; }
.num { font-variant-numeric: tabular-nums; text-align: right; font-weight: 600; }
.num.big { font-size: 1.12em; }
.pos { color: var(--success); }
.neg { color: var(--danger); }
code { font-family: "Consolas", "SF Mono", monospace; background: var(--surface-2);
       padding: 1px 7px; border-radius: 6px; font-size: .92em; color: var(--primary); }

/* ==================== 顶部导航 ==================== */
.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}
.topbar-inner {
    max-width: 1080px;
    margin: 0 auto;
    padding: 12px 22px;
    display: flex;
    align-items: center;
    gap: 18px;
}
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-display);
    text-decoration: none;
    color: var(--primary);
}
.brand:hover { text-decoration: none; }
.brand-mark {
    width: 38px; height: 38px;
    display: grid; place-items: center;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: #fff;
    border-radius: 10px;
    font-weight: 700;
    font-size: 22px;
    box-shadow: 0 4px 14px color-mix(in srgb, var(--primary) 40%, transparent);
    border: 1px solid var(--gold-soft);
}
.brand-mark.small { width: 22px; height: 22px; font-size: 13px; border-radius: 6px; }
.brand-text {
    font-size: 1.45rem;
    font-weight: 700;
    letter-spacing: .5px;
}
.brand-text small { font-size: .6em; color: var(--gold); font-weight: 700; margin-left: 1px; }

.balance-pill {
    margin-left: 4px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: var(--primary-text);
    padding: 6px 14px;
    border-radius: 999px;
    font-weight: 700;
    border: 1px solid var(--gold-soft);
    box-shadow: var(--shadow-sm);
}
.balance-label { font-size: .78em; opacity: .85; font-weight: 600; }
.balance-amount { font-variant-numeric: tabular-nums; }

.nav {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}
.nav a {
    color: var(--text);
    padding: 8px 12px;
    border-radius: 8px;
    font-weight: 600;
    font-size: .96rem;
    transition: background .15s, color .15s;
}
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a.active { color: var(--primary); background: var(--surface-2); }
.nav a.nav-admin { color: var(--gold); }
.nav-user .user-link {
    display: inline-flex; align-items: center; gap: 7px;
    background: var(--surface-2);
    border: 1px solid var(--border);
}
.btn-logout {
    cursor: pointer;
    font: inherit;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 8px 12px;
    border-radius: 8px;
    font-weight: 600;
}
.btn-logout:hover { color: var(--danger); border-color: var(--danger); }

.avatar {
    width: 30px; height: 30px;
    display: inline-grid; place-items: center;
    background: linear-gradient(135deg, var(--gold), var(--gold-soft));
    color: var(--primary);
    border-radius: 50%;
    font-weight: 700;
    font-size: .85rem;
    flex: 0 0 auto;
}
.avatar.small { width: 24px; height: 24px; font-size: .72rem; }
.avatar.xl { width: 76px; height: 76px; font-size: 2rem; border-radius: 18px; }

/* ==================== 按钮 ==================== */
.btn-primary, .btn-ghost {
    display: inline-block;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    padding: 10px 18px;
    border-radius: 10px;
    border: 1px solid transparent;
    transition: transform .12s, box-shadow .15s, background .15s;
    text-decoration: none;
}
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: var(--primary-text);
    border-color: var(--gold-soft);
    box-shadow: 0 6px 16px color-mix(in srgb, var(--primary) 32%, transparent);
}
.btn-primary:hover { transform: translateY(-1px); text-decoration: none; box-shadow: 0 9px 22px color-mix(in srgb, var(--primary) 42%, transparent); }
.btn-primary:active { transform: translateY(0); }
.btn-ghost {
    background: var(--surface);
    color: var(--primary);
    border-color: var(--border);
}
.btn-ghost:hover { background: var(--surface-2); text-decoration: none; border-color: var(--gold); }
.btn-sm { padding: 6px 12px; font-size: .88rem; border-radius: 8px; }
.btn-xs { padding: 3px 8px; font-size: .76rem; border-radius: 6px; }
.btn-block { display: block; width: 100%; text-align: center; }
button[disabled] { opacity: .55; cursor: not-allowed; }

/* ==================== 主页 Hero ==================== */
.hero {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--hero-from), var(--hero-to));
    color: #fff;
    padding: 42px 38px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--gold-soft);
}
.hero-glow {
    position: absolute; inset: 0;
    background:
        radial-gradient(600px 300px at 90% 10%, color-mix(in srgb, var(--gold) 30%, transparent), transparent 60%),
        radial-gradient(500px 280px at 0% 120%, color-mix(in srgb, #fff 12%, transparent), transparent 60%);
    pointer-events: none;
}
.hero-content { position: relative; }
.hello { margin: 0 0 4px; font-size: 1.05rem; opacity: .9; font-weight: 600; }
.hero-balance {
    font-family: var(--font-display);
    font-size: clamp(2.6rem, 6vw, 4rem);
    margin: 0 0 8px;
    font-weight: 700;
    letter-spacing: .5px;
    text-shadow: 0 2px 18px rgba(0,0,0,.25);
}
.hero-sub { margin: 0 0 22px; opacity: .92; font-weight: 600; }
.hero-sub strong { color: var(--gold); }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-actions .btn-ghost {
    background: rgba(255,255,255,.12);
    color: #fff;
    border-color: rgba(255,255,255,.35);
    backdrop-filter: blur(4px);
}
.hero-actions .btn-ghost:hover { background: rgba(255,255,255,.22); }
.hero-actions .btn-primary { background: var(--gold); color: var(--primary); border-color: var(--gold); }
.hero-actions .btn-primary:hover { background: color-mix(in srgb, var(--gold) 88%, #fff); }

/* ==================== 卡片 ==================== */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px 26px;
    margin-bottom: 22px;
    box-shadow: var(--shadow-sm);
}
.card-title { font-size: 1.2rem; font-weight: 700; color: var(--primary); }
.card-foot { margin-top: 14px; font-weight: 600; }
.alert-card { border-left: 4px solid var(--danger); }
.intro p { margin: 6px 0; }

/* ==================== 网格 ==================== */
.grid-2, .grid-3 { display: grid; gap: 18px; margin-bottom: 22px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 820px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* ==================== 磁贴 ==================== */
.tile {
    display: block;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 20px;
    text-decoration: none;
    color: var(--text);
    transition: transform .15s, box-shadow .15s, border-color .15s;
    box-shadow: var(--shadow-sm);
}
.tile:hover { transform: translateY(-3px); text-decoration: none; border-color: var(--gold); box-shadow: var(--shadow); }
.tile-ico {
    width: 42px; height: 42px;
    display: grid; place-items: center;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: var(--gold);
    border-radius: 11px;
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 12px;
}
.tile h3 { margin: 0 0 4px; color: var(--primary); font-size: 1.05rem; }
.tile p { margin: 0; color: var(--text-muted); font-size: .9rem; }

/* ==================== 表格 ==================== */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th, .table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.table th {
    background: var(--surface-2);
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
    font-size: .86rem;
    text-transform: none;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--surface-2); }
.table .col-rank { width: 70px; }
.row-warn { background: color-mix(in srgb, var(--danger) 6%, transparent) !important; }
.row-me { background: color-mix(in srgb, var(--gold) 12%, transparent) !important; }
.user-cell { display: inline-flex; align-items: center; gap: 8px; color: var(--text); }
.user-cell:hover { text-decoration: none; color: var(--primary); }

/* 排名徽章 */
.rank-num {
    display: inline-grid; place-items: center;
    width: 34px; height: 34px;
    border-radius: 9px;
    font-weight: 700;
    background: var(--surface-2);
    color: var(--text-muted);
}
.rank-1 { background: linear-gradient(135deg, #f4cf6b, #c9a961); color: #5a4408; }
.rank-2 { background: linear-gradient(135deg, #d6dbe3, #9aa6b8); color: #2c3340; }
.rank-3 { background: linear-gradient(135deg, #d99a6a, #b07042); color: #4a2a10; }

/* ==================== 徽章 / 标签 ==================== */
.badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 700;
    background: var(--surface-2);
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.badge-success { background: color-mix(in srgb, var(--success) 14%, transparent); color: var(--success); border-color: color-mix(in srgb, var(--success) 30%, transparent); }
.badge-danger  { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.badge-penalty  { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 32%, transparent); }
.badge-redeem, .badge-admin_grant, .badge-signup_bonus { background: color-mix(in srgb, var(--gold) 18%, transparent); color: var(--primary); border-color: color-mix(in srgb, var(--gold) 40%, transparent); }
.badge-transfer { background: color-mix(in srgb, var(--primary-2) 12%, transparent); color: var(--primary-2); border-color: color-mix(in srgb, var(--primary-2) 28%, transparent); }
.badge-borrow   { background: color-mix(in srgb, var(--warning) 16%, transparent); color: var(--warning); border-color: color-mix(in srgb, var(--warning) 30%, transparent); }
.badge-repay    { background: color-mix(in srgb, var(--success) 12%, transparent); color: var(--success); border-color: color-mix(in srgb, var(--success) 26%, transparent); }
.badge-theme_buy{ background: color-mix(in srgb, var(--gold) 14%, transparent); color: var(--gold); border-color: color-mix(in srgb, var(--gold) 34%, transparent); }

.tag-admin { background: var(--gold); color: var(--primary); padding: 2px 8px; border-radius: 6px; font-size: .72rem; font-weight: 700; margin-left: 4px; }
.tag-me    { background: var(--primary-2); color: #fff; padding: 2px 8px; border-radius: 6px; font-size: .72rem; font-weight: 700; margin-left: 4px; }
.tag-active{ background: var(--success); color: #fff; padding: 2px 8px; border-radius: 6px; font-size: .72rem; font-weight: 700; margin-left: 6px; }

/* ==================== 表单 ==================== */
.form { display: flex; flex-direction: column; gap: 14px; max-width: 460px; }
.form.inline { display: inline; max-width: none; }
.form-inline { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; max-width: none; }
.form-inline input { flex: 1 1 140px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-weight: 700; color: var(--primary); font-size: .9rem; }
input[type="text"], input[type="password"], input[type="number"],
input[type="email"], select, textarea {
    font: inherit;
    padding: 11px 13px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    width: 100%;
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-2);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-2) 18%, transparent);
}
.search-form { max-width: none; }
.search-row { display: flex; gap: 10px; flex-wrap: wrap; }
.search-row input { flex: 1 1 240px; }
.search-row select { flex: 0 0 auto; width: auto; }
.search-row button { flex: 0 0 auto; }

/* ==================== 登录注册 ==================== */
.auth-wrap { display: grid; place-items: center; padding: 30px 0; }
.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 36px 34px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow);
}
.auth-title { font-family: var(--font-display); color: var(--primary); font-size: 1.6rem; }
.auth-sub { color: var(--text-muted); margin: 4px 0 22px; }
.auth-foot { margin-top: 18px; text-align: center; color: var(--text-muted); }

/* ==================== 用户主页 ==================== */
.profile { margin-bottom: 22px; }
.profile-head {
    display: flex;
    align-items: center;
    gap: 22px;
    background: linear-gradient(135deg, var(--hero-from), var(--hero-to));
    color: #fff;
    padding: 28px 30px;
    border-radius: var(--radius);
    border: 1px solid var(--gold-soft);
    box-shadow: var(--shadow);
}
.profile-info h1 { color: #fff; font-size: 1.7rem; }
.profile-info .muted { color: rgba(255,255,255,.8); }
.profile-bal { margin: 6px 0 0; }
.profile-bal strong { color: var(--gold); font-size: 1.2rem; }
.avatar.xl { background: linear-gradient(135deg, var(--gold), var(--gold-soft)); color: var(--primary); }

/* ==================== 统计行 ==================== */
.stat-row { display: flex; gap: 16px; flex-wrap: wrap; }
.stat {
    flex: 1 1 140px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px 18px;
}
.stat-num { font-size: 1.5rem; font-weight: 700; color: var(--primary); font-variant-numeric: tabular-nums; }
.stat-label { color: var(--text-muted); font-size: .86rem; font-weight: 600; }

/* ==================== 主题商店 ==================== */
.theme-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 900px) { .theme-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .theme-grid { grid-template-columns: 1fr; } }

.theme-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    display: flex; flex-direction: column;
}
.theme-preview {
    padding: 14px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
}
.tp-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.tp-logo {
    width: 26px; height: 26px; border-radius: 7px;
    background: linear-gradient(135deg, var(--p-from, #0a2540), var(--p-to, #1a4d8c));
    color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .8rem;
    border: 1px solid var(--p-gold, #c9a961);
}
.tp-pill {
    margin-left: auto;
    background: linear-gradient(135deg, var(--p-from), var(--p-to));
    color: #fff; font-size: .72rem; font-weight: 700; padding: 3px 9px; border-radius: 999px;
    border: 1px solid var(--p-gold);
}
.tp-body {
    background: var(--p-bg, #f4f6fb);
    border-radius: 10px;
    padding: 16px;
    border: 1px solid var(--p-border, #e2e7f0);
}
.tp-balance {
    font-family: var(--font-display);
    font-weight: 700; font-size: 1.5rem; color: var(--p-text, #1a2238); margin-bottom: 12px;
}
.tp-btns { display: flex; gap: 8px; }
.tp-btn {
    background: var(--p-gold, #c9a961); color: #1a2238;
    font-size: .76rem; font-weight: 700; padding: 5px 11px; border-radius: 7px;
}
.tp-ghost {
    background: transparent; border: 1px solid var(--p-border, #e2e7f0);
    color: var(--p-text, #1a2238); font-size: .76rem; font-weight: 700; padding: 5px 11px; border-radius: 7px;
}
.theme-info { padding: 16px; flex: 1; display: flex; flex-direction: column; }
.theme-info h3 { color: var(--primary); font-size: 1.05rem; margin-bottom: 4px; }
.theme-info .muted { margin-bottom: 14px; }
.theme-foot {
    margin-top: auto;
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.theme-price { font-weight: 700; color: var(--gold); font-size: 1.05rem; }

/* ==================== 兑换码列表 ==================== */
.code-list { display: flex; flex-direction: column; gap: 8px; }
.code-item {
    display: flex; align-items: center; justify-content: space-between;
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: 9px; padding: 9px 13px;
}
.code-item code { font-size: 1.05rem; font-weight: 700; background: transparent; padding: 0; }

/* ==================== Flash 消息 ==================== */
.flash {
    max-width: 1080px;
    margin: 14px auto 0;
    padding: 13px 18px;
    border-radius: 10px;
    font-weight: 600;
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    animation: flashIn .25s ease;
}
@keyframes flashIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.flash-success { background: color-mix(in srgb, var(--success) 12%, var(--surface)); border-color: color-mix(in srgb, var(--success) 35%, var(--border)); color: color-mix(in srgb, var(--success) 80%, var(--text)); }
.flash-error   { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); color: color-mix(in srgb, var(--danger) 80%, var(--text)); }

/* ==================== 页脚 ==================== */
.footer {
    border-top: 1px solid var(--border);
    background: var(--surface);
    margin-top: auto;
}
.footer-inner {
    max-width: 1080px; margin: 0 auto;
    padding: 22px 22px;
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    color: var(--text-muted); font-size: .88rem;
}
.footer-brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--primary); }
.footer-slogan { color: var(--text-muted); font-weight: 500; }
.footer-meta { flex: 1; min-width: 220px; }
.footer-copy { color: var(--text-muted); }

/* ==================== 响应式 ==================== */
@media (max-width: 720px) {
    .topbar-inner { flex-wrap: wrap; }
    .nav { width: 100%; margin-left: 0; }
    .balance-pill { order: -1; margin-left: auto; }
    .hero { padding: 30px 22px; }
    .profile-head { flex-direction: column; text-align: center; }
}
