/* 킬각 TFT — dak.gg 식 2단: 헤더·히어로는 다크, 본문은 라이트. 색은 전부 토큰.
 * 액센트=바이올렛(기존 게임들과 구분). 라이트에선 흰 배경 대비 위해 명도 내린 --accent,
 * 채움/테두리 원색은 --accent-vivid. 테마 함정 3개는 reference_killgak_theme_ssr 준수. */
:root {
  --bg: #e8ecf3; --bg-2: #eef3fa; --card: #ffffff; --card-2: #eef3fa;
  --line: #d3dce8; --text: #1b1f27; --muted: #5f6b7a;
  --accent: #6d43d8; --accent-vivid: #8b5cf6; --accent-2: #5834b0;
  --blue: #005ef3; --good: #1e7a41; --bad: #d70000;
  --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: #a78bfa; --accent-2: #c4b5fd; --blue: #4a90ff; --good: #43d17a; --bad: #ff5b5b;
  --accent-ink: #1a1030;
  color: var(--text);
}
:root[data-theme="dark"] {
  --bg: #0f1117; --bg-2: #171a23; --card: #1c2029; --card-2: #232833;
  --line: #2b313d; --text: #e7eaf0; --muted: #8a93a6;
  --accent: #a78bfa; --accent-2: #c4b5fd; --accent-vivid: #a78bfa; --accent-ink: #1a1030;
  --blue: #4a90ff; --good: #43d17a; --bad: #ff5b5b;
}
* { 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; }
img { max-width: 100%; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.pad { padding: 20px; }
.center { text-align: center; }

/* 헤더 */
.site-header {
  background: rgba(15,17,23,.92); 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: 14px; height: 58px; }
.hub-link {
  font-size: 13px; color: var(--muted); border: 1px solid var(--line);
  padding: 5px 10px; border-radius: 999px; white-space: nowrap;
}
.hub-link:hover { color: var(--text); border-color: var(--accent); }
.hub-link.on { color: var(--accent); 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: 190px; font-size: 13px;
}
@media (min-width: 860px) { .header-search { display: flex; } }

/* 히어로 */
.hero {
  padding: 52px 0 40px; text-align: center; border-bottom: 1px solid var(--line);
  background:
    radial-gradient(900px 340px at 50% -60px, rgba(167,139,250,.28), transparent 70%),
    linear-gradient(180deg, #12121e 0%, #16121f 55%, #1a1226 100%);
}
.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: 620px; 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; white-space: nowrap;
}
.search-box button:hover { background: var(--accent-2); }
.hint { margin-top: 10px; font-size: 12px; color: var(--muted); }
.popular { margin-top: 12px; display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.popular a, .chip {
  font-size: 12px; color: var(--muted); background: var(--card);
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; cursor: pointer;
}
.popular a:hover, .chip:hover { color: var(--accent); border-color: var(--accent); }
.chip.on { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }

.subnav { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
.subnav a {
  font-size: 13px; font-weight: 600; color: var(--muted);
  border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 7px 14px;
}
.subnav a:hover, .subnav a.on { 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); } }

/* 홈 안내 카드 */
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-top: 8px; }
.info-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.info-card h3 { margin: 0 0 6px; font-size: 15px; }
.info-card p { margin: 0; font-size: 13px; color: var(--muted); }

/* ===== 프로필 ===== */
.pf-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin: 20px 0 6px; }
.pf-avatar { width: 76px; height: 76px; border-radius: 16px; border: 2px solid var(--line); background: var(--card-2); object-fit: cover; }
.pf-name { font-size: 24px; font-weight: 800; letter-spacing: -.5px; }
.pf-name .tag { color: var(--muted); font-weight: 600; font-size: 16px; }
.pf-meta { color: var(--muted); font-size: 13px; margin-top: 2px; }
.pf-refresh { margin-left: auto; }
.btn {
  height: 38px; padding: 0 16px; border: 1px solid var(--line); border-radius: 9px; cursor: pointer;
  background: var(--card); color: var(--text); font-weight: 700; font-size: 13px;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-2); color: var(--accent-ink); }

