/* ============================================
   DOS MUNDOS - GAME STYLESHEET
   ============================================ */

/* COLOR PALETTE */
:root {
    --color-darkspace: #0a0f1e;
    --color-copper: #e8943a;
    --color-cyan: #00d4ff;
    --color-violet: #b388ff;
    --color-white: #f0f0f0;
    
    /* Dimension Colors */
    --dim-humana: #00d4ff;
    --dim-silice: #e8943a;
    --dim-atemporal: #ffffff;
    --dim-transitoria: #b388ff;
    
    /* Spacing */
    --panel-width: 320px;
    --top-height: 80px;
}

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

html, body {
    width: 100%;
    height: 100%;
    background-color: var(--color-darkspace);
    color: var(--color-white);
    font-family: 'Share Tech Mono', monospace;
    overflow: hidden;
}

#app {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, #0a0f1e 0%, #1a1f3a 100%);
    position: relative;
}

/* ANIMATED BACKGROUND PARTICLES */
@keyframes float {
    0%, 100% { transform: translateY(0px); opacity: 0.3; }
    50% { transform: translateY(-20px); opacity: 0.6; }
}

@keyframes twinkle {
    0%, 100% { opacity: 0.2; }
    50% { opacity: 0.8; }
}

.particle {
    position: absolute;
    background: radial-gradient(circle, rgba(0, 212, 255, 0.8), transparent);
    border-radius: 50%;
    pointer-events: none;
    animation: float 8s infinite ease-in-out;
}

/* TOP BAR */
.topbar {
    height: var(--top-height);
    background: linear-gradient(90deg, rgba(10, 15, 30, 0.95) 0%, rgba(26, 31, 58, 0.95) 100%);
    border-bottom: 2px solid var(--color-cyan);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    gap: 40px;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
    flex-shrink: 0;
    z-index: 100;
}

.topbar-left {
    flex: 1;
}

.game-title {
    font-family: 'Cinzel', serif;
    font-size: 32px;
    font-weight: 700;
    color: var(--color-cyan);
    text-shadow: 0 0 20px var(--color-cyan), 0 0 40px rgba(0, 212, 255, 0.5);
    letter-spacing: 4px;
}

.topbar-center {
    flex: 1;
    text-align: center;
}

.dimension-tracker {
    font-size: 14px;
    color: var(--color-violet);
    border: 1px solid var(--color-violet);
    padding: 6px 12px;
    border-radius: 4px;
    display: inline-block;
    background: rgba(179, 136, 255, 0.1);
}

#dimension-display {
    font-weight: bold;
    letter-spacing: 2px;
}

