/* ============================================
   リーダーボード モーダル
   ============================================ */

/* オーバーレイ背景 */
.lb-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 10000;
  justify-content: center;
  align-items: center;
  padding: 16px;
}
.lb-overlay.active {
  display: flex;
}

/* モーダル本体 */
.lb-modal {
  background: #1e1e2e;
  color: #e0e0e0;
  border-radius: 12px;
  max-width: 420px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  animation: lb-slide-in 0.3s ease-out;
}

@keyframes lb-slide-in {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ヘッダー */
.lb-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px 12px;
  border-bottom: 1px solid #333;
}

.lb-header h2 {
  margin: 0;
  font-size: 1.2rem;
  color: #ffd700;
}

.lb-close {
  background: none;
  border: none;
  color: #888;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.lb-close:hover {
  color: #fff;
}

/* 登録フォーム */
.lb-form {
  padding: 16px 20px;
  border-bottom: 1px solid #333;
}

.lb-form p {
  margin: 0 0 8px;
  font-size: 0.9rem;
  color: #aaa;
}

.lb-your-score {
  font-size: 1.3rem;
  font-weight: bold;
  color: #ffd700;
  text-align: center;
  margin: 0 0 12px;
}

.lb-input-row {
  display: flex;
  gap: 8px;
}

.lb-nickname-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #444;
  border-radius: 6px;
  background: #2a2a3e;
  color: #e0e0e0;
  font-size: 0.95rem;
  outline: none;
}
.lb-nickname-input:focus {
  border-color: #ffd700;
}
.lb-nickname-input::placeholder {
  color: #666;
}

.lb-submit-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  background: #ffd700;
  color: #1e1e2e;
  font-weight: bold;
  font-size: 0.9rem;
  cursor: pointer;
  white-space: nowrap;
}
.lb-submit-btn:hover {
  background: #ffed4a;
}
.lb-submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.lb-submit-msg {
  margin: 8px 0 0;
  font-size: 0.85rem;
  text-align: center;
  min-height: 1.2em;
}
.lb-submit-msg.success { color: #4ecdc4; }
.lb-submit-msg.error   { color: #e74c3c; }

/* ランキングテーブル */
.lb-table-wrap {
  padding: 12px 20px 16px;
}

.lb-table-wrap h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
  color: #aaa;
}

.lb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.lb-table th {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 2px solid #444;
  color: #bbb;
  font-weight: normal;
  font-size: 0.8rem;
}

.lb-table td {
  padding: 8px 8px;
  border-bottom: 1px solid #2a2a3e;
  color: #e0e0e0;
}

.lb-table tr:last-child td {
  border-bottom: none;
}

.lb-table .lb-rank {
  width: 32px;
  text-align: center;
  font-weight: bold;
}

.lb-table .lb-rank-1 { color: #ffd700; }
.lb-table .lb-rank-2 { color: #c0c0c0; }
.lb-table .lb-rank-3 { color: #cd7f32; }

.lb-table .lb-name {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb-table .lb-score-col {
  text-align: right;
  font-weight: bold;
  font-variant-numeric: tabular-nums;
}

.lb-table .lb-date {
  text-align: right;
  color: #999;
  font-size: 0.8rem;
}

/* ハイライト行（自分のスコア） */
.lb-table tr.lb-highlight {
  background: rgba(255, 215, 0, 0.1);
}
.lb-table tr.lb-highlight td {
  color: #ffd700;
}

/* ローディング・空状態 */
.lb-loading,
.lb-empty {
  text-align: center;
  padding: 24px;
  color: #666;
  font-size: 0.9rem;
}

/* コンパクトモーダル（登録フォームのみ） */
.lb-modal-compact {
  max-width: 360px;
}
.lb-modal-compact .lb-form {
  border-bottom: none;
}

/* ============================================
   インラインランキング（ゲームページ内埋め込み）
   ============================================ */
.lb-inline {
  background: #1e1e2e;
  border-radius: 12px;
  padding: 20px;
  margin: 24px auto;
  max-width: 480px;
}

.lb-inline-title {
  margin: 0 0 12px;
  font-size: 1.1rem;
  color: #ffd700;
  text-align: center;
}

.lb-inline .lb-table {
  background: transparent;
}

.lb-inline .lb-loading,
.lb-inline .lb-empty {
  padding: 16px;
}

/* レスポンシブ */
@media (max-width: 480px) {
  .lb-modal {
    max-height: 90vh;
    border-radius: 8px;
  }
  .lb-modal-compact {
    max-width: 100%;
  }
  .lb-header { padding: 12px 16px 10px; }
  .lb-form { padding: 12px 16px; }
  .lb-input-row { flex-direction: column; }
  .lb-submit-btn { width: 100%; padding: 10px; }
  .lb-inline {
    padding: 16px 12px;
    margin: 16px auto;
    border-radius: 8px;
  }
}
