/* =========================================
   TikTok Live Ranking - Main Styles
   ========================================= */

/* ---- CSS変数 ---- */
:root {
  --tt-red: #fe2c55;
  --tt-cyan: #25f4ee;
  --tt-black: #010101;
  --tt-dark: #121212;
  --tt-surface: #1a1a2e;
  --tt-surface2: #16213e;
  --tt-card: #0f0f1a;
  --tt-border: rgba(255,255,255,0.08);
  --tt-text: #f8f8f8;
  --tt-text-muted: #8a8a9a;
  --tt-gold: #ffd700;
  --tt-silver: #c0c0c0;
  --tt-bronze: #cd7f32;
  --gradient-main: linear-gradient(135deg, #fe2c55 0%, #fe6f00 100%);
  --gradient-cyan: linear-gradient(135deg, #25f4ee 0%, #0075c4 100%);
  --gradient-dark: linear-gradient(180deg, #0f0f1a 0%, #1a1a2e 100%);
  --shadow-glow-red: 0 0 20px rgba(254, 44, 85, 0.4);
  --shadow-glow-cyan: 0 0 20px rgba(37, 244, 238, 0.3);
  --radius-card: 16px;
  --radius-sm: 8px;
  --header-h: 110px;
  --transition: 0.25s ease;
}

/* ---- ライトモード変数 ---- */
body.light-mode {
  --tt-dark: #f0f0f5;
  --tt-surface: #ffffff;
  --tt-surface2: #f5f5fa;
  --tt-card: #ffffff;
  --tt-border: rgba(0,0,0,0.1);
  --tt-text: #121212;
  --tt-text-muted: #666680;
  --gradient-dark: linear-gradient(180deg, #f5f5fa 0%, #ebebf5 100%);
  --shadow-glow-red: 0 4px 20px rgba(254,44,85,0.25);
}

/* ---- リセット & ベース ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Noto Sans JP', 'Inter', sans-serif;
  background: var(--tt-dark);
  color: var(--tt-text);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background 0.3s, color 0.3s;
}

/* =========================================
   パーティクル背景
   ========================================= */
#particles-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.particle {
  position: absolute;
  border-radius: 50%;
  opacity: 0;
  animation: float-up var(--dur, 6s) ease-in infinite;
  animation-delay: var(--delay, 0s);
}
@keyframes float-up {
  0%   { transform: translateY(100vh) scale(0); opacity: 0; }
  10%  { opacity: 0.6; }
  90%  { opacity: 0.3; }
  100% { transform: translateY(-10vh) scale(1); opacity: 0; }
}

/* =========================================
   ヘッダー
   ========================================= */
#main-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: rgba(10, 10, 20, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--tt-border);
}
body.light-mode #main-header {
  background: rgba(255,255,255,0.9);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  font-size: 2rem;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 8px rgba(254,44,85,0.6));
  animation: logo-pulse 3s ease-in-out infinite;
}
@keyframes logo-pulse {
  0%,100% { filter: drop-shadow(0 0 8px rgba(254,44,85,0.6)); }
  50%      { filter: drop-shadow(0 0 16px rgba(37,244,238,0.8)); }
}

