/* ===== v2.0 通用组件库 — 前后端共用 ===== */

/* ===== 1. 按钮 Button ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 20px;
    height: 36px;
    border-radius: var(--radius);
    border: none;
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    transition: all var(--transition);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.2);
    opacity: 0;
    transition: opacity var(--transition);
}

.btn:hover::before {
    opacity: 1;
}

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

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-sm {
    height: 28px;
    padding: 4px 12px;
    font-size: 12px;
    border-radius: var(--radius-sm);
}

.btn-lg {
    height: 44px;
    padding: 10px 24px;
    font-size: 15px;
    border-radius: var(--radius);
}

.btn-block {
    width: 100%;
}

/* 主按钮 */
.btn-primary {
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    box-shadow: 0 2px 8px rgba(51, 65, 85, 0.25);
}

.btn-primary:hover {
    background: var(--btn-primary-hover);
    box-shadow: 0 4px 12px rgba(51, 65, 85, 0.35);
    transform: translateY(-1px);
}

/* 次按钮 */
.btn-secondary {
    background: var(--btn-secondary-bg);
    color: var(--btn-secondary-text);
    border: 1px solid var(--input-border);
}

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

/* 危险按钮 */
.btn-danger {
    background: var(--btn-danger-bg);
    color: var(--btn-danger-text);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25);
}

.btn-danger:hover {
    background: var(--btn-danger-hover);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35);
    transform: translateY(-1px);
}

/* 边框按钮 */
.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--input-border);
}

.btn-outline:hover {
    background: var(--sidebar-hover);
    color: var(--text-primary);
    border-color: var(--accent-color);
}

/* 文字按钮 */
.btn-text {
    background: transparent;
    color: var(--accent-color);
    padding: 4px 8px;
    height: auto;
}

.btn-text:hover {
    background: var(--accent-light);
    color: var(--accent-hover);
}

/* 图标按钮 */
.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius);
    background: var(--glass-bg);
    color: var(--text-secondary);
    border: 1px solid var(--glass-border);
}

.btn-icon:hover {
    background: var(--sidebar-hover);
    color: var(--text-primary);
}

.btn-icon.btn-sm {
    width: 28px;
    height: 28px;
}

/* ===== 2. 表单 Form ===== */
.form-group {
    margin-bottom: var(--space-4);
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-label .required {
    color: var(--color-error);
    margin-left: 2px;
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 9px 14px;
    border: 1px solid var(--input-border);
    border-radius: var(--radius);
    background: var(--input-bg);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
    outline: none;
    transition: all var(--transition);
    box-sizing: border-box;
}

.form-input:hover,
.form-textarea:hover,
.form-select:hover {
    border-color: var(--input-border-hover);
    background: var(--input-bg-hover);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    border-color: var(--input-focus);
    background: var(--input-bg);
    box-shadow: 0 0 0 3px var(--input-ring);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    cursor: pointer;
}

.form-error {
    color: var(--color-error);
    font-size: 12px;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.form-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.form-success {
    border-color: var(--color-success);
}

.form-error-input {
    border-color: var(--color-error);
}

/* 密码输入框 */
.pwd-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.pwd-input-wrap .form-input {
    padding-right: 44px;
}

.pwd-toggle {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    padding: 0;
    transition: all var(--transition);
}

.pwd-toggle:hover {
    color: var(--text-primary);
    background: var(--sidebar-hover);
}

.form-switch-link {
    margin-top: 12px;
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
}

.form-switch-link a {
    color: var(--accent-color);
    font-weight: 500;
}

/* ===== 3. 模态框 Modal ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 500;
    background: var(--overlay-bg);
    backdrop-filter: blur(var(--overlay-blur));
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-slow);
    padding: var(--space-4);
}

.modal-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    width: 100%;
    max-width: 480px;
    max-height: 85vh;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(var(--glass-blur));
    transform: translateY(20px) scale(0.95);
    transition: transform var(--transition-spring);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.modal-overlay.is-visible .modal {
    transform: translateY(0) scale(1);
}

.modal-lg {
    max-width: 640px;
}

.modal-sm {
    max-width: 360px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-4);
    flex-shrink: 0;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all var(--transition);
    flex-shrink: 0;
}

.modal-close:hover {
    background: var(--sidebar-hover);
    color: var(--text-primary);
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    margin-bottom: var(--space-4);
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-2);
    flex-shrink: 0;
    padding-top: var(--space-2);
    border-top: 1px solid var(--card-border);
    margin-bottom: 0;
}

.modal-footer-center {
    justify-content: center;
}

/* ===== 4. 卡片 Card ===== */
.card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    box-shadow: var(--card-shadow);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(var(--glass-blur));
    transition: all var(--transition);
}

.card:hover {
    box-shadow: var(--card-shadow-hover);
    border-color: var(--card-border-hover);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-4);
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.card-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

.card-footer {
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--card-border);
}

.card-hover {
    cursor: pointer;
}

.card-hover:hover {
    transform: translateY(-2px);
}

/* ===== 5. 标签 Tag ===== */
.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.6;
}

.tag-sm {
    padding: 1px 8px;
    font-size: 11px;
}

.tag-success {
    background: rgba(16, 185, 129, 0.12);
    color: var(--color-success);
}

.tag-error {
    background: rgba(239, 68, 68, 0.12);
    color: var(--color-error);
}

.tag-warning {
    background: rgba(245, 158, 11, 0.12);
    color: var(--color-warning);
}

.tag-info {
    background: rgba(59, 130, 246, 0.12);
    color: var(--color-info);
}

.tag-default {
    background: var(--btn-secondary-bg);
    color: var(--btn-secondary-text);
}

/* 马卡龙色系标签 */
.tag-rose { background: var(--mc-rose); color: var(--mc-rose-dark); }
.tag-slate { background: var(--mc-slate); color: var(--mc-slate-dark); }
.tag-blue { background: var(--mc-blue); color: var(--mc-blue-dark); }
.tag-green { background: var(--mc-green); color: var(--mc-green-dark); }
.tag-yellow { background: var(--mc-yellow); color: var(--mc-yellow-dark); }
.tag-orange { background: var(--mc-orange); color: var(--mc-orange-dark); }
.tag-teal { background: var(--mc-teal); color: var(--mc-teal-dark); }

/* ===== 6. 分页 Pagination ===== */
.pg-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: var(--space-5);
    padding: var(--space-2) 0;
    font-size: 13px;
    user-select: none;
}

