/* === TEAM PHONE STYLES === */

:root {
  --bg-primary: #0a0a1a;
  --bg-surface: #141428;
  --bg-elevated: #1e1e3a;
  --text-primary: #f0f0ff;
  --text-secondary: #8888aa;
  --accent-primary: #6c5ce7;
  --accent-glow: rgba(108, 92, 231, 0.3);
  --color-correct: #00e676;
  --color-incorrect: #ff5252;
  --color-waiting: #ffd740;
  --team-color: #6c5ce7;
  --bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --reveal-timing: 800ms cubic-bezier(0.16, 1, 0.3, 1);
}

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

html, body {
  background: var(--bg-primary);
  background-image: radial-gradient(ellipse at 50% 0%, rgba(108, 92, 231, 0.12) 0%, transparent 60%);
  color: var(--text-primary);
  font-family: 'Outfit', sans-serif;
  font-size: 16px;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

#app {
  min-height: 100vh;
  position: relative;
}

/* Phase management */
.phase {
  display: none;
  min-height: 100vh;
}

.phase.active {
  display: flex;
  flex-direction: column;
  animation: phaseEnter 400ms ease both;
}

@keyframes phaseEnter {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* === TEAM SELECTION === */

#phase-select {
  padding: 2rem 1rem;
  align-items: center;
}

#phase-select .logo {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(3.5rem, 14vw, 5rem);
  letter-spacing: 0.05em;
  text-align: center;
  margin-bottom: 0.5rem;
  text-shadow:
    0 0 15px var(--accent-glow),
    0 0 40px var(--accent-glow),
    0 0 80px rgba(108, 92, 231, 0.15);
  animation: titlePulseMobile 3s ease-in-out infinite;
}

@keyframes titlePulseMobile {
  0%, 100% {
    text-shadow:
      0 0 15px var(--accent-glow),
      0 0 40px var(--accent-glow),
      0 0 80px rgba(108, 92, 231, 0.15);
  }
  50% {
    text-shadow:
      0 0 20px rgba(108, 92, 231, 0.5),
      0 0 50px rgba(108, 92, 231, 0.4),
      0 0 100px rgba(108, 92, 231, 0.2);
  }
}

.select-prompt {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

/* === TEAM CREATION FORM === */

.create-team-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  width: 100%;
  max-width: 400px;
  padding: 2rem 0;
}

.team-name-input {
  width: 100%;
  padding: 1rem;
  background: var(--bg-elevated);
  border: 2px solid transparent;
  border-radius: 12px;
  color: var(--text-primary);
  font-family: 'Outfit', sans-serif;
  font-size: 1.1rem;
  text-align: center;
  outline: none;
  transition: border-color 200ms ease;
}

.team-name-input:focus {
  border-color: var(--accent-primary);
}

.team-name-input::placeholder {
  color: var(--text-secondary);
  opacity: 0.6;
}

.create-error {
  font-size: 0.85rem;
  color: var(--color-incorrect);
  text-align: center;
}

.btn-large {
  width: 100%;
  padding: 1rem;
  font-size: 1.1rem;
  border-radius: 12px;
}

/* === TEAM HEADER === */

