/* WITU 웹 — 시안 "[와이어프레임] 캐릭터 탐색 · PC 센터 칼럼(Whif형) 컬러 1920×1080" 기준.
   치수는 시안의 px 그대로이고, 칼럼보다 좁은 화면에서는 칼럼이 화면 폭을 따릅니다. */

:root {
    /* 어두운 화면이라고 브라우저에 알려, 기본 스크롤 막대 · 입력칸 등이 밝게 그려지지 않게 */
    color-scheme: dark;
    --bg-outer: #0b0a10;
    --bg: #15131c;
    --surface: #1f1c28;
    --surface-raised: #2a2633;
    --surface-selected: #2c2640;
    --border: #3a3546;
    --placeholder: #3a3446;
    --accent: #b7a4f5;
    --on-accent: #1a1722;
    --text: #f2eff7;
    --text-sub: #b9b3c6;
    --text-mute: #8c8699;
    --alert: #ff6b35;
    --danger: #ff4554;
    --adult: #e54850;
    /* 홈 탭 강조색 (Figma 561:2 — 두근 랭킹 분홍 · 1위 금색 · 이야기 초록) */
    --rank-pink: #ff7fa8;
    --gold: #f5c76b;
    --story-green: #5fd3a8;

    --column-home: 880px;
    --column-onboarding: 560px;
    --sheet-width: 528px;
    --gutter: 16px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    height: 100%;
    background: var(--bg-outer);
    color: var(--text);
    font-family: "Noto Sans KR", system-ui, -apple-system, "Malgun Gothic", sans-serif;
    font-size: 15px;
    line-height: 1.2;
    -webkit-font-smoothing: antialiased;
}

button {
    font: inherit;
    color: inherit;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    text-align: inherit;
}

button:disabled { cursor: default; }

button:focus-visible, .sheet:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.sheet:focus, .login-prompt:focus { outline: none; }

h1, h2, h3, p { margin: 0; }

img { display: block; }

/* ───────── 공통 틀 ───────── */

/* 앱 진입 인트로 (앱 IntroSplashView와 같은 움직임 — 심볼이 한 번 '톡' 커졌다 자리 잡고, 빛이 숨 쉬듯 번진 뒤 걷힘).
   크기는 앱 시안(폭 1080)의 비율 그대로: 심볼 443 → 41%, 빛 1100 → 102%, 중심은 가운데보다 조금 위 */
.intro {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    background: var(--bg);
    transition: opacity 0.4s ease-in, visibility 0s linear 0.4s;
    /* 화면이 끝내 뜨지 않아도(오류) 인트로가 가리고 있지 않게 */
    animation: intro-giveup 0.4s ease-in 12s forwards;
}

.intro > img { grid-area: 1 / 1; translate: 0 -3vh; pointer-events: none; user-select: none; }

.intro__glow { width: min(102vw, 520px); animation: intro-breath 1.6s ease-in-out both; }

.intro__symbol { width: min(41vw, 210px); animation: intro-pulse 0.7s ease-in-out both; }

/* intro.js가 화면이 준비되면 붙입니다 */
.intro.is-done { opacity: 0; visibility: hidden; pointer-events: none; }

@keyframes intro-pulse { 50% { scale: 1.06; } }

@keyframes intro-breath { 50% { scale: 1.08; } }

@keyframes intro-giveup { to { opacity: 0; visibility: hidden; pointer-events: none; } }

@media (prefers-reduced-motion: reduce) {
    .intro__glow, .intro__symbol { animation: none; }
}

.stage {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    justify-content: center;
    background: var(--bg-outer);
}

.column {
    position: relative;
    width: 100%;
    max-width: var(--column-home);
    background: var(--bg);
}

.column--narrow { max-width: var(--column-onboarding); }

.divider {
    height: 1px;
    margin: 0;
    border: 0;
    background: var(--border);
}

.icon { display: block; flex: none; }

.icon-button {
    display: inline-grid;
    place-items: center;
    color: var(--text);
}

.icon-button--round {
    width: 36px;
    height: 36px;
    border: 1.5px solid var(--text);
    border-radius: 50%;
}

/* 알약 모양 표시 (준비 중 · 오늘의 한 장면 · 관계 단계 · 해시태그) */
.badge {
    display: inline-flex;
    align-items: center;
    height: 30px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-sub);
    font-size: 13px;
    white-space: nowrap;
}

.badge--small { height: 22px; padding: 0 10px; font-size: 11px; color: var(--text); }
.badge--tiny { height: 19px; padding: 0 7px; font-size: 10px; }
.badge--button { height: 33px; padding: 0 16px; font-size: 13px; font-weight: 500; color: var(--text); }

/* 고르는 칩 (취향) */
.chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    height: 35px;
    padding: 0 16px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-sub);
    font-size: 13px;
    white-space: nowrap;
}

.chip.is-selected {
    border-color: var(--accent);
    background: var(--accent);
    color: var(--on-accent);
    font-weight: 500;
}

.chip:disabled { opacity: 0.5; }

.chip--wide { height: 46px; padding: 0; font-size: 15px; }
.chip--small { height: 29px; padding: 0 14px; font-size: 14px; }

/* 라디오 동그라미 — 부모가 .is-selected면 채워집니다 */
.radio {
    position: relative;
    flex: none;
    width: 20px;
    height: 20px;
    border: 2px solid var(--text-mute);
    border-radius: 50%;
}

.radio--small { width: 18px; height: 18px; }

.is-selected > .radio { border-color: var(--accent); }

