/* 导航栏样式 */
.game-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: #f8f9fa;
    padding: 10px 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 1000;
}

.back-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    color: #4CAF50;
    text-decoration: none;
    font-weight: 500;
    border-radius: 20px;
    transition: all 0.3s ease;
}

.back-button:hover {
    background-color: #e8f5e9;
    transform: translateX(-5px);
}

.back-icon {
    font-size: 1.2em;
    line-height: 1;
}

/* 游戏容器样式 */
.game-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    color: #2c3e50;
    margin-bottom: 10px;
}

.info-button {
    background: #3498db;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 10px;
}

.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

#difficulty {
    padding: 5px 10px;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.game-board {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.word-chain {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    min-height: 50px;
}

.chain-word {
    background: #e8f4fc;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 16px;
    color: #2c3e50;
}

.current-word {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.last-char-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.last-char {
    width: 40px;
    height: 40px;
    background: #f1c40f;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
    font-weight: bold;
}

.input-container {
    display: flex;
    gap: 10px;
}

#wordInput {
    flex: 1;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
}

#submitWord {
    background: #2ecc71;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
}

.timer {
    text-align: center;
    font-size: 18px;
    color: #e74c3c;
    margin: 20px 0;
}

.word-choices {
    margin: 20px 0;
}

.suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.suggestion {
    background: #f0f2f5;
    padding: 5px 10px;
    border-radius: 15px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.suggestion:hover {
    background: #e2e5e9;
}

.button-container {
    display: flex;
    gap: 10px;
    margin: 20px 0;
}

.button-container button {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
}

#showHint {
    background: #3498db;
    color: white;
}

#skipWord {
    background: #95a5a6;
    color: white;
}

#nextLevel {
    background: #2ecc71;
    color: white;
}

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

.word-history {
    margin-top: 30px;
}

.word-history h3 {
    color: #2c3e50;
    margin-bottom: 10px;
}

.used-words {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.used-word {
    background: #f0f2f5;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 14px;
    color: #2c3e50;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: white;
    padding: 20px;
    border-radius: 10px;
    max-width: 500px;
    width: 90%;
    position: relative;
    animation: modalPopIn 0.3s ease-out;
}

.modal.success .modal-content {
    border-top: 5px solid #4CAF50;
}

.modal.info .modal-content {
    border-top: 5px solid #2196F3;
}

.modal-title {
    color: #333;
    font-size: 1.5em;
    margin-bottom: 15px;
    text-align: center;
}

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

.word-info {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.word-info h3 {
    color: #2c3e50;
    font-size: 2em;
    margin: 0 0 10px 0;
}

.word-info .pinyin {
    color: #666;
    font-size: 1.2em;
    margin: 5px 0;
}

.word-info .meaning {
    color: #333;
    margin: 10px 0;
}

.word-info .example {
    color: #666;
    font-style: italic;
    margin: 10px 0;
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 15px;
}

.stats p {
    background-color: #e9ecef;
    padding: 8px;
    border-radius: 5px;
    margin: 0;
}

.level-complete-content {
    text-align: center;
}

.level-complete-content h3 {
    color: #4CAF50;
    font-size: 1.8em;
    margin-bottom: 20px;
}

.level-stats {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.level-stats p {
    margin: 8px 0;
    color: #333;
}

.bonus-info {
    color: #4CAF50;
    font-weight: bold;
    margin: 15px 0;
}

.next-level-btn {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    font-size: 1.1em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.next-level-btn:hover {
    background-color: #45a049;
    transform: scale(1.05);
}

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

/* 按钮禁用状态 */
.button.disabled,
button[disabled] {
    background-color: #cccccc !important;
    cursor: not-allowed !important;
    opacity: 0.6;
}

.button.disabled:hover,
button[disabled]:hover {
    transform: none !important;
    box-shadow: none !important;
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.shake {
    animation: shake 0.5s ease-in-out;
}

/* 响应式设计 */
@media (max-width: 600px) {
    .game-container {
        padding: 10px;
    }

    .button-container {
        flex-direction: column;
    }

    button {
        width: 100%;
    }
}

.input-hint {
    color: #666;
    font-size: 0.9em;
    margin-top: 5px;
}

.input-error {
    color: #ff4444;
    font-size: 0.9em;
    margin-top: 5px;
    animation: shake 0.5s ease-in-out;
}

/* 消息样式 */
.message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    background: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
    animation: slideIn 0.3s ease-out;
    max-width: 80%;
}

.message.info {
    background-color: #e3f2fd;
    border-left: 4px solid #2196f3;
}

.message.error {
    background-color: #ffebee;
    border-left: 4px solid #f44336;
}

.message.warning {
    background-color: #fff3e0;
    border-left: 4px solid #ff9800;
}

.message.hint {
    background-color: #e8f5e9;
    border-left: 4px solid #4caf50;
}

.message.fade-out {
    animation: fadeOut 0.5s ease-out forwards;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* 成功弹窗样式 */
.success-content {
    padding: 20px;
    background: #f5f5f5;
    border-radius: 8px;
    margin: 10px 0;
}

.success-content p {
    margin: 8px 0;
    line-height: 1.5;
}

.success-content .word-info {
    font-size: 1.2em;
    color: #4caf50;
}

.success-content .stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #ddd;
}

/* 关卡完成样式 */
.level-complete-content {
    text-align: center;
    padding: 20px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin: 20px 0;
}

.stat-item {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
}

.stat-item h4 {
    margin: 0 0 10px 0;
    color: #666;
}

.stat-item p {
    margin: 0;
    font-size: 1.5em;
    color: #2196f3;
}

.next-level-button {
    margin-top: 20px;
}

.next-level-button button {
    padding: 10px 20px;
    font-size: 1.1em;
    background-color: #4caf50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.next-level-button button:hover {
    background-color: #45a049;
}
