/* ========== SCRANDLE Game Styles ========== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: #f0f2f5;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Inter', system-ui, -apple-system, 'SF Pro Text', 'Segoe UI', Helvetica, sans-serif;
    padding: 0px;
    user-select: none;
}

.game {
    max-width: 1400px;
    width: 100%;
    background: #ffffff;
    padding: 28px 32px 40px;
    box-shadow: 0 20px 35px -12px rgba(0, 0, 0, 0.06);
    border: 1px solid #e8ecf0;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e8ecf0;
    flex-wrap: wrap;
    gap: 12px;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 20px;
}

h1 {
    font-size: 2rem;
    font-weight: 600;
    letter-spacing: 2px;
    color: #1f2f3a;
    text-transform: uppercase;
    margin: 0;
}

.score-badge {
    background: #2c6e5c;
    color: white;
    padding: 6px 16px;
    border-radius: 40px;
    font-weight: 600;
    font-size: 0.9rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f5f7f9;
    padding: 6px 16px 6px 20px;
    border-radius: 60px;
    cursor: pointer;
}

.user-detail {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.user-name {
    font-weight: 700;
    color: #2a5f4e;
    font-size: 0.9rem;
}

.user-email {
    font-size: 0.7rem;
    color: #7e8d9a;
}

.login-btn {
    background: #e8ecef;
    border: none;
    padding: 6px 16px;
    border-radius: 40px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    transition: 0.2s;
}
.login-btn:hover {
    background: #dce1e5;
}

.right-buttons {
    display: flex;
    gap: 12px;
    align-items: center;
}

.text-btn {
    background: #f5f7f9;
    border: 1px solid #e2e6ea;
    padding: 8px 16px;
    border-radius: 40px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    color: #2a5f4e;
    transition: 0.1s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.text-btn.active {
    background: #e0e8ef;
    color: #1e4a3b;
    border-color: #bbcbd8;
}
.text-btn:active {
    transform: scale(0.96);
}

/* Duel Cards */
.duel {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 32px;
    margin: 28px 0 30px;
}

.card {
    flex: 1;
    min-width: 300px;
    background: #fefefe;
    border-radius: 40px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 3px solid transparent;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.03);
}
.card:hover:not(.disabled-card) {
    transform: translateY(-6px);
}
.card.correct-border {
    border-color: #2c9e6e !important;
    background: #f9fffc;
}
.card.wrong-border {
    border-color: #dc5f4a !important;
    background: #fffaf8;
}
.card.disabled-card {
    pointer-events: none;
    opacity: 0.92;
}

.img-container {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #fafcfd;
    display: flex;
    align-items: center;
    justify-content: center;
}

.food-pic {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f8fa;
}
.food-pic img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Overlay */
.info-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(0deg, rgba(20, 28, 32, 0.94) 0%, rgba(30, 40, 45, 0.8) 80%, transparent);
    padding: 18px 16px 16px;
    backdrop-filter: blur(8px);
    transform: translateY(100%);
    transition: transform 0.25s cubic-bezier(0.2, 0.9, 0.4, 1.1);
    pointer-events: none;
    color: #fdf6e8;
}
.info-overlay.show {
    transform: translateY(0);
}

.food-title {
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: -0.2px;
    margin-bottom: 4px;
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    justify-content: space-between;
}

.club-meta {
    font-size: 0.7rem;
    font-weight: 500;
    opacity: 0.85;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.price-inline {
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(0, 0, 0, 0.4);
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    letter-spacing: 0.3px;
}

/* Percentage Badge */
.percentage-badge {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #111111dd;
    backdrop-filter: blur(16px);
    padding: 14px 28px;
    border-radius: 80px;
    font-weight: 750;
    font-size: 2.2rem;
    font-family: monospace;
    white-space: nowrap;
    z-index: 30;
    opacity: 0;
    transition: opacity 0.2s;
}
.percentage-badge.show-percent {
    opacity: 1;
}
.percentage-badge.low-value {
    color: #e76b5e;
}
.percentage-badge.high-value {
    color: #48b582;
}

/* Result Marker */
.result-marker {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 52px;
    height: 52px;
    border-radius: 60px;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 800;
    z-index: 35;
    opacity: 0;
    transform: scale(0.7);
    transition: opacity 0.2s, transform 0.2s;
}
.result-marker.show-marker {
    opacity: 1;
    transform: scale(1);
}
.result-marker.correct-marker {
    background: #2c9e6e;
    color: white;
}
.result-marker.wrong-marker {
    background: #dc5f4a;
    color: white;
}

/* Progress & Toggle Row */
.progress-row {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    margin: 24px 0 12px;
}

.progress-dots {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    justify-content: center;
}

.dot {
    width: 44px;
    height: 44px;
    background: #d9e1e8;
    border-radius: 60px;
    transition: all 0.2s ease;
    border: 1px solid #cbd5df;
}
.dot.correct-dot {
    background: #2c9e6e;
}
.dot.wrong-dot {
    background: #dc5f4a;
}

.info-toggle {
    background: none;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 50%;
    transition: background 0.2s;
    color: #2a5f4e;
    line-height: 1;
    flex-shrink: 0;
}
.info-toggle:hover {
    background: #e8f0ec;
}

/* Completion Panel */
.completion-panel {
    width: 100%;
    text-align: center;
    padding: 40px 20px;
    background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 48px;
    border: 1px solid #eef2f5;
}
.score-large {
    font-size: 2.5rem;
    font-weight: 700;
    color: #1e2f3a;
    margin: 15px 0 10px;
}
.encouragement {
    font-size: 1.2rem;
    font-weight: 500;
    margin: 8px 0;
    padding: 12px;
    border-radius: 60px;
    display: inline-block;
}
.action-buttons {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 30px;
    flex-wrap: wrap;
}
.action-btn {
    background: transparent;
    border: 1.5px solid #cbd5e2;
    padding: 10px 20px;
    border-radius: 60px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #2a4d5c;
    cursor: pointer;
    transition: 0.1s;
}
.action-btn:active {
    transform: scale(0.96);
    background: #f1f5f9;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}
.modal-content {
    position: relative;
    background: #ffffff;
    border-radius: 48px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    padding: 28px 24px;
}
.stats-grid {
    background: #f8fafc;
    border-radius: 32px;
    padding: 20px;
    margin-bottom: 10px;
}
.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #e2e8f0;
}
.stat-row:last-child {
    border-bottom: none;
}
.stat-label {
    font-weight: 500;
    color: #4a5568;
}
.stat-value {
    font-weight: 700;
    color: #2c6e5c;
}

/* Ranking List */
.ranking-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
    font-weight: 500;
}
.ranking-rank {
    font-weight: 700;
    color: #d68b45;
    width: 50px;
}
.ranking-name {
    flex: 1;
}
.ranking-score {
    width: 80px;
    text-align: right;
}
.ranking-winrate {
    width: 70px;
    text-align: right;
    color: #48bb78;
}

