/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    width: 100%;
    overflow-x: hidden;
}

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

/* 头部样式 */
header {
    text-align: center;
    margin-bottom: 30px;
    position: relative;
}

header h1 {
    font-size: 2.5rem;
    color: #2c3e50;
    margin-bottom: 10px;
}

header p {
    font-size: 1.2rem;
    color: #7f8c8d;
}

.settings-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: #3498db;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background-color 0.3s;
}

.settings-btn:hover {
    background-color: #2980b9;
}

/* 游戏容器样式 */
.game-container {
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* 游戏状态样式 */
.game-status {
    background-color: #ecf0f1;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.round-info {
    font-size: 1.1rem;
    font-weight: bold;
    color: #2c3e50;
}

.progress-bar {
    height: 10px;
    background-color: #ddd;
    border-radius: 5px;
    width: 70%;
    overflow: hidden;
}

.progress {
    height: 100%;
    background-color: #27ae60;
    width: 0%;
    transition: width 0.5s ease;
}

/* 游戏区域样式 */
.game-area {
    padding: 30px;
    min-height: 500px;
}

/* 屏幕样式 */
.screen {
    display: none;
}

.screen.active {
    display: block;
}

/* 开始屏幕样式 */
#startScreen {
    text-align: center;
}

#startScreen h2 {
    font-size: 2rem;
    color: #2c3e50;
    margin-bottom: 20px;
}

#startScreen p {
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.initial-setting {
    margin: 30px 0;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.initial-setting h3 {
    margin-bottom: 10px;
    color: #2c3e50;
}

#initialSetting {
    width: 100%;
    height: 100px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    resize: vertical;
    font-family: inherit;
    font-size: 1rem;
}

/* 按钮样式 */
.primary-btn {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 15px 25px;
    border-radius: 5px;
    cursor: pointer;
    font-size: clamp(1rem, 2.5vw, 1.2rem);
    transition: background-color 0.3s;
    min-height: 44px;
    touch-action: manipulation;
    width: auto;
    max-width: 100%;
    text-align: center;
}

.primary-btn:hover {
    background-color: #2980b9;
}

.secondary-btn {
    background-color: #95a5a6;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    width: auto;
    max-width: 100%;
    text-align: center;
    font-size: 1rem;
    transition: background-color 0.3s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.secondary-btn:hover {
    background-color: #7f8c8d;
}

/* 卡片屏幕样式 */
#cardScreen h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #2c3e50;
}

.cards-container {
    display: flex;
    justify-content: center;
    gap: 40px;
    flex-wrap: wrap;
    width: 100%;
}

.card {
    width: 300px;
    max-width: 100%;
    height: 400px;
    perspective: 1000px;
    cursor: pointer;
    margin-bottom: 20px;
}

.card-inner {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.card:hover .card-inner {
    transform: scale(1.05);
}

.card-content {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 10px;
    background-color: #3498db;
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    text-align: center;
}

.card-content h3 {
    font-size: 1.5rem;
    margin-bottom: 15px;
}

.card-content p {
    font-size: 1.1rem;
}

/* 故事屏幕样式 */
.story-container {
    background-color: #f9f9f9;
    border-radius: 10px;
    padding: 30px;
    margin-bottom: 20px;
    min-height: 300px;
    position: relative;
    width: 100%;
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.loading-indicator {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-radius: 10px;
    z-index: 10;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

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

.story-content {
    line-height: 1.8;
    font-size: 1.1rem;
}

/* 打字机效果样式 */
.typing-effect {
    display: block;
    animation: cursor-blink 1s step-end infinite;
}

@keyframes cursor-blink {
    from, to { border-right-color: transparent; }
    50% { border-right-color: #333; }
}

/* 流式输出状态提示 */
.streaming-status {
    font-size: 0.9rem;
    color: #3498db;
    margin-bottom: 10px;
    font-style: italic;
}

#nextRoundBtn {
    display: block;
    margin: 0 auto;
}

/* 结束屏幕样式 */
#endScreen {
    text-align: center;
}

#endScreen h2 {
    font-size: 2rem;
    color: #2c3e50;
    margin-bottom: 20px;
}

.final-story-container {
    background-color: #f9f9f9;
    border-radius: 10px;
    padding: 30px;
    margin-bottom: 30px;
    text-align: left;
}

.final-story-container h3 {
    text-align: center;
    margin-bottom: 20px;
    color: #2c3e50;
}

.final-story {
    line-height: 1.8;
    font-size: 1.1rem;
    max-height: 400px;
    overflow-y: auto;
    padding: 10px;
}

.action-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

/* 设置面板样式 */
.settings-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: white;
    width: 90%;
    max-width: 500px;
    border-radius: 10px;
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    display: none;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
}

.settings-header h2 {
    color: #2c3e50;
    font-size: 1.5rem;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #7f8c8d;
}

.settings-content {
    padding: 20px;
}

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

.setting-item label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #2c3e50;
}

.setting-item input,
.setting-item select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    background-color: white;
}

.settings-select {
    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='%232c3e50' 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 10px center;
    background-size: 1em;
    cursor: pointer;
}

.setting-actions {
    text-align: right;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 15px;
}

/* 遮罩层样式 */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 900;
    display: none;
}

/* 响应式设计 */
@media screen and (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    header p {
        font-size: 1rem;
    }
    
    .game-area {
        padding: 15px;
    }
    
    .story-container {
        padding: 20px;
    }
    
    .card {
        width: 100%;
        max-width: 300px;
        height: 350px;
    }
    
    .cards-container {
        gap: 20px;
    }
    
    .action-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .action-buttons button {
        width: 100%;
        max-width: 250px;
        margin-bottom: 10px;
    }
    
    .settings-panel {
        width: 95%;
    }
}

@media screen and (max-width: 480px) {
    header h1 {
        font-size: 1.8rem;
    }
    
    .card {
        height: 300px;
    }
    
    .story-container {
        padding: 15px;
    }
    
    .primary-btn, .secondary-btn {
        padding: 12px 20px;
        font-size: 1rem;
    }
}

/* 页脚样式 */
footer {
    text-align: center;
    padding: 20px;
    background-color: #2c3e50;
    color: white;
    margin-top: auto;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .cards-container {
        gap: 20px;
    }
    
    .card {
        width: 250px;
        height: 350px;
    }
    
    .game-area {
        padding: 20px;
    }
    
    .action-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .action-buttons button {
        width: 100%;
        max-width: 300px;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 2rem;
    }
    
    .card {
        width: 100%;
        max-width: 280px;
        height: 320px;
    }
    
    .game-status {
        flex-direction: column;
        gap: 10px;
    }
    
    .progress-bar {
        width: 100%;
    }
    
    .settings-btn {
        position: static;
        margin: 10px auto 0;
        display: inline-flex;
    }
}