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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    /* Prevent overscroll rubber banding on iOS */
    /* overscroll-behavior-y: none; */
}

.container {
    /* Remove max-width for full screen usage on mobile */
    /* max-width: 800px; */
    margin: 0 auto;
    padding: 0; /* Remove padding for edge-to-edge feel */
}

#main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background-color: white;
    border-bottom: 1px solid #e0e0e0;
    position: sticky;
    top: 0;
    z-index: 10;
}

#main-header h1 {
    margin: 0;
    font-size: 18px; /* Smaller header */
    color: #2c3e50;
}

#main-header #logout-button {
    position: static; /* Remove absolute positioning */
    padding: 5px 10px;
    font-size: 14px;
    background-color: #e74c3c;
}

#main-header #logout-button:hover {
    background-color: #c0392b;
}

.screen {
    background-color: white;
    /* Remove padding for screen content to manage its own */
    /* padding: 20px; */
    /* Remove box shadow and border-radius for seamless look */
    /* border-radius: 8px; */
    /* box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); */
    /* margin-bottom: 20px; */
}

.hidden {
    display: none !important;
}

/* Welcome Screen Specific Styles */
#welcome-screen {
    padding: 20px; /* Add padding back to welcome screen content */
}

#login-section h2,
#welcome-stats-area h2 {
    text-align: center;
    margin-bottom: 15px;
    font-size: 20px;
    color: #34495e;
}

.input-group {
    display: flex;
    margin: 20px 0;
}

input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 4px 0 0 4px;
    font-size: 16px;
    -webkit-appearance: none; /* Prevent iOS zoom on focus */
}

button {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 12px 15px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 16px;
    transition: background-color 0.3s;
    -webkit-appearance: none;
}

.input-group button {
    border-radius: 0 4px 4px 0;
}

button:hover:not(:disabled) {
    background-color: #2980b9;
}

button:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
}

/* Welcome Stats Area */
#welcome-stats-area .stats {
    background-color: #f9f9f9;
    border: 1px solid #eee;
    padding: 15px;
    border-radius: 5px;
    margin: 15px 0;
}

#welcome-stats-area .stats p {
    margin-bottom: 8px;
    font-size: 15px;
}

#welcome-stats-area .stats span {
    font-weight: bold;
    color: #2c3e50;
}

#welcome-stats-area button {
    display: block;
    width: 100%;
    margin-top: 10px;
    padding: 12px;
}

#welcome-stats-area #reset-button {
    background-color: #f39c12;
}

#welcome-stats-area #reset-button:hover:not(:disabled) {
    background-color: #e67e22;
}

/* Evaluation Screen Specific Styles */
#evaluation-screen {
    /* Remove padding to allow header and grid to span edge-to-edge */
    padding: 0;
    /* Allow scrolling if content overflows */
    /* overflow-y: auto; */
    /* Consider min-height for consistency */
    /* min-height: calc(100vh - header_height); */
}

/* Remove selected border, selection is immediate action now */
/* .image-item.selected {
    border: 3px solid #2ecc71;
} */

.image-item img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover; /* 改回 cover，填充方块 */
    /* background-color: #f7f7f7; 移除背景色 */
}

.image-item .img-error {
    color: red;
    font-size: 12px;
    text-align: center;
    padding: 10px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Loading Indicator Style */
#loading-indicator {
    position: fixed; /* Or absolute if container is relative */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    z-index: 100;
    font-size: 14px;
}

/* Grid Error Message */
.image-grid p {
    grid-column: 1 / -1; /* Span all columns */
    text-align: center;
    padding: 20px;
    color: #777;
}
.image-grid p.error {
    color: #e74c3c;
}
.image-grid p button {
    margin-left: 10px;
    padding: 5px 10px;
    font-size: 14px;
}

/* Remove Footer */
/* footer {
    display: none;
} */


/* Remove specific mobile overrides that might conflict */
/* @media (max-width: 600px) { ... } */
/* Let the base styles handle mobile first */

/* 预览模式样式 */
#preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.preview-container {
    position: relative;
    width: 100%;
    height: 70vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

#preview-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.preview-navigation {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 15px 0;
    width: 100%;
}

.nav-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 20px;
    margin: 0 15px;
    font-size: 18px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.preview-info {
    color: white;
    font-size: 16px;
}

.preview-controls {
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 0 20px;
    margin-bottom: 30px;
}

.action-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 50px;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s;
}

.select-btn {
    background-color: #2ecc71;
    color: white;
    flex: 1;
    max-width: 200px;
}

.select-btn:hover {
    background-color: #27ae60;
    transform: translateY(-2px);
}

.skip-btn {
    background-color: #e74c3c;
    color: white;
    flex: 1;
    max-width: 200px;
}

.skip-btn:hover {
    background-color: #c0392b;
    transform: translateY(-2px);
}

.close-btn {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
}

.close-btn:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

.preview-confirm-animation {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 100px;
    height: 100px;
    background-color: rgba(46, 204, 113, 0.7);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    opacity: 0;
    transition: transform 0.3s, opacity 0.3s;
}