.logo-text { display: flex; flex-direction: column; line-height: 1.2; }
.logo-title {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: 2px;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.logo-sub {
  font-size: 0.65rem;
  color: var(--tt-text-muted);
  letter-spacing: 1px;
}

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* タブナビ */
.tab-nav {
  display: flex;
  gap: 0;
  padding: 0 16px;
  border-top: 1px solid var(--tt-border);
}
.tab-btn {
  background: none;
  border: none;
  color: var(--tt-text-muted);
  padding: 10px 20px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  transition: color var(--transition);
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tab-btn::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: var(--gradient-main);
  transform: scaleX(0);
  transition: transform var(--transition);
  border-radius: 2px 2px 0 0;
}
.tab-btn.active { color: var(--tt-red); }
.tab-btn.active::after { transform: scaleX(1); }
.tab-btn:hover { color: var(--tt-text); }

/* =========================================
   ボタン
   ========================================= */
.btn-primary {
  background: var(--gradient-main);
  border: none;
  color: #fff;
  padding: 10px 20px;
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: var(--shadow-glow-red);
}
.btn-primary:hover { transform: translateY(-2px) scale(1.03); box-shadow: 0 6px 24px rgba(254,44,85,0.5); }
.btn-primary:active { transform: scale(0.97); }

.btn-secondary {
  background: transparent;
  border: 1px solid var(--tt-border);
  color: var(--tt-text);
  padding: 10px 20px;
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
  font-family: inherit;
}
.btn-secondary:hover { background: var(--tt-border); }

.btn-danger {
  background: linear-gradient(135deg, #fe2c55, #a00030);
  border: none;
  color: #fff;
  padding: 10px 20px;
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: transform var(--transition), box-shadow var(--transition);
}
.btn-danger:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(254,44,85,0.5); }

.btn-danger-sm {
  background: rgba(254,44,85,0.15);
  border: 1px solid rgba(254,44,85,0.3);
  color: var(--tt-red);
  padding: 6px 14px;
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: background var(--transition);
}
.btn-danger-sm:hover { background: rgba(254,44,85,0.25); }

.btn-icon {
  background: var(--tt-border);
  border: none;
  color: var(--tt-text);
  width: 40px; height: 40px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  transition: background var(--transition), transform var(--transition);
  display: flex; align-items: center; justify-content: center;
}
.btn-icon:hover { background: rgba(255,255,255,0.15); transform: scale(1.1); }

.btn-icon-sm {
  background: var(--tt-border);
  border: none;
  color: var(--tt-text);
  width: 36px; height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background var(--transition);
  display: flex; align-items: center; justify-content: center;
}
.btn-icon-sm:hover { background: rgba(255,255,255,0.15); }

/* =========================================
   メインコンテンツ
   ========================================= */
#main-content {
  position: relative;
  z-index: 1;
  margin-top: var(--header-h);
  padding: 24px;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding-top: calc(var(--header-h) + 16px);
}

/* タブパネル */
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn 0.35s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* =========================================
   フィルターバー
   ========================================= */
.filter-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.search-wrap {
  flex: 1;
  min-width: 200px;
  position: relative;
  display: flex;
  align-items: center;
}
.search-wrap i {
  position: absolute;
  left: 14px;
  color: var(--tt-text-muted);
  font-size: 0.9rem;
}
.search-wrap input {
  width: 100%;
  background: var(--tt-surface);
  border: 1px solid var(--tt-border);
  color: var(--tt-text);
  padding: 10px 14px 10px 38px;
  border-radius: 50px;
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.search-wrap input:focus {
  border-color: var(--tt-red);
  box-shadow: 0 0 0 3px rgba(254,44,85,0.15);
}
.search-wrap input::placeholder { color: var(--tt-text-muted); }

.filter-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

select {
  background: var(--tt-surface);
  border: 1px solid var(--tt-border);
  color: var(--tt-text);
  padding: 9px 14px;
  border-radius: 50px;
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition);
  appearance: none;
  -webkit-appearance: none;
  padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238a8a9a' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
select:focus { border-color: var(--tt-red); }

/* =========================================
   セクションタイトル
   ========================================= */
.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--tt-text);
}
.section-title i { color: var(--tt-red); }

/* =========================================
   表彰台 (ポディウム)
   ========================================= */
.podium-section { margin-bottom: 36px; }

.podium-wrap {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 16px;
  padding: 24px 0 0;
}

.podium-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: transform var(--transition);
}
.podium-item:hover { transform: translateY(-6px); }

.podium-avatar-wrap {
  position: relative;
  margin-bottom: 10px;
}

.podium-avatar {
  width: 72px; height: 72px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem;
  font-weight: 900;
  color: #fff;
  position: relative;
  z-index: 1;
  border: 3px solid transparent;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  overflow: hidden;
}
.podium-item.rank-1 .podium-avatar {
  width: 88px; height: 88px;
  font-size: 2.2rem;
  border-color: var(--tt-gold);
  box-shadow: 0 0 24px rgba(255,215,0,0.5);
}
.podium-item.rank-2 .podium-avatar {
  border-color: var(--tt-silver);
  box-shadow: 0 0 16px rgba(192,192,192,0.4);
}
.podium-item.rank-3 .podium-avatar {
  border-color: var(--tt-bronze);
  box-shadow: 0 0 16px rgba(205,127,50,0.4);
}

