/* ===== Tokens (Karrot / SEED v2) ===== */
:root {
  --primary: #ff6f0f;
  --primary-hover: #ff9e66;
  --focus: #e14d00;
  --canvas: #ffffff;
  --bg: #f2f3f6;
  --surface: #f7f8fa;
  --fg: #212124;
  --ink: #1a1c20;
  --muted: #868b94;
  --hairline: #eaebee;
  --outline: rgba(26, 28, 32, 0.118);
  --overlay: #eeeff1;
  --tint: #fff5f0;
  --error: #fa2314;
  --info: #009ceb;
  --success: #1aa174;
  --warn: #f59f00;

  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px; /* 카드 전용: 4px 그리드 위의 확장값 */
  --r-full: 9999px;

  --fast: 150ms;
  --standard: 250ms;
  --slow: 350ms;
  --ease-standard: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-enter: cubic-bezier(0, 0, 0.2, 1);
  --ease-exit: cubic-bezier(0.4, 0, 1, 1);

  --font: -apple-system, BlinkMacSystemFont, system-ui, "Apple SD Gothic Neo", "Malgun Gothic", "Pretendard Variable", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Consolas, "D2Coding", monospace;
}

/* ===== Base ===== */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: -0.02em;
  color: var(--fg);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { letter-spacing: 0; line-height: 1.35; margin: 0; }
p { margin: 0; }
a { color: inherit; }
button { font: inherit; letter-spacing: inherit; color: inherit; }

.container {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 16px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

:focus-visible { outline: none; box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--focus); }

.hint { font-size: 14px; color: var(--muted); }

/* ===== Header ===== */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--hairline);
}

.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}

.logo {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 18px; font-weight: 700; text-decoration: none; color: var(--ink);
  border-radius: var(--r-sm);
}

.logo-mark {
  width: 24px; height: 24px; border-radius: var(--r-full);
  background: var(--primary);
  position: relative;
}
.logo-mark::after {
  content: ""; position: absolute; left: 7px; top: 6px;
  width: 6px; height: 10px;
  border: solid #fff; border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}

.header-nav { display: flex; gap: 4px; }

/* ===== Pills (marketing ghost / outlined) ===== */
.pill {
  position: relative; isolation: isolate;
  display: inline-flex; align-items: center; justify-content: center;
  height: 36px; padding: 4px 12px;
  font-size: 14px; font-weight: 500; line-height: 20px;
  color: var(--ink); text-decoration: none; white-space: nowrap;
  background: transparent; border: 0; border-radius: var(--r-full);
  cursor: pointer;
  transition: background-color .2s var(--ease-standard), box-shadow .2s var(--ease-standard);
}
.pill::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  border-radius: inherit; background: var(--overlay); opacity: 0;
  transition: opacity var(--fast) var(--ease-standard);
}
.pill:hover::before { opacity: .48; }
.pill:active::before { opacity: .72; }
.pill-outline { padding: 3px 11px; border: 1px solid var(--outline); }
.pill-ghost.is-current { font-weight: 700; }