.pg-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--card-border);
    background: var(--card-bg);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all var(--transition);
    white-space: nowrap;
}

.pg-btn:hover:not(:disabled) {
    background: var(--sidebar-hover);
    color: var(--text-primary);
    border-color: var(--accent-color);
}

.pg-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pg-btn.is-active {
    background: var(--accent-color);
    color: #fff;
    border-color: var(--accent-color);
    font-weight: 600;
}

.pg-pages {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pg-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    color: var(--text-muted);
    font-size: 14px;
    letter-spacing: 2px;
}

.pg-interval {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 10px;
    border-left: 1px solid var(--card-border);
    margin-left: 4px;
}

.pg-interval-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-right: 2px;
}

.pg-interval-btn {
    min-width: 28px;
    height: 28px;
    font-size: 12px;
    padding: 0 8px;
    border-radius: var(--radius-sm);
    background: var(--glass-bg);
    border: 1px solid var(--card-border);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.pg-interval-btn:hover {
    background: var(--sidebar-hover);
    color: var(--text-primary);
}

.pg-goto {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 10px;
    border-left: 1px solid var(--card-border);
    margin-left: 4px;
}

.pg-input {
    width: 50px;
    height: 30px;
    padding: 0 8px;
    text-align: center;
    border: 1px solid var(--input-border);
    border-radius: var(--radius-sm);
    background: var(--input-bg);
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    transition: border-color var(--transition);
    -moz-appearance: textfield;
}

.pg-input::-webkit-inner-spin-button,
.pg-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.pg-input:focus {
    border-color: var(--accent-color);
}

.pg-input.is-error {
    border-color: var(--color-error);
}

.pg-goto-btn {
    height: 30px;
    padding: 0 12px;
    font-size: 12px;
    border-radius: var(--radius-sm);
    background: var(--accent-color);
    color: #fff;
    border: none;
    cursor: pointer;
    transition: background var(--transition);
}

.pg-goto-btn:hover {
    background: var(--accent-hover);
}

.pg-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 10px;
    border-left: 1px solid var(--card-border);
    margin-left: 4px;
}

.pg-info-item {
    font-size: 12px;
    color: var(--text-muted);
}

.pg-info-item strong {
    color: var(--text-primary);
    font-weight: 600;
}

.pg-info-sep {
    color: var(--card-border);
}

.pg-loading {
    text-align: center;
    padding: var(--space-4);
    color: var(--text-muted);
    font-size: 13px;
}

/* ===== 7. Toast 消息提示 ===== */
#toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    pointer-events: none;
    width: 100%;
    max-width: 360px;
    padding: 0 var(--space-4);
}

.toast {
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--radius);
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(var(--glass-blur));
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 14px;
    color: var(--text-primary);
    animation: toastIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: auto;
}

.toast-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.toast-content {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-weight: 600;
    margin-bottom: 2px;
}

.toast-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.toast-close {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all var(--transition);
}

.toast-close:hover {
    background: var(--sidebar-hover);
    color: var(--text-primary);
}

.toast-success .toast-icon { color: var(--color-success); }
.toast-error .toast-icon { color: var(--color-error); }
.toast-warning .toast-icon { color: var(--color-warning); }
.toast-info .toast-icon { color: var(--color-info); }

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes toastOut {
    to {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }
}

/* ===== 8. 骨架屏 Skeleton ===== */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-tertiary) 25%,
        var(--bg-secondary) 50%,
        var(--bg-tertiary) 75%
    );
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeletonShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 14px;
    width: 100%;
    margin-bottom: 8px;
}

.skeleton-text:last-child {
    width: 60%;
    margin-bottom: 0;
}

.skeleton-circle {
    border-radius: 50%;
}

.skeleton-rect {
    border-radius: var(--radius);
}

/* ===== 9. 下拉菜单 Dropdown ===== */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 160px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(var(--glass-blur));
    padding: 4px;
    z-index: 100;
    display: none;
    animation: dropdownIn 0.2s ease;
}

.dropdown-menu.is-visible {
    display: block;
}

.dropdown-menu-left {
    right: auto;
    left: 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
    white-space: nowrap;
}

.dropdown-item:hover {
    background: var(--sidebar-hover);
}

.dropdown-item.danger {
    color: var(--color-error);
}

.dropdown-item.danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

.dropdown-divider {
    height: 1px;
    background: var(--card-border);
    margin: 4px 0;
}

@keyframes dropdownIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== 10. 开关 Switch ===== */
.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 24px;
    cursor: pointer;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.switch-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-tertiary);
    border-radius: 24px;
    transition: all var(--transition);
}

.switch-slider::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: all var(--transition);
}

.switch input:checked + .switch-slider {
    background: var(--accent-color);
}

.switch input:checked + .switch-slider::before {
    transform: translateX(16px);
}

.switch input:disabled + .switch-slider {
    opacity: 0.5;
    cursor: not-allowed;
}

.switch-sm {
    width: 32px;
    height: 18px;
}

.switch-sm .switch-slider::before {
    width: 14px;
    height: 14px;
    top: 2px;
    left: 2px;
}

.switch-sm input:checked + .switch-slider::before {
    transform: translateX(14px);
}

/* ===== 11. 进度条 Progress ===== */
.progress {
    width: 100%;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-color), var(--mc-slate-dark));
    border-radius: var(--radius-full);
    transition: width var(--transition-slow);
}

.progress-sm {
    height: 4px;
}

.progress-lg {
    height: 12px;
}

.progress-success .progress-bar {
    background: var(--color-success);
}

.progress-warning .progress-bar {
    background: var(--color-warning);
}

.progress-error .progress-bar {
    background: var(--color-error);
}

/* ===== 12. 图标选择器 ===== */
.icon-picker-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    max-height: 200px;
    overflow-y: auto;
    padding: 4px;
}

.icon-picker-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 10px 4px;
    border-radius: var(--radius);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
    font-size: 12px;
    color: var(--text-secondary);
}

.icon-picker-item:hover {
    background: var(--sidebar-hover);
    border-color: var(--input-border);
}

.icon-picker-item.is-active {
    border-color: var(--accent-color);
    background: var(--accent-lighter);
    color: var(--accent-color);
}

.icon-picker-item svg,
.icon-picker-item .icon {
    width: 24px;
    height: 24px;
    font-size: 20px;
}

/* ===== 13. 上传区域 Upload ===== */
.upload-area {
    border: 2px dashed var(--input-border);
    border-radius: var(--radius-lg);
    padding: var(--space-8) var(--space-6);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    background: var(--input-bg);
}

