* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Courier New', monospace;
    overflow-x: hidden;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

.screen {
    min-height: 100vh;
    padding: 20px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

/* Splash Screen */
.splash-screen {
    background: #000;
    color: #ff9800;
    text-align: center;
    align-items: center;
}

.splash-content {
    animation: pulse 1.5s infinite;
}

.fox-speech {
    position: relative;
    display: inline-block;
    background: white;
    color: black;
    padding: 15px 25px;
    border: 3px solid #ff9800;
    border-radius: 20px;
    font-size: 32px;
    font-weight: bold;
    margin-top: 20px;
    animation: bounce 0.5s ease-out;
}

.fox-speech::after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-top: 15px solid white;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.fox-logo {
    width: 200px;
    height: 200px;
    margin-bottom: 20px;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    object-fit: contain;
}

.studio-title {
    font-size: 48px;
    font-weight: bold;
    margin-bottom: 10px;
}

.studio-subtitle {
    font-size: 32px;
    color: #ffb74d;
}

.loading-text {
    margin-top: 40px;
    color: #ff9800;
    font-size: 14px;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Intro Screen */
.intro-screen {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 25%, #f093fb 50%, #4facfe 75%, #00f2fe 100%);
    color: white;
    background-size: 400% 400%;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.intro-container {
    max-width: 800px;
    width: 100%;
}

.intro-box {
    border: 4px solid #00e5ff;
    background: rgba(0, 0, 0, 0.8);
    padding: 40px;
    margin-bottom: 40px;
}

.game-title {
    font-size: 48px;
    text-align: center;
    margin-bottom: 40px;
    color: #00e5ff;
    animation: pulse 2s infinite;
}

.intro-text {
    font-size: 18px;
    line-height: 1.8;
    margin-bottom: 20px;
}

.intro-text.green { color: #76ff03; }
.intro-text.yellow { color: #ffeb3b; }
.intro-text.pink { color: #ff4081; }
.intro-text.cyan { color: #00e5ff; }
.intro-text.white { color: white; font-size: 24px; }

.name-input-box {
    border: 2px solid #ffeb3b;
    background: #1a1a1a;
    padding: 30px;
    margin-top: 50px;
}

.name-label {
    color: #ffeb3b;
    font-size: 20px;
    margin-bottom: 20px;
    display: block;
}

.name-input {
    width: 100%;
    background: #000;
    border: 2px solid #76ff03;
    color: #76ff03;
    padding: 15px;
    font-size: 20px;
    font-family: 'Courier New', monospace;
}

.start-button {
    width: 100%;
    margin-top: 20px;
    padding: 20px;
    font-size: 20px;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    border: 2px solid #76ff03;
    cursor: pointer;
    transition: all 0.3s;
}

.start-button.enabled {
    background: #388e3c;
    color: white;
}

.start-button.enabled:hover {
    background: #4caf50;
}

.start-button.disabled {
    background: #424242;
    color: #757575;
    cursor: not-allowed;
}

.credits {
    text-align: center;
    color: #757575;
    font-size: 12px;
    margin-top: 40px;
}

/* Game Screen */
.game-screen {
    transition: background 0.5s ease;
}

.game-screen.bg-opening {
    background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 50%, #fab1a0 100%);
}

.game-screen.bg-partnership {
    background: linear-gradient(135deg, #a29bfe 0%, #74b9ff 50%, #81ecec 100%);
}

.game-screen.bg-negotiation {
    background: linear-gradient(135deg, #fd79a8 0%, #fdcb6e 50%, #e17055 100%);
}

.game-screen.bg-recipe {
    background: linear-gradient(135deg, #55efc4 0%, #00b894 50%, #00cec9 100%);
}

.game-screen.bg-book-fair {
    background: linear-gradient(135deg, #d4a574 0%, #c97d60 50%, #b85d47 100%);
}

.game-screen.bg-science-project {
    background: linear-gradient(135deg, #a8d5e5 0%, #6bb3d9 50%, #4a90a4 100%);
}

/* Scenario 4: The Goodbye - Sunset/farewell warm tones */
.game-screen.bg-goodbye {
    background: linear-gradient(135deg, #ff9a56 0%, #ff6b6b 50%, #c44569 100%);
}

/* Scenario 5: Long Distance - Autumn/nostalgic tones */
.game-screen.bg-long-distance {
    background: linear-gradient(135deg, #d2691e 0%, #8b4513 50%, #5c3317 100%);
}

/* Scenario 6: Fair Deals - Summer reunion, hopeful bright */
.game-screen.bg-fair-deals {
    background: linear-gradient(135deg, #74b9ff 0%, #a29bfe 50%, #fd79a8 100%);
}

.game-container {
    max-width: 1200px;
    width: 100%;
}

.game-header {
    background: linear-gradient(135deg, #000 0%, #1a1a1a 100%);
    border: 4px solid #00e5ff;
    padding: 20px;
    margin-bottom: 30px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

.scenario-title {
    font-size: 20px;
}

.scenario-title .arrow {
    color: #00e5ff;
}

.age-info {
    text-align: right;
    color: #ffeb3b;
    font-size: 14px;
}

.game-content {
    display: flex;
    gap: 30px;
    align-items: stretch;
    margin-bottom: 30px;
}

.character-side {
    flex: 0 0 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.maya-sprite {
    width: 350px;
    height: 350px;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.3));
}

.character-sprite {
    text-align: center;
    margin-bottom: 30px;
}

.sprite-emoji {
    font-size: 120px;
}

.character-name {
    background: linear-gradient(135deg, #ff6b6b 0%, #ff4081 100%);
    border: 3px solid #fff;
    color: #fff;
    padding: 10px 25px;
    display: inline-block;
    margin-top: 15px;
    font-size: 18px;
    font-weight: bold;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.dialogue-side {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.speech-bubble {
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
    border: 5px solid #000;
    padding: 30px;
    position: relative;
    font-size: 18px;
    line-height: 1.8;
    color: #000;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    border-radius: 15px;
}

.speech-bubble::before {
    content: '';
    position: absolute;
    left: -30px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 20px solid transparent;
    border-bottom: 20px solid transparent;
    border-right: 30px solid #000;
}

.speech-bubble::after {
    content: '';
    position: absolute;
    left: -20px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 15px solid transparent;
    border-bottom: 15px solid transparent;
    border-right: 25px solid #fff;
}

.choices {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.choice-button {
    width: 100%;
    background: linear-gradient(135deg, #000 0%, #2d3436 100%);
    color: white;
    border: 4px solid #00e5ff;
    padding: 20px;
    text-align: left;
    font-size: 16px;
    font-family: 'Courier New', monospace;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.choice-button:hover {
    background: linear-gradient(135deg, #00e5ff 0%, #00b8d4 100%);
    border-color: #fff;
    color: #000;
    box-shadow: 0 8px 16px rgba(0, 229, 255, 0.4);
}

.choice-button .arrow {
    color: #00e5ff;
    margin-right: 10px;
}

.game-footer {
    margin-top: 40px;
    text-align: center;
    color: rgba(0, 0, 0, 0.5);
    font-size: 14px;
}

/* Outcome Screen */
.outcome-screen-best {
    background: linear-gradient(135deg, #00b894 0%, #55efc4 50%, #81ecec 100%);
    animation: gradientShift 8s ease infinite;
    background-size: 400% 400%;
}

.outcome-screen-good {
    background: linear-gradient(135deg, #74b9ff 0%, #a29bfe 50%, #fd79a8 100%);
    animation: gradientShift 8s ease infinite;
    background-size: 400% 400%;
}

.outcome-screen-okay {
    background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 50%, #fd79a8 100%);
    animation: gradientShift 8s ease infinite;
    background-size: 400% 400%;
}

.outcome-screen-poor {
    background: linear-gradient(135deg, #b2bec3 0%, #636e72 50%, #2d3436 100%);
    animation: gradientShift 8s ease infinite;
    background-size: 400% 400%;
}

.outcome-screen-none {
    background: linear-gradient(135deg, #ff7675 0%, #fd79a8 50%, #fdcb6e 100%);
    animation: gradientShift 8s ease infinite;
    background-size: 400% 400%;
}

.outcome-container {
    max-width: 900px;
    width: 100%;
}

.outcome-box {
    background: rgba(0, 0, 0, 0.8);
    border: 4px solid white;
    padding: 40px;
    margin-bottom: 40px;
}

.outcome-header {
    text-align: center;
    margin-bottom: 40px;
}

.outcome-icon {
    font-size: 80px;
    margin-bottom: 20px;
}

.outcome-title {
    font-size: 36px;
    color: #ffeb3b;
    margin-bottom: 10px;
}

.outcome-type {
    font-size: 24px;
    color: #00e5ff;
}

.outcome-text {
    color: white;
    font-size: 18px;
    line-height: 1.8;
    white-space: pre-line;
    margin-bottom: 40px;
}

.trust-reveal {
    border-top: 2px solid #424242;
    padding-top: 30px;
}

.trust-label {
    color: #76ff03;
    text-align: center;
    margin-bottom: 20px;
    font-size: 18px;
}

.trust-bar-container {
    background: #424242;
    height: 40px;
    overflow: hidden;
    border: 2px solid #76ff03;
    margin-bottom: 10px;
}

.trust-bar {
    height: 100%;
    background: linear-gradient(to right, #f44336, #ffeb3b, #4caf50);
    transition: width 2s ease-out;
}

.trust-value {
    text-align: center;
    color: white;
    font-size: 24px;
    margin-top: 10px;
}

.trust-description {
    text-align: center;
    color: #757575;
    font-size: 14px;
    margin-top: 10px;
}

.continue-section {
    margin-top: 40px;
    text-align: center;
}

.continue-title {
    color: #ffeb3b;
    font-size: 24px;
    margin-bottom: 20px;
}

.scenario-progress {
    color: #757575;
    font-size: 14px;
}

.next-scenario {
    color: #00e5ff;
    font-size: 14px;
    margin-top: 10px;
}

.replay-button {
    margin-top: 30px;
    padding: 15px 40px;
    background: #00e5ff;
    color: #000;
    border: none;
    font-size: 18px;
    font-family: 'Courier New', monospace;
    cursor: pointer;
    font-weight: bold;
}

.replay-button:hover {
    background: #00b8d4;
}

.continue-title .replay-button {
    background: #76ff03;
    color: #000;
}

.continue-title .replay-button:hover {
    background: #64dd17;
}

/* ===== CHAT INTERFACE (Scenario 5) ===== */

/* Chat Screen Container */
.chat-screen {
    min-height: 100vh;
    padding: 0;
    display: flex;
    flex-direction: column;
    transition: background 1s ease;
}

/* Seasonal Backgrounds */
.chat-screen.bg-autumn {
    background: linear-gradient(180deg, #2d1b0e 0%, #5c3317 30%, #8b4513 60%, #d2691e 100%);
}

.chat-screen.bg-winter {
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 30%, #0f3460 60%, #e7f3f8 100%);
}

.chat-screen.bg-spring {
    background: linear-gradient(180deg, #355c7d 0%, #6c5b7b 30%, #c06c84 60%, #f8b500 100%);
}

.chat-screen.bg-summer-end {
    background: linear-gradient(180deg, #ff7e5f 0%, #feb47b 50%, #ffedbc 100%);
}

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    border-bottom: 3px solid #00e5ff;
    position: sticky;
    top: 0;
    z-index: 100;
}

.chat-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #00e5ff;
    image-rendering: pixelated;
}

.chat-contact-info {
    flex: 1;
}

.chat-contact-name {
    color: #fff;
    font-size: 18px;
    font-weight: bold;
}

.chat-status {
    color: #76ff03;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.chat-status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #76ff03;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.chat-status.offline {
    color: #757575;
}

.chat-status.offline::before {
    background: #757575;
    animation: none;
}

.chat-scenario-info {
    text-align: right;
    color: #757575;
    font-size: 12px;
}

/* Chat Messages Container */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

/* New message animation */
@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-new {
    animation: messageSlideIn 0.3s ease-out forwards;
}

/* Message Bubbles */
.chat-bubble {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.5;
    position: relative;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Maya's messages (left side, blue like iMessage) */
.chat-bubble.maya {
    align-self: flex-start;
    background: linear-gradient(135deg, #007aff 0%, #5856d6 100%);
    color: white;
    border-bottom-left-radius: 4px;
    margin-left: 10px;
}

.chat-bubble.maya::before {
    content: '';
    position: absolute;
    left: -8px;
    bottom: 0;
    width: 0;
    height: 0;
    border: 8px solid transparent;
    border-right-color: #007aff;
    border-bottom-color: #007aff;
    border-bottom-left-radius: 10px;
}

/* Player's messages (right side, gray) */
.chat-bubble.player {
    align-self: flex-end;
    background: linear-gradient(135deg, #5a5a5c 0%, #636366 100%);
    color: white;
    border-bottom-right-radius: 4px;
    border-bottom-left-radius: 20px;
    margin-left: auto;
    margin-right: 10px;
}

.chat-bubble.player::before {
    content: '';
    position: absolute;
    right: -8px;
    bottom: 0;
    width: 0;
    height: 0;
    border: 8px solid transparent;
    border-left-color: #48484a;
    border-bottom-color: #48484a;
    border-bottom-right-radius: 10px;
}

/* Timestamp */
.chat-timestamp {
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
    padding: 10px 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Timeskip */
.chat-timeskip {
    text-align: center;
    padding: 30px 20px;
    margin: 20px 0;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-timeskip-title {
    color: #ffeb3b;
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.chat-timeskip-text {
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
}

/* Narration */
.chat-narration {
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    font-style: italic;
    padding: 15px 30px;
    margin: 10px 0;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    border-left: 3px solid #00e5ff;
    border-right: 3px solid #00e5ff;
}

/* Typing Indicator */
.chat-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 15px;
    background: linear-gradient(135deg, #007aff 0%, #5856d6 100%);
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    max-width: 70px;
    margin-left: 10px;
    align-self: flex-start;
}

.chat-typing span {
    width: 8px;
    height: 8px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.chat-typing span:nth-child(1) { animation-delay: 0s; }
.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-5px); }
}

/* Chat Choices */
.chat-choices {
    padding: 15px 20px;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    border-top: 3px solid #00e5ff;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: sticky;
    bottom: 0;
}

.chat-choice-button {
    background: linear-gradient(135deg, #3a3a3c 0%, #48484a 100%);
    color: white;
    border: 2px solid #00e5ff;
    border-radius: 20px;
    padding: 12px 20px;
    font-size: 14px;
    font-family: 'Courier New', monospace;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.chat-choice-button:hover {
    background: linear-gradient(135deg, #007aff 0%, #5856d6 100%);
    border-color: #fff;
    transform: translateX(5px);
}

.chat-choice-button.delayed {
    border-color: #ff9800;
    opacity: 0.8;
}

.chat-choice-button.delayed::after {
    content: ' (delayed)';
    color: #ff9800;
    font-size: 12px;
}

.chat-choice-button.ignore {
    border-color: #ff5252;
    opacity: 0.8;
}

/* Connection Status Banner */
.chat-connection-banner {
    text-align: center;
    padding: 10px;
    font-size: 12px;
    font-weight: bold;
}

.chat-connection-banner.strong {
    background: linear-gradient(90deg, transparent, rgba(118, 255, 3, 0.2), transparent);
    color: #76ff03;
}

.chat-connection-banner.stable {
    background: linear-gradient(90deg, transparent, rgba(255, 235, 59, 0.2), transparent);
    color: #ffeb3b;
}

.chat-connection-banner.fragile {
    background: linear-gradient(90deg, transparent, rgba(255, 152, 0, 0.2), transparent);
    color: #ff9800;
}

.chat-connection-banner.weak {
    background: linear-gradient(90deg, transparent, rgba(255, 82, 82, 0.2), transparent);
    color: #ff5252;
}

/* Message Read Status */
.chat-bubble.player .read-status {
    position: absolute;
    right: -25px;
    bottom: 2px;
    font-size: 10px;
    color: #007aff;
}

/* Shared Content (like images, links) */
.chat-shared-content {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    padding: 10px;
    margin-top: 8px;
}

.chat-shared-image {
    width: 100%;
    max-width: 200px;
    border-radius: 8px;
    image-rendering: pixelated;
}

/* Dreams Shared Counter */
.dreams-counter {
    text-align: center;
    padding: 15px;
    background: rgba(118, 255, 3, 0.1);
    border: 1px solid rgba(118, 255, 3, 0.3);
    border-radius: 8px;
    margin: 15px 20px;
    color: #76ff03;
    font-size: 14px;
}

/* ==========================================
   PHONE CHAT CONTAINER (S5 - replaces speech bubble)
   ========================================== */

.phone-chat-container {
    background: rgba(0, 0, 0, 0.6);
    border-radius: 20px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    flex: 1; /* Stretch to match character-side height */
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.phone-chat-container .chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
}

/* Adjust bubble styles for phone container */
.phone-chat-container .chat-bubble {
    max-width: 85%;
    font-size: 14px;
}

.phone-chat-container .chat-bubble.maya {
    align-self: flex-start;
}

.phone-chat-container .chat-bubble.player {
    align-self: flex-end;
    margin-left: auto;
}

.phone-chat-container .chat-timestamp {
    font-size: 11px;
    padding: 8px 0;
}

.phone-chat-container .chat-timeskip {
    font-size: 12px;
    padding: 10px;
}

/* Chat prompt below phone */
.chat-prompt {
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(118, 255, 3, 0.5);
    border-radius: 8px;
    padding: 12px 15px;
    color: #76ff03;
    font-size: 16px;
    text-align: center;
    font-style: italic;
    margin-top: 15px;
}


/* Chat Screen Mobile */
@media (max-width: 768px) {
    .chat-bubble {
        max-width: 85%;
        font-size: 14px;
    }
    
    .chat-header {
        padding: 10px 15px;
    }
    
    .chat-avatar {
        width: 40px;
        height: 40px;
    }
    
    .chat-contact-name {
        font-size: 16px;
    }
}

/* Responsive */
@media (max-width: 1024px) {
    .game-content {
        flex-direction: column;
    }

    .character-side {
        flex: none;
    }

    .maya-sprite {
        width: 250px;
        height: 250px;
    }

    .speech-bubble::before,
    .speech-bubble::after {
        left: 50%;
        top: -25px;
        transform: translateX(-50%);
        border-left: 20px solid transparent;
        border-right: 20px solid transparent;
        border-bottom: 25px solid #000;
        border-top: none;
    }

    .speech-bubble::after {
        top: -18px;
        border-bottom-color: #fff;
        border-bottom-width: 20px;
    }
}

@media (max-width: 768px) {
    .studio-title { font-size: 32px; }
    .studio-subtitle { font-size: 24px; }
    .game-title { font-size: 32px; }
    .intro-text { font-size: 16px; }
    .sprite-emoji { font-size: 80px; }
    .maya-sprite { width: 200px; height: 200px; }
    .speech-bubble { font-size: 16px; padding: 20px; }
    .choice-button { font-size: 14px; padding: 15px; }
}

