/* 六合彩吃码 — 清爽现代 UI */
:root {
    --bg: #f0f4f8;
    --bg-subtle: #e8eef4;
    --surface: #ffffff;
    --surface-hover: #f8fafc;
    --input-bg: #f8fafc;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;
    --text: #0f172a;
    --text-secondary: #64748b;
    --text-tertiary: #94a3b8;
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-soft: #eef2ff;
    --primary-ring: rgba(79, 70, 229, 0.25);
    --success: #059669;
    --success-soft: #ecfdf5;
    --success-border: #a7f3d0;
    --danger: #dc2626;
    --danger-soft: #fef2f2;
    --danger-border: #fecaca;
    --warn: #d97706;
    --warn-soft: #fffbeb;
    --warn-border: #fde68a;
    --accent-hk: #0ea5e9;
    --accent-macau-old: #8b5cf6;
    --accent-macau-new: #4f46e5;
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-full: 999px;
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.1);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-top: env(safe-area-inset-top, 0px);
    --touch-min: 44px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    --font-mono: "SF Mono", Consolas, "Courier New", monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    color-scheme: light;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    padding-bottom: var(--safe-bottom);
}

/* —— 页面过渡（彩种切换） —— */
.page-main {
    padding-bottom: calc(28px + var(--safe-bottom));
    transition: opacity 0.3s ease, transform 0.3s ease;
}

body.region-switching .page-main {
    opacity: 0;
    transform: translateY(8px);
}

.page-main.region-enter {
    animation: regionPageIn 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.region-hint.region-hint--pulse {
    animation: regionHintPulse 0.4s ease;
}

@keyframes regionPageIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes regionHintPulse {
    0% { opacity: 0.5; }
    100% { opacity: 1; }
}

.container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 16px;
}

a {
    color: var(--primary);
}

/* —— 顶栏 —— */
.top-bar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: calc(10px + var(--safe-top)) 0 12px;
    position: sticky;
    top: 0;
    z-index: 200;
    box-shadow: var(--shadow-xs);
}

.top-bar__inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.top-bar__brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.top-bar__brand::before {
    content: "";
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.top-bar__text {
    min-width: 0;
}

.top-bar__tag {
    display: block;
    font-size: 0.72rem;
    color: var(--text-tertiary);
    font-weight: 500;
    letter-spacing: 0.02em;
}

.top-bar h1 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    font-size: 0.85rem;
}

