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

@keyframes twinkle {
    0% { opacity: 0.3; }
    50% { opacity: 1; }
    100% { opacity: 0.3; }
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

.stars {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    background: linear-gradient(135deg, #1a2a6c, #b21f1f, #fdbb2d);
}

.stars::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(2px 2px at 20px 30px, #fff, rgba(0,0,0,0)),
        radial-gradient(2px 2px at 40px 70px, #fff, rgba(0,0,0,0)),
        radial-gradient(2px 2px at 50px 160px, #fff, rgba(0,0,0,0)),
        radial-gradient(2px 2px at 90px 40px, #fff, rgba(0,0,0,0)),
        radial-gradient(2px 2px at 130px 80px, #fff, rgba(0,0,0,0));
    background-repeat: repeat;
    background-size: 200px 200px;
    animation: twinkle 4s infinite;
}

body {
    font-family: 'Comic Neue', 'Microsoft YaHei', sans-serif;
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.game-header {
    text-align: center;
    margin-bottom: 30px;
    animation: float 6s ease-in-out infinite;
}

h1 {
    color: #fff;
    margin-bottom: 20px;
    font-size: 3em;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.game-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 20px;
}

.stat-item {
    background: rgba(255, 255, 255, 0.9);
    padding: 15px 25px;
    border-radius: 15px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: transform 0.3s;
}

.stat-item:hover {
    transform: translateY(-5px);
}

.stat-icon {
    font-size: 1.5em;
    margin-bottom: 5px;
}

.stat-label {
    color: #666;
    font-size: 0.9em;
}

.stat-value {
    font-size: 1.5em;
    font-weight: bold;
    color: #2c3e50;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.section-header h2 {
    color: #2c3e50;
    font-size: 1.8em;
    margin: 0;
}

.header-decoration {
    font-size: 1.5em;
    animation: float 3s ease-in-out infinite;
}

.import-options {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.manual-import, .file-import {
    flex: 1;
    background: rgba(255, 255, 255, 0.9);
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: transform 0.3s;
}

.manual-import:hover, .file-import:hover {
    transform: translateY(-5px);
}

.import-options h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.3em;
}

textarea {
    width: 100%;
    height: 150px;
    padding: 15px;
    margin-bottom: 15px;
    border: 2px solid #ddd;
    border-radius: 12px;
    resize: vertical;
    font-size: 16px;
    transition: all 0.3s;
    font-family: inherit;
}

textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 10px rgba(52, 152, 219, 0.3);
}

.game-button {
    background: linear-gradient(45deg, #3498db, #2980b9);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
}

.game-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.button-icon {
    font-size: 1.2em;
}

.file-upload {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.file-upload input[type="file"] {
    display: none;
}

.file-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(45deg, #3498db, #2980b9);
    color: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-family: inherit;
}

.file-label:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.file-icon {
    font-size: 1.2em;
}

.file-name {
    color: #666;
    font-size: 0.9em;
    word-break: break-all;
    text-align: center;
}

.file-format-info {
    font-size: 0.9em;
    color: #666;
    text-align: center;
    line-height: 1.4;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.info-icon {
    font-size: 1.2em;
}

.game-board {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin: 30px 0;
    perspective: 1000px;
}

.card {
    aspect-ratio: 3/4;
    background: white;
    border-radius: 15px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 24px;
    padding: 15px;
    text-align: center;
    user-select: none;
    position: relative;
    border: 3px solid transparent;
    overflow: hidden;
}

.card[data-type="word"] {
    font-family: 'Comic Neue', 'Arial', sans-serif;
    font-weight: bold;
    font-size: 28px;
    background: linear-gradient(135deg, #ff9a9e 0%, #fad0c4 100%);
    color: #2c3e50;
    position: relative;
}

.card[data-type="word"]::after {
    content: '🔊';
    position: absolute;
    top: 5px;
    right: 5px;
    font-size: 16px;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.card[data-type="word"]:hover::after {
    opacity: 1;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.card[data-type="meaning"] {
    font-family: 'Microsoft YaHei', sans-serif;
    font-size: 26px;
    background: linear-gradient(135deg, #a1c4fd 0%, #c2e9fb 100%);
    color: #2c3e50;
}

.card:nth-child(3n+1)[data-type="word"] {
    background: linear-gradient(135deg, #ff9a9e 0%, #fad0c4 100%);
}

.card:nth-child(3n+2)[data-type="word"] {
    background: linear-gradient(135deg, #d4fc79 0%, #96e6a1 100%);
}

.card:nth-child(3n+3)[data-type="word"] {
    background: linear-gradient(135deg, #fccb90 0%, #d57eeb 100%);
}

.card:nth-child(3n+1)[data-type="meaning"] {
    background: linear-gradient(135deg, #a1c4fd 0%, #c2e9fb 100%);
}

.card:nth-child(3n+2)[data-type="meaning"] {
    background: linear-gradient(135deg, #84fab0 0%, #8fd3f4 100%);
}

.card:nth-child(3n+3)[data-type="meaning"] {
    background: linear-gradient(135deg, #f6d365 0%, #fda085 100%);
}

.card:hover {
    transform: translateY(-5px) rotate(2deg);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
    filter: brightness(1.1);
}

.card.selected {
    border-color: #3498db;
    transform: scale(1.05);
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    filter: brightness(1.2);
}

.card.matched {
    transition: all 0.5s ease;
    opacity: 0.8;
    filter: saturate(0.8);
}

.card-content {
    position: relative;
    z-index: 1;
}

.emoji {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 40px;
    z-index: 2;
    animation: emojiPop 0.5s ease-out;
}

@keyframes emojiPop {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

.rules {
    background: rgba(255, 255, 255, 0.9);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.rules-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.rule-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 10px;
    transition: transform 0.3s;
}

.rule-item:hover {
    transform: translateX(5px);
}

.rule-icon {
    font-size: 1.5em;
}

.rule-text {
    color: #2c3e50;
    font-size: 1.1em;
}

.footer {
    text-align: center;
    padding: 20px;
    color: #2c3e50;
    font-size: 18px;
    border-top: 1px solid rgba(0,0,0,0.1);
    margin-top: 30px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.footer-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.footer-icon {
    font-size: 1.2em;
    animation: twinkle 2s infinite;
}

@media (max-width: 768px) {
    .game-stats {
        flex-direction: column;
        align-items: center;
    }
    
    .import-options {
        flex-direction: column;
    }
    
    .game-board {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }
    
    h1 {
        font-size: 2em;
    }
    
    .rules-content {
        grid-template-columns: 1fr;
    }
}

/* 控制按钮样式 */
#controls {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    gap: 10px;
}

#controls button {
    padding: 8px 15px;
    border-radius: 20px;
    color: white;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    font-size: 14px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

#controls button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

#controls button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

#speech-toggle {
    background: #2196F3;
}

#controls button:last-child {
    background: #4CAF50;
}

/* 响应式设计 - 在小屏幕上调整按钮位置 */
@media (max-width: 768px) {
    #controls {
        top: 10px;
        right: 10px;
        flex-direction: column;
        gap: 5px;
    }
    
    #controls button {
        padding: 6px 12px;
        font-size: 12px;
    }
}

/* 语音控制下拉菜单样式 */
.speech-control {
    position: relative;
    display: inline-block;
}

.speech-options {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    padding: 8px 0;
    margin-top: 5px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 10000;
    min-width: 140px;
}

.speech-control:hover .speech-options {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.accent-option {
    display: block;
    width: 100%;
    padding: 8px 15px;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    color: #333;
    font-size: 14px;
    transition: background-color 0.2s ease;
}

.accent-option:hover {
    background-color: #f5f5f5;
}

.accent-option.active {
    background-color: #e3f2fd;
    color: #1976d2;
    font-weight: bold;
}

/* 添加小箭头指示器 */
.speech-control::after {
    content: '▼';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    color: white;
    pointer-events: none;
    transition: transform 0.3s ease;
}

.speech-control:hover::after {
    transform: translateY(-50%) rotate(180deg);
}

.engine-option {
    display: block;
    width: 100%;
    padding: 8px 15px;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    color: #333;
    font-size: 14px;
    transition: background-color 0.2s ease;
}

.engine-option:hover {
    background-color: #f5f5f5;
}

.engine-option.active {
    background-color: #e8f5e8;
    color: #2e7d32;
    font-weight: bold;
}

.accent-separator {
    height: 1px;
    background-color: #e0e0e0;
    margin: 5px 0;
} 