.is-selected > .radio::after {
    content: "";
    position: absolute;
    inset: 3px;
    border-radius: 50%;
    background: var(--accent);
}

/* 큰 보라 버튼 */
.cta {
    display: block;
    width: 100%;
    height: 64px;
    border-radius: 14px;
    background: var(--accent);
    color: var(--on-accent);
    font-size: 18px;
    font-weight: 700;
    text-align: center;
}

.cta:disabled { opacity: 0.4; }

/* 가로로 넘기는 줄 — 스크롤 막대는 숨깁니다 */
.h-scroll {
    display: flex;
    overflow-x: auto;
    scrollbar-width: none;
}

.h-scroll::-webkit-scrollbar { display: none; }

/* ───────── 온보딩 (P01~P03) ───────── */

.onb {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 40px 32px clamp(24px, 9vh, 96px);
}

.onb__dots {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.onb__dot {
    width: 12px;
    height: 12px;
    border: 1.5px solid var(--text-mute);
    border-radius: 50%;
}

.onb__dot.is-on { border-color: var(--accent); background: var(--accent); }

.onb__logo {
    margin-top: 10px;
    color: var(--accent);
    font-size: 28px;
    font-weight: 700;
    line-height: 34px;
    text-align: center;
}

.onb__counter {
    height: 0;
    margin-top: 8px;
    padding-right: 5px;
    color: var(--accent);
    font-size: 17px;
    font-weight: 700;
    line-height: 20px;
    text-align: right;
}

.onb__title {
    margin-top: 32px;
    font-size: 26px;
    font-weight: 700;
    line-height: 31px;
}

.onb__counter + .onb__title { margin-top: 24px; }

.onb__subtitle {
    margin-top: 13px;
    color: var(--text-sub);
    font-size: 15px;
    line-height: 18px;
}

/* 버튼은 칼럼 아래쪽에 붙고, 내용이 길면 내용 바로 아래(28px)에 옵니다 */
.onb__body { margin-top: 31px; margin-bottom: 28px; }

.onb__cta { margin-top: auto; flex: none; }

.onb__label {
    margin-top: 26px;
    font-size: 19px;
    font-weight: 700;
    line-height: 23px;
}

.onb__helper {
    margin-top: 14px;
    color: var(--text-mute);
    font-size: 14px;
    line-height: 17px;
}

.onb .divider { margin-top: 21px; }

.onb .divider + .onb__label { margin-top: 19px; }

/* 성향 카드 */
.genre-list { display: grid; gap: 12px; }

.genre-card {
    position: relative;
    display: block;
    width: 100%;
    height: 150px;
    overflow: hidden;
    border-radius: 16px;
    background: var(--placeholder);
}

.genre-card.is-selected { box-shadow: 0 0 0 3px var(--accent), 0 0 36px rgba(183, 164, 245, 0.45); }

.genre-card__image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: right center;
}

/* 그림 왼쪽에 글자가 놓이므로 왼쪽을 어둡게 */
.genre-card::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(90deg, rgba(21, 19, 28, 0.9) 0%, rgba(21, 19, 28, 0.9) 34%, rgba(21, 19, 28, 0) 62%);
}

.genre-card__name, .genre-card__desc, .genre-card__badge { position: absolute; z-index: 3; }

.genre-card__name {
    left: 28px;
    top: 28px;
    font-size: 36px;
    font-weight: 700;
    line-height: 43px;
}

.genre-card.is-selected .genre-card__name { color: var(--accent); }

.genre-card__desc {
    left: 28px;
    top: 96px;
    color: var(--text-sub);
    font-size: 15px;
    line-height: 18px;
}

.genre-card__dim {
    position: absolute;
    inset: 0;
    z-index: 2;
    background: rgba(21, 19, 28, 0.55);
}

.genre-card.is-closed .genre-card__name, .genre-card.is-closed .genre-card__desc { opacity: 0.45; }

.genre-card__badge { right: 27px; top: 16px; }

/* 대표 이미지 + 설명 글 상자 */
.art {
    position: relative;
    overflow: hidden;
    border-radius: 16px;
    background: var(--placeholder);
}

.art img { width: 100%; height: 100%; object-fit: cover; }

.art--pov { height: 260px; }
.art--pov img { object-position: center 18%; }

.art--taste { height: 250px; margin-top: 23px; }
.art--taste img { object-position: center 24%; }

.art__caption {
    position: absolute;
    padding: 14px 10px;
    border-radius: 10px;
    background: rgba(21, 19, 28, 0.9);
    font-weight: 500;
    white-space: pre-line;
}

.art__caption--right {
    right: 20px;
    top: 78px;
    width: 180px;
    font-size: 17px;
    line-height: 26px;
    text-align: right;
}

.art__caption--left {
    left: 20px;
    bottom: 22px;
    width: 240px;
    padding: 11px 14px;
    font-size: 19px;
    line-height: 28px;
}

/* 성별 */
.gender-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 15px;
}

.radio-pill {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 50px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-sub);
    font-size: 15px;
}

.radio-pill.is-selected {
    border-color: var(--accent);
    background: var(--accent);
    color: var(--on-accent);
    font-weight: 500;
}