.user-nav__name {
    color: var(--text-secondary);
    font-weight: 500;
    padding: 0 6px;
    max-width: 96px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-nav a {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    background: var(--input-bg);
    border: 1px solid transparent;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.user-nav a:hover {
    background: var(--primary-soft);
    color: var(--primary);
    border-color: #c7d2fe;
}

.user-nav__out:hover {
    background: var(--danger-soft);
    color: var(--danger);
    border-color: var(--danger-border);
}

/* —— 彩种切换 —— */
.sticky-region-bar {
    position: sticky;
    top: calc(62px + var(--safe-top));
    z-index: 150;
    padding: 14px 0 10px;
    margin: 0 -16px 4px;
    padding-left: 16px;
    padding-right: 16px;
    background: linear-gradient(var(--bg) 75%, rgba(240, 244, 248, 0.92));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.sticky-region-bar.is-stuck {
    box-shadow: var(--shadow-sm);
}

.region-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    padding: 4px;
    margin-bottom: 10px;
    position: relative;
    background: var(--bg-subtle);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.region-tabs__indicator {
    position: absolute;
    top: 4px;
    left: 4px;
    height: calc(100% - 8px);
    width: 0;
    border-radius: calc(var(--radius-md) - 4px);
    background: var(--primary);
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
    pointer-events: none;
    z-index: 0;
    opacity: 0;
    will-change: transform, width, background, box-shadow;
}

.region-tabs.is-ready .region-tabs__indicator {
    opacity: 1;
    transition:
        transform 0.36s cubic-bezier(0.34, 1.15, 0.64, 1),
        width 0.36s cubic-bezier(0.34, 1.15, 0.64, 1),
        background 0.32s ease,
        box-shadow 0.32s ease,
        opacity 0.15s ease;
}

/* 三盘各自主题色 */
.region-tabs--macau_old .region-tabs__indicator {
    background: linear-gradient(135deg, #7c3aed 0%, #8b5cf6 100%);
    box-shadow: 0 4px 14px rgba(139, 92, 246, 0.45);
}

.region-tabs--macau_new .region-tabs__indicator {
    background: linear-gradient(135deg, #4338ca 0%, #4f46e5 100%);
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.45);
}

.region-tabs--hk .region-tabs__indicator {
    background: linear-gradient(135deg, #0284c7 0%, #0ea5e9 100%);
    box-shadow: 0 4px 14px rgba(14, 165, 233, 0.45);
}

.region-tab {
    position: relative;
    z-index: 1;
    min-width: 0;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 11px 8px;
    border-radius: calc(var(--radius-md) - 4px);
    color: var(--text-secondary);
    background: transparent;
    border: none;
    box-shadow: none;
    transition: color 0.28s ease;
}

.region-tab::before {
    display: none;
}

.region-tab.active {
    color: #fff;
    background: transparent;
}

.region-tabs--macau_old .region-tab.active {
    color: #fff;
}

.region-tabs--macau_new .region-tab.active {
    color: #fff;
}

.region-tabs--hk .region-tab.active {
    color: #fff;
}

.region-hint {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-tertiary);
    text-align: center;
}

.region-hint b {
    color: var(--text);
    font-weight: 600;
}

/* —— 卡片 —— */
.card {
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 20px 22px;
    margin-bottom: 14px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.card h2 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
    padding-bottom: 0;
    border: none;
    display: block;
}

.card h2::before,
.card h2::after {
    display: none;
}

.card h2 + .hint {
    margin-top: 0;
}

.hint {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 14px;
    line-height: 1.55;
}

/* —— 提示框 —— */
.tips-box {
    background: var(--primary-soft);
    border: 1px solid #c7d2fe;
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    margin-bottom: 14px;
    font-size: 0.88rem;
    line-height: 1.65;
}

.tips-box strong {
    color: var(--primary);
    display: block;
    margin-bottom: 6px;
    font-size: 0.92rem;
}

.tips-box ul {
    margin: 0 0 8px 18px;
    color: var(--text-secondary);
}

.tips-box li {
    margin-bottom: 4px;
}

.tips-box code {
    background: var(--surface);
    color: var(--primary-hover);
    padding: 2px 7px;
    border-radius: 6px;
    font-size: 0.85em;
    border: 1px solid #c7d2fe;
    font-family: var(--font-mono);
}

.tips-examples {
    margin: 6px 0 0;
    font-size: 0.82rem;
}

.tips-examples code {
    margin-right: 6px;
    margin-top: 4px;
    display: inline-block;
}

.tips-ok {
    color: var(--success);
    font-weight: 600;
}

.tips-bad {
    color: var(--danger);
    font-weight: 600;
}

.alert-list {
    margin: 8px 0 0 18px;
}

.alert-list li {
    margin-bottom: 4px;
}

/* —— 表单 —— */
textarea,
input[type="text"],
input[type="password"],
input[type="number"],
select {
    color: var(--text);
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

textarea {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    font-family: var(--font-mono);
    resize: vertical;
    line-height: 1.55;
    transition: border-color 0.15s, box-shadow 0.15s;
}

@media (min-width: 769px) {
    textarea { font-size: 14px; }
}

textarea:focus,
input:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-ring);
    background: var(--surface);
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-top: 14px;
}

.form-row label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-row input[type="number"] {
    width: 88px;
    padding: 10px 12px;
}

.input-label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
    margin: 16px 0 8px;
}

.input-label:first-of-type {
    margin-top: 0;
}

/* —— 按钮 —— */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--touch-min);
    padding: 10px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    font-family: var(--font);
    transition: background 0.15s, border-color 0.15s, transform 0.1s, box-shadow 0.15s;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    box-shadow: var(--shadow-xs);
}