.preview-confirm-animation::after {
    content: "✓";
    color: white;
    font-size: 50px;
}

.preview-confirm-animation.active {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

/* 长按效果提示 */
.image-item {
    position: relative;
}

.image-item::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.image-item.long-press::after {
    opacity: 1;
}

/* 触摸设备滑动提示样式 */
@media (pointer: coarse) {
    .swipe-hint {
        position: fixed;
        top: 10px;
        left: 0;
        right: 0;
        text-align: center;
        color: rgba(255, 255, 255, 0.7);
        font-size: 14px;
        padding: 5px;
        z-index: 1010;
        animation: fadeOut 3s forwards;
        animation-delay: 2s;
    }
    
    @keyframes fadeOut {
        from { opacity: 1; }
        to { opacity: 0; }
    }
}

/* 评估进度条样式 */
.eval-progress {
    background-color: rgba(255, 255, 255, 0.95);
    padding: 8px 15px;
    border-bottom: 1px solid #eee;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.05);
}

.progress-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.stat-label {
    font-size: 14px;
    color: #666;
}

.stat-value {
    font-size: 18px;
    font-weight: bold;
    color: #2c3e50;
    min-width: 30px;
    text-align: center;
}

/* 评估完成反馈效果 */
#eval-feedback {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: transparent; /* 背景完全透明 */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.1s; /* 更快的淡出 */
}

#eval-feedback.show {
    opacity: 1;
    animation: flashInOut 0.5s forwards; /* 总时长缩短到 0.5 秒 */
}

/* 替换 quickFadeInOut */
@keyframes flashInOut {
    0% { opacity: 0; }
    20% { opacity: 1; }
    80% { opacity: 1; }
    100% { opacity: 0; }
}

.feedback-content {
    background-color: transparent; /* 背景透明 */
    padding: 0;
    border-radius: 0;
    text-align: center;
    box-shadow: none; /* 移除阴影 */
    transform: translateY(0); /* 移除位移 */
    animation: none; /* 移除内容动画 */
    min-width: auto;
}

.feedback-progress {
    font-size: 0; /* 隐藏容器默认字体大小 */
    color: transparent; /* 隐藏容器默认颜色 */
}

/* 为数字跳动添加样式 - 水墨红黑风 */
#eval-feedback-count {
    font-family: \"ZCOOL KuaiLe\", cursive, sans-serif; 
    font-weight: normal;
    font-size: 88px; 
    display: inline-block;
    animation: inkSplash 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    animation-iteration-count: 1;
    transform-origin: center center;
    
    /* 默认颜色和阴影 */
    color: #1a1a1a;
    text-shadow: 3px 3px 5px rgba(0,0,0,0.3);
    transition: color 0.2s, text-shadow 0.2s; /* 平滑颜色过渡 */
}

/* 喜欢 (Selected) 状态的颜色 */
#eval-feedback-count.selected {
    color: #27ae60; /* 选用更深的绿色 */
    text-shadow:
        2px 2px 0px #2ecc71, /* 亮绿色偏移 */
        -1px -1px 0px #a0e8af, /* 更浅的绿色偏移 */
        3px 3px 5px rgba(0,0,0,0.4);
}

/* 跳过 (Skipped) 状态的颜色 */
#eval-feedback-count.skipped {
    color: #c0392b; /* 选用更深的红色 */
    text-shadow:
        2px 2px 0px #e74c3c, /* 亮红色偏移 */
        -1px -1px 0px #f5b7b1, /* 更浅的粉红色偏移 */
        3px 3px 5px rgba(0,0,0,0.4);
}

/* 动画保持不变 */
@keyframes inkSplash {
    0% { 
        transform: scale(0.6) rotate(-20deg);
        opacity: 0;
        text-shadow: none; 
    } 
    50% { 
        transform: scale(1.2) rotate(8deg);
        opacity: 1; 
        text-shadow: 
            1px 1px 0px #c0392b, 
            -0.5px -0.5px 0px #e74c3c, 
            1px 1px 2px rgba(0,0,0,0.2);
    }
    100% { 
        transform: scale(1) rotate(0deg);
        opacity: 1; 
        text-shadow: 
            2px 2px 0px #c0392b, 
            -1px -1px 0px #e74c3c, 
            3px 3px 5px rgba(0,0,0,0.3);
    }
}

/* 设置项样式 */
.settings-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    margin: 15px 0;
    border-top: 1px solid #f0f0f0;
    border-bottom: 1px solid #f0f0f0;
}

.settings-item label:first-child {
    font-size: 15px;
    color: #555;
}

/* 开关样式 (经典 iOS 风格) */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: #3498db;
}

input:focus + .slider {
    box-shadow: 0 0 1px #3498db;
}

input:checked + .slider:before {
    transform: translateX(22px);
}

