/*
 * 디자인 기준
 * - 간격은 4px 격자, 글자 굵기는 400 / 500 / 600, 자간은 큰 제목만 살짝 좁게
 * - 표면은 중립 회색 단계, 강조색은 청록 하나 (주 버튼·1위 막대·게이지 바늘·핵심 숫자에만)
 * - 시그니처: 눈금. 다양성 게이지와 공유 카드의 점수 줄에 같은 눈금을 씀
 * - 움직임은 색·표면·투명도·transform만, 곡선 하나
 */
@font-face {
  font-family: "Pretendard";
  src: url("../fonts/PretendardVariable.woff2") format("woff2-variations"), url("../fonts/PretendardVariable.woff2") format("woff2");
  font-weight: 45 920;
  font-style: normal;
  font-display: swap;
}
:root {
  --bg: #FAFAFA;
  --surface: #FFFFFF;
  --surface-2: #F4F4F5;
  --hover: #ECECEE;
  --text: #171717;
  --text-2: #525252;
  --muted: #737373;
  --border: rgba(23, 23, 23, .08);
  --border-strong: rgba(23, 23, 23, .16);
  --accent: #0F766E;
  --accent-hover: #0D6560;
  --on-accent: #FFFFFF;
  --accent-soft: #E8F3F1;
  --primary: var(--accent);
  --primary-hover: var(--accent-hover);
  --on-primary: var(--on-accent);
  --bar: #D4D4D8;
  --bar-strong: #A1A1AA;
  --good: #15803D;
  --mid: #1D4ED8;
  --lean: #B45309;
  --bad: #DC2626;
  color-scheme: light;
  --radius: 16px;
  --radius-control: 10px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  /* 화면 아래 고정 요소(알림·맨 위로)의 높이. 처음엔 Netlify 무료 배지를 피하려고 만든 값 */
  --dock: 72px;
  --mono: ui-monospace, "SF Mono", Consolas, "Courier New", monospace;
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
}

/* 다크: 기기 설정을 따르되, 상단 버튼으로 고르면 data-theme이 우선해요 */
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #141415;
  --surface: #19191B;
  --surface-2: #232325;
  --hover: #2B2B2E;
  --text: #EDEDED;
  --text-2: #A1A1A6;
  --muted: #85858B;
  --border: rgba(237, 237, 237, .08);
  --border-strong: rgba(237, 237, 237, .16);
  --accent: #2DD4BF;
  --accent-hover: #5EEAD4;
  --on-accent: #04201D;
  --accent-soft: #12302D;
  --primary: #EDEDED;
  --primary-hover: #FFFFFF;
  --on-primary: #141415;
  --bar: #3A3A3E;
  --bar-strong: #6B6B72;
  --good: #4CC38A;
  --mid: #7AA7F0;
  --lean: #E0A458;
  --bad: #E5484D;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #141415;
    --surface: #19191B;
    --surface-2: #232325;
    --hover: #2B2B2E;
    --text: #EDEDED;
    --text-2: #A1A1A6;
    --muted: #85858B;
    --border: rgba(237, 237, 237, .08);
    --border-strong: rgba(237, 237, 237, .16);
    --accent: #2DD4BF;
    --accent-hover: #5EEAD4;
    --on-accent: #04201D;
    --accent-soft: #12302D;
  --primary: #EDEDED;
  --primary-hover: #FFFFFF;
  --on-primary: #141415;
    --bar: #3A3A3E;
    --bar-strong: #6B6B72;
    --good: #4CC38A;
    --mid: #7AA7F0;
    --lean: #E0A458;
    --bad: #E5484D;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); line-height: 1.6; -webkit-font-smoothing: antialiased; padding-bottom: env(safe-area-inset-bottom); }
/* 한국어 줄바꿈: 글자 단위가 아니라 띄어쓰기 단위로 끊기 ("보⏎여드려요" 방지).
   띄어쓰기 없이 긴 영문·숫자·코드는 넘칠 때만 아무 데서나 끊어요 */
body { word-break: keep-all; overflow-wrap: anywhere; }
/* 제목·짧은 문장은 줄 길이를 고르게, 긴 문단은 마지막 줄에 한 단어만 남지 않게 */
h1, h2, h3, .lead, .mode-desc, summary, th, .insight b, .tile .k { text-wrap: balance; }
p, li, td, .sub, .hint { text-wrap: pretty; }
/* 큰 화면에서만 정해둔 위치에서 줄바꿈 */
@media (max-width: 720px) { .br-wide { display: none; } }
a { color: var(--accent); }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.ico { flex: none; }

