@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Outfit:wght@300;400;600;700&display=swap');

:root {
  /* Default variables (mapped to Neon Festival) */
  --bg-color: #0f172a;
  --text-color: #f8fafc;
  --primary-color: #f472b6;
  --secondary-color: #22d3ee;
  --accent-color: #c084fc;
  --success-color: #4ade80;
  --danger-color: #f87171;
  --card-bg: rgba(30, 41, 59, 0.7);
  --card-border: rgba(255, 255, 255, 0.1);
  --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.theme-neon {
  --bg-color: #0f172a;
  --text-color: #f8fafc;
  --primary-color: #f472b6;
  --secondary-color: #22d3ee;
  --accent-color: #c084fc;
  --success-color: #4ade80;
  --danger-color: #f87171;
  --card-bg: rgba(30, 41, 59, 0.7);
  --card-border: rgba(255, 255, 255, 0.1);
}

body.theme-retro {
  --bg-color: #1a0f14;
  --text-color: #ffe4e1;
  --primary-color: #ffb347;
  --secondary-color: #ff69b4;
  --accent-color: #ff8c00;
  --success-color: #98fb98;
  --danger-color: #ff6b6b;
  --card-bg: rgba(43, 24, 30, 0.7);
  --card-border: rgba(255, 105, 180, 0.2);
}

body.theme-modern {
  --bg-color: #050505;
  --text-color: #ffffff;
  --primary-color: #e2e8f0;
  --secondary-color: #94a3b8;
  --accent-color: #64748b;
  --success-color: #4ade80;
  --danger-color: #f87171;
  --card-bg: rgba(25, 25, 25, 0.7);
  --card-border: rgba(255, 255, 255, 0.05);
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: var(--font-family);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  height: 100dvh; /* Lock to dynamic viewport height! */
  overflow: hidden; /* Prevent scrolling for a full-screen app feel */
  transition: background-color 0.5s ease, color 0.5s ease;
}

/* Background effects for Neon theme */
body.theme-neon {
    background: radial-gradient(circle at 20% 20%, #1e1b4b 0%, #0f172a 100%);
    position: relative;
}

body.theme-neon::before, body.theme-neon::after {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: var(--primary-color);
    filter: blur(150px);
    opacity: 0.2;
    z-index: -1;
    animation: moveLight 10s infinite alternate ease-in-out;
}

body.theme-neon::after {
    background: var(--secondary-color);
    right: 10%;
    bottom: 10%;
    animation-delay: -5s;
    animation-duration: 15s;
}

@keyframes moveLight {
    0% { transform: translate(0, 0); }
    100% { transform: translate(100px, 100px); }
}

body.theme-retro {
    background-color: #1a0f14;
    background-image: radial-gradient(circle at 50% 50%, #2b181e 0%, #1a0f14 100%);
}

body.theme-modern {
    background-color: #050505;
}

#app {
  width: 100%;
  max-width: 100%; /* Full viewport usage allowed */
  height: 100%; /* Fill the fixed height body */
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 20px;
  box-sizing: border-box;
  overflow: hidden; /* Prevent app leaking bounds */
  position: relative; /* Create stacking context */
  z-index: 10; /* Above the canvas */
}

#celebration-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none; /* Let clicks pass through */
  z-index: 1; /* Below the app UI */
}

/* Glassmorphism Card Style */
.glass-card {
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  width: 100%;
  max-width: 1200px; /* Fits exactly 10 cards without scrolling */
  max-height: 100%; /* Prevent overflowing the parent */
  overflow-y: auto; /* Allow internal scrolling if content is too tall! */
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: fadeIn 0.3s ease-in-out;
}

/* Typography */
h1, h2, h3 {
  font-family: 'Bebas Neue', var(--font-family);
  letter-spacing: 2px;
  color: var(--text-color);
}

h1 {
  font-size: 3.5rem;
  margin-bottom: 0.5rem;
  text-align: center;
  text-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
}

body.theme-neon h1 {
    color: #fff;
    text-shadow: 0 0 20px var(--primary-color), 0 0 40px var(--accent-color);
}

body.theme-retro h1 {
    color: var(--accent-color);
    text-shadow: none;
}

body.theme-modern h1 {
    color: #fff;
    text-shadow: none;
}

p {
  font-size: 1.1rem;
  line-height: 1.5;
  text-align: center;
}

/* Form Elements */
input[type="text"], input[type="number"], select {
  width: 100%;
  padding: 12px;
  border-radius: 6px;
  border: 1px solid var(--card-border);
  background-color: #010409;
  color: var(--text-color);
  box-sizing: border-box;
  font-size: 1rem;
  transition: border-color 0.2s;
}

input[type="text"]:focus, input[type="number"]:focus, select:focus {
  outline: none;
  border-color: var(--accent-color);
}

/* Buttons */
button {
  padding: 14px 24px;
  min-width: 160px; /* Give buttons a consistent standard width */
  align-self: center; /* Center buttons within flex-direction: column containers */
  border-radius: 8px;
  border: 2px solid var(--primary-color);
  background-color: transparent;
  color: var(--text-color);
  font-family: 'Outfit', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  text-transform: uppercase;
  letter-spacing: 1px;
}

button:hover {
  background-color: var(--primary-color);
  color: var(--bg-color);
  box-shadow: 0 0 20px var(--primary-color);
  transform: translateY(-2px);
}

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

button.secondary {
  border-color: var(--secondary-color);
  color: var(--secondary-color);
}

button.secondary:hover {
  background-color: var(--secondary-color);
  color: var(--bg-color);
  box-shadow: 0 0 20px var(--secondary-color);
}

/* Player Controls */
.player-controls {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin: 10px 0;
}

button.icon-btn {
  width: 64px;
  height: 64px;
  min-width: 64px; /* Override standard button min-width */
  padding: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  line-height: 1;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Utilities */
.hidden {
  display: none !important;
}

.spinner {
  border: 4px solid rgba(255, 255, 255, 0.1);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border-left-color: var(--accent-color);
  animation: spin 1s linear infinite;
  display: inline-block;
}

.success { color: var(--success-color); }
.danger { color: var(--danger-color); }

/* Timeline Cards */
.timeline-container {
  width: 100%;
  padding: 10px 0;
  position: relative; /* Anchor the absolute arrow inside this instead of wrapper! */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 3000 20' width='3000' height='20'%3E%3Cpath d='M 0 10 L 2980 10' stroke='%23f472b6' stroke-width='2'/%3E%3Cpolygon points='2980,0 3000,10 2980,20' fill='%23f472b6'/%3E%3C/svg%3E");
  background-position: right top 108px; /* 118px target line height - 10px SVG center */
  background-repeat: no-repeat;
  background-size: auto 20px; /* Maintain aspect ratio! */
}

.scrolling-box {
  width: calc(100% - 35px); /* End scroll area before the arrow head at the right edge! */
  overflow-x: auto; /* Enable horizontal scrolling here! */
}

.timeline-cards {
  display: flex;
  flex-wrap: nowrap; /* Keep horizontal */
  gap: 12px;
  padding: 4px;
  padding-right: 50px; /* Make room for arrow and prevent cards from overlapping it! */
  min-height: 140px; /* Prevent height collapse when empty! */
  position: relative;
}

/* Horizon line and arrow are now handled as background images on .timeline-container */

/* New stationary Arrow Marker attached to the non-scrolling wrapper! */
.timeline-wrapper {
  position: relative; /* Anchor the absolute arrow */
  width: 100%;
}

/* Arrow marker handles as background on timeline-container */

.timeline-card {
  flex: 0 0 100px; /* Shrink width slightly */
  height: 100px; /* Make it square-ish */
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transition: transform 0.2s;
}

.timeline-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.timeline-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px; /* The line crosses exactly in this gap */
  flex: 0 0 100px; /* Match card width */
  position: relative;
  z-index: 1; /* Anchor above the background horizontal line */
}

.timeline-year {
  font-size: 0.9rem;
  font-weight: bold;
  color: #fff; /* Ensure text is white or from variables */
  background: rgba(0, 0, 0, 0.6);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--card-border);
  min-width: 40px;
  text-align: center;
}