/* Login Form */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.login-form input {
    padding: 12px 16px;
    border-radius: 60px;
    border: 1px solid #cbd5e2;
    font-size: 1rem;
    outline: none;
}
.login-form button {
    background: #2c6e5c;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 60px;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
}

/* Toast */
.floating-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(44, 62, 68, 0.9);
    backdrop-filter: blur(12px);
    color: #fef1da;
    padding: 10px 22px;
    border-radius: 60px;
    font-size: 0.85rem;
    z-index: 300;
    opacity: 0;
    transition: opacity 0.2s;
    white-space: nowrap;
}

/* Mode Selector */
.mode-selector {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 18px;
}

/* Selected card (before knowing result) */
.card.selected-card {
    border-color: #3b82f6 !important;
    background: #f8faff;
}

/* Dot selected state */
.dot.selected-dot {
    background: #3b82f6;
    border-color: #2563eb;
}

/* Calendar styles */
.calendar-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.calendar-table th,
.calendar-table td {
    padding: 8px 4px;
    text-align: center;
}
.calendar-table th {
    color: #6b7d8a;
    font-weight: 500;
}
.calendar-day {
    width: 36px;
    height: 36px;
    line-height: 36px;
    border-radius: 50%;
    cursor: pointer;
    transition: 0.1s;
    display: inline-block;
}
.calendar-day:hover {
    background: #e8f0ec;
}
.calendar-day.available {
    background: #2c6e5c;
    color: white;
    font-weight: 600;
}
.calendar-day.available:hover {
    background: #1e4a3b;
}
.calendar-day.empty {
    pointer-events: none;
    color: #ccc;
}
.calendar-day.today {
    border: 2px solid #d68b45;
    color: #d68b45;
}
.calendar-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.calendar-nav button {
    background: none;
    border: 1px solid #cbd5e2;
    padding: 4px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
}

/* 统一关闭按钮样式 */
.close-modal,
.modal-content .close {
    position: absolute;
    top: 12px;
    right: 16px;
    width: 32px;
    height: 32px;
    background: #f0f2f5;
    border-radius: 50%;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    color: #4a5568;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 10;
}
.close-modal:hover,
.modal-content .close:hover {
    background: #e2e6ea;
    color: #1e2f3a;
}

/* 日历弹窗 – 取消内部滚动 */
#historyDateModal .modal-content {
    max-height: 520px;
    overflow-y: visible;
}

/* 全局加载遮罩 */
.loading-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.loading-spinner {
    width: 48px;
    height: 48px;
    border: 5px solid #e2e8f0;
    border-top-color: #2c6e5c;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
.loading-text {
    margin-top: 16px;
    font-size: 1rem;
    color: #2c6e5c;
    font-weight: 500;
}

/* Share modal */
.share-modal-content {
    max-width: 400px;
    padding: 24px;
}
.share-modal-content img {
    max-width: 100%;
    border-radius: 16px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}

/* Responsive */
@media (max-width: 750px) {
    .game {
        padding: 20px;
    }
    .food-pic img {
        object-fit: cover;
    }
    .percentage-badge {
        font-size: 1.4rem;
        padding: 8px 18px;
    }
    .dot {
        width: 36px;
        height: 36px;
    }
    h1 {
        font-size: 1.5rem;
    }
    .action-btn {
        padding: 6px 12px;
        font-size: 0.7rem;
    }
    .text-btn {
        padding: 6px 12px;
        font-size: 0.75rem;
    }
    .food-title {
        font-size: 1rem;
    }
    .progress-dots {
        gap: 10px;
    }
    .info-toggle {
        font-size: 1.5rem;
        padding: 2px 6px;
    }
}