/* ==========================================================================
   MBTI Journal Korea — design system
   ========================================================================== */
:root {
  --bg: #0b0b10;
  --bg-elev: #111118;
  --surface: #16161f;
  --surface-2: #1e1e2a;
  --surface-3: #272736;
  --text: #f3f3f7;
  --text-2: #c9c9d4;
  --text-muted: #8f8fa0;
  --border: #2a2a38;
  --accent: #8b5cf6;
  --accent-strong: #7c3aed;
  --accent-2: #c084fc;
  --accent-soft: rgba(139, 92, 246, 0.14);
  --danger: #f43f5e;
  --success: #10b981;
  --nt: #a78bfa;
  --nf: #34d399;
  --sj: #60a5fa;
  --sp: #fbbf24;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  --header-bg: rgba(11, 11, 16, 0.82);
  --grad: linear-gradient(135deg, #a78bfa 0%, #c084fc 50%, #f0abfc 100%);
  color-scheme: dark;
  font-family: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Malgun Gothic', 'Segoe UI', sans-serif;
}

:root[data-theme="light"] {
  --bg: #f7f6fb;
  --bg-elev: #ffffff;
  --surface: #ffffff;
  --surface-2: #f1eff8;
  --surface-3: #e6e3f1;
  --text: #16151d;
  --text-2: #3b3a48;
  --text-muted: #6b6a7b;
  --border: #e3e0ee;
  --accent: #7c3aed;
  --accent-strong: #6d28d9;
  --accent-2: #8b5cf6;
  --accent-soft: rgba(124, 58, 237, 0.09);
  --nt: #7c3aed;
  --nf: #059669;
  --sj: #2563eb;
  --sp: #d97706;
  --shadow: 0 10px 30px rgba(40, 30, 80, 0.08);
  --header-bg: rgba(255, 255, 255, 0.85);
  --grad: linear-gradient(135deg, #7c3aed 0%, #a855f7 50%, #d946ef 100%);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
main { flex: 1; }
img, svg, canvas { max-width: 100%; display: block; }
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hidden { display: none !important; }
.muted { color: var(--text-muted); }
.small { font-size: 0.86rem; }
.center { text-align: center; }
.mt-1 { margin-top: 0.5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; } .mt-4 { margin-top: 2.5rem; }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }

/* ---------- IP banner ---------- */
.ip-banner {
  background: linear-gradient(90deg, #4c1d95, #6d28d9, #4c1d95);
  color: #ede9fe;
  font-size: 0.74rem;
  overflow: hidden;
  white-space: nowrap;
  padding: 0.28rem 0;
}
.ip-banner .marquee { display: inline-flex; animation: marquee 38s linear infinite; }
.ip-banner .marquee span { padding-right: 2rem; }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  border-bottom: 1px solid var(--border);
}
/* Blur lives on a pseudo-element: backdrop-filter on the header itself would make it
   the containing block for the fixed mobile drawer and clip it to header height. */
.site-header::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: var(--header-bg);
  backdrop-filter: saturate(160%) blur(16px);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
}
.header-inner {
  max-width: 1120px; margin: 0 auto;
  padding: 0.7rem 1.25rem;
  display: flex; align-items: center; gap: 1rem;
}
.logo {
  font-weight: 800; font-size: 1.18rem; letter-spacing: -0.5px;
  display: inline-flex; align-items: center; gap: 0.45rem;
  color: var(--text); text-decoration: none !important; white-space: nowrap;
}
.logo-mark {
  width: 28px; height: 28px; border-radius: 8px; background: var(--grad);
  display: grid; place-items: center; color: #fff; font-size: 0.8rem; font-weight: 900;
}
.site-nav { display: flex; gap: 0.2rem; margin-left: auto; align-items: center; }
.site-nav a {
  color: var(--text-muted); font-size: 0.92rem; font-weight: 600;
  padding: 0.45rem 0.7rem; border-radius: 10px; text-decoration: none; white-space: nowrap;
}
.site-nav a:hover { color: var(--text); background: var(--surface-2); }
.site-nav a.active { color: var(--text); background: var(--surface-2); }
.site-nav a.nav-premium { color: #fff; background: var(--grad); }
.site-nav a.nav-premium:hover { filter: brightness(1.08); }
.icon-btn {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-size: 1rem;
  flex-shrink: 0;
}
.icon-btn:hover { border-color: var(--accent); }
.menu-toggle { display: none; }

@media (max-width: 920px) {
  .menu-toggle { display: grid; }
  .site-nav {
    position: fixed; inset: 0 0 0 auto; width: min(300px, 82vw);
    flex-direction: column; align-items: stretch; gap: 0.25rem;
    background: var(--bg-elev); border-left: 1px solid var(--border);
    padding: 4.5rem 1rem 1rem; transform: translateX(100%); visibility: hidden;
    transition: transform 0.25s ease, visibility 0.25s; box-shadow: var(--shadow); z-index: 120;
  }
  .site-nav.open { transform: translateX(0); visibility: visible; }
  .logo { font-size: 1.05rem; }
  .site-nav a { padding: 0.8rem 1rem; font-size: 1rem; }
  .header-inner .theme-toggle { margin-left: auto; }
  .nav-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 110; }
}

/* ---------- Layout ---------- */
.container { max-width: 1120px; margin: 0 auto; padding: 1.75rem 1.25rem 3rem; }
.narrow { max-width: 760px; margin-left: auto; margin-right: auto; }
.section { margin-top: 3rem; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1.1rem; flex-wrap: wrap; }
.section-head h2, .section-title { font-size: 1.45rem; font-weight: 800; letter-spacing: -0.4px; }
.section-head p { color: var(--text-muted); font-size: 0.95rem; }
.page-title { font-size: clamp(1.7rem, 4vw, 2.3rem); font-weight: 800; letter-spacing: -0.8px; line-height: 1.3; }
.page-lead { color: var(--text-muted); font-size: 1.04rem; margin-top: 0.5rem; max-width: 680px; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.4rem;
}
.card h3 { font-size: 1.08rem; margin-bottom: 0.4rem; }
.card p + p { margin-top: 0.6rem; }
.card-soft { background: var(--surface-2); }
.card-accent { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); background: linear-gradient(160deg, var(--accent-soft), var(--surface) 60%); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  padding: 0.72rem 1.25rem; border-radius: 12px; font-weight: 700; font-size: 0.95rem;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  text-decoration: none !important; transition: transform 0.12s ease, filter 0.15s, border-color 0.15s, background 0.15s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn-grad { background: var(--grad); border: none; color: #fff; }
.btn-grad:hover { filter: brightness(1.08); }
.btn-kakao { background: #fee500; border-color: #fee500; color: #191919; }
.btn-kakao:hover { filter: brightness(0.96); border-color: #fee500; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 0.45rem 0.85rem; font-size: 0.84rem; border-radius: 10px; }
.btn-lg { padding: 0.95rem 1.6rem; font-size: 1.05rem; border-radius: 14px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn-row { display: flex; gap: 0.55rem; flex-wrap: wrap; }

/* ---------- Chips / badges ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 0.3rem;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-muted);
  padding: 0.4rem 0.85rem; border-radius: 999px; font-size: 0.83rem; font-weight: 600;
  transition: all 0.15s ease; white-space: nowrap;
}
button.chip:hover { color: var(--text); border-color: var(--accent); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.chips-scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 0.3rem; scrollbar-width: thin; }
.badge {
  display: inline-block; font-size: 0.74rem; font-weight: 800; letter-spacing: 0.4px;
  padding: 0.18rem 0.55rem; border-radius: 6px; background: var(--accent-soft); color: var(--accent-2);
}
.g-NT { --g: var(--nt); } .g-NF { --g: var(--nf); } .g-SJ { --g: var(--sj); } .g-SP { --g: var(--sp); }
.badge[class*="g-"] { background: color-mix(in srgb, var(--g) 16%, transparent); color: var(--g); }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 0.85rem; }
.field label { font-size: 0.86rem; font-weight: 700; color: var(--text-2); }
.input, select.input, textarea.input {
  width: 100%; padding: 0.75rem 0.9rem; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 12px; color: var(--text); outline: none;
  transition: border-color 0.15s;
}
.input:focus { border-color: var(--accent); }
textarea.input { resize: vertical; min-height: 140px; line-height: 1.7; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
@media (max-width: 560px) { .form-row { grid-template-columns: 1fr; } }
.search-wrap { position: relative; }
.search-wrap .input { padding-left: 2.5rem; border-radius: 999px; }
.search-wrap::before { content: "⌕"; position: absolute; left: 1rem; top: 50%; transform: translateY(-52%); color: var(--text-muted); font-size: 1.1rem; }

/* ---------- Hero ---------- */
.hero {
  position: relative; text-align: center; padding: 3.2rem 1rem 2.4rem; overflow: hidden;
}
.hero::before {
  content: ""; position: absolute; inset: -40% -10% auto; height: 120%;
  background: radial-gradient(closest-side, var(--accent-soft), transparent 70%);
  z-index: -1;
}
.hero .eyebrow { display: inline-block; font-size: 0.82rem; font-weight: 700; color: var(--accent-2); background: var(--accent-soft); padding: 0.3rem 0.8rem; border-radius: 999px; margin-bottom: 1rem; }
.hero h1 { font-size: clamp(2rem, 5.5vw, 3.2rem); font-weight: 900; letter-spacing: -1.4px; line-height: 1.2; }
.hero p { color: var(--text-muted); max-width: 560px; margin: 1rem auto 1.6rem; font-size: 1.08rem; }
.hero .btn-row { justify-content: center; }
.hero-stats { display: flex; justify-content: center; gap: 2rem; margin-top: 2rem; flex-wrap: wrap; }
.hero-stats div { text-align: center; }
.hero-stats strong { display: block; font-size: 1.4rem; font-weight: 800; }
.hero-stats span { font-size: 0.82rem; color: var(--text-muted); }

/* ---------- Daily widget ---------- */
.daily { display: grid; grid-template-columns: 1.2fr 1fr; gap: 1.2rem; align-items: stretch; }
@media (max-width: 820px) { .daily { grid-template-columns: 1fr; } }
.daily-type-select { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.4rem; margin-top: 0.9rem; }
.daily-type-select button {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
  padding: 0.55rem 0; font-weight: 800; font-size: 0.85rem; color: var(--text-2);
}
.daily-type-select button:hover { border-color: var(--accent); }
.daily-type-select button.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.fortune h3 { font-size: 1.25rem; }
.fortune .msg { font-size: 1.08rem; margin: 0.8rem 0 1rem; color: var(--text); }
.fortune-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
.fortune-meta div { background: var(--surface-2); border-radius: 12px; padding: 0.7rem; text-align: center; }
.fortune-meta small { display: block; color: var(--text-muted); font-size: 0.75rem; }
.fortune-meta strong { font-size: 0.95rem; }
.meter { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin-top: 0.3rem; }
.meter > i { display: block; height: 100%; background: var(--grad); border-radius: 99px; }

/* ---------- Feature tiles ---------- */
.tile { display: flex; flex-direction: column; gap: 0.5rem; color: var(--text); text-decoration: none !important; transition: transform 0.18s, border-color 0.18s; }
.tile:hover { transform: translateY(-3px); border-color: var(--accent); }
.tile .tile-icon { font-size: 1.8rem; }
.tile p { color: var(--text-muted); font-size: 0.92rem; }
.tile .tile-cta { margin-top: auto; color: var(--accent-2); font-weight: 700; font-size: 0.9rem; }

/* ---------- Posts ---------- */
.feed-controls { display: grid; gap: 0.75rem; margin-bottom: 1.2rem; }
.feed-controls .row { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.feed-controls .search-wrap { flex: 1; min-width: 220px; }
.posts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.2rem; }
.post-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.post-card:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--g, var(--accent)) 60%, var(--border)); box-shadow: var(--shadow); }
.post-card > a { color: inherit; text-decoration: none; display: flex; flex-direction: column; flex: 1; }
.post-thumb {
  height: 150px; display: grid; place-items: center; font-size: 3.4rem; position: relative;
  background: radial-gradient(circle at 30% 20%, color-mix(in srgb, var(--g, var(--accent)) 35%, transparent), transparent 70%), var(--surface-2);
}
.post-thumb .badge { position: absolute; top: 0.8rem; left: 0.8rem; }
.post-thumb .mine { position: absolute; top: 0.8rem; right: 0.8rem; background: var(--surface); color: var(--text-2); }
.post-body-sm { padding: 1.1rem 1.2rem 0.6rem; flex: 1; }
.post-body-sm h3 { font-size: 1.06rem; line-height: 1.45; margin-bottom: 0.35rem; }
.post-meta { font-size: 0.8rem; color: var(--text-muted); }
.post-excerpt { font-size: 0.9rem; color: var(--text-2); margin-top: 0.5rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.post-actions { display: flex; gap: 0.4rem; padding: 0.4rem 1.2rem 1.1rem; }
.empty { grid-column: 1 / -1; text-align: center; padding: 3rem 1rem; color: var(--text-muted); }

/* Post detail */
.post-detail { max-width: 740px; margin: 0 auto; }
.breadcrumb { font-size: 0.84rem; color: var(--text-muted); margin-bottom: 1rem; }
.breadcrumb a { color: var(--text-muted); }
.post-header { margin-bottom: 1.6rem; padding-bottom: 1.4rem; border-bottom: 1px solid var(--border); }
.post-header h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); line-height: 1.35; letter-spacing: -0.6px; margin: 0.6rem 0 0.5rem; }
.prose { font-size: 1.06rem; color: var(--text-2); }
.prose p { margin-bottom: 1.1rem; }
.prose h2, .prose h3 { color: var(--text); margin: 2rem 0 0.7rem; font-size: 1.25rem; letter-spacing: -0.3px; }
.prose ul, .prose ol { margin: 0 0 1.1rem 1.3rem; }
.prose li { margin-bottom: 0.35rem; }
.prose strong { color: var(--text); }
.related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 0.8rem; }
.related-card { display: flex; flex-direction: column; gap: 0.35rem; padding: 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); text-decoration: none !important; }
.related-card:hover { border-color: var(--accent); }
.related-card strong { font-size: 0.95rem; line-height: 1.45; }