/* 상단 */
.top { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
.top-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 60px; }
.brand { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 600; line-height: 1; }
.logo { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: var(--text); color: var(--surface); font-size: 14px; font-weight: 600; letter-spacing: 0; }
.top-right { display: flex; align-items: center; gap: 12px; }
/* .btn.small의 margin-top(8px)이 뒤에서 덮어써서 설치 버튼만 아래로 내려가던 문제: 상단 바 안에서는 여백 없이 */
.top-right .btn.install { margin: 0; }
.theme-toggle { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--text-2); cursor: pointer; transition: background-color .15s var(--ease), color .15s var(--ease), transform .15s var(--ease); }
.theme-toggle:hover { background: var(--surface-2); color: var(--text); }
.theme-toggle:active { transform: scale(0.98); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: block; }
:root[data-theme="dark"] .theme-toggle .moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .moon { display: none; }
}

/* 업로드 */
.hero { padding: 56px 0 16px; text-align: center; }
.hero-top { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 64px; align-items: center; margin-bottom: 48px; text-align: left; }
.hero-top .hero-text h1 { font-size: clamp(32px, 4.4vw, 48px); line-height: 1.2; margin: 0 0 16px; }
.hero-top .lead { margin: 0; max-width: 520px; }
.hero-visual .invite { max-width: none; margin: 0; }
/* 예시 공유 카드: 실제 공유 카드와 같은 종이 톤 (화면 모드와 상관없이 밝게) */
.hero-card { --hc-paper: #FDFBF7; --hc-raised: #F4EFE6; --hc-line: #E4DDD0; --hc-ink: #1F1B16; --hc-ink2: #5E554A; --hc-muted: #7B7266; --hc-track: #EAE4D8; --hc-bar: #BDB4A4; --hc-tick: #B8AE9C; --hc-accent: #0F766E;
  position: relative; padding: 28px 28px 24px; background: var(--hc-paper); color: var(--hc-ink); border: 1px solid var(--hc-line); border-radius: 24px; box-shadow: 0 2px 4px rgba(31, 27, 22, .04), 0 20px 40px rgba(31, 27, 22, .10); transform: rotate(-2deg); }