.radio-pill.is-selected > .radio { border-color: var(--surface); }
.radio-pill.is-selected > .radio::after { background: #fff; }

/* 시점 */
.pov-list { display: grid; gap: 12px; margin-top: 17px; }

.pov-card {
    display: grid;
    grid-template-columns: 20px 1fr;
    column-gap: 16px;
    row-gap: 12px;
    align-items: center;
    height: 80px;
    padding: 0 24px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
}

.pov-card.is-selected {
    border: 2px solid var(--accent);
    padding: 0 23px;
    background: var(--surface-selected);
}

.pov-card > .radio { grid-row: 1 / span 2; }

.pov-card__title { align-self: end; font-size: 17px; font-weight: 500; line-height: 20px; }

.pov-card__desc { align-self: start; color: var(--text-mute); font-size: 14px; line-height: 17px; }

/* 취향 */
.taste__group {
    color: var(--accent);
    font-size: 17px;
    font-weight: 700;
    line-height: 20px;
}

.taste__chips + .taste__group { margin-top: 26px; }

.taste__chips {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: 16px;
}

.onb .divider--taste { margin-top: 26px; }

.taste__preview-label {
    margin-top: 15px;
    color: var(--text-sub);
    font-size: 14px;
    line-height: 17px;
}

.taste__summary {
    display: flex;
    align-items: center;
    gap: 27px;
    margin-top: 11px;
}

.taste__summary-text { font-size: 15px; }

/* ───────── 홈 (P04) ───────── */

.home {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
}

.home__header {
    display: flex;
    align-items: center;
    flex: none;
    height: 62px;
    padding: 0 44px 0 24px;
}

.home__logo {
    color: var(--accent);
    font-size: 26px;
    font-weight: 700;
    line-height: 31px;
}

.genre-dropdown {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 34px;
    margin-left: 35px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    font-weight: 500;
}

.genre-dropdown .icon { color: var(--text-sub); }

.genre-dropdown__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
}

.home__header-right {
    display: flex;
    align-items: center;
    margin-left: auto;
}

.home__safe-label { margin-right: 11px; color: var(--text-sub); font-size: 14px; }

/* 세이프 토글은 켜진 채로 고정이라 누르는 모양(손가락 커서)을 주지 않습니다 */
.toggle {
    position: relative;
    display: inline-block;
    flex: none;
    width: 48px;
    height: 28px;
    border-radius: 14px;
    background: var(--border);
    transition: background 0.15s;
}

.toggle.is-on { background: var(--accent); }

.toggle__knob {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.15s;
}

.toggle.is-on .toggle__knob { transform: translateX(20px); }

.home__bell { position: relative; margin-left: 30px; }

.home__unread {
    position: absolute;
    top: -3px;
    right: -3px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--alert);
}

/* 취향 칩 줄 */
.chip-bar {
    position: relative;
    flex: none;
    height: 66px;
}

.chip-bar__chips {
    gap: 8px;
    padding: 10px 64px 0 var(--gutter);
}

.chip-bar__search {
    position: absolute;
    top: 4px;
    right: 0;
    display: grid;
    place-items: center;
    width: 56px;
    height: 50px;
    background: var(--bg);
}

/* 스크롤되는 본문 */
.home__scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-bottom: 108px;
    scrollbar-width: thin;
    scrollbar-color: #544c63 transparent;
}

.home__scroll::-webkit-scrollbar { width: 6px; }
.home__scroll::-webkit-scrollbar-thumb { border-radius: 3px; background: #544c63; }

.home__empty {
    padding: 72px var(--gutter);
    color: var(--text-mute);
    text-align: center;
}

/* 오늘의 한 장면 */
.scene {
    position: relative;
    height: 220px;
    overflow: hidden;
    background: var(--placeholder);
}

.scene__image {
    position: absolute;
    top: 0;
    right: 0;
    width: 50%;
    height: 100%;
    object-fit: cover;
}

.scene__scrim {
    position: absolute;
    inset: 0 50% 0 0;
    background: rgba(21, 19, 28, 0.9);
}

/* 글은 왼쪽 절반(어두운 면) 안에서 줄바꿈합니다 — 실제 대사는 줄바꿈 없이 길게 옵니다 */
.scene__text {
    position: absolute;
    left: 32px;
    right: calc(50% + 16px);
    top: 28px;
}

.scene__quote {
    margin-top: 14px;
    font-size: 28px;
    font-weight: 700;
    line-height: 38px;
    white-space: pre-line;
    word-break: keep-all;
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
}

.scene__source {
    margin-top: 12px;
    color: var(--text-sub);
    font-size: 14px;
    line-height: 17px;
}

.scene__enter { position: absolute; right: 36px; bottom: 23px; }

/* 이벤트 바 */
.event-bar {
    display: block;
    width: calc(100% - var(--gutter) * 2);
    height: 40px;
    margin: 12px var(--gutter) 0;
    border-radius: 10px;
    background: var(--surface-raised);
    color: var(--text-sub);
    font-size: 14px;
    line-height: 40px;
    text-align: center;
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 콘텐츠 탭 */
.home-tabs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    margin-top: 4px;
    border-bottom: 1px solid var(--border);
}

.home-tabs__tab {
    position: relative;
    height: 47px;
    color: var(--text-mute);
    font-size: 17px;
    text-align: center;
}

.home-tabs__tab.is-active { color: var(--text); font-weight: 700; }

.home-tabs__tab.is-active::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 3px;
    background: var(--accent);
}

/* 섹션 제목 */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 21px 16px var(--gutter);
}

.relation-row + .section-header { padding-top: 20px; }

.section-header__title { font-size: 20px; font-weight: 700; line-height: 24px; }