.btn:active {
    transform: scale(0.98);
}

.btn:hover {
    background: var(--surface-hover);
    border-color: var(--border-strong);
}

.btn-lg {
    min-height: 48px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
}

.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25);
}

.btn-danger:hover {
    background: #b91c1c;
    border-color: #b91c1c;
}

.btn-sm {
    min-height: 36px;
    padding: 6px 12px;
    font-size: 13px;
}

.btn-block {
    width: 100%;
}

.btn-preset {
    min-width: 48px;
    font-weight: 600;
}

.btn-preset.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.btn-edit {
    color: var(--primary);
    border-color: #c7d2fe;
    background: var(--primary-soft);
}

.btn-edit:hover {
    background: #e0e7ff;
}

.form-row--actions {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
    gap: 10px;
    align-items: stretch;
}

.form-row--actions .btn {
    width: 100%;
    min-height: 48px;
}

/* —— 提示条 —— */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    font-size: 0.9rem;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.alert::before {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    content: "";
}

.alert-success {
    background: var(--success-soft);
    color: #047857;
    border: 1px solid var(--success-border);
}

.alert-success::before {
    background: var(--success);
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z'/%3E%3C/svg%3E") center/14px no-repeat;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z'/%3E%3C/svg%3E") center/14px no-repeat;
}

.alert-error {
    background: var(--danger-soft);
    color: #b91c1c;
    border: 1px solid var(--danger-border);
}

.alert-warn {
    background: var(--warn-soft);
    color: #b45309;
    border: 1px solid var(--warn-border);
}

/* —— 统计 —— */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.stat-item {
    background: linear-gradient(180deg, var(--surface) 0%, var(--input-bg) 100%);
    padding: 16px 14px;
    border-radius: var(--radius-sm);
    text-align: center;
    border: 1px solid var(--border);
}

.stat-label {
    display: block;
    font-size: 0.78rem;
    color: var(--text-tertiary);
    margin-bottom: 6px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.stat-value {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.stat-profit .stat-value {
    color: var(--success);
}

.stat-loss .stat-value {
    color: var(--danger);
}

/* —— 表格 —— */
.table-wrap {
    overflow-x: auto;
    max-height: 460px;
    overflow-y: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    -webkit-overflow-scrolling: touch;
    background: var(--surface);
}

.table-wrap::after {
    content: "← 左右滑动查看更多 →";
    display: none;
    text-align: center;
    font-size: 0.72rem;
    color: var(--text-tertiary);
    padding: 8px;
    background: var(--input-bg);
    border-top: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

th, td {
    padding: 10px 12px;
    text-align: center;
    border-bottom: 1px solid var(--border);
}

th {
    background: var(--input-bg);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.8rem;
    position: sticky;
    top: 0;
    z-index: 1;
}

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

tr:hover td {
    background: var(--surface-hover);
}

.profit-positive {
    color: var(--success);
    font-weight: 600;
}

.profit-negative {
    color: var(--danger);
    font-weight: 600;
}

#resultTable tr.row-safe {
    background: var(--success-soft);
}

#resultTable tr.row-danger {
    background: var(--danger-soft);
}

.status-safe {
    color: var(--success);
    font-weight: 600;
}

.status-danger {
    color: var(--danger);
    font-weight: 600;
}

#resultTable .col-eat {
    width: 48px;
}

#resultTable .eat-check {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
    cursor: pointer;
}

#eatCheckAll {
    cursor: pointer;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    cursor: pointer;
}

/* —— 倍率 —— */
.odds-card {
    border-top: 3px solid var(--primary);
}

