/* =====================================================================
   串个签 · 管理后台
   设计基调：炭火暖橙 + 米纸底色 + 深咖侧栏
   ===================================================================== */

:root {
    --bg: #f5efe5;
    --bg-soft: #fbf7f0;
    --panel: #fffdf9;
    --panel-2: #f9f3e9;
    --ink: #2b211b;
    --ink-soft: #5c4c40;
    --muted: #948477;
    --line: #e9dfd1;
    --line-strong: #dccdb9;
    --brand: #e2552b;
    --brand-dark: #c4421c;
    --brand-soft: #fce9e0;
    --gold: #d9a441;
    --gold-soft: #fbf1d8;
    --green: #2f8f63;
    --green-soft: #e5f4ec;
    --red: #cf3d3d;
    --red-soft: #fbe8e6;
    --blue: #3c6fa8;
    --blue-soft: #e8f0f8;
    --shadow-sm: 0 2px 8px rgba(74, 48, 28, .05);
    --shadow: 0 12px 32px rgba(74, 48, 28, .08);
    --radius: 16px;
    --radius-sm: 10px;
    --sidebar-w: 236px;
    --font-ui: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Noto Sans CJK SC", sans-serif;
    --font-display: "Songti SC", "STSong", "Noto Serif CJK SC", Georgia, serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-ui);
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

body { background-image: radial-gradient(rgba(180, 140, 100, .08) 1px, transparent 1px); background-size: 22px 22px; }

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4, p { margin: 0; }
.hidden { display: none !important; }

/* ------------------------------ 通用按钮 ------------------------------ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 38px;
    padding: 0 16px;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    background: var(--panel);
    color: var(--ink-soft);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease;
}

.btn:hover { background: var(--panel-2); border-color: var(--line-strong); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.btn-primary {
    background: linear-gradient(135deg, #ec6437, var(--brand));
    border-color: transparent;
    color: #fff;
    box-shadow: 0 8px 18px rgba(226, 85, 43, .24);
}
.btn-primary:hover { background: linear-gradient(135deg, var(--brand), var(--brand-dark)); }

.btn-ghost { background: transparent; }
.btn-danger { color: var(--red); border-color: #f0c9c6; background: #fffafa; }
.btn-danger:hover { background: var(--red-soft); }
.btn-soft { background: var(--brand-soft); color: var(--brand-dark); border-color: #f6cdbd; }
.btn-soft:hover { background: #fadfd2; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn-icon { width: 34px; height: 34px; padding: 0; }

/* ------------------------------ 登录页 ------------------------------ */
.login-view {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(420px, 1.08fr) minmax(380px, .92fr);
}

