/* 主题卡片样式 */
.theme-card {
    background: var(--transparent-white);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.theme-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.theme-card.locked {
    opacity: 0.7;
    cursor: not-allowed;
}

.theme-card.locked:hover {
    transform: none;
    box-shadow: var(--shadow-sm);
}

.theme-icon {
    width: 48px;
    height: 48px;
    margin-bottom: var(--spacing-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-2xl);
}

.theme-name {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--dark-gray);
    margin-bottom: var(--spacing-sm);
}

.theme-progress {
    width: 100%;
    height: 6px;
    background: var(--light-gray);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: var(--spacing-sm);
}

.progress-bar {
    height: 100%;
    background: var(--gradient-nature);
    border-radius: 3px;
    transition: width var(--transition-slow);
}

.progress-text {
    font-size: var(--font-size-xs);
    color: var(--gray);
    font-weight: 500;
}

.theme-cost {
    position: absolute;
    top: var(--spacing-sm);
    right: var(--spacing-sm);
    background: var(--primary-yellow);
    color: var(--dark-gray);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    font-weight: 700;
}

.theme-cost::before {
    content: "🪙";
    margin-right: 2px;
}

.theme-hint {
    position: absolute;
    bottom: var(--spacing-sm);
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-green);
    color: white;
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    font-weight: 500;
    opacity: 0.9;
    white-space: nowrap;
}

/* 词语列表样式 */
.word-item {
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 600;
    transition: all var(--transition-fast);
    cursor: pointer;
    user-select: none;
    background: var(--white);
    color: var(--dark-gray);
    margin-bottom: var(--spacing-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--light-gray);
    box-shadow: var(--shadow-sm);
    text-align: center;
    position: relative;
}

.word-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-orange);
}

.word-item.found {
    background: var(--light-gray);
    color: var(--dark-gray);
    transform: none;
    box-shadow: var(--shadow-sm);
    border-color: var(--primary-green);
}

.word-item.found::after {
    content: "✓";
    position: absolute;
    right: var(--spacing-sm);
    font-weight: 800;
    color: var(--primary-green);
}

.word-item.current {
    background: var(--primary-yellow);
    color: var(--dark-gray);
    transform: scale(1.1);
    box-shadow: var(--shadow-md);
}

.word-item:not(.found):not(.current) {
    color: var(--dark-gray);
}

.word-text {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--dark-gray);
    line-height: 1.2;
    letter-spacing: 0.3px;
}

.word-item.found .word-text {
    color: var(--primary-green);
    text-decoration: line-through;
}

/* 词语搜索网格样式 */
.word-grid {
    display: grid;
    gap: 3px;
    background: linear-gradient(135deg, var(--white) 0%, var(--light-gray) 100%);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.1),
        0 4px 16px rgba(0, 0, 0, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    max-width: 100%;
    max-height: 100%;
    margin: 0 auto;
    border: 2px solid var(--primary-blue);
    position: relative;
    overflow: hidden;
}

.word-grid::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(59, 130, 246, 0.05) 50%, transparent 70%);
    pointer-events: none;
    z-index: 1;
}

/* 网格大小自适应 */
.word-grid.size-8 { grid-template-columns: repeat(8, 1fr); }
.word-grid.size-10 { grid-template-columns: repeat(10, 1fr); }
.word-grid.size-12 { grid-template-columns: repeat(12, 1fr); }
.word-grid.size-15 { grid-template-columns: repeat(15, 1fr); }

.grid-cell {
    width: 42px;
    height: 42px;
    border: 2px solid var(--light-gray);
    background: linear-gradient(145deg, var(--white) 0%, var(--light-gray) 100%);
    color: var(--dark-gray);
    font-size: var(--font-size-xl);
    font-weight: 800;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    position: relative;
    z-index: 2;
}

.grid-cell:hover {
    background: linear-gradient(145deg, var(--primary-blue) 0%, var(--primary-blue-dark) 100%);
    color: var(--white);
    transform: scale(1.08);
    border-color: var(--primary-blue);
    box-shadow: 
        0 4px 16px rgba(59, 130, 246, 0.4),
        0 2px 8px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    z-index: 3;
}

.grid-cell.selected {
    background: linear-gradient(145deg, var(--primary-yellow) 0%, var(--primary-orange) 100%);
    color: var(--dark-gray);
    transform: scale(1.15);
    border-color: var(--primary-orange);
    box-shadow: 
        0 6px 20px rgba(245, 158, 11, 0.4),
        0 3px 12px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    z-index: 4;
    animation: selected-pulse 0.6s ease-in-out;
}

.grid-cell.found {
    background: linear-gradient(145deg, var(--primary-green) 0%, var(--primary-green-dark) 100%);
    color: var(--white);
    transform: scale(1.05);
    border-color: var(--primary-green);
    box-shadow: 
        0 4px 16px rgba(34, 197, 94, 0.4),
        0 2px 8px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    z-index: 3;
    animation: found-celebration 0.8s ease-out;
}

/* 词语高亮样式 */
.word-highlight {
    position: absolute;
    background: linear-gradient(90deg, var(--primary-blue) 0%, var(--primary-blue-dark) 100%);
    border-radius: var(--radius-sm);
    opacity: 0.9;
    pointer-events: none;
    z-index: 15;
    animation: highlight-appear 0.4s ease-out;
    box-shadow: 
        0 4px 16px rgba(59, 130, 246, 0.6),
        0 2px 8px rgba(0, 0, 0, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.8);
}

