:root {
  --bg: #0e1117;
  --panel: #181d27;
  --panel-2: #1f2633;
  --border: #2b3344;
  --text: #e8ecf3;
  --text-dim: #9aa4b5;
  --accent: #4ea1ff;
  --grade-best: #ffcf4d;
  --grade-good: #5fd38a;
  --grade-mid: #9aa4b5;
  --grade-bad: #ff9d5c;
  --grade-worst: #ff6470;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-header {
  text-align: center;
  padding: 32px 16px 12px;
  position: relative;
}
.site-header h1 {
  font-size: 1.7rem;
  letter-spacing: -0.5px;
  cursor: pointer;
  display: inline-block;
}
.site-header h1:hover { color: var(--accent); }

/* 좌상단 홈 버튼 */
.home-btn {
  position: absolute;
  top: 18px;
  left: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  font-size: 1.15rem;
  text-decoration: none;
  transition: border-color 0.15s, transform 0.1s;
}
.home-btn:hover { border-color: var(--accent); transform: translateY(-1px); }
.site-date { color: var(--text-dim); margin-top: 6px; font-size: 0.95rem; }
.site-basis { color: var(--text-dim); margin-top: 4px; font-size: 0.74rem; opacity: 0.85; }

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  padding: 16px;
  max-width: 980px;
  margin: 0 auto;
}
.tab {
  background: var(--panel);
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.15s;
}
.tab:hover { color: var(--text); border-color: var(--accent); }
.tab.active { background: var(--accent); border-color: var(--accent); color: #0b1320; font-weight: 700; }
.tab .team-dot {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: 1px;
}

.search-row { max-width: 980px; margin: 0 auto; padding: 0 16px 8px; }
#search-input {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 11px 14px;
  font-size: 0.95rem;
}
#search-input:focus { outline: none; border-color: var(--accent); }

main { flex: 1; max-width: 980px; width: 100%; margin: 0 auto; padding: 12px 16px 40px; }

.hidden { display: none !important; }
.loading {
  text-align: center;
  color: var(--text-dim);
  padding: 48px 0;
  font-size: 0.95rem;
}
.loading.spin::before {
  content: "⚾";
  display: block;
  font-size: 2rem;
  margin-bottom: 12px;
  animation: bounce 0.9s infinite alternate ease-in-out;
}
@keyframes bounce {
  from { transform: translateY(0) rotate(0deg); }
  to { transform: translateY(-12px) rotate(180deg); }
}

/* ── 매치업 한줄평 / 선발 맞대결 / 팩트 ── */
.m-comment {
  background: var(--panel-2);
  border-left: 3px solid var(--accent);
  border-radius: 0 10px 10px 0;
  padding: 10px 14px;
  font-size: 0.88rem;
  line-height: 1.55;
  margin-bottom: 14px;
}
.st-duel { margin-bottom: 14px; }
.st-title { font-size: 0.82rem; font-weight: 800; margin-bottom: 8px; }
.st-row { display: flex; align-items: stretch; gap: 10px; }
.st-vs { align-self: center; font-size: 0.78rem; font-weight: 800; color: var(--text-dim); }
.st-cell {
  flex: 1;
  background: var(--panel-2);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
}
.st-cell:hover { outline: 1px solid var(--accent); }
.st-cell.st-none {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 0.85rem;
  cursor: default;
}
.st-name { display: flex; align-items: center; gap: 7px; font-size: 0.92rem; margin-bottom: 6px; flex-wrap: wrap; }
.st-name .grade-badge { font-size: 0.7rem; padding: 1px 7px; }
.st-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 4px;
  border-radius: 6px;
  color: #fff;
  font-size: 0.74rem;
  font-weight: 800;
}
.st-stats { font-size: 0.78rem; color: var(--text-dim); line-height: 1.6; }
.st-stats b { color: var(--text); }

