/* ==========================================================================
   Modern Service — Modrinth 스타일 참고 테마 (다크 기본 / 라이트 지원)
   ========================================================================== */
:root {
  --bg: #16181c;
  --raised: #26292f;
  --raised-2: #1f2126;
  --button: #33363d;
  --button-hover: #3d414a;
  --divider: #34373e;
  --text: #b0bac5;
  --text-strong: #ecf9fb;
  --text-muted: #8a939d;
  --brand: #1bd96a;
  --brand-hover: #3ee083;
  --brand-ink: #0b2615;
  --brand-soft: rgba(27, 217, 106, .12);
  --red: #ff496e;
  --red-soft: rgba(255, 73, 110, .12);
  --orange: #ffa347;
  --orange-soft: rgba(255, 163, 71, .12);
  --blue: #4f9cff;
  --blue-soft: rgba(79, 156, 255, .12);
  --purple: #c78aff;
  --purple-soft: rgba(199, 138, 255, .12);
  --shadow: 0 2px 8px rgba(0, 0, 0, .25);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, .45);
  --radius: 16px;
  --radius-sm: 10px;
  --header-h: 64px;
  --max: 1280px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f1f3f6;
  --raised: #ffffff;
  --raised-2: #f7f8fa;
  --button: #e9ecf0;
  --button-hover: #dfe3e8;
  --divider: #e2e5ea;
  --text: #4b535c;
  --text-strong: #15181c;
  --text-muted: #7b848e;
  --brand: #00af5c;
  --brand-hover: #009950;
  --brand-ink: #ffffff;
  --brand-soft: rgba(0, 175, 92, .1);
  --red: #e0284d;
  --red-soft: rgba(224, 40, 77, .08);
  --orange: #d97706;
  --orange-soft: rgba(217, 119, 6, .1);
  --blue: #2563eb;
  --blue-soft: rgba(37, 99, 235, .08);
  --purple: #8b3fd9;
  --purple-soft: rgba(139, 63, 217, .08);
  --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-lg: 0 16px 40px rgba(15, 23, 42, .14);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Pretendard Variable', Pretendard, Inter, -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Malgun Gothic', 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
main { flex: 1; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4, h5 { color: var(--text-strong); line-height: 1.3; margin: 0 0 .5em; font-weight: 800; letter-spacing: -.01em; }
h1 { font-size: clamp(1.6rem, 3vw, 2.1rem); }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
img { max-width: 100%; display: block; }
hr { border: 0; border-top: 1px solid var(--divider); margin: 1.5rem 0; }
code, pre { font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; }
code { background: var(--button); padding: .1em .4em; border-radius: 6px; color: var(--text-strong); }
pre { background: var(--raised-2); border: 1px solid var(--divider); padding: 1rem; border-radius: var(--radius-sm); overflow-x: auto; }
pre code { background: none; padding: 0; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { width: 1.15em; height: 1.15em; flex-shrink: 0; vertical-align: -.2em; }
.muted { color: var(--text-muted); }
.strong { color: var(--text-strong); font-weight: 700; }
.text-brand { color: var(--brand); }
.text-red { color: var(--red); }
.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; }
.small { font-size: .85rem; }
.center { text-align: center; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; }

.container { width: 100%; max-width: var(--max); margin: 0 auto; padding-inline: clamp(16px, 3vw, 32px); }
.page { padding-block: 28px 56px; }

/* ───────── Header ───────── */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--raised) 88%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--divider);
}
.header-inner { height: var(--header-h); display: flex; align-items: center; gap: 20px; }
.logo { display: flex; align-items: center; gap: 10px; color: var(--text-strong); font-weight: 800; font-size: 1.12rem; letter-spacing: -.02em; white-space: nowrap; }
.logo:hover { text-decoration: none; }
.logo-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-weight: 900; font-size: 1.05rem; box-shadow: 0 0 0 4px var(--brand-soft); }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a { color: var(--text); font-weight: 600; padding: 8px 14px; border-radius: 999px; display: inline-flex; align-items: center; gap: 6px; }
.nav a:hover { background: var(--button); color: var(--text-strong); text-decoration: none; }
.nav a.active { background: var(--brand-soft); color: var(--brand); }
.header-search { flex: 1; max-width: 380px; margin-left: auto; position: relative; }
.header-search input { width: 100%; padding: 9px 14px 9px 38px; border-radius: 999px; background: var(--button); border: 1px solid transparent; color: var(--text-strong); font: inherit; }
.header-search input:focus { outline: none; border-color: var(--brand); background: var(--raised-2); }
.header-search .icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.header-actions { display: flex; align-items: center; gap: 8px; }
.points-chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-weight: 700; font-size: .9rem; white-space: nowrap; }
.points-chip:hover { text-decoration: none; filter: brightness(1.1); }
.icon-btn { width: 40px; height: 40px; border-radius: 999px; display: inline-grid; place-items: center; background: var(--button); color: var(--text-strong); border: 0; cursor: pointer; }
.icon-btn:hover { background: var(--button-hover); }
.menu-toggle { display: none; }