/* 圆形滑块 */
.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Tinder 卡片区域样式 */
#card-container {
    flex-grow: 1; /* 占据剩余空间 */
    display: flex;
    flex-direction: column;
    justify-content: center; /* 垂直居中卡片区域 */
    align-items: center;
    padding: 10px;
    overflow: hidden; /* 防止卡片动画溢出 */
    position: relative; /* 用于卡片绝对定位 */
    min-height: 400px; /* 保证最小高度 */
    margin-top: 5px; /* 减小上边距 */
}

#card-stack {
    position: relative;
    width: 90%; /* 卡片宽度 */
    max-width: 350px; /* 最大宽度 */
    height: 60vh; /* 卡片高度 */
    max-height: 500px; /* 最大高度 */
}

.image-card {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #fff;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: grab;
    user-select: none;
    transition: transform 0.3s ease, opacity 0.3s ease;
    will-change: transform, opacity;
    border: 1px solid #eee;
    /* touch-action: pan-x; */ /* !!! 移除 pan-x，因为我们需要检测垂直滑动 !!! */
}

/* 使后面的卡片稍微缩小并下移，形成堆叠感 */
.image-card:nth-child(2) {
    transform: translateY(8px) scale(0.96);
    z-index: -1;
    opacity: 0.9;
}

.image-card:nth-child(3) {
    transform: translateY(16px) scale(0.92);
    z-index: -2;
    opacity: 0.8;
}

/* 隐藏更后面的卡片 */
.image-card:nth-child(n+4) {
    opacity: 0;
    pointer-events: none; 
}

.image-card img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* 确保图片完整显示 */
    pointer-events: none; /* 防止图片干扰拖动 */
}

/* 卡片拖动/滑动时的样式 */
/* .image-card.dragging { ... } */ /* 移除拖拽中的旋转等样式，因为不再左右拖拽 */

/* 滑出动画 (JS会添加/移除这些类) */
.image-card.swipe-up { /* 新增：上滑跳过 */
    transform: translateY(-150%) rotate(-5deg) !important; /* 向上移出并稍微旋转 */
    opacity: 0 !important;
}

.image-card.swipe-like { /* 重命名 swipe-right 为 swipe-like */
    transform: translateX(150%) rotate(30deg) !important; /* 喜欢动画保持向右飞出 */
    opacity: 0 !important;
}

/* 移除 swipe-left，因为跳过现在是 swipe-up */
/* .image-card.swipe-left { ... } */

/* 底部操作按钮 */
.action-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
    padding-bottom: 10px;
}

.action-buttons .action-btn {
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 50%; /* 圆形按钮 */
    width: 60px;
    height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    font-size: 14px; /* 调整文字大小 */
}

.action-buttons .action-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.action-buttons .dislike {
    color: #e74c3c; /* 红色 */
    border-color: #e74c3c;
}

.action-buttons .like {
    color: #2ecc71; /* 绿色 */
    border-color: #2ecc71;
}

/* 无更多卡片提示 */
.no-more-cards {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 20px;
    color: #777;
    background-color: #f9f9f9;
    border-radius: 15px;
}

/* 防止页面在评估时垂直滚动 (更强制) */
body.no-scroll {
    overflow: hidden; /* 禁止所有方向滚动 */
    /* 如果在 iOS 上仍然有问题，可能需要考虑 position: fixed; 但这会影响布局 */
}

/* 新的顶部栏样式 */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between; /* 让元素分散对齐 */
    padding: 8px 10px; /* 调整内边距 */
    background-color: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

/* 返回按钮新样式 */
.top-bar-button {
    background: none;
    border: 1px solid #aaa;
    color: #555;
    font-size: 14px;
    padding: 4px 10px;
    cursor: pointer;
    border-radius: 15px; 
    transition: background-color 0.2s, border-color 0.2s;
    flex-shrink: 0; /* 防止按钮被压缩 */
}

.top-bar-button:hover {
    background-color: #eee;
    border-color: #888;
}

/* 进度统计保持居中 */
.top-bar .progress-stats {
    display: flex;
    justify-content: center;
    gap: 20px; /* 调整间距 */
    flex-grow: 1; /* 占据中间空间 */
    text-align: center;
    /* 移除背景和边框 */
}

.top-bar .stat-item {
    display: flex;
    align-items: baseline; /* 对齐基线更好看 */
    gap: 4px;
}

.top-bar .stat-label {
    font-size: 12px; /* 调小标签字号 */
    color: #666;
}

.top-bar .stat-value {
    font-size: 16px; /* 调小数值字号 */
    font-weight: bold;
    color: #2c3e50;
    min-width: 20px; /* 调整最小宽度 */
    text-align: center;
    line-height: 1; /* 确保行高一致 */
}

/* 占位符，用于平衡布局 */
.top-bar-spacer {
    /* 宽度大致等于返回按钮的宽度，用于视觉居中 */
    /* width: 70px; */ /* 可以根据实际按钮宽度调整，或留空 */
    flex-shrink: 0;
    visibility: hidden; /* 或者直接不设置宽度，靠 justify-content: space-between */
}
