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

:root {
    --primary: #FF6B9D;
    --secondary: #C44569;
    --accent: #FFD93D;
    --success: #6BCF7F;
    --warning: #FFA502;
    --danger: #FF4757;
    --dark: #2C3E50;
    --light: #ECF0F1;
}

body {
    font-family: 'Poppins', sans-serif;
    overflow: hidden;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* LOADING SCREEN */
#loadingScreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loader {
    text-align: center;
    color: white;
}

.loader h1 {
    font-size: 2.5em;
    margin-bottom: 20px;
    animation: bounce 1s infinite;
}

.spinner {
    width: 60px;
    height: 60px;
    margin: 20px auto;
    border: 5px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* GAME CONTAINER */
#gameContainer {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* TOP BAR */
#topBar {
    background: rgba(44, 62, 80, 0.95);
    backdrop-filter: blur(10px);
    padding: 10px 20px;
    border-bottom: 3px solid var(--primary);
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    z-index: 100;
}

.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.character-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.character-info img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 3px solid var(--accent);
}

.character-info h3 {
    color: white;
    font-size: 1.2em;
    margin-bottom: 2px;
}

.character-info p {
    color: var(--accent);
    font-size: 0.9em;
}

.attributes {
    display: flex;
    gap: 15px;
    flex: 1;
}

.attr {
    display: flex;
    align-items: center;
    gap: 8px;
}

.attr .icon {
    font-size: 1.5em;
}

.bar-container {
    width: 100px;
    height: 20px;
    background: rgba(0,0,0,0.3);
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid rgba(255,255,255,0.2);
}

.bar {
    height: 100%;
    transition: width 0.3s ease;
    border-radius: 8px;
}

.bar.health { background: linear-gradient(90deg, #FF4757, #FF6B9D); }
.bar.energy { background: linear-gradient(90deg, #FFA502, #FFD93D); }
.bar.hunger { background: linear-gradient(90deg, #6BCF7F, #A3E636); }
.bar.happiness { background: linear-gradient(90deg, #FF6B9D, #FFD93D); }

.attr span:last-child {
    color: white;
    font-size: 0.9em;
    font-weight: 600;
    min-width: 60px;
}

.currency {
    display: flex;
    gap: 15px;
}

.coin, .gem {
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(0,0,0,0.3);
    padding: 8px 15px;
    border-radius: 20px;
    border: 2px solid rgba(255,255,255,0.2);
}

.coin .icon, .gem .icon {
    font-size: 1.3em;
}

.coin span:last-child, .gem span:last-child {
    color: white;
    font-weight: 700;
    font-size: 1.1em;
}

.time-display {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0,0,0,0.3);
    padding: 8px 15px;
    border-radius: 20px;
    border: 2px solid rgba(255,255,255,0.2);
    color: white;
    font-weight: 600;
}

/* CANVAS */
#gameCanvas {
    flex: 1;
    display: block;
    background: #000;
}

/* SIDE MENU */
.side-menu {
    position: fixed;
    right: 0;
    top: 0;
    height: 100vh;
    width: 300px;
    background: rgba(44, 62, 80, 0.98);
    backdrop-filter: blur(10px);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 200;
    box-shadow: -5px 0 20px rgba(0,0,0,0.5);
}

.side-menu.closed {
    transform: translateX(100%);
}

.side-menu:not(.closed) {
    transform: translateX(0);
}

.menu-toggle {
    position: absolute;
    left: -50px;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: var(--primary);
    border: none;
    border-radius: 10px 0 0 10px;
    color: white;
    font-size: 1.5em;
    cursor: pointer;
    transition: all 0.3s;
}

.menu-toggle:hover {
    background: var(--secondary);
    transform: translateY(-50%) scale(1.1);
}

.menu-content {
    padding: 20px;
    overflow-y: auto;
    height: 100%;
}

.menu-content h2 {
    color: white;
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.8em;
}

.menu-btn {
    width: 100%;
    padding: 15px;
    margin-bottom: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    color: white;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.menu-btn span {
    font-size: 1.5em;
}

.menu-btn:hover {
    background: var(--primary);
    transform: translateX(-5px);
}

/* PANELS */
.panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    background: rgba(44, 62, 80, 0.98);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 50px rgba(0,0,0,0.5);
    z-index: 300;
    overflow-y: auto;
    display: none;
}

.panel.active {
    display: block;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -40%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.panel h2 {
    color: white;
    margin-bottom: 20px;
    font-size: 2em;
}

.panel-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: var(--danger);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1.5em;
    cursor: pointer;
    transition: all 0.3s;
}

.panel-close:hover {
    background: #D63031;
    transform: rotate(90deg);
}

/* ACTIONS PANEL */
.actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.action-card {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.action-card:hover {
    background: var(--primary);
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(255, 107, 157, 0.5);
}

.action-card h3 {
    color: white;
    margin-bottom: 10px;
    font-size: 1.2em;
}

.action-card p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9em;
    margin-bottom: 15px;
}

.action-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 10px;
}

.stat-badge {
    background: rgba(0, 0, 0, 0.3);
    padding: 5px 10px;
    border-radius: 10px;
    font-size: 0.85em;
    color: white;
}

/* DIALOGUE BOX */
.dialogue-box {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 700px;
    background: rgba(44, 62, 80, 0.98);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 5px 30px rgba(0,0,0,0.5);
    display: none;
    z-index: 400;
}

.dialogue-box.show {
    display: flex;
    animation: slideUp 0.3s ease;
}

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

.npc-avatar {
    width: 80px;
    height: 80px;
    margin-right: 20px;
}

.npc-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid var(--accent);
}

.dialogue-content {
    flex: 1;
}

.dialogue-content h4 {
    color: var(--accent);
    margin-bottom: 10px;
    font-size: 1.3em;
}

.dialogue-content p {
    color: white;
    line-height: 1.6;
}

#dialogueClose {
    background: var(--primary);
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

#dialogueClose:hover {
    background: var(--secondary);
}

/* NOTIFICATION TOAST */
.notification-toast {
    position: fixed;
    top: 100px;
    right: 20px;
    background: rgba(44, 62, 80, 0.98);
    backdrop-filter: blur(10px);
    padding: 15px 25px;
    border-radius: 15px;
    border-left: 5px solid var(--success);
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    color: white;
    font-weight: 600;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s;
    z-index: 500;
}

.notification-toast.show {
    opacity: 1;
    transform: translateX(0);
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .status-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .attributes {
        flex-direction: column;
    }
    
    .bar-container {
        width: 100%;
    }
    
    .side-menu {
        width: 100%;
    }
    
    .panel {
        width: 95%;
        padding: 20px;
    }
}

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

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 5px;
}

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