:root {
    --primary: #f3d47d; /* Gold */
    --accent: #9d50bb; /* Purple */
    --accent-dark: #6e48aa;
    --bg-dark: #0f0c29;
    --glass: rgba(255, 255, 255, 0.1);
    --glass-heavy: rgba(255, 255, 255, 0.2);
    --text: #ffffff;
    --text-dim: rgba(255, 255, 255, 0.7);
    --safe-bottom: env(safe-area-inset-bottom);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: #0a0a12 url('bg_minimal.jpg') no-repeat center center / cover;
    color: white;
    margin: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#app {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
.app-header {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(to bottom, rgba(15, 12, 41, 0.8), transparent);
    z-index: 10;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: var(--glass);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.app-header h1 {
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: 2px;
    color: var(--primary);
    text-transform: uppercase;
}

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

.filters button {
    background: var(--glass);
    border: none;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    cursor: pointer;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: white;
}

.filters button:hover {
    background: var(--glass-heavy);
    transform: translateY(-2px);
}

.filters button:active {
    transform: scale(0.9);
}

.filters button.active {
    background: var(--accent);
    box-shadow: 0 0 15px var(--accent);
    border-color: rgba(255, 255, 255, 0.4);
    transform: scale(1.1);
}

#toggle-favs.active {
    background: rgba(255, 71, 87, 0.3); /* Soft red instead of purple */
    box-shadow: 0 0 15px rgba(255, 71, 87, 0.4);
    border-color: rgba(255, 71, 87, 0.5);
}

/* Timeline */
#timeline-container {
    flex: 1;
    overflow-x: hidden;
    overflow-y: auto;
    padding-bottom: 100px;
}

.timeline-track {
    display: flex;
    width: 300%; /* 3 days */
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.day-view {
    width: 33.33%;
    padding: 0 20px;
}

.more-stages-btn {
    width: 100%;
    background: var(--glass);
    border: 1px dashed rgba(255,255,255,0.3);
    color: white;
    padding: 15px;
    border-radius: 16px;
    font-weight: 800;
    cursor: pointer;
    margin-top: 20px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.more-stages-btn:hover {
    background: var(--glass-heavy);
    border-color: var(--primary);
    transform: translateY(-2px);
}

.more-stages-btn span {
    font-size: 1.5rem;
    color: var(--primary);
}

.stage-section {
    margin-bottom: 30px;
}

.stage-title {
    font-size: 0.9rem;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
}

.stage-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, var(--primary), transparent);
}

.acts-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

/* Desktop Horizontal View */
@media (min-width: 768px) {
    .acts-list {
        display: flex;
        overflow-x: auto;
        padding-bottom: 10px;
        scroll-snap-type: x mandatory;
        gap: 15px;
    }
    
    .act-card {
        min-width: 300px;
        scroll-snap-align: start;
    }
    
    .acts-list::-webkit-scrollbar {
        height: 6px;
    }
    
    .acts-list::-webkit-scrollbar-thumb {
        background: var(--glass-heavy);
        border-radius: 3px;
    }
}

/* Act Card */
.act-card {
    background: var(--glass);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.act-card:active {
    transform: scale(0.98);
    background: var(--glass-heavy);
}

.act-card.popular {
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(243, 212, 125, 0.2);
}

.act-info h3 {
    font-size: 1.1rem;
    margin-bottom: 4px;
}

.act-time {
    font-size: 0.8rem;
    color: var(--text-dim);
}

.ascii-reaction {
    font-family: monospace;
    font-size: 0.8rem;
    color: var(--primary);
    margin-top: 5px;
    opacity: 0.9;
    animation: float-ascii 3s ease-in-out infinite;
    transform-origin: center;
}

@keyframes float-ascii {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-3px) scale(1.05); }
}

.act-rating-display {
    font-size: 1.5rem;
}

.popular-badge {
    color: var(--primary);
    font-size: 1.1rem;
    margin-left: 8px;
    display: inline-block;
    font-family: monospace;
    animation: float-ascii 2.5s ease-in-out infinite;
    transform-origin: center;
    vertical-align: middle;
    text-shadow: 0 0 8px rgba(255, 0, 255, 0.4);
}

/* Bottom Nav */
.bottom-nav {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: rgba(15, 12, 41, 0.8);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    display: flex;
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 20;
    margin-bottom: var(--safe-bottom);
}

.nav-item {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-dim);
    padding: 12px 5px;
    border-radius: 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.nav-item.active {
    background: var(--primary);
    color: #000;
}

.day-label {
    font-size: 0.9rem;
    font-weight: 800;
}

.day-date {
    font-size: 0.6rem;
    opacity: 0.8;
}