.topbar-right {
    flex: 1;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn-control {
    padding: 8px 16px;
    background: linear-gradient(135deg, rgba(232, 148, 58, 0.3), rgba(232, 148, 58, 0.1));
    border: 1px solid var(--color-copper);
    color: var(--color-copper);
    font-family: 'Share Tech Mono', monospace;
    font-size: 12px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s ease;
    letter-spacing: 1px;
}

.btn-control:hover {
    background: linear-gradient(135deg, rgba(232, 148, 58, 0.6), rgba(232, 148, 58, 0.3));
    box-shadow: 0 0 15px rgba(232, 148, 58, 0.5);
}

/* GAME CONTAINER */
.game-container {
    flex: 1;
    display: flex;
    gap: 10px;
    padding: 10px;
    overflow: hidden;
    background: linear-gradient(to bottom, rgba(0, 212, 255, 0.05), transparent);
}

/* LEFT PANEL */
.left-panel {
    width: var(--panel-width);
    background: linear-gradient(135deg, rgba(10, 15, 30, 0.9), rgba(26, 31, 58, 0.9));
    border: 1px solid var(--color-cyan);
    border-radius: 4px;
    padding: 15px;
    overflow-y: auto;
    box-shadow: inset 0 0 20px rgba(0, 212, 255, 0.1), 0 0 20px rgba(0, 212, 255, 0.2);
    flex-shrink: 0;
}

.left-panel::-webkit-scrollbar {
    width: 8px;
}

.left-panel::-webkit-scrollbar-track {
    background: rgba(0, 212, 255, 0.1);
}

.left-panel::-webkit-scrollbar-thumb {
    background: var(--color-cyan);
    border-radius: 4px;
}

/* PANEL SECTIONS */
.panel-section {
    margin-bottom: 20px;
}

.panel-title {
    font-family: 'Cinzel', serif;
    font-size: 14px;
    color: var(--color-cyan);
    margin-bottom: 10px;
    border-bottom: 1px solid var(--color-cyan);
    padding-bottom: 8px;
    letter-spacing: 2px;
}

/* INVENTORY GRID */
.inventory-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.inventory-item {
    aspect-ratio: 1;
    background: linear-gradient(135deg, rgba(232, 148, 58, 0.3), rgba(232, 148, 58, 0.05));
    border: 1px solid var(--color-copper);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 24px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.inventory-item:hover {
    background: linear-gradient(135deg, rgba(232, 148, 58, 0.6), rgba(232, 148, 58, 0.2));
    box-shadow: 0 0 15px rgba(232, 148, 58, 0.5);
    transform: scale(1.05);
}

.inventory-item.empty {
    opacity: 0.3;
    cursor: default;
}

.inventory-item.empty:hover {
    background: linear-gradient(135deg, rgba(232, 148, 58, 0.1), rgba(232, 148, 58, 0.05));
    box-shadow: none;
    transform: scale(1);
}

.item-tooltip {
    position: absolute;
    bottom: -60px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(10, 15, 30, 0.95);
    border: 1px solid var(--color-copper);
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 200;
}

.inventory-item:hover .item-tooltip {
    opacity: 1;
}

/* ALLIES CONTAINER */
.allies-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ally-card {
    background: linear-gradient(135deg, rgba(179, 136, 255, 0.3), rgba(179, 136, 255, 0.05));
    border: 1px solid var(--color-violet);
    border-radius: 4px;
    padding: 10px;
    font-size: 12px;
}

.ally-name {
    font-family: 'Cinzel', serif;
    color: var(--color-violet);
    font-weight: bold;
    margin-bottom: 4px;
    letter-spacing: 1px;
}

.ally-dimension {
    color: var(--color-white);
    opacity: 0.8;
    font-size: 10px;
    margin-bottom: 4px;
}

.ally-ability {
    color: var(--color-cyan);
    font-size: 10px;
    line-height: 1.3;
}

.ally-stat {
    margin-top: 4px;
    color: var(--color-copper);
    font-size: 10px;
}

/* CENTER PANEL */
.center-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

.scene-image {
    flex: 1;
    background: linear-gradient(135deg, rgba(26, 31, 58, 0.8), rgba(10, 15, 30, 0.8));
    border: 1px solid var(--color-cyan);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 30px rgba(0, 212, 255, 0.1), 0 0 30px rgba(0, 212, 255, 0.1);
}

.scene-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    animation: fadeIn 0.8s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.scene-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.1), rgba(179, 136, 255, 0.05));
    position: relative;
}

.scene-title {
    font-family: 'Cinzel', serif;
    font-size: 48px;
    color: var(--color-cyan);
    text-shadow: 0 0 20px var(--color-cyan), 0 0 40px rgba(0, 212, 255, 0.3);
    text-align: center;
    letter-spacing: 3px;
}

/* NARRATIVE BOX */
.narrative-box {
    height: 180px;
    background: linear-gradient(135deg, rgba(10, 15, 30, 0.95), rgba(26, 31, 58, 0.95));
    border: 1px solid var(--color-violet);
    border-radius: 4px;
    padding: 15px;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.5;
    color: var(--color-white);
    box-shadow: inset 0 0 20px rgba(179, 136, 255, 0.1), 0 0 20px rgba(179, 136, 255, 0.1);
}