.dropdown { position: relative; }
.dropdown > summary { list-style: none; cursor: pointer; }
.dropdown > summary::-webkit-details-marker { display: none; }
.avatar { width: 40px; height: 40px; border-radius: 999px; background: linear-gradient(135deg, var(--brand), #0ea5e9); color: #fff; display: grid; place-items: center; font-weight: 800; text-transform: uppercase; }
.dropdown-menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; background: var(--raised); border: 1px solid var(--divider); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 60; }
.dropdown-menu .dm-head { padding: 10px 12px; border-bottom: 1px solid var(--divider); margin-bottom: 6px; }
.dropdown-menu a, .dropdown-menu button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; color: var(--text); font: inherit; font-weight: 600; background: none; border: 0; cursor: pointer; text-align: left; }
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--button); color: var(--text-strong); text-decoration: none; }
.dropdown-menu .danger { color: var(--red); }
.dropdown-menu hr { margin: 6px 0; }

/* ───────── Buttons ───────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 12px; border: 0; font: inherit; font-weight: 700; cursor: pointer; background: var(--button); color: var(--text-strong); white-space: nowrap; transition: background .15s, transform .05s, filter .15s; text-decoration: none !important; line-height: 1.3; }
.btn:hover { background: var(--button-hover); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn-primary { background: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand-hover); }
.btn-danger { background: var(--red-soft); color: var(--red); }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--button); }
.btn-outline { background: transparent; box-shadow: inset 0 0 0 1.5px var(--divider); }
.btn-sm { padding: 6px 12px; border-radius: 9px; font-size: .86rem; }
.btn-lg { padding: 13px 24px; font-size: 1.04rem; border-radius: 14px; }
.btn-block { width: 100%; }
.btn-group { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ───────── Cards / Surfaces ───────── */
.card { background: var(--raised); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-title h2, .card-title h3 { margin: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > .card-title { padding: 20px 22px 4px; margin-bottom: 8px; }
/* 카드 바로 아래 버튼 묶음 간격 (예: 상품 등록 화면 등록하기/취소) */
.card + .btn-group, .card + form { margin-top: 16px; }

/* ───────── Forms ───────── */
.field { margin-bottom: 16px; }
.field > label, .label { display: block; color: var(--text-strong); font-weight: 700; margin-bottom: 6px; font-size: .93rem; }
.field .hint { font-size: .82rem; color: var(--text-muted); margin-top: 6px; }
.input, .select, .textarea { width: 100%; padding: 11px 14px; border-radius: 12px; border: 1.5px solid transparent; background: var(--button); color: var(--text-strong); font: inherit; transition: border-color .15s, background .15s; }
.input::placeholder, .textarea::placeholder { color: var(--text-muted); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); background: var(--raised-2); }
.textarea { min-height: 140px; resize: vertical; line-height: 1.6; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%238a939d' stroke-width='2'%3E%3Cpath d='m2 4 4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
.input-group { display: flex; gap: 8px; }
.input-group .input { flex: 1; min-width: 0; }
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; padding: 4px 0; user-select: none; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); margin: 3px 0 0; flex-shrink: 0; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.verified-badge { display: inline-flex; align-items: center; gap: 6px; color: var(--brand); font-weight: 700; font-size: .9rem; }
.chip-select { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-select label { position: relative; }
.chip-select input { position: absolute; opacity: 0; pointer-events: none; }
.chip-select span { display: inline-block; padding: 7px 14px; border-radius: 999px; background: var(--button); font-weight: 600; font-size: .9rem; cursor: pointer; border: 1.5px solid transparent; color: var(--text); }
.chip-select input:checked + span { background: var(--brand-soft); color: var(--brand); border-color: var(--brand); }
.chip-select input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ───────── Alerts ───────── */
.flash-wrap { display: grid; gap: 10px; margin-bottom: 20px; }
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 13px 16px; border-radius: 12px; font-weight: 600; font-size: .94rem; background: var(--blue-soft); color: var(--blue); border: 1px solid color-mix(in srgb, currentColor 25%, transparent); }
.alert-success { background: var(--brand-soft); color: var(--brand); }
.alert-error { background: var(--red-soft); color: var(--red); }
.alert-warning { background: var(--orange-soft); color: var(--orange); }
.alert .icon { margin-top: 2px; }
.alert-close { margin-left: auto; background: none; border: 0; color: inherit; cursor: pointer; opacity: .7; font-size: 1.2rem; line-height: 1; padding: 0 2px; }

/* ───────── Badges & tags ───────── */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; background: var(--button); color: var(--text); white-space: nowrap; }
.badge-green { background: var(--brand-soft); color: var(--brand); }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-orange { background: var(--orange-soft); color: var(--orange); }
.badge-blue { background: var(--blue-soft); color: var(--blue); }
.badge-purple { background: var(--purple-soft); color: var(--purple); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: .8rem; font-weight: 600; color: var(--text-muted); }
.tag + .tag::before { content: ''; width: 3px; height: 3px; border-radius: 50%; background: var(--text-muted); margin-right: 4px; opacity: .6; }
.price { font-weight: 800; color: var(--text-strong); }
.price.free { color: var(--brand); }

