/* === Reset & Variables === */

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

:root {
  --bg: #fef7ed;
  --bg-warm: #fef3e2;
  --surface: #ffffff;
  --surface-alt: #fff7ed;
  --text: #1a1a2e;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --ocean: #0891b2;
  --ocean-deep: #0e7490;
  --ocean-light: #a5f3fc;
  --ocean-wash: rgba(8, 145, 178, 0.08);
  --coral: #f97316;
  --coral-light: #fed7aa;
  --sunset: #f59e0b;
  --sunset-light: #fef3c7;
  --pink: #ec4899;
  --pink-light: #fce7f3;
  --success: #10b981;
  --success-light: #d1fae5;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --border: rgba(0, 0, 0, 0.08);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 4px 16px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.12), 0 4px 12px rgba(0,0,0,0.06);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 24px;
  --font-display: 'Lilita One', cursive;
  --font-body: 'Nunito', sans-serif;

  /* Decade card colors */
  --decade-1: var(--coral);
  --decade-2: var(--ocean);
  --decade-3: var(--pink);
  --decade-4: var(--sunset);
}

html, body {
  height: 100%;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

body {
  background:
    radial-gradient(ellipse at 20% 0%, rgba(249, 115, 22, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 0%, rgba(8, 145, 178, 0.06) 0%, transparent 60%),
    var(--bg);
  position: relative;
  min-height: 100%;
}

/* === Decorative Waves === */

.ocean-waves {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  pointer-events: none;
  z-index: 0;
  line-height: 0;
}

.ocean-waves svg {
  width: 100%;
  height: 80px;
}

/* === App Shell === */

.app {
  max-width: 500px;
  margin: 0 auto;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 24px 20px;
  animation: fade-in 0.3s ease-out;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.hidden {
  display: none !important;
}

/* === Buttons === */

.btn {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  min-height: 48px;
  padding: 12px 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  position: relative;
}

.btn:active {
  transform: scale(0.96);
}

.btn-large {
  font-size: 1.1rem;
  padding: 16px 32px;
  border-radius: var(--radius);
  min-height: 56px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--ocean) 0%, var(--ocean-deep) 100%);
  color: #fff;
  box-shadow: 0 4px 16px rgba(8, 145, 178, 0.3);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 6px 24px rgba(8, 145, 178, 0.4);
  transform: translateY(-1px);
}

.btn-primary:disabled {
  background: #cbd5e1;
  color: #94a3b8;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-spotify {
  background: #1db954;
  color: #fff;
  box-shadow: 0 4px 16px rgba(29, 185, 84, 0.3);
}

.btn-spotify:hover {
  box-shadow: 0 6px 24px rgba(29, 185, 84, 0.4);
  transform: translateY(-2px) scale(1.02);
}

.btn-reveal {
  background: linear-gradient(135deg, var(--coral) 0%, #ea580c 100%);
  color: #fff;
  box-shadow: 0 4px 16px rgba(249, 115, 22, 0.3);
}

.btn-reveal:hover {
  box-shadow: 0 6px 24px rgba(249, 115, 22, 0.4);
  transform: translateY(-1px);
}

.btn-success {
  background: var(--success);
  color: #fff;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
}

.btn-success:hover {
  background: #059669;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25);
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-partial {
  background: var(--surface);
  color: var(--text);
  border: 2px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.btn-partial:hover {
  border-color: var(--ocean);
  background: var(--ocean-wash);
}

.btn-text {
  background: none;
  color: var(--text-secondary);
  padding: 8px 12px;
  min-height: auto;
}

.btn-text:hover {
  color: var(--ocean);
}

.btn-icon {
  flex-shrink: 0;
}

/* === Select Controls === */

.select-control {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--surface);
  color: var(--text);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  min-height: 38px;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.select-control:focus {
  outline: none;
  border-color: var(--ocean);
}

/* === Login Screen === */

.centered-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 20px;
}

.login-hero {
  animation: hero-entrance 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes hero-entrance {
  from { opacity: 0; transform: translateY(30px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.hero-icon {
  font-size: 4rem;
  margin-bottom: 8px;
  animation: gentle-bob 3s ease-in-out infinite;
}

@keyframes gentle-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.app-title {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: 0.01em;
  color: var(--text);
  background: linear-gradient(135deg, var(--ocean-deep) 0%, var(--coral) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.app-subtitle {
  color: var(--text-secondary);
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 16px;
}

/* === Decade Selection === */

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

.header h1 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 400;
  color: var(--text);
}

.decade-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}

.decade-btn {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 400;
  background: var(--surface);
  color: var(--text);
  border: 3px solid transparent;
  border-radius: var(--radius);
  padding: 30px 16px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-align: center;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.decade-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--border);
  transition: all 0.2s ease;
}

.decade-btn:nth-child(1)::before { background: var(--decade-1); }
.decade-btn:nth-child(2)::before { background: var(--decade-2); }
.decade-btn:nth-child(3)::before { background: var(--decade-3); }
.decade-btn:nth-child(4)::before { background: var(--decade-4); }

.decade-btn:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.decade-btn.active {
  border-color: var(--ocean);
  background: var(--ocean-wash);
  box-shadow: var(--shadow), 0 0 0 1px var(--ocean);
}

.decade-btn:nth-child(1).active { border-color: var(--decade-1); background: rgba(249, 115, 22, 0.06); box-shadow: var(--shadow), 0 0 0 1px var(--decade-1); }
.decade-btn:nth-child(2).active { border-color: var(--decade-2); background: rgba(8, 145, 178, 0.06); box-shadow: var(--shadow), 0 0 0 1px var(--decade-2); }
.decade-btn:nth-child(3).active { border-color: var(--decade-3); background: rgba(236, 72, 153, 0.06); box-shadow: var(--shadow), 0 0 0 1px var(--decade-3); }
.decade-btn:nth-child(4).active { border-color: var(--decade-4); background: rgba(245, 158, 11, 0.06); box-shadow: var(--shadow), 0 0 0 1px var(--decade-4); }

.decade-btn:nth-child(1).active::before { height: 5px; }
.decade-btn:nth-child(2).active::before { height: 5px; }
.decade-btn:nth-child(3).active::before { height: 5px; }
.decade-btn:nth-child(4).active::before { height: 5px; }

.decade-actions {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

#start-btn {
  width: 100%;
  margin-bottom: 24px;
}

/* === Stats Summary === */

.stats-summary {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.stats-summary h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 400;
  color: var(--ocean-deep);
  letter-spacing: 0.02em;
  margin-bottom: 14px;
}

.stats-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 0;
}

.stats-row + .stats-row {
  border-top: 1px solid var(--border);
}

.stats-label {
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 700;
}

.stats-value {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--ocean);
}

.stats-value-full {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.stats-actions {
  margin-top: 14px;
  text-align: center;
}

/* === Quiz Screen === */

.quiz-header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.active-decades {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--coral);
}

.session-progress {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 700;
}

.quiz-settings {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

.quiz-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  position: relative;
}

/* === Play Button === */

.play-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.play-btn {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--ocean) 0%, var(--ocean-deep) 100%);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  box-shadow:
    0 8px 32px rgba(8, 145, 178, 0.35),
    0 2px 8px rgba(8, 145, 178, 0.2),
    inset 0 2px 4px rgba(255,255,255,0.2);
}

.play-btn::before {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 3px dashed rgba(8, 145, 178, 0.25);
  animation: slow-spin 20s linear infinite;
}

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

.play-btn:hover {
  transform: scale(1.08);
  box-shadow:
    0 12px 40px rgba(8, 145, 178, 0.4),
    0 4px 12px rgba(8, 145, 178, 0.25),
    inset 0 2px 4px rgba(255,255,255,0.2);
}

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

.play-btn.playing {
  background: linear-gradient(145deg, var(--coral) 0%, #ea580c 100%);
  box-shadow:
    0 8px 32px rgba(249, 115, 22, 0.35),
    0 2px 8px rgba(249, 115, 22, 0.2),
    inset 0 2px 4px rgba(255,255,255,0.2);
  animation: bounce-pulse 0.8s ease-in-out infinite;
}

.play-btn.playing::before {
  border-color: rgba(249, 115, 22, 0.3);
  animation: slow-spin 4s linear infinite;
}

@keyframes bounce-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

.play-hint {
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 600;
}

/* === Reveal & Answer === */

.reveal-area, .answer-area {
  width: 100%;
  text-align: center;
}

.reveal-area {
  animation: pop-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes pop-in {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

.answer-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 28px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  animation: card-reveal 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

.answer-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--ocean), var(--coral), var(--pink), var(--sunset));
}

@keyframes card-reveal {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.answer-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 400;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.2;
}

.answer-artist {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ocean-deep);
  margin-bottom: 6px;
}

.answer-year {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 700;
}

.answer-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

.answer-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.answer-actions .btn {
  flex: 1;
}

/* === Toast === */

.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: #fff;
  padding: 14px 28px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 100;
  animation: toast-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-width: 90vw;
}

@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 16px) scale(0.95); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

/* === Loading Spinner === */

.loading {
  color: var(--text-muted);
  text-align: center;
  padding: 40px;
}

.spinner {
  display: inline-block;
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--ocean);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 8px;
}

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