:root {
  --bg: #f4f5f7;
  --surface: #fff;
  --ink: #15171c;
  --ink-2: #353b46;
  --muted: #5a616d;
  --line: #dde0e6;
  --tray: #e9ebef;
  --brass: #8a6a21;
  --focus: #2457c5;
  --live: #2e8b57;
  --improving: #b7791f;
  --lab: #5b6b8c;
  --r: 10px;
  --wrap: 1080px;
  --gutter: 20px;
  --header-h: 60px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0f1115;
  --surface: #171a20;
  --ink: #eceef2;
  --ink-2: #c9ced7;
  --muted: #a3aab6;
  --line: #2b3038;
  --tray: #1f232b;
  --brass: #d1a64a;
  --focus: #8db3ff;
  --live: #4cc38a;
  --improving: #e0a64a;
  --lab: #9fb0d4;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1115;
    --surface: #171a20;
    --ink: #eceef2;
    --ink-2: #c9ced7;
    --muted: #a3aab6;
    --line: #2b3038;
    --tray: #1f232b;
    --brass: #d1a64a;
    --focus: #8db3ff;
    --live: #4cc38a;
    --improving: #e0a64a;
    --lab: #9fb0d4;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  font-size: 16px;
  line-height: 1.7;
  word-break: keep-all;
  overflow-wrap: break-word;
  -webkit-tap-highlight-color: transparent;
}
img, svg { max-width: 100%; }
a { color: inherit; text-decoration-color: var(--line); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { line-height: 1.3; margin: 0; letter-spacing: -0.01em; }
p { margin: 0 0 1em; }
code { font-size: .9em; background: var(--tray); padding: 1px 6px; border-radius: 4px; }
/* 고정된 머리글에 제목이 가려지지 않게 */
[id] { scroll-margin-top: calc(var(--header-h) + 12px); }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 6px; z-index: 100; }
.skip:focus { top: 12px; }
[hidden] { display: none !important; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.bar { display: flex; align-items: center; gap: 16px; min-height: var(--header-h); }
.logo { flex: none; display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.1rem; text-decoration: none; color: var(--ink); white-space: nowrap; }
.logo-ring { color: var(--brass); flex: none; }
.nav { min-width: 0; display: flex; gap: 2px; margin-left: auto; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.nav::-webkit-scrollbar { display: none; }
.nav a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 12px; border-radius: 8px; text-decoration: none; color: var(--muted); white-space: nowrap; font-size: .95rem; font-weight: 500; }
.nav a:hover { color: var(--ink); background: var(--tray); }
.nav a[aria-current] { color: var(--ink); background: var(--tray); font-weight: 600; }
.theme-btn { flex: none; width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 50%; cursor: pointer; }
.theme-btn svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme-btn .i-sun { display: none; }
:root[data-theme="dark"] .theme-btn .i-moon { display: none; }
:root[data-theme="dark"] .theme-btn .i-sun { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-btn .i-moon { display: none; }
  :root:not([data-theme="light"]) .theme-btn .i-sun { display: block; }
}

/* ---------- hero ---------- */
.hero { padding: 88px 0 48px; }
.hero h1 { font-size: clamp(1.85rem, 5.4vw, 3rem); font-weight: 750; letter-spacing: -0.025em; line-height: 1.25; }
.hero-sub { color: var(--ink-2); max-width: 32em; margin: 18px 0 36px; font-size: 1.1rem; line-height: 1.7; }
.dock { list-style: none; margin: 0; padding: 18px 22px; display: flex; flex-wrap: wrap; gap: 10px 20px; background: var(--tray); border-radius: 22px; width: fit-content; max-width: 100%; }
.dock li { animation: settle .5s cubic-bezier(.2,.8,.3,1) both; animation-delay: calc(var(--i) * 70ms + 100ms); }
@keyframes settle { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: none; } }
.chip { display: flex; flex-direction: column; align-items: center; gap: 7px; min-width: 64px; padding: 2px; text-decoration: none; color: var(--ink); font-size: .82rem; font-weight: 500; text-align: center; line-height: 1.3; border-radius: 12px; }
.chip-ball { width: 56px; height: 56px; border-radius: 50%; background: var(--c); color: #fff; display: grid; place-items: center; transition: transform .15s; box-shadow: inset 0 0 0 1px rgba(255,255,255,.14); }
.chip:hover .chip-ball { transform: translateY(-3px); }
.chip-name { white-space: nowrap; }
:root[data-theme="dark"] .chip-ball { box-shadow: inset 0 0 0 1px rgba(255,255,255,.28); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chip-ball { box-shadow: inset 0 0 0 1px rgba(255,255,255,.28); } }

/* marks */
.mark { font-weight: 700; font-size: 1.25rem; line-height: 1; display: inline-grid; place-items: center; }
.mark-half { width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(90deg, #fff 50%, #8b8f96 50%); }
.mark-play { width: 0; height: 0; border-style: solid; border-width: 10px 0 10px 17px; border-color: transparent transparent transparent #e5322d; margin-left: 4px; }

/* ---------- quick row ---------- */
section.wrap.quick { padding-top: 4px; padding-bottom: 4px; }
section.quick + section.wrap { padding-top: 40px; }
.quick-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; margin-bottom: 12px; }
.quick-row h2 { font-size: .9rem; color: var(--muted); font-weight: 600; min-width: 7em; }
.pills { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.pills a { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 16px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; text-decoration: none; font-size: .92rem; font-weight: 500; }
.pills a:hover { border-color: var(--muted); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; box-shadow: 0 0 0 1px rgba(128,128,128,.45); }
.link-btn { background: none; border: 0; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font: inherit; font-size: .88rem; min-height: 40px; padding: 0 6px; }

/* ---------- sections ---------- */
section.wrap { padding-top: 56px; padding-bottom: 8px; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
h2 { font-size: 1.45rem; font-weight: 700; }
.sec-desc { color: var(--muted); margin: 8px 0 0; }
.count { color: var(--muted); margin: 0; font-size: .92rem; }

.toolbar { display: flex; flex-direction: column; gap: 12px; margin-bottom: 28px; }
.search { position: relative; display: block; }
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; pointer-events: none; }
.search input { width: 100%; height: 48px; padding: 0 44px 0 42px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: var(--r); font: inherit; font-size: 1rem; }
.search input::placeholder { color: var(--muted); }
.search input:hover { border-color: var(--muted); }
.kbd { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font: 600 .8rem/1 inherit; font-family: inherit; padding: 4px 8px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; color: var(--muted); background: var(--bg); pointer-events: none; }
.search input:focus ~ .kbd, .search input:not(:placeholder-shown) ~ .kbd { display: none; }
@media (hover: none) { .kbd { display: none; } .search input { padding-right: 14px; } }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filter { font: inherit; font-size: .92rem; font-weight: 500; min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.filter:hover { border-color: var(--muted); }
.filter span { color: var(--muted); margin-left: 4px; font-weight: 400; }
.filter[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.filter[aria-pressed="true"] span { color: inherit; opacity: .7; }

/* ---------- cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 36px 24px; }
.card { position: relative; display: flex; flex-direction: column; }
.card-frame { display: block; line-height: 0; border: 1px solid var(--line); border-top: 4px solid var(--c); border-radius: var(--r); background: var(--surface); overflow: hidden; }
.card-frame img { width: 100%; height: auto; aspect-ratio: 8 / 5; display: block; }
.fav { position: absolute; top: 12px; right: 10px; z-index: 1; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer; }
.fav:hover { color: var(--ink); border-color: var(--muted); }
.fav svg, .fav-btn svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.fav[aria-pressed="true"] { color: var(--brass); }
.fav-btn[aria-pressed="true"] svg { color: var(--brass); }
.fav[aria-pressed="true"] svg, .fav-btn[aria-pressed="true"] svg { fill: currentColor; }
.card-body { flex: 1; display: flex; flex-direction: column; padding: 16px 2px 0; }
.card-body h3 { font-size: 1.2rem; font-weight: 700; }
.card-body h3 a { text-decoration: none; }
.card-body h3 a:hover { text-decoration: underline; }
.tagline { color: var(--ink-2); margin: 6px 0 12px; line-height: 1.6; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: .88rem; color: var(--muted); margin: 0 0 16px; }
.status { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); font-weight: 600; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.s-live::before { background: var(--live); }
.s-improving::before { background: var(--improving); }
.s-lab::before { background: var(--lab); }
.cat { padding: 1px 9px; border-radius: 6px; background: var(--tray); color: var(--ink-2); font-weight: 500; }
.tags { color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; font: inherit; font-size: .95rem; font-weight: 500; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); font-weight: 600; }
.btn.primary:hover { opacity: .88; }
.btn svg { flex: none; }
.share-btn svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.empty { text-align: center; padding: 40px 20px; border: 1px dashed var(--line); border-radius: 14px; color: var(--muted); }
.empty p { margin: 0 0 16px; }

/* ---------- updates timeline ---------- */
.timeline { list-style: none; margin: 24px 0 0; padding: 0; }
.t-day { display: grid; grid-template-columns: 10em 1fr; gap: 10px 28px; padding: 20px 0; border-top: 1px solid var(--line); }
.t-day:first-child { border-top: 0; padding-top: 4px; }
.t-date { font-size: .95rem; font-weight: 600; color: var(--muted); padding-top: 1px; }
.t-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }
.t-items li { padding-left: 14px; border-left: 3px solid var(--c, var(--brass)); }
.u-tag { display: inline-block; font-weight: 700; font-size: .95rem; text-decoration: none; margin-bottom: 2px; }
.u-tag:hover { text-decoration: underline; }
.u-text { margin: 0; color: var(--ink-2); max-width: 46em; }

/* ---------- about on home ---------- */
.about-sec .cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 28px; margin-top: 20px; }
.about-sec h3 { font-size: 1.08rem; margin-bottom: 6px; }
.about-sec p { color: var(--ink-2); }
.more { margin-top: 8px; }
.more a { font-weight: 600; }

/* ---------- FAQ ---------- */
.faq h2 { margin-bottom: 12px; }
.faq details { border-top: 1px solid var(--line); }
.faq details:last-of-type { border-bottom: 1px solid var(--line); }
.faq summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 56px; padding: 12px 0; cursor: pointer; font-weight: 600; font-size: 1.02rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: ""; flex: none; width: 9px; height: 9px; margin-right: 6px; border: solid var(--muted); border-width: 0 2px 2px 0; transform: rotate(45deg) translateY(-3px); transition: transform .15s; }
.faq details[open] summary::after { transform: rotate(-135deg) translateY(-3px); }
.faq details p { margin: 0 0 18px; color: var(--ink-2); max-width: 46em; }

/* ---------- prose pages ---------- */
.prose { padding-top: 52px; padding-bottom: 32px; max-width: 760px; }
.prose h1 { font-size: clamp(1.75rem, 5vw, 2.1rem); margin-bottom: 14px; }
.prose h2 { font-size: 1.25rem; margin: 40px 0 12px; }
.prose p, .prose li { line-height: 1.8; color: var(--ink-2); }
.lead { font-size: 1.1rem; color: var(--ink-2); line-height: 1.7; }
.plain { padding-left: 1.2em; margin: 0 0 1em; }
.plain li { margin-bottom: 8px; }
.plain li::marker { color: var(--muted); }
.muted { color: var(--muted); }
.prose .actions { margin: 24px 0; }
.notfound { padding-top: 88px; padding-bottom: 88px; }

/* ---------- detail ---------- */
.detail { padding-top: 24px; padding-bottom: 24px; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; color: var(--muted); font-size: .9rem; margin-bottom: 18px; }
.crumbs a { color: var(--muted); }
.crumbs [aria-current] { color: var(--ink); }
.detail-hero { display: grid; grid-template-columns: 1fr; gap: 28px; }
.detail-hero h1 { font-size: clamp(1.9rem, 5vw, 2.5rem); }
.ko { color: var(--muted); margin: 2px 0 0; }
.detail .lead { margin: 10px 0 14px; }
.detail-intro .meta { margin-bottom: 20px; }
.detail-intro .actions { margin-top: 0; }
.share-status { min-height: 1.6em; margin: 10px 0 0; font-size: .92rem; color: var(--muted); }
.detail-preview { display: block; border: 1px solid var(--line); border-top: 4px solid var(--c); border-radius: var(--r); overflow: hidden; background: var(--surface); line-height: 0; align-self: start; }
.detail-preview img { width: 100%; height: auto; }
.d-body { max-width: 720px; }
.d-sec { margin-top: 44px; }
.d-sec h2 { font-size: 1.25rem; margin-bottom: 12px; }
.d-sec p { color: var(--ink-2); }
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.checks li { position: relative; padding-left: 28px; color: var(--ink-2); line-height: 1.65; }
.checks li::before { content: ""; position: absolute; left: 5px; top: .3em; width: 6px; height: 11px; border: solid var(--brass); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }
.note { background: var(--tray); border-radius: 14px; padding: 20px 22px 8px; }
.note h2 { font-size: 1.1rem; }
.note li { color: var(--ink-2); }
.stack { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.stack li { padding: 5px 13px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: .9rem; }
.others { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.others a { display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 16px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; text-decoration: none; font-weight: 500; }
.others a:hover { border-color: var(--muted); }

/* ---------- footer ---------- */
.site-footer { margin-top: 80px; border-top: 1px solid var(--line); padding: 44px 0 calc(28px + env(safe-area-inset-bottom)); }
.foot { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 28px; }
.foot-name { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.05rem; margin: 0 0 6px; }
.foot-desc { color: var(--muted); font-size: .92rem; }
.foot-h { font-size: .88rem; font-weight: 600; color: var(--muted); margin: 0 0 6px; }
.foot-col ul { list-style: none; margin: 0; padding: 0; }
.foot-col a { display: inline-flex; align-items: center; gap: 8px; min-height: 38px; color: var(--ink-2); text-decoration: none; font-size: .95rem; }
.foot-col a:hover { color: var(--ink); text-decoration: underline; }
.foot-bottom p { margin: 28px 0 0; color: var(--muted); font-size: .85rem; }

/* ---------- wide screens ---------- */
@media (min-width: 760px) {
  .toolbar { flex-direction: row; align-items: center; justify-content: space-between; }
  .search { flex: 0 0 320px; }
  .detail-hero { grid-template-columns: 1.1fr 1fr; align-items: start; gap: 40px; }
}

/* ---------- phones ---------- */
@media (max-width: 640px) {
  :root { --gutter: 16px; --header-h: 56px; }
  .bar { gap: 6px; }
  .logo { gap: 6px; font-size: 1.02rem; }
  .logo-ring { width: 24px; height: 24px; }
  .nav a { padding: 0 9px; font-size: .9rem; }
  .theme-btn { width: 40px; height: 40px; }

  .hero { padding: 40px 0 32px; }
  .hero-sub { font-size: 1rem; margin: 14px 0 24px; }
  /* 휴대폰 홈 화면처럼 한 줄에 4개씩, 남는 칸은 왼쪽부터 채운다 */
  .dock { width: 100%; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 16px 8px; gap: 16px 4px; border-radius: 18px; }
  .chip { min-width: 0; font-size: .76rem; }
  .chip-ball { width: 50px; height: 50px; }

  section.wrap { padding-top: 44px; }
  h2 { font-size: 1.3rem; }

  /* 휴대폰 카드: 작은 미리보기 옆에 이름과 상태, 아래에 설명과 버튼 */
  .grid { grid-template-columns: 1fr; gap: 12px; }
  .card { display: grid; grid-template-columns: 96px minmax(0, 1fr); column-gap: 14px; align-items: start; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
  .card-frame { grid-column: 1; grid-row: 1 / span 2; border-top-width: 3px; border-radius: 8px; }
  .card-body { display: contents; }
  .card-body h3 { grid-column: 2; grid-row: 1; align-self: end; padding-right: 44px; font-size: 1.1rem; line-height: 1.3; }
  .card .meta { grid-column: 2; grid-row: 2; align-self: start; margin: 6px 0 0; padding-right: 4px; }
  .tagline { grid-column: 1 / -1; grid-row: 3; margin: 12px 0 14px; }
  .card .actions { grid-column: 1 / -1; grid-row: 4; }
  .fav { top: 10px; right: 10px; }
  .actions .btn { flex: 1 1 0; padding: 0 12px; }

  .t-day { grid-template-columns: 1fr; gap: 12px; }

  .detail-intro .actions .btn { flex: 1 1 auto; }
  .detail-intro .actions .btn.wide { flex-basis: 100%; }
  .note { padding: 18px 18px 6px; }

  .foot { grid-template-columns: 1fr 1fr; gap: 24px 16px; }
  .foot-brand { grid-column: 1 / -1; }
}
@media (max-width: 359px) {
  .logo span { font-size: .95rem; }
  .nav a { padding: 0 6px; font-size: .86rem; }
  .dock { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .dock li { animation: none; }
  .chip-ball, .faq summary::after { transition: none; }
}
@media print {
  .site-header, .site-footer, .fav, .theme-btn, .share-btn { display: none; }
}
