* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 打字机效果 */
.keyword-text.typewriter {
    border-right: 2px solid #ff6b6b;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 50% {
        border-color: #ff6b6b;
    }
    51%, 100% {
        border-color: transparent;
    }
}

/* 响应式动画调整 */
@media (max-width: 768px) {
    .keyword-text {
        font-size: 2rem;
    }
    
    .keyword-display {
        padding: 15px;
    }
    
    .keyword-particles {
        width: 150px;
        height: 150px;
    }
    
    .particle {
        width: 3px;
        height: 3px;
    }
}

/* 性能优化：减少不必要的重绘 */
.keyword-text,
.keyword-text::before,
.keyword-text::after {
    will-change: transform, opacity;
}

/* 无障碍支持：减少动画 */
@media (prefers-reduced-motion: reduce) {
    .keyword-text,
    .keyword-display,
    .particle {
        animation: none !important;
        transition: none !important;
    }
    
    .keyword-text::before,
    .keyword-text::after {
        display: none;
    }
}

body {
    font-family: "Microsoft YaHei", sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* 动态背景 */
.background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    z-index: -1;
}

.background-animation::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 20% 80%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(255, 255, 255, 0.05) 0%, transparent 50%);
    animation: float 20s ease-in-out infinite;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    33% { transform: translateY(-20px) rotate(1deg); }
    66% { transform: translateY(-10px) rotate(-1deg); }
}

/* 屏幕切换 */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.5s ease;
    transform: translateY(20px);
}

.screen.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.container {
    max-width: 800px;
    width: 90%;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    text-align: center;
    animation: slideUp 0.8s ease;
}

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

/* 标题样式 */
.title {
    font-size: 4rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    background: linear-gradient(45deg, #fff, #f0f0f0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: titleGlow 3s ease-in-out infinite alternate;
}

@keyframes titleGlow {
    from { text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3); }
    to { text-shadow: 2px 2px 20px rgba(255, 255, 255, 0.5); }
}

.subtitle {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 3rem;
    letter-spacing: 2px;
}

/* 按钮样式 */
.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 25px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 0.5rem;
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.6);
}

.btn-secondary {
    background: linear-gradient(45deg, #74b9ff, #0984e3);
    color: white;
    box-shadow: 0 4px 15px rgba(116, 185, 255, 0.4);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(116, 185, 255, 0.6);
}

.btn-back {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 20px;
    font-size: 0.9rem;
    position: relative;
}

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

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

/* 游戏界面 */
.game-header {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    z-index: 10;
    min-height: 60px;
}

.status-indicator {
    background: rgba(255, 193, 7, 0.9);
    color: #856404;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid rgba(255, 193, 7, 0.3);
    animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

.status-indicator .status-text {
    display: flex;
    align-items: center;
}

.status-indicator .status-text::before {
    content: '●';
    margin-right: 5px;
    animation: statusBlink 1.5s ease-in-out infinite;
}

@keyframes statusBlink {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.score-display {
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
}

.score-display span {
    margin: 0 15px;
    padding: 8px 15px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.game-content {
    max-width: 800px;
    width: 90%;
    padding: 2rem;
    margin-top: 80px;
}

.keyword-display {
    text-align: center;
    margin-bottom: 3rem;
}

.keyword-display h2 {
    font-size: 2.5rem;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    margin-bottom: 1rem;
}

.keyword-text {
    color: #ff6b6b;
    font-size: 3rem;
    font-weight: 700;
    text-shadow: 2px 2px 8px rgba(255, 107, 107, 0.5);
    display: inline-block;
    position: relative;
    animation: keywordEntrance 2s ease-out;
}

.keyword-text::before {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    background: radial-gradient(circle, rgba(255, 107, 107, 0.3) 0%, transparent 70%);
    border-radius: 50%;
    animation: glowPulse 3s ease-in-out infinite;
    z-index: -1;
}

.keyword-text::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: sparkle 2s ease-out;
}

/* 关键字入场动画 */
@keyframes keywordEntrance {
    0% {
        opacity: 0;
        transform: scale(0.3) rotate(-180deg) translateY(-100px);
        filter: blur(10px);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.2) rotate(-90deg) translateY(-20px);
        filter: blur(2px);
    }
    80% {
        opacity: 1;
        transform: scale(0.95) rotate(0deg) translateY(0);
        filter: blur(0);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg) translateY(0);
        filter: blur(0);
    }
}

/* 光晕脉冲动画 */
@keyframes glowPulse {
    0%, 100% {
        opacity: 0.5;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.2);
    }
}

/* 闪光效果 */
@keyframes sparkle {
    0% {
        width: 0;
        height: 0;
        opacity: 1;
    }
    50% {
        width: 100px;
        height: 100px;
        opacity: 0.8;
    }
    100% {
        width: 200px;
        height: 200px;
        opacity: 0;
    }
}

/* 悬停时的额外效果 */
.keyword-text:hover {
    animation: keywordHover 0.6s ease-in-out;
    cursor: default;
}

@keyframes keywordHover {
    0%, 100% {
        transform: scale(1) rotate(0deg);
    }
    25% {
        transform: scale(1.1) rotate(-5deg);
    }
    75% {
        transform: scale(1.1) rotate(5deg);
    }
}

/* 粒子效果容器 */
.keyword-display {
    position: relative;
    overflow: visible;
    padding: 20px;
    border-radius: 15px;
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.1), rgba(76, 201, 196, 0.1));
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.keyword-display:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(255, 107, 107, 0.3);
}

