/* ============================================================
   style.css — CARTOON EDITION of Deploy Pony
   Bright, bouncy, colorful, pastel-tastic!
   ============================================================ */

:root {
    --void: #87CEEB;
    --deep-blue: #C9B1FF;
    --purple: #FF69B4;
    --mid-purple: #E088C0;
    --cyan: #FFD700;
    --orange: #FFA500;
    --red: #FF4444;
    --green: #32CD32;
    --white: #FFFEF2;
    --grey: #8888AA;
    --dark-grey: #E8E0F0;
}

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

body {
    background: var(--void);
    color: #444;
    font-family: 'Courier New', 'Consolas', monospace;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
}

/* ---- GAME CONTAINER ---- */
#game-container {
    width: 100vw;
    height: 100vh;
    position: relative;
    overflow: hidden;
}

/* ---- VIGNETTE OVERLAY (removed for cartoon!) ---- */
#vignette {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 100;
    background: none; /* No dark vignette in cartoon mode */
}

/* ---- FLOATING CONFETTI PARTICLES ---- */
.floating-code {
    position: absolute;
    color: var(--purple);
    font-size: 14px;
    opacity: 0;
    pointer-events: none;
    animation: floatCode 12s linear infinite;
    font-family: monospace;
}

@keyframes floatCode {
    0% { opacity: 0; transform: translateX(100vw) translateY(0) rotate(0deg); }
    10% { opacity: 0.5; }
    50% { transform: translateX(50vw) translateY(-20px) rotate(180deg); }
    90% { opacity: 0.5; }
    100% { opacity: 0; transform: translateX(-100px) translateY(-40px) rotate(360deg); }
}

/* ---- SCREENS ---- */
.game-screen {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.6s ease;
}

.game-screen.active {
    opacity: 1;
    pointer-events: all;
}

/* ---- LOADING SCREEN ---- */
#loading-screen {
    background: linear-gradient(180deg, #B0E0FF, #FFF0F5);
}

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

.loading-bar-container {
    width: 400px;
    max-width: 80vw;
    height: 24px;
    border: 2px solid var(--purple);
    margin: 20px auto;
    background: white;
    border-radius: 12px;
    overflow: hidden;
}

.loading-bar {
    height: 100%;
    background: linear-gradient(90deg, #FF69B4, #FFD700, #5DADE2, #32CD32);
    animation: loadingPulse 4s ease-in-out;
    width: 0%;
    border-radius: 10px;
}

@keyframes loadingPulse {
    0% { width: 0%; }
    20% { width: 15%; }
    40% { width: 35%; }
    60% { width: 50%; }
    70% { width: 55%; }
    80% { width: 70%; }
    95% { width: 85%; }
    100% { width: 100%; }
}

#loading-text {
    color: #9B59B6;
    font-size: 12px;
    margin-top: 10px;
    min-height: 20px;
}

.loading-title {
    color: #E74C9C;
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 15px;
}

/* ---- MENU SCREEN ---- */
#menu-screen {
    background: linear-gradient(180deg, #87CEEB 0%, #C9B1FF 50%, #FFE4F0 100%);
}

.menu-content {
    text-align: center;
    max-width: 600px;
    padding: 20px;
}

.menu-logo {
    margin-bottom: 30px;
}

.menu-lore {
    color: #7B68AE;
    font-size: 12px;
    line-height: 1.8;
    margin-bottom: 30px;
    font-style: italic;
}

.menu-lore p {
    margin-bottom: 8px;
    animation: loreReveal 0.5s ease both;
}

.menu-lore p:nth-child(1) { animation-delay: 0.3s; }
.menu-lore p:nth-child(2) { animation-delay: 0.6s; }
.menu-lore p:nth-child(3) { animation-delay: 0.9s; }
.menu-lore p:nth-child(4) { animation-delay: 1.2s; }
.menu-lore p:nth-child(5) { animation-delay: 1.5s; }
.menu-lore p:nth-child(6) { animation-delay: 1.8s; }

