/* Message */
.message {
  width: 100%;
  padding: 12px 18px;
  border-radius: 10px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  animation: fadeIn 0.2s ease;
}

.message.info { background: #eaf2f8; color: #2980b9; border: 1px solid #bdd7ee; }
.message.success { background: #e8f8f0; color: #27ae60; border: 1px solid #a3d9b1; }
.message.error { background: #fce4e4; color: #e74c3c; border: 1px solid #f5b7b1; }
.message.warning { background: #fef9e7; color: #f39c12; border: 1px solid #f9e79f; }

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

/* Panels (leaderboard + history) */
.leaderboard-panel, .history-panel {
  width: 100%;
  margin-top: 16px;
  background: rgba(255,255,255,0.85);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.leaderboard-panel { max-width: 480px; }
.history-panel { max-width: 780px; margin-top: 12px; }

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  cursor: pointer;
  font-weight: 700;
  color: #2c3e50;
  font-size: 14px;
  user-select: none;
  transition: background 0.15s;
}
.panel-header:hover { background: rgba(0,0,0,0.02); }
.leaderboard-panel .panel-header { justify-content: center; }
.panel-arrow { font-size: 11px; color: #95a5a6; transition: transform 0.2s; }

.panel-list {
  overflow-y: auto;
  transition: max-height 0.3s ease;
}

.panel-empty {
  text-align: center;
  color: #95a5a6;
  font-size: 13px;
  padding: 16px;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid transparent;
}

.history-item:hover {
  background: #fff;
  border-color: #e8e3da;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

.history-item-other {
  opacity: 0.6;
  cursor: default;
}

.history-item-other:hover {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.history-info { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

.history-avatar {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  background-size: cover; background-position: center;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: #fff;
}
.history-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }

.history-user { font-size: 12px; font-weight: 700; color: #3498db; min-width: 60px; text-transform: uppercase; letter-spacing: 0.5px; }
.history-difficulty { font-size: 14px; font-weight: 600; color: #2c3e50; }
.history-time { font-size: 13px; font-family: 'Courier New', monospace; color: #7f8c8d; background: #f8f6f2; padding: 2px 8px; border-radius: 4px; }
.history-date { font-size: 12px; color: #95a5a6; }
.history-status { font-size: 12px; font-weight: 600; color: #27ae60; }
.history-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.history-resume {
  font-size: 11px;
  font-weight: 700;
  color: #3498db;
  background: #eaf3fc;
  border-radius: 6px;
  padding: 3px 10px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  pointer-events: none;
  user-select: none;
}

/* Leaderboard */
.leaderboard-panel .panel-list { padding: 0; }

.lb-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 18px;
  border-bottom: 1px solid #f0ede8;
  transition: background 0.12s;
}
.lb-item:last-child { border-bottom: none; }
.lb-item:hover { background: #faf8f5; }

.lb-top {
  background: linear-gradient(90deg, #fffaf0 0%, #fff 40%);
}
.lb-top:hover { background: linear-gradient(90deg, #fdf6e3 0%, #faf8f5 40%); }

.lb-rank {
  width: 28px; flex-shrink: 0;
  font-size: 14px; font-weight: 700; color: #95a5a6; text-align: center;
}
.lb-rank-top {
  width: 28px; font-size: 16px;
}
.lb-item:nth-child(1) .lb-rank-top { color: #f1c40f; }
.lb-item:nth-child(2) .lb-rank-top { color: #bdc3c7; }
.lb-item:nth-child(3) .lb-rank-top { color: #cd7f32; }

.lb-avatar {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  background-size: cover; background-position: center;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: #fff;
}

.lb-username {
  flex: 1; font-size: 14px; font-weight: 500; color: #2c3e50;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.lb-score {
  flex-shrink: 0; text-align: right;
}
.lb-score-num {
  font-size: 18px; font-weight: 700; color: #2c3e50;
}
.lb-score-label {
  font-size: 11px; color: #95a5a6; font-weight: 500;
}