.hero-card p { margin: 0; }
.hc-tag { position: absolute; top: 24px; right: 24px; font-size: 12px; font-weight: 500; color: var(--hc-muted); border: 1px solid var(--hc-line); border-radius: 6px; padding: 0 8px; line-height: 20px; }
.hc-k { font-size: 13px; font-weight: 600; color: var(--hc-accent); }
.hc-type { display: flex; align-items: center; gap: 12px; margin-top: 12px !important; font-size: 32px; line-height: 40px; font-weight: 600; letter-spacing: -0.02em; }
.hc-type svg { flex: none; color: var(--hc-accent); }
.hc-score { margin-top: 16px; padding: 16px 20px; background: var(--hc-raised); border-radius: 16px; }
.hc-score-top { display: flex; justify-content: space-between; align-items: flex-end; }
.hc-score-k { font-size: 12px; font-weight: 500; color: var(--hc-muted); }
.hc-num { font-size: 56px; line-height: 60px; font-weight: 600; letter-spacing: -0.03em; color: var(--hc-accent); font-variant-numeric: tabular-nums; }
.hc-num small { font-size: 18px; font-weight: 500; color: var(--hc-muted); letter-spacing: 0; margin-left: 4px; }
.hc-level { font-size: 15px; font-weight: 600; color: #B45309; padding-bottom: 8px; }
.hc-ruler { display: block; width: 100%; height: 24px; margin-top: 12px; color: var(--hc-tick); }
.hc-needle { fill: var(--hc-accent); }
.hc-bars { display: grid; gap: 8px; margin-top: 16px; }
.hc-bar { display: grid; grid-template-columns: 84px 1fr 40px; align-items: center; gap: 12px; font-size: 14px; font-weight: 500; }
.hc-track { display: block; height: 8px; border-radius: 4px; background: var(--hc-track); overflow: hidden; }
.hc-track span { display: block; height: 100%; border-radius: 4px; background: var(--hc-bar); }
.hc-bar.first .hc-track span { background: var(--hc-accent); }
.hc-pct { text-align: right; color: var(--hc-ink2); font-variant-numeric: tabular-nums; }
.hero h1 { font-size: clamp(28px, 5vw, 44px); line-height: 1.25; font-weight: 600; margin: 0 0 12px; letter-spacing: -0.02em; }
.lead { color: var(--text-2); max-width: 680px; margin: 0 auto 32px; font-size: 18px; line-height: 28px; }
.lead:empty { display: none; }
.drop { transition: border-color .15s var(--ease), background-color .15s var(--ease); }
.status { min-height: 24px; margin: 16px 0 0; font-size: 14px; color: var(--text-2); }
.status.error { color: var(--bad); font-weight: 500; }

.guide { text-align: left; max-width: 720px; margin: 20px auto 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px; }
.guide summary { cursor: pointer; font-weight: 500; }
.guide ol { padding-left: 20px; margin: 12px 0 4px; }
.guide li { margin: 8px 0; color: var(--text-2); }
.hint { font-size: 13px; color: var(--muted); margin: 8px 0 4px; }
.guide-tag { display: inline-block; margin: 16px 0 0; padding: 0 8px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-size: 13px; line-height: 24px; font-weight: 500; }
.guide-sub { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 12px; }
.guide-sub summary { font-weight: 500; font-size: 14px; color: var(--text-2); }
.guide-sub ul { padding-left: 20px; margin: 8px 0 4px; }
.guide-sub li { margin: 8px 0; color: var(--text-2); font-size: 14px; }

/* 버튼 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); padding: 0 16px; border-radius: var(--radius-control); font: inherit; font-weight: 500; font-size: 14px; line-height: 20px; cursor: pointer; transition: background-color .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease), transform .15s var(--ease); }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.small { min-height: 32px; padding: 0 12px; font-size: 13px; margin-top: 8px; }
.btn[disabled], .btn.primary[disabled] { background: var(--surface-2); border-color: var(--border); color: var(--muted); cursor: not-allowed; transform: none; }
.btn[aria-busy="true"] { cursor: progress; }
.btn:focus-visible, .chips button:focus-visible, select:focus-visible, .sns-btn:focus-visible, input.code:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 결과 */
#result { padding: 28px 0 0; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips button { border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); min-height: 32px; padding: 0 12px; border-radius: 8px; font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; transition: background-color .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease); }
.chips button:hover { background: var(--surface-2); color: var(--text); }
.chips button.on { background: var(--text); color: var(--surface); border-color: var(--text); }
.chips.sm { gap: 4px; }
.chips.sm button { min-height: 24px; padding: 0 8px; font-size: 12px; border-radius: 6px; }

.right-column-wrapper { display: flex; flex-direction: column; gap: 16px; height: 100%; }
#personaPanel .cat-group:last-of-type { margin-bottom: 0; }

.tiles { display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr)); gap: 12px; width: 100%; margin: 16px 0; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px 20px; display: flex; flex-direction: column; justify-content: flex-start; min-height: 104px; }
.tile .k { font-size: 13px; line-height: 20px; color: var(--muted); font-weight: 500; text-align: left; }
.tile .v { font-size: 40px; line-height: 48px; font-weight: 600; letter-spacing: -0.02em; margin-top: 4px; font-variant-numeric: tabular-nums; text-align: left; }
.tile .v small { font-size: 16px; color: var(--muted); font-weight: 400; letter-spacing: 0; margin-left: 4px; }
.tile .d { font-size: 13px; line-height: 20px; color: var(--text-2); text-align: left; margin-top: auto; padding-top: 4px; }
.tiles:not(.three) > .tile:first-child .v { color: var(--accent); font-size: 56px; line-height: 64px; }
/* 통계 카드: 마우스를 올리면 숫자만 살짝 커져서 강조 (색·빛 효과 없음) */
.tile .v { transform-origin: left center; transition: transform .2s var(--ease); }
@media (hover: hover) { .tile:hover .v { transform: scale(1.04); } }
@media (prefers-reduced-motion: reduce) { .tile .v { transition: none; } }

.lv-wide { color: var(--good); } .lv-mid { color: var(--mid); } .lv-lean { color: var(--lean); } .lv-narrow { color: var(--bad); }

.grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 16px; margin-bottom: 16px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 24px; margin-bottom: 16px; }
.grid .panel { margin-bottom: 0; }
.panel h2 { font-size: 18px; line-height: 28px; font-weight: 600; margin: 0 0 4px; }
.panel .sub { color: var(--muted); font-size: 14px; margin: 0 0 16px; }
#card { width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--border); display: block; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.card-box { margin: 0; }
.card-box.story { max-width: 300px; margin-left: auto; margin-right: auto; }

/* 공유 */
.share h2 { margin-bottom: 16px; }
.sns { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; margin-bottom: 12px; }
.sns-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 16px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-control); color: var(--text-2); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; transition: background-color .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease), transform .15s var(--ease); }
.sns-btn:hover { background: var(--hover); border-color: var(--border-strong); color: var(--text); }
.sns-btn:active { transform: scale(0.98); }
.sns-btn[disabled] { opacity: .5; cursor: progress; }
.sns-btn .ico { display: grid; place-items: center; width: 28px; height: 28px; filter: grayscale(1); opacity: .6; transition: filter .15s var(--ease), opacity .15s var(--ease); }
.sns-btn .ico img { width: 28px; height: 28px; object-fit: contain; display: block; }
.sns-btn .ico svg { width: 24px; height: 24px; }
.sns-btn:hover .ico { filter: none; opacity: 1; }

.share-actions .btn { flex: 1 1 auto; }
.share .hint { margin-top: 12px; }

