:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --text-color: #ecf0f1;
    --card-bg: rgba(255, 255, 255, 0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background: var(--primary-color);
    color: var(--text-color);
    min-height: 100vh;
    overflow-x: hidden;
}

.language-switch {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.lang-btn {
    background: transparent;
    border: 1px solid var(--text-color);
    color: var(--text-color);
    padding: 5px 10px;
    margin-left: 5px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.lang-btn.active {
    background: var(--text-color);
    color: var(--primary-color);
}

.container {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 2rem;
    position: relative;
    overflow-y: auto;
}

.polygon-background {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    padding: 3rem;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 800px;
    position: relative;
    overflow: visible;
    margin: 20px 0;
    display: flex;
    flex-direction: column;
}

.title-container {
    text-align: center;
    margin-bottom: 60px;
}

.main-title {
    font-size: 3.5rem;
    font-weight: 700;
    background: linear-gradient(45deg, #3498db, #e74c3c);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 20px;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    width: 100%;
    max-width: 1000px;
}

.feature-card {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 30px;
    text-decoration: none;
    color: var(--text-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

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

.card-content i {
    font-size: 2.5rem;
    margin-bottom: 15px;
    color: var(--secondary-color);
}

.card-title {
    font-size: 1.5rem;
    font-weight: 600;
}

.subtitle {
    font-size: 1.2rem;
    color: var(--text-color);
    opacity: 0.8;
    margin-top: 10px;
}

.generator-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.result-container {
    display: flex;
    gap: 20px;
    width: 100%;
    min-height: 300px;
}

.main-result {
    flex: 3;
}

.backup-result {
    flex: 1;
}

.result-box {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 15px;
    height: 100%;
    min-height: 300px;
    width: 100%;
    display: flex;
    flex-direction: column;
}

.result-box .word-combination {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
    justify-content: center;
}

.result-box .word-row {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.result-box .word {
    padding: 8px 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    min-width: 80px;
}

.result-box .word:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.settings-panel {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 30px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.setting-group {
    margin-bottom: 20px;
}

.setting-group:last-child {
    margin-bottom: 0;
}

.setting-group label {
    display: block;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.setting-group input[type="number"] {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-color);
    padding: 8px 12px;
    border-radius: 6px;
    width: 100px;
    font-size: 1rem;
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.error-message {
    color: var(--accent-color);
    font-size: 1.2rem;
    text-align: center;
}

.grid-container {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
}

.grid-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    color: var(--text-color);
    font-size: 1.1rem;
    font-weight: 500;
}

.input-group input {
    padding: 10px 15px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.input-group input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.15);
}

.nine-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    aspect-ratio: 1;
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 10px;
    position: relative;
}

.grid-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 15px;
    font-size: 1.8rem;
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    min-height: 80px;
}

.grid-cell:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.grid-cell.selected {
    background: rgba(52, 152, 219, 0.3);
    border: 2px solid #3498db;
}

.word-type-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.word-count-input {
    display: flex;
    align-items: center;
    gap: 10px;
}

.word-count-input label {
    margin-bottom: 0;
    white-space: nowrap;
}

.word-count-input input[type="number"] {
    width: 80px;
    margin: 0;
}

.word-type-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.word-type-btn {
    padding: 8px 16px;
    margin: 4px;
    border: 1px solid #ddd;
    border-radius: 20px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
}

.word-type-btn:hover {
    background: #f5f5f5;
    transform: translateY(-2px);
}

.word-type-btn.active {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    border-color: #2ecc71;
    color: white;
    box-shadow: 0 4px 15px rgba(46, 204, 113, 0.5),
                0 0 0 2px rgba(46, 204, 113, 0.3);
    transform: translateY(-1px);
    font-weight: 600;
    letter-spacing: 0.5px;
}

.word-type-btn.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0));
    pointer-events: none;
}

.button-group {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
}

.generate-btn {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.2rem;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.2);
    flex: 1;
}

.generate-btn:hover {
    background: linear-gradient(135deg, #5dade2, #3498db);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(52, 152, 219, 0.3);
}

.action-btn {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.2rem;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.2);
    flex: 1;
}

