body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #000;
    color: #fff;
    overflow: hidden;
}

.app-container {
    width: 100%;
    height: 100vh;
    position: relative;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.screen.active {
    display: flex;
    opacity: 1;
}

/* Universe Selection Screen */
#universeScreen {
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #0f0f1e 100%);
}

.content-wrapper {
    text-align: center;
    max-width: 500px;
    padding: 2rem;
}

h1 {
    font-size: 3rem;
    margin: 0 0 0.5rem 0;
    font-weight: 700;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.7;
    margin-bottom: 2rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

input[type="text"] {
    padding: 1rem 1.5rem;
    font-size: 1.1rem;
    border: 2px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s;
}

input[type="text"]:focus {
    border-color: rgba(255, 255, 255, 0.5);
}

button {
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    background: #fff;
    color: #000;
    cursor: pointer;
    transition: transform 0.2s, opacity 0.2s;
}

button:hover {
    transform: translateY(-2px);
}

button:active {
    transform: translateY(0);
}

/* Loading Screen */
#loadingScreen {
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap: 2rem;
    background: #0f0f1e;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-text {
    font-size: 1.2rem;
    opacity: 0.7;
}

/* Character Screen */
#characterScreen {
    background: #0a0a0f;
    overflow-y: auto;
    justify-content: center;
    align-items: center;
}

.character-container {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 3rem;
    max-width: 1200px;
    padding: 2rem;
    width: 100%;
}

.character-portrait {
    position: sticky;
    top: 2rem;
    height: fit-content;
}

.character-portrait img {
    width: 100%;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.character-details {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

#characterName {
    font-size: 2.5rem;
    margin: 0;
    font-weight: 700;
}

.universe-label {
    font-size: 1rem;
    opacity: 0.6;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.detail-section {
    background: rgba(255, 255, 255, 0.05);
    padding: 1.5rem;
    border-radius: 8px;
}

.detail-section h3 {
    margin: 0 0 1rem 0;
    font-size: 1.2rem;
    opacity: 0.8;
}

.detail-section p {
    margin: 0;
    line-height: 1.6;
    opacity: 0.9;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

ul {
    margin: 0;
    padding-left: 1.2rem;
    line-height: 1.8;
}

.mission-section {
    background: rgba(255, 200, 100, 0.1);
    border: 1px solid rgba(255, 200, 100, 0.3);
}

.primary-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    margin-top: 1rem;
}

/* Mission Screen */
#missionScreen {
    background: #0a0a0f;
    flex-direction: column;
}

.mission-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
}

.story-panel {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    background: linear-gradient(to bottom, #0a0a0f 0%, #1a1a2e 100%);
}

#storyContent {
    max-width: 800px;
    margin: 0 auto;
}

.story-entry {
    margin-bottom: 2rem;
    animation: fadeIn 0.5s ease;
}

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

.story-entry.user-action {
    background: rgba(100, 100, 255, 0.1);
    padding: 1rem;
    border-radius: 8px;
    border-left: 3px solid rgba(100, 100, 255, 0.5);
}

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

.action-panel {
    padding: 2rem;
    background: rgba(0, 0, 0, 0.5);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    gap: 1rem;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

textarea {
    flex: 1;
    padding: 1rem;
    font-size: 1rem;
    font-family: inherit;
    border: 2px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    border-radius: 8px;
    resize: none;
    outline: none;
}

textarea:focus {
    border-color: rgba(255, 255, 255, 0.5);
}

/* Result Screen */
#resultScreen {
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #0f0f1e 100%);
}

.result-container {
    text-align: center;
    max-width: 600px;
    padding: 2rem;
}

.result-icon {
    font-size: 5rem;
    margin-bottom: 1rem;
}

#resultTitle {
    font-size: 2.5rem;
    margin: 0 0 1rem 0;
}

#resultText {
    font-size: 1.2rem;
    line-height: 1.8;
    opacity: 0.9;
    margin-bottom: 2rem;
}

@media (max-width: 768px) {
    .character-container {
        grid-template-columns: 1fr;
        gap: 2rem;
        padding: 1rem;
    }

    .character-portrait {
        position: static;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    h1 {
        font-size: 2rem;
    }

    .action-panel {
        flex-direction: column;
    }
}