/* Bottom Sheet */
.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #1a1a2e;
    border-radius: 30px 30px 0 0;
    padding: 20px 20px calc(20px + var(--safe-bottom));
    z-index: 100;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 -10px 40px rgba(0,0,0,0.5);
}

.bottom-sheet.visible {
    transform: translateY(0);
}

.sheet-handle {
    width: 40px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    margin: 0 auto 20px;
}

#rating-artist-name {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 5px;
}

#rating-stage-time {
    color: var(--primary);
    margin-bottom: 30px;
    font-weight: 600;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-bottom: 30px;
}

.emoji-btn {
    background: var(--glass);
    border: 2px solid transparent;
    font-size: 2.2rem;
    padding: 13px 0;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

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

.emoji-btn.active {
    transform: scale(1.1);
    border: 2px solid white;
}

/* Idle States with Translucent Backgrounds */
.emoji-btn[data-rating="awful"] {
    background: rgba(255, 71, 87, 0.15);
    border-color: rgba(255, 71, 87, 0.3);
}
.emoji-btn[data-rating="boring"] {
    background: rgba(255, 159, 67, 0.15);
    border-color: rgba(255, 159, 67, 0.3);
}
.emoji-btn[data-rating="cool"] {
    background: rgba(241, 196, 15, 0.15);
    border-color: rgba(241, 196, 15, 0.3);
}
.emoji-btn[data-rating="great"] {
    background: rgba(46, 204, 113, 0.15);
    border-color: rgba(46, 204, 113, 0.3);
}
.emoji-btn[data-rating="mindblowing"] {
    background: rgba(52, 152, 219, 0.15);
    border-color: rgba(52, 152, 219, 0.3);
}

/* Hover States (slightly more visible) */
.emoji-btn[data-rating="awful"]:hover {
    background: rgba(255, 71, 87, 0.3);
}
.emoji-btn[data-rating="boring"]:hover {
    background: rgba(255, 159, 67, 0.3);
}
.emoji-btn[data-rating="cool"]:hover {
    background: rgba(241, 196, 15, 0.3);
}
.emoji-btn[data-rating="great"]:hover {
    background: rgba(46, 204, 113, 0.3);
}
.emoji-btn[data-rating="mindblowing"]:hover {
    background: rgba(52, 152, 219, 0.3);
}

/* Active States with Opaque Backgrounds & Glowing Shadows */
.emoji-btn[data-rating="awful"].active {
    background: #ff4757;
    box-shadow: 0 0 15px rgba(255, 71, 87, 0.6);
}
.emoji-btn[data-rating="boring"].active {
    background: #ff9f43;
    box-shadow: 0 0 15px rgba(255, 159, 67, 0.6);
}
.emoji-btn[data-rating="cool"].active {
    background: #f1c40f;
    box-shadow: 0 0 15px rgba(241, 196, 15, 0.6);
}
.emoji-btn[data-rating="great"].active {
    background: #2ecc71;
    box-shadow: 0 0 15px rgba(46, 204, 113, 0.6);
}
.emoji-btn[data-rating="mindblowing"].active {
    background: #3498db;
    box-shadow: 0 0 15px rgba(52, 152, 219, 0.6);
}

.act-card.social-highlight {
    border: 2px solid #ff00ff;
    box-shadow: 0 0 20px rgba(255, 0, 255, 0.4);
    animation: pulse-border 2s infinite;
}

@keyframes pulse-border {
    0% { box-shadow: 0 0 10px rgba(255, 0, 255, 0.2); }
    50% { box-shadow: 0 0 25px rgba(255, 0, 255, 0.6); }
    100% { box-shadow: 0 0 10px rgba(255, 0, 255, 0.2); }
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
    z-index: 90;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

/* Stats */
.global-stats {
    margin-top: 20px;
    padding: 15px;
    background: rgba(255,255,255,0.05);
    border-radius: 12px;
}

.stat-bar {
    height: 8px;
    width: 100%;
    background: #333;
    border-radius: 4px;
    display: flex;
    overflow: hidden;
    margin-bottom: 10px;
}

.stat-pos {
    height: 100%;
    background: #4cd137;
}

.stat-neg {
    height: 100%;
    background: #e84118;
}

#stat-summary {
    font-size: 0.85rem;
    color: var(--text-dim);
    text-align: center;
    cursor: pointer;
    user-select: none;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 4px 0;
}

#stat-summary:hover {
    color: #fff;
}

.expand-arrow {
    font-size: 0.9rem;
    color: var(--primary);
    transition: transform 0.2s;
}

.voters-breakdown {
    margin-top: 10px;
    background: rgba(0, 0, 0, 0.35);
    border-radius: 12px;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 160px;
    overflow-y: auto;
}

.voter-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    padding: 5px 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
}

