* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #f0c419 0%, #f39c12 50%, #e67e22 100%);
    min-height: 100vh;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: moveBackground 20s linear infinite;
    pointer-events: none;
}

@keyframes moveBackground {
    0% { transform: translate(0, 0); }
    100% { transform: translate(50px, 50px); }
}

.container {
    max-width: 950px;
    margin: 0 auto;
    background: white;
    border-radius: 24px;
    padding: 0;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    position: relative;
}

.header {
    background: linear-gradient(135deg, #f0c419 0%, #f39c12 100%);
    padding: 40px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, rgba(255,255,255,0.2) 0%, transparent 70%);
    animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.logo {
    font-size: 4em;
    margin-bottom: 10px;
    animation: bounce 2s ease-in-out infinite;
    position: relative;
    z-index: 1;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

h1 {
    color: white;
    text-align: center;
    margin-bottom: 10px;
    font-size: 2.5em;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 1;
}

.subtitle {
    text-align: center;
    color: rgba(255, 255, 255, 0.95);
    font-size: 1.1em;
    font-weight: 500;
    position: relative;
    z-index: 1;
}

.input-section {
    background: linear-gradient(to bottom, #fafafa 0%, #f5f5f5 100%);
    padding: 40px;
    border-radius: 0;
    margin-bottom: 0;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* 单词长度选择器 */
.length-selector {
    margin-bottom: 30px;
}

.length-selector label {
    display: block;
    margin-bottom: 12px;
    color: #333;
    font-weight: 600;
    font-size: 16px;
}

.length-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.length-btn {
    padding: 10px 20px;
    border: 2px solid #ddd;
    background: white;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    color: #666;
}

.length-btn:hover {
    border-color: #f39c12;
    color: #f39c12;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.length-btn.active {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    border-color: #f39c12;
    color: white;
    box-shadow: 0 4px 12px rgba(243, 156, 18, 0.4);
}

/* 字母组 */
.letter-group {
    margin-bottom: 25px;
}

.group-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.color-indicator {
    width: 20px;
    height: 20px;
    border-radius: 4px;
}

.color-indicator.green {
    background: #6aaa64;
}

.color-indicator.yellow {
    background: #c9b458;
}

.color-indicator.gray {
    background: #787c7e;
}

.group-header label {
    color: #333;
    font-weight: 600;
    font-size: 15px;
}

/* 字母输入框 */
.letter-boxes {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.letter-box {
    width: 50px;
    height: 50px;
    border: 2px solid #d3d6da;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    text-transform: uppercase;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.letter-box:hover {
    border-color: #878a8c;
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.letter-box.green {
    background: #6aaa64;
    border-color: #6aaa64;
    color: white;
    box-shadow: 0 3px 8px rgba(106, 170, 100, 0.3);
}

.letter-box.yellow {
    background: #c9b458;
    border-color: #c9b458;
    color: white;
    box-shadow: 0 3px 8px rgba(201, 180, 88, 0.3);
}

.letter-box input {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    text-align: center;
    font-size: 24px;
    font-weight: bold;
    text-transform: uppercase;
    color: inherit;
    outline: none;
}

.letter-box.empty {
    background: #f8f9fa;
}

.position-label {
    position: absolute;
    top: -8px;
    left: 2px;
    font-size: 10px;
    color: #999;
    font-weight: normal;
}

/* 灰色字母输入 */
.gray-input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #d3d6da;
    border-radius: 8px;
    font-size: 16px;
    text-transform: uppercase;
    transition: border-color 0.3s;
}

.gray-input:focus {
    outline: none;
    border-color: #787c7e;
}

/* 操作按钮 */
.action-buttons {
    display: flex;
    gap: 12px;
    margin-top: 30px;
}

.action-buttons button {
    flex: 1;
    padding: 14px 30px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #6aaa64 0%, #5a9454 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(106, 170, 100, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5a9454 0%, #4a8444 100%);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(106, 170, 100, 0.5);
}

.btn-secondary {
    background: linear-gradient(135deg, #95a5a6 0%, #7f8c8d 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(120, 124, 126, 0.3);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #7f8c8d 0%, #6c7a7b 100%);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(120, 124, 126, 0.4);
}

/* 结果区域 */
.results-section {
    padding: 30px 40px 40px;
    background: white;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 3px solid #f0f0f0;
}

.results-header h2 {
    color: #333;
    font-size: 1.6em;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.results-header h2::before {
    content: '📋';
    font-size: 1.2em;
}

.result-count {
    color: #666;
    font-size: 15px;
    background: linear-gradient(135deg, #f0c419 0%, #f39c12 100%);
    padding: 8px 16px;
    border-radius: 20px;
    color: white;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(243, 156, 18, 0.3);
}

#resultCount {
    color: white;
    font-weight: bold;
    font-size: 16px;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    max-height: 500px;
    overflow-y: auto;
    padding: 20px;
    background: linear-gradient(to bottom, #fafafa 0%, #f5f5f5 100%);
    border-radius: 12px;
    border: 2px solid #e8e8e8;
}

.word-item {
    background: white;
    padding: 14px 12px;
    border-radius: 10px;
    text-align: center;
    font-weight: 600;
    color: #333;
    border: 2px solid #e0e0e0;
    transition: all 0.3s;
    cursor: pointer;
    font-size: 14px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}

.word-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(243, 156, 18, 0.2), transparent);
    transition: left 0.5s;
}

.word-item:hover::before {
    left: 100%;
}

.word-item:hover {
    border-color: #f39c12;
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 6px 16px rgba(243, 156, 18, 0.3);
    color: #f39c12;
}

/* 滚动条样式 */
.results-grid::-webkit-scrollbar {
    width: 8px;
}

.results-grid::-webkit-scrollbar-track {
    background: #e0e0e0;
    border-radius: 10px;
}

.results-grid::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    border-radius: 10px;
}

.results-grid::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #e67e22 0%, #d35400 100%);
}

/* 加载动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.container {
    animation: fadeIn 0.6s ease-out;
}

/* 响应式设计 */
@media (max-width: 600px) {
    body {
        padding: 10px;
    }
    
    .header {
        padding: 30px 20px;
    }
    
    .logo {
        font-size: 3em;
    }
    
    h1 {
        font-size: 1.8em;
    }
    
    .subtitle {
        font-size: 0.95em;
    }
    
    .input-section {
        padding: 25px 20px;
    }
    
    .results-section {
        padding: 25px 20px;
    }
    
    .length-buttons {
        gap: 6px;
    }
    
    .length-btn {
        padding: 8px 16px;
        font-size: 14px;
    }
    
    .letter-box {
        width: 45px;
        height: 45px;
        font-size: 20px;
    }
    
    .results-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        padding: 15px;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .results-header h2 {
        font-size: 1.3em;
    }
}