/* 내 취향 섹션을 넓혀 찾았을 때 제목 아래 한 줄 ("#소꿉친구 이야기는 아직 준비 중이에요") */
.section-note { margin: -8px var(--gutter) 10px; color: var(--text-mute); font-size: 14px; line-height: 20px; }

.section-header__more { color: var(--text-mute); font-size: 13px; }

.progress {
    display: block;
    width: 100%;
    height: 4px;
    margin-top: 18px;
    overflow: hidden;
    border: 0;
    border-radius: 2px;
    background: var(--border);
    appearance: none;
    -webkit-appearance: none;
}

.progress::-webkit-progress-bar { border-radius: 2px; background: var(--border); }
.progress::-webkit-progress-value { border-radius: 2px; background: var(--accent); }
.progress::-moz-progress-bar { border-radius: 2px; background: var(--accent); }

/* 하단 탭바 (플로팅) */
.tab-bar {
    position: absolute;
    z-index: 7;
    left: var(--gutter);
    right: var(--gutter);
    bottom: 0;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    height: 76px;
    padding: 8px 8px 0;
    border: 1px solid var(--border);
    border-bottom: 0;
    border-radius: 20px 20px 0 0;
    background: var(--surface);
}

.tab-bar__tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    height: 60px;
    border-radius: 16px;
    color: var(--text-mute);
    font-size: 12px;
}

.tab-bar__tab.is-active { background: var(--surface-raised); color: var(--accent); font-weight: 700; }

/* ───────── 홈 성향 전환 시트 (P05) ───────── */

.sheet-dim {
    position: fixed;
    inset: 0;
    z-index: 10;
    background: rgba(0, 0, 0, 0.6);
}

.sheet {
    position: fixed;
    left: 50%;
    bottom: 0;
    z-index: 11;
    width: min(var(--sheet-width), 100%);
    padding: 10px 16px 12px;
    border-radius: 20px 20px 0 0;
    background: var(--surface);
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.35);
    transform: translateX(-50%);
    animation: sheet-up 0.18s ease-out;
}

@keyframes sheet-up {
    from { transform: translate(-50%, 24px); opacity: 0; }
    to { transform: translate(-50%, 0); opacity: 1; }
}

.sheet__handle {
    width: 60px;
    height: 5px;
    margin: 0 auto;
    border-radius: 3px;
    background: var(--border);
}

.sheet__title {
    margin: 17px 8px 22px;
    font-size: 22px;
    font-weight: 700;
    line-height: 26px;
}

.sheet__rows { display: grid; gap: 6px; }

.sheet-row {
    display: flex;
    align-items: center;
    height: 56px;
    padding: 0 24px 0 18px;
    border-radius: 12px;
    color: var(--text-mute);
    font-size: 18px;
    font-weight: 500;
}

.sheet-row:disabled > .radio { border-color: var(--border); }

.sheet-row.is-selected { background: var(--surface-selected); color: var(--text); font-weight: 700; }

.sheet-row:not(:disabled):not(.is-selected) { color: var(--text); }

.sheet-row__name { margin-left: 14px; }

.sheet-row__current {
    margin-left: 20px;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--accent);
    color: var(--on-accent);
    font-size: 12px;
    font-weight: 500;
    line-height: 14px;
}

.sheet-row__closed { margin-left: auto; font-size: 14px; font-weight: 400; }

.sheet__divider { margin: 14px 8px 0; }

.sheet__mix {
    display: grid;
    grid-template-columns: 20px 1fr;
    column-gap: 14px;
    row-gap: 8px;
    margin: 17px 8px 13px;
    cursor: pointer;
}

.sheet__mix input {
    grid-row: 1 / span 2;
    width: 20px;
    height: 20px;
    margin: 4px 0 0;
    appearance: none;
    border: 1.5px solid var(--text-mute);
    border-radius: 4px;
    cursor: pointer;
}

.sheet__mix input:checked {
    border-color: var(--accent);
    background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='m5 10.500 3.300 3.300L15 7' fill='none' stroke='%231a1722' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 100% no-repeat;
}

.sheet__mix-title { font-size: 17px; font-weight: 500; line-height: 20px; }

.sheet__mix-desc { color: var(--text-mute); font-size: 14px; line-height: 17px; }

.sheet__apply { height: 56px; }

/* ───────── 좁은 화면 (폰 폭) — 칼럼이 화면 폭을 따를 때 머리줄이 줄바꿈되지 않게 ───────── */

.home__safe-label, .genre-dropdown { white-space: nowrap; }

@media (max-width: 520px) {
    .home__header { padding: 0 16px; }
    .genre-dropdown { margin-left: 14px; }
    .home__bell { margin-left: 14px; }
    .onb { padding-left: 20px; padding-right: 20px; }
    .scene__text { left: 20px; }
    .scene__enter { right: 16px; }
    .scene__quote { font-size: 22px; line-height: 30px; }
}

/* ───────── 오류 안내 ───────── */

.notice-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 32px;
}

.notice-page__text { color: var(--text-sub); font-size: 17px; }

.notice-page__link { line-height: 64px; text-decoration: none; }

#blazor-error-ui {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    display: none;
    padding: 10px 16px;
    background: var(--alert);
    color: #fff;
    font-size: 13px;
}

#blazor-error-ui .reload { margin-left: 12px; color: #fff; }

/* ───────── 가로로 넘기는 줄의 마우스 조작 (화살표 · 끌기) ───────── */

.hscroll { position: relative; }

.h-scroll.is-dragging { cursor: grabbing; user-select: none; scroll-behavior: auto; }

