* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Nunito', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
    user-select: none;
}

/* 顶部导航 */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    color: #fff;
}

.back-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    padding: 10px 15px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background 0.3s;
    text-decoration: none;
}

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

.level-info {
    text-align: center;
}

.level-info h1 {
    font-size: 1.3rem;
    font-weight: 700;
}

.level-info p {
    font-size: 0.85rem;
    opacity: 0.8;
}

.hint-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    padding: 10px 15px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background 0.3s;
}

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

.hint-count {
    background: #FFD700;
    color: #333;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.85rem;
}

/* 游戏主区域 */
.game-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 10px 20px 20px;
    max-width: 500px;
    margin: 0 auto;
    width: 100%;
}

/* 单词展示区 */
.words-area {
    background: rgba(255,255,255,0.95);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.words-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.word-row {
    display: flex;
    justify-content: center;
    gap: 6px;
}

.word-cell {
    width: 38px;
    height: 38px;
    background: #e8e8e8;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 700;
    color: #333;
    transition: all 0.3s ease;
}

.word-cell.revealed {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.word-cell.hint {
    background: #FFD700;
    color: #333;
}

/* 额外单词区域 */
.bonus-area {
    background: rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 10px 15px;
    margin-bottom: 15px;
    text-align: center;
}

.bonus-label {
    color: rgba(255,255,255,0.8);
    font-size: 0.85rem;
    margin-bottom: 5px;
}

.bonus-words {
    color: #FFD700;
    font-weight: 700;
    font-size: 1.1rem;
}

/* 当前输入显示 */
.current-word {
    background: rgba(255,255,255,0.95);
    border-radius: 16px;
    padding: 15px 25px;
    margin-bottom: 15px;
    text-align: center;
    min-height: 55px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

.current-word-text {
    font-size: 1.8rem;
    font-weight: 800;
    color: #667eea;
    letter-spacing: 4px;
}

/* 字母转盘区域 */
.wheel-area {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.letter-wheel {
    position: relative;
    width: 280px;
    height: 280px;
}

.wheel-bg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 260px;
    height: 260px;
    background: rgba(255,255,255,0.15);
    border-radius: 50%;
}

.letter-btn {
    position: absolute;
    width: 60px;
    height: 60px;
    background: #fff;
    border: none;
    border-radius: 50%;
    font-size: 1.6rem;
    font-weight: 800;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.letter-btn:hover {
    transform: scale(1.1);
}

.letter-btn.selected {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    transform: scale(1.15);
}

.letter-btn.disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* 连线画布 */
.line-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

/* 操作按钮 */
.action-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 15px;
}

.action-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    padding: 12px 25px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

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

.action-btn.shuffle {
    background: rgba(255,255,255,0.25);
}

.action-btn.submit {
    background: linear-gradient(135deg, #4CAF50, #45a049);
}

/* 成功弹窗 */
.success-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.success-modal.active {
    display: flex;
}

.success-content {
    background: #fff;
    border-radius: 24px;
    padding: 40px 30px;
    text-align: center;
    max-width: 350px;
    width: 100%;
    animation: popIn 0.3s ease;
}

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

.success-icon {
    font-size: 4rem;
    margin-bottom: 15px;
}

.success-title {
    font-size: 1.8rem;
    font-weight: 800;
    color: #333;
    margin-bottom: 10px;
}

.success-subtitle {
    color: #666;
    margin-bottom: 25px;
}

.success-stats {
    display: flex;
    justify-content: space-around;
    margin-bottom: 25px;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 12px;
}

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

.success-stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: #667eea;
}

.success-stat-label {
    font-size: 0.8rem;
    color: #888;
}

.success-btn {
    display: block;
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    margin-bottom: 10px;
}

.success-btn.secondary {
    background: #f0f0f0;
    color: #333;
}

/* 消息提示 */
.toast {
    position: fixed;
    top: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: rgba(0,0,0,0.8);
    color: #fff;
    padding: 12px 25px;
    border-radius: 25px;
    font-weight: 600;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1001;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.success {
    background: linear-gradient(135deg, #4CAF50, #45a049);
}

.toast.error {
    background: linear-gradient(135deg, #f44336, #d32f2f);
}

.toast.bonus {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #333;
}

/* 响应式 */
@media (max-width: 380px) {
    .letter-wheel {
        width: 240px;
        height: 240px;
    }

    .wheel-bg {
        width: 220px;
        height: 220px;
    }

    .letter-btn {
        width: 50px;
        height: 50px;
        font-size: 1.4rem;
    }

    .word-cell {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }
}

@media (min-height: 800px) {
    .game-container {
        padding-top: 20px;
    }

    .words-area {
        padding: 25px;
    }
}