@keyframes loreReveal {
    from { opacity: 0; transform: translateY(15px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.menu-btn {
    background: white;
    border: 2px solid var(--purple);
    color: #E74C9C;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    font-weight: bold;
    padding: 12px 40px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 280px;
    border-radius: 12px;
}

.menu-btn:hover {
    background: #FF69B4;
    color: white;
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(255, 105, 180, 0.4);
}

.menu-btn:active {
    transform: scale(0.98);
}

.menu-btn.primary {
    background: #FF69B4;
    border-color: #E74C9C;
    color: white;
}

.menu-btn.primary:hover {
    background: #E74C9C;
}

.menu-subtitle {
    color: #9B59B6;
    font-size: 10px;
    margin-top: 20px;
}

/* ---- CARE SCREEN ---- */
#care-screen {
    background: linear-gradient(180deg, #E8F4FD 0%, #F0E6FF 40%, #FFF0F5 100%);
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto 1fr auto;
    gap: 10px;
    padding: 15px;
}

.care-header {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 10px;
    border-bottom: 2px solid #E8E0F0;
}

.care-title {
    color: #E74C9C;
    font-size: 14px;
    font-weight: bold;
}

.care-controls {
    display: flex;
    gap: 10px;
}

.icon-btn {
    background: white;
    border: 2px solid #DDD;
    color: #9B59B6;
    font-family: monospace;
    font-size: 12px;
    padding: 4px 8px;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 8px;
}

.icon-btn:hover {
    border-color: var(--purple);
    color: var(--purple);
    background: #FFF0F5;
}

.icon-btn.muted {
    opacity: 0.4;
    text-decoration: line-through;
}

.pony-area {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#pony-display {
    position: relative;
    z-index: 2;
}

#poop-container {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.pony-poop {
    position: absolute;
    cursor: pointer;
    pointer-events: all;
    transition: transform 0.3s, opacity 0.3s;
    animation: poopAppear 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.pony-poop:hover {
    transform: scale(1.15) rotate(3deg);
}

.pony-poop.poof {
    transform: scale(0) rotate(20deg);
    opacity: 0;
}

@keyframes poopAppear {
    from { transform: scale(0) rotate(-10deg); }
    to { transform: scale(1) rotate(0deg); }
}

#dialogue-bubble {
    position: absolute;
    top: 8%;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border: 2px solid var(--purple);
    color: #555;
    padding: 10px 18px;
    font-size: 11px;
    border-radius: 16px;
    opacity: 0;
    transition: opacity 0.4s ease, transform 0.4s ease;
    max-width: 280px;
    text-align: center;
    z-index: 10;
    pointer-events: none;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

#dialogue-bubble.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(-3px);
}

#dialogue-bubble::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid var(--purple);
}

.stats-area {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    overflow-y: auto;
}

#pony-stats {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pony-name {
    color: #E74C9C;
    font-size: 13px;
    font-weight: bold;
    margin-bottom: 2px;
    word-break: break-all;
}

.pony-level {
    color: #9B59B6;
    font-size: 10px;
    margin-bottom: 6px;
}

.stat-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 10px;
}

.stat-bar.pulse-warning .stat-fill {
    animation: pulseWarn 0.5s ease infinite alternate;
}

@keyframes pulseWarn {
    from { opacity: 1; }
    to { opacity: 0.4; }
}

.stat-label {
    min-width: 100px;
    color: #888;
    font-size: 9px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stat-track {
    flex: 1;
    height: 12px;
    background: white;
    border: 2px solid #DDD;
    border-radius: 6px;
    overflow: hidden;
}

.stat-fill {
    height: 100%;
    transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.5s ease;
    border-radius: 4px;
}

.stat-value {
    min-width: 35px;
    text-align: right;
    color: #555;
    font-size: 10px;
    font-weight: bold;
}

.deploy-stats {
    color: #888;
    font-size: 9px;
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px solid #E0E0E0;
}

.exception-list {
    margin-top: 6px;
    padding: 6px;
    background: #FFF0F0;
    border: 2px solid var(--red);
    border-radius: 8px;
}

.exception-header {
    color: var(--red);
    font-size: 9px;
    margin-bottom: 3px;
}

.exception-item {
    color: var(--orange);
    font-size: 9px;
    padding: 1px 0;
}

.actions-area {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    padding: 8px;
    border-top: 2px solid #E8E0F0;
}

.action-btn {
    background: white;
    border: 2px solid var(--purple);
    color: #E74C9C;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    font-weight: bold;
    padding: 8px 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    border-radius: 10px;
}

.action-btn:hover {
    background: #FF69B4;
    color: white;
    transform: scale(1.05);
    box-shadow: 0 3px 10px rgba(255, 105, 180, 0.3);
}

.action-btn:active {
    transform: scale(0.95);
}

.action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.btn-prompt {
    color: var(--green);
    margin-right: 4px;
}

.deploy-btn {
    border-color: var(--orange);
    color: var(--orange);
}

.deploy-btn:hover {
    background: var(--orange);
    color: white;
    box-shadow: 0 3px 10px rgba(255, 165, 0, 0.3);
}

.minigame-btn {
    border-color: var(--green);
    color: var(--green);
}

.minigame-btn:hover {
    background: var(--green);
    color: white;
    box-shadow: 0 3px 10px rgba(50, 205, 50, 0.3);
}

.event-log-area {
    grid-column: 1 / -1;
    max-height: 80px;
    overflow-y: auto;
    padding: 5px 10px;
    background: rgba(255, 255, 255, 0.6);
    border-top: 2px solid #E8E0F0;
    border-radius: 0 0 8px 8px;
}

#event-log {
    font-size: 9px;
}