.team-header {
  padding: 1rem;
  text-align: center;
  font-family: 'Bebas Neue', sans-serif;
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: 0.06em;
  color: #000;
  flex-shrink: 0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* === CENTERED MESSAGE === */

.centered-message {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
  gap: 1rem;
}

.big-text {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 2.5rem;
  letter-spacing: 0.03em;
}

.waiting-text {
  font-size: 1rem;
  color: var(--text-secondary);
  animation: pulseOpacity 2s ease-in-out infinite;
}

@keyframes pulseOpacity {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* === MINI EQUALIZER === */

.mini-equalizer {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 70px;
  margin-bottom: 1rem;
}

.mini-equalizer .eq-bar {
  width: 10px;
  border-radius: 3px 3px 0 0;
  animation: eqBounce 1.2s ease-in-out infinite;
}

.mini-equalizer .eq-bar:nth-child(1) { background: #FF6B35; height: 60%; animation-delay: 0s; }
.mini-equalizer .eq-bar:nth-child(2) { background: #4ECDC4; height: 80%; animation-delay: 0.15s; }
.mini-equalizer .eq-bar:nth-child(3) { background: #FFE66D; height: 45%; animation-delay: 0.3s; }
.mini-equalizer .eq-bar:nth-child(4) { background: #FF69B4; height: 90%; animation-delay: 0.1s; }
.mini-equalizer .eq-bar:nth-child(5) { background: #7B68EE; height: 55%; animation-delay: 0.25s; }
.mini-equalizer .eq-bar:nth-child(6) { background: #98FB98; height: 75%; animation-delay: 0.05s; }
.mini-equalizer .eq-bar:nth-child(7) { background: #FF4444; height: 65%; animation-delay: 0.2s; }

@keyframes eqBounce {
  0%, 100% { transform: scaleY(0.3); }
  50% { transform: scaleY(1); }
}

/* === TIMELINE (read-only) === */

.timeline-readonly {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.timeline-card {
  background: var(--bg-elevated);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  border-left: 4px solid var(--team-color);
}

.timeline-card .card-year {
  font-family: 'Space Mono', monospace;
  font-weight: 700;
  font-size: 1rem;
  color: var(--team-color);
}

.timeline-card .card-info {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.15rem;
}

/* === TIMELINE (interactive/guessing) === */

.guess-prompt {
  padding: 1rem;
  text-align: center;
  font-weight: 600;
}

.card-count {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.timeline-interactive {
  padding: 0.5rem 1rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 0;
  flex: 1;
  overflow-y: auto;
}

.placement-slot {
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0.25rem 0;
  border: 2px dashed rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  cursor: pointer;
  transition: all 200ms ease;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  animation: slotPulse 2s ease-in-out infinite;
  -webkit-tap-highlight-color: transparent;
  background: rgba(108, 92, 231, 0.03);
}

.placement-slot:active {
  transform: scale(0.97);
  background: rgba(var(--team-color), 0.15);
  border-color: var(--team-color);
}

@keyframes slotPulse {
  0%, 100% {
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: none;
  }
  50% {
    border-color: var(--team-color);
    box-shadow: 0 0 20px rgba(108, 92, 231, 0.25), inset 0 0 15px rgba(108, 92, 231, 0.08);
  }
}

/* === SUBMITTED CHECK === */

.check-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--color-correct);
  color: #000;
  font-size: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  animation: popIn 500ms var(--bounce) both;
  box-shadow: 0 0 30px rgba(0, 230, 118, 0.4), 0 0 60px rgba(0, 230, 118, 0.15);
}

@keyframes popIn {
  from { transform: scale(0); }
  to { transform: scale(1); }
}

/* === REVEAL === */

.reveal-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
  gap: 1.5rem;
}

.reveal-song-info {
  opacity: 0;
}

.reveal-song-info.visible {
  animation: revealBlurIn var(--reveal-timing) both;
}

@keyframes revealBlurIn {
  from {
    opacity: 0;
    filter: blur(15px);
    transform: scale(0.85);
  }
  to {
    opacity: 1;
    filter: blur(0);
    transform: scale(1);
  }
}

.reveal-song-info .reveal-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 2rem;
  line-height: 1.1;
}

.reveal-song-info .reveal-artist {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.reveal-song-info .reveal-year {
  font-family: 'Space Mono', monospace;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--color-waiting);
  margin-top: 0.5rem;
  opacity: 0;
}

.reveal-song-info .reveal-year.visible {
  animation: yearFlashIn 600ms var(--bounce) both;
}

@keyframes yearFlashIn {
  0% {
    opacity: 0;
    transform: scale(2);
    text-shadow: 0 0 60px rgba(255, 215, 64, 0.8);
  }
  60% {
    opacity: 1;
    text-shadow: 0 0 40px rgba(255, 215, 64, 0.6);
  }
  100% {
    transform: scale(1);
    text-shadow: 0 0 20px rgba(255, 215, 64, 0.3);
  }
}

.team-result {
  font-size: 1.5rem;
  font-weight: 700;
  padding: 1rem 2rem;
  border-radius: 12px;
  opacity: 0;
}

.team-result.visible {
  animation: resultPop 400ms var(--bounce) both;
}

@keyframes resultPop {
  from {
    opacity: 0;
    transform: scale(0.5);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.team-result.correct {
  background: rgba(0, 230, 118, 0.15);
  color: var(--color-correct);
  border: 2px solid var(--color-correct);
}

.team-result.incorrect {
  background: rgba(255, 82, 82, 0.15);
  color: var(--color-incorrect);
  border: 2px solid var(--color-incorrect);
}

.team-result.no-answer {
  background: rgba(136, 136, 170, 0.15);
  color: var(--text-secondary);
  border: 2px solid var(--text-secondary);
}

/* === SCOREBOARD (Vertical Bar Chart) === */

.scoreboard-section {
  padding: 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.section-title {
  font-size: 1rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
  margin-top: 1rem;
}

.chart-area-mobile {
  position: relative;
  height: 45vh;
  display: flex;
  flex-direction: column;
}

.finish-line-mobile {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  border-top: 3px dashed var(--color-waiting);
  box-shadow: 0 0 15px rgba(255, 215, 64, 0.4);
  z-index: 2;
}

.finish-label-mobile {
  position: absolute;
  right: 0;
  top: -1.4rem;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 0.8rem;
  color: var(--color-waiting);
  letter-spacing: 0.15em;
}

.bars-container-mobile {
  flex: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 0.5rem;
  padding-top: 1.5rem;
}

.bar-column-mobile {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  max-width: 60px;
  height: 100%;
  justify-content: flex-end;
}

.bar-stack-mobile {
  width: 100%;
  display: flex;
  flex-direction: column-reverse;
  border-radius: 6px 6px 0 0;
  overflow: hidden;
  transition: height 800ms var(--bounce);
}

.bar-segment-mobile {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Space Mono', monospace;
  font-size: 0.55rem;
  font-weight: 700;
  color: rgba(0, 0, 0, 0.6);
  min-height: 0;
  transition: min-height 600ms var(--bounce);
}

.bar-segment-mobile.new-card {
  animation: segmentGlow 1.5s ease both;
}

@keyframes segmentGlow {
  0% {
    box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.6);
  }
  100% {
    box-shadow: inset 0 0 0px rgba(255, 255, 255, 0);
  }
}

.bar-label-mobile {
  margin-top: 0.5rem;
  font-weight: 700;
  font-size: 0.7rem;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.bar-column-mobile.my-team .bar-stack-mobile {
  box-shadow: 0 0 12px rgba(108, 92, 231, 0.5);
}

/* === WINNER PHASE === */

.winner-content-mobile {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  gap: 0.5rem;
}

.winner-title-mobile {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(3rem, 12vw, 5rem);
  letter-spacing: 0.05em;
  animation: winnerBounce 600ms var(--bounce) both;
}

.winner-subtitle-mobile {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(2rem, 8vw, 3rem);
  color: var(--color-waiting);
  letter-spacing: 0.1em;
  animation: winnerBounce 600ms var(--bounce) 200ms both;
}

@keyframes winnerBounce {
  from {
    opacity: 0;
    transform: scale(0.3);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* === CONFETTI === */

.confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  width: 10px;
  height: 10px;
  top: -20px;
  animation: confettiFall linear forwards;
}

@keyframes confettiFall {
  to {
    transform: translateY(110vh) rotate(720deg);
    opacity: 0;
  }
}

/* === MODAL === */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal.hidden {
  display: none !important;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
}

.modal-content {
  position: relative;
  background: var(--bg-surface);
  border-radius: 16px 16px 0 0;
  padding: 1.5rem;
  width: 100%;
  max-width: 500px;
  animation: slideUp 300ms ease both;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-title {
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 1rem;
  text-align: center;
}

.modal-between {
  text-align: center;
  padding: 0.75rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.modal-between .between-card {
  color: var(--text-primary);
  font-weight: 600;
  padding: 0.25rem 0;
}

.modal-between .between-arrow {
  font-size: 1.5rem;
  color: var(--team-color);
  padding: 0.25rem 0;
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
}

.modal-actions .btn {
  flex: 1;
  padding: 1rem;
  font-size: 1rem;
  border-radius: 10px;
}

/* === BUTTONS === */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-family: 'Outfit', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

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

.btn-primary {
  background: var(--accent-primary);
  color: #fff;
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.hidden {
  display: none !important;
}