.odds-setting {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.odds-input-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.odds-input-group label {
    font-weight: 600;
    color: var(--text);
}

.odds-prefix {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.odds-input-group input[type="number"] {
    width: 100px;
    padding: 10px 14px;
    font-size: 1.15rem;
    font-weight: 700;
    text-align: center;
    border-color: var(--primary);
    background: var(--surface);
}

.odds-presets {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.presets-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* —— 导出 / 工具栏 —— */
.eat-export-toolbar {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 14px;
}

.eat-export-toolbar .btn {
    width: 100%;
}

@media (min-width: 640px) {
    .eat-export-toolbar {
        display: flex;
        flex-wrap: wrap;
    }
    .eat-export-toolbar .btn {
        width: auto;
    }
}

.export-report-box {
    margin-bottom: 14px;
    padding: 14px;
    background: var(--warn-soft);
    border: 1px solid var(--warn-border);
    border-radius: var(--radius-sm);
}

.export-report-box label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #92400e;
}

.export-report-box textarea {
    background: var(--surface);
}

/* —— 生肖参考 —— */
.zodiac-ref {
    margin: 12px 0 16px;
    padding: 12px 14px;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
}

.zodiac-ref summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--primary);
}

.zodiac-ref-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
    margin-top: 10px;
}

.zodiac-ref-item {
    display: flex;
    gap: 8px;
    padding: 8px 10px;
    background: var(--surface);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.zodiac-ref-name {
    font-weight: 700;
    color: #be123c;
    min-width: 1.5em;
}

.zodiac-ref-nums {
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.zodiac-admin-table .zodiac-admin-name {
    font-size: 1.1rem;
    color: #be123c;
}

.zodiac-admin-input {
    width: 100%;
    max-width: 420px;
    padding: 10px 12px;
    font-family: var(--font-mono);
}

/* —— 推荐面板 —— */
.summary-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
    padding: 4px;
    background: var(--input-bg);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.summary-tabs .btn {
    flex: 1;
    min-width: 120px;
    border: none;
    box-shadow: none;
    background: transparent;
}

.summary-tabs .btn.active {
    background: var(--surface);
    color: var(--primary);
    box-shadow: var(--shadow-xs);
    font-weight: 600;
}

.recommend-panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.recommend-panel {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    background: var(--input-bg);
}

.recommend-panel h3 {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 10px;
}

.recommend-panel h3 small {
    font-weight: 400;
    color: var(--text-tertiary);
    font-size: 0.75rem;
}

.recommend-good {
    border-top: 3px solid var(--success);
}

.recommend-bad {
    border-top: 3px solid var(--danger);
}

.recommend-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 220px;
    overflow-y: auto;
}

.rec-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--surface);
    border-radius: 8px;
    border: 1px solid var(--border);
    font-size: 0.88rem;
}

.rec-item.rec-top {
    border-color: var(--success-border);
    background: var(--success-soft);
}

.rec-item.rec-warn-top {
    border-color: var(--danger-border);
    background: var(--danger-soft);
}

.rec-rank {
    min-width: 24px;
    height: 24px;
    line-height: 24px;
    text-align: center;
    background: var(--text-tertiary);
    color: #fff;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
}

.rec-top .rec-rank {
    background: var(--success);
}

.rec-warn-top .rec-rank {
    background: var(--danger);
}

.rec-num {
    font-weight: 700;
    color: var(--primary);
}

.rec-stake {
    color: var(--text-secondary);
}

.rec-profit {
    font-weight: 600;
    margin-left: auto;
}

.rec-top .rec-profit {
    color: var(--success);
}

.rec-warn-top .rec-profit {
    color: var(--danger);
}

/* —— 历史记录 —— */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-empty {
    color: var(--text-tertiary);
    font-size: 0.9rem;
    padding: 20px;
    text-align: center;
}

.history-day {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--surface);
    box-shadow: var(--shadow-xs);
}

.history-day-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: var(--input-bg);
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}

.history-day-header:hover {
    background: var(--primary-soft);
}

.history-day-arrow {
    width: 16px;
    font-size: 0.7rem;
    color: var(--text-tertiary);
}

.history-day-title {
    font-weight: 600;
    flex: 1;
    color: var(--text);
}

.history-day-meta {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.history-section-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}

.history-section-head h2 {
    margin-bottom: 0;
}

.history-section-count {
    font-weight: normal;
    color: var(--text-tertiary);
    font-size: 0.85em;
}

.history-day-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.history-day-link {
    font-size: 0.8rem;
    color: var(--primary);
    font-weight: 500;
    text-decoration: none;
    padding: 6px 10px;
    border-radius: 6px;
    background: var(--primary-soft);
}

