/* 웹 효과 도감 — 다크 모던 (글래스 · 그라디언트) */
@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable-dynamic-subset.min.css');

:root {
  --bg: #07070c;
  --bg-2: #0d0d16;
  --glass: rgba(255, 255, 255, 0.045);
  --glass-2: rgba(255, 255, 255, 0.08);
  --line: rgba(255, 255, 255, 0.09);
  --line-2: rgba(255, 255, 255, 0.16);
  --text: #ecebf5;
  --muted: #9a98b3;
  --faint: #6b6987;
  --violet: #8b5cf6;
  --pink: #ec4899;
  --cyan: #22d3ee;
  --grad: linear-gradient(110deg, var(--violet), var(--pink) 55%, var(--cyan));
  --radius: 18px;
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: 140px; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(900px 600px at 85% -10%, rgba(139, 92, 246, 0.18), transparent 60%),
    radial-gradient(700px 500px at -10% 30%, rgba(34, 211, 238, 0.08), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 15px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
}
::selection { background: rgba(139, 92, 246, 0.45); }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ── 상단 바 ─────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 20px;
  height: 64px; padding: 0 clamp(16px, 4vw, 40px);
  background: rgba(7, 7, 12, 0.72);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; font-weight: 800; letter-spacing: 0.02em; }
.tabs { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 999px; background: var(--glass); }
.tabs a { padding: 6px 14px; border-radius: 999px; color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 600; }
.tabs a:hover { color: var(--text); }
.tabs a[aria-current="page"] { color: #fff; background: var(--glass-2); box-shadow: inset 0 0 0 1px var(--line-2); }
.search {
  margin-left: auto; width: min(360px, 40vw);
  display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 10px 0 14px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--glass);
  color: var(--muted); transition: border-color 0.2s, box-shadow 0.2s;
}
.search:focus-within { border-color: rgba(139, 92, 246, 0.6); box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.15); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 14px; }
.search input::placeholder { color: var(--faint); }
.search kbd { padding: 0 6px; border: 1px solid var(--line-2); border-radius: 6px; font: 12px var(--mono); color: var(--faint); }

main { padding: 0 clamp(16px, 4vw, 40px) 80px; max-width: 1440px; margin: 0 auto; }