.pf-cards { display: grid; grid-template-columns: 260px 1fr; gap: 14px; margin-top: 12px; align-items: start; }
@media (max-width: 720px) { .pf-cards { grid-template-columns: 1fr; } }
.pf-body { display: grid; grid-template-columns: 340px 1fr; gap: 14px; margin-top: 16px; align-items: start; }
@media (max-width: 860px) { .pf-body { grid-template-columns: 1fr; } }
.pf-left { display: flex; flex-direction: column; gap: 14px; }
@media (max-width: 860px) { .pf-left { flex-direction: column; } }
.mplace-box { min-width: 40px; padding: 4px 6px; border-radius: 8px; font-size: 18px; font-weight: 900;
  color: #fff; line-height: 1.1; display: inline-block; }
.mplace-box.p1 { color: #3a2600; }

.rank-card { text-align: center; }
.rank-card .tier { font-size: 20px; font-weight: 800; }
.rank-card .lp { color: var(--muted); font-size: 13px; margin-top: 2px; }
.rank-card .wr { display: flex; justify-content: center; gap: 16px; margin-top: 12px; }
.rank-card .wr div { font-size: 12px; color: var(--muted); }
.rank-card .wr b { display: block; font-size: 18px; color: var(--text); }
.rank-badge {
  display: inline-flex; align-items: center; gap: 6px; margin-bottom: 8px; padding: 4px 12px;
  border-radius: 999px; background: var(--card-2); font-weight: 800; font-size: 13px;
}
.hot { color: #e6522e; font-size: 12px; font-weight: 700; }
.stat-row { display: flex; justify-content: space-around; text-align: center; margin-top: 4px; }
.stat-row .s b { display: block; font-size: 18px; font-weight: 800; }
.stat-row .s span { font-size: 11px; color: var(--muted); }

/* ===== 프로필 대시보드(인포그래픽) ===== */
.pf-dash { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 14px; }
@media (max-width: 900px) { .pf-dash { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .pf-dash { grid-template-columns: 1fr; } }
.dash {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; display: flex; flex-direction: column; min-height: 128px;
}
.dash-h { font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 10px; letter-spacing: .2px; }
.dash-body { flex: 1; display: flex; align-items: center; justify-content: center; }

/* 랭크 카드 + Top4 도넛 */
.rankd { display: flex; align-items: center; gap: 14px; width: 100%; }
.donut { position: relative; width: 76px; height: 76px; flex: 0 0 auto; }
.donut svg { transform: rotate(-90deg); }
.donut .track { fill: none; stroke: var(--card-2); stroke-width: 9; }
.donut .val { fill: none; stroke: var(--accent-vivid); stroke-width: 9; stroke-linecap: round; transition: stroke-dashoffset .7s ease; }
.donut .ctr { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.donut .ctr b { font-size: 19px; font-weight: 800; line-height: 1; }
.donut .ctr span { font-size: 9px; color: var(--muted); margin-top: 2px; }
.rankd .meta { min-width: 0; }
.rankd .tier { font-size: 17px; font-weight: 800; }
.rankd .lp { font-size: 13px; color: var(--muted); }
.rankd .sub { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* 평균 등수 게이지 */
.avgp { width: 100%; text-align: center; }
.avgp .big { font-size: 40px; font-weight: 900; line-height: 1; letter-spacing: -1px; }
.avgp .lbl { font-size: 11px; color: var(--muted); margin: 2px 0 12px; }
.gauge { position: relative; height: 10px; border-radius: 6px; overflow: visible;
  background: linear-gradient(90deg, #e8a11e 0%, #2fb3a3 22%, #4f86d8 45%, #98a0aa 60%, #d1743f 80%, #d64b3f 100%); }
.gauge .mark { position: absolute; top: -4px; width: 3px; height: 18px; background: var(--text);
  border-radius: 2px; transform: translateX(-50%); box-shadow: 0 0 0 2px var(--card); }
.gauge-scale { display: flex; justify-content: space-between; font-size: 9px; color: var(--muted); margin-top: 5px; }

/* 배치 분포 히스토그램 */
.hist { display: flex; align-items: flex-end; gap: 5px; width: 100%; height: 84px; }
.hist .col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; }
.hist .bar { width: 100%; border-radius: 4px 4px 0 0; min-height: 3px; transition: height .5s ease; position: relative; }
.hist .cnt { font-size: 10px; font-weight: 700; height: 13px; line-height: 13px; }
.hist .cnt.zero { color: var(--muted); opacity: .45; }
.hist .lb { font-size: 10px; color: var(--muted); margin-top: 3px; font-weight: 700; }

/* 최근 배치 pill + 스파크라인 */
.formd { width: 100%; }
.pills { display: flex; gap: 4px; flex-wrap: wrap; }
.pill {
  width: 22px; height: 22px; border-radius: 6px; display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; color: #fff;
}
.pill.p1 { color: #3a2600; }
.form-stats { display: flex; gap: 14px; margin-top: 12px; }
.form-stats .s { text-align: center; }
.form-stats .s b { display: block; font-size: 17px; font-weight: 800; }
.form-stats .s span { font-size: 10px; color: var(--muted); }

/* 모스트 유닛/특성 빈도 바 */
.freq-card { margin-top: 12px; }
.freq { display: flex; flex-direction: column; gap: 7px; margin-top: 4px; }
.freq-row { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; }
.freq-face { width: 34px; height: 34px; border-radius: 7px; overflow: hidden; border: 2px solid var(--cost, #7f8792); background: var(--card-2); }
.freq-face img { width: 100%; height: 100%; object-fit: cover; }
.freq-mid { min-width: 0; }
.freq-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.freq-bar { height: 6px; border-radius: 4px; background: var(--card-2); margin-top: 4px; overflow: hidden; }
.freq-bar i { display: block; height: 100%; border-radius: 4px; background: var(--accent-vivid); transition: width .6s ease; }
.freq-meta { text-align: right; white-space: nowrap; }
.freq-meta b { font-size: 14px; font-weight: 800; }
.freq-meta span { display: block; font-size: 10px; color: var(--muted); }
.place-badge { display: inline-block; min-width: 20px; text-align: center; padding: 1px 5px; border-radius: 5px;
  font-size: 11px; font-weight: 800; color: #fff; }
.place-badge.p1 { color: #3a2600; }
.star3-tag { color: #e6a11e; font-size: 10px; font-weight: 700; }

.trait-freq { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.tf-row { display: flex; align-items: center; gap: 8px; }
.tf-ic { width: 22px; height: 22px; border-radius: 5px; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.tf-ic img { width: 15px; height: 15px; filter: brightness(0) invert(1); }
.tf-name { font-size: 12px; font-weight: 600; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tf-bar { flex: 0 0 90px; height: 6px; border-radius: 4px; background: var(--card-2); overflow: hidden; }
.tf-bar i { display: block; height: 100%; background: var(--accent-vivid); border-radius: 4px; }
.tf-cnt { font-size: 11px; font-weight: 700; color: var(--muted); flex: 0 0 auto; }

/* 매치 리스트 */
.match-list { display: flex; flex-direction: column; gap: 8px; }
.match {
  display: grid; grid-template-columns: 64px 1fr; gap: 12px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--line);
  border-radius: var(--radius); padding: 12px 14px;
}
.match.top1 { border-left-color: #e6a11e; }
.match.top4 { border-left-color: var(--blue); }
.match-place { text-align: center; }
.match-place .p { font-size: 22px; font-weight: 900; line-height: 1; }
.match-place .ord { font-size: 11px; color: var(--muted); }
.match-place .when { font-size: 10px; color: var(--muted); margin-top: 4px; }
.match-body { min-width: 0; }
.match-meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.match-meta .lv { color: var(--text); font-weight: 700; }

.traits { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; }
.trait { display: inline-flex; align-items: center; gap: 3px; padding: 2px 7px 2px 3px; border-radius: 999px;
  font-size: 11px; font-weight: 700; color: #fff; }
.trait img { width: 15px; height: 15px; filter: brightness(0) invert(1); }

.board { display: flex; gap: 5px; flex-wrap: wrap; }
.unit { width: 46px; }
.unit .hex {
  position: relative; width: 46px; height: 46px; border-radius: 8px; overflow: hidden;
  border: 2px solid var(--cost, #7f8792); background: var(--card-2);
}
.unit .hex img { width: 100%; height: 100%; object-fit: cover; }
.unit .stars { text-align: center; font-size: 10px; line-height: 1; color: #e6a11e; height: 11px; margin-top: 1px; }
.unit .stars.s3 { color: #e6a11e; text-shadow: 0 0 3px rgba(230,161,30,.6); }
.unit .items { display: flex; gap: 1px; justify-content: center; margin-top: 1px; }
.unit .items img { width: 13px; height: 13px; border-radius: 3px; border: 1px solid var(--line); }

/* ===== 랭킹 ===== */
.rank-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; }
.rank-item {
  display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center;
  padding: 11px 14px; border: 1px solid var(--line); border-top: 0; background: var(--card);
}
.rank-item:first-child { border-top: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; }
.rank-item:last-child { border-radius: 0 0 var(--radius) var(--radius); }
.rank-item:hover { background: var(--card-2); }
.rk-no { text-align: center; font-weight: 800; color: var(--muted); }
.rank-item:nth-child(1) .rk-no { color: #e6a11e; }
.rank-item:nth-child(2) .rk-no, .rank-item:nth-child(3) .rk-no { color: var(--accent); }
.rk-main { min-width: 0; display: flex; flex-direction: column; }
.rk-name { font-weight: 700; font-size: 15px; }
.rk-name:hover { color: var(--accent); }
.rk-tag { color: var(--muted); font-weight: 600; font-size: 12px; margin-left: 2px; }
.rk-sub { font-size: 12px; color: var(--muted); }
.rk-wr { text-align: right; min-width: 128px; }
.rk-wr .wr-top { font-size: 14px; }
.rk-wr .wr-top b { font-size: 15px; }
.rk-wr .wr-lbl { font-size: 10px; color: var(--muted); }
.rk-wr .wr-bar { display: block; height: 5px; border-radius: 3px; background: var(--card-2); overflow: hidden; margin: 3px 0 3px auto; width: 100px; }
.rk-wr .wr-bar i { display: block; height: 100%; border-radius: 3px; background: var(--accent-vivid); }
.rk-wr small { display: block; font-size: 11px; color: var(--muted); }
/* 메달(상위 3) */
.rk-no.medal { color: #fff; }
.rk-no .mdl { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px;
  border-radius: 50%; font-size: 12px; font-weight: 800; color: #3a2600; }
.rk-no .mdl.m1 { background: linear-gradient(135deg, #ffd964, #e6a11e); }
.rk-no .mdl.m2 { background: linear-gradient(135deg, #dbe2ea, #a9b4c2); }
.rk-no .mdl.m3 { background: linear-gradient(135deg, #e6b98a, #c9824f); color: #fff; }
/* LP 상대 바 */
.rk-lpbar { display: block; height: 4px; border-radius: 3px; background: var(--card-2); overflow: hidden; margin-top: 5px; max-width: 260px; }
.rk-lpbar i { display: block; height: 100%; border-radius: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-vivid)); transition: width .5s ease; }
/* 랭킹 요약 스트립 */
.rank-summary { display: flex; gap: 10px; flex-wrap: wrap; margin: 4px 0 14px; }
.rank-summary .rs {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 16px; text-align: center; min-width: 96px;
}
.rank-summary .rs b { display: block; font-size: 18px; font-weight: 800; }
.rank-summary .rs span { font-size: 11px; color: var(--muted); }

/* 푸터 */
.site-footer { margin-top: 40px; border-top: 1px solid var(--line); background: var(--bg-2); }
.footer-inner { padding: 24px 16px; text-align: center; color: var(--muted); font-size: 12px; line-height: 1.8; }
.footer-inner a { color: var(--muted); }
.footer-inner a:hover { color: var(--accent); }
.footer-links { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 8px; }