.h-scroll.is-dragging * { pointer-events: none; }

.hscroll__arrow {
    position: absolute;
    top: 50%;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: rgba(31, 28, 40, 0.94);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    color: var(--text);
    transform: translateY(-50%);
}

.hscroll__arrow--left { left: 8px; }

.hscroll__arrow--right { right: 8px; }

.hscroll__arrow--right .icon { transform: rotate(180deg); }

.hscroll__arrow.is-hidden { display: none; }

/* 손가락으로 넘기는 기기에서는 화살표가 필요 없습니다 */
@media (hover: none) {
    .hscroll__arrow { display: none; }
}

/* 카드 줄은 화살표를 표지 그림의 가운데 높이에 둡니다 */
.hscroll:has(> .relation-row) .hscroll__arrow { top: 80px; }

/* 홈 성향 전환 v2 (Figma 617:2 G01 ~ G03) — 체크박스 다중 선택 */
.genre-sheet__desc { margin: 4px 8px 8px; }

.genre-sheet__divider { margin: 4px 8px; }

.genre-check { gap: 14px; }

.genre-check__sub { margin-left: auto; color: var(--text-mute); font-size: 14px; font-weight: 400; }

.check {
    position: relative;
    flex: none;
    width: 22px;
    height: 22px;
    border: 1.5px solid var(--text-mute);
    border-radius: 5px;
}

.check.is-on { border-color: var(--accent); background: var(--accent); }

.check.is-on::after {
    content: "";
    position: absolute;
    left: 6px;
    top: 2px;
    width: 6px;
    height: 11px;
    border: solid var(--on-accent);
    border-width: 0 2.2px 2.2px 0;
    transform: rotate(45deg);
}

/* 일부만 골랐을 때 "−" */
.check.is-partial { border-color: var(--accent); }

.check.is-partial::after {
    content: "";
    position: absolute;
    left: 4px;
    top: 9px;
    width: 11px;
    height: 2px;
    border-radius: 1px;
    background: var(--accent);
}

.sheet-row:disabled > .check { border-color: var(--border); }

.genre-sheet__note { margin: 10px 8px 0; color: var(--text-sub); font-size: 13px; }

.genre-sheet__note.is-error { color: var(--danger); }

/* 작품 카드 성향 아이콘 (G05) — 색은 앱 GenreIconView와 같음, 보라는 강조색이라 쓰지 않음 */
.genre-icon {
    position: absolute;
    left: 8px;
    bottom: 8px;
    display: grid;
    place-items: center;
    min-width: 24px;
    height: 24px;
    padding: 0 5px;
    border-radius: 12px;
    color: #1a1722;
    font-size: 11px;
    font-weight: 700;
}