.podium-crown {
  position: absolute;
  top: -18px; left: 50%;
  transform: translateX(-50%);
  font-size: 1.4rem;
  animation: crown-bounce 2s ease-in-out infinite;
  z-index: 2;
}
@keyframes crown-bounce {
  0%,100% { transform: translateX(-50%) translateY(0); }
  50%      { transform: translateX(-50%) translateY(-5px); }
}

.podium-ring {
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 2px solid transparent;
  animation: ring-spin 3s linear infinite;
}
.rank-1 .podium-ring { border-color: var(--tt-gold) transparent var(--tt-gold) transparent; }
.rank-2 .podium-ring { border-color: var(--tt-silver) transparent var(--tt-silver) transparent; }
.rank-3 .podium-ring { border-color: var(--tt-bronze) transparent var(--tt-bronze) transparent; }
@keyframes ring-spin { to { transform: rotate(360deg); } }

.podium-info { text-align: center; }
.podium-name {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 4px;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.podium-item.rank-1 .podium-name { font-size: 1rem; }

.podium-pts {
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  gap: 3px;
  justify-content: center;
}
.podium-pts i { color: var(--tt-gold); }

.podium-base {
  width: 100%;
  border-radius: 12px 12px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 900;
  color: rgba(255,255,255,0.8);
  margin-top: 10px;
  min-width: 80px;
}
.podium-item.rank-1 .podium-base {
  height: 90px;
  background: linear-gradient(180deg, rgba(255,215,0,0.35) 0%, rgba(255,215,0,0.15) 100%);
  border: 1px solid rgba(255,215,0,0.3);
  min-width: 100px;
}
.podium-item.rank-2 .podium-base {
  height: 65px;
  background: linear-gradient(180deg, rgba(192,192,192,0.25) 0%, rgba(192,192,192,0.1) 100%);
  border: 1px solid rgba(192,192,192,0.2);
}
.podium-item.rank-3 .podium-base {
  height: 50px;
  background: linear-gradient(180deg, rgba(205,127,50,0.25) 0%, rgba(205,127,50,0.1) 100%);
  border: 1px solid rgba(205,127,50,0.2);
}

/* =========================================
   ランキングテーブル
   ========================================= */
.ranking-list-section { margin-bottom: 40px; }

.ranking-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-card);
  border: 1px solid var(--tt-border);
  background: var(--tt-surface);
}

.ranking-table {
  width: 100%;
  border-collapse: collapse;
}

.ranking-table thead th {
  background: var(--tt-surface2);
  color: var(--tt-text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 14px 16px;
  white-space: nowrap;
  border-bottom: 1px solid var(--tt-border);
}
.ranking-table thead th[data-sort] {
  cursor: pointer;
  transition: color var(--transition);
  user-select: none;
}
.ranking-table thead th[data-sort]:hover { color: var(--tt-red); }

.ranking-table tbody tr {
  border-bottom: 1px solid var(--tt-border);
  transition: background var(--transition), transform var(--transition);
  animation: rowIn 0.4s ease both;
}
@keyframes rowIn {
  from { opacity: 0; transform: translateX(-16px); }
  to   { opacity: 1; transform: translateX(0); }
}
.ranking-table tbody tr:last-child { border-bottom: none; }
.ranking-table tbody tr:hover { background: rgba(254,44,85,0.05); }

.ranking-table td {
  padding: 14px 16px;
  font-size: 0.9rem;
  vertical-align: middle;
}

/* 順位セル */
.td-rank {
  font-weight: 800;
  text-align: center;
  width: 60px;
}
.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: 50%;
  font-size: 0.9rem;
  font-weight: 800;
}
.rank-1-badge {
  background: linear-gradient(135deg, #ffd700, #ffaa00);
  color: #000;
  box-shadow: 0 0 12px rgba(255,215,0,0.5);
  font-size: 1rem;
}
.rank-2-badge {
  background: linear-gradient(135deg, #e8e8e8, #b0b0b0);
  color: #000;
}
.rank-3-badge {
  background: linear-gradient(135deg, #cd7f32, #a05f22);
  color: #fff;
}
.rank-other-badge {
  background: var(--tt-border);
  color: var(--tt-text-muted);
}

/* ユーザーセル */
.td-user { display: flex; align-items: center; gap: 10px; min-width: 160px; }
.user-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
}
.user-name { font-weight: 600; }
.user-note { font-size: 0.72rem; color: var(--tt-text-muted); }

/* カテゴリバッジ */
.category-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(255,255,255,0.07);
  white-space: nowrap;
}

/* 数値セル */
.points-val {
  display: inline-flex; align-items: center; gap: 5px;
  color: var(--tt-gold);
  font-weight: 700;
  font-size: 0.95rem;
}
.bonus-val {
  display: inline-flex; align-items: center; gap: 5px;
  color: var(--tt-cyan);
  font-weight: 700;
  font-size: 0.95rem;
}
.total-val {
  display: inline-flex; align-items: center; gap: 5px;
  color: #fe2c55;
  font-weight: 800;
  font-size: 0.95rem;
}

/* アクションセル */
.td-action-btns { display: flex; gap: 6px; }
.btn-edit {
  background: rgba(37,244,238,0.1);
  border: 1px solid rgba(37,244,238,0.2);
  color: var(--tt-cyan);
  width: 32px; height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.8rem;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition);
}
.btn-edit:hover { background: rgba(37,244,238,0.2); }
.btn-delete {
  background: rgba(254,44,85,0.1);
  border: 1px solid rgba(254,44,85,0.2);
  color: var(--tt-red);
  width: 32px; height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.8rem;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition);
}
.btn-delete:hover { background: rgba(254,44,85,0.2); }

