/* ===== リセット ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Helvetica Neue', Arial, 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', Meiryo, sans-serif;
  background: #0a0a0f;
  color: #fff;
  max-width: 450px;
  margin: 0 auto;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===== ヘッダー動画 =====
   デフォルト: margin-bottom -15% 方式 (0002/0003/0004)
   .aspect 付与時: aspect-ratio 3/4 クロップ方式 (0001) */
.hero-video-wrap {
  width: 100%;
  overflow: hidden;
  position: relative;
}
.hero-video-wrap video {
  width: 100%;
  height: auto;
  display: block;
  margin-bottom: -15%;
}
.hero-video-wrap.aspect {
  aspect-ratio: 3 / 4;
}
.hero-video-wrap.aspect video {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  min-width: 100%;
  min-height: 100%;
  width: auto;
  height: 100%;
  object-fit: cover;
  display: block;
  margin-bottom: 0;
}
.hero-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 80px;
  background: linear-gradient(transparent, #0a0a0f);
  pointer-events: none;
}

/* ===== タイトルバー ===== */
.title-bar {
  text-align: center;
  padding: 16px 16px 8px;
  position: relative;
}
.title-bar h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 2px;
  background: linear-gradient(135deg, #ff6090, #ff2d55, #25f4ee);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.title-bar .subtitle {
  font-size: 11px;
  color: #888;
  margin-top: 4px;
}