.genre-icon--rofan { background: #e6c36a; }

.genre-icon--hl { background: #ffb46b; }

.genre-icon--bl { background: #6fa8ff; }

.genre-icon--gl { background: #ff7fa8; }

/* ───────── 홈 탭 개편 (Figma 561:2 X01 ~ X04, 앱 홈과 같은 구성) ───────── */

/* 관계 카드 (Figma 561:2 H2 420×612 · 표지 420×372, 1080 폭 시안을 0.4배) */
.relation-row { gap: 12px; padding: 0 var(--gutter); }

.relation-card { display: block; flex: none; width: 168px; color: inherit; text-decoration: none; }

.relation-card__main { display: block; color: inherit; text-decoration: none; }

.relation-card__author--link { display: block; text-decoration: none; }

.relation-card__author--link:hover { color: var(--text-sub); }

.relation-card__cover {
    position: relative;
    aspect-ratio: 420 / 372;
    overflow: hidden;
    border-radius: 10px;
    background: var(--placeholder);
}

.relation-card__cover img { width: 100%; height: 100%; object-fit: cover; object-position: center top; }

.relation-card__stage { position: absolute; left: 8px; top: 8px; }

.relation-card__title {
    margin-top: 8px;
    overflow: hidden;
    font-size: 16px;
    font-weight: 700;
    line-height: 20px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.relation-card__line, .relation-card__author {
    margin-top: 4px;
    overflow: hidden;
    color: var(--text-sub);
    font-size: 13px;
    line-height: 17px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.relation-card__author { color: var(--text-mute); font-size: 12px; }

.relation-card__hashtag { margin-top: 8px; }

/* '전체 관계' 그리드 카드 (V1 480×678 · 표지 480×504) — 폰은 2열, 넓으면 열이 늘어남 */
.relation-card--grid { width: auto; }

.relation-card--grid .relation-card__cover { aspect-ratio: 480 / 504; }

/* 줄 끝 [전체 보기] 카드 */
.see-all-card {
    display: flex;
    flex: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    align-self: flex-start;
    width: 96px;
    /* 옆 카드의 표지 높이 (168 × 372 / 420) */
    height: 149px;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-sub);
    font-size: 13px;
}

/* 이어서 읽기 (H4 312×384 · 표지 312×246) */
.continue-row { gap: 10px; padding: 0 var(--gutter); }

.continue-card { display: block; flex: none; width: 125px; color: inherit; text-decoration: none; }

.continue-card__cover {
    position: relative;
    aspect-ratio: 312 / 246;
    overflow: hidden;
    border-radius: 8px 8px 0 0;
    background: var(--placeholder);
}

.continue-card__cover img { width: 100%; height: 100%; object-fit: cover; object-position: center top; }

.continue-card .continue-card__progress { margin-top: 0; border-radius: 0; }

.continue-card__title {
    margin-top: 8px;
    overflow: hidden;
    font-size: 14px;
    font-weight: 700;
    line-height: 17px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.continue-card__meta { margin-top: 4px; color: var(--text-mute); font-size: 12px; }

/* 탭 맨 위 질문 */
.tab-question { padding: 22px var(--gutter) 0; }

.tab-question__title { font-size: 21px; font-weight: 700; line-height: 26px; }

.tab-question__desc { margin-top: 4px; color: var(--text-mute); font-size: 14px; }

.relation-filter { padding-bottom: 4px; }

.relation-filter__row { display: flex; align-items: center; gap: 12px; margin-top: 14px; padding-left: var(--gutter); }

.relation-filter__label { flex: none; color: var(--text-sub); font-size: 13px; }

.relation-filter__row .hscroll { flex: 1; min-width: 0; }

.relation-filter__chips { gap: 6px; padding-right: var(--gutter); }

/* 랭킹 줄 (TOP 9 · 4~50위) — 순위 · 그림 144 · 제목 · ♥ */
.rank-row { display: flex; align-items: center; gap: 10px; }

.rank-row__main { display: flex; flex: 1; align-items: center; gap: 12px; min-width: 0; color: inherit; text-decoration: none; }

.rank-row__rank { flex: none; width: 26px; color: var(--text-sub); font-size: 22px; font-weight: 700; text-align: center; }

.rank-row__rank.is-top { color: var(--accent); }

.rank-row__thumb { position: relative; flex: none; width: 58px; height: 58px; overflow: hidden; border-radius: 8px; background: var(--placeholder); }

.rank-row__thumb img { width: 100%; height: 100%; object-fit: cover; object-position: center top; }

.rank-row__thumb .genre-icon { left: 3px; bottom: 3px; min-width: 18px; height: 18px; font-size: 9px; }

.rank-row__body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }

.rank-row__title { overflow: hidden; font-size: 15px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }

.rank-row__likes { color: var(--rank-pink); font-size: 12px; }

.rank-row__chat {
    flex: none;
    height: 32px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text);
    font-size: 13px;
    line-height: 30px;
    text-decoration: none;
}

/* TOP 9: 세로 3줄씩 묶은 열을 가로로 넘김 (다음 열이 잘려 보이게) */
.rank-grid {
    display: grid;
    grid-auto-flow: column;
    grid-template-rows: repeat(3, auto);
    grid-auto-columns: min(86%, 380px);
    gap: 14px 20px;
    padding: 0 var(--gutter);
}

/* 전체 관계 */
.all-works { padding-bottom: 8px; }

.all-works__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 20px 10px;
    padding: 0 var(--gutter);
}

/* 정렬 드롭다운 */
.sort-menu { position: relative; }

.sort-menu__button {
    height: 30px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-sub);
    font-size: 13px;
}

.sort-menu__button::after { content: " ▾"; }

.sort-menu__button--static { display: inline-block; line-height: 28px; }

.sort-menu__button--static::after { content: none; }

.sort-menu__list {
    position: absolute;
    top: 36px;
    right: 0;
    z-index: 5;
    min-width: 110px;
    margin: 0;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-raised);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
    list-style: none;
}

.sort-menu__option { display: block; width: 100%; padding: 9px 10px; border-radius: 8px; color: var(--text-sub); font-size: 14px; }

.sort-menu__option.is-selected { background: var(--surface-selected); color: var(--text); font-weight: 700; }

/* 세로 목록 끝 — 로딩 점 3개 (차례로 진해짐, 앱 AllWorksSection) */
.end-sentinel { display: grid; place-items: center; min-height: 1px; padding: 18px 0 6px; }

.loading-dots { display: flex; gap: 14px; }

.loading-dots span { width: 9px; height: 9px; border-radius: 50%; background: var(--border); animation: loading-dot 1.05s infinite; }

.loading-dots span:nth-child(2) { animation-delay: 0.35s; }

.loading-dots span:nth-child(3) { animation-delay: 0.7s; }

@keyframes loading-dot {
    0%, 66%, 100% { background: var(--border); }
    33% { background: var(--accent); }
}

/* 이야기 탭 — 첫 장면 카드 (강조색 초록) */
.story-banner { padding-top: 16px; }

.story-banner__track {
    display: flex;
    gap: 10px;
    padding: 0 var(--gutter);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding: 0 var(--gutter);
    scrollbar-width: none;
}

.story-banner__track::-webkit-scrollbar { display: none; }

.story-card { display: flex; gap: 12px; color: inherit; text-decoration: none; }

.story-card__cover { position: relative; flex: none; width: 96px; height: 72px; overflow: hidden; border-radius: 8px; background: var(--placeholder); }

.story-card__cover img { width: 100%; height: 100%; object-fit: cover; object-position: center top; }

.story-card__body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }

.story-card__chapter { overflow: hidden; font-size: 15px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }

.story-card__situation {
    display: -webkit-box;
    overflow: hidden;
    color: var(--text-sub);
    font-size: 13px;
    line-height: 18px;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
}

.story-card__meta { overflow: hidden; color: var(--story-green); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }

.story-list .story-card { padding: 10px var(--gutter); }

/* 신작 배너: 와이드 그림 위에 글 (다음 배너가 잘려 보임) */
.story-card--banner {
    position: relative;
    flex: none;
    width: 86%;
    max-width: 560px;
    aspect-ratio: 924 / 600;
    overflow: hidden;
    border-radius: 12px;
    scroll-snap-align: start;
}