/* ---------- Ads ---------- */
.ad-slot { margin: 2rem auto; text-align: center; min-height: 0; }
.ad-slot .ad-label { display: block; font-size: 0.7rem; color: var(--text-muted); letter-spacing: 1px; margin-bottom: 0.3rem; }
.ad-slot:empty { display: none; }

/* ---------- Test ---------- */
.test-wrap { max-width: 720px; margin: 0 auto; }
.progress { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: var(--grad); transition: width 0.3s ease; border-radius: 99px; }
.progress-label { display: flex; justify-content: space-between; font-size: 0.84rem; color: var(--text-muted); margin: 0.5rem 0 1.2rem; }
.q-card { text-align: center; padding: 2rem 1.4rem; animation: fadeUp 0.25s ease; }
.q-card .q-num { font-size: 0.85rem; font-weight: 700; color: var(--accent-2); }
.q-card h2 { font-size: clamp(1.2rem, 3.4vw, 1.5rem); line-height: 1.5; margin: 0.7rem auto 1.8rem; max-width: 520px; letter-spacing: -0.3px; }
.likert { display: flex; align-items: center; justify-content: center; gap: clamp(0.45rem, 2.5vw, 1.1rem); }
.likert-end { font-size: 0.8rem; font-weight: 700; width: 64px; }
.likert-end.agree { color: var(--accent-2); text-align: left; }
.likert-end.disagree { color: var(--text-muted); text-align: right; }
.likert button {
  border-radius: 50%; border: 2px solid var(--border); background: transparent; transition: all 0.15s ease;
  flex-shrink: 0;
}
.likert button:nth-of-type(1), .likert button:nth-of-type(5) { width: 52px; height: 52px; }
.likert button:nth-of-type(2), .likert button:nth-of-type(4) { width: 42px; height: 42px; }
.likert button:nth-of-type(3) { width: 34px; height: 34px; }
.likert button:nth-of-type(1), .likert button:nth-of-type(2) { border-color: color-mix(in srgb, var(--text-muted) 70%, transparent); }
.likert button:nth-of-type(4), .likert button:nth-of-type(5) { border-color: var(--accent); }
.likert button:hover { transform: scale(1.08); }
.likert button.selected { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.likert button:nth-of-type(1).selected, .likert button:nth-of-type(2).selected { background: var(--text-muted); border-color: var(--text-muted); box-shadow: none; }
@media (max-width: 480px) { .likert-end { display: none; } .likert-labels-mobile { display: flex !important; } }
.likert-labels-mobile { display: none; justify-content: space-between; font-size: 0.78rem; font-weight: 700; margin-top: 0.8rem; color: var(--text-muted); }
.q-nav { display: flex; justify-content: space-between; margin-top: 1.4rem; }
.kbd-hint { font-size: 0.78rem; color: var(--text-muted); margin-top: 1rem; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Result */
.result-hero { text-align: center; padding: 2.2rem 1.4rem; position: relative; overflow: hidden; }
.result-hero::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--g) 28%, transparent), transparent 65%); z-index: 0; }
.result-hero > * { position: relative; }
.result-type { font-size: clamp(3.2rem, 12vw, 5rem); font-weight: 900; letter-spacing: 2px; line-height: 1; color: var(--g); margin: 0.6rem 0; }
.result-nick { font-size: 1.25rem; font-weight: 800; }
.result-emoji { font-size: 3rem; }
.axis { margin-bottom: 1rem; }
.axis-top { display: flex; justify-content: space-between; font-size: 0.86rem; font-weight: 700; margin-bottom: 0.35rem; }
.axis-top .win { color: var(--g, var(--accent-2)); }
.axis-bar { height: 12px; border-radius: 99px; background: var(--surface-3); position: relative; overflow: hidden; }
.axis-bar > i { position: absolute; top: 0; bottom: 0; background: var(--g, var(--accent)); border-radius: 99px; }
.list-check { list-style: none; display: grid; gap: 0.45rem; }
.list-check li { padding-left: 1.5rem; position: relative; color: var(--text-2); }
.list-check li::before { content: "✓"; position: absolute; left: 0; color: var(--success); font-weight: 900; }
.list-warn li::before { content: "!"; color: var(--sp); left: 0.35rem; }
.stack { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; }
@media (max-width: 520px) { .stack { grid-template-columns: repeat(2, 1fr); } }
.stack-item { background: var(--surface-2); border-radius: 12px; padding: 0.8rem; text-align: center; }
.stack-item small { display: block; font-size: 0.72rem; color: var(--text-muted); }
.stack-item strong { display: block; font-size: 1.3rem; color: var(--accent-2); }
.stack-item span { font-size: 0.78rem; color: var(--text-2); }

