/* ============================================================
   Stick Hero LAN - Stylesheet
   Developed by binht.nguyen (SATTI P) - All rights reserved.
   ============================================================ */

/* ===== RESET & BASE ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  color: #333;
  -webkit-font-smoothing: antialiased;
}

/* ===== ANIMATED GRADIENT BACKGROUND (warm green-cream) ===== */
@keyframes gradientShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

body {
  background: linear-gradient(-45deg, #a8d8a8, #c5e8c5, #f5f0e1, #e8e0c8, #b8d8b8, #f0ead5);
  background-size: 400% 400%;
  animation: gradientShift 25s ease infinite;
}

/* ===== SCREEN MANAGEMENT ===== */
.screen {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.screen.active {
  display: flex;
}

/* ===== COPYRIGHT ===== */
.copyright {
  position: absolute;
  bottom: 8px;
  right: 12px;
  font-size: 10px;
  color: rgba(0, 0, 0, 0.25);
  pointer-events: none;
  z-index: 9999;
  user-select: none;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-block;
  padding: 14px 36px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
  outline: none;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-primary {
  background: #e74c3c;
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: #c0392b;
}

.btn-accent {
  background: #e67e22;
  color: #fff;
}

.btn-accent:hover:not(:disabled) {
  background: #d35400;
}

.btn-secondary {
  background: rgba(0, 0, 0, 0.08);
  color: #555;
  border: 1px solid rgba(0, 0, 0, 0.15);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(0, 0, 0, 0.15);
  color: #333;
}

/* ===== MAIN MENU ===== */
.menu-container {
  text-align: center;
}

.game-title {
  font-size: 64px;
  font-weight: 900;
  color: #1a1a1a;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  line-height: 1.1;
  margin-bottom: 40px;
}

.game-title span {
  color: #e74c3c;
  font-size: 20px;
  font-weight: 700;
  display: block;
  margin-top: 4px;
}

.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
}

.menu-buttons .btn {
  min-width: 220px;
}

/* ===== GAME HUD ===== */
.game-hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 10;
  pointer-events: none;
}

.hud-score {
  font-size: 32px;
  font-weight: 900;
  color: #1a1a1a;
  text-shadow: 0 1px 4px rgba(255, 255, 255, 0.5);
}

.hud-highscore {
  font-size: 16px;
  color: rgba(0, 0, 0, 0.4);
  margin-left: 40px;
}

.hud-timer {
  font-size: 28px;
  font-weight: 700;
  color: #e67e22;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
  font-variant-numeric: tabular-nums;
}

.hud-mini-lb {
  font-size: 12px;
  color: rgba(0, 0, 0, 0.5);
  text-align: right;
  line-height: 1.4;
}

.hud-left, .hud-right, .hud-center {
  display: flex;
  align-items: center;
}

.hud-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

/* ===== CANVAS ===== */
canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: transparent;
}

