/* ===== 全局重置 & 配色（佛家金色） ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: #000000; /* 纯黑背景 */
    color: #f5e6c8;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 12px;
    position: relative;
    overflow-x: hidden;
}

#bg-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.app-container {
    position: relative;
    z-index: 1;
    max-width: 480px;
    width: 100%;
    margin: 0 auto;
}

/* ===== 卡片 ===== */
.card {
    background: rgba(20, 15, 10, 0.85);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border-radius: 20px;
    padding: 18px 16px 20px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.8);
    margin-bottom: 16px;
    border: 1px solid rgba(232, 184, 76, 0.3);
}

.card-title {
    font-size: 17px;
    font-weight: 600;
    color: #f5c27b;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    border-bottom: 1px solid rgba(232, 184, 76, 0.2);
    padding-bottom: 8px;
}

/* ===== 按钮通用 ===== */
.btn-common {
    background: rgba(232, 184, 76, 0.15);
    border: 1px solid #e8b84c;
    color: #f5e6c8;
    padding: 8px 18px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: 0.2s;
    font-family: inherit;
}
.btn-common:hover {
    background: rgba(232, 184, 76, 0.35);
}
.btn-common:active {
    transform: scale(0.97);
}

/* 主提交按钮（登录/注册） */
.btn-primary {
    background: #e8b84c;
    color: #1f1a12;
    border: none;
    padding: 12px 20px;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s;
    box-shadow: 0 4px 12px rgba(232, 184, 76, 0.3);
}
.btn-primary:hover {
    background: #f5c27b;
    transform: translateY(-1px);
}

/* ===== 设置按钮（齿轮） ===== */
.btn-settings {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #b5aeaa;
    padding: 4px 8px;
    border-radius: 10px;
    transition: 0.2s;
    position: relative;
}
.btn-settings:hover {
    background: rgba(232, 184, 76, 0.2);
    color: #f5c27b;
}

/* 下拉菜单 */
.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 36px;
    background: rgba(20, 15, 10, 0.95);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(232, 184, 76, 0.4);
    border-radius: 12px;
    padding: 6px 0;
    min-width: 150px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.6);
    z-index: 100;
}
.dropdown-menu.show {
    display: block;
}
.dropdown-menu .menu-item {
    padding: 10px 18px;
    color: #f5e6c8;
    font-size: 14px;
    cursor: pointer;
    transition: 0.15s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
}
.dropdown-menu .menu-item:hover {
    background: rgba(232, 184, 76, 0.2);
}
.dropdown-menu .menu-item.danger {
    color: #f5a09e;
}
.dropdown-menu .menu-item.danger:hover {
    background: rgba(192, 57, 43, 0.3);
}

/* 输入框 */
.form-group input,
.form-group select,
.record-input .row select,
.record-input .row input {
    background: rgba(20, 15, 10, 0.8);
    border: 1px solid #7a5f3a;
    color: #f5e6c8;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 15px;
    width: 100%;
}
.form-group input:focus,
.form-group select:focus {
    border-color: #e8b84c;
    box-shadow: 0 0 0 3px rgba(232, 184, 76, 0.25);
    outline: none;
}

.auth-error {
    background: rgba(192, 57, 43, 0.3);
    color: #f5a09e;
    padding: 8px 14px;
    border-radius: 12px;
    display: none;
    margin-bottom: 12px;
}
.auth-error.show { display: block; }
.hidden { display: none !important; }

.flex-row {
    display: flex;
    gap: 10px;
    align-items: center;
}
.flex-row input { flex: 1; }

.captcha-img {
    border-radius: 10px;
    background: rgba(0,0,0,0.4);
    cursor: pointer;
    border: 1px solid #7a5f3a;
    min-width: 100px;
    height: 44px;
    object-fit: contain;
}

.auth-switch {
    text-align: center;
    font-size: 13px;
    color: #7a6a5a;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(232, 184, 76, 0.2);
}

/* ===== 头部导航 ===== */
.header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0 20px;
}
.header-bar .app-brand {
    font-size: 20px;
    font-weight: 600;
    color: #f5c27b;
    cursor: pointer;
}
.header-bar .user-badge {
    background: rgba(232, 184, 76, 0.2);
    padding: 4px 14px;
    border-radius: 30px;
    font-size: 14px;
    color: #f5e6c8;
    cursor: pointer;
    transition: 0.2s;
}
.header-bar .user-badge:hover {
    background: rgba(232, 184, 76, 0.35);
}
.header-right {
    display: flex;
    align-items: center;
    gap: 6px;
    position: relative;
}

/* ===== 今日卡片 ===== */
.today-card {
    background: rgba(20, 15, 10, 0.6);
    border-radius: 16px;
    padding: 14px 16px;
    border: 1px solid rgba(232, 184, 76, 0.3);
}
.today-date {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 15px;
    font-weight: 500;
    color: #f5c27b;
    margin-bottom: 8px;
}
.badge-today {
    background: #e8b84c;
    color: #1f1a12;
    font-size: 11px;
    padding: 2px 12px;
    border-radius: 30px;
    font-weight: 500;
}
.today-content {
    font-size: 16px;
    color: #f5e6c8;
    padding: 8px 0 4px;
    line-height: 1.6;
    min-height: 40px;
}
.today-content .empty-hint { color: #7a6a5a; }

/* ===== 统计列表 ===== */
.summary-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(232, 184, 76, 0.15);
}
.summary-item:last-child { border-bottom: none; }
.summary-item .cat { color: #f5e6c8; }
.summary-item .total { color: #f5c27b; font-weight: 600; }

.history-empty {
    color: #7a6a5a;
    text-align: center;
    padding: 20px 0 8px;
}

.global-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
    padding: 4px 0;
}
.global-stats-grid .stat-item {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid rgba(232, 184, 76, 0.1);
    font-size: 14px;
}
.global-stats-grid .stat-item .cat { color: #f5e6c8; }
.global-stats-grid .stat-item .total { color: #f5c27b; font-weight: 600; }

/* ===== 模态框（修改昵称） ===== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 200;
    justify-content: center;
    align-items: center;
}
.modal-overlay.show { display: flex; }
.modal-box {
    background: rgba(20, 15, 10, 0.95);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(232, 184, 76, 0.4);
    border-radius: 20px;
    padding: 24px 20px;
    max-width: 340px;
    width: 90%;
    box-shadow: 0 16px 48px rgba(0,0,0,0.8);
}
.modal-box h3 {
    color: #f5c27b;
    margin-bottom: 16px;
    text-align: center;
}
.modal-box .form-group { margin-bottom: 12px; }
.modal-box .btn-row {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 12px;
}

/* 响应式 */
@media (max-width: 420px) {
    .card { padding: 14px 12px 16px; }
    .app-brand { font-size: 18px; }
    .global-stats-grid { gap: 4px 8px; }
    .global-stats-grid .stat-item { font-size: 13px; }
    .record-input .row { gap: 6px; flex-wrap: wrap; }
    .record-input .row select,
    .record-input .row input { font-size: 14px; padding: 8px 10px; }
    .record-input .row input[type="number"] { max-width: 80px; }
}
