html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 0;
}

.form-floating > .form-control-plaintext::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder {
  text-align: start;
}

.timeline-slot, .host-timeline-slot {
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.timeline-slot:hover, .host-timeline-slot:hover {
  background-color: rgba(255, 193, 7, 0.1);
}

.timeline-slot.border-warning, .host-timeline-slot.border-warning {
  background-color: rgba(255, 193, 7, 0.2);
  border-color: #ffc107 !important;
}

.touch-action-none {
  touch-action: none;
}

#songCard {
  touch-action: none;
  user-select: none;
}

@media (max-width: 767.98px) {
  #host-app .container-fluid {
    padding-left: 12px;
    padding-right: 12px;
  }
}

.connector-line {
  width: 2px;
  height: 20px;
  background: linear-gradient(to bottom, #6c757d, #495057);
  margin: 0 auto;
}

@keyframes resultPop {
  0% { transform: scale(0.5); opacity: 0; }
  70% { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}

.result-animate {
  animation: resultPop 0.4s ease-out;
}

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-slide-in {
  animation: fadeSlideIn 0.3s ease-out;
}

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

.spinner-mini {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

.join-code-box {
  background: linear-gradient(135deg, #2c3036, #212529);
  border: 2px dashed #ffc107;
  border-radius: 12px;
  padding: 1rem 1.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  max-width: 100%;
}

.join-code-text {
  font-family: 'Courier New', monospace;
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: 0.4em;
  color: #ffc107;
}

.copy-btn {
  background: rgba(255, 193, 7, 0.15);
  border: 1px solid rgba(255, 193, 7, 0.3);
  color: #ffc107;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.copy-btn:hover {
  background: rgba(255, 193, 7, 0.25);
}

.copy-btn.copied {
  background: rgba(25, 135, 84, 0.3);
  border-color: rgba(25, 135, 84, 0.5);
  color: #198754;
}

.song-card {
  background: linear-gradient(145deg, #0d6efd, #0b5ed7);
  border: none;
  border-radius: 16px;
  position: relative;
  overflow: hidden;
}

.song-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 40%, rgba(255,255,255,0.08), transparent 60%);
  pointer-events: none;
}

.year-badge {
  font-size: 1.25rem;
  min-width: 60px;
  padding: 0.35rem 0.75rem;
  font-weight: 700;
}

.year-badge-large {
  font-size: 1.5rem;
  min-width: 80px;
  padding: 0.5rem 1rem;
  font-weight: 800;
}

.confirm-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bs-dark);
  padding: 12px 16px;
  z-index: 9999;
  border-top: 1px solid rgba(255,255,255,0.15);
  box-shadow: 0 -4px 12px rgba(0,0,0,0.3);
}

#card-section {
  padding-bottom: 80px !important;
}

/* Full-screen result overlay */
#result-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

#result-overlay.show {
  opacity: 1;
}

#result-overlay .result-icon {
  font-size: 8rem;
  filter: drop-shadow(0 0 40px rgba(0,0,0,0.5));
  animation: resultPopIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes resultPopIn {
  0% { transform: scale(0.2) rotate(-15deg); opacity: 0; }
  60% { transform: scale(1.2) rotate(3deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

@keyframes resultPopOut {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(0.8); opacity: 0; }
}

.other-player-timeline {
  max-height: 60vh;
  overflow-y: auto;
}

.other-player-timeline .card-body {
  padding: 0.5rem 0.75rem;
}

.lang-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.6);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
}

.lang-btn:hover,
.lang-btn.active {
  background: rgba(255,255,255,0.1);
  color: white;
  border-color: rgba(255,255,255,0.4);
}

.view-timeline-btn {
  font-size: 0.75rem;
  padding: 1px 8px;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.view-timeline-btn:hover {
  opacity: 1;
}

.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content-box {
  background: #212529;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 16px;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-header-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.modal-header-box h5 {
  margin: 0;
}

.modal-close-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.timeline-card {
  border-radius: 12px;
  padding: 0;
}

.timeline-card .card-body {
  padding: 1rem 1rem !important;
}

.timeline-card .song-title {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.3;
}

.timeline-card .song-artist {
  font-size: 1rem;
  opacity: 0.7;
  line-height: 1.3;
}

.timeline-card .card-year {
  display: block;
  margin-top: 10px;
  font-size: 3rem;
  min-width: 100px;
  padding: 0.6rem 1.2rem;
  font-weight: 800;
}

.timeline-card-new {
  border: 2px solid #ffc107 !important;
  box-shadow: 0 0 16px rgba(255, 193, 7, 0.5) !important;
  animation: highlightPulse 1.5s ease-in-out 3;
}

@keyframes highlightPulse {
  0%, 100% { box-shadow: 0 0 12px rgba(255, 193, 7, 0.4); }
  50% { box-shadow: 0 0 24px rgba(255, 193, 7, 0.8); }
}

.result-correct {
  color: #198754;
  text-shadow: 0 0 20px rgba(25, 135, 84, 0.3);
}

.result-wrong {
  color: #dc3545;
  text-shadow: 0 0 20px rgba(220, 53, 69, 0.3);
}

/* ===== Sidebar compact timeline ===== */
.compact-timeline .compact-cards {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 4px 0 8px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.compact-timeline .compact-cards::-webkit-scrollbar {
  height: 4px;
}

.compact-timeline .compact-cards::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.2);
  border-radius: 4px;
}

.compact-card {
  flex: 0 0 auto;
  width: 100px;
  border-radius: 8px;
  padding: 6px 8px;
  text-align: center;
  transition: all 0.2s ease;
}

.compact-card .compact-title {
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 90px;
  display: block;
}

.compact-card .compact-artist {
  font-size: 0.62rem;
  opacity: 0.65;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 90px;
  display: block;
}

.compact-card .compact-year {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 800;
  background: rgba(255,255,255,0.15);
  border-radius: 4px;
  padding: 2px 6px;
  margin-top: 4px;
}

.compact-card.card-new {
  border: 2px solid #ffc107 !important;
  box-shadow: 0 0 10px rgba(255, 193, 7, 0.5) !important;
  animation: highlightPulse 1.5s ease-in-out 3;
}

.sidebar-toggle-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.6);
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 6px;
  transition: all 0.2s;
  white-space: nowrap;
}

.sidebar-toggle-btn.active {
  background: rgba(13, 110, 253, 0.3);
  border-color: rgba(13, 110, 253, 0.6);
  color: white;
}

.sidebar-toggle-btn:hover {
  background: rgba(255,255,255,0.15);
}

.my-turn-badge {
  display: inline-block;
  background: linear-gradient(135deg, #198754, #157347);
  color: white;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
}