.narrative-box::-webkit-scrollbar {
    width: 8px;
}

.narrative-box::-webkit-scrollbar-track {
    background: rgba(179, 136, 255, 0.1);
}

.narrative-box::-webkit-scrollbar-thumb {
    background: var(--color-violet);
    border-radius: 4px;
}

#narrative-text {
    animation: fadeIn 0.8s ease-in-out;
}

/* COMBAT UI */
.combat-ui {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 15, 30, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 150;
    border-radius: 4px;
    border: 2px solid var(--color-copper);
}

.combat-ui.hidden {
    display: none;
}

.combat-arena {
    width: 90%;
    height: 90%;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.combat-stats {
    display: flex;
    justify-content: space-around;
    align-items: center;
    gap: 20px;
    margin-bottom: 10px;
}

.combatant {
    flex: 1;
    background: linear-gradient(135deg, rgba(232, 148, 58, 0.2), rgba(232, 148, 58, 0.05));
    border: 1px solid var(--color-copper);
    padding: 15px;
    border-radius: 4px;
    text-align: center;
}

.combatant h3 {
    font-family: 'Cinzel', serif;
    color: var(--color-copper);
    margin-bottom: 10px;
    letter-spacing: 1px;
}

.combat-hp {
    font-size: 12px;
    margin-bottom: 5px;
    color: var(--color-white);
}

.combat-bar {
    width: 100%;
    height: 20px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--color-copper);
    border-radius: 2px;
    overflow: hidden;
}

.hp-bar {
    height: 100%;
    background: linear-gradient(90deg, #ff3333, #ffaa33);
    transition: width 0.5s ease;
    box-shadow: 0 0 10px rgba(255, 100, 0, 0.6);
}

.vs-indicator {
    font-family: 'Cinzel', serif;
    font-size: 24px;
    color: var(--color-copper);
    text-shadow: 0 0 10px var(--color-copper);
}

.combat-log {
    flex: 1;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--color-cyan);
    padding: 15px;
    border-radius: 4px;
    overflow-y: auto;
    font-size: 12px;
    color: var(--color-cyan);
    line-height: 1.6;
}

.combat-log::-webkit-scrollbar {
    width: 8px;
}

.combat-log::-webkit-scrollbar-thumb {
    background: var(--color-cyan);
    border-radius: 4px;
}

.combat-hand {
    display: flex;
    gap: 10px;
    justify-content: center;
    height: 120px;
    flex-wrap: wrap;
    align-content: flex-start;
}

.combat-card {
    width: 100px;
    height: 120px;
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.3), rgba(0, 212, 255, 0.1));
    border: 1px solid var(--color-cyan);
    border-radius: 4px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    text-align: center;
    font-size: 11px;
    transition: all 0.3s ease;
    color: var(--color-white);
}

.combat-card:hover {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.6), rgba(0, 212, 255, 0.3));
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.5);
    transform: translateY(-5px);
}

.combat-card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.combat-card.disabled:hover {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.3), rgba(0, 212, 255, 0.1));
    box-shadow: none;
    transform: none;
}

/* PUZZLE UI */
.puzzle-ui {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 15, 30, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 150;
    border-radius: 4px;
    border: 2px solid var(--color-violet);
}

.puzzle-ui.hidden {
    display: none;
}

.puzzle-container {
    background: linear-gradient(135deg, rgba(179, 136, 255, 0.3), rgba(179, 136, 255, 0.1));
    border: 1px solid var(--color-violet);
    border-radius: 4px;
    padding: 30px;
    width: 80%;
    max-width: 600px;
}

.puzzle-container h2 {
    font-family: 'Cinzel', serif;
    color: var(--color-violet);
    margin-bottom: 20px;
    text-align: center;
    letter-spacing: 2px;
}

#puzzle-content {
    margin-bottom: 20px;
    color: var(--color-white);
}