/* ───────── Hero ───────── */
.hero { position: relative; overflow: hidden; padding: clamp(48px, 9vw, 110px) 0 clamp(40px, 7vw, 80px); text-align: center; }
.hero::before { content: ''; position: absolute; inset: -40% -10% auto; height: 120%; background: radial-gradient(closest-side, var(--brand-soft), transparent 70%); pointer-events: none; }
.hero > * { position: relative; }
.hero h1 { font-size: clamp(2rem, 6vw, 3.6rem); font-weight: 900; letter-spacing: -.035em; margin-bottom: 16px; }
.hero h1 em { font-style: normal; color: var(--brand); }
.hero p.lead { font-size: clamp(1rem, 2vw, 1.2rem); max-width: 640px; margin: 0 auto 28px; }
.hero-search { max-width: 620px; margin: 0 auto 22px; position: relative; }
.hero-search-field { position: relative; }
.hero-search input { width: 100%; display: block; text-align: left; text-overflow: ellipsis; padding: 16px 130px 16px 50px; border-radius: 16px; background: var(--raised); border: 1.5px solid var(--divider); color: var(--text-strong); font: inherit; font-size: 1.05rem; box-shadow: var(--shadow-lg); }
.hero-search input:focus { outline: none; border-color: var(--brand); }
.hero-search-field > .icon { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--text-muted); width: 20px; height: 20px; pointer-events: none; }
.hero-search .btn { position: absolute; right: 7px; top: 7px; bottom: 7px; }
.hero-stats { display: flex; justify-content: center; gap: clamp(20px, 5vw, 56px); margin-top: 36px; flex-wrap: wrap; }
.hero-stats div { text-align: center; }
.hero-stats strong { display: block; font-size: 1.6rem; color: var(--text-strong); font-weight: 900; }
.hero-stats span { font-size: .88rem; color: var(--text-muted); }