.action-btn:hover {
    background: linear-gradient(135deg, #5dade2, #3498db);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(52, 152, 219, 0.3);
}

.backup-result .word-combination {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
    justify-content: center;
}

.backup-result .word-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
    justify-content: center;
}

.backup-result .word {
    width: 100%;
    text-align: center;
}

.ai-result {
    margin-top: 30px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    min-height: 100px;
}

.ai-content {
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--text-color);
    white-space: pre-wrap;
}

.loading-dots {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 20px;
    z-index: 1;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    background-color: var(--text-color);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out;
}

.loading-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {
    0%, 80%, 100% { 
        transform: scale(0);
        opacity: 0.3;
    }
    40% { 
        transform: scale(1);
        opacity: 1;
    }
}

.word-count-select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-color);
    padding: 8px 12px;
    border-radius: 6px;
    width: 80px;
    font-size: 1rem;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
    padding-right: 32px;
}

.word-count-select:hover {
    background-color: rgba(255, 255, 255, 0.15);
}

.word-count-select:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.4);
    background-color: rgba(255, 255, 255, 0.2);
}

.word-count-select option {
    background: var(--primary-color);
    color: var(--text-color);
}

/* 响应式设计 */
@media screen and (max-width: 768px) {
    .container {
        padding: 10px;
        width: 100%;
        max-width: 100%;
        min-height: 100vh;
        align-items: flex-start;
        overflow-y: auto;
    }

    .polygon-background {
        padding: 20px;
        width: 100%;
        max-width: 100%;
        margin: 20px 0;
        min-height: auto;
    }

    .title-container {
        margin-bottom: 20px;
    }

    .main-title {
        font-size: 24px;
    }

    .subtitle {
        font-size: 14px;
    }

    .generator-container {
        padding: 15px;
        gap: 15px;
    }

    .nine-grid {
        width: 100%;
        max-width: 300px;
        gap: 5px;
        margin: 0 auto;
        aspect-ratio: 1;
    }

    .grid-cell {
        padding: 8px;
        font-size: 14px;
        min-height: 60px;
    }

    .button-group {
        flex-direction: column;
        gap: 10px;
        margin-top: 20px;
        width: 100%;
        max-width: 300px;
        margin-left: auto;
        margin-right: auto;
    }

    .generate-btn, .action-btn {
        width: 100%;
        padding: 10px;
    }
}

@media screen and (max-width: 480px) {
    .container {
        padding: 5px;
    }

    .polygon-background {
        padding: 15px;
        margin: 10px 0;
    }

    .main-title {
        font-size: 20px;
    }

    .subtitle {
        font-size: 12px;
    }

    .generator-container {
        padding: 10px;
        gap: 10px;
    }

    .nine-grid {
        max-width: 250px;
        gap: 3px;
    }

    .grid-cell {
        padding: 6px;
        font-size: 12px;
        min-height: 50px;
    }

    .button-group {
        gap: 8px;
        max-width: 250px;
    }

    .generate-btn, .action-btn {
        padding: 8px;
        font-size: 14px;
    }
}

@media (max-width: 768px) {
    .main-title {
        font-size: 2.5rem;
    }
    
    .feature-grid {
        grid-template-columns: 1fr;
    }
    
    .polygon-background {
        padding: 20px;
    }
    
    .word {
        font-size: 1.5rem;
    }
    
    .generate-btn {
        padding: 12px 30px;
        font-size: 1rem;
    }
    
    .settings-panel {
        padding: 15px;
    }
    
    .checkbox-group {
        flex-direction: column;
        gap: 10px;
    }
    
    .nine-grid {
        max-width: 100%;
        gap: 5px;
    }
    
    .grid-cell {
        font-size: 1rem;
        padding: 10px;
        min-height: 80px;
    }
}

.backup-result .setting-group {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 15px;
    height: 40px;
}

.backup-result .setting-group label {
    margin-bottom: 0;
    font-size: 1.1rem;
    font-weight: 500;
    line-height: 1;
}

.backup-result .result-box {
    display: flex;
    flex-direction: column;
    min-height: 200px;
}

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

.alert-content {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: relative;
    min-width: 300px;
    text-align: center;
}

.alert-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #666;
}

.alert-close:hover {
    color: #333;
}

#alertMessage {
    display: block;
    margin: 10px 0;
    color: #333;
    font-size: 16px;
} 