/* ===== タブ ===== */
.tab-bar {
  display: flex;
  justify-content: center;
  gap: 0;
  margin: 12px 16px 0;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.tab-btn {
  flex: 1;
  padding: 10px 0;
  background: none;
  border: none;
  color: #666;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  transition: color 0.25s;
}
.tab-btn.active {
  color: #fff;
}
.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 20%;
  right: 20%;
  height: 2px;
  background: linear-gradient(90deg, #ff2d55, #25f4ee);
  border-radius: 1px;
}
.tab-btn:hover:not(.active) {
  color: #999;
}

/* ===== タブコンテンツ ===== */
.tab-content {
  display: none;
}
.tab-content.active {
  display: block;
}

/* ===== 期間・カウントダウン ===== */
.event-timer {
  text-align: center;
  padding: 10px 16px 4px;
}
.event-timer .period {
  font-size: 13px;
  font-weight: 600;
  color: #ccc;
  letter-spacing: 0.5px;
}
.event-timer .countdown {
  font-size: 13px;
  font-weight: 700;
  margin-top: 4px;
  color: #fff;
  transition: color 0.3s;
}
.event-timer .countdown.urgent {
  color: #ff2d55;
}

/* ===== 更新情報 ===== */
.update-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  font-size: 11px;
  color: #666;
}
.update-bar .live-dot {
  display: inline-block;
  width: 6px; height: 6px;
  background: #ff2d55;
  border-radius: 50%;
  margin-right: 4px;
  animation: pulse 1.5s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
.update-bar .status { color: #25f4ee; }

/* ===== ランキングリスト ===== */
.ranking-list {
  padding: 0 12px 80px;
}

.rank-card {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  margin-bottom: 6px;
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  transition: background 0.2s;
}
.rank-card:hover {
  background: rgba(255,255,255,0.08);
}

/* TOP3 */
.rank-card.top1 {
  background: linear-gradient(135deg, rgba(255,215,0,0.15), rgba(255,180,0,0.05));
  border-color: rgba(255,215,0,0.3);
}
.rank-card.top2 {
  background: linear-gradient(135deg, rgba(192,192,192,0.12), rgba(192,192,192,0.04));
  border-color: rgba(192,192,192,0.2);
}
.rank-card.top3 {
  background: linear-gradient(135deg, rgba(205,127,50,0.12), rgba(205,127,50,0.04));
  border-color: rgba(205,127,50,0.2);
}

/* Lose判定: 行全体を薄く・グレースケール気味に */
.rank-card.lose {
  opacity: 0.5;
  filter: grayscale(0.5);
}
.rank-card.lose .nickname,
.rank-card.lose .tiktok-id {
  text-decoration: line-through;
  text-decoration-color: rgba(255,255,255,0.2);
}
/* Win判定: 軽くハイライト */
.rank-card.win {
  border-color: rgba(37,244,238,0.35);
  box-shadow: 0 0 12px rgba(37,244,238,0.15);
}

.rank-num {
  width: 32px;
  text-align: center;
  font-size: 16px;
  font-weight: 800;
  color: #555;
  flex-shrink: 0;
}
.top1 .rank-num { color: #ffd700; font-size: 20px; }
.top2 .rank-num { color: #c0c0c0; font-size: 18px; }
.top3 .rank-num { color: #cd7f32; font-size: 18px; }

.rank-avatar {
  display: block;
  width: 44px; height: 44px;
  border-radius: 50%;
  overflow: visible;
  margin: 0 10px;
  flex-shrink: 0;
  position: relative;
  background: #1a1a2e;
  text-decoration: none;
}
.rank-avatar img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.rank-avatar .avatar-fallback {
  width: 100%; height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  border-radius: 50%;
}
.rank-avatar .live-badge {
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  background: #ff2d55;
  color: #fff;
  font-size: 7px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
  line-height: 1;
  letter-spacing: 0.5px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  z-index: 10;
}

.rank-info {
  flex: 1;
  min-width: 0;
}
.rank-info .nickname {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rank-info .tiktok-id {
  font-size: 11px;
  color: #666;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rank-score {
  text-align: right;
  flex-shrink: 0;
  margin-left: 8px;
}
.rank-score .diamonds {
  font-size: 14px;
  font-weight: 700;
  color: #25f4ee;
}
.rank-score .diamonds::after {
  content: ' pt';
  font-size: 10px;
  font-weight: 500;
  color: #888;
}
/* LIVE配信中アバター：赤枠パルス */
.rank-avatar.is-live {
  border: 2.5px solid #ff2d55;
  animation: live-pulse 2s ease-in-out infinite;
}
@keyframes live-pulse {
  0%, 100% { border-color: rgba(255,45,85,1); box-shadow: 0 0 8px rgba(255,45,85,0.5); }
  50% { border-color: rgba(255,45,85,0.35); box-shadow: 0 0 2px rgba(255,45,85,0.15); }
}

/* ===== 読み込み・エラー ===== */
.loading {
  text-align: center;
  padding: 40px;
  color: #555;
}
.loading .spinner {
  width: 30px; height: 30px;
  border: 3px solid #222;
  border-top-color: #ff2d55;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.error-message {
  text-align: center;
  padding: 40px;
  color: #ff6090;
}

/* ===== イベント詳細タブ ===== */
.detail-section {
  padding: 16px;
}
.detail-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}
.detail-card h3 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 10px;
  color: #ff6090;
}
.detail-card p, .detail-card li {
  font-size: 13px;
  color: #bbb;
  line-height: 1.7;
}
.detail-card ul {
  list-style: none;
  padding: 0;
}
.detail-card ul li::before {
  content: '▸ ';
  color: #25f4ee;
}
.detail-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
}
.detail-table th, .detail-table td {
  padding: 8px 10px;
  font-size: 12px;
  text-align: left;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.detail-table th {
  color: #888;
  font-weight: 600;
}
.detail-table td {
  color: #ccc;
}
.detail-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}
.badge-gold { background: rgba(255,215,0,0.2); color: #ffd700; }
.badge-silver { background: rgba(192,192,192,0.2); color: #c0c0c0; }
.badge-bronze { background: rgba(205,127,50,0.2); color: #cd7f32; }
.badge-tiktok { background: rgba(37,244,238,0.15); color: #25f4ee; }

.detail-period {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(255,45,85,0.08);
  border: 1px solid rgba(255,45,85,0.2);
  border-radius: 10px;
  margin-bottom: 12px;
}
.detail-period .period-icon {
  font-size: 20px;
}
.detail-period .period-text {
  font-size: 13px;
  color: #ff6090;
  font-weight: 600;
}
.detail-period .period-sub {
  font-size: 11px;
  color: #888;
}