.m-facts { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.fact-pill {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 0.76rem;
  color: var(--text-dim);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.fact-pill b { color: var(--text); }
.f-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  font-size: 0.62rem;
  font-weight: 800;
  color: #fff;
  margin-left: 2px;
}
.f-w { background: var(--grade-good); color: #03240f; }
.f-l { background: var(--grade-worst); color: #2b0508; }
.f-d { background: var(--grade-mid); color: #11151c; }

/* ── 순위표 ──────────────────────────── */
.standings-wrap { overflow-x: auto; }
.standings {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  font-size: 0.88rem;
}
.standings th, .standings td {
  padding: 11px 12px;
  text-align: center;
  white-space: nowrap;
}
.standings thead th {
  background: var(--panel-2);
  color: var(--text-dim);
  font-size: 0.76rem;
  font-weight: 700;
}
.standings tbody tr { border-top: 1px solid var(--panel-2); }
.standings tbody tr:hover { background: var(--panel-2); }
.td-rank { font-weight: 800; }
.td-team { font-weight: 700; text-align: left !important; }
.td-team .team-dot { margin-right: 7px; }
.td-fortune { min-width: 130px; }
.f-bar {
  display: inline-block;
  width: 64px;
  height: 7px;
  background: var(--panel-2);
  border-radius: 999px;
  overflow: hidden;
  margin-right: 8px;
  vertical-align: 2px;
}
.f-fill { display: block; height: 100%; border-radius: 999px; }

/* ── 오늘의 경기 ─────────────────────── */
.games-section { margin-bottom: 22px; }
.games-title {
  font-size: 1.02rem;
  font-weight: 800;
  margin: 4px 2px 10px;
}
.games-title.rank-title { margin-top: 4px; }
.games-sub { font-size: 0.75rem; font-weight: 400; color: var(--text-dim); margin-left: 6px; }

.games-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
}
.game-card {
  flex: 0 0 232px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
}
.game-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.g-top { text-align: center; margin-bottom: 8px; }
.g-status {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 2px 10px;
  background: var(--panel-2);
  color: var(--text-dim);
}
.g-status.g-live { background: #3d1216; color: #ff6470; animation: pulse 1.4s infinite; }
.g-status.g-cancel { text-decoration: line-through; }
@keyframes pulse { 50% { opacity: 0.55; } }

.g-teams {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.g-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 64px;
}
.g-emblem { object-fit: contain; }
.g-dot { display: inline-block; border-radius: 50%; }
.g-name { font-size: 0.82rem; font-weight: 700; white-space: nowrap; }
.g-home {
  font-size: 0.6rem;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 3px;
  margin-left: 4px;
  vertical-align: 1px;
}
.g-score { font-size: 1.25rem; font-weight: 800; white-space: nowrap; }
.g-colon { color: var(--text-dim); font-weight: 400; }
.g-vs { font-size: 0.85rem; color: var(--text-dim); font-weight: 700; }

.g-fortune-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}
.g-flabel { font-size: 0.68rem; color: var(--text-dim); }
.g-favg { font-size: 0.92rem; font-weight: 800; color: var(--text-dim); width: 40px; text-align: center; }
.g-favg.lead { color: var(--grade-best); }
.g-favg.lead::after { content: " ▲"; font-size: 0.65rem; }

/* 매치업 모달 */
.m-bigscore { font-size: 1.1rem; margin-left: 8px; }
.m-gauge-wrap { margin: 14px 0 18px; }
.m-gauge {
  display: flex;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--panel-2);
}
.m-gauge-a, .m-gauge-h { transition: width 0.4s; }
.m-gauge-caption {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-top: 8px;
}
.m-gauge-caption b { color: var(--text); }
.m-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .m-cols { grid-template-columns: 1fr; } }
.m-col-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 2px solid var(--border);
  font-size: 0.95rem;
}
.m-avg { margin-left: auto; font-size: 0.78rem; color: var(--text-dim); }
.m-player {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 8px;
  cursor: pointer;
}
.m-player:hover { background: var(--panel-2); }
.m-player .grade-badge { font-size: 0.72rem; padding: 2px 7px; }
.m-pname { font-weight: 700; font-size: 0.9rem; }
.m-ppos { font-size: 0.75rem; color: var(--text-dim); }
.m-pscore { margin-left: auto; font-size: 0.82rem; color: var(--text-dim); font-weight: 700; }
.m-empty { color: var(--text-dim); font-size: 0.85rem; padding: 8px; }
.m-player.m-out { opacity: 0.38; }
.m-entry-badge {
  font-size: 0.62rem;
  font-weight: 800;
  color: #0b1320;
  background: var(--accent);
  border-radius: 4px;
  padding: 1px 5px;
}
.m-note { margin-top: 14px; font-size: 0.74rem; color: var(--text-dim); }