.word-highlight.horizontal {
    height: 10px;
    border-radius: 5px;
    background: linear-gradient(90deg, var(--primary-blue) 0%, var(--primary-blue-dark) 50%, var(--primary-blue) 100%);
}

.word-highlight.vertical {
    width: 10px;
    border-radius: 5px;
    background: linear-gradient(180deg, var(--primary-blue) 0%, var(--primary-blue-dark) 50%, var(--primary-blue) 100%);
}

.word-highlight.diagonal {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--primary-blue) 0%, var(--primary-blue-dark) 70%, var(--primary-blue) 100%);
    box-shadow: 
        0 6px 20px rgba(59, 130, 246, 0.8),
        0 3px 12px rgba(0, 0, 0, 0.3);
}

@keyframes highlight-appear {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 0.8;
        transform: scale(1);
    }
}

@keyframes selected-pulse {
    0%, 100% {
        transform: scale(1.15);
    }
    50% {
        transform: scale(1.25);
    }
}

@keyframes found-celebration {
    0% {
        transform: scale(1.05) rotate(0deg);
    }
    25% {
        transform: scale(1.2) rotate(5deg);
    }
    50% {
        transform: scale(1.15) rotate(-5deg);
    }
    75% {
        transform: scale(1.1) rotate(3deg);
    }
    100% {
        transform: scale(1.05) rotate(0deg);
    }
}

/* 完成界面样式 */
.completion-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fade-in 0.3s ease-out;
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.completion-content {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: var(--spacing-2xl);
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: var(--shadow-lg);
    animation: slide-up 0.4s ease-out;
}

@keyframes slide-up {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.completion-content h2 {
    color: var(--primary-green);
    font-size: var(--font-size-2xl);
    font-weight: 800;
    margin-bottom: var(--spacing-md);
}

.completion-content p {
    color: var(--gray);
    font-size: var(--font-size-lg);
    margin-bottom: var(--spacing-xl);
}

.completion-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
}

.stat-item {
    text-align: center;
}

.stat-label {
    display: block;
    color: var(--gray);
    font-size: var(--font-size-sm);
    margin-bottom: var(--spacing-xs);
}

.stat-value {
    display: block;
    color: var(--dark-gray);
    font-size: var(--font-size-xl);
    font-weight: 700;
}

.completion-actions {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.completion-actions .btn {
    width: 100%;
    padding: var(--spacing-md);
    font-size: var(--font-size-md);
}

/* 设置界面样式 */
.settings-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.settings-content {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: var(--spacing-2xl);
    max-width: 400px;
    width: 90%;
    box-shadow: var(--shadow-lg);
}

.settings-content h2 {
    color: var(--dark-gray);
    font-size: var(--font-size-xl);
    font-weight: 700;
    margin-bottom: var(--spacing-xl);
    text-align: center;
}

.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md) 0;
    border-bottom: 1px solid var(--light-gray);
}

.setting-item:last-of-type {
    border-bottom: none;
}

.setting-item label {
    color: var(--dark-gray);
    font-size: var(--font-size-md);
    font-weight: 500;
}

.setting-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary-orange);
}

.setting-item select {
    padding: var(--spacing-sm);
    border: 2px solid var(--light-gray);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-md);
    background: var(--white);
    color: var(--dark-gray);
}

.setting-item select:focus {
    outline: none;
    border-color: var(--primary-orange);
}

.settings-content .btn {
    width: 100%;
    margin-top: var(--spacing-lg);
}

/* 提示样式 */
.hint-indicator {
    position: absolute;
    background: var(--primary-yellow);
    color: var(--dark-gray);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    font-weight: 700;
    z-index: 20;
    pointer-events: none;
    animation: hint-bounce 0.6s ease-in-out;
}

@keyframes hint-bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

/* 错误提示样式 */
.error-message {
    background: #FF6B6B;
    color: var(--white);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 600;
    text-align: center;
    margin: var(--spacing-sm) 0;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* 成功提示样式 */
.success-message {
    background: var(--primary-green);
    color: var(--white);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 600;
    text-align: center;
    margin: var(--spacing-sm) 0;
    animation: success-pop 0.5s ease-out;
}

@keyframes success-pop {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* 加载动画样式 */
.loading-dots {
    display: inline-block;
}

.loading-dots::after {
    content: '';
    animation: dots 1.5s steps(5, end) infinite;
}

@keyframes dots {
    0%, 20% { content: ''; }
    40% { content: '.'; }
    60% { content: '..'; }
    80%, 100% { content: '...'; }
}

/* 响应式组件调整 */
@media (max-width: 768px) {
    .theme-card {
        min-height: 100px;
        padding: var(--spacing-sm);
    }
    
    .theme-icon {
        width: 36px;
        height: 36px;
        font-size: var(--font-size-xl);
    }
    
    .theme-name {
        font-size: var(--font-size-xs);
    }
    
    .grid-cell {
        width: 35px;
        height: 35px;
        font-size: var(--font-size-md);
    }
    
    .completion-content {
        padding: var(--spacing-xl);
        margin: var(--spacing-md);
    }
    
    .completion-stats {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }
}

@media (max-width: 480px) {
    .theme-card {
        min-height: 80px;
    }
    
    .theme-icon {
        width: 32px;
        height: 32px;
        font-size: var(--font-size-lg);
    }
    
    .grid-cell {
        width: 30px;
        height: 30px;
        font-size: var(--font-size-sm);
    }
    
    .completion-content {
        padding: var(--spacing-lg);
    }
    
    .completion-content h2 {
        font-size: var(--font-size-xl);
    }
}