/* ===== Primary button (SEED box button) ===== */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center;
  height: 44px; padding: 0 20px;
  font-size: 16px; font-weight: 700;
  color: #fff; background: var(--primary);
  border: 0; border-radius: var(--r-full);
  cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background-color var(--fast) var(--ease-standard);
}
.btn-primary:hover, .btn-primary:active { background: var(--primary-hover); }
.btn-primary:disabled { background: #dcdee3; color: #adb1ba; cursor: default; }

/* ===== Hero ===== */
.hero { padding: 64px 0 48px; }
.hero-inner { display: flex; flex-direction: column; align-items: center; text-align: center; }

.hero-title { font-size: 48px; font-weight: 700; color: var(--ink); }
.hero-sub { margin-top: 12px; font-size: 18px; color: #555d6d; }

.mode-tabs {
  display: inline-flex; gap: 4px; margin-top: 40px; padding: 4px;
  background: var(--bg); border-radius: var(--r-full);
}
.mode-tab {
  height: 32px; padding: 0 16px;
  font-size: 14px; font-weight: 500; color: #555d6d;
  background: transparent; border: 0; border-radius: var(--r-full);
  cursor: pointer;
  transition: background-color var(--fast) var(--ease-standard), color var(--fast) var(--ease-standard);
}
.mode-tab[aria-selected="true"] {
  background: var(--canvas); color: var(--ink); font-weight: 700;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .08);
}

/* Search pill */
.search-pill {
  display: flex; align-items: center; gap: 8px;
  width: 100%; max-width: 640px; height: 60px; margin-top: 16px;
  padding: 0 8px 0 20px;
  background: var(--canvas); border-radius: var(--r-full);
  box-shadow: rgba(0,0,0,.05) 0 5px 10px, rgba(0,0,0,.07) 0 15px 25px, var(--ink) 0 0 0 2px;
  transition: box-shadow .2s var(--ease-standard);
}
.search-pill:focus-within {
  box-shadow: rgba(0,0,0,.05) 0 5px 10px, rgba(0,0,0,.07) 0 15px 25px, var(--focus) 0 0 0 2px;
}
.search-pill.is-invalid { box-shadow: rgba(0,0,0,.05) 0 5px 10px, var(--error) 0 0 0 2px; }

.search-icon { width: 20px; height: 20px; flex: none; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }

.search-pill input {
  flex: 1; min-width: 0; height: 100%;
  font: inherit; font-size: 18px; color: #2a3038;
  background: transparent; border: 0; outline: none;
}
.search-pill input::placeholder { color: #adb1ba; }

/* HTML form */
.html-form { width: 100%; max-width: 640px; margin-top: 16px; text-align: left; }
.html-form textarea {
  display: block; width: 100%; padding: 16px;
  font-family: var(--mono); font-size: 14px; line-height: 1.6; letter-spacing: 0;
  color: var(--fg); background: var(--surface);
  border: 2px solid var(--ink); border-radius: var(--r-lg);
  resize: vertical; outline: none;
  transition: border-color .2s var(--ease-standard);
}
.html-form textarea:focus { border-color: var(--focus); }
.html-form.is-invalid textarea { border-color: var(--error); }
.html-form-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }

.field-error { margin-top: 12px; font-size: 14px; color: var(--error); }

.keywords {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 16px;
  margin-top: 24px; font-size: 14px;
}
.keywords-label { color: var(--muted); }
.keyword {
  padding: 0; font-size: 16px; color: var(--ink);
  background: none; border: 0; border-radius: var(--r-sm); cursor: pointer;
}
.keyword:hover { text-decoration: underline; }

/* ===== Results ===== */
.results { padding: 40px 0 64px; background: var(--bg); min-height: 50vh; }

.card {
  background: var(--canvas);
  border-radius: var(--r-lg);
  padding: 24px;
}
.card-title { font-size: 16px; font-weight: 700; color: var(--ink); }

.report-top { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* Summary */
.summary-card { display: flex; align-items: center; gap: 24px; }

.score-ring { position: relative; width: 120px; height: 120px; flex: none; }
.score-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: var(--hairline); stroke-width: 10; }
.ring-value {
  fill: none; stroke: var(--muted); stroke-width: 10; stroke-linecap: round;
  stroke-dasharray: 326.73; stroke-dashoffset: 326.73;
  transition: stroke-dashoffset 900ms var(--ease-enter), stroke var(--standard) var(--ease-standard);
}
.score-ring[data-grade="good"] .ring-value { stroke: var(--success); }
.score-ring[data-grade="ok"] .ring-value { stroke: var(--warn); }
.score-ring[data-grade="bad"] .ring-value { stroke: var(--error); }

.score-num {
  position: absolute; inset: 0;
  display: flex; align-items: baseline; justify-content: center; padding-top: 38px;
  color: var(--ink);
}
.score-num strong { font-size: 34px; font-weight: 700; letter-spacing: 0; line-height: 1; }
.score-num span { font-size: 14px; margin-left: 2px; color: var(--muted); }

.summary-body { min-width: 0; }
.summary-label { font-size: 20px; font-weight: 700; color: var(--ink); line-height: 1.35; }
.summary-target {
  margin-top: 4px; font-size: 14px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.counts { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 12px 0 0; padding: 0; list-style: none; font-size: 14px; color: #555d6d; }
.counts li { display: inline-flex; align-items: center; gap: 6px; }
.counts strong { color: var(--ink); }

.dot { width: 8px; height: 8px; border-radius: var(--r-full); display: inline-block; }
.dot-fail { background: var(--error); }
.dot-warn { background: var(--warn); }
.dot-pass { background: var(--success); }

.summary-actions { display: flex; gap: 8px; margin-top: 16px; margin-left: -12px; }
.summary-actions .pill-outline { margin-left: 12px; }

/* SERP preview */
.serp { margin: 16px 0 12px; padding: 16px; border: 1px solid var(--hairline); border-radius: var(--r-md); font-family: Arial, var(--font); letter-spacing: 0; }
.serp-site { display: flex; align-items: center; gap: 12px; }
.serp-favicon { width: 28px; height: 28px; border-radius: var(--r-full); background: var(--surface); border: 1px solid var(--hairline); flex: none; }
.serp-name { font-size: 14px; color: #202124; }
.serp-url { font-size: 12px; color: #4d5156; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px; }
.serp-title { margin-top: 8px; font-size: 20px; line-height: 1.3; color: #1a0dab; overflow-wrap: anywhere; }
.serp-desc { margin-top: 4px; font-size: 14px; line-height: 1.58; color: #4d5156; overflow-wrap: anywhere; }
.serp .is-missing { color: var(--muted); font-style: italic; }

/* Filter tabs (SEED tabs, hug) */
.filter-tabs {
  display: flex; gap: 24px; margin-top: 32px;
  border-bottom: 1px solid #dcdee3;
  overflow-x: auto; scrollbar-width: none;
}
.filter-tab {
  position: relative; height: 44px; padding: 0;
  font-size: 16px; font-weight: 500; color: var(--muted);
  background: none; border: 0; cursor: pointer; white-space: nowrap;
  transition: color var(--fast) var(--ease-standard);
}
.filter-tab::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: var(--ink); transform: scaleX(0);
  transition: transform var(--standard) var(--ease-standard);
}
.filter-tab[aria-selected="true"] { color: var(--ink); font-weight: 700; }
.filter-tab[aria-selected="true"]::after { transform: scaleX(1); }
.filter-tab .tab-count { margin-left: 4px; font-weight: 400; color: var(--muted); }

/* Check groups */
.check-group { margin-top: 24px; }
.group-title { margin: 0 0 8px 4px; font-size: 14px; font-weight: 700; color: #555d6d; }
.group-list { background: var(--canvas); border-radius: var(--r-lg); overflow: hidden; }

.check { border-top: 1px solid var(--hairline); }
.check:first-child { border-top: 0; }

.check-head {
  display: flex; align-items: flex-start; gap: 12px;
  width: 100%; padding: 16px 20px;
  text-align: left; background: none; border: 0;
  list-style: none; cursor: default;
}
.check-head::-webkit-details-marker { display: none; }
details.check > .check-head { cursor: pointer; }
details.check > .check-head:hover { background: var(--surface); }

.status-icon { width: 24px; height: 24px; flex: none; margin-top: 1px; }

.check-text { flex: 1; min-width: 0; }
.check-title { font-size: 16px; font-weight: 700; color: var(--ink); }
.check-msg { margin-top: 2px; font-size: 14px; color: #555d6d; overflow-wrap: anywhere; }

.chevron {
  width: 20px; height: 20px; flex: none; margin-top: 2px;
  fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  transition: transform var(--standard) var(--ease-standard);
}
details[open] .chevron { transform: rotate(180deg); }

.check-detail { padding: 0 20px 16px 56px; }
.check-detail ul { margin: 0; padding: 12px 16px; list-style: none; background: var(--surface); border-radius: var(--r-md); }
.check-detail li {
  padding: 4px 0; font-size: 14px; line-height: 1.5; color: var(--fg);
  overflow-wrap: anywhere;
}
.check-detail code, .check-detail .mono { font-family: var(--mono); font-size: 13px; letter-spacing: 0; }
.check-detail .tag {
  display: inline-block; min-width: 28px; margin-right: 8px; padding: 0 6px;
  font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: 0;
  color: #555d6d; background: var(--canvas); border: 1px solid var(--hairline); border-radius: var(--r-sm);
  text-align: center;
}
.check-detail .indent-2 { padding-left: 16px; }
.check-detail .indent-3 { padding-left: 32px; }
.check-detail .indent-4 { padding-left: 48px; }
.check-detail .indent-5, .check-detail .indent-6 { padding-left: 64px; }
.check-detail .is-bad { color: var(--error); }

.empty-filter { margin-top: 32px; text-align: center; font-size: 14px; color: #4d5156; }

/* Skeleton */
.skeleton .card { margin-bottom: 16px; }
.sk {
  position: relative; overflow: hidden;
  background: var(--hairline); border-radius: var(--r-sm);
}
.sk::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.6), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.2s infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }
.sk-ring { width: 120px; height: 120px; border-radius: var(--r-full); flex: none; }
.sk-lines { flex: 1; }
.sk-line { height: 16px; margin: 12px 0; }
.w40 { width: 40%; } .w60 { width: 60%; } .w80 { width: 80%; }
.loading-text { text-align: center; font-size: 14px; color: var(--muted); }

/* Blocking error */
.blocking-error { max-width: 520px; margin: 24px auto; padding: 40px 24px; text-align: center; }
.blocking-title { font-size: 16px; font-weight: 600; color: var(--ink); }
.blocking-sub { margin-top: 8px; font-size: 14px; color: #555d6d; }
.blocking-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 24px; }
.blocking-actions .pill { height: 44px; padding: 0 19px; }

/* Footer */
.site-footer { border-top: 1px solid var(--hairline); background: var(--canvas); }
.footer-inner { padding: 32px 16px; }
.footer-link { font-size: 16px; color: #555d6d; text-decoration: none; }
.footer-link:hover { text-decoration: underline; }
.footer-note { margin-top: 8px; font-size: 14px; color: var(--muted); }

/* Snackbar */
.snackbar {
  position: fixed; left: 50%; bottom: 24px; z-index: 50;
  max-width: calc(100% - 32px); padding: 12px 16px;
  font-size: 14px; color: #fff; background: var(--ink);
  border-radius: var(--r-md);
  opacity: 0; pointer-events: none;
  transform: translate(-50%, 16px);
  transition: opacity var(--fast) var(--ease-exit), transform var(--fast) var(--ease-exit);
}
.snackbar.is-show {
  opacity: 1; transform: translate(-50%, 0);
  transition: opacity var(--standard) var(--ease-enter), transform var(--standard) var(--ease-enter);
}

/* ===== Guide page ===== */
.guide-hero { padding: 64px 0 40px; }
.guide-hero h1 { font-size: 42px; font-weight: 700; color: var(--ink); }
.guide-hero p { margin-top: 12px; font-size: 18px; color: #555d6d; }

.guide-body { padding: 40px 0 64px; background: var(--bg); }
.guide-toc { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.guide-section { margin-top: 32px; scroll-margin-top: 80px; }
.guide-section h2 { font-size: 24px; font-weight: 700; color: var(--ink); margin: 0 0 12px 4px; }
.guide-item { padding: 20px 24px; border-top: 1px solid var(--hairline); }
.guide-item:first-child { border-top: 0; }
.guide-item h3 { font-size: 16px; font-weight: 700; color: var(--ink); }
.guide-item p { margin-top: 4px; font-size: 14px; color: #555d6d; }
.guide-item .rule { margin-top: 8px; font-size: 14px; color: var(--fg); }
.guide-item code { font-family: var(--mono); font-size: 13px; letter-spacing: 0; padding: 1px 6px; background: var(--surface); border-radius: var(--r-sm); }
.guide-cta { margin-top: 40px; text-align: center; }

/* ===== Responsive ===== */
@media (max-width: 760px) {
  .report-top { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .hero { padding: 40px 0 32px; }
  .hero-title { font-size: 34px; }
  .hero-sub { font-size: 16px; }
  .guide-hero h1 { font-size: 34px; }
  .guide-hero p { font-size: 16px; }
  .search-pill { padding-left: 16px; }
  .search-pill .btn-primary { padding: 0 16px; }
  .search-icon { display: none; }
  .summary-card { flex-direction: column; text-align: center; }
  .counts, .summary-actions { justify-content: center; }
  .summary-actions { margin-left: 0; }
  .summary-target { white-space: normal; overflow-wrap: anywhere; }
  .card { padding: 20px 16px; }
  .check-head { padding: 16px; }
  .check-detail { padding: 0 16px 16px; }
  .html-form-foot { flex-direction: column; align-items: stretch; }
  .header-nav .pill-ghost { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0ms !important;
    transition-duration: 0ms !important;
  }
}