.voter-row.is-me {
    border: 1px solid rgba(243, 212, 125, 0.4);
    background: rgba(243, 212, 125, 0.1);
}

.voter-name {
    font-weight: 600;
    color: #fff;
}

.voter-vote {
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 8px;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 4px;
}

.voter-vote.voter-awful { color: #ff4757; background: rgba(255, 71, 87, 0.18); }
.voter-vote.voter-boring { color: #ff9f43; background: rgba(255, 159, 67, 0.18); }
.voter-vote.voter-cool { color: #f1c40f; background: rgba(241, 196, 15, 0.18); }
.voter-vote.voter-great { color: #2ecc71; background: rgba(46, 204, 113, 0.18); }
.voter-vote.voter-mindblowing { color: #3498db; background: rgba(52, 152, 219, 0.18); }

.search-links {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.search-btn {
    flex: 1;
    text-decoration: none;
    text-align: center;
    padding: 10px 0;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 800;
    color: white;
    transition: transform 0.2s;
}

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

.search-btn.yt { background: #ff0000; }
.search-btn.sp { background: #1DB954; }
.search-btn.sc { background: #ff7700; }

/* Modals */
.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: #1a1a2e;
    width: 100%;
    max-width: 500px;
    border-radius: 24px;
    padding: 25px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.8);
    border: 1px solid rgba(255,255,255,0.1);
}

.modal header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.wallet {
    background: var(--glass);
    padding: 5px 15px;
    border-radius: 12px;
    font-weight: 800;
    color: var(--primary);
}

.close-modal {
    background: transparent;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
}

/* Shop */
.shop-grid {
    display: grid;
    gap: 20px;
}

.shop-item {
    background: var(--glass);
    border-radius: 20px;
    padding: 15px;
    display: flex;
    gap: 15px;
    align-items: center;
}

.item-preview {
    width: 80px;
    height: 80px;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
}

.item-preview img {
    width: 100%; height: 100%;
    object-fit: contain;
}

.buy-btn {
    margin-top: 10px;
    background: var(--primary);
    border: none;
    padding: 8px 15px;
    border-radius: 10px;
    font-weight: 800;
    cursor: pointer;
}

.shop-item.unlocked .buy-btn {
    background: #4cd137;
    pointer-events: none;
}

.shop-item.unlocked .buy-btn::after {
    content: ' - OWNED';
}

/* Game */
#game-container {
    position: relative;
    width: 100%;
    height: 340px;
    background: #000;
    border-radius: 16px;
    overflow: hidden;
    touch-action: manipulation;
    contain: content;
}

#game-canvas {
    width: 100%;
    height: 100%;
    touch-action: manipulation;
    display: block;
}

#game-start-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 10px;
    pointer-events: auto;
    z-index: 10;
}

#game-start-overlay.hidden {
    display: none !important;
    pointer-events: none !important;
}

#start-game-btn {
    background: var(--accent);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 12px;
    font-weight: 800;
    cursor: pointer;
}

.game-content header {
    transition: opacity 0.3s;
}

#game-score-display {
    transition: opacity 0.3s;
}

.hidden {
    display: none !important;
}

/* Rating Bottom Sheet Close Hint */
.close-hint {
    position: absolute;
    top: -50px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-dim);
    margin: 0;
    letter-spacing: 0.5px;
    animation: pulse-opacity 2s infinite;
    pointer-events: none;
    z-index: 101;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

@keyframes pulse-opacity {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 0.9; }
}

/* Scoreboard Styling */
#scoreboard-container {
    width: 85%;
    max-height: 140px;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 10px 15px;
    margin-top: 5px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#scoreboard-container h3 {
    font-size: 0.85rem;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    text-align: center;
    font-weight: 800;
    margin-bottom: 2px;
}

#scoreboard-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.scoreboard-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    padding: 4px 8px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.02);
}

.scoreboard-row.current-user {
    background: rgba(243, 212, 125, 0.15);
    border: 1px solid var(--primary);
    font-weight: bold;
}

.scoreboard-rank {
    width: 20px;
    font-weight: bold;
    color: var(--text-dim);
}

.scoreboard-rank-1 { color: #ffd700; }
.scoreboard-rank-2 { color: #c0c0c0; }
.scoreboard-rank-3 { color: #cd7f32; }

.scoreboard-name {
    flex: 1;
    text-align: left;
    padding-left: 5px;
    text-transform: capitalize;
}

.scoreboard-score {
    font-weight: 800;
    color: var(--primary);
}

#scoreboard-container::-webkit-scrollbar {
    width: 4px;
}

#scoreboard-container::-webkit-scrollbar-thumb {
    background: var(--glass-heavy);
    border-radius: 2px;
}