/* ===== GAME OVER OVERLAY ===== */
.gameover-overlay {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

.gameover-box {
  background: #fff;
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-radius: 16px;
  padding: 40px;
  text-align: center;
  min-width: 300px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

.gameover-box h2 {
  font-size: 32px;
  color: #e74c3c;
  margin-bottom: 16px;
}

.gameover-box p {
  font-size: 18px;
  margin-bottom: 8px;
  color: #555;
}

.gameover-box .btn {
  margin-top: 12px;
  width: 100%;
}

/* ===== DEAD OVERLAY ===== */
.dead-overlay {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

.dead-box {
  background: #fff;
  border: 2px solid rgba(231, 76, 60, 0.3);
  border-radius: 16px;
  padding: 30px;
  text-align: center;
  min-width: 280px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

.dead-box h2 {
  font-size: 28px;
  color: #e74c3c;
  margin-bottom: 10px;
}

.dead-box p {
  font-size: 16px;
  margin-bottom: 6px;
  color: #555;
}

.dead-placement {
  font-size: 24px;
  font-weight: 900;
  color: #e67e22;
  margin-bottom: 6px;
}

.spectating-text {
  color: rgba(0, 0, 0, 0.35);
  font-size: 13px;
  margin-top: 12px;
  font-style: italic;
}

/* ===== LOBBY ===== */
.lobby-container {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 16px;
  padding: 30px 40px;
  text-align: center;
  min-width: 360px;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

.lobby-container h2 {
  font-size: 28px;
  margin-bottom: 20px;
  color: #1a1a1a;
}

.room-id-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 24px;
  font-size: 18px;
  color: #555;
}

.room-id {
  font-size: 32px;
  font-weight: 900;
  color: #e67e22;
  letter-spacing: 4px;
  font-family: 'Courier New', monospace;
}

.player-list-container {
  margin-bottom: 20px;
}

.player-list-container h3 {
  font-size: 14px;
  color: rgba(0, 0, 0, 0.4);
  margin-bottom: 10px;
}

.player-list {
  list-style: none;
  max-height: 280px;
  overflow-y: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  text-align: left;
}

.player-list li {
  padding: 6px 14px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #333;
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.08);
  transition: all 0.15s ease;
}

.player-list li:hover {
  background: rgba(0, 0, 0, 0.08);
}

.player-list li .player-list-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
  object-fit: cover;
  border: 1px solid rgba(0, 0, 0, 0.1);
}


.waiting-text {
  color: #e67e22;
  font-size: 16px;
  margin-bottom: 20px;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ===== TIME LIMIT INPUT ===== */
.time-limit-container {
  margin-bottom: 20px;
}

.time-limit-container label {
  display: block;
  font-size: 13px;
  color: rgba(0, 0, 0, 0.4);
  margin-bottom: 6px;
}

.time-limit-container input {
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 6px;
  color: #1a1a1a;
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  padding: 8px 16px;
  width: 120px;
  font-family: 'Courier New', monospace;
  outline: none;
}

.time-limit-container input:focus {
  border-color: #e67e22;
}

/* ===== LOGIN ===== */
.login-container {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 16px;
  padding: 30px 40px;
  text-align: center;
  min-width: 360px;
  max-width: 440px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

.login-container h2 {
  font-size: 28px;
  margin-bottom: 24px;
  color: #1a1a1a;
}

.login-field {
  margin-bottom: 18px;
  text-align: left;
}

.login-field label {
  display: block;
  font-size: 13px;
  color: rgba(0, 0, 0, 0.4);
  margin-bottom: 6px;
}

.login-field input {
  width: 100%;
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 6px;
  color: #1a1a1a;
  font-size: 16px;
  padding: 10px 14px;
  outline: none;
  text-transform: uppercase;
}

.login-field input:focus {
  border-color: #e67e22;
}

.avatar-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
  max-height: 200px;
  overflow-y: auto;
}

.avatar-swatch {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  cursor: pointer;
  border: 3px solid transparent;
  transition: all 0.15s ease;
  object-fit: cover;
  background: rgba(0, 0, 0, 0.05);
}

.avatar-swatch:hover {
  transform: scale(1.15);
}

.avatar-swatch.selected {
  border-color: #e67e22;
  box-shadow: 0 0 12px rgba(230, 126, 34, 0.5);
}

/* ===== AVATAR ICONS IN TABLES / LISTS ===== */
.lb-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  vertical-align: middle;
  margin-right: 4px;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.mini-lb-entry {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.mini-lb-avatar {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.error-text {
  color: #e74c3c;
  font-size: 13px;
  margin-bottom: 12px;
}

/* ===== HOST GAME SCREEN ===== */
.host-game-hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  pointer-events: none;
}

.host-timer span {
  font-size: 36px;
  font-weight: 900;
  color: #e67e22;
  text-shadow: 0 2px 8px rgba(230, 126, 34, 0.3);
  font-variant-numeric: tabular-nums;
}

.host-leaderboard {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 16px;
  padding: 30px 36px;
  z-index: 10;
  width: 50%;
  max-width: 700px;
  max-height: 70vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

.host-leaderboard h3 {
  font-size: 24px;
  color: rgba(0, 0, 0, 0.5);
  margin-bottom: 20px;
  text-transform: uppercase;
  letter-spacing: 2px;
  text-align: center;
}

.host-leaderboard table {
  font-size: 18px;
}

.host-leaderboard th {
  font-size: 15px;
  padding: 10px 12px;
}

.host-leaderboard td {
  padding: 12px;
  font-size: 18px;
}

.host-leaderboard table,
.postgame-table,
.dead-box table,
.gameover-box table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.host-leaderboard th,
.postgame-table th,
.dead-box th,
.gameover-box th {
  text-align: left;
  padding: 4px 6px;
  color: rgba(0, 0, 0, 0.35);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.host-leaderboard td,
.postgame-table td,
.dead-box td,
.gameover-box td {
  padding: 6px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  color: #333;
}

.host-leaderboard tr:hover td,
.postgame-table tr:hover td {
  background: rgba(0, 0, 0, 0.02);
}

.status-alive {
  color: #27ae60;
  font-weight: 600;
}

.status-dead {
  color: #e74c3c;
  font-weight: 600;
}

/* ===== POST GAME ===== */
.postgame-container {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 16px;
  padding: 30px 40px;
  text-align: center;
  min-width: 400px;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

.postgame-container h2 {
  font-size: 32px;
  color: #e67e22;
  margin-bottom: 20px;
}

.postgame-container .btn {
  margin-top: 16px;
  min-width: 180px;
}

/* ===== PODIUM (Top 3) ===== */
.podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 16px;
  margin-bottom: 24px;
}

.podium-card {
  background: #fff;
  border-radius: 12px 12px 0 0;
  padding: 16px 20px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  min-width: 120px;
  position: relative;
}

.podium-card .podium-rank {
  font-size: 14px;
  font-weight: 700;
  color: rgba(0, 0, 0, 0.4);
  margin-bottom: 6px;
}

.podium-card .podium-avatar-wrap {
  margin: 0 auto 8px;
  display: flex;
  justify-content: center;
}

.podium-card .podium-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(0, 0, 0, 0.1);
}

.podium-card.podium-1st .podium-avatar {
  width: 60px;
  height: 60px;
  border-color: #f1c40f;
}

.podium-card .podium-name {
  font-size: 15px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 4px;
  word-break: break-word;
}

.podium-card .podium-score {
  font-size: 24px;
  font-weight: 900;
  color: #e67e22;
}

.podium-card.podium-1st {
  border-top: 4px solid #f1c40f;
  padding-top: 24px;
  padding-bottom: 28px;
}

.podium-card.podium-1st .podium-rank {
  font-size: 18px;
  color: #f1c40f;
}

.podium-card.podium-1st .podium-score {
  font-size: 32px;
}

.podium-card.podium-2nd {
  border-top: 4px solid #bdc3c7;
}

.podium-card.podium-3rd {
  border-top: 4px solid #cd7f32;
}

.podium-spacer {
  width: 120px;
  flex-shrink: 0;
}

/* Results table for ranks 4+ */
.results-table-container {
  max-height: 200px;
  overflow-y: auto;
  margin-top: 8px;
}

.results-table-container table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.results-table-container th {
  text-align: left;
  padding: 6px 8px;
  color: rgba(0, 0, 0, 0.35);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  position: sticky;
  top: 0;
  background: #fff;
}

.results-table-container td {
  padding: 6px 8px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  color: #333;
}


/* ===== MODAL ===== */
.modal {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-box {
  background: #fff;
  border: 2px solid rgba(231, 76, 60, 0.3);
  border-radius: 16px;
  padding: 30px 40px;
  text-align: center;
  min-width: 300px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

.modal-box h2 {
  color: #e74c3c;
  margin-bottom: 12px;
}

.modal-box p {
  color: #555;
  margin-bottom: 16px;
}

/* ===== INSTRUCTIONS OVERLAY ===== */
.instructions-box {
  background: #fff;
  border: 2px solid rgba(230, 126, 34, 0.3);
  border-radius: 16px;
  padding: 30px 40px;
  text-align: left;
  min-width: 360px;
  max-width: 500px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

.instructions-box h2 {
  font-size: 28px;
  color: #e67e22;
  margin-bottom: 20px;
  text-align: center;
}

.instructions-diagram {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 0;
  margin: 20px auto;
  padding: 20px 0;
  background: linear-gradient(180deg, #a8d8a8, #f5f0e1);
  border-radius: 12px;
  position: relative;
  height: 120px;
}

.diagram-platform {
  width: 60px;
  height: 60px;
  background: #000;
  border-radius: 4px;
  position: relative;
  flex-shrink: 0;
}

.diagram-character {
  position: absolute;
  top: -24px;
  right: 4px;
  width: 14px;
  height: 20px;
  background: #1a1a1a;
  border-radius: 50% 50% 30% 30%;
}

.diagram-character::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 0;
  width: 100%;
  height: 4px;
  background: #e74c3c;
  border-radius: 2px;
}

.diagram-stick {
  width: 3px;
  height: 50px;
  background: #000;
  transform: rotate(0deg);
  transform-origin: bottom center;
  margin-bottom: 60px;
  margin-left: -1px;
}

.diagram-gap {
  width: 50px;
  flex-shrink: 0;
}

.diagram-marker {
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 6px;
  background: #e74c3c;
  border-radius: 1px;
}

.instructions-content {
  font-size: 14px;
  line-height: 1.6;
  color: #333;
}

.instructions-content p {
  margin-bottom: 10px;
}

.instructions-content ul {
  margin: 6px 0 12px 20px;
}

.instructions-content li {
  margin-bottom: 4px;
}

.instructions-box .btn {
  margin-top: 16px;
  width: 100%;
}

/* ===== MUSIC TOGGLE BUTTON ===== */
.music-toggle {
  position: fixed;
  bottom: 12px;
  left: 12px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.15);
  background: rgba(255, 255, 255, 0.9);
  font-size: 18px;
  cursor: pointer;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.music-toggle:hover {
  transform: scale(1.1);
  background: rgba(255, 255, 255, 1);
}

.music-toggle.muted {
  opacity: 0.5;
}

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


/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.12);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.25);
}

/* ===== PERFECT HIT INDICATOR ===== */
.perfect-indicator {
  position: absolute;
  font-size: 24px;
  font-weight: 900;
  color: #f1c40f;
  text-shadow: 0 0 20px rgba(241, 196, 15, 0.8);
  pointer-events: none;
  z-index: 15;
  animation: perfectFloat 1s ease-out forwards;
}

@keyframes perfectFloat {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-60px) scale(1.5);
  }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
  .game-title {
    font-size: 42px;
  }
  .game-title span {
    font-size: 14px;
  }
  .btn {
    padding: 12px 24px;
    font-size: 14px;
  }
  .lobby-container,
  .login-container,
  .postgame-container {
    min-width: auto;
    width: 90%;
    padding: 20px;
  }
  .host-leaderboard {
    width: 200px;
    font-size: 11px;
  }
}