.toast { position: fixed; left: 50%; bottom: calc(var(--dock) + env(safe-area-inset-bottom)); transform: translate(-50%, 8px); max-width: min(560px, calc(100% - 32px)); background: var(--text); color: var(--surface); padding: 12px 20px; border-radius: 12px; font-size: 14px; font-weight: 500; box-shadow: 0 8px 24px rgba(0, 0, 0, .12); opacity: 0; pointer-events: none; transition: opacity .2s var(--ease), transform .2s var(--ease); z-index: 20; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
/* 맨 위로 가기: 600px 넘게 내려왔을 때만 나타나요 */
.to-top { position: fixed; right: calc(16px + env(safe-area-inset-right)); bottom: calc(var(--dock) + env(safe-area-inset-bottom)); z-index: 6; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 1px solid var(--border-strong); border-radius: 50%; background: var(--surface); color: var(--text); box-shadow: 0 4px 16px rgba(0, 0, 0, .12); cursor: pointer; opacity: 0; pointer-events: none; transform: translateY(8px); transition: opacity .2s var(--ease), transform .2s var(--ease), background-color .15s var(--ease); }
.to-top.show { opacity: 1; pointer-events: auto; transform: none; }
.to-top:hover { background: var(--surface-2); }
.to-top.show:active { transform: scale(0.96); }
.to-top:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 640px) { .toast.show ~ .to-top.show { transform: translateY(-80px); } }
@media (prefers-reduced-motion: reduce) { .to-top { transition: none; } }
.row { display: flex; gap: 8px; flex-wrap: wrap; }

/* 막대: 1위만 강조색, 나머지는 중립 */
.bars { display: flex; flex-direction: column; gap: 12px; }
.bar { display: grid; grid-template-columns: 148px 1fr 52px; align-items: center; gap: 12px; font-size: 14px; }
.bar .name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .track, .bar .fill, .pair .track, .pair .fill { display: block; }
.bar .track { background: var(--surface-2); border-radius: 4px; height: 8px; overflow: hidden; }
.bar .fill { height: 100%; background: var(--bar); border-radius: 4px; animation: fillUpBar .5s var(--ease) both; transform-origin: left; }
.bar.first .fill { background: var(--accent); }
.bar.first .pct { font-size: 20px; color: var(--accent); }
.bar .pct { text-align: right; font-weight: 500; font-variant-numeric: tabular-nums; }
.bar.unknown .fill { background: var(--bar-strong); }
.bar.unknown .name { color: var(--muted); }
@keyframes fillUpBar {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

.pair { display: grid; grid-template-columns: 148px 1fr 96px; align-items: center; gap: 12px; font-size: 14px; }
.pair .name { font-weight: 500; }
.pair .tracks { display: flex; flex-direction: column; gap: 4px; }
.pair .track { background: var(--surface-2); border-radius: 4px; height: 8px; overflow: hidden; }
.pair .fill { height: 100%; border-radius: 4px; animation: fillUpBar .5s var(--ease) both; transform-origin: left; }
.pair .fill.watch { background: var(--accent); }
.pair .fill.search { background: var(--bar-strong); }
.pair .pct { text-align: right; font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; line-height: 20px; }
.legend { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin: 8px 0 12px; }
.sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; margin-left: 8px; }
.sw.watch { background: var(--accent); margin-left: 0; } .sw.search { background: var(--bar-strong); }
.insights { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 8px; }
.insight { background: var(--surface-2); border-radius: var(--radius-control); padding: 12px 16px; font-size: 14px; }
.insight b { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 4px; }
.insight.warn b { color: var(--text); }

/* 채널 표 */
.table-wrap { overflow-x: auto; }
.channels { width: 100%; border-collapse: collapse; font-size: 14px; }
.channels th { color: var(--muted); font-weight: 500; font-size: 13px; padding: 8px 12px; border-bottom: 1px solid var(--border-strong); text-align: left; }
.channels th:last-child { width: 196px; min-width: 164px; }

/* 행은 아래쪽 헤어라인만, 높이 44px */
.channels td { height: 44px; padding: 4px 12px; border-bottom: 1px solid var(--border); }
.channels tbody tr:last-child td { border-bottom: 0; }
.channels tbody tr:hover td { background: var(--surface-2); }

