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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    min-height: 100vh;
    color: #e8e8e8;
    line-height: 1.6;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

/* Header */
header {
    text-align: center;
    padding: 30px 0;
}

header h1 {
    font-size: 2.5rem;
    background: linear-gradient(135deg, #ffd700, #ff6b6b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
}

.subtitle {
    color: #888;
    font-size: 1rem;
}

/* Screen Management */
.screen {
    display: none;
}

.screen.active {
    display: block;
    animation: fadeIn 0.5s ease;
}

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

/* Setup Card */
.setup-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 40px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.setup-card h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #ffd700;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #ccc;
}

.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.3);
    color: #e8e8e8;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #ffd700;
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
    font-family: inherit;
}

.form-group select option {
    background: #1a1a2e;
    color: #e8e8e8;
}

/* Buttons */
.btn {
    padding: 14px 28px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-small {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    color: #ccc;
    font-size: 0.875rem;
}

.btn-small:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Game Screen */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.genre-tag {
    background: rgba(255, 215, 0, 0.2);
    color: #ffd700;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
}

/* Story Container */
.story-container {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 15px;
    padding: 25px;
    min-height: 200px;
    margin-bottom: 20px;
}

.story-segment {
    margin-bottom: 20px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border-left: 4px solid #667eea;
    animation: slideIn 0.5s ease;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

.story-segment h4 {
    color: #ffd700;
    margin-bottom: 10px;
    font-size: 0.875rem;
}

.story-segment p {
    color: #e8e8e8;
    line-height: 1.8;
    white-space: pre-wrap;
}

/* Story Images */
.story-content {
    animation: fadeIn 0.5s ease;
}

.image-container {
    position: relative;
    margin-bottom: 20px;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.3);
    min-height: 200px;
}

.story-image {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 12px;
    transition: opacity 0.5s ease;
}

.story-image.history-image {
    opacity: 1;
    margin-bottom: 15px;
    width: 100%;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
}

.image-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #888;
    font-size: 0.9rem;
    pointer-events: none;
}

.story-image.loaded + .image-loading {
    display: none;
}

.story-segment.loading {
    text-align: center;
    border-left-color: #ffd700;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 215, 0, 0.3);
    border-top-color: #ffd700;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Choices */
.choices-container {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 15px;
    padding: 25px;
}

.choices-container h3 {
    color: #ffd700;
    margin-bottom: 20px;
    text-align: center;
}

.choice-btn {
    width: 100%;
    padding: 16px 20px;
    margin-bottom: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: #e8e8e8;
    font-size: 1rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

.choice-btn:hover:not(:disabled) {
    background: rgba(102, 126, 234, 0.2);
    border-color: #667eea;
    transform: translateX(5px);
}

.choice-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.choice-number {
    width: 28px;
    height: 28px;
    background: #667eea;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 600;
    flex-shrink: 0;
}

.choice-btn:hover .choice-number {
    background: #ffd700;
    color: #1a1a2e;
}

/* Error Message */
.error-message {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #e74c3c;
    color: white;
    padding: 15px 25px;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(231, 76, 60, 0.4);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateX(-50%) translateY(20px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Responsive */
@media (max-width: 600px) {
    header h1 {
        font-size: 1.75rem;
    }
    
    .setup-card {
        padding: 25px;
    }
    
    .story-container {
        padding: 15px;
    }
    
    .story-segment {
        padding: 15px;
    }
}
