/* 天天练字功能样式 */

/* CSS变量定义（如果base.html中没有定义） */
:root {
    --deepseek-primary: #0066ff;
    --deepseek-primary-dark: #0052cc;
    --deepseek-secondary: #f5f8ff;
    --deepseek-tertiary: #e5edff;
    --deepseek-text-primary: #1a1a1a;
    --deepseek-text-secondary: #666666;
    --deepseek-border: #e6e6e6;
    --deepseek-shadow: rgba(0, 102, 255, 0.1);
    --deepseek-shadow-heavy: rgba(0, 102, 255, 0.15);
}

/* 基础容器 */
.handwriting-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* 头部样式 */
.handwriting-header {
    text-align: center;
    margin-bottom: 2rem;
}

.handwriting-header h1 {
    font-size: 2.5rem;
    color: var(--deepseek-primary);
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.handwriting-header .subtitle {
    font-size: 1.2rem;
    color: var(--deepseek-text-secondary);
    margin-bottom: 0;
}

/* 用户选择区域 */
.user-selection {
    margin-top: 2rem;
}

.users-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.user-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 12px var(--deepseek-shadow);
    cursor: pointer !important;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    text-align: center;
    user-select: none;
}

.user-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px var(--deepseek-shadow-heavy);
    border-color: var(--deepseek-primary);
}

.user-avatar {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

.user-name {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--deepseek-text-primary);
    margin-bottom: 0.5rem;
}

.user-score {
    font-size: 1.1rem;
    color: var(--deepseek-primary);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.user-last-played {
    font-size: 0.9rem;
    color: var(--deepseek-text-secondary);
}

/* 管理员区域 */
.admin-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--deepseek-border);
    text-align: center;
}

.admin-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--deepseek-secondary);
    color: var(--deepseek-primary);
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.admin-link:hover {
    background: var(--deepseek-primary);
    color: white;
    transform: translateY(-2px);
}

/* 关卡选择页面 */
.level-selection {
    margin-top: 2rem;
}

.levels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.level-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 12px var(--deepseek-shadow);
    cursor: pointer !important;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    user-select: none;
}

.level-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px var(--deepseek-shadow-heavy);
    border-color: var(--deepseek-primary);
}

.level-card.completed {
    border-color: #28a745;
    background: linear-gradient(135deg, #f8fff9 0%, #e8f5e8 100%);
}

.level-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--deepseek-text-primary);
    margin-bottom: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.level-description {
    font-size: 0.9rem;
    color: var(--deepseek-text-secondary);
    margin-bottom: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.level-characters {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.character-tag {
    background: var(--deepseek-secondary);
    color: var(--deepseek-primary);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 500;
}

.character-tag.more-indicator {
    background: #4dabf7;
    color: white;
    font-weight: 600;
    border: 2px solid #339af0;
}

.level-progress {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--deepseek-text-secondary);
}

.stars {
    display: flex;
    gap: 0.25rem;
}

.star {
    color: #ffc107;
    font-size: 1rem;
}

.star.empty {
    color: #e0e0e0;
}

/* 用户信息栏 */
.user-info-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px var(--deepseek-shadow);
    margin-bottom: 2rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info .avatar {
    font-size: 1.5rem;
}

.user-info .name {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--deepseek-text-primary);
}

.user-info .score {
    font-size: 1rem;
    color: var(--deepseek-primary);
    font-weight: 500;
}

.switch-user-btn {
    padding: 0.5rem 1rem;
    background: var(--deepseek-secondary);
    color: var(--deepseek-primary);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.switch-user-btn:hover {
    background: var(--deepseek-primary);
    color: white;
}

/* 练习界面 */
.practice-container {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2rem;
    margin-top: 2rem;
}

.practice-main {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 12px var(--deepseek-shadow);
}

.practice-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.sidebar-section {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px var(--deepseek-shadow);
}

.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--deepseek-text-primary);
    margin-bottom: 1rem;
}

/* 田字格区域 */
.grid-container {
    position: relative;
    width: 500px;
    height: 500px;
    margin: 0 auto;
    background: #c8ffc8;
    border: 4px solid #96c896;
    border-radius: 8px;
}

.grid-container::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: #96c896;
    transform: translateY(-50%);
}

.grid-container::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #96c896;
    transform: translateX(-50%);
}

/* 汉字列表 */
.characters-list {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    justify-content: center;
    flex-wrap: wrap;
}

.character-item {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 600;
    transition: all 0.3s ease;
    cursor: pointer !important;
    user-select: none;
}

.character-item:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.character-item:active {
    transform: scale(0.95);
}

.character-item.current {
    background: #fff3cd;
    color: #856404;
    border: 2px solid #ffc107;
    animation: pulse 1.5s ease-in-out infinite;
}

.character-item.completed {
    background: #d4edda;
    color: #155724;
    border: 2px solid #28a745;
}

.character-item.pending {
    background: #f8f9fa;
    color: #6c757d;
    border: 2px solid #dee2e6;
}

/* 当前字符的脉冲动画 */
@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.7);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(255, 193, 7, 0);
    }
}

/* 控制按钮 */
.control-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}

.control-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.control-btn.primary {
    background: var(--deepseek-primary);
    color: white;
}

.control-btn.primary:hover {
    background: var(--deepseek-primary-dark);
}

.control-btn.secondary {
    background: var(--deepseek-secondary);
    color: var(--deepseek-primary);
}

.control-btn.secondary:hover {
    background: var(--deepseek-primary);
    color: white;
}

.control-btn.danger {
    background: #dc3545;
    color: white;
}

.control-btn.danger:hover {
    background: #c82333;
}

/* 关卡选择状态 */
.level-status {
    font-size: 0.85rem;
    margin-left: 0.5rem;
}

/* 植物成长系统 */
.plant-growth-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border: 2px solid var(--deepseek-primary);
    z-index: 1000;
    min-width: 120px;
}

.plant-pot {
    text-align: center;
    margin-bottom: 10px;
}

.plant-img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    transition: all 0.3s ease;
}

.plant-img:hover {
    transform: scale(1.1);
}

.plant-info {
    text-align: center;
    font-size: 0.8rem;
    color: var(--deepseek-text-primary);
}

.plant-level {
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--deepseek-primary);
}

.progress-container {
    margin-top: 8px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background-color: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 4px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #0066ff, #4dabf7);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    color: var(--deepseek-text-secondary);
    font-size: 0.7rem;
    text-align: center;
}

/* 水滴积分动画 */
.drop-animation {
    position: fixed;
    color: #0066ff;
    font-size: 1.2rem;
    font-weight: bold;
    pointer-events: none;
    z-index: 1001;
    animation: dropToPlant 2s ease-out forwards;
}

@keyframes dropToPlant {
    0% {
        opacity: 1;
        transform: scale(1) translate(0, 0);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.2) translate(calc(var(--end-x) * 0.5), calc(var(--end-y) * 0.5));
    }
    100% {
        opacity: 0;
        transform: scale(0.8) translate(var(--end-x), var(--end-y));
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .handwriting-container {
        padding: 1rem;
    }
    
    .handwriting-header h1 {
        font-size: 2rem;
    }
    
    .users-grid,
    .levels-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .practice-container {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .grid-container {
        width: 300px;
        height: 300px;
    }
    
    .user-info-bar {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .characters-list {
        gap: 0.5rem;
    }
    
    .character-item {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
    
    .control-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .control-btn {
        width: 100%;
        max-width: 200px;
    }
}

@media (max-width: 480px) {
    .grid-container {
        width: 250px;
        height: 250px;
    }
    
    .character-item {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }
}
