:root {
    --primary: #ff4b72;
    --primary-dark: #cc3a59;
    --bg-gradient-1: #1a1a2e;
    --bg-gradient-2: #16213e;
    --bg-gradient-3: #0f3460;
    --text-main: #ffffff;
    --text-muted: #b0b0b0;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background: linear-gradient(135deg, var(--bg-gradient-1), var(--bg-gradient-2), var(--bg-gradient-3));
    color: var(--text-main);
    min-height: 100vh;
    overflow: hidden; /* For mobile app feel */
}

/* Base Screen Style */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.screen.active {
    opacity: 1;
    pointer-events: all;
    z-index: 10;
}

/* Glassmorphism Styles */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* Splash Screen */
#splash-screen {
    justify-content: center;
    align-items: center;
    background: var(--bg-gradient-1);
    z-index: 50;
}

#splash-screen h1 {
    font-size: 1.2rem;
    font-weight: 300;
    color: var(--text-muted);
}

.heart-pulse {
    font-size: 5rem;
    animation: pulse 1s infinite alternate ease-in-out;
    margin-bottom: 20px;
}

@keyframes pulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.2); }
}

/* Login Screen */
#login-screen {
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.login-container {
    padding: 40px 30px;
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-container h2 {
    font-size: 2rem;
    margin-bottom: 5px;
    color: var(--primary);
}

.login-container p {
    color: var(--text-muted);
    margin-bottom: 30px;
    font-size: 0.95rem;
}

.input-group {
    margin-bottom: 20px;
}

.input-group input {
    width: 100%;
    padding: 16px 20px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    background: rgba(0,0,0,0.2);
    color: white;
    font-size: 1rem;
    transition: all 0.3s;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(0,0,0,0.4);
}

.error-text {
    color: #ff4b4b;
    font-size: 0.9rem;
    min-height: 20px;
    margin-bottom: 15px;
}

button {
    width: 100%;
    padding: 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s, transform 0.1s;
}

button:hover {
    background: var(--primary-dark);
}

button:active {
    transform: scale(0.98);
}

/* Dashboard Screen */
#dashboard-screen {
    padding: 0;
    overflow-y: auto;
    /* Imagen elegida por el usuario con una capa oscura por encima para que las letras blancas resalten */
    background-image: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.7)), url('fondo.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
}

.dashboard-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    padding: 30px 20px 20px;
    background: rgba(0,0,0,0.2);
    border-bottom: 1px solid var(--glass-border);
    margin-bottom: 20px;
}

.profile-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
.compact-counter {
    background: rgba(255, 75, 114, 0.15);
    border: 1px solid var(--primary);
    color: white;
    padding: 6px 15px;
    border-radius: 20px;
    font-size: 1rem;
    font-weight: 300;
    margin-top: -5px;
    text-shadow: 0 0 5px rgba(0,0,0,0.5);
    box-shadow: 0 0 10px rgba(255, 75, 114, 0.2);
}
.compact-counter span {
    font-weight: 700;
    color: var(--primary);
}

.profile-pic {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--primary);
    box-shadow: 0 0 20px rgba(255, 75, 114, 0.4);
}

header h2 {
    font-size: 1.8rem;
    font-weight: 400;
}

#logout-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    width: auto;
    padding: 6px 12px;
    font-size: 0.8rem;
    background: rgba(0,0,0,0.5);
    border: 1px solid var(--primary);
}

.balance-badge {
    background: rgba(255, 204, 0, 0.15);
    border: 1px solid #ffcc00;
    color: #ffcc00;
    padding: 8px 15px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 1.1rem;
    box-shadow: 0 0 15px rgba(255, 204, 0, 0.4);
    transition: transform 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.reward-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 25px;
    background: rgba(0,0,0,0.2);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--glass-border);
}
.reward-table th, .reward-table td {
    padding: 12px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.reward-table th {
    background: rgba(255, 75, 114, 0.3);
    color: var(--primary);
    font-weight: bold;
    font-size: 1.1rem;
}
.reward-table tr:last-child td {
    border-bottom: none;
}
.reward-amount {
    color: #ffcc00;
    font-weight: bold;
    font-size: 1.2rem;
    text-shadow: 0 0 10px rgba(255,204,0,0.4);
}

main {
    padding: 0 20px 40px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
}

.card {
    padding: 25px;
    text-align: center;
}

.card h3 {
    margin-bottom: 20px;
    font-size: 1.3rem;
    font-weight: 400;
}

.counter-display {
    display: flex;
    justify-content: space-around;
    margin-bottom: 15px;
}

.time-block {
    display: flex;
    flex-direction: column;
}

.time-block span {
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
    text-shadow: 0 0 10px rgba(255, 75, 114, 0.3);
}

.time-block label {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 5px;
}

.subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    opacity: 0.7;
}