/* ---------- Types grid ---------- */
.type-card { display: flex; flex-direction: column; gap: 0.3rem; color: var(--text); text-decoration: none !important; border-top: 3px solid var(--g); transition: transform 0.18s, box-shadow 0.18s; }
.type-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.type-card .code { font-size: 1.5rem; font-weight: 900; color: var(--g); letter-spacing: 1px; }
.type-card .nick { font-weight: 700; }
.type-card p { font-size: 0.88rem; color: var(--text-muted); }
.type-card .emoji { font-size: 2rem; }
.group-legend { display: flex; flex-wrap: wrap; gap: 1rem; font-size: 0.86rem; color: var(--text-muted); }
.group-legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--g); margin-right: 0.4rem; }

/* ---------- Match ---------- */
.match-pickers { display: grid; grid-template-columns: 1fr auto 1fr; gap: 1rem; align-items: center; }
@media (max-width: 640px) { .match-pickers { grid-template-columns: 1fr; } .match-plus { text-align: center; } }
.match-plus { font-size: 2rem; color: var(--accent-2); font-weight: 900; }
.type-picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.35rem; }
.type-picker button { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 0.6rem 0; font-weight: 800; font-size: 0.85rem; color: var(--text-2); }
.type-picker button.active { background: var(--g); border-color: var(--g); color: #111; }
.type-picker button:hover { border-color: var(--g); }
.score-ring { width: 170px; height: 170px; margin: 0 auto; position: relative; }
.score-ring svg { transform: rotate(-90deg); }
.score-ring .num { position: absolute; inset: 0; display: grid; place-items: center; font-size: 2.6rem; font-weight: 900; }
.score-ring .num small { font-size: 1rem; }
.axis-compare { display: grid; gap: 0.75rem; }
.axis-compare .row { display: grid; grid-template-columns: 70px 1fr; gap: 0.8rem; align-items: start; background: var(--surface-2); border-radius: 12px; padding: 0.85rem; }
.axis-compare .row strong { font-size: 0.9rem; }
.axis-compare .row p { font-size: 0.92rem; color: var(--text-2); }
.tag-same { color: var(--success); } .tag-diff { color: var(--sp); }
.compat-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.compat-table td, .compat-table th { padding: 0.45rem 0.5rem; border-bottom: 1px solid var(--border); text-align: left; }
.compat-table .bar { height: 6px; background: var(--surface-3); border-radius: 99px; min-width: 60px; }
.compat-table .bar i { display: block; height: 100%; background: var(--grad); border-radius: 99px; }

/* ---------- Journal ---------- */
.journal-layout { display: grid; grid-template-columns: 1.35fr 1fr; gap: 1.2rem; align-items: start; }
@media (max-width: 900px) { .journal-layout { grid-template-columns: 1fr; } }
.prompt-box { background: var(--accent-soft); border: 1px dashed color-mix(in srgb, var(--accent) 50%, transparent); border-radius: 14px; padding: 1rem 1.1rem; margin-bottom: 1rem; }
.prompt-box small { color: var(--accent-2); font-weight: 800; font-size: 0.76rem; letter-spacing: 0.5px; }
.prompt-box p { font-weight: 700; margin-top: 0.2rem; }
.moods { display: flex; gap: 0.4rem; }
.moods button { flex: 1; font-size: 1.6rem; padding: 0.5rem 0; background: var(--surface-2); border: 2px solid transparent; border-radius: 12px; transition: transform 0.12s; }
.moods button:hover { transform: translateY(-2px); }
.moods button.active { border-color: var(--accent); background: var(--accent-soft); }
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.6rem; }
.stat { background: var(--surface-2); border-radius: 12px; padding: 0.85rem; }
.stat small { color: var(--text-muted); font-size: 0.78rem; display: block; }
.stat strong { font-size: 1.5rem; font-weight: 800; }
.heatmap { display: grid; grid-template-rows: repeat(7, auto); grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; margin-top: 0.6rem; max-width: 300px; }
.heatmap i { width: 100%; aspect-ratio: 1; border-radius: 3px; background: var(--surface-3); display: block; }
.heatmap i[data-m="1"] { background: #f43f5e; } .heatmap i[data-m="2"] { background: #fb923c; }
.heatmap i[data-m="3"] { background: #facc15; } .heatmap i[data-m="4"] { background: #4ade80; }
.heatmap i[data-m="5"] { background: #22c55e; }
.heatmap i.today { outline: 2px solid var(--accent-2); outline-offset: 1px; }
.entry { border-bottom: 1px solid var(--border); padding: 1rem 0; }
.entry:last-child { border-bottom: none; }
.entry-head { display: flex; align-items: center; gap: 0.6rem; justify-content: space-between; }
.entry-head .when { font-weight: 800; font-size: 0.92rem; }
.entry-prompt { font-size: 0.82rem; color: var(--accent-2); margin-top: 0.3rem; }
.entry-text { white-space: pre-wrap; color: var(--text-2); margin-top: 0.4rem; font-size: 0.95rem; }
.entry-tools { display: flex; gap: 0.3rem; }
.entry-tools button { background: none; border: none; color: var(--text-muted); font-size: 0.82rem; padding: 0.2rem 0.4rem; border-radius: 6px; }
.entry-tools button:hover { color: var(--text); background: var(--surface-2); }

/* ---------- Premium / pricing ---------- */
.lock-wrap { position: relative; }
.locked .lock-content { filter: blur(6px); pointer-events: none; user-select: none; max-height: 520px; overflow: hidden; }
.lock-overlay { display: none; }
.locked .lock-overlay { display: flex; position: absolute; inset: 0; align-items: center; justify-content: center; padding: 1rem; background: linear-gradient(to bottom, transparent, var(--bg) 70%); }
.pricing { max-width: 420px; width: 100%; text-align: center; box-shadow: var(--shadow); }
.price { font-size: 2.4rem; font-weight: 900; letter-spacing: -1px; }
.price del { font-size: 1.1rem; color: var(--text-muted); font-weight: 600; margin-right: 0.4rem; }
.ribbon { display: inline-block; background: var(--grad); color: #fff; font-size: 0.78rem; font-weight: 800; padding: 0.3rem 0.8rem; border-radius: 999px; }
.report-section { margin-top: 1.2rem; }
.report-section h3 { display: flex; align-items: center; gap: 0.5rem; font-size: 1.15rem; margin-bottom: 0.6rem; }
.plan { counter-reset: w; display: grid; gap: 0.6rem; }
.plan div { background: var(--surface-2); border-radius: 12px; padding: 0.85rem 1rem 0.85rem 3.2rem; position: relative; }
.plan div::before { counter-increment: w; content: counter(w) "주"; position: absolute; left: 0.9rem; top: 0.85rem; font-weight: 900; color: var(--accent-2); font-size: 0.9rem; }

/* ---------- Affiliate ---------- */
.aff-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.8rem; }
.aff-card { display: flex; flex-direction: column; gap: 0.3rem; padding: 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); text-decoration: none !important; }
.aff-card:hover { border-color: var(--accent); }
.aff-card .emoji { font-size: 1.7rem; }
.aff-card small { color: var(--text-muted); font-size: 0.8rem; }
.aff-card .go { color: var(--accent-2); font-size: 0.82rem; font-weight: 700; margin-top: auto; }
.disclosure { font-size: 0.76rem; color: var(--text-muted); margin-top: 0.6rem; }

/* ---------- Newsletter / chat ---------- */
.cta-band { display: grid; grid-template-columns: 1.2fr 1fr; gap: 1.5rem; align-items: center; }
@media (max-width: 760px) { .cta-band { grid-template-columns: 1fr; } }
.inline-form { display: flex; gap: 0.5rem; }
.inline-form .input { flex: 1; min-width: 0; }
@media (max-width: 440px) { .inline-form { flex-direction: column; } }

/* ---------- Functions page ---------- */
.func-card .code { color: var(--accent-2); font-weight: 800; font-size: 0.84rem; }
.func-card .types { margin-top: 0.7rem; display: flex; flex-wrap: wrap; gap: 0.3rem; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.data-table th, .data-table td { padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
.data-table th { background: var(--surface-2); font-size: 0.82rem; color: var(--text-muted); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--surface-2); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); background: var(--bg-elev); margin-top: 3rem; }
.footer-inner { max-width: 1120px; margin: 0 auto; padding: 2.2rem 1.25rem 2rem; display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 1.5rem; font-size: 0.88rem; }
@media (max-width: 760px) { .footer-inner { grid-template-columns: 1fr 1fr; } .footer-brand { grid-column: 1 / -1; } }
.footer-inner h4 { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 0.6rem; letter-spacing: 0.5px; }
.footer-inner ul { list-style: none; display: grid; gap: 0.35rem; }
.footer-inner a { color: var(--text-2); }
.footer-brand p { color: var(--text-muted); margin-top: 0.5rem; max-width: 340px; }
.footer-legal { max-width: 1120px; margin: 0 auto; padding: 1rem 1.25rem 2rem; border-top: 1px solid var(--border); font-size: 0.76rem; color: var(--text-muted); }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%); z-index: 300; display: grid; gap: 0.5rem; pointer-events: none; width: max-content; max-width: 90vw; }
.toast { background: var(--text); color: var(--bg); padding: 0.7rem 1.1rem; border-radius: 12px; font-size: 0.9rem; font-weight: 600; box-shadow: var(--shadow); animation: fadeUp 0.2s ease; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 250; display: grid; place-items: center; padding: 1rem; background: rgba(0,0,0,0.6); }
.modal-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.4rem; max-width: 440px; width: 100%; max-height: 90vh; overflow: auto; }
.modal-box img { border-radius: 12px; margin: 0.8rem 0; }

/* ---------- Print (premium report PDF) ---------- */
@media print {
  .site-header, .site-footer, .ip-banner, .ad-slot, .no-print, .toast-wrap { display: none !important; }
  body { background: #fff; color: #111; }
  .card { border: 1px solid #ddd; break-inside: avoid; background: #fff; }
  .container { padding: 0; }
  :root { --text: #111; --text-2: #333; --text-muted: #666; --surface: #fff; --surface-2: #f4f4f4; --surface-3: #e5e5e5; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
