:root {
    --primary: #4CAF50;
    --primary-dark: #388E3C;
    --danger: #E53935;
    --danger-dark: #C62828;
    --bg: #f5f5f5;
    --card-bg: #ffffff;
    --text: #333333;
    --text-secondary: #666666;
    --border: #e0e0e0;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-tap-highlight-color: transparent;
}

/* 登录页 */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 32px 24px;
    width: 100%;
    max-width: 360px;
    box-shadow: var(--shadow);
}

.auth-card h1 {
    text-align: center;
    margin-bottom: 8px;
    color: var(--primary);
}

.subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 24px;
}

.tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.tab {
    flex: 1;
    padding: 12px;
    border: none;
    background: none;
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.auth-form input {
    width: 100%;
    padding: 14px;
    margin-bottom: 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 16px;
    outline: none;
}

.auth-form input:focus {
    border-color: var(--primary);
}

.error {
    color: var(--danger);
    font-size: 14px;
    text-align: center;
    margin-top: 8px;
    min-height: 20px;
}

/* 按钮 */
button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    outline: none;
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: var(--primary);
    color: white;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 500;
    transition: background 0.2s;
}

.btn-primary:active {
    background: var(--primary-dark);
}

.btn-primary.small {
    width: auto;
    padding: 8px 14px;
    font-size: 14px;
}

.btn-secondary {
    padding: 12px 20px;
    background: var(--border);
    color: var(--text);
    border-radius: 10px;
    font-size: 15px;
}

.btn-text {
    background: none;
    color: var(--text-secondary);
    font-size: 14px;
    padding: 8px;
}

/* 主应用 */
.app-header {
    background: var(--primary);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.app-header h1 {
    font-size: 18px;
    font-weight: 600;
}

.app-header .username {
    font-size: 12px;
    opacity: 0.9;
}

.app-header .app-version {
    font-size: 11px;
    opacity: 0.75;
    margin-left: 8px;
}

.app-header .btn-text {
    color: white;
    opacity: 0.9;
}

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

.score-card {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border-radius: 16px;
    padding: 28px;
    text-align: center;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.score-label {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 4px;
}

.score-value {
    font-size: 56px;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 4px;
}

.score-desc {
    font-size: 13px;
    opacity: 0.85;
    margin-bottom: 12px;
}

.score-status {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    min-height: 28px;
}

.badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

.badge.reward {
    background: #ffeb3b;
    color: #333;
}

.badge.punishment {
    background: var(--danger);
    color: white;
}

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

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.section h2 {
    font-size: 16px;
    font-weight: 600;
}

/* 任务列表 */
.task-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.task-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fafafa;
}

.task-name {
    flex: 1;
    font-size: 15px;
    word-break: break-all;
    padding-right: 10px;
}

.task-name.sensitive,
.record-task-name.sensitive {
    color: var(--text-secondary);
    letter-spacing: 2px;
    user-select: none;
}

.task-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.btn-score {
    min-width: 64px;
    height: 36px;
    padding: 0 10px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: white;
    white-space: nowrap;
}

.btn-score.plus {
    background: var(--primary);
}

.btn-score.plus:active {
    background: var(--primary-dark);
}

.btn-score.minus {
    background: var(--danger);
}

.btn-score.minus:active {
    background: var(--danger-dark);
}

.btn-icon {
    width: 32px;
    height: 32px;
    background: none;
    color: var(--text-secondary);
    font-size: 18px;
    line-height: 1;
}

.empty-tips {
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    padding: 20px 0;
    display: none;
}

.empty-tips.show {
    display: block;
}

/* 记录列表 */
.record-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.record-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

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

.record-name {
    color: var(--text-secondary);
}

.record-points {
    font-weight: 600;
}

.record-points.plus {
    color: var(--primary);
}

.record-points.minus {
    color: var(--danger);
}

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

/* 记录分组 */
.record-group {
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    background: var(--card-bg);
}

.record-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--bg);
    cursor: pointer;
    user-select: none;
}

.record-group-header:hover {
    background: #eeeeee;
}

.record-group-info {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.record-group-toggle {
    color: var(--text-secondary);
    font-size: 12px;
    width: 16px;
    text-align: center;
    flex-shrink: 0;
}

.record-group-meta {
    color: var(--text-secondary);
    font-size: 13px;
    flex-shrink: 0;
}

.record-group-body {
    padding: 0 12px;
    max-height: 240px;
    overflow-y: auto;
}

.record-group-body .record-item {
    padding: 10px 0;
}

/* 让记录区域滚动条更明显 */
.record-list::-webkit-scrollbar,
.record-group-body::-webkit-scrollbar {
    width: 8px;
}

.record-list::-webkit-scrollbar-thumb,
.record-group-body::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.record-list,
.record-group-body {
    scrollbar-width: thin;
    scrollbar-color: #c1c1c1 transparent;
}

/* 弹窗 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 100;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 24px;
    width: 100%;
    max-width: 360px;
}

.modal-content h3 {
    margin-bottom: 16px;
    font-size: 18px;
}

.modal-content input {
    width: 100%;
    padding: 14px;
    margin-bottom: 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 16px;
}

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

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

.modal-actions {
    display: flex;
    gap: 12px;
}

.modal-actions button {
    flex: 1;
}

/* 加载和提示 */
.loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 16px 24px;
    border-radius: 10px;
    z-index: 200;
}

.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.75);
    color: white;
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 14px;
    z-index: 200;
}

@media (min-width: 768px) {
    .container {
        padding: 24px;
    }
}