.puzzle-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.puzzle-input {
    width: 100%;
    padding: 10px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--color-violet);
    color: var(--color-white);
    border-radius: 4px;
    font-family: 'Share Tech Mono', monospace;
    margin-bottom: 10px;
}

.puzzle-input:focus {
    outline: none;
    border-color: var(--color-cyan);
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

.puzzle-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    margin: 5px 0;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.puzzle-option:hover {
    background: rgba(179, 136, 255, 0.2);
}

.puzzle-option input[type="radio"],
.puzzle-option input[type="checkbox"] {
    cursor: pointer;
}

/* RIGHT PANEL */
.right-panel {
    width: var(--panel-width);
    background: linear-gradient(135deg, rgba(10, 15, 30, 0.9), rgba(26, 31, 58, 0.9));
    border: 1px solid var(--color-copper);
    border-radius: 4px;
    padding: 15px;
    overflow-y: auto;
    box-shadow: inset 0 0 20px rgba(232, 148, 58, 0.1), 0 0 20px rgba(232, 148, 58, 0.2);
    flex-shrink: 0;
}

.right-panel::-webkit-scrollbar {
    width: 8px;
}

.right-panel::-webkit-scrollbar-track {
    background: rgba(232, 148, 58, 0.1);
}

.right-panel::-webkit-scrollbar-thumb {
    background: var(--color-copper);
    border-radius: 4px;
}

/* CHARACTER STATS */
.character-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-label {
    color: var(--color-cyan);
    font-size: 12px;
    letter-spacing: 1px;
}

.stat-value {
    color: var(--color-copper);
    font-weight: bold;
    font-size: 14px;
}

/* CHOICES CONTAINER */
.choices-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-action {
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.3), rgba(0, 212, 255, 0.1));
    border: 1px solid var(--color-cyan);
    color: var(--color-cyan);
    font-family: 'Share Tech Mono', monospace;
    font-size: 12px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s ease;
    letter-spacing: 1px;
    text-align: left;
    padding-left: 12px;
}

.btn-action:hover {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.6), rgba(0, 212, 255, 0.3));
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.5);
    transform: translateX(5px);
}

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

.btn-action:disabled:hover {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.3), rgba(0, 212, 255, 0.1));
    box-shadow: none;
    transform: none;
}

.btn-action.locked::before {
    content: '🔒 ';
    color: var(--color-copper);
}

/* MODALS */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: linear-gradient(135deg, rgba(10, 15, 30, 0.95), rgba(26, 31, 58, 0.95));
    border: 2px solid var(--color-cyan);
    border-radius: 4px;
    padding: 30px;
    max-width: 400px;
    box-shadow: 0 0 40px rgba(0, 212, 255, 0.4);
}

.modal-content h2 {
    font-family: 'Cinzel', serif;
    color: var(--color-cyan);
    margin-bottom: 20px;
    text-align: center;
    letter-spacing: 2px;
}

.modal-content p {
    color: var(--color-white);
    margin-bottom: 20px;
    line-height: 1.6;
    text-align: center;
}

.save-slots {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.save-slot,
.load-slot {
    padding: 12px;
    background: linear-gradient(135deg, rgba(232, 148, 58, 0.3), rgba(232, 148, 58, 0.1));
    border: 1px solid var(--color-copper);
    color: var(--color-copper);
    font-family: 'Share Tech Mono', monospace;
    font-size: 14px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s ease;
    letter-spacing: 1px;
}

.save-slot:hover,
.load-slot:hover {
    background: linear-gradient(135deg, rgba(232, 148, 58, 0.6), rgba(232, 148, 58, 0.3));
    box-shadow: 0 0 15px rgba(232, 148, 58, 0.5);
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

#close-modal,
#close-modal-load,
#confirm-no,
#ending-newgame {
    background: linear-gradient(135deg, rgba(232, 148, 58, 0.3), rgba(232, 148, 58, 0.1));
    border: 1px solid var(--color-copper);
    color: var(--color-copper);
}

#close-modal:hover,
#close-modal-load:hover,
#confirm-no:hover,
#ending-newgame:hover {
    background: linear-gradient(135deg, rgba(232, 148, 58, 0.6), rgba(232, 148, 58, 0.3));
    box-shadow: 0 0 15px rgba(232, 148, 58, 0.5);
}