.section { margin-top: 44px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.section-head h2 { margin: 0; }
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.feature { background: var(--raised); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.feature .fi { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); margin-bottom: 14px; }
.feature h3 { margin-bottom: 6px; }
.feature p { margin: 0; font-size: .94rem; }

/* ───────── Project cards ───────── */
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 14px; }
.pcard { display: grid; grid-template-columns: 76px 1fr; gap: 6px 16px; background: var(--raised); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); color: inherit; transition: transform .15s, box-shadow .15s; position: relative; }
.pcard:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.pcard-icon, .picon { width: 76px; height: 76px; border-radius: 16px; background: var(--button); object-fit: cover; display: grid; place-items: center; color: var(--text-muted); font-size: 1.8rem; font-weight: 900; overflow: hidden; }
.pcard-body { min-width: 0; }
.pcard-title { color: var(--text-strong); font-weight: 800; font-size: 1.08rem; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pcard-summary { margin: 4px 0 8px; font-size: .92rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pcard-foot { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 10px; margin-top: 4px; border-top: 1px solid var(--divider); font-size: .86rem; flex-wrap: wrap; }
.pcard-foot .stats { display: flex; gap: 14px; color: var(--text-muted); }
.pcard-foot .stats span { display: inline-flex; align-items: center; gap: 5px; }

/* 목록형 (둘러보기) */
.plist { display: grid; gap: 12px; }
.prow { display: grid; grid-template-columns: 96px 1fr auto; gap: 18px; background: var(--raised); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); color: inherit; align-items: start; transition: box-shadow .15s; }
.prow:hover { text-decoration: none; box-shadow: var(--shadow-lg); }
.prow .picon { width: 96px; height: 96px; border-radius: 18px; font-size: 2.2rem; }
.prow-title { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; margin-bottom: 4px; }
.prow-title strong { color: var(--text-strong); font-size: 1.2rem; font-weight: 800; }
.prow-title .by { font-size: .88rem; color: var(--text-muted); }
.prow p { margin: 0 0 10px; }
.prow-side { text-align: right; display: grid; gap: 6px; justify-items: end; font-size: .88rem; color: var(--text-muted); white-space: nowrap; }
.prow-side .big { font-size: 1.05rem; color: var(--text-strong); font-weight: 800; display: inline-flex; align-items: center; gap: 6px; }

/* ───────── Browse layout ───────── */
.browse { display: grid; grid-template-columns: 280px 1fr; gap: 24px; align-items: start; }
.filters { position: sticky; top: calc(var(--header-h) + 20px); display: grid; gap: 14px; max-height: calc(100vh - var(--header-h) - 40px); overflow-y: auto; padding-right: 2px; }
.filters .card { padding: 18px; }
.filters h3 { font-size: .95rem; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }
.filter-list { display: grid; gap: 2px; }
.filter-list a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 9px; color: var(--text); font-weight: 600; font-size: .92rem; }
.filter-list a:hover { background: var(--button); text-decoration: none; color: var(--text-strong); }
.filter-list a.on { color: var(--brand); background: var(--brand-soft); }
.filter-list .box { width: 18px; height: 18px; border-radius: 5px; border: 2px solid var(--divider); display: grid; place-items: center; flex-shrink: 0; }
.filter-list a.on .box { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.browse-toolbar { display: flex; gap: 10px; margin-bottom: 14px; align-items: center; flex-wrap: wrap; }
.browse-toolbar .search { flex: 1; min-width: 200px; position: relative; }
.browse-toolbar .search input { padding-left: 40px; }
.browse-toolbar .search .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.browse-toolbar .select { width: auto; min-width: 150px; }
.filter-toggle { display: none; }
.active-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.active-filters a { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-weight: 700; font-size: .84rem; }
.empty { text-align: center; padding: 56px 20px; color: var(--text-muted); }
.empty .icon { width: 44px; height: 44px; margin: 0 auto 12px; opacity: .6; display: block; }

.pagination { display: flex; justify-content: center; gap: 6px; margin-top: 24px; flex-wrap: wrap; }
.pagination a, .pagination span { min-width: 40px; height: 40px; padding: 0 12px; border-radius: 10px; display: inline-grid; place-items: center; background: var(--raised); color: var(--text); font-weight: 700; box-shadow: var(--shadow); }
.pagination a:hover { background: var(--button-hover); text-decoration: none; }
.pagination .current { background: var(--brand); color: var(--brand-ink); }
.pagination .gap { background: none; box-shadow: none; }

/* ───────── Product detail ───────── */
.phead { display: grid; grid-template-columns: 112px 1fr auto; gap: 22px; align-items: center; margin-bottom: 22px; }
.phead .picon { width: 112px; height: 112px; border-radius: 22px; font-size: 2.6rem; box-shadow: var(--shadow); }
.phead h1 { margin-bottom: 6px; }
.phead p { margin: 0 0 10px; font-size: 1.04rem; }
.phead-meta { display: flex; gap: 16px; flex-wrap: wrap; color: var(--text-muted); font-size: .9rem; }
.phead-meta span { display: inline-flex; align-items: center; gap: 6px; }
.phead-actions { display: grid; gap: 8px; justify-items: end; }
.pdetail { display: grid; grid-template-columns: 1fr 320px; gap: 22px; align-items: start; }
.pside { display: grid; gap: 16px; position: sticky; top: calc(var(--header-h) + 20px); }
.pside h3 { font-size: .98rem; margin-bottom: 10px; }
.buy-box .price-big { font-size: 1.9rem; font-weight: 900; color: var(--text-strong); letter-spacing: -.02em; }
.buy-box .price-big.free { color: var(--brand); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: .92rem; margin: 0; }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; color: var(--text-strong); font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.pill-list { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { padding: 4px 11px; border-radius: 999px; background: var(--button); font-size: .82rem; font-weight: 700; color: var(--text); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--divider); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { padding: 10px 16px; font-weight: 700; color: var(--text-muted); border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; gap: 8px; align-items: center; }
.tabs a:hover { color: var(--text-strong); text-decoration: none; }
.tabs a.active { color: var(--brand); border-color: var(--brand); }
.tabs .count { background: var(--button); color: var(--text); padding: 0 8px; border-radius: 999px; font-size: .76rem; }

.prose { color: var(--text); line-height: 1.75; overflow-wrap: anywhere; }
.prose h2, .prose h3, .prose h4, .prose h5 { margin: 1.4em 0 .5em; }
.prose h2:first-child, .prose h3:first-child { margin-top: 0; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li { margin: .25em 0; }
.prose blockquote { margin: 1em 0; padding: .6em 1em; border-left: 4px solid var(--brand); background: var(--raised-2); border-radius: 0 10px 10px 0; }
.legal h2 { font-size: 1.15rem; margin-top: 2em; }
.legal table { width: 100%; border-collapse: collapse; margin: 1em 0; font-size: .92rem; }
.legal th, .legal td { border: 1px solid var(--divider); padding: 8px 12px; text-align: left; vertical-align: top; }
.legal th { background: var(--raised-2); color: var(--text-strong); }

/* ───────── Auth pages ───────── */
.auth-wrap { min-height: calc(100vh - var(--header-h) - 200px); display: grid; place-items: center; padding: 40px 16px 64px; }
.auth-card { width: 100%; max-width: 440px; }
.auth-card.wide { max-width: 560px; }
.auth-card .card { padding: clamp(22px, 5vw, 36px); }
.auth-card h1 { font-size: 1.6rem; text-align: center; }
.auth-card .sub { text-align: center; color: var(--text-muted); margin-bottom: 24px; }
.auth-foot { text-align: center; margin-top: 18px; font-size: .94rem; }
.steps { display: grid; gap: 14px; }
.step { border: 1.5px solid var(--divider); border-radius: 14px; padding: 16px; transition: border-color .2s; }
.step.done { border-color: var(--brand); background: var(--brand-soft); }
.step-head { display: flex; align-items: center; gap: 10px; font-weight: 800; color: var(--text-strong); margin-bottom: 12px; }
.step.done .step-head { margin-bottom: 0; }
.step-num { width: 26px; height: 26px; border-radius: 50%; background: var(--button); display: grid; place-items: center; font-size: .82rem; }
.step.done .step-num { background: var(--brand); color: var(--brand-ink); }
.step-msg { font-size: .86rem; margin-top: 8px; min-height: 1.2em; }
.step-msg.ok { color: var(--brand); }
.step-msg.err { color: var(--red); }
.sms-box { background: var(--raised-2); border: 1px dashed var(--divider); border-radius: 12px; padding: 14px; margin-top: 12px; display: grid; gap: 6px; }
.sms-box .code { font-size: 1.7rem; letter-spacing: .3em; font-weight: 900; color: var(--brand); font-family: ui-monospace, monospace; }
.otp-input { text-align: center; font-size: 1.5rem; letter-spacing: .4em; font-weight: 800; }

/* ───────── Account layout ───────── */
.layout-side { display: grid; grid-template-columns: 250px 1fr; gap: 24px; align-items: start; }
.side-nav { position: sticky; top: calc(var(--header-h) + 20px); background: var(--raised); border-radius: var(--radius); padding: 10px; box-shadow: var(--shadow); display: grid; gap: 2px; }
.side-nav a { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px; color: var(--text); font-weight: 700; font-size: .94rem; }
.side-nav a:hover { background: var(--button); color: var(--text-strong); text-decoration: none; }
.side-nav a.active { background: var(--brand-soft); color: var(--brand); }
.side-nav .sep { height: 1px; background: var(--divider); margin: 6px 4px; }
.side-nav .nav-count { margin-left: auto; background: var(--red); color: #fff; font-size: .72rem; padding: 0 7px; border-radius: 999px; line-height: 1.6; }
.page-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-title h1 { margin: 0; font-size: 1.6rem; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--raised); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); display: block; color: inherit; }
a.stat:hover { text-decoration: none; box-shadow: var(--shadow-lg); }
.stat .label { font-size: .84rem; color: var(--text-muted); font-weight: 600; display: flex; align-items: center; gap: 6px; margin: 0 0 6px; }
.stat .value { font-size: 1.65rem; font-weight: 900; color: var(--text-strong); letter-spacing: -.02em; line-height: 1.2; }
.stat .delta { font-size: .82rem; margin-top: 4px; color: var(--text-muted); }
.stat.accent .value { color: var(--brand); }
.stat.warn .value { color: var(--orange); }
.stat.danger .value { color: var(--red); }

/* ───────── Tables ───────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted); font-weight: 700; padding: 12px 16px; border-bottom: 1px solid var(--divider); white-space: nowrap; background: var(--raised-2); }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--divider); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: color-mix(in srgb, var(--button) 40%, transparent); }
.table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; white-space: nowrap; }
.table .prod { display: flex; align-items: center; gap: 12px; min-width: 200px; }
.table .prod .picon { width: 42px; height: 42px; border-radius: 10px; font-size: 1rem; }
.table a.strong { color: var(--text-strong); }
.plus { color: var(--brand); font-weight: 700; }
.minus { color: var(--red); font-weight: 700; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar .input, .toolbar .select { width: auto; flex: 0 1 auto; }
.toolbar .grow { flex: 1 1 220px; }
.inline-form { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.inline-form .input { padding: 7px 10px; border-radius: 9px; font-size: .88rem; width: 140px; }

details.expand > summary { cursor: pointer; list-style: none; }
details.expand > summary::-webkit-details-marker { display: none; }
.panel { background: var(--raised-2); border: 1px solid var(--divider); border-radius: 12px; padding: 14px; margin-top: 10px; }

.backup-codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; font-family: ui-monospace, monospace; font-weight: 700; color: var(--text-strong); }
.backup-codes span { background: var(--raised-2); padding: 8px 12px; border-radius: 8px; text-align: center; letter-spacing: .1em; }
.qr-box { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.qr-box img { width: 180px; height: 180px; border-radius: 12px; background: #fff; padding: 8px; }

.thread { display: grid; gap: 14px; }
.msg { background: var(--raised-2); border-radius: 14px; padding: 16px 18px; border: 1px solid var(--divider); }
.msg.answer { border-color: var(--brand); background: var(--brand-soft); }
.msg-head { display: flex; justify-content: space-between; gap: 10px; font-size: .86rem; color: var(--text-muted); margin-bottom: 8px; flex-wrap: wrap; }
.msg-head strong { color: var(--text-strong); }
.msg-body { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text-strong); }

/* ───────── Modal (dialog) ───────── */
dialog.modal { border: 0; padding: 0; border-radius: 18px; background: var(--raised); color: var(--text); width: min(480px, calc(100vw - 32px)); box-shadow: var(--shadow-lg); }
dialog.modal::backdrop { background: rgba(0, 0, 0, .55); backdrop-filter: blur(3px); }
.modal-body { padding: 24px; }
.modal-body h3 { margin-bottom: 8px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }

/* ───────── Footer ───────── */
.site-footer { border-top: 1px solid var(--divider); background: var(--raised); margin-top: 40px; padding: 36px 0 28px; font-size: .9rem; }
.footer-grid { display: grid; grid-template-columns: 1.6fr repeat(3, 1fr); gap: 28px; }
.footer-grid h4 { font-size: .9rem; margin-bottom: 10px; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 7px; }
.footer-grid a { color: var(--text); }
.footer-grid a:hover { color: var(--brand); }
.footer-bottom { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-top: 1px solid var(--divider); margin-top: 28px; padding-top: 20px; color: var(--text-muted); font-size: .85rem; }
.github-link { display: inline-flex; align-items: center; gap: 8px; color: var(--text-strong) !important; font-weight: 700; }

/* ───────── Admin ───────── */
.admin-shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.admin-side { background: var(--raised); border-right: 1px solid var(--divider); padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.admin-side .logo { padding: 4px 8px 18px; }
.admin-side .side-label { font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); padding: 10px 12px 4px; font-weight: 800; }
.admin-side a.nav-item { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px; color: var(--text); font-weight: 700; }
.admin-side a.nav-item:hover { background: var(--button); text-decoration: none; color: var(--text-strong); }
.admin-side a.nav-item.active { background: var(--brand-soft); color: var(--brand); }
.admin-side .nav-count { margin-left: auto; background: var(--red); color: #fff; font-size: .72rem; padding: 0 7px; border-radius: 999px; line-height: 1.6; }
.admin-side .side-bottom { margin-top: auto; display: grid; gap: 4px; border-top: 1px solid var(--divider); padding-top: 12px; }
.admin-main { min-width: 0; }
.admin-top { position: sticky; top: 0; z-index: 40; height: var(--header-h); display: flex; align-items: center; gap: 12px; padding: 0 clamp(16px, 3vw, 32px); background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--divider); }
.admin-top h1 { margin: 0; font-size: 1.2rem; }
.admin-top .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.admin-content { padding: 24px clamp(16px, 3vw, 32px) 56px; }
.admin-menu-toggle { display: none; }
.dash-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-bottom: 16px; }
.bar-chart { display: flex; align-items: flex-end; gap: 6px; height: 200px; padding-top: 10px; }
.bar-chart .bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; min-width: 0; }
.bar-chart .bar i { display: block; width: 100%; max-width: 34px; border-radius: 6px 6px 3px 3px; background: linear-gradient(180deg, var(--brand), color-mix(in srgb, var(--brand) 55%, transparent)); min-height: 3px; transition: filter .15s; }
.bar-chart .bar:hover i { filter: brightness(1.2); }
.bar-chart .bar span { font-size: .7rem; color: var(--text-muted); white-space: nowrap; }
.todo-list { display: grid; gap: 8px; }
.todo-list a { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-radius: 12px; background: var(--raised-2); color: var(--text-strong); font-weight: 700; border: 1px solid var(--divider); }
.todo-list a:hover { border-color: var(--brand); text-decoration: none; }
.form-grid { display: grid; grid-template-columns: 1fr 340px; gap: 18px; align-items: start; }
.upload-box { border: 2px dashed var(--divider); border-radius: 14px; padding: 16px; text-align: center; background: var(--raised-2); }
.upload-box input { width: 100%; font: inherit; color: var(--text); }
.upload-box input::file-selector-button { font: inherit; font-weight: 700; border: 0; padding: 8px 14px; border-radius: 9px; background: var(--button); color: var(--text-strong); margin-right: 10px; cursor: pointer; }
.icon-preview { width: 96px; height: 96px; border-radius: 18px; margin: 0 auto 12px; }