.event-entry {
    padding: 1px 0;
    border-bottom: 1px solid rgba(200, 200, 220, 0.3);
}

.event-info { color: #888; }
.event-success { color: #27AE60; }
.event-warning { color: #E67E22; }
.event-error { color: #E74C3C; }

/* ---- RIDE SCREEN ---- */
#ride-screen {
    background: #87CEEB;
    padding: 0;
}

#ride-canvas {
    width: 100%;
    height: 100%;
}

#ride-zone {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 26px;
    font-weight: bold;
    color: #E74C9C;
    text-shadow: 2px 2px 0 white, -2px -2px 0 white, 2px -2px 0 white, -2px 2px 0 white;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

#ride-zone.zone-flash {
    opacity: 1;
    animation: zoneFlash 2s ease;
}

@keyframes zoneFlash {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5) rotate(-5deg); }
    20% { opacity: 1; transform: translate(-50%, -50%) scale(1.15) rotate(2deg); }
    40% { transform: translate(-50%, -50%) scale(0.95) rotate(-1deg); }
    60% { transform: translate(-50%, -50%) scale(1.05) rotate(1deg); }
    80% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0deg); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(1) rotate(0deg); }
}

/* ---- DEPLOY MINI-GAME SCREEN ---- */
#deploy-screen {
    background: linear-gradient(180deg, #E8F4FD 0%, #FFF0F5 100%);
    padding: 20px;
    overflow-y: auto;
}

#deploy-game-area {
    max-width: 750px;
    width: 100%;
}

.minigame-header {
    text-align: center;
    margin-bottom: 20px;
}

.minigame-header h2 {
    color: #E74C9C;
    font-size: 22px;
    font-weight: bold;
    margin-bottom: 8px;
}

.minigame-header p {
    color: #888;
    font-size: 12px;
}

/* Catapult */
#catapult-canvas {
    display: block;
    margin: 0 auto 15px;
    border: 2px solid #DDD;
    border-radius: 10px;
    max-width: 100%;
}

.catapult-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    align-items: center;
}

.control-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.control-group label {
    color: #888;
    font-size: 11px;
}

.control-group input[type="range"] {
    width: 150px;
    accent-color: #FF69B4;
}

/* XML Puzzle */
.xml-slots {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 15px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.xml-slot {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    background: white;
    border: 2px solid #DDD;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 10px;
}

.xml-slot:hover {
    border-color: var(--purple);
    transform: translateX(3px);
}

.xml-slot.selected {
    border-color: var(--purple);
    background: #FFF0F5;
    box-shadow: 0 3px 10px rgba(255, 105, 180, 0.2);
    transform: scale(1.02);
}

.xml-slot.correct {
    border-color: var(--green);
    background: #F0FFF0;
}

.slot-number {
    color: #BBB;
    font-size: 11px;
    min-width: 20px;
}

.xml-slot code {
    color: #27AE60;
    font-size: 12px;
    font-weight: bold;
}

.timer-warning {
    color: var(--red) !important;
    animation: pulseWarn 0.5s ease infinite alternate;
}

/* Dependency Hell */
.dep-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    max-width: 500px;
    margin: 0 auto 15px;
}