#confirm-yes {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.3), rgba(0, 212, 255, 0.1));
    border: 1px solid var(--color-cyan);
    color: var(--color-cyan);
    flex: 1;
}

#confirm-yes:hover {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.6), rgba(0, 212, 255, 0.3));
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.5);
}

/* ENDING CONTENT */
.ending-content {
    max-width: 600px;
}

.ending-text {
    color: var(--color-white);
    margin-bottom: 20px;
    line-height: 1.8;
    text-align: center;
}

.ending-text h3 {
    color: var(--color-cyan);
    margin-top: 15px;
    margin-bottom: 10px;
    font-family: 'Cinzel', serif;
    letter-spacing: 1px;
}

/* DIMENSION-SPECIFIC ACCENT COLORS */
.dimension-humana {
    --accent-color: var(--dim-humana);
}

.dimension-silice {
    --accent-color: var(--dim-silice);
}

.dimension-atemporal {
    --accent-color: var(--dim-atemporal);
}

.dimension-transitoria {
    --accent-color: var(--dim-transitoria);
}

/* TRANSITION EFFECTS */
@keyframes dimensionFlash {
    0% { background: rgba(0, 212, 255, 0.3); }
    50% { background: rgba(0, 212, 255, 0.1); }
    100% { background: transparent; }
}

.dimension-transition {
    animation: dimensionFlash 0.8s ease-out;
}

/* FLICKER EFFECT FOR ATEMPORAL */
@keyframes flicker {
    0%, 100% { opacity: 1; }
    10%, 20%, 40%, 60%, 70%, 90% { opacity: 0.9; }
    15%, 35%, 65%, 85% { opacity: 0.8; }
    50% { opacity: 0.95; }
}

.atemporal-flicker {
    animation: flicker 0.15s infinite;
}

/* RESPONSIVE DESIGN */
@media (max-width: 1600px) {
    :root {
        --panel-width: 280px;
    }
}

@media (max-width: 1280px) {
    .game-container {
        flex-direction: column;
    }

    .left-panel,
    .right-panel {
        width: 100%;
        height: 120px;
        overflow-x: auto;
        overflow-y: hidden;
    }

    .panel-section {
        display: inline-block;
        margin-right: 20px;
        white-space: nowrap;
    }

    .center-panel {
        height: calc(100vh - var(--top-height) - 360px);
    }

    .inventory-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 4px;
    }

    .inventory-item {
        font-size: 18px;
    }

    .allies-container {
        flex-direction: row;
        gap: 10px;
        overflow-x: auto;
    }

    .ally-card {
        flex-shrink: 0;
        width: 150px;
    }
}

/* Text selection and other details */
::selection {
    background: var(--color-cyan);
    color: var(--color-darkspace);
}

::-moz-selection {
    background: var(--color-cyan);
    color: var(--color-darkspace);
}
/* TIMELINE PUZZLE STYLES */
.timeline-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 12px 0;
}

.timeline-event {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--color-cyan);
    padding: 10px 14px;
    cursor: grab;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.2s;
    user-select: none;
}

.timeline-event:hover {
    background: rgba(255, 255, 255, 0.1);
}

.timeline-event.dragging {
    opacity: 0.4;
    cursor: grabbing;
}

.drag-handle {
    color: var(--color-cyan);
    font-size: 1.2em;
}

.timeline-hint {
    font-size: 0.8em;
    opacity: 0.6;
    margin-top: 4px;
    font-style: italic;
}