.channels th.num, .channels .num { text-align: right; padding-right: 24px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.channels .rank { color: var(--muted); width: 28px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.channels .ch { font-weight: 500; min-width: 120px; overflow-wrap: anywhere; }
.channels .count-num { font-weight: 500; }
.channels .pct-sub { color: var(--muted); font-size: 13px; margin-left: 4px; }

.channels select { font: inherit; font-size: 13px; font-weight: 500; height: 32px; padding: 0 28px 0 12px; border-radius: 8px; border: 1px solid var(--border-strong); background-color: var(--surface-2); color: var(--text-2); width: 100%; min-width: 140px; max-width: 172px; cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23737373' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 12px; transition: background-color .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease); text-align: left; }
.channels select:hover { background-color: var(--hover); color: var(--text); }
.channels select.fixed { border-color: transparent; background-color: var(--accent-soft); color: var(--accent); }
.channels select.unk { color: var(--lean); }

.est { font-size: 12px; font-weight: 500; line-height: 20px; color: var(--lean); background: var(--surface-2); padding: 0 8px; border-radius: 6px; vertical-align: middle; }

.tiles.three { grid-template-columns: repeat(3, 1fr); margin: 0 0 16px; }
.tiles.three .tile { background: var(--surface-2); border-radius: var(--radius-control); }
.tiles.three .tile .v { font-size: 32px; line-height: 40px; }
.tiles.three .tile .v:has(small) { display: flex; align-items: baseline; gap: 2px; white-space: nowrap; }
.tiles.three .tile:last-child:not(:has(small)) .v { font-size: 24px; line-height: 32px; }
.tiles.three .tile .v .sub { display: block; font-size: 14px; font-weight: 400; color: var(--text-2); margin: 4px 0 0; }
.insight .big { font-size: 32px; line-height: 40px; font-weight: 600; letter-spacing: -0.02em; margin-right: 4px; font-variant-numeric: tabular-nums; }
.how { margin-top: 12px; font-size: 13px; color: var(--muted); }
.how summary { cursor: pointer; font-weight: 500; }
.how p { margin: 8px 0 0; line-height: 1.7; }
#friendPanel details.how { margin-top: 20px; padding-top: 12px; border-top: 1px solid var(--border); }

/* 분류 보강 */
.enrich { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; align-items: center; background: var(--surface-2); border-radius: 12px; padding: 16px; margin: 4px 0 16px; }
.enrich-text > b { display: block; margin-bottom: 4px; font-weight: 600; }
.enrich-text .sub { font-size: 13px; margin: 0; }
.enrich .status { grid-column: 1 / -1; margin: 0; }
.enrich .status:empty { display: none; }
.yt-mark { color: var(--muted); font-size: 11px; vertical-align: 1px; }
/* 분류 근거가 약한 상위 채널: 주황 점 + 작은 글자 (수준 색은 점으로만) */
.check-mark { display: inline-flex; align-items: center; margin-left: 8px; font-size: 12px; font-weight: 500; color: var(--lean); white-space: nowrap; }
.check-mark .lv-dot { width: 6px; height: 6px; margin-right: 4px; }
.check-ok { margin-left: 8px; min-height: 24px; padding: 0 8px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface); color: var(--text-2); font: inherit; font-size: 12px; font-weight: 500; cursor: pointer; white-space: nowrap; transition: background-color .15s var(--ease), color .15s var(--ease); }
.check-ok:hover { background: var(--surface-2); color: var(--text); }
.check-ok:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.check-note { margin: 0 0 12px; font-size: 13px; color: var(--text-2); }

/* 결과 요약(내 유형) */
.persona { display: flex; gap: 16px; align-items: flex-start; margin: 12px 0 20px; }
.persona-ico { display: grid; place-items: center; flex: none; width: 48px; height: 48px; border-radius: 12px; background: var(--surface-2); color: var(--text); }
.persona-type { font-size: 24px; line-height: 32px; font-weight: 600; margin: 0 0 4px; }
.persona-desc { margin: 0; color: var(--text-2); font-size: 14px; line-height: 22px; }

/* 게이지 = 눈금자 */
.gauge { margin: 0 0 20px; }
.gauge-track { position: relative; container-type: inline-size; height: 8px; border-radius: 4px; background: var(--surface-2); overflow: visible; }
.gauge-track::before { content: ""; position: absolute; inset: 0; border-radius: 4px; background: repeating-linear-gradient(90deg, transparent 0, transparent calc(10% - 1px), var(--border-strong) calc(10% - 1px), var(--border-strong) 10%); }
.gauge-mark { position: absolute; top: 50%; left: 0; width: 4px; height: 20px; border-radius: 2px; background: var(--accent); transform: translate(calc(var(--p, 0) * 1cqw - 50%), -50%); transition: transform .5s var(--ease); }
.gauge-range { position: absolute; top: -4px; bottom: -4px; border-radius: 6px; background: var(--accent); opacity: .18; }
.range-note { display: inline-block; margin-top: 4px; font-size: 12px; color: var(--muted); line-height: 1.5; }
.range-note .linkbtn { margin: 0; font-size: 12px; }
.inner-rows { display: grid; gap: 8px; margin-top: 12px; }
.inner-row { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(0, 1.4fr) minmax(0, 1.6fr); gap: 12px; align-items: center; padding: 12px 16px; border: 1px solid var(--border); border-radius: 10px; }
.inner-flag { display: inline-flex; align-items: center; font-size: 12px; font-weight: 500; color: var(--text-2); }
/* 수준 색은 큰 글자가 아니라 8px 점으로만 */
.lv-dot { display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 50%; background: currentColor; margin-right: 8px; }
.inner-name { display: flex; align-items: center; gap: 8px; }
.inner-stat { display: flex; flex-direction: column; gap: 2px; font-size: 14px; min-width: 0; }
.inner-stat .k { font-size: 12px; color: var(--muted); }
.inner-stat .ch-name { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 640px) { .inner-row { grid-template-columns: 1fr 1fr; } .inner-name { grid-column: 1 / -1; } }
.gauge-labels { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 8px; }
.cat-group { margin-bottom: 16px; }
.cat-group .k { display: block; font-size: 13px; color: var(--muted); font-weight: 500; margin-bottom: 8px; }
.cat-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-chip { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px; border-radius: 8px; background: var(--surface-2); color: var(--text); font-size: 14px; line-height: 24px; font-weight: 500; }
.cat-chip b { color: var(--accent); font-weight: 500; font-variant-numeric: tabular-nums; }
.cat-chips.muted .cat-chip { color: var(--text-2); font-weight: 400; }

/* 결과 공유 / 친구 비교 */
.card-head .k, #friendPanel .k { font-size: 13px; color: var(--muted); font-weight: 500; }
/* 궁합 링크 만들기 */
.invite-make { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.nick { flex: 1 1 160px; min-width: 0; min-height: 40px; font: inherit; font-size: 14px; padding: 0 12px; border-radius: var(--radius-control); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); }
.nick:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.invite-make .btn { flex: 1 1 160px; }
/* 궁합 링크 공유 창: PC는 가운데, 휴대폰은 아래에서 올라오는 시트 */
.sheet { width: min(480px, calc(100% - 32px)); padding: 20px 24px 24px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); box-shadow: 0 16px 48px rgba(0, 0, 0, .16); }
.sheet[open] { animation: sheetIn .2s var(--ease); }
.sheet::backdrop { background: rgba(0, 0, 0, .4); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet-head h2 { margin: 0; font-size: 18px; line-height: 28px; font-weight: 600; }
.sheet .sub { margin: 4px 0 16px; font-size: 14px; color: var(--muted); }
.sheet-close { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--text-2); cursor: pointer; transition: background-color .15s var(--ease), color .15s var(--ease); }
.sheet-close:hover { background: var(--surface-2); color: var(--text); }
.sheet-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sheet-sns { margin-bottom: 12px; }
.sns-btn { white-space: nowrap; }
.sheet-sns .sns-btn { padding: 16px 4px; }
.sheet-sns .sns-btn[data-to="copy"] { color: var(--text); }
.sheet-sns .sns-btn[data-to="copy"] .ico { filter: none; opacity: 1; color: var(--accent); }
input.code.sheet-link { width: 100%; font-size: 13px; color: var(--text-2); }
.sheet .status { margin: 8px 0 0; min-height: 0; }
.sheet .status:empty { display: none; }
.sheet .hint { margin: 8px 0 0; }
@keyframes sheetIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (max-width: 640px) {
  .sheet-sns { grid-auto-flow: row; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .sheet-sns .sns-btn[data-to="copy"] { grid-column: 1 / -1; flex-direction: row; padding: 12px; font-size: 14px; }
  .sheet-sns:has(#linkNative[hidden]) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sheet { width: 100%; max-width: 100%; margin: auto 0 0; padding: 20px 16px calc(24px + env(safe-area-inset-bottom)); border-radius: 16px 16px 0 0; }
}
input.code { flex: 1 1 220px; min-width: 0; min-height: 40px; font: inherit; font-size: 14px; padding: 0 12px; border-radius: var(--radius-control); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); }
/* 받은 링크 붙여넣기: 접지 않고 항상 보여요 */
.friend-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; margin-top: 20px; }
.friend-send .k { display: block; font-size: 13px; font-weight: 500; color: var(--muted); }
.friend-send .invite-make { margin-top: 8px; }
.paste-box { padding-left: 24px; border-left: 1px solid var(--border); }
.paste-box .k { display: block; font-size: 13px; font-weight: 500; color: var(--muted); }
.paste-row { margin-top: 8px; flex-wrap: nowrap; }
.paste-row input.code { flex: 1 1 auto; }
.paste-row .btn { flex: none; }
#pasteBox .linkbtn { font-size: 13px; }

/* 궁합 결과: 겹침 숫자가 주인공 */
.match { margin-top: 16px; padding: 20px; border-radius: 12px; background: var(--surface-2); }
.match-head { display: flex; align-items: center; gap: 20px; }
.match-num { flex: none; white-space: nowrap; font-size: 64px; line-height: 64px; font-weight: 600; letter-spacing: -0.03em; color: var(--accent); font-variant-numeric: tabular-nums; }
.match-num small { font-size: 24px; font-weight: 500; color: var(--muted); letter-spacing: 0; margin-left: 2px; }
.match-label { margin: 0; font-size: 20px; line-height: 28px; font-weight: 600; }
.match-line { margin: 4px 0 0; font-size: 14px; color: var(--text-2); }
.match-people { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 20px; }
.person { display: flex; flex-direction: column; gap: 4px; padding: 12px 16px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); min-width: 0; }
.person .k { font-size: 12px; color: var(--muted); }
.person-type { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person-score { font-size: 28px; line-height: 36px; font-weight: 600; font-variant-numeric: tabular-nums; }
.person.mine .person-score { color: var(--accent); }
.person-score small { font-size: 13px; font-weight: 400; color: var(--muted); margin-left: 2px; }
.match .hint { margin: 12px 0; }
@media (min-width: 861px) {
  .match { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 24px; align-items: center; }
  .match-people { margin-top: 0; }
  .match .hint, .match .row { grid-column: 1 / -1; }
}

/* 궁합 링크로 들어온 사람에게 보이는 초대 */
.invite { max-width: 560px; margin: 0 auto 40px; padding: 20px 24px; text-align: left; background: var(--surface); border: 1px solid var(--accent); border-radius: var(--radius); }
.invite-k { margin: 0 0 12px; font-size: 13px; font-weight: 500; color: var(--accent); }
.invite-body { display: flex; align-items: center; gap: 20px; }
.invite-score { flex: none; white-space: nowrap; font-size: 56px; line-height: 56px; font-weight: 600; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.invite-score small { font-size: 18px; font-weight: 400; color: var(--muted); letter-spacing: 0; margin-left: 2px; }
.invite-type { margin: 0; font-size: 20px; line-height: 28px; font-weight: 600; }
.invite-cats { margin: 4px 0 0; font-size: 14px; color: var(--text-2); }
#friendStatus { margin: 8px 0 0; min-height: 0; }
#friendStatus:empty { display: none; }

.notes ul { margin: 8px 0 0; padding-left: 20px; color: var(--text-2); font-size: 14px; }
.notes li { margin: 8px 0; }
.foot { color: var(--muted); font-size: 13px; padding: 16px 16px calc(var(--dock) + 24px); text-align: center; }
.foot p { margin: 0; }
.policy { max-width: 720px; margin: 0 auto 16px; padding: 16px 20px; text-align: left; border: 1px solid var(--border); border-radius: var(--radius-control); }
.policy .policy-title { font-weight: 600; color: var(--text-2); margin-bottom: 8px; }
.policy ul { margin: 0; padding-left: 20px; }
.policy li { margin: 4px 0; }
.policy-link { display: inline-block; margin-top: 8px; font-weight: 500; }
.linkbtn { background: none; border: 0; padding: 0; margin-top: 8px; color: var(--accent); font: inherit; font-weight: 500; text-decoration: underline; cursor: pointer; }
.status .linkbtn { margin-top: 0; }

/* 진단 방법 선택 */
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; text-align: left; }
.mode-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; display: flex; flex-direction: column; gap: 12px; }
/* 두 카드의 칸(배지·제목·설명·버튼·아래 안내)을 같은 줄에 맞춰서 버튼 높이가 어긋나지 않게 */
@supports (grid-template-rows: subgrid) {
  .mode-card { display: grid; grid-row: span 5; grid-template-rows: subgrid; row-gap: 12px; }
}
.mode-foot { display: flex; flex-direction: column; gap: 12px; }
.mode-card.full.drop { border: 1px dashed var(--border-strong); }
.mode-card.full.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.mode-card h2 { font-size: 20px; line-height: 28px; font-weight: 600; margin: 0; }
.mode-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.badge { font-size: 12px; font-weight: 500; line-height: 24px; color: var(--text-2); background: var(--surface-2); padding: 0 8px; border-radius: 6px; }
.time { font-size: 13px; color: var(--muted); }
.mode-desc { margin: 0; color: var(--text-2); font-size: 14px; line-height: 22px; flex: 1; }
.mode-desc b { font-weight: 600; color: var(--text); }
.mode-note { margin: 0; font-size: 12px; color: var(--muted); }
/* 구글 검토 전 경고 화면 안내: 조용한 표면 위 한 단락 */
.login-tip { margin: 0; padding: 8px 12px; border-radius: 8px; background: var(--surface-2); font-size: 12px; line-height: 18px; color: var(--text-2); }
.login-tip b { font-weight: 600; color: var(--text); }
.mode-card .status { margin: 0; min-height: 0; }
.mode-card .status:empty { display: none; }
.btn.wide { width: 100%; min-height: 44px; padding: 0 16px; }
.sample-btn { margin: 16px auto 0; display: flex; }

