/* 모툰이 v2 디자인 시스템 - 다크 기본, [data-theme="light"] 로 라이트 전환 */

:root {
  --bg: #0e0e11;
  --bg-elev: #17171b;
  --bg-elev-2: #202026;
  --bg-hover: #26262d;
  --line: #2a2a31;
  --text: #f3f3f6;
  --text-2: #a8a8b3;
  --text-3: #6e6e79;
  --brand: #ff4085;
  --brand-strong: #ff2a76;
  --brand-ink: #ffffff;
  --brand-weak: rgba(255, 64, 133, 0.14);
  --gold: #ffc44d;
  --rookie: #3ddc97;
  --rookie-weak: rgba(61, 220, 151, 0.16);
  --overlay: rgba(8, 8, 10, 0.72);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --topbar-bg: rgba(14, 14, 17, 0.82);
  --skeleton: #1d1d22;
  --skeleton-hi: #26262d;

  --radius-s: 8px;
  --radius: 12px;
  --radius-l: 20px;
  --sidebar-w: 240px;
  --sidebar-w-collapsed: 76px;
  --topbar-h: 64px;
  --page-max: 1320px;
  --gutter: 32px;
  --card-w: 164px;
  --font-sans: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #ffffff;
  --bg-elev: #f5f5f8;
  --bg-elev-2: #ececf1;
  --bg-hover: #e6e6ec;
  --line: #e3e3e9;
  --text: #121216;
  --text-2: #565661;
  --text-3: #8d8d98;
  --brand: #e6185f;
  --brand-strong: #cc0f50;
  --brand-weak: rgba(230, 24, 95, 0.09);
  --gold: #b97800;
  --rookie: #0a8a55;
  --rookie-weak: rgba(10, 138, 85, 0.1);
  --overlay: rgba(10, 10, 14, 0.58);
  --shadow: 0 10px 30px rgba(20, 20, 30, 0.12);
  --topbar-bg: rgba(255, 255, 255, 0.86);
  --skeleton: #efeff3;
  --skeleton-hi: #f7f7fa;
  color-scheme: light;
}

/* ---------- 기본 ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body.v2 {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}
/* 초기화 규칙은 :where() 로 우선순위를 0 으로 둬서 컴포넌트 스타일(.chip, .btn 등)을 덮지 않게 한다 */
:where(.v2) a { color: inherit; text-decoration: none; }
:where(.v2) img { display: block; max-width: 100%; }
:where(.v2) button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:where(.v2) :is(h1, h2, h3, p) { margin: 0; }
:where(.v2) :focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
/* .btn 등 display 를 정한 컴포넌트에서도 hidden 속성이 항상 이기게 한다 */
[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: 20px; height: 20px; flex: none; }

/* ---------- 레이아웃 ---------- */
.app { min-height: 100vh; }
.main-col { margin-left: var(--sidebar-w); min-width: 0; transition: margin-left .2s ease; }
.app[data-sidebar="collapsed"] .main-col { margin-left: var(--sidebar-w-collapsed); }
.page { max-width: var(--page-max); margin: 0 auto; padding: 8px var(--gutter) 64px; }

