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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0e0d12;
  color: #e8e0d0;
  font-family: 'Georgia', serif;
}

#header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1.5rem;
  background: linear-gradient(180deg, rgba(14,13,18,0.98) 0%, rgba(14,13,18,0.85) 100%);
  border-bottom: 1px solid rgba(255,210,80,0.15);
}

#title-block {
  display: flex;
  flex-direction: column;
}

#title {
  font-size: 1.3rem;
  font-weight: bold;
  letter-spacing: 0.15em;
  color: #f5d87a;
  text-shadow: 0 0 18px rgba(245,216,122,0.4);
}

#subtitle {
  font-size: 0.65rem;
  color: #8a7f6a;
  font-style: italic;
  letter-spacing: 0.06em;
}

#stats-block {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.6rem 1.2rem;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
}

.stat-val {
  font-size: 1.1rem;
  font-weight: bold;
  color: #f5d87a;
}

.stat-label {
  font-size: 0.55rem;
  color: #6a6050;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

#arena {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
}

#bubble-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
}

#tasting-panel {
  position: fixed;
  bottom: 3.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  width: min(480px, 90vw);
  background: rgba(18, 16, 22, 0.92);
  border: 1px solid rgba(255,210,80,0.2);
  border-radius: 0.5rem;
  padding: 0.9rem 1.2rem;
  min-height: 4.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  box-shadow: 0 0 30px rgba(0,0,0,0.6);
  transition: opacity 0.3s;
}

#tasting-inner {
  width: 100%;
  text-align: center;
}

#tasting-placeholder {
  color: #5a5248;
  font-style: italic;
  font-size: 0.85rem;
}

#tasting-note {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

#tasting-note.hidden {
  display: none;
}

#note-flavor {
  font-size: 1rem;
  font-weight: bold;
  color: #f5d87a;
  letter-spacing: 0.05em;
}

#note-flavor.rare {
  color: #ff9d3a;
  text-shadow: 0 0 12px rgba(255,157,58,0.5);
  animation: rareGlow 1.5s ease-in-out infinite alternate;
}

@keyframes rareGlow {
  from { text-shadow: 0 0 8px rgba(255,157,58,0.4); }
  to   { text-shadow: 0 0 22px rgba(255,157,58,0.9), 0 0 40px rgba(255,100,0,0.3); }
}

#note-text {
  font-size: 0.82rem;
  color: #c0b8a8;
  font-style: italic;
  line-height: 1.45;
}

#note-rating {
  font-size: 0.75rem;
  color: #8a7f6a;
  margin-top: 0.15rem;
}

#spawn-controls {
  position: fixed;
  bottom: 0.7rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  gap: 0.6rem;
}

#spawn-btn, #leaderboard-btn {
  background: rgba(245,216,122,0.08);
  border: 1px solid rgba(245,216,122,0.3);
  color: #f5d87a;
  font-family: 'Georgia', serif;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  padding: 0.4rem 1.2rem;
  border-radius: 2rem;
  cursor: pointer;
  transition: all 0.2s;
}

#spawn-btn:hover, #leaderboard-btn:hover {
  background: rgba(245,216,122,0.15);
  border-color: rgba(245,216,122,0.6);
}

#spawn-btn:active, #leaderboard-btn:active {
  transform: scale(0.96);
}

/* Leaderboard modal */
#lb-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 7, 11, 0.78);
  backdrop-filter: blur(4px);
}

#lb-modal.hidden {
  display: none;
}

#lb-box {
  width: min(840px, 94vw);
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  background: rgba(18, 16, 22, 0.98);
  border: 1px solid rgba(255,210,80,0.25);
  border-radius: 0.6rem;
  padding: 1.2rem 1.4rem 1.1rem;
  box-shadow: 0 0 40px rgba(0,0,0,0.7);
}

#lb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#lb-title {
  font-size: 1.25rem;
  font-weight: bold;
  letter-spacing: 0.1em;
  color: #f5d87a;
  text-shadow: 0 0 16px rgba(245,216,122,0.4);
}

#lb-close {
  background: none;
  border: none;
  color: #8a7f6a;
  font-size: 1.1rem;
  cursor: pointer;
  transition: color 0.2s;
}

#lb-close:hover {
  color: #f5d87a;
}

#lb-subtitle {
  font-size: 0.7rem;
  color: #8a7f6a;
  font-style: italic;
  letter-spacing: 0.05em;
  margin-bottom: 0.8rem;
}

#lb-table-wrap {
  overflow-y: auto;
  overflow-x: auto;
  flex: 1;
  border-top: 1px solid rgba(255,210,80,0.12);
  border-bottom: 1px solid rgba(255,210,80,0.12);
}

#lb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

#lb-table th {
  position: sticky;
  top: 0;
  background: rgba(18, 16, 22, 0.98);
  color: #6a6050;
  text-transform: uppercase;
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  font-weight: normal;
  text-align: left;
  padding: 0.5rem 0.5rem;
  white-space: nowrap;
}

#lb-table td {
  padding: 0.45rem 0.5rem;
  color: #c0b8a8;
  border-top: 1px solid rgba(255,255,255,0.04);
  white-space: nowrap;
}

#lb-table .lb-rank {
  color: #f5d87a;
  font-weight: bold;
  width: 2rem;
}

#lb-table .lb-score {
  color: #f5d87a;
  font-weight: bold;
}

#lb-table .lb-rare {
  color: #ff9d3a;
}

#lb-table .lb-bpm {
  color: #8fd3c8;
}

#lb-table .lb-missed {
  color: #c98a8a;
}

#lb-table .lb-ratio {
  color: #b0a8d0;
}

#lb-table .lb-bonus {
  color: #d0c08a;
}

#lb-table .lb-duration {
  color: #9ab0c0;
}

#lb-table .lb-date {
  color: #6a6050;
  font-size: 0.72rem;
}

#lb-table .lb-empty {
  text-align: center;
  color: #5a5248;
  font-style: italic;
  padding: 1.4rem;
}

#lb-submit-row {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.9rem;
}

#lb-name {
  flex: 1;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(245,216,122,0.25);
  border-radius: 0.4rem;
  color: #e8e0d0;
  font-family: 'Georgia', serif;
  font-size: 0.8rem;
  padding: 0.45rem 0.7rem;
  outline: none;
}

#lb-name:focus {
  border-color: rgba(245,216,122,0.6);
}

#lb-submit-btn {
  background: rgba(245,216,122,0.12);
  border: 1px solid rgba(245,216,122,0.4);
  color: #f5d87a;
  font-family: 'Georgia', serif;
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  padding: 0.45rem 1.1rem;
  border-radius: 0.4rem;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

#lb-submit-btn:hover {
  background: rgba(245,216,122,0.2);
  border-color: rgba(245,216,122,0.7);
}

#lb-msg {
  min-height: 1rem;
  margin-top: 0.5rem;
  font-size: 0.72rem;
  font-style: italic;
  color: #8a7f6a;
  text-align: center;
}

/* Pop burst overlay */
.pop-burst {
  position: fixed;
  pointer-events: none;
  z-index: 30;
  font-size: 1.4rem;
  animation: popFloat 0.8s ease-out forwards;
}

@keyframes popFloat {
  0%   { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-3rem) scale(1.6); }
}
