:root {
  --bg-main: #0b0f19;
  --bg-card: #151d30;
  --border-color: #23324d;
  --accent-cyan: #00f0ff;
  --accent-blue: #38bdf8;
  --accent-gold: #f59e0b;
  --text-main: #e2e8f0;
  --text-sub: #94a3b8;
}
* { box-sizing: border-box; }
body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  margin: 0;
  padding: 16px;
}
.container {
  max-width: 1100px;
  margin: 0 auto;
}
header {
  text-align: center;
  margin-bottom: 16px;
}

/* ★ ソーシャルリンクボタン ★ */
.social-links {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.link-btn {
  display: inline-flex;
  align-items: center;
  padding: 6px 16px;
  border-radius: 20px;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: bold;
  transition: all 0.2s;
}
.link-yt { background: rgba(220, 38, 38, 0.1); color: #ef4444; border: 1px solid #ef4444; }
.link-yt:hover { background: rgba(220, 38, 38, 0.25); box-shadow: 0 0 8px rgba(239, 68, 68, 0.4); }
.link-x { background: rgba(255, 255, 255, 0.05); color: #fff; border: 1px solid #cbd5e1; }
.link-x:hover { background: rgba(255, 255, 255, 0.15); box-shadow: 0 0 8px rgba(255, 255, 255, 0.3); }
.link-join { background: rgba(245, 158, 11, 0.1); color: #fbbf24; border: 1px solid #fbbf24; }
.link-join:hover { background: rgba(245, 158, 11, 0.25); box-shadow: 0 0 8px rgba(251, 191, 36, 0.4); }

h1 {
  color: var(--accent-cyan);
  margin: 0 0 6px 0;
  font-size: 1.6rem;
  letter-spacing: 0.5px;
}
.sub-title {
  color: var(--text-sub);
  font-size: 0.85rem;
  margin: 0 0 12px 0;
}

/* ★ 更新履歴（スクロール対応エリア） ★ */
.version-info {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 8px 12px;
  margin-bottom: 20px;
  font-size: 0.8rem;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
  text-align: left;
}
.update-scroll-box {
  max-height: 80px;
  overflow-y: auto;
  padding-right: 4px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.update-scroll-box::-webkit-scrollbar { width: 4px; }
.update-scroll-box::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
.update-row { display: flex; align-items: baseline; gap: 8px; }
.version-badge {
  background: var(--accent-cyan); color: #000;
  padding: 1px 5px; border-radius: 4px; font-weight: bold; font-size: 0.75rem; white-space: nowrap;
}
.update-date { color: var(--text-sub); font-size: 0.75rem; white-space: nowrap; }
.update-text { color: var(--text-main); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.auth-banner {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--bg-card); border: 1px solid var(--border-color);
  padding: 10px 16px; border-radius: 8px; margin-bottom: 20px; gap: 10px; flex-wrap: wrap;
}
.edition-tag { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; font-weight: bold; }
.badge-free { background: #334155; color: #94a3b8; padding: 3px 8px; border-radius: 4px; font-size: 0.75rem; }
.badge-full {
  background: linear-gradient(135deg, #d97706, #b45309); color: #fff;
  padding: 3px 8px; border-radius: 4px; font-size: 0.75rem; box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
}
.auth-input-group { display: flex; gap: 6px; align-items: center; }
.auth-input {
  background: #0b0f19; border: 1px solid var(--border-color); color: #fff;
  padding: 6px 10px; border-radius: 4px; font-size: 0.85rem; width: 140px; outline: none;
}
.auth-input:focus { border-color: var(--accent-cyan); }
.btn-sm {
  background: #1e293b; color: #fff; border: 1px solid var(--border-color);
  padding: 6px 12px; border-radius: 4px; cursor: pointer; font-size: 0.85rem;
}
.btn-sm:hover { background: #334155; }

.calc-box { text-align: center; margin-bottom: 20px; }
button.btn-primary {
  background: linear-gradient(135deg, #00f0ff, #0077ff); color: #000; font-weight: bold;
  border: none; padding: 12px 28px; font-size: 1.05rem; border-radius: 8px; cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 240, 255, 0.25); transition: all 0.2s;
}
button.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(0, 240, 255, 0.4); }
button.btn-primary:disabled { background: #334155; color: #64748b; cursor: not-allowed; box-shadow: none; transform: none; }
#status { text-align: center; color: #ffd700; font-size: 0.9rem; margin-top: 10px; min-height: 1.2em; }

.filter-panel {
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: 10px; padding: 16px; margin-bottom: 20px; display: flex; flex-direction: column; gap: 14px;
}
.filter-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.filter-label { font-size: 0.8rem; color: var(--text-sub); font-weight: 600; min-width: 120px; }
.filter-pills { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.pill {
  background: #0b0f19; border: 1px solid var(--border-color); color: var(--text-sub);
  padding: 5px 12px; border-radius: 6px; font-size: 0.8rem; cursor: pointer; user-select: none; transition: all 0.15s;
}
.pill:hover { border-color: var(--accent-cyan); color: #fff; }
.pill.active { background: #0369a1; border-color: var(--accent-cyan); color: #fff; font-weight: bold; }

.icon-pill { background: transparent !important; border: 2px solid transparent !important; padding: 4px !important; border-radius: 8px; }
.icon-pill.active { background: rgba(0, 240, 255, 0.1) !important; border-color: var(--accent-cyan) !important; box-shadow: 0 0 8px rgba(0, 240, 255, 0.2); }
.filter-icon { width: 32px; height: 32px; object-fit: contain; filter: grayscale(100%) opacity(40%); transition: all 0.15s ease; vertical-align: middle; }
.icon-pill:hover .filter-icon { filter: grayscale(30%) opacity(80%); transform: scale(1.05); }
.icon-pill.active .filter-icon { filter: grayscale(0%) opacity(100%); transform: scale(1.15); }

.char-icon { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border-color); flex-shrink: 0; background-color: var(--bg-main); margin-right: 8px; }

.search-sort-bar { display: grid; grid-template-columns: 2fr 1fr auto; gap: 12px; align-items: center; }
@media (max-width: 768px) { .search-sort-bar { grid-template-columns: 1fr; } }
input[type="text"], select {
  background: #0b0f19; border: 1px solid var(--border-color); color: #fff;
  padding: 8px 12px; border-radius: 6px; font-size: 0.85rem; outline: none; width: 100%;
}
input[type="text"]:focus, select:focus { border-color: var(--accent-cyan); }
.checkbox-group { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; cursor: pointer; white-space: nowrap; }

.meta-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 0.85rem; color: var(--text-sub); }

.table-wrapper { overflow-x: auto; border: 1px solid var(--border-color); border-radius: 10px; background: var(--bg-card); }
.ranking-table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--border-color); }
th { background: #101726; color: var(--text-sub); font-size: 0.8rem; letter-spacing: 0.5px; white-space: nowrap; }
tr:last-child td { border-bottom: none; }
tr:hover { background: rgba(255, 255, 255, 0.02); }

.rank-cell { font-weight: bold; color: var(--accent-cyan); width: 45px; text-align: center; }
.row-flex { display: flex; align-items: center; gap: 8px; }
.icons-wrap { display: flex; gap: 4px; align-items: center; flex-shrink: 0; }
.status-icon { width: 24px; height: 24px; object-fit: contain; vertical-align: middle; }
.unit-name { font-weight: bold; color: #fff; margin-bottom: 2px; }
.weapon-name { color: var(--text-sub); font-size: 0.8rem; }
.pilot-name { font-weight: 500; color: #f1f5f9; }
.attr-badge { display: inline-block; font-size: 0.7rem; padding: 2px 6px; border-radius: 4px; margin-left: 4px; font-weight: 600; }
.attr-物理 { background: #451a03; color: #f97316; }
.attr-ビーム { background: #0369a1; color: #38bdf8; }
.attr-特殊 { background: #4c1d95; color: #c084fc; }
.attr-map { background: #831843; color: #f472b6; }
.attr-sensei { background: #854d0e; color: #fef08a; }

.dmg-cell { text-align: right; font-variant-numeric: tabular-nums; font-weight: bold; white-space: nowrap; }
.dmg-full { color: var(--accent-blue); font-size: 1.05rem; }
.dmg-init { color: var(--text-sub); font-size: 0.9rem; }

.site-footer { text-align: center; margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--border-color); color: var(--text-sub); font-size: 0.75rem; line-height: 1.6; }
.site-footer p { margin: 4px 0; }

/* ★ モーダル用スタイル ★ */
.modal-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.75);
  display: flex; justify-content: center; align-items: center;
  z-index: 1000; padding: 16px;
}
.modal-content {
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: 12px; width: 100%; max-width: 500px; max-height: 90vh;
  overflow-y: auto; position: relative; box-shadow: 0 10px 30px rgba(0,0,0,0.7);
}
.modal-close {
  position: absolute; top: 12px; right: 16px; background: transparent; border: none;
  color: var(--text-sub); font-size: 1.8rem; cursor: pointer; line-height: 1;
}
.modal-close:hover { color: #fff; }
.modal-header {
  padding: 16px 20px; border-bottom: 1px solid var(--border-color);
  display: flex; align-items: center; gap: 12px; background: rgba(0,0,0,0.2);
}
.modal-body { padding: 16px 20px; }
.stat-box {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px;
  text-align: center; margin-bottom: 16px;
}
.stat-item { background: #0b0f19; padding: 8px 4px; border-radius: 6px; border: 1px solid var(--border-color); }
.stat-label { font-size: 0.65rem; color: var(--text-sub); margin-bottom: 2px; }
.stat-val { font-weight: bold; font-size: 0.95rem; color: #fff; }
.ability-list { font-size: 0.8rem; margin-bottom: 24px; background: #0b0f19; padding: 10px 12px; border-radius: 6px; }
.weapon-card {
  background: #0b0f19; border: 1px solid var(--border-color);
  border-radius: 6px; padding: 10px 12px; margin-bottom: 8px;
}
/* 機体名をクリッカブルにする装飾 */
.clickable-unit {
  cursor: pointer; transition: color 0.2s;
  text-decoration: underline; text-decoration-color: var(--border-color); text-underline-offset: 3px;
}
.clickable-unit:hover { color: var(--accent-cyan); text-decoration-color: var(--accent-cyan); }