/* =========================
   Ranking Table Style
========================= */

.rank-wrap {
  width: 100%;
  margin: 0 auto;
}

.rank-box {
  width: 100%;
  max-width: none;
  margin: 0 auto;
  background: rgba(18, 31, 52, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 14px;
  box-sizing: border-box;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.rank-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  font-size: 12px;
  color: #f3f7ff;
  font-weight: 600;
  line-height: 1.2;
}

/* ===== Header ===== */
.rank-table thead th {
  background: #13233d;
  color: #ffffff;
  padding: 12px 10px;
  text-align: center;
  white-space: nowrap;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.rank-table thead th:first-child {
  border-top-left-radius: 10px;
}

.rank-table thead th:last-child {
  border-top-right-radius: 10px;
}

/* ===== Body ===== */
.rank-table tbody td {
  background: rgba(25, 40, 68, 0.92);
  color: #f3f7ff;
  padding: 5px 10px;
  text-align: center;
  white-space: nowrap;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.rank-table tbody tr:hover td {
  background: rgba(32, 51, 86, 0.98);
}

/* ===== Columns ===== */
.rank-table td.name-col {
  text-align: left;
  font-weight: 700;
  color: #ffffff;
}

.rank-table td.rank-col {
  text-align: center;
  width: 72px;
}

.rank-table td.rank-col .rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 20px;
  padding: 0 10px;
  border-radius: 999px;
  background: #0b1830;
  color: #ffcc33;
  font-weight: 800;
  line-height: 1;
}

/* 数値 */
.rank-table td.score-col,
.rank-table td.count-col,
.rank-table td.max-col,
.rank-table td.time-col {
  color: #ffffff;
  font-variant-numeric: tabular-nums;
}

/* ===== アルトン以下 ===== */

/* ラベル */
.alton-mark {
  color: #ff4d4d;
  font-weight: 800;
  margin-right: 6px;
}

/* 行全体は赤 */
.rank-table tbody tr.alton-row td {
  color: #ff6b6b;
  font-weight: 700;
}

/* 順位だけ白 */
.rank-table tbody tr.alton-row td.rank-col {
  color: #ffffff !important;
}

/* 名前も白 */
.rank-table tbody tr.alton-row td.name-col {
  color: #ffffff !important;
}

/* (雑魚など)は赤 */
.rank-table tbody tr.alton-row td.name-col .zako {
  color: #ff4d4d !important;
  font-weight: 700;
  margin-left: 6px;
}

/* ===== Column Width ===== */
.rank-table th:nth-child(1),
.rank-table td:nth-child(1) {
  width: 90px;
}

.rank-table th:nth-child(2),
.rank-table td:nth-child(2) {
  width: 34%;
}

.rank-table th:nth-child(3),
.rank-table td:nth-child(3) {
  width: 13%;
}

.rank-table th:nth-child(4),
.rank-table td:nth-child(4) {
  width: 16%;
}

.rank-table th:nth-child(5),
.rank-table td:nth-child(5) {
  width: 12%;
}

.rank-table th:nth-child(6),
.rank-table td:nth-child(6) {
  width: 15%;
}

/* =========================
   Rule Button
========================= */

.rule-button-wrap {
  text-align: center;
  margin-top: 16px;
}

.rule-open-btn {
  padding: 10px 18px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: #13233d;
  color: #ffffff;
  font-weight: 700;
  cursor: pointer;
  transition: 0.2s;
}

.rule-open-btn:hover {
  background: #1b3154;
}

/* =========================
   Modal
========================= */

.rule-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
}

.rule-modal.is-open {
  display: block;
}

.rule-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
}

.rule-modal-content {
  position: relative;
  width: min(92%, 900px);
  max-height: 85vh;
  margin: 5vh auto;
  background: #13233d;
  color: #ffffff;
  border-radius: 14px;
  overflow: hidden;
}

.rule-modal-content h3 {
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.05);
  font-size: 20px;
}

.rule-modal-body {
  padding: 20px;
  overflow-y: auto;
  max-height: 70vh;
  line-height: 1.8;
}

.rule-modal-body h4 {
  margin-top: 20px;
  color: #ffcc66;
}

.rule-close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
}

/* =========================
   Mobile
========================= */

@media (max-width: 640px) {
  .rank-table {
    font-size: 10px;
    line-height: 0.95; /* ←さらに詰める */
  }

  .rank-table td,
  .rank-table th {
    padding: 1px 6px; /* ←ここをさらに小さく */
  }

  .rank-table td.rank-col .rank-badge {
    height: 12px; /* ←丸も縮める */
  }

  .rule-open-btn {
    font-size: 13px;
    padding: 8px 14px;
  }
}