/* =========================================
   空の状態
   ========================================= */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--tt-text-muted);
}
.empty-state i { font-size: 3rem; margin-bottom: 16px; display: block; opacity: 0.4; }
.empty-state p { font-size: 1rem; margin-bottom: 16px; }

/* =========================================
   統計タブ
   ========================================= */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--tt-surface);
  border: 1px solid var(--tt-border);
  border-radius: var(--radius-card);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform var(--transition), box-shadow var(--transition);
}
.stat-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,0.3); }
.stat-icon {
  font-size: 1.5rem;
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 6px;
}
.stat-val { font-size: 1.6rem; font-weight: 800; }
.stat-label { font-size: 0.78rem; color: var(--tt-text-muted); font-weight: 500; }

.charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.charts-row-single {
  grid-template-columns: 1fr;
}
.chart-card {
  background: var(--tt-surface);
  border: 1px solid var(--tt-border);
  border-radius: var(--radius-card);
  padding: 20px;
}
.chart-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.chart-title i { color: var(--tt-red); }

/* =========================================
   履歴タブ
   ========================================= */
.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.history-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.history-item {
  background: var(--tt-surface);
  border: 1px solid var(--tt-border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: rowIn 0.3s ease both;
  font-size: 0.88rem;
}
.history-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.history-dot.add    { background: #4ade80; box-shadow: 0 0 8px rgba(74,222,128,0.5); }
.history-dot.edit   { background: var(--tt-cyan); box-shadow: 0 0 8px rgba(37,244,238,0.5); }
.history-dot.delete { background: var(--tt-red); box-shadow: 0 0 8px rgba(254,44,85,0.5); }
.history-text { flex: 1; }
.history-time { font-size: 0.75rem; color: var(--tt-text-muted); flex-shrink: 0; }

/* =========================================
   モーダル
   ========================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal-card {
  background: var(--tt-surface);
  border: 1px solid var(--tt-border);
  border-radius: 20px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(30px) scale(0.95);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.modal-overlay.open .modal-card { transform: translateY(0) scale(1); }

.modal-sm { max-width: 420px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--tt-border);
  position: sticky;
  top: 0;
  background: var(--tt-surface);
  z-index: 1;
}
.modal-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  display: flex; align-items: center; gap: 8px;
}
.modal-header h2 i { color: var(--tt-red); }
.modal-close {
  background: rgba(255,255,255,0.08);
  border: none;
  color: var(--tt-text);
  width: 32px; height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.9rem;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition);
}
.modal-close:hover { background: rgba(254,44,85,0.2); color: var(--tt-red); }

.modal-body { padding: 20px 24px; }

/* フォーム */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-group:last-child { margin-bottom: 0; }
.form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--tt-text-muted);
  display: flex; align-items: center; gap: 5px;
}
.form-group label i { color: var(--tt-red); font-size: 0.75rem; }
.required { color: var(--tt-red); }