.login-brand {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 46px 56px;
    overflow: hidden;
    color: #fff8ef;
    background:
        radial-gradient(circle at 18% 12%, rgba(226, 85, 43, .5), transparent 38%),
        radial-gradient(circle at 82% 78%, rgba(217, 164, 65, .28), transparent 44%),
        linear-gradient(150deg, #2a1b13 0%, #1a110c 62%, #231610 100%);
}

.login-brand::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        repeating-linear-gradient(0deg, rgba(255, 236, 210, .045) 0 1px, transparent 1px 46px),
        repeating-linear-gradient(90deg, rgba(255, 236, 210, .045) 0 1px, transparent 1px 46px);
    mask-image: radial-gradient(circle at 60% 45%, #000 25%, transparent 78%);
    pointer-events: none;
}

.brand-top { position: relative; display: flex; align-items: center; gap: 14px; }
.brand-mark {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    background: linear-gradient(145deg, #f1703f, #d94a20);
    color: #fff;
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 700;
    box-shadow: 0 10px 22px rgba(226, 85, 43, .32);
}
.brand-name { display: flex; flex-direction: column; line-height: 1.25; }
.brand-name strong { font-size: 19px; letter-spacing: .12em; }
.brand-name span { font-size: 12px; color: rgba(255, 241, 225, .62); letter-spacing: .18em; }

.brand-main { position: relative; max-width: 520px; }
.eyebrow {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .24em;
    color: var(--brand);
    text-transform: uppercase;
}
.login-brand .eyebrow { color: #e9a878; }
.brand-main h1 {
    margin: 16px 0 18px;
    font-family: var(--font-display);
    font-size: clamp(38px, 4.4vw, 56px);
    font-weight: 700;
    line-height: 1.22;
    letter-spacing: .02em;
}
.brand-desc { max-width: 400px; color: rgba(255, 241, 225, .66); font-size: 14px; line-height: 1.8; }

.skewer-art { position: relative; height: 122px; margin-top: 40px; }
.skewer { position: absolute; left: 6px; top: 22px; width: 300px; height: 84px; transform: rotate(-8deg); }
.skewer-stick {
    position: absolute; left: 0; top: 41px; width: 300px; height: 3px; border-radius: 3px;
    background: linear-gradient(90deg, #d9b382, #f3dcc0 70%, #f7e8d5);
    box-shadow: 0 2px 6px rgba(0, 0, 0, .35);
}
.bite { position: absolute; top: 22px; width: 38px; height: 38px; border-radius: 11px; box-shadow: inset 0 -5px 0 rgba(0, 0, 0, .16), 0 6px 12px rgba(0, 0, 0, .25); }
.bite-1 { left: 58px; background: linear-gradient(145deg, #e8894f, #cf5d2c); }
.bite-2 { left: 108px; top: 26px; width: 34px; height: 34px; background: linear-gradient(145deg, #e7c14f, #d3a132); }
.bite-3 { left: 154px; background: linear-gradient(145deg, #8fae6a, #658748); }
.bite-4 { left: 204px; top: 26px; width: 34px; height: 34px; background: linear-gradient(145deg, #c08a5c, #98633c); }

.brand-foot { position: relative; font-size: 11px; letter-spacing: .16em; color: rgba(255, 241, 225, .38); }

.login-panel { display: flex; align-items: center; justify-content: center; padding: 40px; background: var(--bg); }
.login-card {
    width: 100%;
    max-width: 400px;
    padding: 38px 36px 30px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: var(--shadow);
}
.login-card h2 { margin: 10px 0 6px; font-family: var(--font-display); font-size: 30px; letter-spacing: .02em; }
.login-sub { margin-bottom: 26px; color: var(--muted); font-size: 13px; }
.login-card .field { margin-bottom: 18px; }
.login-card .field > span { font-size: 12px; letter-spacing: .04em; transition: color .18s ease; }
.login-card .field:focus-within > span { color: var(--brand-dark); }

.login-input-wrap { position: relative; }
.login-input-icon {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    width: 18px; height: 18px; display: grid; place-items: center;
    color: #a89888; pointer-events: none;
    transition: color .18s ease;
}
.login-input-icon svg { width: 18px; height: 18px; }
/* 使用 .login-card 提升优先级，覆盖后置的通用 .input 规则 */
.login-card .login-input {
    width: 100%;
    height: 48px;
    padding: 0 14px 0 42px;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    background: #fbf7f0;
    color: var(--ink);
    font-size: 14px;
    caret-color: var(--brand);
    box-shadow: inset 0 1px 2px rgba(74, 48, 28, .04);
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.login-card .login-input::placeholder { color: #b4a493; }
.login-card .login-input:hover { border-color: #d3c1ab; background: #fffdf9; }
.login-card .login-input:focus {
    outline: none;
    border-color: var(--brand);
    background: #fffdf9;
    box-shadow: 0 0 0 3px rgba(226, 85, 43, .13), inset 0 1px 2px rgba(74, 48, 28, .02);
}
.login-input-wrap:focus-within .login-input {
    border-color: var(--brand);
    background: #fffdf9;
    box-shadow: 0 0 0 3px rgba(226, 85, 43, .13), inset 0 1px 2px rgba(74, 48, 28, .02);
}
.login-input-wrap:focus-within .login-input-icon { color: var(--brand); }
.login-card .login-input:-webkit-autofill,
.login-card .login-input:-webkit-autofill:hover,
.login-card .login-input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--ink);
    -webkit-box-shadow: 0 0 0 1000px #fffdf9 inset;
    transition: background-color 9999s ease-out;
}

.login-card .btn-block { margin-top: 10px; height: 46px; font-size: 14px; letter-spacing: .02em; }
.form-error {
    margin: 0 0 10px;
    padding: 9px 12px;
    border-radius: 8px;
    background: var(--red-soft);
    color: var(--red);
    font-size: 12.5px;
}
.form-error.hidden { display: none; }

/* ------------------------------ 布局 ------------------------------ */
.app-shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 24px 16px 18px;
    color: #f6ebdd;
    background:
        radial-gradient(circle at 50% 0%, rgba(226, 85, 43, .22), transparent 40%),
        linear-gradient(180deg, #251811, #1a110c);
    border-right: 1px solid rgba(255, 240, 220, .06);
}
.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 26px; }
.sidebar .brand-mark { width: 38px; height: 38px; border-radius: 11px; font-size: 21px; }
.sidebar-brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.sidebar-brand-text strong { font-size: 16px; letter-spacing: .1em; }
.sidebar-brand-text span { font-size: 10px; color: rgba(255, 241, 225, .45); letter-spacing: .22em; }

.side-nav { display: flex; flex-direction: column; gap: 4px; }
.side-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 42px;
    padding: 0 13px;
    border-radius: 11px;
    color: rgba(255, 241, 225, .62);
    font-size: 13.5px;
    font-weight: 500;
    transition: background .16s ease, color .16s ease;
}
.side-nav a:hover { color: #fff3e6; background: rgba(255, 240, 220, .06); }
.side-nav a.active {
    color: #fff;
    background: linear-gradient(135deg, rgba(226, 85, 43, .92), rgba(196, 66, 28, .86));
    box-shadow: 0 8px 18px rgba(0, 0, 0, .22);
}
.nav-icon { display: inline-flex; width: 18px; height: 18px; opacity: .9; }
.nav-icon svg { width: 18px; height: 18px; }

/* 移动端导航折叠开关：桌面端隐藏 */
.side-nav-toggle { display: none; }

.sidebar-foot { margin-top: auto; padding-top: 18px; border-top: 1px solid rgba(255, 240, 220, .1); }
.admin-chip { display: flex; align-items: center; gap: 10px; padding: 4px 6px 12px; }
.admin-avatar {
    width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px;
    background: rgba(255, 240, 220, .12); color: #f7dcc2; font-weight: 700; font-size: 13px;
}
.admin-meta { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.admin-meta strong { font-size: 12.5px; color: #fff2e4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-meta span { font-size: 10px; color: rgba(255, 241, 225, .4); letter-spacing: .08em; }
.logout-btn {
    width: 100%; height: 34px; border: 1px solid rgba(255, 240, 220, .14); border-radius: 9px;
    background: transparent; color: rgba(255, 241, 225, .58); font-size: 12px;
}
.logout-btn:hover { background: rgba(255, 240, 220, .06); color: #fff3e6; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; justify-content: space-between; gap: 20px;
    padding: 22px 32px 18px;
    background: rgba(245, 239, 229, .88);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(220, 205, 185, .55);
}
.topbar h1 { font-family: var(--font-display); font-size: 25px; letter-spacing: .02em; }
.topbar p { margin-top: 2px; color: var(--muted); font-size: 12px; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.topbar-logout { display: none; }
.today-label { color: var(--muted); font-size: 12px; letter-spacing: .04em; }
.page-content { padding: 26px 32px 48px; max-width: 1500px; width: 100%; }

/* ------------------------------ 卡片 / 统计 ------------------------------ */
.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 20px; }
.card-head {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--line);
}
.card-title { font-size: 14.5px; font-weight: 700; letter-spacing: .01em; }
.card-sub { margin-top: 3px; color: var(--muted); font-size: 12px; }
.card-body { padding: 20px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.stat-card {
    position: relative; overflow: hidden;
    padding: 18px 18px 16px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.stat-card::after {
    content: ""; position: absolute; right: -26px; top: -26px; width: 84px; height: 84px;
    border-radius: 50%; background: var(--brand-soft); opacity: .75;
}
.stat-card:nth-child(2)::after { background: var(--gold-soft); }
.stat-card:nth-child(3)::after { background: var(--green-soft); }
.stat-card:nth-child(4)::after { background: var(--blue-soft); }
.stat-card:nth-child(5)::after { background: #f1e9fb; }
.stat-icon {
    position: relative; z-index: 1;
    width: 34px; height: 34px; display: grid; place-items: center;
    margin-bottom: 14px; border-radius: 10px;
    background: var(--panel-2); color: var(--brand);
}
.stat-icon svg { width: 18px; height: 18px; }
.stat-value { position: relative; z-index: 1; font-family: var(--font-display); font-size: 30px; font-weight: 700; line-height: 1.1; }
.stat-label { position: relative; z-index: 1; margin-top: 5px; color: var(--muted); font-size: 12px; }
.stat-foot { position: relative; z-index: 1; margin-top: 12px; font-size: 11.5px; color: var(--ink-soft); }
.stat-foot strong { color: var(--brand); }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(300px, .75fr); gap: 20px; margin-top: 20px; }
.dashboard-grid .card + .card { margin-top: 0; }

.levels-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; }
.levels-grid .card + .card { margin-top: 0; }

/* ------------------------------ 表格 ------------------------------ */
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
    padding: 12px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    color: var(--muted);
    background: var(--panel-2);
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
tbody td { padding: 13px 16px; border-bottom: 1px solid #f1e9dd; font-size: 13px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fffaf3; }
.td-muted { color: var(--muted); font-size: 12px; }
.td-nowrap { white-space: nowrap; }
.td-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.user-cell { display: flex; align-items: center; gap: 10px; min-width: 170px; }
.avatar {
    width: 34px; height: 34px; flex: 0 0 34px; border-radius: 50%;
    position: relative; display: grid; place-items: center; overflow: hidden;
    background: linear-gradient(145deg, #f1d9c4, #e1bfa2);
    color: #7a4a2a; font-weight: 700; font-size: 13px;
}
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.user-name { font-weight: 600; line-height: 1.35; }
.user-sub { color: var(--muted); font-size: 11px; font-family: Consolas, "SFMono-Regular", monospace; }

/* 玩家卡片（桌面端 & 移动端通用） */
.user-card { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: var(--panel); }
.user-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.user-card-head .user-cell { min-width: 0; }
.user-card-head .badge { flex: 0 0 auto; }
.user-card-head .user-sub { word-break: break-all; }
.user-card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 12px; }
.user-card-stat { min-width: 0; padding: 9px 10px; border-radius: 9px; background: var(--panel-2); }
.user-card-stat span { display: block; font-size: 11px; color: var(--muted); }
.user-card-stat strong { display: block; margin-top: 3px; font-size: 14px; line-height: 1.4; word-break: break-all; }
.user-card-stat small { display: block; margin-top: 2px; font-size: 11px; color: var(--muted); }
.user-card-foot {
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
    gap: 10px; margin-top: 12px; padding-top: 11px; border-top: 1px solid var(--line);
}
.user-card-foot .td-muted { font-size: 11px; }
.user-card-foot .btn { margin-left: auto; }

/* 玩家列表移动端卡片列表容器 */
.user-card-list { display: none; }
@media (max-width: 900px) {
    .users-table-wrap { display: none; }
    .users-toolbar { flex-direction: column; align-items: stretch; }
    .users-toolbar .toolbar-left { width: 100%; flex-wrap: wrap; }
    .users-toolbar .search-box { flex: 1 1 100%; }
    .users-toolbar .search-box .input { width: 100%; min-width: 0; }
    .users-toolbar .select { flex: 1 1 calc(50% - 5px); min-width: 0; }
    .users-toolbar .toolbar-right { align-self: flex-start; }
    .user-card-list { display: flex; flex-direction: column; gap: 12px; padding: 14px; }
}

/* ------------------------------ 徽标 ------------------------------ */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    height: 23px; padding: 0 8px; border-radius: 7px;
    font-size: 11px; font-weight: 600; white-space: nowrap;
}
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-orange { background: var(--brand-soft); color: var(--brand-dark); }
.badge-gold { background: var(--gold-soft); color: #9a6c14; }
.badge-blue { background: var(--blue-soft); color: var(--blue); }
.badge-gray { background: #f0ece5; color: #7b6e61; }
.badge-red { background: var(--red-soft); color: var(--red); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ------------------------------ 工具栏 / 标签页 ------------------------------ */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tabs { display: inline-flex; padding: 4px; background: #efe7da; border-radius: 11px; }
.tab {
    height: 32px; padding: 0 14px; border: none; border-radius: 8px;
    background: transparent; color: var(--muted); font-size: 12.5px; font-weight: 600;
}
.tab.active { background: var(--panel); color: var(--ink); box-shadow: var(--shadow-sm); }

.search-box { position: relative; }
.search-box svg { position: absolute; left: 12px; top: 50%; width: 15px; height: 15px; transform: translateY(-50%); color: var(--muted); }
.input, .select {
    height: 38px;
    padding: 0 12px;
    background: var(--panel);
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.search-box .input { padding-left: 34px; min-width: 230px; }
.input:focus, .select:focus, textarea:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(226, 85, 43, .12);
}
.select { min-width: 130px; cursor: pointer; }

/* ------------------------------ 分页 ------------------------------ */
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 15px 20px; border-top: 1px solid var(--line); }
.page-info { color: var(--muted); font-size: 12px; }
.page-btns { display: flex; gap: 6px; }
.page-btn {
    min-width: 32px; height: 32px; padding: 0 9px;
    border: 1px solid var(--line-strong); border-radius: 8px;
    background: var(--panel); color: var(--ink-soft); font-size: 12px;
}
.page-btn:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.page-btn.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ------------------------------ 表单 ------------------------------ */
.field { display: flex; flex-direction: column; gap: 7px; }
.field > span { font-size: 12px; font-weight: 600; color: var(--ink-soft); }
.field small { color: var(--muted); font-size: 11.5px; line-height: 1.6; }
.field .input, .field .select { width: 100%; }
textarea.input { height: auto; min-height: 88px; padding: 10px 12px; resize: vertical; line-height: 1.6; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .span-2 { grid-column: span 2; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.modal-body .form-actions {
    position: sticky;
    bottom: -20px;
    z-index: 2;
    padding: 12px 0 6px;
    background: linear-gradient(180deg, rgba(255, 253, 249, 0), var(--panel) 26%);
}

.switch { position: relative; display: inline-flex; width: 46px; height: 26px; flex: 0 0 46px; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch-track {
    width: 100%; height: 100%; border-radius: 999px; background: #d8ccbc;
    transition: background .18s ease; pointer-events: none;
}
.switch-track::after {
    content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
    border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .18);
    transition: transform .18s ease;
}
.switch input:checked + .switch-track { background: var(--green); }
.switch input:checked + .switch-track::after { transform: translateX(20px); }

/* ------------------------------ 藏品卡片 ------------------------------ */
.collection-grid { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 10px; }
.collection-card {
    overflow: hidden;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 11px;
    box-shadow: var(--shadow-sm);
    transition: transform .18s ease, box-shadow .18s ease;
}
.collection-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.cover { position: relative; aspect-ratio: 1 / 1; background: var(--panel-2); overflow: hidden; }
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover-fallback {
    width: 100%; height: 100%; display: grid; place-items: center;
    font-family: var(--font-display); font-size: 28px; font-weight: 700; color: #fff;
    text-shadow: 0 4px 12px rgba(0, 0, 0, .18);
}
.cover-fallback.market { background: linear-gradient(140deg, #e58a51, #c9592a); }
.cover-fallback.premium { background: linear-gradient(140deg, #a8794f, #6f452b); }
.cover-status { position: absolute; top: 6px; right: 6px; }
.collection-body { padding: 8px 9px 9px; }
.collection-name {
    display: flex; align-items: center; justify-content: center; gap: 4px;
    font-weight: 700; font-size: 12.5px; line-height: 1.2;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.collection-name > span:first-child { overflow: hidden; text-overflow: ellipsis; }
.collection-name .badge { flex: 0 0 auto; font-size: 9px; padding: 0 5px; }
.collection-meta {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    margin-top: 2px; color: var(--muted); font-size: 10px;
}
.collection-id { font-family: Consolas, monospace; }
.collection-actions { display: flex; gap: 4px; margin-top: 7px; padding-top: 6px; border-top: 1px dashed var(--line); }
.collection-actions .btn { flex: 1; height: 26px; padding: 0 4px; font-size: 11px; border-radius: 6px; }

/* ------------------------------ 默认食材 ------------------------------ */
/* 仅作展示：16 个基础食材尽量排在一行，小卡片更紧凑 */
.ingredient-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(50px, 1fr)); gap: 5px; }
.ingredient-card {
    min-width: 0;
    padding: 4px 4px 6px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-2);
    text-align: center;
}
.ingredient-thumb {
    width: 100%; aspect-ratio: 1; display: grid; place-items: center;
    border-radius: 6px; overflow: hidden;
    background: #fff8ed;
    border: 1px solid #f3e8d8;
}
.ingredient-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ingredient-thumb span { font-family: var(--font-display); font-size: 17px; font-weight: 700; color: var(--brand); }
.ingredient-name {
    margin-top: 4px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ------------------------------ 默认食材 ------------------------------ */
.ingredient-check-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.ingredient-check {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--panel-2);
    color: var(--ink-soft);
    font-size: 12px;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.ingredient-check input { margin: 0; accent-color: var(--brand); }
.ingredient-check img { width: 22px; height: 22px; object-fit: contain; }
.ingredient-check.is-selected { border-color: #f0bfae; background: var(--brand-soft); color: var(--brand-dark); }
.ingredient-check:has(input:disabled) { opacity: .5; cursor: not-allowed; }

/* ------------------------------ 弹窗 ------------------------------ */
.modal-overlay {
    position: fixed; inset: 0; z-index: 100;
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
    background: rgba(38, 25, 16, .48);
    backdrop-filter: blur(3px);
    animation: fadeIn .16s ease;
}
.modal {
    width: 100%; max-width: 560px; max-height: calc(100vh - 48px);
    display: flex; flex-direction: column;
    background: var(--panel);
    border-radius: 18px;
    box-shadow: 0 26px 60px rgba(30, 18, 10, .3);
    animation: modalIn .2s ease;
    overflow: hidden;
}
.modal-lg { max-width: 760px; }
.modal-sm { max-width: 420px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 20px 22px 14px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-family: var(--font-display); font-size: 20px; }
.modal-head p { margin-top: 3px; color: var(--muted); font-size: 12px; }
.modal-close {
    width: 30px; height: 30px; flex: 0 0 30px; display: grid; place-items: center;
    border: none; border-radius: 8px; background: var(--panel-2); color: var(--muted); font-size: 18px; line-height: 1;
}
.modal-close:hover { background: var(--brand-soft); color: var(--brand); }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 15px 22px 20px; border-top: 1px solid var(--line); }

/* ------------------------------ 用户详情 ------------------------------ */
.detail-head { display: flex; align-items: center; gap: 14px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.detail-head .avatar { width: 52px; height: 52px; flex: 0 0 52px; font-size: 18px; }
.detail-name { font-family: var(--font-display); font-size: 21px; font-weight: 700; }
.detail-openid { margin-top: 2px; color: var(--muted); font-size: 11px; font-family: Consolas, monospace; }
.kv-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 18px; }
.kv { padding: 11px 13px; background: var(--panel-2); border-radius: 10px; }
.kv dt { color: var(--muted); font-size: 11px; }
.kv dd { margin: 3px 0 0; font-size: 15px; font-weight: 700; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 20px 0 10px; font-size: 12px; font-weight: 700; color: var(--ink-soft); letter-spacing: .04em; }
.chip-list { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 5px 9px; border-radius: 8px;
    background: var(--panel-2); border: 1px solid var(--line);
    font-size: 12px;
}
.chip .dot { background: var(--brand); }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form .input { width: 130px; }
.inline-form .select { flex: 1; min-width: 160px; }
.divider { height: 1px; background: var(--line); margin: 18px 0; }

/* 串品皮肤映射 */
.skin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.skin-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--panel-2);
}
.skin-base,
.skin-target { display: flex; align-items: center; gap: 7px; min-width: 0; font-size: 12.5px; }
.skin-base { font-weight: 600; color: var(--ink-soft); }
.skin-base img { width: 26px; height: 26px; flex: 0 0 26px; object-fit: contain; }
.skin-target { font-weight: 600; color: var(--brand-dark); }
.skin-target img { width: 24px; height: 24px; flex: 0 0 24px; object-fit: cover; border-radius: 5px; }
.skin-base span,
.skin-target span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.skin-arrow { flex: 0 0 auto; color: var(--muted); font-size: 12px; }
.skin-target.is-default { color: var(--muted); font-weight: 400; }

/* ------------------------------ 棋盘预览 ------------------------------ */
.board-info { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.board-wrap { padding: 18px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 14px; }
.board { display: grid; grid-template-columns: repeat(var(--size, 8), 1fr); gap: 5px; max-width: 560px; margin: 0 auto; }
.board-cell {
    position: relative; aspect-ratio: 1; border-radius: 8px;
    background: #ece1d2; border: 1px solid #e1d3c0;
    display: grid; place-items: center;
}
.board-tile {
    position: relative;
    overflow: hidden;
    width: 78%; height: 78%; border-radius: 7px;
    box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .14), 0 2px 4px rgba(0, 0, 0, .1);
}
.board-tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.board-depth {
    position: absolute; right: 3px; bottom: 2px;
    padding: 0 4px; border-radius: 4px;
    background: rgba(43, 33, 27, .62); color: #fff;
    font-size: 9px; line-height: 14px;
}
.legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px; justify-content: center; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11.5px; }
.legend-dot {
    position: relative; overflow: hidden;
    width: 18px; height: 18px; border-radius: 5px;
    box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .14);
}
.legend-dot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.solution-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.solution-step { padding: 4px 8px; border-radius: 6px; background: var(--panel-2); color: var(--ink-soft); font-size: 11px; }

/* ------------------------------ 概览页 ------------------------------ */
.province-list { display: flex; flex-direction: column; gap: 13px; }
.province-row { display: grid; grid-template-columns: 46px minmax(0, 1fr) 52px; align-items: center; gap: 10px; }
.province-name { font-size: 12.5px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.province-track { height: 8px; border-radius: 999px; background: #f0e7da; overflow: hidden; }
.province-fill { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #f0a071, var(--brand)); }
.province-value { text-align: right; font-size: 12px; font-weight: 700; color: var(--ink-soft); }
.status-list { display: flex; flex-direction: column; gap: 2px; }
.status-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.status-row:last-child { border-bottom: none; }
.status-label { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.status-label svg { width: 16px; height: 16px; color: var(--muted); }
.status-hint { color: var(--muted); font-size: 11.5px; margin-top: 3px; }
.quick-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }

/* ------------------------------ 配置页 ------------------------------ */
.config-group + .config-group { margin-top: 20px; }
.config-item { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding: 16px 0; border-bottom: 1px dashed var(--line); }
.config-item:last-child { border-bottom: none; padding-bottom: 2px; }
.config-label { font-size: 13px; font-weight: 600; }
.config-help { margin-top: 3px; color: var(--muted); font-size: 11.5px; max-width: 520px; line-height: 1.65; }
.config-control { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; }
.config-control .input, .config-control .select { width: 190px; }
.config-unit { color: var(--muted); font-size: 12px; }

/* 分享文案与分享图片 */
.config-control .config-textarea {
    width: 420px;
    min-height: 104px;
    padding: 10px 12px;
    line-height: 1.7;
    resize: vertical;
    font-family: inherit;
}
.share-image-picker { display: flex; flex-direction: column; gap: 8px; width: 420px; max-width: 100%; }
.share-image-thumbs {
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 10px;
    min-height: 96px;
    padding: 10px;
    border: 1px dashed var(--line);
    border-radius: 12px;
    background: var(--panel-2);
}
.share-image-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 76px;
    color: var(--muted);
    font-size: 12px;
}
.share-image-thumb {
    position: relative;
    width: 120px;
    height: 96px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--line);
    background: var(--panel-2);
}
.share-image-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.share-image-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(30, 16, 8, 0.66);
    color: #fff;
    font-size: 13px;
    line-height: 20px;
    cursor: pointer;
}
.share-image-tools { display: flex; align-items: center; gap: 8px; }
.ad-banner {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 16px 18px; margin-bottom: 20px;
    border-radius: 14px;
    background: linear-gradient(135deg, #2b1b12, #4a2a1a);
    color: #ffeeda;
}
.ad-banner strong { font-size: 14px; }
.ad-banner p { margin-top: 3px; color: rgba(255, 238, 218, .6); font-size: 11.5px; }

/* ------------------------------ 排行榜 ------------------------------ */
.rank-badge {
    width: 26px; height: 26px; display: grid; place-items: center;
    border-radius: 8px; background: var(--panel-2); color: var(--muted);
    font-size: 12px; font-weight: 700;
}
.rank-1 { background: linear-gradient(145deg, #f3cf6f, #d9a441); color: #5a3c06; }
.rank-2 { background: linear-gradient(145deg, #dfe3e8, #b7bfc8); color: #4d5661; }
.rank-3 { background: linear-gradient(145deg, #e8b993, #cd8b57); color: #5a3416; }
.rank-value { font-size: 16px; font-weight: 700; font-family: var(--font-display); }
.rank-bar-wrap { display: flex; align-items: center; gap: 10px; min-width: 180px; }
.rank-bar { height: 7px; flex: 1; border-radius: 999px; background: #f0e7da; overflow: hidden; }
.rank-bar span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #f0a071, var(--brand)); }

/* ------------------------------ 空状态 / 加载 ------------------------------ */
.empty { padding: 54px 20px; text-align: center; }
.empty-icon { width: 54px; height: 54px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 16px; background: var(--panel-2); color: var(--muted); }
.empty-icon svg { width: 26px; height: 26px; }
.empty-title { font-size: 14px; font-weight: 700; }
.empty-desc { margin-top: 4px; color: var(--muted); font-size: 12px; }
.empty .btn { margin-top: 14px; }

.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 70px 20px; color: var(--muted); font-size: 13px; }
.spinner {
    width: 18px; height: 18px; border-radius: 50%;
    border: 2px solid #e4d6c5; border-top-color: var(--brand);
    animation: spin .7s linear infinite;
}
.error-panel { padding: 40px 20px; text-align: center; }
.error-panel p { color: var(--muted); font-size: 13px; margin-bottom: 14px; }

/* ------------------------------ 提示 ------------------------------ */
.toast-root { position: fixed; top: 22px; right: 22px; z-index: 200; display: flex; flex-direction: column; gap: 9px; }
.toast {
    display: flex; align-items: center; gap: 9px;
    min-width: 220px; max-width: 380px;
    padding: 11px 15px;
    border-radius: 11px;
    background: #2b211b; color: #fff5e8;
    box-shadow: 0 12px 30px rgba(30, 18, 10, .26);
    font-size: 12.5px;
    animation: toastIn .2s ease;
}
.toast.success .toast-mark { background: var(--green); }
.toast.error .toast-mark { background: var(--red); }
.toast-mark {
    width: 18px; height: 18px; flex: 0 0 18px; display: grid; place-items: center;
    border-radius: 50%; background: var(--brand); color: #fff; font-size: 11px; font-weight: 700;
}

/* ------------------------------ 上传 ------------------------------ */
.upload-box { display: flex; align-items: center; gap: 14px; }
.upload-preview {
    width: 96px; height: 96px; flex: 0 0 96px;
    border: 1px dashed var(--line-strong); border-radius: 10px;
    background: var(--panel-2); display: grid; place-items: center; overflow: hidden;
    color: var(--muted); font-size: 11px;
}
.upload-preview img { width: 100%; height: 100%; object-fit: cover; }
.upload-actions { display: flex; flex-direction: column; gap: 7px; }
.file-input { display: none; }

/* ------------------------------ 动画 ------------------------------ */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }

/* ------------------------------ 响应式 ------------------------------ */
@media (max-width: 1180px) {
    :root { --sidebar-w: 76px; }
    .sidebar { padding: 20px 10px 16px; align-items: center; }
    .sidebar-brand { padding: 0 0 22px; }
    .sidebar-brand-text, .side-nav a span:not(.nav-icon), .admin-meta, .logout-btn { display: none; }
    .side-nav a { justify-content: center; padding: 0; width: 46px; height: 44px; }
    .sidebar-foot { width: 100%; }
    .admin-chip { justify-content: center; padding: 0 0 4px; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .topbar-logout { display: inline-flex; }
}

@media (max-width: 900px) {
    .login-view { grid-template-columns: 1fr; }
    .login-brand { display: none; }
    .login-panel { min-height: 100vh; padding: 24px; background: linear-gradient(160deg, #2a1b13, #1a110c); }
    .login-card { border: none; }
    .topbar { padding: 18px 20px 14px; }
    .page-content { padding: 20px 20px 40px; }
    .form-grid { grid-template-columns: 1fr; }
    .form-grid .span-2 { grid-column: auto; }
    .kv-grid { grid-template-columns: 1fr 1fr; }
    .config-item { flex-direction: column; gap: 10px; }
    .config-control .input, .config-control .select { width: 100%; min-width: 200px; }
    .collection-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed; z-index: 60; left: 0; right: 0; bottom: 0; top: auto;
        height: auto; flex-direction: column; align-items: stretch;
        padding: 8px 10px calc(10px + env(safe-area-inset-bottom));
        border-right: none; border-top: 1px solid rgba(255, 240, 220, .1);
    }
    .sidebar-brand, .sidebar-foot { display: none; }

    .side-nav-toggle {
        display: flex; align-items: center; justify-content: center; gap: 8px;
        width: 100%; height: 42px; padding: 0;
        border: 1px solid rgba(255, 240, 220, .12); border-radius: 11px;
        background: rgba(255, 240, 220, .06); color: #fff3e6;
        font-size: 13.5px; font-weight: 600; letter-spacing: .06em;
    }
    .side-nav-toggle:active { background: rgba(255, 240, 220, .12); }

    .side-nav {
        display: none; flex-direction: column; gap: 4px;
        max-height: 58vh; overflow-y: auto;
        padding: 8px 2px 10px; margin-bottom: 8px;
        border-bottom: 1px dashed rgba(255, 240, 220, .12);
    }
    .sidebar.nav-open .side-nav { display: flex; }
    .side-nav a {
        width: 100%; height: 42px; justify-content: flex-start; padding: 0 14px;
    }
    .side-nav a span:not(.nav-icon) { display: inline; }

    .main { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
    .page-content { padding: 16px 14px 30px; }
    .topbar { padding: 14px 14px 12px; }
    .topbar h1 { font-size: 21px; }
    .today-label { display: none; }
    .kv-grid { grid-template-columns: 1fr; }
    .skin-grid { grid-template-columns: 1fr; }
    .collection-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .table-wrap { min-height: 0; }
    .pagination { flex-wrap: wrap; }
    .page-btns { flex-wrap: wrap; }
}

/* 隐藏 ThinkPHP 调试浮标，保持后台界面干净 */
#think_page_trace,
#think_page_trace_open {
    display: none !important;
}