/* ───────── Responsive ───────── */
@media (max-width: 1100px) {
  .header-search { max-width: 260px; }
  .pdetail { grid-template-columns: 1fr 280px; }
  .dash-grid, .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
  .nav, .header-search { display: none; }
  .menu-toggle { display: inline-grid; }
  .site-header.open .mobile-menu { display: grid; }
  /* 로고는 왼쪽, 버튼 묶음은 오른쪽 */
  .header-actions { margin-left: auto; }
  .browse { grid-template-columns: 1fr; }
  .filters { position: static; max-height: none; display: none; }
  .filters.open { display: grid; }
  .filter-toggle { display: inline-flex; }
  .pdetail { grid-template-columns: 1fr; }
  .pside { position: static; }
  .layout-side { grid-template-columns: 1fr; }
  .side-nav { position: static; display: flex; overflow-x: auto; padding: 6px; gap: 4px; scrollbar-width: none; }
  .side-nav::-webkit-scrollbar { display: none; }
  .side-nav a { white-space: nowrap; flex-shrink: 0; }
  .side-nav .sep { display: none; }
  .feature-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-grid > :first-child { grid-column: 1 / -1; }
  .admin-shell { grid-template-columns: 1fr; }
  .admin-side { position: fixed; inset: 0 auto 0 0; width: 268px; z-index: 80; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  .admin-shell.open .admin-side { transform: none; }
  .admin-shell.open::after { content: ''; position: fixed; inset: 0; background: rgba(0, 0, 0, .5); z-index: 70; }
  .admin-menu-toggle { display: inline-grid; }
}
@media (max-width: 640px) {
  body { font-size: 14.5px; }
  .header-inner { gap: 10px; }
  .logo-text { display: none; }
  .points-chip { padding: 6px 10px; font-size: .84rem; }
  .card { padding: 18px; border-radius: 14px; }
  .form-row { grid-template-columns: 1fr; }
  .prow { grid-template-columns: 64px 1fr; gap: 12px; }
  .prow .picon { width: 64px; height: 64px; border-radius: 14px; font-size: 1.5rem; }
  .prow-side { grid-column: 1 / -1; display: flex; justify-content: space-between; flex-wrap: wrap; border-top: 1px solid var(--divider); padding-top: 10px; }
  .pcard { grid-template-columns: 60px 1fr; }
  .pcard-icon { width: 60px; height: 60px; border-radius: 13px; }
  .phead { grid-template-columns: 76px 1fr; gap: 14px; }
  .phead .picon { width: 76px; height: 76px; border-radius: 16px; font-size: 1.8rem; }
  .phead-actions { grid-column: 1 / -1; justify-items: stretch; }
  .phead-actions .btn { width: 100%; }
  .hero-search input { padding: 14px 84px 14px 44px; font-size: 1rem; }
  .hero-search-field > .icon { left: 15px; width: 18px; height: 18px; }
  .hero-search .btn { right: 6px; top: 6px; bottom: 6px; padding: 0 16px; border-radius: 11px; }
  .browse-toolbar .select { flex: 1; }
  .table th, .table td { padding: 11px 12px; }
  .stat .value { font-size: 1.35rem; }
  .bar-chart span { display: none; }
  .backup-codes { grid-template-columns: 1fr 1fr; font-size: .85rem; }
  .footer-grid { grid-template-columns: 1fr; }
  .toolbar .input, .toolbar .select, .toolbar .btn { flex: 1 1 100%; width: 100%; }
}

/* 모바일 메뉴 */
.mobile-menu { display: none; padding-block: 12px 16px; border-top: 1px solid var(--divider); gap: 6px; }
.mobile-menu form { position: relative; margin-bottom: 6px; }
.mobile-menu form .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.mobile-menu form input { padding-left: 40px; }
.mobile-menu a { padding: 11px 12px; border-radius: 10px; color: var(--text-strong); font-weight: 700; display: flex; gap: 10px; align-items: center; }
.mobile-menu a:hover { background: var(--button); text-decoration: none; }
@media (min-width: 961px) { .mobile-menu { display: none !important; } }

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