#love-note {
    width: 100%;
    min-height: 150px;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--glass-border);
    color: white;
    border-radius: 12px;
    padding: 15px;
    font-size: 1.1rem;
    resize: none;
    margin-bottom: 10px;
}

#love-note:focus {
    outline: none;
    border-color: var(--primary);
}

.note-actions {
    text-align: right;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Sidebar Menu */
#sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    width: 250px;
    height: 100vh;
    background: rgba(15, 20, 30, 0.95);
    backdrop-filter: blur(20px);
    z-index: 200;
    transition: left 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 5px 0 15px rgba(0,0,0,0.5);
    border-right: 1px solid var(--glass-border);
}
#sidebar.open {
    left: 0;
}
.nav-links {
    list-style: none;
    margin-top: 10px;
}
.nav-links li {
    padding: 20px;
    font-size: 1.2rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    cursor: pointer;
    transition: background 0.2s;
}
.nav-links li:hover, .nav-links li.active {
    background: rgba(255, 75, 114, 0.2);
    border-left: 5px solid var(--primary);
}

#sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.5);
    z-index: 199;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s;
}
#sidebar-overlay.open {
    opacity: 1;
    pointer-events: all;
}

/* App Views */
.app-view {
    animation: fadeIn 0.4s ease;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Social Wall Styles */
.upload-btn {
    display: inline-block;
    padding: 12px 25px;
    background: linear-gradient(45deg, var(--primary), #ff8a00);
    color: white;
    border-radius: 25px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    transition: transform 0.2s;
}
.upload-btn:active {
    transform: scale(0.95);
}

.post-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 15px;
    overflow: hidden;
    backdrop-filter: blur(10px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}
.post-header {
    display: flex;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.post-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 15px;
    object-fit: cover;
    border: 2px solid var(--primary);
}
.post-author {
    font-weight: bold;
    font-size: 1.1rem;
}
.post-time {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-left: auto;
}
.post-image {
    width: 100%;
    max-height: 400px;
    object-fit: contain;
    background: rgba(0,0,0,0.5);
    display: block;
}
.post-actions {
    padding: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.like-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.8rem;
    cursor: pointer;
    padding: 0;
    width: auto;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: transform 0.2s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}
.like-btn.liked {
    color: #ff4b4b;
    text-shadow: 0 0 10px rgba(255,75,75,0.5);
    transform: scale(1.1);
}
.like-count {
    font-size: 1.1rem;
    font-weight: bold;
}
.download-btn {
    float: right;
    background: transparent;
    border: 1px solid var(--text-muted);
    color: var(--text-muted);
    padding: 6px 15px;
    border-radius: 20px;
    text-decoration: none;
    font-size: 0.9rem;
    cursor: pointer;
    margin-top: 5px;
    transition: all 0.2s;
}
.download-btn:hover {
    color: white;
    border-color: white;
    background: rgba(255,255,255,0.1);
}
.post-comments {
    padding: 15px;
    background: rgba(0,0,0,0.2);
}
.comment {
    margin-bottom: 10px;
    font-size: 0.95rem;
}
.comment span {
    font-weight: bold;
    color: var(--primary);
    margin-right: 8px;
}
.add-comment {
    display: flex;
    margin-top: 15px;
    gap: 10px;
}
.add-comment input {
    flex: 1;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 10px 15px;
    border-radius: 20px;
    outline: none;
}
.add-comment button {
    width: auto;
    padding: 8px 15px;
    border-radius: 20px;
    background: var(--primary);
    font-size: 0.9rem;
}

/* Roulette Styles */
.roulette-container {
    position: relative;
    width: 250px;
    height: 250px;
    margin: 30px auto;
}
.pointer {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 40px;
    z-index: 10;
    color: white;
    text-shadow: 0 4px 6px rgba(0,0,0,0.8);
    display: flex;
    justify-content: center;
}
.roulette-wheel {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 5px solid rgba(255,255,255,0.3);
    /* Colors: Dark pink, Purple, Crimson, Indigo, Deep Pink */
    background: conic-gradient(
        #c71585 0 72deg, 
        #8a2be2 72deg 144deg, 
        #b03060 144deg 216deg, 
        #4b0082 216deg 288deg, 
        #dc143c 288deg 360deg
    );
    position: relative;
    overflow: hidden;
    /* Soft cubic bezier for realistic spin slow down */
    transition: transform 4s cubic-bezier(0.1, 0.7, 0.1, 1);
    box-shadow: 0 0 30px rgba(0,0,0,0.8);
}
.slice-text {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 110px; /* stretch center to edge */
    height: 20px;
    margin-top: -10px;
    transform-origin: 0 50%;
    /* Aligning with the center of each conic section */
    /* 0deg in conic is Top. 0deg in rotate is Right. 
       -90deg shift needed for Top. Slice length: 72deg. Half is 36deg.
       -90 + 36 = -54 offset. */
    transform: rotate(calc(var(--i) * 72deg - 54deg));
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 10px;
    color: white;
    font-size: 0.85rem;
    font-weight: 800;
    text-shadow: 2px 2px 3px rgba(0,0,0,1);
    z-index: 5;
}

/* Result Modal Display Container */
#result-modal {
    justify-content: center;
    align-items: center;
    background: rgba(0,0,0,0.8);
    z-index: 100;
}
.modal-content {
    animation: popUp 0.6s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
}
@keyframes popUp {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* ============================ */
/* 3D KAMASUTRA DICE ANIMATIONS */
/* ============================ */
.scene { width: 160px; height: 160px; perspective: 600px; }
.cube { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; transition: transform 3s cubic-bezier(0.175, 0.885, 0.32, 1.275); transform: rotateX(-15deg) rotateY(-15deg); }
.cube-face { position: absolute; width: 160px; height: 160px; background: rgba(0, 0, 0, 0.85); border: 2px solid #ff4b72; border-radius: 15px; box-shadow: inset 0 0 20px rgba(255, 75, 114, 0.5); font-size: 3rem; font-weight: bold; color: white; display: flex; justify-content: center; align-items: center; text-align: center; line-height: 1.2; text-shadow: 2px 2px 5px black; }

.cube-face-front  { transform: rotateY(  0deg) translateZ(80px); }
.cube-face-right  { transform: rotateY( 90deg) translateZ(80px); }
.cube-face-back   { transform: rotateY(180deg) translateZ(80px); }
.cube-face-left   { transform: rotateY(-90deg) translateZ(80px); }
.cube-face-top    { transform: rotateX( 90deg) translateZ(80px); }
.cube-face-bottom { transform: rotateX(-90deg) translateZ(80px); }
/* Scratch Card (Rasca y Gana) Styles */
#scratch-board h3 {
    margin-bottom: 5px;
}
#scratch-game-area {
    box-shadow: inset 0 0 20px rgba(0,0,0,0.8), 0 0 15px rgba(0, 198, 255, 0.2);
}
#scratch-prize-display {
    user-select: none;
}
#scratch-canvas {
    filter: drop-shadow(0 0 5px rgba(0,0,0,0.5));
}
.scratch-bought #btn-buy-scratch {
    display: none;
}

@keyframes scratchReveal {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.1); opacity: 0; pointer-events: none; }
}
.scratch-finished #scratch-canvas {
    animation: scratchReveal 0.8s forwards;
}

/* --- BOTÓN FLOTANTE MÚSICA --- */
.music-fab {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    z-index: 9999;
    cursor: pointer;
    box-shadow: 0 5px 20px rgba(0,0,0,0.5);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.music-fab:active {
    transform: scale(0.9);
}

.music-fab.playing {
    border-color: var(--primary);
    box-shadow: 0 0 20px var(--primary);
    animation: music-pulse 2s infinite ease-in-out;
}

@keyframes music-pulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 75, 114, 0.7); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 15px rgba(255, 75, 114, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 75, 114, 0); }
}

