/* 남산 스킬 웹 — 색은 여기 토큰만. 라이트·다크 둘 다 선택된 값(다크는 자동 반전이 아님). */
:root {
  color-scheme: light;
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-2: #f0f0ec;
  --border: #e2e1dc;
  --text: #16161a;
  --text-2: #52514e;
  --muted: #6b6a66;
  --accent: #3b5bdb;
  --accent-ink: #ffffff;
  --chip: #e8ecfb;
  --chip-ink: #2f47b0;
  --series-1: #2a78d6;
  --grid: #e7e6e1;
  --radius: 14px;
  --gutter: 16px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121214;
    --surface: #1b1b1e;
    --surface-2: #232327;
    --border: #2e2e33;
    --text: #f0efec;
    --text-2: #c3c2b7;
    --muted: #9d9c95;
    --accent: #7c95f0;
    --accent-ink: #0d1430;
    --chip: #262e4d;
    --chip-ink: #b8c6ff;
    --series-1: #3987e5;
    --grid: #2b2b30;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121214; --surface: #1b1b1e; --surface-2: #232327; --border: #2e2e33; --text: #f0efec; --text-2: #c3c2b7;
  --muted: #9d9c95; --accent: #7c95f0; --accent-ink: #0d1430; --chip: #262e4d; --chip-ink: #b8c6ff; --series-1: #3987e5; --grid: #2b2b30;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.55 system-ui, -apple-system, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
a { color: var(--accent); }
h1 { font-size: 24px; line-height: 1.3; margin: 0 0 8px; }
h2 { font-size: 17px; margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.top { display: flex; align-items: center; gap: 12px; padding: 14px var(--gutter); max-width: 1080px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; font-size: 18px; }
.brand img { border-radius: 8px; }
.tag { color: var(--muted); font-size: 13px; }
main { max-width: 1080px; margin: 0 auto; padding: 0 var(--gutter) 32px; }
.foot { max-width: 1080px; margin: 0 auto; padding: 24px var(--gutter) 40px; color: var(--muted); font-size: 13px; }

.hero { padding: 16px 0 8px; }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 16px 0; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.tile-label { color: var(--text-2); font-size: 13px; }
.tile-value { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; }
.tile-sub { color: var(--muted); font-size: 12px; }

.controls { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 8px 0 16px; }
.search { flex: 1 1 220px; min-height: 44px; padding: 0 14px; border-radius: 22px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 22px; padding: 3px; }
.seg button { min-height: 38px; padding: 0 16px; border: 0; border-radius: 19px; background: transparent; color: var(--text-2); font: inherit; cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.12); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.card { display: flex; flex-direction: column; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; color: var(--text); text-decoration: none; min-width: 0; }
.card:hover, .card:focus-visible { border-color: var(--accent); }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.card-title { font-weight: 700; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ver { color: var(--muted); font-size: 13px; font-weight: 500; }
.card-desc { margin: 0; color: var(--text-2); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 0; }
.card-stats dt { color: var(--muted); font-size: 12px; }
.card-stats dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-foot { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { background: var(--chip); color: var(--chip-ink); border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 600; }

.state { padding: 32px 8px; text-align: center; color: var(--text-2); }
.btn { min-height: 44px; padding: 0 20px; border-radius: 22px; border: 0; background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 600; cursor: pointer; }
.more { display: block; margin: 20px auto 0; }

.back { display: inline-block; margin: 8px 0 12px; text-decoration: none; min-height: 44px; line-height: 44px; }
.detail-head .meta { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin: 14px 0; min-width: 0; }
.versions { margin: 0; padding-left: 18px; }
.md h3, .md h4 { margin: 16px 0 6px; font-size: 15px; }
.md p, .md li { color: var(--text-2); overflow-wrap: anywhere; }
.recipe { margin-top: 10px; }
.recipe summary { cursor: pointer; color: var(--text-2); min-height: 32px; }
.recipe pre { background: var(--surface-2); border-radius: 10px; padding: 12px; overflow-x: auto; font-size: 12px; line-height: 1.45; }
.how ol { margin: 8px 0 0; padding-left: 20px; color: var(--text-2); }
.btn.install { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; min-width: 200px; margin: 4px 0 8px; }
.how details summary { cursor: pointer; min-height: 32px; }
.notice { background: var(--chip); color: var(--chip-ink); border-radius: 10px; padding: 10px 12px; }

.chart-wrap { position: relative; }
.chart { display: block; max-width: 100%; }
.chart-box { min-width: 0; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; }
.chart .bar path { fill: var(--series-1); }
.chart .hit { fill: transparent; }
.chart .bar:hover path, .chart .bar:focus path { opacity: .8; }
.chart .bar:focus { outline: none; }
.tip { position: absolute; top: -6px; transform: translate(-50%, -100%); background: var(--text); color: var(--bg); padding: 4px 10px; border-radius: 8px; font-size: 12px; white-space: nowrap; pointer-events: none; }
.table-view { margin-top: 8px; font-size: 13px; }
.table-view table { border-collapse: collapse; margin-top: 6px; }
.table-view th, .table-view td { padding: 4px 12px 4px 0; text-align: left; font-variant-numeric: tabular-nums; }

@media (max-width: 640px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile-value { font-size: 22px; }
  .grid { grid-template-columns: 1fr; }
  h1 { font-size: 21px; }
  .seg { width: 100%; }
  .seg button { flex: 1; }
}