.upload-area:hover {
    border-color: var(--accent-color);
    background: var(--accent-lighter);
}

.upload-area.dragover {
    border-color: var(--accent-color);
    background: var(--accent-light);
}

.upload-icon {
    font-size: 40px;
    margin-bottom: var(--space-3);
    opacity: 0.5;
}

.upload-text {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.upload-hint {
    font-size: 12px;
    color: var(--text-muted);
}

/* ===== 15. 工具类：动画 ===== */
.animate-fade-in { animation: fadeIn 0.3s ease both; }
.animate-slide-up { animation: slideUp 0.35s ease-out both; }
.animate-slide-down { animation: slideDown 0.3s ease-out both; }
.animate-slide-in-left { animation: slideInLeft 0.3s ease-out both; }
.animate-slide-in-right { animation: slideInRight 0.3s ease-out both; }
.animate-scale-in { animation: scaleIn 0.25s ease both; }
.animate-bounce-in { animation: bounceIn 0.5s ease both; }
.animate-spin { animation: spin 1s linear infinite; }
.animate-float { animation: float 3s ease-in-out infinite; }

/* ===== 16. 设置面板 Settings Panel ===== */
.settings-panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 400;
    background: var(--overlay-bg);
    backdrop-filter: blur(var(--overlay-blur));
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-slow);
    padding: var(--space-4);
}

.settings-panel-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

.settings-panel {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 520px;
    max-height: 85vh;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(var(--glass-blur));
    transform: translateY(20px) scale(0.95);
    transition: transform var(--transition-spring);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.settings-panel-overlay.is-visible .settings-panel {
    transform: translateY(0) scale(1);
}

.settings-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--card-border);
    flex-shrink: 0;
}

.settings-panel-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.settings-panel-close {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all var(--transition);
    flex-shrink: 0;
}

.settings-panel-close:hover {
    background: var(--sidebar-hover);
    color: var(--text-primary);
}

.settings-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* 分组 */
.sp-group {
    margin-bottom: 20px;
}

.sp-group-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 10px;
    letter-spacing: 0.3px;
}

/* 行 */
.sp-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
}

.sp-label {
    font-size: 13px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

/* 主题选择网格 */
.sp-theme-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.sp-theme-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 12px;
    border-radius: var(--radius);
    border: 2px solid var(--card-border);
    background: var(--bg-secondary);
    cursor: pointer;
    transition: all var(--transition);
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.sp-theme-item:hover {
    border-color: var(--accent-light);
    background: var(--sidebar-hover);
    transform: translateY(-1px);
}

.sp-theme-item.is-active {
    border-color: var(--accent-color);
    background: var(--accent-lighter);
    color: var(--accent-color);
}

/* 马卡龙色调选择网格 */
.sp-color-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
}

.sp-color-item {
    width: 100%;
    aspect-ratio: 1;
    border-radius: var(--radius);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
}

.sp-color-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.sp-color-item.is-active {
    border-color: var(--text-primary);
    box-shadow: 0 0 0 2px var(--card-bg) inset, var(--shadow-md);
    transform: translateY(-2px);
}

/* 背景选项按钮组 */
.sp-bg-option {
    display: flex;
    gap: 6px;
}

.sp-bg-btn {
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--card-border);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

.sp-bg-btn:hover {
    border-color: var(--accent-light);
}

.sp-bg-btn.is-active {
    border-color: var(--accent-color);
    background: var(--accent-lighter);
    color: var(--accent-color);
}