.history-day-link:hover {
    text-decoration: none;
    background: #e0e7ff;
}

.history-day-del {
    min-height: 32px;
    padding: 4px 10px;
    font-size: 12px;
}

.history-day-body {
    border-top: 1px solid var(--border);
}

.history-item {
    padding: 12px 130px 12px 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    position: relative;
    transition: background 0.12s;
}

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

.history-item:hover {
    background: var(--surface-hover);
}

.history-item.active {
    background: var(--primary-soft);
    border-left: 3px solid var(--primary);
    padding-left: 13px;
}

.history-item-main {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 4px;
}

.history-item-time {
    font-weight: 600;
    color: var(--primary);
    font-size: 0.9rem;
}

.history-item-stake {
    font-weight: 600;
}

.history-item-odds {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.history-item-preview {
    font-size: 0.78rem;
    color: var(--text-tertiary);
    font-family: var(--font-mono);
    word-break: break-all;
}

.history-item-actions {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 6px;
}

/* —— 弹窗 —— */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(6px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal-box {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 24px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

.modal-box h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.modal-box label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin: 14px 0 6px;
    color: var(--text-secondary);
}

.modal-box textarea,
.modal-box input[type="number"] {
    width: 100%;
    padding: 12px;
    font-size: 14px;
}

.modal-box textarea {
    font-family: var(--font-mono);
}

/* —— Toast —— */
.toast {
    position: fixed;
    bottom: calc(24px + var(--safe-bottom));
    left: 50%;
    transform: translateX(-50%) translateY(16px);
    background: var(--text);
    color: #fff;
    padding: 12px 20px;
    border-radius: var(--radius-full);
    font-size: 0.9rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s, transform 0.25s;
    z-index: 9999;
    max-width: calc(100vw - 32px);
    box-shadow: var(--shadow-md);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* —— 登录 —— */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 24px 16px;
    padding-top: calc(24px + var(--safe-top));
    padding-bottom: calc(24px + var(--safe-bottom));
    background: linear-gradient(160deg, #eef2ff 0%, var(--bg) 50%, #f0fdf4 100%);
}

.login-box {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 36px 32px;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}

.login-box::before {
    content: "";
    display: block;
    width: 56px;
    height: 56px;
    margin: 0 auto 20px;
    border-radius: 16px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.35);
}

.login-box__tag {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-bottom: 4px;
}

.login-box h1 {
    text-align: center;
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 28px;
}

.login-box label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.login-box input {
    width: 100%;
    padding: 14px;
    margin-bottom: 16px;
    font-size: 16px;
}

.login-box .btn-primary {
    margin-top: 8px;
}

.inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.inline-form input,
.inline-form select {
    padding: 10px 12px;
    font-size: 14px;
}

/* —— H5 —— */
@media (max-width: 768px) {
    .recommend-panels {
        grid-template-columns: 1fr;
    }

    .top-bar__inner {
        flex-wrap: wrap;
    }

    .top-bar h1 {
        white-space: normal;
        font-size: 1.05rem;
    }

    .user-nav {
        width: 100%;
        justify-content: flex-start;
    }

    .user-nav__name {
        max-width: none;
        flex: 1;
    }

    .card {
        padding: 16px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .table-wrap::after {
        display: block;
    }

    #resultTable {
        min-width: 500px;
        font-size: 0.82rem;
    }

    .history-item {
        padding: 12px 12px 52px;
    }

    .history-item.active {
        padding-left: 9px;
    }

    .history-item-actions {
        left: 12px;
        right: 12px;
        top: auto;
        bottom: 10px;
        transform: none;
        justify-content: flex-end;
    }

    .history-day-header {
        flex-wrap: wrap;
    }

    .history-day-meta {
        width: 100%;
    }

    .zodiac-ref-grid {
        grid-template-columns: 1fr;
    }

    .modal-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .modal-box {
        max-width: none;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        max-height: 92vh;
        padding-bottom: calc(24px + var(--safe-bottom));
    }

    .summary-tabs {
        flex-direction: column;
    }

    .summary-tabs .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 12px;
    }

    .sticky-region-bar {
        margin-left: -12px;
        margin-right: -12px;
        padding-left: 12px;
        padding-right: 12px;
    }

    .region-tab {
        font-size: 0.82rem;
        padding: 10px 4px;
    }

    .eat-export-toolbar {
        grid-template-columns: 1fr;
    }

    .inline-form {
        flex-direction: column;
        align-items: stretch;
    }

    .inline-form .btn,
    .inline-form input,
    .inline-form select {
        width: 100%;
    }
}

@media (max-width: 600px) {
    .form-row:not(.form-row--actions) {
        flex-direction: column;
        align-items: stretch;
    }

    .form-row:not(.form-row--actions) .btn {
        width: 100%;
    }
}

/* —— 后台用户管理 —— */
.admin-main {
    padding-bottom: 32px;
}

.admin-toolbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 14px;
}

