:root {
  --ink: #17231f;
  --muted: #65716d;
  --brand: #173b34;
  --brand-2: #24594e;
  --accent: #e6a84c;
  --paper: #f5f4ef;
  --surface: #fffdf8;
  --line: #dedfd9;
  --soft: #e9eee9;
  --danger-soft: #fff5df;
  --safe-bottom: max(14px, env(safe-area-inset-bottom));
  font-family: Pretendard, "Noto Sans KR", "Apple SD Gothic Neo", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }
.skip-link { position: fixed; top: -80px; left: 10px; z-index: 100; padding: 12px 16px; background: #fff; }
.skip-link:focus { top: 10px; }

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  border-bottom: 1px solid rgba(222, 223, 217, .88);
  background: rgba(245, 244, 239, .94);
  backdrop-filter: blur(14px);
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; background: var(--brand); color: white; font-weight: 900; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 1rem; letter-spacing: -.02em; }
.brand small { margin-top: 1px; color: var(--muted); font-size: .67rem; }
.install-button { min-height: 44px; border: 0; border-radius: 12px; padding: 0 14px; background: var(--brand); color: white; font-size: .84rem; font-weight: 800; }

main { width: min(100%, 800px); min-height: calc(100vh - 66px); margin: 0 auto; padding: 0 18px calc(96px + var(--safe-bottom)); }
.view { animation: enter .22s ease; }
@keyframes enter { from { opacity: 0; transform: translateY(5px); } }
.hero { margin: 0 -18px; padding: 50px 22px 38px; background: var(--brand); color: white; border-radius: 0 0 30px 30px; }
.hero .eyebrow { color: #b8d6cd; }
.hero h1 { margin: 10px 0 16px; font-size: clamp(2rem, 9vw, 3.15rem); line-height: 1.16; letter-spacing: -.055em; }
.hero h1 em { color: #f1be6f; font-style: normal; }
.hero > p:not(.eyebrow) { max-width: 34rem; margin: 0; color: #d9e4e0; line-height: 1.7; font-size: .94rem; }
.eyebrow { margin: 0; color: var(--brand-2); font-size: .72rem; font-weight: 900; letter-spacing: .09em; text-transform: uppercase; }

.search-box { min-height: 54px; display: flex; align-items: center; gap: 10px; margin-top: 24px; border: 1px solid transparent; border-radius: 16px; padding: 0 16px; background: white; color: var(--brand); box-shadow: 0 12px 30px rgba(0, 0, 0, .12); }
.search-box:focus-within { outline: 3px solid rgba(244,184,96,.45); }
.search-box span { font-size: 1.45rem; }
.search-box input { width: 100%; min-height: 50px; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 1rem; }
.search-box.compact { margin-top: 20px; border-color: var(--line); box-shadow: none; }

.section-block { margin-top: 36px; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.section-heading h2, .steps h2 { margin: 5px 0 0; font-size: 1.35rem; letter-spacing: -.04em; }
.text-button { min-height: 44px; border: 0; padding: 0 4px; background: transparent; color: var(--brand-2); font-weight: 800; }
.card-scroller { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(265px, 82%); gap: 12px; margin-right: -18px; padding: 2px 18px 8px 0; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.card-scroller::-webkit-scrollbar { display: none; }

.certificate-card { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: 0 6px 20px rgba(23,59,52,.055); }
.compact-card { scroll-snap-align: start; }
.card-main { width: 100%; min-height: 44px; display: block; border: 0; padding: 20px; background: transparent; color: var(--ink); text-align: left; }
.category-badge { display: inline-flex; min-height: 28px; align-items: center; border-radius: 999px; padding: 0 10px; background: var(--soft); color: var(--brand-2); font-size: .72rem; font-weight: 800; }
.certificate-card h3 { margin: 15px 42px 3px 0; font-size: 1.2rem; letter-spacing: -.035em; }
.provider { margin: 0; color: var(--muted); font-size: .78rem; }
.summary { min-height: 46px; margin: 15px 0 18px; color: #49544f; font-size: .86rem; line-height: 1.55; }
.save-button { position: absolute; top: 15px; right: 14px; z-index: 2; width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; color: #87908c; font-size: 1.45rem; }
.save-button.saved { color: #cf8823; }
.card-meta { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.card-meta > span:not(.difficulty) { min-height: 28px; display: inline-flex; align-items: center; padding: 0 8px; border-radius: 8px; background: #f1f0eb; color: #59635f; font-size: .72rem; font-weight: 700; }
.difficulty { display: inline-flex; align-items: center; gap: 7px; }
.difficulty i { width: 35px; height: 7px; border-radius: 99px; background: linear-gradient(90deg, var(--accent) calc(var(--level) * 20%), #e5e5df 0); }
.difficulty small { color: var(--muted); font-size: .7rem; font-weight: 700; }
.more { min-height: 44px; display: flex; align-items: flex-end; justify-content: flex-end; margin-top: 5px; color: var(--brand-2); font-size: .8rem; font-weight: 900; }
.more b { margin-left: 5px; font-size: 1.2rem; }

.affiliate-banner { display: grid; gap: 18px; margin-top: 34px; border-radius: 22px; padding: 24px; background: #e8efe9; border: 1px solid #d1ddd5; }
.affiliate-banner h2 { margin: 6px 0 9px; font-size: 1.4rem; letter-spacing: -.04em; }
.affiliate-banner p:not(.eyebrow) { margin: 0 0 8px; color: #485650; line-height: 1.55; font-size: .86rem; }
.affiliate-banner small, .detail-affiliate small { display: block; color: var(--muted); font-size: .68rem; line-height: 1.45; }
.affiliate-banner > a { min-height: 50px; display: flex; align-items: center; justify-content: center; border-radius: 14px; background: var(--brand); color: white; text-decoration: none; font-size: .9rem; font-weight: 900; }
.affiliate-banner > a span { margin-left: 7px; }

.steps { padding: 26px 0 10px; }
.steps ol { display: grid; gap: 1px; margin: 20px 0 0; padding: 0; list-style: none; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.steps li { min-height: 84px; display: flex; align-items: center; gap: 15px; padding: 15px 17px; background: var(--surface); }
.steps li + li { border-top: 1px solid var(--line); }
.steps b { width: 34px; height: 34px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; background: var(--brand); color: white; font-size: .8rem; }
.steps strong, .steps small { display: block; }
.steps small { margin-top: 5px; color: var(--muted); font-size: .78rem; }

.page-top { padding: 34px 0 14px; }
.page-top h1 { margin: 7px 0; font-size: 1.9rem; letter-spacing: -.05em; }
.page-top > p:not(.eyebrow) { color: var(--muted); }
.filter-row { display: flex; gap: 8px; margin-right: -18px; padding: 16px 18px 5px 0; overflow-x: auto; scrollbar-width: none; }
.filter-row button { min-height: 44px; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 999px; padding: 0 15px; background: var(--surface); color: var(--muted); font-size: .8rem; font-weight: 800; }
.filter-row button.active { border-color: var(--brand); background: var(--brand); color: white; }
.result-count { margin: 10px 0 12px; color: var(--muted); font-size: .8rem; font-weight: 700; }
.certificate-list { display: grid; gap: 12px; }
.empty-state { min-height: 300px; display: grid; place-content: center; justify-items: center; padding: 30px; text-align: center; }
.empty-state strong { font-size: 1.05rem; }
.empty-state p { margin: 8px 0 20px; color: var(--muted); font-size: .85rem; }
.primary-button { min-height: 48px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 13px; padding: 0 17px; background: var(--brand); color: white; text-decoration: none; font-weight: 900; }

.bottom-nav { position: fixed; right: 0; bottom: 0; left: 0; z-index: 30; height: calc(66px + var(--safe-bottom)); display: grid; grid-template-columns: repeat(3, 1fr); padding: 6px max(14px, calc((100vw - 600px) / 2)) var(--safe-bottom); border-top: 1px solid var(--line); background: rgba(255,253,248,.97); backdrop-filter: blur(14px); }
.bottom-nav button { min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; border-radius: 12px; background: transparent; color: #76817c; font-size: .68rem; font-weight: 800; }
.bottom-nav button span { font-size: 1.25rem; line-height: 1; }
.bottom-nav button.active { color: var(--brand); background: var(--soft); }

.detail-dialog { width: min(100%, 680px); max-height: 92dvh; margin: auto auto 0; border: 0; border-radius: 26px 26px 0 0; padding: 0; background: var(--surface); color: var(--ink); box-shadow: 0 -18px 50px rgba(0,0,0,.2); }
.detail-dialog::backdrop { background: rgba(8,20,17,.58); backdrop-filter: blur(2px); }
.detail-head { position: relative; padding: 28px 24px 24px; background: var(--brand); color: white; }
.detail-head .category-badge { background: rgba(255,255,255,.14); color: #dcebe6; }
.detail-head h2 { margin: 16px 50px 5px 0; font-size: 1.65rem; letter-spacing: -.05em; }
.detail-head p { margin: 0; color: #c9d9d4; font-size: .82rem; }
.close-button { position: absolute; top: 17px; right: 17px; width: 44px; height: 44px; border: 0; border-radius: 50%; background: rgba(255,255,255,.13); color: white; font-size: 1.8rem; }
.detail-body { padding: 22px 20px calc(26px + env(safe-area-inset-bottom)); }
.detail-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.detail-facts span { min-height: 76px; display: flex; flex-direction: column; justify-content: center; border-radius: 13px; padding: 11px; background: #f0f1ec; }
.detail-facts small { color: var(--muted); font-size: .66rem; }
.detail-facts strong { margin-top: 6px; font-size: .82rem; }
.detail-body section { margin-top: 24px; }
.detail-body section h3 { margin: 0 0 7px; font-size: 1rem; }
.detail-body section p { margin: 0; color: #4d5853; font-size: .87rem; line-height: 1.65; }
.detail-body section.note { border-left: 4px solid var(--accent); border-radius: 3px 12px 12px 3px; padding: 14px 15px; background: var(--danger-soft); }
.tag-row { display: flex; flex-wrap: wrap; gap: 7px; margin: 22px 0; }
.tag-row span { color: var(--brand-2); font-size: .75rem; font-weight: 800; }
.official-button { min-height: 50px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--brand); border-radius: 14px; color: var(--brand); text-decoration: none; font-size: .86rem; font-weight: 900; }
.detail-affiliate { display: grid; gap: 8px; margin: 22px 0 12px; border: 1px solid #d1ddd5; border-radius: 15px; padding: 16px; background: #edf3ee; }
.detail-affiliate p { margin: 0; color: #4d5853; font-size: .8rem; line-height: 1.5; }
.toast { position: fixed; right: 18px; bottom: calc(78px + var(--safe-bottom)); left: 18px; z-index: 50; max-width: 520px; margin: auto; border-radius: 12px; padding: 12px 16px; background: #272d2a; color: white; text-align: center; font-size: .8rem; }

@media (min-width: 640px) {
  main { padding-right: 24px; padding-left: 24px; }
  .hero { margin-right: -24px; margin-left: -24px; padding-right: 42px; padding-left: 42px; }
  .certificate-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .affiliate-banner { grid-template-columns: minmax(0, 1fr) 210px; align-items: center; }
  .detail-dialog { margin-bottom: 4vh; border-radius: 26px; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; } }