.story-card--banner .story-card__cover { position: absolute; inset: 0; width: auto; height: auto; border-radius: 0; }

.story-card--banner .story-card__cover::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(21, 19, 28, 0.95) 10%, rgba(21, 19, 28, 0) 70%);
}

.story-card--banner .story-card__body { position: absolute; left: 16px; right: 16px; bottom: 14px; z-index: 1; }

.story-card--banner .story-card__chapter { font-size: 18px; white-space: normal; }

.story-card__badge {
    position: absolute;
    left: 12px;
    top: 12px;
    z-index: 1;
    height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    background: var(--story-green);
    color: #10231c;
    font-size: 12px;
    font-weight: 700;
    line-height: 24px;
}

.story-card--banner .genre-icon { z-index: 1; left: auto; right: 10px; top: 10px; bottom: auto; }

.pager-dots { display: flex; justify-content: center; gap: 6px; margin-top: 10px; }

.pager-dots__dot { width: 7px; height: 7px; border-radius: 4px; background: var(--border); transition: width 0.15s; }

.pager-dots__dot.is-active { width: 18px; background: var(--text-sub); }

/* 두근 랭킹 탭 (강조색 분홍 · 1위 금색) */
.podium {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    align-items: end;
    gap: 10px;
    padding: 18px var(--gutter) 0;
}

.rank-card { display: flex; flex-direction: column; gap: 4px; color: inherit; text-decoration: none; }

.rank-card__cover {
    position: relative;
    aspect-ratio: 312 / 336;
    overflow: hidden;
    border: 2px solid transparent;
    border-radius: 10px;
    background: var(--placeholder);
}

.rank-card.is-first .rank-card__cover { border-color: var(--gold); }

.podium .rank-card:not(.is-first) .rank-card__cover { aspect-ratio: 312 / 300; }

.rank-card__cover img { width: 100%; height: 100%; object-fit: cover; object-position: center top; }

.rank-card__badge {
    position: absolute;
    left: 8px;
    top: 8px;
    min-width: 26px;
    height: 26px;
    padding: 0 8px;
    border-radius: 13px;
    background: rgba(21, 19, 28, 0.85);
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
    line-height: 26px;
    text-align: center;
}