.dep-card {
    aspect-ratio: 1;
    perspective: 600px;
    cursor: pointer;
}

.dep-card-front,
.dep-card-back {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    backface-visibility: hidden;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    border-radius: 10px;
    border: 2px solid #DDD;
}

.dep-card {
    position: relative;
}

.dep-card-front {
    background: linear-gradient(135deg, #F8F0FF, #FFF0F5);
    z-index: 2;
}

.dep-card-back {
    background: white;
    border-color: var(--green);
    transform: rotateY(180deg);
}

.dep-card.flipped .dep-card-front {
    transform: rotateY(180deg);
}

.dep-card.flipped .dep-card-back {
    transform: rotateY(0);
}

.dep-card.matched .dep-card-back {
    border-color: var(--cyan);
    background: #FFFDE8;
}

.dep-q {
    color: var(--purple);
    font-size: 26px;
    font-weight: bold;
}

.dep-label {
    color: #BBB;
    font-size: 9px;
    margin-top: 4px;
}

.dep-name {
    color: #27AE60;
    font-size: 9px;
    font-weight: bold;
    text-align: center;
    word-break: break-all;
    padding: 4px;
}

/* The Build */
.build-area {
    max-width: 500px;
    margin: 0 auto;
    text-align: center;
}

.build-terminal {
    background: white;
    border: 2px solid #DDD;
    padding: 15px;
    margin-bottom: 20px;
    text-align: left;
    border-radius: 10px;
}

.terminal-header {
    color: #27AE60;
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 2px solid #EEE;
}

.build-message {
    color: #E67E22;
    font-size: 11px;
    min-height: 20px;
}

.build-bar-container {
    width: 100%;
    height: 30px;
    background: white;
    border: 2px solid #DDD;
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 15px;
}

.build-bar {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 12px;
    transition: width 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.3s ease;
    border-radius: 13px;
}

.build-stats {
    color: #888;
    font-size: 11px;
    margin-bottom: 15px;
}

.build-click-btn {
    font-size: 16px !important;
    padding: 15px 40px !important;
    animation: buildPulse 1.2s ease infinite;
}

@keyframes buildPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 3px 10px rgba(255, 105, 180, 0.2); }
    50% { transform: scale(1.05); box-shadow: 0 5px 20px rgba(255, 105, 180, 0.4); }
}

.build-setback {
    animation: setbackFlash 0.3s ease;
}

@keyframes setbackFlash {
    0% { background: transparent; }
    50% { background: rgba(255, 68, 68, 0.15); }
    100% { background: transparent; }
}

/* ---- GAME OVER SCREEN ---- */
#gameover-screen {
    background: linear-gradient(180deg, #FFE4F0 0%, #FFF0F5 50%, #E8F4FD 100%);
}

.gameover-content {
    text-align: center;
    max-width: 500px;
    padding: 20px;
}

.gameover-title {
    color: #E74C9C;
    font-size: 30px;
    font-weight: bold;
    margin-bottom: 20px;
    text-shadow: 2px 2px 0 white;
}

.gameover-message {
    color: #9B59B6;
    font-size: 13px;
    margin-bottom: 20px;
    line-height: 1.6;
}

.gameover-stats {
    color: #888;
    font-size: 11px;
    margin-bottom: 25px;
    line-height: 1.8;
}

.gameover-score {
    color: #E74C9C;
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 25px;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
    #care-screen {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto auto auto;
    }

    .pony-area {
        min-height: 200px;
    }

    .dep-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .action-btn {
        font-size: 10px;
        padding: 6px 10px;
    }

    .stat-label {
        min-width: 60px;
        font-size: 8px;
    }
}

@media (max-width: 480px) {
    .dep-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .menu-btn {
        min-width: 220px;
        font-size: 14px;
        padding: 10px 20px;
    }

    .catapult-controls {
        flex-direction: column;
    }
}

/* ---- SCROLLBAR STYLING ---- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #F8F0FF;
}

::-webkit-scrollbar-thumb {
    background: #DDD;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--purple);
}

/* ---- REDUCED MOTION ---- */
@media (prefers-reduced-motion: reduce) {
    .floating-code,
    .particle {
        animation: none !important;
        display: none;
    }
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