.admin-panel h2 {
    margin-bottom: 14px;
}

.admin-panel__hint {
    margin: -6px 0 12px;
}

.admin-panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.admin-panel__head h2 {
    margin-bottom: 0;
}

.admin-panel__meta {
    font-size: 0.85rem;
    color: var(--text-tertiary);
    white-space: nowrap;
}

.admin-form-grid {
    display: grid;
    gap: 12px 14px;
    align-items: end;
}

.admin-form-grid--add,
.admin-form-grid--pwd {
    grid-template-columns: 1fr 1fr;
}

.admin-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.admin-field label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.admin-field__label-hidden {
    visibility: hidden;
    height: 0;
    margin: 0;
    overflow: hidden;
}

.admin-field input,
.admin-field select {
    width: 100%;
    padding: 10px 12px;
    font-size: 15px;
}

.admin-field--action .btn {
    min-height: 44px;
}

.admin-table-wrap {
    max-height: none;
    border: none;
    margin: 0;
}

.admin-users-table {
    font-size: 0.9rem;
}

.admin-users-table .col-id {
    width: 56px;
    color: var(--text-tertiary);
}

.admin-users-table .col-name {
    text-align: left;
    min-width: 120px;
}

.admin-users-table .col-name strong {
    font-weight: 600;
}

.admin-users-table .col-role {
    width: 100px;
}

.admin-users-table .col-time {
    width: 168px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.admin-users-table .col-actions {
    width: 148px;
}

.admin-users-table td.col-name,
.admin-users-table td.col-time {
    text-align: left;
}

.admin-users-table td.col-actions {
    text-align: right;
}

.role-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.3;
    white-space: nowrap;
}

.role-admin {
    background: var(--primary-soft);
    color: var(--primary);
}

.role-user {
    background: var(--input-bg);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.role-self {
    background: var(--success-soft);
    color: var(--success);
    margin-left: 6px;
    vertical-align: middle;
}

.admin-user-actions {
    display: inline-flex;
    flex-wrap: nowrap;
    gap: 6px;
    align-items: center;
    justify-content: flex-end;
}

.admin-user-actions .btn-sm {
    min-height: 34px;
    padding: 5px 12px;
    white-space: nowrap;
}

.admin-inline-del {
    display: inline-flex;
    margin: 0;
}

@media (min-width: 900px) {
    .admin-form-grid--add,
    .admin-form-grid--pwd {
        grid-template-columns: 1fr 1fr 1fr auto;
    }

    .admin-field--action {
        min-width: 108px;
    }
}

@media (max-width: 768px) {
    .admin-toolbar {
        grid-template-columns: 1fr;
    }

    .admin-form-grid--add,
    .admin-form-grid--pwd {
        grid-template-columns: 1fr;
    }

    .admin-users-table .col-time {
        display: none;
    }

    .admin-users-table th.col-time,
    .admin-users-table td.col-time {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .region-tabs.is-ready .region-tabs__indicator,
    .page-main,
    .region-tab {
        transition: none !important;
        animation: none !important;
    }

    body.region-switching .page-main {
        opacity: 1;
        transform: none;
    }
}