/* 사이드바 */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 40;
  display: flex; flex-direction: column; gap: 4px;
  padding: 18px 14px; background: var(--bg); border-right: 1px solid var(--line);
  overflow-y: auto; transition: width .2s ease;
}
.sidebar-top { display: flex; align-items: center; justify-content: space-between; padding: 4px 8px 18px; }
.logo img { height: 18px; width: auto; }
.sidebar-toggle { width: 32px; height: 32px; display: grid; place-items: center; border-radius: var(--radius-s); color: var(--text-2); }
.sidebar-toggle:hover { background: var(--bg-hover); color: var(--text); }
.nav-group { display: flex; flex-direction: column; gap: 2px; padding: 6px 0; }
.nav-group + .nav-group { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 12px; }
.nav-label { font-size: 12px; color: var(--text-3); padding: 2px 12px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; height: 42px; padding: 0 12px;
  border-radius: var(--radius); color: var(--text-2); font-weight: 500; white-space: nowrap;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item[aria-current="page"] { background: var(--brand-weak); color: var(--brand); font-weight: 700; }
.sidebar-cta {
  margin-top: auto; padding: 16px; border-radius: var(--radius); background: var(--bg-elev);
  display: flex; flex-direction: column; gap: 10px; font-size: 13px; color: var(--text-2);
}
.sidebar-cta strong { color: var(--text); font-size: 14px; }
.app[data-sidebar="collapsed"] .sidebar { width: var(--sidebar-w-collapsed); }
.app[data-sidebar="collapsed"] .sidebar .nav-text,
.app[data-sidebar="collapsed"] .sidebar .nav-label,
.app[data-sidebar="collapsed"] .sidebar .sidebar-cta,
.app[data-sidebar="collapsed"] .sidebar .logo { display: none; }
.app[data-sidebar="collapsed"] .sidebar-top { justify-content: center; }
.app[data-sidebar="collapsed"] .nav-item { justify-content: center; padding: 0; }

/* 상단바 */
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h);
  display: flex; align-items: center; gap: 16px; padding: 0 var(--gutter);
  background: var(--topbar-bg); backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid transparent;
}
.topbar.is-scrolled { border-bottom-color: var(--line); }
.topbar .logo { display: none; flex: none; }
.search { position: relative; flex: 1; min-width: 0; max-width: 520px; margin: 0 auto; }
.search-box {
  display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 14px;
  border-radius: 999px; background: var(--bg-elev); border: 1px solid var(--line); color: var(--text-3);
}
.search-box:focus-within { border-color: var(--brand); color: var(--text-2); }
.search-box input { flex: 1; min-width: 0; width: 100%; height: 100%; padding: 0; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; }
.search-box input::placeholder { color: var(--text-3); }
.search-panel {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 50;
  max-height: min(70vh, 520px); overflow-y: auto; padding: 8px;
  border-radius: var(--radius); background: var(--bg-elev); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.search-panel[hidden] { display: none; }
.search-item { display: flex; gap: 12px; align-items: center; padding: 8px; border-radius: var(--radius-s); }
.search-item:hover, .search-item.is-active { background: var(--bg-hover); }
.search-item img { width: 44px; height: 58px; object-fit: cover; border-radius: 6px; background: var(--skeleton); }
.search-item .t { font-weight: 600; }
.search-item .s { font-size: 13px; color: var(--text-3); display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.search-empty { padding: 20px; text-align: center; color: var(--text-3); font-size: 14px; }
.search-all { display: block; margin-top: 4px; padding: 10px 8px; border-top: 1px solid var(--line); text-align: center; font-size: 13px; font-weight: 600; color: var(--brand); }
.search-all:hover { background: var(--bg-hover); border-radius: var(--radius-s); }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 999px; color: var(--text-2); }
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.theme-toggle .sun { display: none; }
:root[data-theme="light"] .theme-toggle .sun { display: block; }
:root[data-theme="light"] .theme-toggle .moon { display: none; }

/* 버튼 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 40px; padding: 0 18px; border-radius: 999px; font-weight: 600; font-size: 14px; white-space: nowrap;
  transition: background .15s ease, transform .15s ease;
}
.btn-primary { background: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand-strong); }
.btn-ghost { background: var(--bg-elev-2); color: var(--text); }
.btn-ghost:hover { background: var(--bg-hover); }
.btn-sm { height: 34px; padding: 0 14px; font-size: 13px; }
.btn-block { width: 100%; }

/* 사용자 메뉴 */
.user-menu { position: relative; }
.avatar {
  width: 36px; height: 36px; border-radius: 999px; display: grid; place-items: center;
  background: var(--brand-weak); color: var(--brand); font-weight: 800;
}
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 200px; padding: 6px; z-index: 50;
  border-radius: var(--radius); background: var(--bg-elev); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.menu[hidden] { display: none; }
.menu-head { padding: 10px 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu-head strong { display: block; }
.menu-head span { font-size: 12px; color: var(--text-3); }
.menu a { display: block; padding: 9px 12px; border-radius: var(--radius-s); font-size: 14px; color: var(--text-2); }
.menu a:hover { background: var(--bg-hover); color: var(--text); }

/* ---------- 칩 ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 12px 0 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 36px; padding: 0 16px; border-radius: 999px; font-size: 14px; font-weight: 600;
  background: var(--bg-elev); color: var(--text-2); border: 1px solid var(--line);
}
.chip:hover { color: var(--text); background: var(--bg-hover); }
.chip[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }

/* ---------- 히어로 ---------- */
.hero { position: relative; margin-top: 16px; }
.hero-track {
  display: flex; gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth;
  scrollbar-width: none; border-radius: var(--radius-l);
}
.hero-track::-webkit-scrollbar { display: none; }
.hero-slide {
  position: relative; flex: 0 0 100%; scroll-snap-align: start; overflow: hidden;
  height: clamp(260px, 30vw, 380px); border-radius: var(--radius-l); background: var(--bg-elev);
  display: flex; align-items: center;
}
.hero-bg {
  position: absolute; inset: -40px; background-image: var(--img); background-size: cover; background-position: center;
  filter: blur(28px) saturate(140%); opacity: .55; transform: scale(1.05);
}
.hero-slide::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, var(--bg) 0%, rgba(0,0,0,0) 75%); opacity: .9; }
:root[data-theme="light"] .hero-slide::after { background: linear-gradient(90deg, rgba(255,255,255,.92) 0%, rgba(255,255,255,0) 75%); }
.hero-body { position: relative; z-index: 1; flex: 1; min-width: 0; padding: 0 clamp(24px, 5vw, 56px); display: flex; flex-direction: column; gap: 12px; max-width: 560px; }
.hero-kind { align-self: flex-start; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--brand); color: var(--brand-ink); }
.hero-title {
  font-size: clamp(24px, 3.2vw, 40px); font-weight: 800; line-height: 1.2; letter-spacing: -0.03em;
  word-break: keep-all; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.hero-sub { color: var(--text-2); font-size: 15px; }
.hero-body .btn { align-self: flex-start; margin-top: 6px; }
.hero-cover {
  position: relative; z-index: 1; height: 82%; aspect-ratio: 3 / 4; margin-right: clamp(24px, 6vw, 80px);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); background: var(--skeleton); flex: none;
}
.hero-cover img { width: 100%; height: 100%; object-fit: cover; }
.hero-nav { position: absolute; right: 16px; bottom: 16px; z-index: 2; display: flex; align-items: center; gap: 8px; }
.hero-count { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--overlay); color: #fff; }
.hero-arrow { width: 34px; height: 34px; border-radius: 999px; display: grid; place-items: center; background: var(--overlay); color: #fff; }

/* ---------- 섹션 / 레일 ---------- */
.section { margin-top: 44px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-title { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
.section-title small { display: block; font-size: 13px; font-weight: 500; color: var(--text-3); margin-top: 2px; letter-spacing: 0; }
.section-more { font-size: 13px; color: var(--text-3); display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; }
.section-more:hover { color: var(--text); }

.rail-wrap { position: relative; }
.rail {
  display: grid; grid-auto-flow: column; grid-auto-columns: var(--card-w); gap: 14px;
  overflow-x: auto; scroll-snap-type: x proximity; scroll-behavior: smooth; padding-bottom: 6px; scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }
.rail > * { scroll-snap-align: start; }
.rail-btn {
  position: absolute; top: calc(var(--card-w) * 0.66 - 18px); z-index: 2; width: 36px; height: 36px; border-radius: 999px;
  display: grid; place-items: center; background: var(--bg-elev-2); color: var(--text); box-shadow: var(--shadow);
  opacity: 0; transition: opacity .15s ease;
}
.rail-btn.prev { left: -14px; }
.rail-btn.next { right: -14px; }
.rail-wrap:hover .rail-btn:not([disabled]) { opacity: 1; }
.rail-btn[disabled] { pointer-events: none; }

/* ---------- 카드 ---------- */
.card { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.card-cover {
  position: relative; aspect-ratio: 3 / 4; border-radius: var(--radius); overflow: hidden; background: var(--skeleton);
}
.card-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
.card:hover .card-cover img { transform: scale(1.04); }
.badges { position: absolute; top: 8px; left: 8px; display: flex; gap: 4px; flex-wrap: wrap; }
.badge { padding: 2px 7px; border-radius: 6px; font-size: 11px; font-weight: 800; line-height: 18px; background: var(--overlay); color: #fff; }
.badge.brand { background: var(--brand); }
.badge.touch { background: #7a5cff; }
.card-title { font-weight: 700; font-size: 15px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.card-author { display: flex; align-items: center; gap: 4px; min-width: 0; font-size: 13px; color: var(--text-3); }
.card-author-name { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 작가 등급 배지 (content/author_tiers.py): 공식은 브랜드색, 신예는 초록. 이름이 길어도 보이도록 이름 앞에 둔다 */
.tier { flex: none; display: inline-flex; align-items: center; height: 16px; padding: 0 5px; border-radius: 4px; font-size: 10px; font-weight: 800; line-height: 1; }
.tier-official { background: var(--brand); color: var(--brand-ink); }
.tier-rookie { background: var(--rookie-weak); color: var(--rookie); }
.card-meta { display: flex; gap: 10px; font-size: 12px; color: var(--text-3); }
.card-meta .star { color: var(--gold); }
.card-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

/* 표지 이미지를 못 불러왔을 때 */
.is-broken { background: linear-gradient(135deg, var(--brand-weak), var(--bg-elev-2)); }
.is-broken img { visibility: hidden; }
.card-cover.is-broken::after, .hero-cover.is-broken::after, .wide-card.is-broken::after {
  content: "MOTOONI"; position: absolute; inset: 0; display: grid; place-items: center;
  font-weight: 900; font-size: 13px; letter-spacing: .12em; color: var(--text-3);
}

/* 랭킹 카드: 큰 순위 숫자 */
.rail.rank { grid-auto-columns: calc(var(--card-w) + 34px); }
.rank-card { display: grid; grid-template-columns: 34px 1fr; align-items: end; }
.rank-num {
  font-size: 64px; font-weight: 900; line-height: .8; letter-spacing: -0.06em; color: var(--bg);
  -webkit-text-stroke: 2px var(--text-2); margin-bottom: 64px; margin-right: -12px; z-index: 1; font-style: italic;
}
.rank-card:nth-child(-n+3) .rank-num { -webkit-text-stroke-color: var(--brand); }

/* 하이라이트(가로형) 카드 */
.rail.wide { grid-auto-columns: minmax(280px, 32%); }
.wide-card { position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; background: var(--skeleton); }
.wide-card img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
.wide-card:hover img { transform: scale(1.04); }
.wide-card .info { position: absolute; inset: auto 0 0 0; padding: 40px 16px 14px; background: linear-gradient(0deg, rgba(0,0,0,.85), rgba(0,0,0,0)); color: #fff; }
.wide-card .info strong { display: block; font-size: 16px; }
.wide-card .info span { font-size: 13px; opacity: .8; }

/* 그리드 (칩 피드 / 장르) */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 22px 16px; }
.feed-status { padding: 28px 0; text-align: center; color: var(--text-3); font-size: 14px; }

/* 탭 (장르 섹션) */
.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 18px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; height: 34px; padding: 0 14px; border-radius: 999px; font-size: 14px; font-weight: 600; color: var(--text-3); }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); background: var(--bg-elev-2); }

/* 스켈레톤 */
.skeleton { background: linear-gradient(90deg, var(--skeleton) 25%, var(--skeleton-hi) 37%, var(--skeleton) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: var(--radius); }
.skeleton.cover { aspect-ratio: 3 / 4; }
.skeleton.line { height: 12px; margin-top: 8px; width: 70%; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* 창작자 띠 배너 */
.band {
  display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap;
  padding: 28px clamp(20px, 4vw, 40px); border-radius: var(--radius-l);
  background: radial-gradient(120% 140% at 0% 0%, rgba(255, 64, 133, .35), transparent 55%), var(--bg-elev);
  border: 1px solid var(--line);
}
.band h2 { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.band p { color: var(--text-2); margin-top: 6px; }
.band-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* 커뮤니티 */
.board-cols { display: grid; grid-template-columns: 1fr 2fr; gap: 16px; }
.board-box { padding: 18px 20px; border-radius: var(--radius); background: var(--bg-elev); border: 1px solid var(--line); }
.board-box h3 { font-size: 15px; font-weight: 800; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; }
.board-list { list-style: none; margin: 0; padding: 0; }
.board-list li a { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 14px; }
.board-list li:first-child a { border-top: 0; }
.board-list .t { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-list .m { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.board-list .c { color: var(--brand); font-weight: 700; font-size: 12px; }

/* 푸터 */
.footer { border-top: 1px solid var(--line); margin-top: 40px; }
.footer-inner { max-width: var(--page-max); margin: 0 auto; padding: 28px var(--gutter) 40px; font-size: 12px; color: var(--text-3); display: flex; flex-direction: column; gap: 10px; }
.footer-links { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); }
.footer-links a:hover { color: var(--text); }

/* ---------- 공통 조각 (작품 상세·뷰어·전체 작품·검색) ---------- */
.pill {
  display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: var(--bg-elev-2); color: var(--text-2);
}
.pill-brand { background: var(--brand-weak); color: var(--brand); }
.tag { font-size: 13px; color: var(--text-3); }
.avatar.sm { width: 28px; height: 28px; font-size: 12px; flex: none; }
.btn-lg { height: 48px; padding: 0 22px; font-size: 15px; }
.icon-btn-lg { width: 48px; height: 48px; background: var(--bg-elev-2); }
.empty-state { min-height: 50vh; display: grid; place-content: center; justify-items: center; gap: 12px; text-align: center; padding: 40px 16px; }
.empty-state h1 { font-size: 22px; font-weight: 800; }
.empty-state p { color: var(--text-2); }
.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 120;
  padding: 10px 18px; border-radius: 999px; background: var(--text); color: var(--bg); font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow);
}
.toast[hidden] { display: none; }

/* 모바일 하단 탭바 */
.tabbar { display: none; }

/* 온보딩 모달 */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; background: var(--overlay); }
.modal[hidden] { display: none; }
.modal-card { width: min(560px, 100%); padding: 28px; border-radius: var(--radius-l); background: var(--bg-elev); border: 1px solid var(--line); box-shadow: var(--shadow); position: relative; }
.modal-card h2 { font-size: 22px; font-weight: 800; text-align: center; letter-spacing: -0.02em; }
.modal-card > p { text-align: center; color: var(--text-2); margin-top: 6px; font-size: 14px; }
.modal-skip { position: absolute; top: 16px; right: 18px; font-size: 13px; color: var(--text-3); }
.taste-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 22px 0; }
.taste {
  aspect-ratio: 3 / 4; border-radius: var(--radius); border: 2px solid transparent; position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: flex-end; padding: 12px; text-align: left; color: #fff;
}
.taste::before { content: ""; position: absolute; inset: 0; background: var(--taste-bg); }
.taste::after { content: ""; position: absolute; inset: 0; background: linear-gradient(0deg, rgba(0,0,0,.7), rgba(0,0,0,0) 60%); }
.taste > * { position: relative; z-index: 1; }
.taste strong { font-size: 16px; }
.taste span { font-size: 12px; opacity: .85; }
.taste[aria-pressed="true"] { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-weak); }
.taste-check { position: absolute; top: 10px; left: 10px; width: 22px; height: 22px; border-radius: 999px; border: 2px solid rgba(255,255,255,.8); }
.taste[aria-pressed="true"] .taste-check { background: var(--brand); border-color: var(--brand); opacity: 1; }
.taste[aria-pressed="true"] .taste-check::after {
  content: ""; position: absolute; left: 5px; top: 1px; width: 6px; height: 11px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
/* 하나를 고르면 나머지는 흐리게 */
.taste-options:has([aria-pressed="true"]) .taste:not([aria-pressed="true"]) { opacity: .55; }
/* 대표 작품 표지: 그라데이션 위에 깔고 취향 색을 반투명하게 입힌다 (표지가 없으면 그라데이션만) */
.taste > .taste-art { position: absolute; inset: 0; z-index: 0; opacity: 1; }
.taste-art img { width: 100%; height: 100%; object-fit: cover; }
.taste-art::after { content: ""; position: absolute; inset: 0; background: var(--taste-bg); opacity: .5; }
/* 창이 열릴 때 창 자체에 포커스를 주므로 테두리는 그리지 않는다 */
.modal-card:focus, .modal-card:focus-visible { outline: none; }
/* 고르기 전 '추천받기' 처럼 비활성 버튼은 눌리지 않는 모양으로 */
.btn:disabled { opacity: .4; cursor: not-allowed; pointer-events: none; }

/* ---------- 반응형 ---------- */
@media (max-width: 1279px) {
  :root { --card-w: 150px; }
}
@media (max-width: 1023px) {
  :root { --gutter: 16px; --card-w: 128px; --topbar-h: 56px; }
  .sidebar { display: none; }
  .main-col, .app[data-sidebar="collapsed"] .main-col { margin-left: 0; }
  .topbar .logo { display: block; }
  .topbar-actions .hide-m { display: none; }
  .page { padding-bottom: 96px; }
  .hero-slide { height: auto; min-height: 220px; flex-direction: row-reverse; justify-content: flex-end; padding: 20px 0; }
  .hero-cover { height: auto; width: 34%; max-width: 160px; margin: 0 0 0 20px; }
  .hero-body { padding: 0 16px; gap: 8px; }
  .hero-title { font-size: 22px; }
  .hero-sub { font-size: 13px; }
  .hero-body .btn { height: 36px; padding: 0 14px; font-size: 13px; }
  .hero-nav { top: 12px; right: 12px; bottom: auto; }
  .hero-arrow { display: none; }
  .board-cols { grid-template-columns: 1fr; }
  .rail.wide { grid-auto-columns: 78%; }
  .rank-num { font-size: 52px; margin-bottom: 54px; }
  .rail-btn { display: none; }
  .tabbar {
    position: fixed; inset: auto 0 0 0; z-index: 40; display: grid; grid-template-columns: repeat(4, 1fr);
    height: calc(60px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: var(--topbar-bg); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line);
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; color: var(--text-3); }
  .tabbar a[aria-current="page"] { color: var(--brand); }
  .search { max-width: none; }
}
@media (max-width: 599px) {
  .topbar { gap: 10px; }
  .topbar .logo img { height: 14px; }
  .topbar-actions { gap: 4px; }
  .search-box { height: 38px; padding: 0 12px; }
  .grid { grid-template-columns: repeat(3, 1fr); gap: 16px 10px; }
  .card-title { font-size: 14px; }
  .section-title { font-size: 18px; }
  .band h2 { font-size: 19px; }
  .taste-options { gap: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* 메인 '이어서 보기' 카드: 조회수 대신 다음 화 안내 */
.card-progress { color: var(--brand); font-weight: 600; }

/* ---------- AI 캐릭터 카드 (v2/_char_tile.html: 둘러보기·메인 줄·검색·작품 상세) ---------- */
.cc-tile { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.cc-tile-img { position: relative; aspect-ratio: 1 / 1; border-radius: var(--radius-l); overflow: hidden; background: var(--bg-elev-2); }
.cc-tile-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
.cc-tile:hover .cc-tile-img img { transform: scale(1.04); }
.cc-tile-img .badge { position: absolute; top: 8px; left: 8px; }
.cc-initial { width: 100%; height: 100%; display: grid; place-items: center; font-size: 44px; font-weight: 800; color: var(--brand); background: var(--brand-weak); }
.cc-tile-name { font-size: 15px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-tile-work { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-tile-intro { font-size: 13px; color: var(--text-2); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cc-tile-meta { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-3); }
.cc-tile-meta .icon { width: 13px; height: 13px; }