.compare-box { text-align: left; margin: 32px auto 0; max-width: 860px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 24px; }
.compare-box h3 { margin: 0 0 12px; font-size: 16px; font-weight: 600; }
.cmp { width: 100%; border-collapse: collapse; font-size: 14px; }
.cmp th, .cmp td { padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: top; text-align: left; }
.cmp thead th { font-size: 14px; font-weight: 600; color: var(--text); background: var(--surface-2); }
.cmp tbody th { color: var(--muted); font-weight: 500; white-space: nowrap; width: 120px; }
.cmp td { color: var(--text-2); }
.cmp td b { font-weight: 600; color: var(--text); }
.cmp tbody tr:last-child th, .cmp tbody tr:last-child td { border-bottom: 0; }

.mode-banner { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; border-radius: var(--radius); padding: 12px 20px; margin-bottom: 16px; font-size: 14px; background: var(--surface); border: 1px solid var(--border); }
.mode-banner b { font-weight: 600; }
.mode-banner .btn { margin: 0; }

@media (max-width: 760px) {
  .modes { grid-template-columns: 1fr; }
  .hero { padding-top: 32px; }
  .hero-top { display: flex; flex-direction: column; gap: 24px; margin-bottom: 32px; }
  .hero-visual { order: -1; width: 100%; }
  .hero-visual:empty, .hero-card { display: none; }
  .cmp tbody th { width: auto; white-space: nowrap; padding-right: 8px; }
}