.rank-card.is-first .rank-card__badge { background: var(--gold); color: #2a2110; }

.axis-row .rank-card__badge { background: var(--gold); color: #2a2110; font-size: 11px; }

.rank-card__title { margin-top: 4px; overflow: hidden; font-size: 14px; font-weight: 700; text-align: center; text-overflow: ellipsis; white-space: nowrap; }

.rank-card__likes { color: var(--rank-pink); font-size: 12px; text-align: center; }

.axis-row { gap: 10px; padding: 0 var(--gutter); }

.axis-row .rank-card { flex: none; width: 128px; }

.axis-row .rank-card__title, .axis-row .rank-card__likes { text-align: left; }

.rank-list { display: flex; flex-direction: column; gap: 12px; padding: 0 var(--gutter); }

.rank-list__end { margin: 22px 0 8px; color: var(--text-mute); font-size: 13px; text-align: center; }

/* 스크롤 고정 (X04): 내리면 로고 줄이 접히고, 콘텐츠 탭 줄은 위에 붙음 */
.home__header { overflow: hidden; transition: height 0.2s, opacity 0.2s; }

.home.is-collapsed .home__header { height: 0; opacity: 0; }

.home-tabs { position: sticky; top: 0; z-index: 4; background: var(--bg); }

.home__empty { white-space: pre-line; }

/* [맨 위로] — 2화면 넘게 내렸을 때만 */
.scroll-top {
    position: absolute;
    right: 18px;
    bottom: 104px;
    z-index: 6;
    display: none;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: rgba(31, 28, 40, 0.94);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    color: var(--text);
}

.scroll-top.is-shown { display: grid; }

/* ───────── 취향 세분화 (Figma 602:2 W01 · W02 · W04) ───────── */

/* 온보딩 3/3 — 축 이름 옆 "N 선택" */
.taste__axis { display: flex; align-items: baseline; gap: 14px; }

.taste__chips + .taste__axis { margin-top: 24px; }

.taste__axis-count { color: var(--text-mute); font-size: 13px; }

.taste__summary { margin-top: 26px; gap: 14px; }

/* 칩 안의 핀 · 연필 */
.chip .icon { margin-right: 5px; }

.chip-bar__edit .icon { margin: 0 0 0 5px; }

.chip-bar__edit { border-style: dashed; }

/* 오늘의 한 장면 — 내 취향 추천 알약 */
.scene__pick { gap: 4px; border-color: var(--accent); color: var(--accent); }

/* ───────── 서재 (Figma W05~W09) · 카드 ♥ ───────── */

.library__segment { display: grid; grid-template-columns: 1fr 1fr; flex: none; gap: 4px; margin: 4px 20px 8px; padding: 4px; border-radius: 999px; background: var(--surface-raised); }

.library__segment-tab { height: 40px; border-radius: 999px; color: var(--text-sub); font-size: 15px; text-align: center; }

.library__segment-tab.is-active { background: var(--accent); color: var(--on-accent); font-weight: 700; }

.library__body { padding-bottom: 24px; }

.library__sort::after { content: " ▾"; }

.library__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 18px 10px; padding: 0 20px; }

.library-card { position: relative; }

.library-card__open { display: flex; flex-direction: column; gap: 8px; width: 100%; color: inherit; text-align: left; }

.library-card__cover { position: relative; display: block; aspect-ratio: 480 / 504; overflow: hidden; border: 2px solid transparent; border-radius: 10px; background: var(--placeholder); }

.library-card.is-chosen .library-card__cover { border-color: var(--accent); }

.library-card__cover img { width: 100%; height: 100%; object-fit: cover; object-position: center top; }

.library-card__stage { position: absolute; left: 8px; top: 8px; }

.library-card__check { position: absolute; right: 8px; top: 8px; background: rgba(21, 19, 28, .7); }

.library-card.is-chosen .library-card__check::after { background: var(--accent); }

.library-card__title { overflow: hidden; padding-right: 64px; font-size: 15px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }

.library-card__actions { position: absolute; right: 0; bottom: -4px; display: flex; gap: 2px; }

.library-card__mark { display: grid; place-items: center; width: 30px; height: 30px; color: var(--accent); }

.like-button { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 30px; height: 30px; color: var(--text-sub); }

.like-button.is-liked { color: var(--danger); }

.like-button__count { font-size: 14px; }

.detail-action.is-liked { color: var(--danger); }

/* WITU 추천 묶음 */
.pick-set { padding: 8px 0 22px; }

.pick-set__title { margin: 0 20px; font-size: 18px; font-weight: 700; }

.pick-set__desc { margin: 4px 20px 0; color: var(--text-mute); font-size: 13px; }

.pick-set .library__grid { margin-top: 14px; }

.pick-card { display: flex; flex-direction: column; gap: 6px; color: inherit; text-decoration: none; }

.pick-card__cover { position: relative; display: block; aspect-ratio: 480 / 504; overflow: hidden; border-radius: 10px; background: var(--placeholder); }

.pick-card__cover img { width: 100%; height: 100%; object-fit: cover; object-position: center top; }

.pick-card__badge { position: absolute; left: 8px; top: 8px; height: 20px; padding: 0 8px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: 10px; font-weight: 700; line-height: 20px; }

.pick-card__title { overflow: hidden; font-size: 15px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }

.pick-card__line { display: -webkit-box; overflow: hidden; color: var(--text-sub); font-size: 13px; line-height: 18px; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }

.pick-card__reason { color: var(--accent); font-size: 12px; line-height: 16px; }

/* 홈 내 서재 탭 (Figma W04) — 작은 카드 3장씩 (표지 228 × 174, 1080 폭 시안) */
.shelf-row { gap: 10px; padding: 0 var(--gutter); }

.shelf-card { display: flex; flex: none; flex-direction: column; gap: 8px; width: calc((100% - var(--gutter) * 2 - 20px) / 3); min-width: 108px; max-width: 200px; color: inherit; text-decoration: none; }

.shelf-card__cover { position: relative; display: block; aspect-ratio: 228 / 174; overflow: hidden; border-radius: 10px; background: var(--placeholder); }

.shelf-card__cover img { width: 100%; height: 100%; object-fit: cover; object-position: center top; }

.shelf-card__badge { position: absolute; left: 8px; top: 8px; height: 18px; padding: 0 7px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: 10px; font-weight: 700; line-height: 18px; }

.shelf-card__title { overflow: hidden; font-size: 15px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }

/* 게스트 — 담아 둔 관계 자리의 로그인 안내 축약판 */
.shelf-guest { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 var(--gutter); padding: 16px 18px; border: 1px dashed var(--border); border-radius: 12px; }

.shelf-guest__text { color: var(--text-sub); font-size: 14px; }

.shelf-guest__cta { flex: none; }

/* 불러오기 실패 안내 */
.load-failed { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 48px 24px; text-align: center; }

.load-failed__text { margin: 0; color: var(--text-sub); font-size: 14px; }

.load-failed__retry { padding: 10px 20px; border: 1px solid var(--border); border-radius: 20px; background: var(--surface); color: var(--text); font-size: 14px; cursor: pointer; }

/* 성인이용가 19 원형 (앱 AdultBadgeView · Figma 617:2 G05 — 성향 아이콘 오른쪽, 아이콘이 숨으면 그 자리) */
.adult-badge {
    position: absolute;
    left: 8px;
    bottom: 8px;
    z-index: 3;
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--adult);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

.genre-icon + .adult-badge { left: 36px; }

.rank-row__thumb .adult-badge, .search-suggest__thumb .adult-badge, .my-list-row__thumb .adult-badge, .chat-row__thumb .adult-badge { left: 3px; bottom: 3px; width: 18px; height: 18px; font-size: 9px; }

.rank-row__thumb .genre-icon + .adult-badge { left: 25px; }

.story-card--banner .adult-badge { left: auto; right: 10px; top: 10px; bottom: auto; }

.story-card--banner .genre-icon + .adult-badge { left: auto; right: 40px; }

/* 제목 옆 · 오늘의 장면 왼쪽 위 */
.adult-badge--inline { position: static; flex: none; }

.adult-badge--corner { left: 12px; top: 12px; bottom: auto; }

.search-suggest__thumb, .my-list-row__thumb, .chat-row__thumb { position: relative; }

.chat-row__thumb { display: inline-grid; flex: none; }

/* 세이프 해제 안내 */
.safe-row { display: grid; gap: 3px; margin: 12px 8px 0; }

.safe-row__title { font-size: 15px; font-weight: 700; }

.safe-row__desc { color: var(--text-sub); font-size: 13px; line-height: 19px; }

.safe-sheet__text { white-space: pre-line; }