/* 关键字容器动画已移除以避免与关键字入场动画重复 */

/* 彩虹文字效果 */
.keyword-text.rainbow {
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4, #feca57, #ff9ff3, #54a0ff);
    background-size: 400% 400%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: rainbowShift 3s ease-in-out infinite;
}

@keyframes rainbowShift {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

/* 震动效果 */
.keyword-text.shake {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* 弹跳效果 */
.keyword-text.bounce {
    animation: bounce 1s ease-in-out;
}

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

.keyword-particles {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200px;
    height: 200px;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: -1;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: #ff6b6b;
    border-radius: 50%;
    animation: particleFloat 3s ease-out infinite;
}

@keyframes particleFloat {
    0% {
        opacity: 1;
        transform: translate(0, 0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(var(--random-x, 0), var(--random-y, 0)) scale(0);
    }
}

.input-section {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 2rem;
    margin-bottom: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

#poem-input {
    width: 100%;
    min-height: 120px;
    padding: 1rem;
    border: none;
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.9);
    font-size: 1.1rem;
    font-family: 'Noto Serif SC', serif;
    resize: vertical;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

#poem-input:focus {
    outline: none;
    box-shadow: 0 0 20px rgba(255, 107, 107, 0.3);
    transform: scale(1.02);
}

.input-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* AI反馈 */
.ai-feedback {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    text-align: center;
    animation: fadeInUp 0.5s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ai-feedback h3 {
    color: white;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
}

.feedback-content {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-bottom: 2rem;
    justify-content: center;
}

.score-circle {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    box-shadow: 0 10px 30px rgba(255, 107, 107, 0.4);
    animation: scoreReveal 1s ease;
}

@keyframes scoreReveal {
    from {
        transform: scale(0) rotate(180deg);
        opacity: 0;
    }
    to {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.score-circle span {
    font-size: 2rem;
}

.score-circle small {
    font-size: 0.8rem;
    opacity: 0.8;
}

.feedback-text {
    flex: 1;
    text-align: left;
}

.feedback-text p {
    color: white;
    font-size: 1.1rem;
    line-height: 1.6;
    background: rgba(255, 255, 255, 0.1);
    padding: 1rem;
    border-radius: 10px;
    border-left: 4px solid #ff6b6b;
}

/* 设置界面 */
.settings-form {
    text-align: left;
    margin-top: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    color: white;
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    box-shadow: 0 0 15px rgba(116, 185, 255, 0.4);
    transform: scale(1.02);
}

.api-note {
    display: block;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
    margin-top: 0.5rem;
    font-style: italic;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.3rem 0.6rem;
    border-radius: 5px;
    border-left: 3px solid #ff6b6b;
}

/* 规则界面 */
.rules-content {
    text-align: left;
    color: white;
    margin-top: 2rem;
}

.rules-content h3 {
    color: #ff6b6b;
    font-size: 1.3rem;
    margin: 1.5rem 0 1rem 0;
    border-bottom: 2px solid rgba(255, 107, 107, 0.3);
    padding-bottom: 0.5rem;
}

.rules-content p,
.rules-content li {
    line-height: 1.8;
    margin-bottom: 0.8rem;
    font-size: 1.05rem;
}

.rules-content ul {
    padding-left: 1.5rem;
}

/* 结果界面 */
.final-score {
    margin: 2rem 0;
}

.score-display-large {
    font-size: 4rem;
    font-weight: 700;
    color: #ff6b6b;
    text-shadow: 2px 2px 8px rgba(255, 107, 107, 0.5);
    margin-bottom: 1rem;
    animation: finalScoreReveal 1.5s ease;
}

@keyframes finalScoreReveal {
    0% {
        transform: scale(0) rotate(360deg);
        opacity: 0;
    }
    70% {
        transform: scale(1.2) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.score-display-large small {
    font-size: 2rem;
    color: rgba(255, 255, 255, 0.7);
}

#final-comment {
    color: white;
    font-size: 1.2rem;
    margin-bottom: 2rem;
    font-style: italic;
}

.result-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* 加载动画 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    color: white;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #ff6b6b;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-overlay p {
    font-size: 1.2rem;
    margin-top: 1rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .title {
        font-size: 2.5rem;
    }
    
    .container {
        width: 95%;
        padding: 1.5rem;
    }
    
    .game-header {
        flex-direction: column;
        gap: 10px;
        padding: 15px;
        min-height: 80px;
    }
    
    .score-display {
        font-size: 0.9rem;
    }
    
    .score-display span {
        margin: 0 5px;
        padding: 6px 10px;
        font-size: 0.8rem;
    }
    
    .game-content {
        margin-top: 100px;
    }
    
    .keyword-display h2 {
        font-size: 1.8rem;
    }
    
    .keyword-display span {
        font-size: 2.2rem;
    }
    
    .feedback-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .feedback-text {
        text-align: center;
    }
    
    .result-buttons {
        flex-direction: column;
    }
    
    .input-buttons {
        flex-direction: column;
    }
    
    .btn-back {
        padding: 6px 16px;
        font-size: 0.8rem;
    }
}

/* 版权信息样式 */
.copyright {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    padding: 8px 0;
    text-align: center;
    z-index: 100;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.copyright p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85rem;
    margin: 0;
    letter-spacing: 1px;
    font-weight: 400;
}

/* 响应式版权信息 */
@media (max-width: 768px) {
    .copyright p {
        font-size: 0.75rem;
        padding: 0 10px;
    }
}