.form-group input[type="text"],
.form-group input[type="number"],
.form-group textarea {
  background: var(--tt-surface2);
  border: 1px solid var(--tt-border);
  border-radius: var(--radius-sm);
  color: var(--tt-text);
  padding: 10px 14px;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  resize: none;
}
.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--tt-red);
  box-shadow: 0 0 0 3px rgba(254,44,85,0.15);
}
.form-group input::placeholder, .form-group textarea::placeholder { color: var(--tt-text-muted); }

.form-group select {
  border-radius: var(--radius-sm);
  padding: 10px 30px 10px 14px;
}

/* カラーピッカー */
.color-picker-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.color-options { display: flex; gap: 6px; flex-wrap: wrap; }
.color-dot {
  width: 28px; height: 28px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
  transition: transform var(--transition), border-color var(--transition);
}
.color-dot:hover { transform: scale(1.2); }
.color-dot.selected { border-color: #fff; transform: scale(1.1); }

input[type="color"] {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 2px solid var(--tt-border);
  background: none;
  cursor: pointer;
  padding: 2px;
  outline: none;
}

/* 合計プレビュー */
.total-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(254,44,85,0.08);
  border: 1px solid rgba(254,44,85,0.25);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
}
.total-preview-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--tt-text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.total-preview-label i { color: var(--tt-red); }
.total-preview-val {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--tt-red);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 16px;
  margin-top: 8px;
  border-top: 1px solid var(--tt-border);
}

.delete-confirm-text {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--tt-text);
  margin-bottom: 20px;
}
.delete-confirm-text strong { color: var(--tt-red); }

/* =========================================
   トースト通知
   ========================================= */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  background: var(--tt-surface);
  border: 1px solid var(--tt-border);
  border-radius: 12px;
  padding: 14px 18px;
  font-size: 0.88rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 220px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  animation: toastIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  pointer-events: all;
}
.toast.fade-out { animation: toastOut 0.3s ease forwards; }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(60px) scale(0.85); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes toastOut {
  to   { opacity: 0; transform: translateX(60px) scale(0.85); }
}
.toast.success .toast-icon { color: #4ade80; }
.toast.error   .toast-icon { color: var(--tt-red); }
.toast.info    .toast-icon { color: var(--tt-cyan); }
.toast-icon { font-size: 1.1rem; flex-shrink: 0; }

/* =========================================
   ライブインジケーター
   ========================================= */
.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--tt-red);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 1px;
  margin-left: 6px;
}
.live-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: #fff;
  animation: blink 1.2s ease-in-out infinite;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.2} }

/* =========================================
   ローディングオーバーレイ
   ========================================= */
#loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 20, 0.75);
  backdrop-filter: blur(6px);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
}
.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  color: var(--tt-text);
}
.loading-spinner i {
  font-size: 2.4rem;
  color: var(--tt-red);
}
.loading-spinner span {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--tt-text-muted);
}

/* =========================================
   アバター画像共通
   ========================================= */
.avatar-has-img {
  padding: 0 !important;
  overflow: hidden;
}
.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

/* =========================================
   スクロールバー
   ========================================= */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--tt-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* =========================================
   レスポンシブ
   ========================================= */
@media (max-width: 768px) {
  #main-content { padding: 16px; padding-top: calc(var(--header-h) + 12px); }
  .header-inner { padding: 10px 16px; }
  .logo-title { font-size: 1rem; }
  .logo-sub { display: none; }
  .btn-primary { padding: 8px 14px; font-size: 0.82rem; }
  .podium-item.rank-1 .podium-avatar { width: 72px; height: 72px; }
  .podium-avatar { width: 56px; height: 56px; font-size: 1.4rem; }
  .form-row { grid-template-columns: 1fr; }
  .charts-row { grid-template-columns: 1fr; }
  .ranking-table th, .ranking-table td { padding: 10px 10px; font-size: 0.82rem; }
  /* 合計PT列はスマホでも表示する */
}

@media (max-width: 480px) {
  .header-logo .logo-icon { font-size: 1.6rem; }
  .podium-wrap { gap: 8px; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-controls { justify-content: flex-end; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