.timeline-item.preview .timeline-card {
  border: 2px dashed var(--accent-color);
  opacity: 0.8;
  box-shadow: 0 0 10px var(--accent-color);
}

.timeline-item.preview .placeholder-img {
  background: #161b22;
  color: var(--accent-color);
  font-size: 3rem; /* Bigger question mark */
}

.timeline-card img {
  width: 100%;
  height: 100px; /* Match width */
  object-fit: cover;
}

.timeline-card .placeholder-img {
  width: 100%;
  height: 100px; /* Match width */
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 2rem;
  background: #161b22;
}

.timeline-card .card-info {
  padding: 4px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end; /* Push text to bottom */
  background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0) 100%);
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
}

.timeline-card .card-year {
  font-size: 1rem;
  font-weight: bold;
  color: #fff;
}

.timeline-card .card-title {
  font-size: 0.8rem;
  color: #eee;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timeline-card .card-artist {
  font-size: 0.7rem;
  color: #ccc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.empty-timeline {
  color: #888;
  font-style: italic;
  text-align: center;
  width: 100%;
  padding: 20px;
}

/* Reveal Details */
.reveal-details {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.reveal-item {
  background: rgba(255, 255, 255, 0.05);
  padding: 12px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

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

.reveal-item .label {
  font-weight: bold;
  color: #888;
  font-size: 0.9rem;
}

.reveal-item .success {
  font-weight: bold;
}

.reveal-item .danger {
  font-weight: bold;
}

.guess-diff {
  font-size: 0.9rem;
  color: #888;
}

.guess-strike {
  text-decoration: line-through;
  color: var(--danger-color);
}

.guess-close {
  color: var(--success-color); /* Green for close enough */
  font-weight: bold;
}

.guess-correct {
  color: var(--success-color); /* Green for perfect guess */
  font-weight: bold;
}

@keyframes dropInCard {
  0% { opacity: 0; transform: translateY(-40px) scale(1.1); box-shadow: 0 15px 20px rgba(0,0,0,0.4); }
  100% { opacity: 1; transform: translateY(0) scale(1); box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
}

.new-card-anim {
  animation: dropInCard 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Mobile Responsiveness Improvements */
@media (max-width: 600px) {
    #app {
        padding: 10px;
        overflow: auto; /* Allow scrolling on mobile if content is too tall */
    }
    
    .glass-card {
        padding: 16px;
        gap: 12px;
        max-height: initial; /* Let card grow to full height on mobile */
        overflow-y: visible; /* Rely on #app scrollbar */
    }
    
    #draggable-card-container {
        margin: 5px 0 !important;
    }
    
    h1 {
        font-size: 2.2rem;
    }
    
    p {
        font-size: 1rem;
    }
    
    button {
        padding: 10px 16px;
        font-size: 1rem;
        min-width: auto; /* Allow buttons to shrink */
    }
    
    .player-controls {
        gap: 10px;
    }
    
    button.icon-btn {
        width: 48px;
        height: 48px;
        min-width: 48px;
        font-size: 1.4rem;
    }
    
    /* Ensure the timeline cards don't blow up */
    .timeline-cards {
        min-height: 100px;
    }
    
    .timeline-card {
        flex: 0 0 80px;
        height: 80px;
    }
    
    .timeline-card img {
        height: 80px;
    }
    
    .timeline-card .placeholder-img {
        height: 80px;
        font-size: 1.5rem;
    }
    
    .timeline-item {
        flex: 0 0 80px;
    }
    
    .timeline-cards::before {
        top: 88px; /* Adjusted for 80px card height */
    }
    
    .timeline-cards::after {
        top: calc(88px - 0.55em);
    }

    .timeline-container {
        background-position: right top 88px; /* 98px target line height - 10px SVG center */
        background-size: auto 20px;
    }
}

/* Floating Install Button */
#install-btn {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 1000;
    padding: 6px 12px;
    font-size: 0.8rem;
    min-width: auto;
    border-radius: 20px;
    border-color: var(--secondary-color);
    color: var(--secondary-color);
    background-color: rgba(30, 41, 59, 0.8); /* Match card-bg for contrast */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
    font-weight: bold;
}

#install-btn:hover {
    background-color: var(--secondary-color);
    color: var(--bg-color);
    box-shadow: 0 0 15px var(--secondary-color);
}

/* Coin Stacks */
.coin-stack {
    display: inline-flex;
    flex-direction: column-reverse; /* Stack bottom to top */
    align-items: center;
    gap: 2px;
    vertical-align: middle;
}

.coin {
    width: 24px;
    height: 6px;
    background: linear-gradient(to right, #ffe066 0%, #f5c518 50%, #d4a000 100%); /* Gold gradient */
    border-radius: 3px;
    border: 1px solid rgba(0, 0, 0, 0.3);
    box-shadow: 0 1px 1px rgba(0,0,0,0.5);
}

.points-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-family: 'Bebas Neue', var(--font-family);
}

.points-number {
    font-size: 1.2rem;
    color: #ffd700;
}