.sp-bg-btn.preview-dark { background: #1e293b; color: #e2e8f0; }
.sp-bg-btn.preview-light { background: #f1f5f9; color: #475569; }
.sp-bg-btn.preview-transparent { background: linear-gradient(45deg, #eee 25%, transparent 25%), linear-gradient(-45deg, #eee 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #eee 75%), linear-gradient(-45deg, transparent 75%, #eee 75%); background-size: 10px 10px; background-position: 0 0, 0 5px, 5px -5px, -5px 0px; color: #666; }

/* 颜色/范围输入 */
.sp-input-color {
    width: 36px;
    height: 36px;
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    padding: 2px;
    background: var(--card-bg);
}

.sp-input-range {
    flex: 1;
    max-width: 140px;
    accent-color: var(--accent-color);
}

.sp-input-number {
    width: 70px;
}

/* 底部按钮区 */
.sp-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 16px;
    border-top: 1px solid var(--card-border);
    margin-top: 8px;
}

/* 响应式 */
@media (max-width: 768px) {
    .settings-panel {
        max-width: 100%;
        max-height: 90vh;
    }
    .sp-theme-grid {
        grid-template-columns: 1fr;
    }
    .sp-color-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ===== 响应式 ===== */
@media (max-width: 1024px) {
    .pg-interval { display: none; }
}

@media (max-width: 768px) {
    .pg-goto { display: none; }
    .pg-info { border-left: none; padding-left: 0; margin-left: 0; }
    .pg-wrapper { gap: 4px; }
    .pg-btn { min-width: 28px; height: 28px; font-size: 12px; }
    
    .modal {
        padding: var(--space-4);
        max-height: 90vh;
    }
    
    .modal-lg {
        max-width: 100%;
    }
    
    .icon-picker-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ===== 15. 模态框按钮行 ===== */
.modal-btn-row {
    display: flex;
    gap: var(--space-3);
    justify-content: flex-end;
    margin-top: var(--space-5);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border-color);
}

/* ===== 16. 图标选择器标签 ===== */
.icon-picker-label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}

/* ===== 17. 分页按钮修饰类 ===== */
.pg-btn.pg-prev,
.pg-btn.pg-next {
    min-width: 60px;
}

.pg-btn.pg-num {
    min-width: 36px;
}

/* ===== 18. PWA 安装横幅 ===== */
.pwa-install-banner {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10001;
    display: none;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    max-width: calc(100vw - 32px);
}

.pwa-install-banner.is-visible {
    display: flex;
    animation: pwaBannerIn 0.3s ease-out;
}

@keyframes pwaBannerIn {
    from { opacity: 0; transform: translate(-50%, 20px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

.pwa-install-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: var(--radius);
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.pwa-install-text {
    flex: 1;
    min-width: 0;
}

.pwa-install-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.pwa-install-desc {
    font-size: 12px;
    color: var(--text-secondary);
}

.pwa-install-btn {
    flex-shrink: 0;
    padding: 8px 16px;
    background: var(--accent-color);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity var(--transition);
}

.pwa-install-btn:hover {
    opacity: 0.9;
}

.pwa-install-close {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-muted);
    transition: background var(--transition);
}

.pwa-install-close:hover {
    background: var(--bg-secondary);
}

/* ===== 19. 消息详情弹窗内容 ===== */
.message-detail-content {
    margin: var(--space-4) 0;
    padding: var(--space-4);
    background: var(--bg-secondary);
    border-radius: var(--radius);
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-break: break-word;
}

.message-detail-time {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: var(--space-2);
}

/* ===== 20. 小组件系统 Widgets (v1.1.3) ===== */

/* 右侧可视化区容器（嵌入内容区右侧，三栏布局） */
.widget-sidebar {
    flex-shrink: 0;
    width: 280px;
    background: transparent;
    border-left: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width var(--transition), transform var(--transition);
}

.widget-sidebar.is-hidden {
    display: none;
}

/* 问题1：完全隐藏标题栏，区域融入背景 */
.widget-sidebar_header {
    display: none;
}

.widget-sidebar_title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.5px;
}

.widget-sidebar_collapse {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.widget-sidebar_collapse:hover {
    background: var(--sidebar-hover);
    color: var(--text-primary);
}

.widget-sidebar_body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.widget-sidebar_body::-webkit-scrollbar { width: 4px; }
.widget-sidebar_body::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 2px; }

/* 组件区域（顶部 / 右侧） */
.widget-zone {
    min-height: 40px;
    border-radius: var(--radius);
    transition: background var(--transition), outline var(--transition);
}

.widget-zone.is-drag-over {
    background: var(--accent-lighter);
    outline: 2px dashed var(--accent-color);
    outline-offset: 2px;
}

/* 顶部入口区：横排滚动 */
.widget-zone_top {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 4px 2px 8px;
    scrollbar-width: thin;
    justify-content: center; /* 组件根据剩余空间自适应居中 */
}
.widget-zone_top::-webkit-scrollbar { height: 4px; }
.widget-zone_top::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 2px; }

/* 右侧可视化区：2 列网格 */
.widget-zone_sidebar {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    align-content: start;
}

/* 单个组件卡片：透明背景，无边框 */
.widget-item {
    position: relative;
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: all var(--transition);
    user-select: none;
    cursor: grab;
}

.widget-item:hover {
    background: rgba(128, 128, 128, 0.12);
    border-color: rgba(128, 128, 128, 0.2);
    transform: translateY(-2px);
}

.widget-item:active {
    cursor: grabbing;
}

/* 尺寸变体 */
.widget-item_1x1 {
    width: 120px;
    min-height: 90px;
    flex-shrink: 0;
}

.widget-item_2x1 {
    width: 200px;
    min-height: 90px;
    flex-shrink: 0;
}

.widget-item_2x2 {
    grid-column: span 2;
    min-height: 220px;
}

.widget-item_1x2 {
    grid-column: span 1;
    min-height: 220px;
}

/* 顶部区组件尺寸自适应 */
.widget-zone_top .widget-item_2x2,
.widget-zone_top .widget-item_1x2 {
    grid-column: auto;
    min-height: 90px;
    width: 160px;
}

/* 拖拽中状态 */
.widget-item.is-dragging {
    opacity: 0.85;
    cursor: grabbing;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    transform: rotate(2deg);
}

.widget-item_placeholder {
    background: var(--bg-tertiary);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius);
    opacity: 0.5;
}

/* 组件内容区 */
.widget-item_body {
    flex: 1;
    padding: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* 空状态 */
.widget-empty {
    color: var(--text-muted);
    font-size: 12px;
    text-align: center;
    padding: 20px 8px;
    width: 100%;
}

.widget-empty_top {
    width: 160px;
    flex-shrink: 0;
}

.widget-empty_sidebar {
    grid-column: span 2;
    padding: 40px 8px;
}

.widget-error {
    color: var(--color-error, #ef4444);
    font-size: 12px;
    text-align: center;
    padding: 16px 8px;
}

/* 三点菜单弹出 */
.widget-menu {
    position: fixed;
    z-index: 10000;
    min-width: 120px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    backdrop-filter: blur(var(--glass-blur));
}

.widget-menu_item {
    padding: 8px 14px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    transition: background var(--transition);
}

.widget-menu_item:hover {
    background: var(--sidebar-hover);
}

.widget-menu_item:first-child {
    border-bottom: 1px solid var(--border-color);
}

/* 响应式：平板（组件区固定右侧滑出） */
@media (max-width: 1024px) {
    .widget-sidebar {
        position: fixed;
        right: 0;
        top: 0;
        height: 100vh;
        z-index: 100;
        transform: translateX(100%);
        box-shadow: -4px 0 16px rgba(0, 0, 0, 0.1);
    }
    .widget-sidebar.is-visible {
        transform: translateX(0);
    }
    .widget-sidebar.is-hidden {
        transform: translateX(100%);
        display: flex;
    }
}

/* 响应式：手机（组件区底部横滑） */
@media (max-width: 768px) {
    .widget-sidebar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        top: auto;
        width: 100%;
        height: 200px;
        transform: translateY(100%);
        border-left: none;
        border-top: 1px solid var(--border-color);
        border-radius: var(--radius) var(--radius) 0 0;
    }
    .widget-sidebar.is-visible {
        transform: translateY(0);
    }
    .widget-sidebar.is-hidden {
        transform: translateY(100%);
        display: flex;
    }
    .widget-zone_sidebar {
        grid-template-columns: repeat(3, 1fr);
    }
    .widget-zone_top .widget-item_2x2,
    .widget-zone_top .widget-item_1x2,
    .widget-zone_top .widget-item_2x1,
    .widget-zone_top .widget-item_1x1 {
        width: 110px;
        min-height: 80px;
    }
    .widget-item_2x2,
    .widget-item_1x2 {
        grid-column: span 2;
        min-height: 180px;
    }
}

/* 首页顶部组件行容器 */
.home_page_widget-top {
    margin-bottom: 20px;
}

/* ===== 敲木鱼组件私有样式（wooden_fish）===== */
.widget-item[data-widget-key="wooden_fish"] .widget-item_body {
    padding: 8px 10px 10px;
}

.wf-wrap {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 4px;
}

/* 顶部行：今日功德 + 音效开关 */
.wf-stats-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.wf-merit-today b,
.wf-merit-total b {
    color: var(--accent-color);
    font-weight: 600;
    font-size: 14px;
    margin-left: 2px;
}

.wf-sound-btn {
    width: 26px;
    height: 26px;
    padding: 0;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.wf-sound-btn:hover {
    background: var(--sidebar-hover);
    color: var(--text-primary);
}

.wf-sound-btn.is-off {
    color: var(--text-muted);
    opacity: 0.55;
}

.wf-sound-btn.is-on {
    color: var(--accent-color);
}

/* 木鱼点击区域 */
.wf-fish-area {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80px;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.wf-fish {
    width: 130px;
    height: 100px;
    max-width: 100%;
    transition: transform 0.08s ease-out;
    transform-origin: center bottom;
    will-change: transform;
}

/* 棒槌敲打动画 */
.wf-fish_stick {
    transition: transform 0.1s ease-out;
    transform-origin: 140px 25px;
}

.wf-fish_stick.is-knocking {
    animation: wf-stick-knock 0.22s ease-out;
}

@keyframes wf-stick-knock {
    0%   { transform: rotate(0deg); }
    30%  { transform: rotate(-25deg); }
    55%  { transform: rotate(8deg); }
    75%  { transform: rotate(-3deg); }
    100% { transform: rotate(0deg); }
}

/* 木鱼震动反馈 */
.wf-fish.is-shake {
    animation: wf-shake 0.2s ease-out;
}

@keyframes wf-shake {
    0%   { transform: translate(0, 0) scale(1); }
    25%  { transform: translate(-1px, 1px) scale(0.98); }
    50%  { transform: translate(1px, -1px) scale(1.01); }
    75%  { transform: translate(-0.5px, 0.5px) scale(0.99); }
    100% { transform: translate(0, 0) scale(1); }
}

/* 飘字容器：覆盖在木鱼上方 */
.wf-floats {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: visible;
}

/* 单个飘字：从木鱼中心向上飘 + 淡出 */
.wf-float {
    position: absolute;
    left: 50%;
    top: 30%;
    transform: translateX(-50%);
    transform: translateX(calc(-50% + var(--wf-offset-x, 0px)));
    color: var(--accent-color);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
    animation: wf-float-up 1.1s ease-out forwards;
    pointer-events: none;
}

@keyframes wf-float-up {
    0% {
        opacity: 0;
        transform: translate(-50%, 0) scale(0.7);
    }
    15% {
        opacity: 1;
        transform: translate(-50%, -6px) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(calc(-50% + var(--wf-offset-x, 0px)), -42px) scale(1);
    }
}

/* 底部累计功德 */
.wf-stats-bottom {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    padding-top: 2px;
}

/* 1x1 尺寸适配：缩小木鱼，隐藏底部累计 */
.widget-item_1x1 .wf-fish {
    width: 70px;
    height: 54px;
}
.widget-item_1x1 .wf-stats-bottom {
    display: none;
}
.widget-item_1x1 .wf-merit-today {
    font-size: 11px;
}

/* 1x2 横条适配：木鱼和统计横排 */
.widget-item_1x2 .wf-wrap {
    flex-direction: row;
    align-items: center;
    gap: 12px;
}
.widget-item_1x2 .wf-stats-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    flex-shrink: 0;
}
.widget-item_1x2 .wf-fish-area {
    flex: 1;
}
.widget-item_1x2 .wf-stats-bottom {
    display: none;
}

/* ===== 串珠组件私有样式（prayer_beads）===== */
.widget-item[data-widget-key="prayer_beads"] .widget-item_body {
    padding: 6px 10px 8px;
}

.pb-wrap {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 4px;
}

/* 珠子区：横排居中 */
.pb-beads {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    outline: none;
}

.pb-beads:focus-visible {
    border-radius: var(--radius-sm);
    box-shadow: 0 0 0 2px var(--input-ring);
}

.pb-beads-track {
    display: flex;
    align-items: center;
    gap: 6px;
    transition: transform 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* 单颗珠子：渐变 + 高光 + 阴影，模拟真实珠质感 */
.pb-bead {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #a8b5cf 0%, #64748b 50%, #334155 100%);
    box-shadow: inset -1px -1px 2px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.15);
    transition: all 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    flex-shrink: 0;
    position: relative;
}

/* 珠子高光点 */
.pb-bead::before {
    content: '';
    position: absolute;
    top: 15%;
    left: 20%;
    width: 25%;
    height: 25%;
    border-radius: 50%;
    background: rgba(255,255,255,0.4);
}

/* 当前珠：主题色高亮 + 放大 + 光晕脉冲 + 更强高光 */
.pb-bead.is-current {
    width: 14px;
    height: 14px;
    background: radial-gradient(circle at 35% 30%, var(--accent-light, #60a5fa) 0%, var(--accent-color, #334155) 60%, #1e293b 100%);
    box-shadow:
        inset -1px -1px 3px rgba(0,0,0,0.3),
        0 0 0 4px var(--accent-light, rgba(51, 65, 85, 0.15)),
        0 2px 8px rgba(0,0,0,0.2);
    transform: scale(1.1);
    animation: pb-bead-pulse 2s ease-in-out infinite;
}

@keyframes pb-bead-pulse {
    0%, 100% {
        box-shadow:
            inset -1px -1px 3px rgba(0,0,0,0.3),
            0 0 0 4px var(--accent-light, rgba(51, 65, 85, 0.15)),
            0 2px 8px rgba(0,0,0,0.2);
    }
    50% {
        box-shadow:
            inset -1px -1px 3px rgba(0,0,0,0.3),
            0 0 0 6px var(--accent-light, rgba(51, 65, 85, 0.1)),
            0 2px 12px rgba(0,0,0,0.25);
    }
}

.pb-bead.is-current::before {
    width: 30%;
    height: 30%;
    background: rgba(255,255,255,0.6);
}

/* 底部统计区 */
.pb-stats {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 11px;
    color: var(--text-muted);
}

.pb-count {
    color: var(--text-secondary);
    font-size: 12px;
}

.pb-count-num {
    color: var(--accent-color);
    font-weight: 700;
    font-size: 14px;
}

.pb-count-total {
    color: var(--text-muted);
    margin-left: 1px;
}

.pb-meta {
    display: flex;
    gap: 8px;
    align-items: center;
}

.pb-meta b {
    color: var(--text-secondary);
    font-weight: 600;
    margin-left: 2px;
}

/* 1x1 尺寸适配：只显示当前珠 + 计数 */
.widget-item_1x1 .pb-beads-track {
    gap: 4px;
}
.widget-item_1x1 .pb-bead {
    width: 6px;
    height: 6px;
}
.widget-item_1x1 .pb-bead.is-current {
    width: 10px;
    height: 10px;
    box-shadow: 0 0 0 3px var(--accent-light, rgba(51, 65, 85, 0.15));
}
.widget-item_1x1 .pb-meta {
    display: none;
}

/* 2x2 尺寸适配：珠子放大，统计更明显 */
.widget-item_2x2 .pb-beads-track {
    gap: 10px;
}
.widget-item_2x2 .pb-bead {
    width: 12px;
    height: 12px;
}
.widget-item_2x2 .pb-bead.is-current {
    width: 20px;
    height: 20px;
    box-shadow:
        inset -1px -1px 3px rgba(0,0,0,0.3),
        0 0 0 6px var(--accent-light, rgba(51, 65, 85, 0.15)),
        0 2px 8px rgba(0,0,0,0.2);
}
.widget-item_2x2 .pb-stats {
    font-size: 13px;
}
.widget-item_2x2 .pb-count {
    font-size: 14px;
}
.widget-item_2x2 .pb-count-num {
    font-size: 18px;
}

/* ===== 倒计时组件私有样式（countdown）===== */
.widget-item[data-widget-key="countdown"] .widget-item_body {
    padding: 8px 10px 10px;
    cursor: pointer;
}

.cd-wrap {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 8px;
}

/* 主倒计时卡片 */
.cd-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    padding: 8px 4px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, color-mix(in srgb, var(--cd-color, #334155) 8%, transparent), transparent);
    border-left: 3px solid var(--cd-color, #334155);
    min-height: 60px;
}

.cd-main_header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

.cd-main_icon {
    font-size: 16px;
    line-height: 1;
}

.cd-main_name {
    font-weight: 500;
}

.cd-main_time {
    font-size: 18px;
    font-weight: 700;
    color: var(--cd-color, var(--accent-color));
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.5px;
    line-height: 1.2;
    text-align: center;
    word-break: keep-all;
}

/* 小倒计时项列表（横排） */
.cd-rest {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.cd-rest_item {
    flex: 1;
    min-width: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 4px;
    border-radius: var(--radius-sm);
    background: var(--glass-bg);
    border-top: 2px solid var(--cd-color, #64748b);
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
}

.cd-rest_icon {
    font-size: 13px;
    line-height: 1;
}

.cd-rest_name {
    color: var(--text-secondary);
    font-weight: 500;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cd-rest_days {
    color: var(--cd-color, var(--text-primary));
    font-weight: 600;
    font-size: 12px;
}

/* 空状态 */
.cd-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    cursor: pointer;
    color: var(--text-muted);
    user-select: none;
}

.cd-empty_icon {
    font-size: 32px;
    opacity: 0.5;
    margin-bottom: 4px;
}

.cd-empty_text {
    font-size: 12px;
}

/* 1x1 尺寸适配：只显示主项，缩小字号 */
.widget-item_1x1 .cd-main_time {
    font-size: 14px;
}
.widget-item_1x1 .cd-main_header {
    font-size: 11px;
}
.widget-item_1x1 .cd-rest {
    display: none;
}

/* 1x2 竖条适配：主项在上，小项在下 */
.widget-item_1x2 .cd-wrap {
    flex-direction: column;
}

/* ===== 倒计时管理弹窗 ===== */
.cd-mgr {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.cd-mgr_list {
    max-height: 240px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 4px;
}

.cd-mgr_empty {
    padding: 24px 8px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

.cd-mgr_item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
}

.cd-mgr_item:hover {
    background: var(--sidebar-hover);
}

.cd-mgr_item-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.cd-mgr_item-info {
    flex: 1;
    min-width: 0;
}

.cd-mgr_item-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cd-mgr_item-date {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.cd-mgr_item-del {
    width: 24px;
    height: 24px;
    padding: 0;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    transition: all var(--transition);
    flex-shrink: 0;
}

.cd-mgr_item-del:hover {
    background: rgba(239, 68, 68, 0.12);
    color: var(--color-error, #ef4444);
}

.cd-mgr_form {
    border-top: 1px solid var(--border-color);
    padding-top: 12px;
}

.cd-mgr_form-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.cd-mgr_form-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.cd-mgr_input {
    height: 36px;
}

.cd-mgr_add-btn {
    width: 100%;
}

/* 隐藏工具类 */
.is-hidden {
    display: none !important;
}

/* ===== 答案之书组件私有样式（answer_book）===== */
.widget-item[data-widget-key="answer_book"] .widget-item_body {
    padding: 8px 6px;
    cursor: pointer;
}

.ab-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 4px;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.ab-wrap:focus-visible {
    outline: 2px solid var(--input-ring);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

.ab-icon {
    font-size: 28px;
    line-height: 1;
    transition: transform 0.3s ease;
}

.ab-wrap:hover .ab-icon {
    transform: scale(1.1) rotate(-5deg);
}

.ab-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.ab-hint {
    font-size: 10px;
    color: var(--text-muted);
}

/* 1x2 / 2x2 适配：横排显示 */
.widget-item_1x2 .ab-wrap,
.widget-item_2x2 .ab-wrap {
    flex-direction: row;
    gap: 12px;
}
.widget-item_2x2 .ab-icon {
    font-size: 48px;
}
.widget-item_2x2 .ab-title {
    font-size: 16px;
}
.widget-item_2x2 .ab-hint {
    font-size: 12px;
}

/* ===== 答案之书弹窗 ===== */
.ab-modal {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.ab-book-scene {
    perspective: 800px;
    display: flex;
    justify-content: center;
    padding: 8px 0;
}

.ab-book {
    position: relative;
    width: 240px;
    height: 140px;
    transform-style: preserve-3d;
    transition: transform 0.6s ease;
}

.ab-book.is-flipping {
    animation: ab-flip 0.6s ease;
}

@keyframes ab-flip {
    0%   { transform: rotateY(0deg); }
    50%  { transform: rotateY(90deg); }
    100% { transform: rotateY(0deg); }
}

.ab-book_cover,
.ab-book_page {
    position: absolute;
    inset: 0;
    border-radius: 6px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    backface-visibility: hidden;
}

/* 封面 */
.ab-book_cover {
    background: linear-gradient(135deg, #8b5a3c, #5c3a26);
    color: #f5e6d3;
    box-shadow: 0 4px 12px rgba(92, 58, 38, 0.3);
}

.ab-book_icon {
    font-size: 40px;
    margin-bottom: 6px;
}

.ab-book_title {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 2px;
}

/* 内页 */
.ab-book_page {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    overflow-y: auto;
}

.ab-book_placeholder {
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
}

.ab-book_loading {
    color: var(--text-muted);
    font-size: 13px;
}

.ab-book_answer {
    text-align: center;
    padding: 8px;
    animation: ab-fade-in 0.4s ease;
}

@keyframes ab-fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.ab-book_answer-text {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.6;
    font-style: italic;
}

.ab-book_error {
    color: var(--color-error, #ef4444);
    font-size: 13px;
    text-align: center;
}

.ab-input-row {
    display: flex;
}

.ab-input-row .form-input {
    flex: 1;
}

.ab-control-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.ab-control-row .ab-flip-btn {
    flex: 1;
}

/* ===== 喝水提醒组件私有样式（water_reminder）===== */
.widget-item[data-widget-key="water_reminder"] .widget-item_body {
    padding: 8px 10px;
    cursor: pointer;
}

.wr-wrap {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 4px;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.wr-wrap:focus-visible {
    outline: 2px solid var(--input-ring);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

.wr-icon-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex: 1;
}

.wr-icon {
    font-size: 22px;
    line-height: 1;
    transition: transform 0.3s ease;
}

.wr-wrap:hover .wr-icon {
    transform: scale(1.1);
}

.wr-icon.is-done {
    animation: wr-bounce 0.6s ease;
}

@keyframes wr-bounce {
    0%, 100% { transform: scale(1); }
    30%      { transform: scale(1.2); }
    60%      { transform: scale(0.95); }
}

.wr-cups {
    font-size: 12px;
    color: var(--text-secondary);
}

.wr-today-num {
    color: var(--accent-color);
    font-weight: 700;
    font-size: 14px;
}

.wr-goal-num {
    color: var(--text-muted);
}

.wr-progress {
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    overflow: hidden;
}

.wr-progress_bar {
    height: 100%;
    background: var(--accent-color);
    border-radius: 2px;
    transition: width 0.4s ease;
}

.wr-percent {
    font-size: 10px;
    color: var(--text-muted);
    text-align: center;
}

/* 1x2 / 2x2 适配 */
.widget-item_2x2 .wr-icon {
    font-size: 36px;
}
.widget-item_2x2 .wr-cups {
    font-size: 14px;
}
.widget-item_2x2 .wr-today-num {
    font-size: 20px;
}

/* ===== 捏泡泡纸组件 bubble_wrap ===== */
.bw-wrap {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 8px;
}
.bw-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.bw-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}
.bw-count {
    font-size: 11px;
    color: var(--text-muted);
}
.bw-count b {
    color: var(--accent-color);
    font-size: 13px;
}
.bw-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 4px;
    flex: 1;
    align-content: center;
}
.bw-bubble {
    aspect-ratio: 1;
    background: radial-gradient(circle at 35% 35%, #60a5fa, #2563eb);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: inset -2px -2px 4px rgba(0,0,0,0.2), inset 2px 2px 4px rgba(255,255,255,0.3);
}
.bw-bubble:hover {
    transform: scale(1.1);
}
.bw-bubble.is-popped {
    background: #e2e8f0;
    box-shadow: inset 2px 2px 4px rgba(0,0,0,0.1);
    transform: scale(0.8);
    cursor: default;
    pointer-events: none;
}
.bw-reset {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 11px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}
.bw-reset:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

/* ===== 掷骰子组件 dice_roll ===== */
.dr-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 8px;
    cursor: pointer;
}
.dr-dice {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    width: 60px;
    height: 60px;
    background: #fff;
    border-radius: 12px;
    padding: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transition: transform 0.3s ease;
}
.dr-dice.is-rolling {
    animation: dr-shake 0.1s ease-in-out infinite;
}
@keyframes dr-shake {
    0%, 100% { transform: rotate(-5deg); }
    50% { transform: rotate(5deg); }
}
.dr-dot {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: #e2e8f0;
}
.dr-dot.is-on {
    background: #1e293b;
}
.dr-info {
    display: flex;
    align-items: baseline;
    gap: 2px;
}
.dr-num {
    font-size: 20px;
    font-weight: 700;
    color: var(--accent-color);
}
.dr-label {
    font-size: 12px;
    color: var(--text-muted);
}
.dr-hint {
    font-size: 10px;
    color: var(--text-muted);
}

/* ===== 番茄翻牌组件 flip_card ===== */
.fc-wrap {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 6px;
}
.fc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.fc-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}
.fc-stats {
    font-size: 11px;
    color: var(--text-muted);
}
.fc-timer {
    font-weight: 600;
    color: var(--accent-color);
}
.fc-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    flex: 1;
    align-content: center;
}
.fc-card {
    aspect-ratio: 1;
    cursor: pointer;
    perspective: 100px;
}
.fc-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.4s ease;
    transform-style: preserve-3d;
}
.fc-card.is-flipped .fc-card-inner {
    transform: rotateY(180deg);
}
.fc-card-front,
.fc-card-back {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    backface-visibility: hidden;
    font-size: 18px;
}
.fc-card-front {
    background: var(--accent-color);
    color: #fff;
    font-weight: 700;
}
.fc-card-back {
    background: #f1f5f9;
    transform: rotateY(180deg);
}
.fc-card.is-matched .fc-card-back {
    background: #dcfce7;
    animation: fc-pop 0.3s ease;
}
@keyframes fc-pop {
    0% { transform: rotateY(180deg) scale(1); }
    50% { transform: rotateY(180deg) scale(1.15); }
    100% { transform: rotateY(180deg) scale(1); }
}
.fc-restart {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 11px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    align-self: center;
}
.fc-restart:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

/* ===== 广场页组件商店卡片样式 ===== */
.library_page_widget-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}
.library_page_widget-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: all 0.2s ease;
}
.library_page_widget-card:hover {
    border-color: var(--accent-color);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}
.library_page_widget-icon {
    font-size: 36px;
    text-align: center;
    line-height: 1;
}
.library_page_widget-info {
    flex: 1;
}
.library_page_widget-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.library_page_widget-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 8px;
}
.library_page_widget-tags {
    display: flex;
    gap: 6px;
}
.library_page_widget-tag {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--bg-secondary);
    color: var(--text-muted);
}
.library_page_widget-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.library_page_widget-badge.is-added {
    font-size: 11px;
    color: #22c55e;
    font-weight: 600;
}

/* 组件预览弹窗 */
.library_page_widget-preview {
    text-align: center;
    padding: 20px 0;
}
.library_page_widget-preview-icon {
    font-size: 56px;
    margin-bottom: 12px;
}
.library_page_widget-preview-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}
.library_page_widget-preview-desc {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 12px;
}
.library_page_widget-preview-tags {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 16px;
}
.library_page_widget-preview-hint {
    font-size: 12px;
    color: var(--text-muted);
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 10px 16px;
}
.widget-item_2x2 .wr-progress {
    height: 8px;
}
.widget-item_2x2 .wr-percent {
    font-size: 12px;
}

/* ===== 喝水提醒弹窗 ===== */
.wr-modal {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.wr-modal_progress-text {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.wr-modal_progress-text b {
    color: var(--accent-color);
    font-weight: 700;
    font-size: 16px;
}

.wr-modal_progress-bar {
    height: 10px;
    background: var(--border-color);
    border-radius: 5px;
    overflow: hidden;
}

.wr-modal_progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-color), var(--accent-hover, var(--accent-color)));
    border-radius: 5px;
    transition: width 0.4s ease;
}

.wr-modal_actions {
    display: flex;
    gap: 8px;
}

.wr-modal_btn {
    flex: 1;
}

.wr-modal_settings {
    border-top: 1px solid var(--border-color);
    padding-top: 12px;
}

.wr-modal_settings-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.wr-modal_form-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.wr-modal_label {
    font-size: 12px;
    color: var(--text-secondary);
    width: 64px;
    flex-shrink: 0;
}

.wr-modal_input {
    height: 38px;
    font-size: 13px;
}

.wr-modal_unit {
    font-size: 12px;
    color: var(--text-muted);
}

/* 自定义开关 */
.wr-modal_switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    flex-shrink: 0;
}

.wr-modal_switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.wr-modal_switch-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--border-color);
    border-radius: 20px;
    transition: background var(--transition);
}

.wr-modal_switch-slider::before {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform var(--transition);
}

.wr-modal_switch input:checked + .wr-modal_switch-slider {
    background: var(--accent-color);
}

.wr-modal_switch input:checked + .wr-modal_switch-slider::before {
    transform: translateX(16px);
}

/* ===== 时间胶囊组件 time_capsule ===== */
.tc-wrap {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 6px;
    padding: 4px;
}
.tc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.tc-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
}
.tc-count {
    font-size: 10px;
    color: var(--text-muted);
}
.tc-form {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.tc-input {
    width: 100%;
    height: 36px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 4px 6px;
    font-size: 11px;
    resize: none;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: inherit;
}
.tc-input:focus {
    outline: none;
    border-color: var(--accent-color);
}
.tc-form-row {
    display: flex;
    gap: 4px;
}
.tc-days {
    flex: 1;
    height: 22px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 10px;
    background: var(--bg-secondary);
    color: var(--text-primary);
}
.tc-btn {
    height: 22px;
    font-size: 10px;
    padding: 0 8px;
    background: var(--accent-color);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}
.tc-btn:hover { opacity: 0.9; }
.tc-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.tc-empty {
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    padding: 8px 0;
}
.tc-item {
    background: var(--bg-secondary);
    border-radius: 6px;
    padding: 4px 6px;
    font-size: 10px;
}
.tc-item.is-locked .tc-item-text {
    filter: blur(4px);
    user-select: none;
}
.tc-item.is-unlocked .tc-item-text {
    color: var(--text-primary);
    font-weight: 600;
}
.tc-item-text {
    line-height: 1.4;
    margin-bottom: 2px;
}
.tc-item-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 9px;
    color: var(--text-muted);
}
.tc-item-meta button {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 10px;
    padding: 0 4px;
}
.tc-item-meta button:hover { color: #ef4444; }
.tc-item-meta .tc-unlock { color: var(--accent-color); }

/* ===== 2048 组件 mini_2048 ===== */
.m48-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    gap: 6px;
    padding: 4px;
}
.m48-header {
    display: flex;
    justify-content: space-between;
    width: 100%;
    align-items: center;
}
.m48-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}
.m48-scores {
    display: flex;
    gap: 6px;
}
.m48-score, .m48-best {
    font-size: 11px;
    padding: 2px 6px;
    background: #bbada0;
    color: #fff;
    border-radius: 4px;
    font-weight: 700;
}
.m48-best {
    background: #8f7a66;
    font-weight: 500;
}
.m48-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    background: #bbada0;
    padding: 4px;
    border-radius: 6px;
    width: 100%;
    max-width: 220px;
    aspect-ratio: 1;
}
.m48-tile {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 700;
    transition: all 0.1s ease;
}
.m48-tile:nth-child(n) {
    font-size: 14px;
}
.m48-hint {
    font-size: 10px;
    color: var(--text-muted);
}
.m48-restart {
    background: var(--accent-color);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 4px 12px;
    font-size: 11px;
    cursor: pointer;
}
.m48-restart:hover { opacity: 0.9; }
.m48-over {
    position: absolute;
    inset: 0;
    background: rgba(238, 228, 218, 0.73);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    color: #776e65;
    border-radius: 6px;
}
.m48-win {
    position: absolute;
    inset: 0;
    background: rgba(237, 194, 46, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    color: #f9f6f2;
    border-radius: 6px;
}

/* ===== 今天吃啥组件 lunch_picker ===== */
.lp-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    gap: 6px;
    padding: 4px;
}
.lp-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
}
.lp-display {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent-color);
    min-height: 28px;
    display: flex;
    align-items: center;
    transition: transform 0.07s;
    cursor: pointer;
    text-align: center;
}
.lp-display.is-rolling {
    animation: lp-shake 0.07s ease-in-out infinite;
}
@keyframes lp-shake {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-2px); }
}
.lp-display.is-final {
    animation: lp-pop 0.4s ease;
}
@keyframes lp-pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}
.lp-actions {
    display: flex;
    gap: 6px;
}
.lp-btn {
    font-size: 11px;
    padding: 3px 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}
.lp-btn:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}
.lp-btn-primary {
    background: var(--accent-color);
    color: #fff;
    border-color: var(--accent-color);
}
.lp-btn-primary:hover {
    opacity: 0.9;
    color: #fff;
}
.lp-tags {
    display: flex;
    gap: 3px;
    flex-wrap: wrap;
    justify-content: center;
    max-height: 40px;
    overflow: hidden;
}
.lp-tag {
    font-size: 10px;
    padding: 1px 6px;
    background: var(--bg-secondary);
    color: var(--text-muted);
    border-radius: 8px;
}

