/* 킬각 FC 온라인 — dak.gg 식 2단 구성: 헤더·히어로는 다크, 그 아래 본문은 라이트.
 * 색은 전부 아래 토큰을 타므로 :root 는 "본문(밝은 배경)" 기준으로 둔다.
 * 다크로 남길 영역(.site-header/.hero)은 같은 토큰을 자기 스코프에서 다시 선언한다.
 * --accent(파랑)는 라이트에서 흰 배경 대비를 위해 명도를 내린 값, --accent-vivid 는 원색.
 */
:root {
  --bg: #e8ecf3;
  --bg-2: #eef3fa;
  --card: #ffffff;
  --card-2: #eef3fa;
  --line: #d3dce8;
  --text: #1b1f27;
  --muted: #5f6b7a;
  --accent: #1857c4;
  --accent-vivid: #2f80ff;
  --accent-2: #0f429c;
  --blue: #1857c4;
  --good: #1e7a41;
  --bad: #d70000;
  --draw: #9a6b00;
  --accent-ink: #ffffff;
  --radius: 12px;
}
/* 다크로 남는 영역 (헤더·히어로) */
.site-header, .hero {
  --bg: #0f1117;
  --bg-2: #171a23;
  --card: #1c2029;
  --card-2: #232833;
  --line: #2b313d;
  --text: #e7eaf0;
  --muted: #8a93a6;
  --accent: #4a90ff;
  --accent-2: #7fb0ff;
  --blue: #4a90ff;
  --good: #43d17a;
  --bad: #ff5b5b;
  --draw: #ffcf66;
  --accent-ink: #08121f;
  color: var(--text);
}
/* 다크 모드 — 헤더의 🌙 버튼(kg-nav.js)이 html[data-theme] 을 바꾼다. */
:root[data-theme="dark"] {
  --bg: #0f1117;
  --bg-2: #171a23;
  --card: #1c2029;
  --card-2: #232833;
  --line: #2b313d;
  --text: #e7eaf0;
  --muted: #8a93a6;
  --accent: #4a90ff;
  --accent-2: #7fb0ff;
  --blue: #4a90ff;
  --good: #43d17a;
  --bad: #ff5b5b;
  --draw: #ffcf66;
  --accent-ink: #08121f;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  font-family: "Pretendard", -apple-system, BlinkMacSystemFont, "Malgun Gothic", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.pad { padding: 20px; }

/* 헤더 */
.site-header {
  background: rgba(15,17,23,.9);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(8px);
}
.header-inner { display: flex; align-items: center; gap: 16px; height: 58px; }
.hub-link {
  font-size: 13px; color: var(--muted); border: 1px solid var(--line);
  padding: 5px 10px; border-radius: 999px;
}
.hub-link:hover { color: var(--text); border-color: var(--accent); }
.header-spacer { flex: 1; }
.header-search { display: none; gap: 6px; }
.header-search input {
  background: var(--card); border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 7px 10px; width: 180px; font-size: 13px;
}
@media (min-width: 900px) { .header-search { display: flex; } }

/* 히어로 — FC 아트를 핫링크하지 않으려고 그라디언트만 쓴다(잔디 필드 느낌의 초록/파랑). */
.hero {
  padding: 54px 0 40px;
  background:
    radial-gradient(1000px 360px at 50% -60px, rgba(74,144,255,.22), transparent 70%),
    linear-gradient(180deg, #0d1524 0%, #0f1117 100%);
  border-bottom: 1px solid var(--line);
  text-align: center;
}
.hero-title { font-size: 32px; font-weight: 800; margin: 0 0 8px; letter-spacing: -1px; }
.hero-title b { color: var(--accent); }
.hero-sub { color: var(--muted); margin: 0 0 22px; font-size: 15px; }

.search-box { display: flex; gap: 8px; max-width: 560px; margin: 0 auto; }
.search-box input {
  flex: 1; min-width: 0; height: 48px;
  background: var(--card); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 0 14px; font-size: 15px;
}
.search-box input:focus { outline: none; border-color: var(--accent); }
.search-box button {
  height: 48px; padding: 0 22px; border: 0; border-radius: 10px; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 15px;
}
.search-box button:hover { background: var(--accent-2); }
.popular { margin-top: 14px; display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.popular a {
  font-size: 12px; color: var(--muted); background: var(--card);
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px;
}
.popular a:hover { color: var(--accent); border-color: var(--accent); }

/* 공통 */
.section-title {
  font-size: 17px; font-weight: 700; margin: 26px 0 12px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.section-title .muted { font-size: 12px; font-weight: 400; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.notice { padding: 40px 20px; text-align: center; color: var(--muted); }
.notice.err { color: var(--bad); }
.spinner {
  width: 26px; height: 26px; margin: 0 auto 12px;
  border: 3px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.btn {
  background: var(--card-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 8px 14px; font-size: 13px; cursor: pointer;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }

/* 프로필 헤더 */
.profile-head {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; margin-top: 20px;
}
.pf-avatar {
  width: 56px; height: 56px; border-radius: 12px; flex: 0 0 auto;
  background: linear-gradient(135deg, #2f80ff, #14406e);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 800; color: #fff;
}
.pf-name { font-size: 22px; font-weight: 800; margin: 0; }
.pf-meta { color: var(--muted); font-size: 13px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tag { font-size: 11px; border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; color: var(--muted); }
.pf-actions { margin-left: auto; display: flex; gap: 8px; }

/* 최근 전적 요약 스탯 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; text-align: center; }
.stat .v { font-size: 20px; font-weight: 800; letter-spacing: -.5px; }
.stat .k { font-size: 12px; color: var(--muted); margin-top: 3px; }
.stat .v.hl { color: var(--accent); }
.stat .v.win { color: var(--good); }
.stat .v.lose { color: var(--bad); }

/* 최고 등급 카드 */
.div-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.div-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.div-card .dc-mode { font-size: 12px; color: var(--muted); }
.div-card .dc-div { font-size: 18px; font-weight: 800; margin-top: 2px; color: var(--accent); }
.div-card .dc-date { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* 매치 목록 */
.match-list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.match { display: flex; align-items: center; gap: 14px; padding: 12px 14px; cursor: pointer; }
.match + .match { border-top: 1px solid var(--line); }
.match:hover { background: var(--card-2); }
.m-result {
  flex: 0 0 44px; text-align: center; border-left: 3px solid var(--line);
  padding-left: 10px; margin-left: -14px; font-weight: 800; font-size: 18px;
}
.match.win .m-result { border-left-color: var(--good); color: var(--good); }
.match.lose .m-result { border-left-color: var(--bad); color: var(--bad); }
.match.draw .m-result { border-left-color: var(--draw); color: var(--draw); }
.m-score { flex: 0 0 auto; text-align: center; min-width: 66px; }
.m-score .sc { font-size: 20px; font-weight: 800; letter-spacing: 1px; }
.m-score .lb { font-size: 11px; color: var(--muted); }
.m-info { flex: 1 1 auto; min-width: 0; }
.m-mode { font-size: 13px; font-weight: 600; }
.m-sub { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-extra { flex: 0 0 auto; text-align: right; font-size: 11px; color: var(--muted); }
.m-extra b { display: block; font-size: 14px; color: var(--text); font-weight: 700; }

/* 감독 랭킹 (홈·랭킹 페이지) */
.rank-list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.rank-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; }
.rank-row + .rank-row { border-top: 1px solid var(--line); }
.rank-row:hover { background: var(--card-2); cursor: pointer; }
.rank-row .rk { flex: 0 0 34px; text-align: center; font-weight: 800; color: var(--muted); }
.rank-row .rk.top { color: var(--accent); }
.rank-row .nm { font-weight: 700; font-size: 14px; }
.rank-row .sub { font-size: 12px; color: var(--muted); }
.rank-row > div:nth-child(2) { flex: 1 1 auto; min-width: 0; }
.rank-row .cp { flex: 0 0 auto; font-size: 12px; font-weight: 700; color: var(--accent); }

/* 매치 상세 — 양 팀 비교 */
.md-score {
  display: flex; align-items: center; justify-content: center; gap: 20px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; margin-top: 20px; flex-wrap: wrap;
}
.md-side { text-align: center; min-width: 120px; }
.md-side .nm { font-size: 17px; font-weight: 800; }
.md-side .rs { font-size: 12px; margin-top: 2px; }
.md-side.win .rs { color: var(--good); } .md-side.lose .rs { color: var(--bad); } .md-side.draw .rs { color: var(--draw); }
.md-vs { font-size: 34px; font-weight: 900; letter-spacing: 2px; }

/* 스탯 비교 바 */
.cmp-row { display: grid; grid-template-columns: 60px 1fr 90px 1fr 60px; align-items: center; gap: 8px; padding: 8px 0; font-size: 13px; }
.cmp-row + .cmp-row { border-top: 1px solid var(--line); }
.cmp-row .cl { text-align: right; font-weight: 700; }
.cmp-row .cr { text-align: left; font-weight: 700; }
.cmp-row .ck { text-align: center; color: var(--muted); font-size: 12px; }
.cmp-bar { height: 8px; border-radius: 4px; background: var(--card-2); overflow: hidden; display: flex; }
.cmp-bar i { display: block; height: 100%; }
.cmp-bar.l { justify-content: flex-end; } .cmp-bar.l i { background: var(--accent); }
.cmp-bar.r i { background: var(--muted); }

/* 라인업 */
.squad-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 20px 0 14px; overflow-x: auto; }
.squad-tabs button {
  background: none; border: 0; border-bottom: 2px solid transparent; cursor: pointer;
  color: var(--muted); font-size: 14px; font-weight: 600; padding: 10px 14px; white-space: nowrap;
}
.squad-tabs button.on { color: var(--accent); border-bottom-color: var(--accent); }
.squad-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 10px; }
.pl-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; text-align: center; position: relative; }
.pl-card.sub { opacity: .82; }
.pl-img { width: 64px; height: 64px; object-fit: contain; margin: 0 auto 4px; display: block; }
.pl-pos { position: absolute; top: 8px; left: 8px; font-size: 10px; font-weight: 700; color: var(--accent); background: var(--card-2); border-radius: 5px; padding: 1px 5px; }
.pl-grade { position: absolute; top: 8px; right: 8px; font-size: 10px; font-weight: 800; color: var(--accent-ink); background: var(--accent); border-radius: 5px; padding: 1px 5px; }
.pl-season { width: 15px; height: 15px; object-fit: contain; vertical-align: -3px; margin-right: 3px; }
.pl-name { font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-rating { font-size: 12px; color: var(--muted); margin-top: 2px; }
.pl-rating b { color: var(--text); }
.pl-gline { font-size: 11px; color: var(--accent); margin-top: 2px; }

/* 푸터 */
.site-footer {
  border-top: 1px solid var(--line); margin-top: 48px; padding: 22px 0 34px;
  color: var(--muted); font-size: 12px; text-align: center;
}
.site-footer nav { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-bottom: 10px; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--accent); }
.disclaimer { max-width: 720px; margin: 0 auto 8px; line-height: 1.7; }

@media (max-width: 640px) {
  .hero-title { font-size: 26px; }
  .cmp-row { grid-template-columns: 48px 1fr 70px 1fr 48px; font-size: 12px; }
  .md-vs { font-size: 26px; }
}