/* ── 랭킹 ───────────────────────────── */
.rank-list { display: flex; flex-direction: column; gap: 10px; }
.rank-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
}
.rank-item:hover { border-color: var(--accent); transform: translateY(-1px); }
.rank-no {
  font-size: 1.15rem;
  font-weight: 800;
  width: 38px;
  text-align: center;
  color: var(--text-dim);
  flex-shrink: 0;
}
.rank-item.top1 .rank-no { color: var(--grade-best); font-size: 1.4rem; }
.rank-item.top2 .rank-no { color: #cfd6e4; font-size: 1.25rem; }
.rank-item.top3 .rank-no { color: #d8a06a; font-size: 1.2rem; }
.rank-main { flex: 1; min-width: 0; }
.rank-name-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rank-name { font-weight: 700; font-size: 1.05rem; }
.rank-summary {
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rank-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.rank-score { font-size: 0.8rem; color: var(--text-dim); }

/* ── 선수 카드 그리드 ───────────────── */
.player-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}
.player-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
}
.player-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.player-card .p-name { font-size: 1.1rem; font-weight: 700; }
.player-card .p-meta { color: var(--text-dim); font-size: 0.85rem; margin-top: 6px; }

.team-chip {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  border-radius: 5px;
  padding: 2px 7px;
  vertical-align: 1px;
}

.grade-badge {
  display: inline-block;
  font-weight: 800;
  font-size: 0.85rem;
  border-radius: 7px;
  padding: 3px 10px;
  background: var(--panel-2);
}
.grade-대길 { color: #1c1500; background: var(--grade-best); }
.grade-길 { color: #03240f; background: var(--grade-good); }
.grade-평 { color: #11151c; background: var(--grade-mid); }
.grade-흉 { color: #251002; background: var(--grade-bad); }
.grade-대흉 { color: #2b0508; background: var(--grade-worst); }

/* ── 모달 ───────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 10, 0.7);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 32px 16px;
  overflow-y: auto;
  z-index: 50;
}
.modal {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  max-width: 640px;
  width: 100%;
  padding: 28px;
  position: relative;
}
.modal-close {
  position: absolute;
  top: 14px; right: 16px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
}
.modal-close:hover { color: var(--text); }

.detail-head { text-align: center; margin-bottom: 20px; }
.detail-head .d-name { font-size: 1.5rem; font-weight: 800; }
.detail-head .d-meta { color: var(--text-dim); font-size: 0.9rem; margin-top: 6px; }
.detail-grade-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 14px;
}
.detail-grade-row .grade-badge { font-size: 1.05rem; padding: 6px 16px; }
.detail-score { color: var(--text-dim); font-size: 0.9rem; }

.detail-summary {
  background: var(--panel-2);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 18px;
}

.cat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
@media (max-width: 560px) { .cat-grid { grid-template-columns: 1fr; } }
.cat-card {
  background: var(--panel-2);
  border-radius: 10px;
  padding: 12px 14px;
}
.cat-card .c-title { font-size: 0.8rem; color: var(--accent); font-weight: 700; margin-bottom: 6px; }
.cat-card .c-text { font-size: 0.87rem; line-height: 1.55; color: var(--text); }

.lucky-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.lucky-pill {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.82rem;
  color: var(--text-dim);
}
.lucky-pill b { color: var(--text); }

.advice-box {
  border-left: 3px solid var(--grade-best);
  padding: 10px 14px;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--panel-2);
  border-radius: 0 10px 10px 0;
}

.error-box {
  background: #2a1418;
  border: 1px solid #5c2730;
  color: #ffb4bc;
  border-radius: 10px;
  padding: 16px;
  text-align: center;
  font-size: 0.92rem;
  line-height: 1.6;
}

.site-footer {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.78rem;
  padding: 24px 16px 32px;
  border-top: 1px solid var(--border);
  margin-top: 12px;
  line-height: 1.7;
}
.footer-links { margin-bottom: 10px; }
.footer-links a {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}
.footer-links a:hover { color: var(--accent); text-decoration: underline; }
.footer-sep { margin: 0 8px; opacity: 0.5; }
.footer-copy { margin-top: 10px; opacity: 0.7; }

/* 2행 탭(랭킹/순위표)은 1행(팀) 바로 아래 붙인다 */
.tabs-views { padding-top: 0; }

/* ── 약관/개인정보 등 정적 문서 페이지 ── */
.legal {
  max-width: 760px;
  margin: 0 auto;
  padding: 40px 20px 60px;
  line-height: 1.75;
  font-size: 0.92rem;
}
.legal a.legal-back {
  display: inline-block;
  margin-bottom: 24px;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.85rem;
}
.legal a.legal-back:hover { text-decoration: underline; }
.legal h1 { font-size: 1.5rem; margin-bottom: 6px; }
.legal .updated { color: var(--text-dim); font-size: 0.82rem; margin-bottom: 28px; }
.legal h2 {
  font-size: 1.08rem;
  margin: 28px 0 10px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.legal p { margin-bottom: 12px; color: var(--text); }
.legal ul { margin: 0 0 12px 1.1rem; }
.legal li { margin-bottom: 7px; }
.legal a { color: var(--accent); }
.legal .muted { color: var(--text-dim); font-size: 0.85rem; }

/* ── 기도 버프 (네이버 응원 수 기반 가산점) ───────────────── */
.buff-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(255, 207, 77, 0.12);
  border: 1px solid rgba(255, 207, 77, 0.4);
  color: var(--grade-best);
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}
.buff-mini {
  color: var(--grade-best);
  font-size: 0.74rem;
  font-weight: 700;
  white-space: nowrap;
}
.td-fortune .buff-mini { margin-left: 6px; }
.g-buff-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
}
.g-buff {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--grade-best);
  min-width: 34px;
  text-align: center;
}

/* 경기 카드 엔트리 발표 상태 칩 */
.g-entry {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 2px 8px;
  margin-left: 6px;
  background: var(--panel-2);
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.g-entry.on {
  background: rgba(95, 211, 138, 0.12);
  border-color: rgba(95, 211, 138, 0.4);
  color: var(--grade-good);
}