/* ── 히어로 ───────────────────────────────────────── */
.hero {
  position: relative; overflow: hidden;
  min-height: 420px; margin: 28px 0 0; padding: clamp(32px, 6vw, 72px);
  display: flex; align-items: center;
  border: 1px solid var(--line); border-radius: 28px;
  background: #07070c;
  isolation: isolate;
}
.hero-bg {
  position: absolute; inset: 0; z-index: -1;
  width: 100%; height: 100%; object-fit: cover; object-position: right center;
  -webkit-mask-image: linear-gradient(90deg, transparent 10%, #000 55%);
  mask-image: linear-gradient(90deg, transparent 10%, #000 55%);
}
.hero-copy { max-width: 560px; }
.kicker { margin: 0 0 10px; font-size: 13px; font-weight: 700; letter-spacing: 0.24em; color: var(--cyan); }
.hero h1 {
  margin: 0; font-size: clamp(44px, 7vw, 84px); line-height: 1.02; font-weight: 800; letter-spacing: -0.04em;
  background: linear-gradient(180deg, #fff 30%, #b9b4e8);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lead { margin: 18px 0 28px; color: var(--muted); font-size: 16px; }
.lead b { color: var(--text); font-weight: 700; }
.stats { display: flex; gap: 12px; margin: 0; }
.stats div { padding: 12px 18px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255, 255, 255, 0.04); backdrop-filter: blur(10px); }
.stats dt { font-size: 12px; color: var(--faint); }
.stats dd { margin: 0; font-size: 26px; font-weight: 800; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ── 카테고리 필터 ───────────────────────────────── */
.filters {
  position: sticky; top: 64px; z-index: 10;
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  margin: 28px calc(-1 * clamp(16px, 4vw, 40px)) 0; padding: 14px clamp(16px, 4vw, 40px);
  background: linear-gradient(var(--bg) 70%, transparent);
}
.filters::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 16px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--glass); color: var(--muted);
  font-size: 14px; font-weight: 600; white-space: nowrap;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.chip small { font-size: 12px; color: var(--faint); }
.chip:hover { color: var(--text); border-color: var(--line-2); }
.chip[aria-pressed="true"] {
  color: #fff; border-color: transparent;
  background: linear-gradient(var(--bg-2), var(--bg-2)) padding-box, var(--grad) border-box;
  border: 1px solid transparent;
  box-shadow: 0 6px 24px -8px rgba(139, 92, 246, 0.6);
}
.chip[aria-pressed="true"] small { color: var(--muted); }

.result { margin: 10px 0 18px; color: var(--faint); font-size: 14px; }

/* ── 카드 ─────────────────────────────────────────── */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 310px), 1fr)); gap: 22px; }
.card {
  position: relative; display: flex; flex-direction: column;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
  overflow: hidden;
  transition: transform 0.25s ease, border-color 0.25s, box-shadow 0.25s;
}
.card:hover { transform: translateY(-3px); border-color: var(--line-2); box-shadow: 0 24px 48px -24px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(139, 92, 246, 0.2); }
.demo { position: relative; aspect-ratio: 4 / 3; background: #0b0b14; border-bottom: 1px solid var(--line); }
.demo iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }
.demo .placeholder { position: absolute; inset: 0; display: grid; place-items: center; color: var(--faint); font-size: 13px; }
.hint-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  background: rgba(7, 7, 12, 0.7); border: 1px solid var(--line-2);
  backdrop-filter: blur(8px);
  font-size: 12px; font-weight: 600; color: var(--text);
}
.hint-chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
.demo .hint-chip { position: absolute; left: 12px; top: 12px; pointer-events: none; }
.card-body { display: flex; flex-direction: column; gap: 10px; padding: 16px 18px 18px; flex: 1; }
.card-title { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.card h3 { margin: 0; font-size: 18px; font-weight: 750; letter-spacing: -0.01em; }
.card .en { margin: -6px 0 0; font-size: 13px; color: var(--faint); }
.card .summary { margin: 0; color: var(--muted); font-size: 14px; flex: 1; }
.meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.badge { padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line); background: var(--glass); font-size: 12px; font-weight: 600; color: var(--muted); }
.level { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; color: var(--faint); }
.level i { width: 7px; height: 7px; border-radius: 50%; background: var(--line-2); }
.level i.on { background: var(--violet); box-shadow: 0 0 6px var(--violet); }
.level span { margin-left: 4px; }
.card-actions { display: flex; gap: 8px; margin-top: 4px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 16px;
  border: 1px solid var(--line-2); border-radius: 11px;
  background: var(--glass); color: var(--text);
  font-size: 14px; font-weight: 600; white-space: nowrap;
  transition: background 0.2s, border-color 0.2s, transform 0.1s;
}
.btn:hover { background: var(--glass-2); }
.btn:active { transform: scale(0.98); }
.btn.primary { border: 0; background: var(--grad); color: #fff; box-shadow: 0 8px 24px -10px rgba(236, 72, 153, 0.7); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--glass); }
.btn.wide { width: 100%; }
.card-actions .btn { flex: 1; height: 36px; }
.btn.copied { border-color: rgba(34, 211, 238, 0.6); color: var(--cyan); }
.btn.primary.copied { color: #fff; filter: saturate(0.6) brightness(1.15); }

.empty { text-align: center; color: var(--muted); padding: 60px 0; }

/* ── 즐겨찾기 ─────────────────────────────────────── */
.fav {
  display: inline-grid; place-items: center;
  width: 36px; height: 36px; padding: 0;
  border: 1px solid var(--line-2); border-radius: 50%;
  background: rgba(7, 7, 12, 0.7); color: var(--muted);
  backdrop-filter: blur(8px);
  transition: color 0.2s, background 0.2s, transform 0.2s, border-color 0.2s;
}
.fav:hover { color: #fde68a; transform: scale(1.08); }
.fav[aria-pressed="true"] { color: #fbbf24; border-color: rgba(251, 191, 36, 0.55); background: rgba(251, 191, 36, 0.14); }
.fav[aria-pressed="true"] svg { fill: currentColor; filter: drop-shadow(0 0 6px rgba(251, 191, 36, 0.7)); }
.fav[aria-pressed="true"]:active svg { transform: scale(1.3); }
.demo .fav { position: absolute; right: 12px; top: 12px; z-index: 1; }
.fav.big { width: auto; height: 40px; padding: 0 14px; gap: 6px; display: inline-flex; align-items: center; border-radius: 12px; font-size: 14px; font-weight: 600; }
.d-head-actions { display: flex; gap: 8px; }
.card.is-fav { border-color: rgba(251, 191, 36, 0.35); box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.12), 0 18px 40px -24px rgba(251, 191, 36, 0.4); }
.sec-title { grid-column: 1 / -1; margin: 6px 0 -6px; font-size: 15px; font-weight: 700; color: var(--muted); }
.sec-title.fav-title { order: -2; color: #fbbf24; }
.sec-title:not(.fav-title) { order: 0; margin-top: 18px; }
.chip-fav[aria-pressed="true"] { box-shadow: 0 6px 24px -8px rgba(251, 191, 36, 0.55); }

/* ── 상세보기 ─────────────────────────────────────── */
.detail {
  width: min(1180px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0;
  border: 1px solid var(--line-2); border-radius: 24px;
  background: rgba(13, 13, 22, 0.92); color: var(--text);
  backdrop-filter: blur(24px);
  box-shadow: 0 40px 120px -20px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(139, 92, 246, 0.15);
}
.detail::backdrop { background: rgba(3, 3, 8, 0.7); backdrop-filter: blur(6px); }
.detail[open] { animation: rise 0.28s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes rise { from { opacity: 0; transform: translateY(16px) scale(0.98); } }
.detail-inner { display: flex; flex-direction: column; max-height: calc(100vh - 48px); }
.d-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 22px 24px 14px; }
.d-cat { margin: 0 0 4px; font-size: 12px; font-weight: 700; letter-spacing: 0.18em; color: var(--cyan); }
.d-head h2 { margin: 0; font-size: 28px; font-weight: 800; letter-spacing: -0.02em; }
.d-en { margin: 2px 0 0; color: var(--muted); }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 12px; background: var(--glass); color: var(--text); }
.icon-btn:hover { background: var(--glass-2); }
.d-body { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; padding: 0 24px 24px; min-height: 0; overflow: auto; }
.d-stage { display: flex; flex-direction: column; gap: 10px; position: sticky; top: 0; align-self: start; }
.d-frame { position: relative; aspect-ratio: 4 / 3; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: #0b0b14; }
.d-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.d-stage-bar { display: flex; align-items: center; justify-content: space-between; }
.d-info { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.d-tabs { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 14px; background: var(--glass); }
.d-tabs button { flex: 1; height: 36px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-weight: 650; }
.d-tabs button[aria-selected="true"] { color: #fff; background: var(--glass-2); box-shadow: inset 0 0 0 1px var(--line-2); }
.d-panel { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.d-panel h4 { margin: 6px 0 0; font-size: 13px; letter-spacing: 0.04em; color: var(--faint); font-weight: 700; }
.d-panel p { margin: 0; color: var(--muted); }
.d-panel .desc { color: var(--text); }
.aka { display: flex; flex-wrap: wrap; gap: 6px; }
.tip { padding: 12px 14px; border: 1px solid rgba(34, 211, 238, 0.25); border-radius: 12px; background: rgba(34, 211, 238, 0.06); }
.panel-note { font-size: 14px; }
.code-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.seg { display: flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: var(--glass); }
.seg button { height: 30px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font: 600 13px var(--mono); }
.seg button[aria-pressed="true"] { color: #fff; background: var(--glass-2); }
.code, .prompt {
  margin: 0; max-height: 46vh; overflow: auto;
  padding: 16px; border: 1px solid var(--line); border-radius: 14px;
  background: #05050a;
  font: 13px/1.65 var(--mono); color: #d7d5ee; white-space: pre; tab-size: 2;
}
.prompt { white-space: pre-wrap; font-family: var(--font); font-size: 14px; line-height: 1.75; }

/* 토스트 */
.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 100;
  transform: translate(-50%, 12px); opacity: 0; pointer-events: none;
  padding: 10px 18px; border-radius: 999px;
  background: rgba(20, 20, 32, 0.92); border: 1px solid var(--line-2);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
  font-weight: 600; transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 900px) {
  .d-body { grid-template-columns: 1fr; }
  .d-stage { position: static; }
  .tabs { display: none; }
}
@media (max-width: 600px) {
  .topbar { gap: 12px; }
  .search { width: auto; flex: 1; }
  .search kbd { display: none; }
  .brand span { display: none; }
  .hero { min-height: 360px; }
  .hero-bg { opacity: 0.35; -webkit-mask-image: linear-gradient(180deg, transparent, #000 70%); mask-image: linear-gradient(180deg, transparent, #000 70%); }
  .lead { color: #c9c6e0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