@media (max-width: 860px) {
  .grid { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .tiles:not(.three) > .tile:first-child, .tiles:not(.three) > .tile:last-child { grid-column: 1 / -1; }
  .insights { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .tiles.three { grid-template-columns: 1fr; }
  .enrich { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .cmp thead { display: none; }
  .cmp, .cmp tbody, .cmp tr, .cmp th, .cmp td { display: block; width: auto; }
  .cmp tr { padding: 12px 0; border-bottom: 1px solid var(--border); }
  .cmp tbody tr:last-child { border-bottom: 0; }
  .cmp th, .cmp td, .cmp tbody tr:last-child th, .cmp tbody tr:last-child td { padding: 0; border: 0; }
  .cmp tbody th { margin-bottom: 4px; color: var(--text); white-space: normal; }
  /* 격자로 나누면 굵은 글자(<b>)와 나머지 글자가 다른 칸으로 갈라져서, 라벨만 왼쪽에 고정하고 내용은 한 덩어리로 흐르게 */
  .cmp td { position: relative; padding: 2px 0 2px 72px; }
  .cmp td::before { position: absolute; left: 0; top: 2px; color: var(--muted); font-size: 13px; }
  .cmp td:nth-of-type(1)::before { content: "빠른"; }
  .cmp td:nth-of-type(2)::before { content: "정밀"; }
  .cmp td.both { padding-left: 0; }
  .cmp td.both::before { content: none; }
  .friend-grid { grid-template-columns: 1fr; gap: 20px; }
  .paste-box { padding: 20px 0 0; border-left: 0; border-top: 1px solid var(--border); }
  .toolbar { flex-wrap: nowrap; }
  .toolbar .chips { flex-wrap: nowrap; }
}
@media (max-width: 520px) {
  .panel { padding: 20px 16px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tiles:not(.three) > .tile:first-child, .tiles:not(.three) > .tile:last-child { grid-column: auto; }
  .tiles:not(.three) .tile { padding: 12px 16px; min-height: 0; }
  .tiles:not(.three) .tile .v { font-size: 28px; line-height: 36px; }
  .tiles:not(.three) > .tile:first-child .v { font-size: 36px; line-height: 44px; }
  .tiles:not(.three) .tile .v small { font-size: 13px; }
  .sns-btn { padding: 12px 4px; font-size: 12px; }
  .channels th, .channels td { padding-left: 8px; padding-right: 8px; }
  .channels th:last-child { width: auto; min-width: 0; }
  .channels .num { padding-right: 8px; }
  .channels .pct-sub { display: none; }
  .channels select { min-width: 0; max-width: 120px; }
  .channels .ch { min-width: 0; }
  .bar { grid-template-columns: 100px 1fr 48px; }
  .pair { grid-template-columns: 100px 1fr 80px; }
  .match-num { font-size: 52px; line-height: 56px; }
  .invite-score { font-size: 44px; line-height: 48px; }
  .channels .rank { display: none; }
}
:root[data-theme="dark"] .sns-btn[data-logo="x"] .ico img { background: radial-gradient(circle closest-side, #fff 0 80%, transparent 82%); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .sns-btn[data-logo="x"] .ico img { background: radial-gradient(circle closest-side, #fff 0 80%, transparent 82%); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
