/* 캐릭터 상세 (시안 "상세페이지 · 모바일 컬러" MD01~MD06). 모바일 시안(1080 폭)의 치수를 홈 PC 시안과 같은 비율로 줄였습니다.
   색 · 폭 변수는 app.css의 :root에 있습니다. */

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

/* 위에 고정된 줄: 뒤로 · 제목 · 더보기 */
.detail-bar {
    display: flex;
    align-items: center;
    flex: none;
    gap: 10px;
    height: 60px;
    padding: 0 16px;
}

.detail-bar__back { color: var(--text); }

.detail-bar__title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    font-size: 19px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 북마크 — 담으면 채워진 모양 + 강조색 */
.detail-bar__bookmark { color: var(--text); }

.detail-bar__bookmark.is-on { color: var(--accent); }

.detail-bar__more {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--surface-raised);
}

.detail__scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-bottom: 32px;
    scrollbar-width: thin;
    scrollbar-color: #544c63 transparent;
}

/* 표지 — 모바일은 화면 폭 정사각에 가깝지만, PC 칼럼에서는 세로를 줄여 얼굴 쪽이 보이게 자릅니다 */
.detail-hero {
    height: min(440px, 50vh);
    overflow: hidden;
    background: var(--placeholder);
}

.detail-hero img { width: 100%; height: 100%; object-fit: cover; object-position: center 22%; }

.detail-head { padding: 20px 24px 0; }

.detail-head__title { font-size: 28px; font-weight: 700; line-height: 36px; }

.detail-head__stats {
    display: flex;
    gap: 16px;
    margin-top: 8px;
    font-size: 14px;
    font-weight: 700;
}

.detail-head__stats span { display: inline-flex; align-items: center; gap: 5px; }

.detail-head__author {
    display: inline-block;
    max-width: 100%;
    margin-top: 12px;
    padding: 5px 12px;
    overflow: hidden;
    border-radius: 8px;
    background: var(--surface-raised);
    color: var(--text-sub);
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: top;
}

.detail-tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 18px; }

.detail-tag {
    padding: 6px 12px;
    border-radius: 8px;
    background: var(--surface-raised);
    color: var(--text-sub);
    font-size: 13px;
    line-height: 16px;
}

.detail-tag--genre { background: var(--accent); color: var(--on-accent); font-weight: 700; }

.detail-actions { display: flex; justify-content: center; gap: 56px; padding: 16px 0 6px; }

.detail-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-width: 64px;
    color: var(--text);
    font-size: 13px;
}

.detail-action.is-on { color: var(--accent); }

/* 탭: 캐릭터 설정 / 댓글 N — 스크롤해도 위에 붙어 있습니다 */
.detail-tabs {
    position: sticky;
    top: 0;
    z-index: 2;
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin-top: 10px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

.detail-tabs__tab {
    position: relative;
    height: 48px;
    color: var(--text-mute);
    font-size: 16px;
    text-align: center;
}

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

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

/* 본문 구역 */
.detail-section { padding: 24px 24px 0; }

.detail-section > .divider { margin: 0 0 24px; }

.detail-section__title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    font-size: 20px;
    font-weight: 700;
    line-height: 26px;
}

.detail-section__title--muted { color: var(--text-mute); font-size: 16px; }

.detail-section__title--small { margin-top: 20px; font-size: 17px; }

.detail-section__sub { margin: 18px 0 8px; color: var(--text-mute); font-size: 15px; font-weight: 400; }

.detail-section .divider + .detail-section__sub { margin-top: 18px; }

.detail-text {
    color: var(--text-sub);
    font-size: 15px;
    line-height: 25px;
    overflow-wrap: anywhere;
    white-space: pre-line;
}

.detail-text + .divider { margin-top: 18px; }

.detail-text--muted { margin-top: 12px; }

.detail-text--narration { margin-top: 12px; color: var(--text-mute); font-style: italic; }

.detail-text.is-clamped {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 5;
    line-clamp: 5;
}

/* 묶음 카드: 시작 상황 · 작품 */
.detail-card {
    margin: 24px 16px 0;
    padding: 22px 20px 20px;
    border-radius: 18px;
    background: var(--surface);
}

.detail-card .detail-section__title { margin-bottom: 10px; }

.detail-card__chip { cursor: default; }

.detail-card__work { font-size: 21px; font-weight: 700; line-height: 28px; }

.detail-card .detail-head__author { margin: 10px 0 14px; border: 1px solid var(--border); background: none; }

/* 누르면 [채팅 하기]와 같이 대화 시작 */
.detail-card__prompt {
    display: block;
    width: fit-content;
    margin: 18px 0 0 auto;
    padding: 10px 18px;
    border: 0;
    border-radius: 12px;
    background: var(--surface-selected);
    color: var(--text-sub);
    font: inherit;
    font-size: 14px;
    cursor: pointer;
}

.detail-card__prompt:hover,
.detail-card__prompt:focus-visible { color: var(--text); }

/* 시작 상황의 첫 메시지 한 줄 */
.opening-line {
    margin-top: 8px;
    padding: 12px 16px;
    border-radius: 12px;
    background: var(--bg);
    font-size: 15px;
    line-height: 24px;
    overflow-wrap: anywhere;
    white-space: pre-line;
}

.opening-line b { margin-right: 10px; }

/* 명령어 */
.beta-badge {
    padding: 1px 9px;
    border: 1px solid var(--text-sub);
    border-radius: 999px;
    color: var(--text-sub);
    font-size: 12px;
    font-weight: 400;
    line-height: 17px;
}

.accordion { margin-top: 8px; border-radius: 12px; background: var(--surface-raised); }

.accordion__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 52px;
    padding: 0 18px;
    font-size: 16px;
    font-weight: 500;
}

.accordion__head .icon { color: var(--text-sub); transition: transform 0.15s; }

.accordion.is-open .accordion__head .icon { transform: rotate(180deg); }

.accordion__body {
    padding: 0 18px 16px;
    color: var(--text-sub);
    font-size: 14px;
    line-height: 22px;
    white-space: pre-line;
}

/* 작가 코멘트 */
.author-line { color: var(--text-sub); font-size: 15px; line-height: 25px; overflow-wrap: anywhere; }

.author-line--heading { margin-top: 16px; color: var(--text); font-size: 16px; font-weight: 500; }

.author-line--item { position: relative; padding-left: 18px; }

.author-line--item::before { content: "-"; position: absolute; left: 2px; color: var(--text-mute); }

/* 관련 콘텐츠 */
.related {
    position: relative;
    display: block;
    aspect-ratio: 16 / 9;
    max-height: 360px;
    width: 100%;
    overflow: hidden;
    border-radius: 16px;
    background: var(--placeholder);
}

.related img { width: 100%; height: 100%; object-fit: cover; opacity: 0.55; }

.related__play {
    position: absolute;
    left: 50%;
    top: 50%;
    display: grid;
    place-items: center;
    width: 52px;
    height: 38px;
    border-radius: 10px;
    background: var(--text);
    color: var(--on-accent);
    transform: translate(-50%, -50%);
}

.detail-dates { margin-top: 10px; color: var(--text-mute); font-size: 13px; white-space: pre; }

.detail-more {
    display: block;
    margin: 14px auto 0;
    padding: 6px 12px;
    font-size: 15px;
    white-space: pre;
}

/* 같은 작품 캐릭터 */
.same-work-row { gap: 12px; }

.same-work { display: block; flex: none; width: 150px; color: inherit; text-decoration: none; }

.same-work__image {
    display: block;
    height: 150px;
    overflow: hidden;
    border-radius: 12px;
    background: var(--placeholder);
}

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

.same-work__name {
    display: block;
    margin-top: 10px;
    overflow: hidden;
    font-size: 15px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.same-work__line {
    display: -webkit-box;
    height: 38px;
    margin-top: 4px;
    overflow: hidden;
    color: var(--text-sub);
    font-size: 13px;
    line-height: 19px;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
}

.same-work__tags { display: flex; gap: 4px; height: 19px; margin-top: 8px; overflow: hidden; }

.hscroll:has(> .same-work-row) .hscroll__arrow { top: 75px; }

/* 댓글 */
.comment { display: flex; gap: 12px; margin-bottom: 18px; }

.comment__body { min-width: 0; }

.comment__nickname { font-size: 15px; font-weight: 500; line-height: 28px; }

.comment__content {
    margin-top: 2px;
    color: var(--text-sub);
    font-size: 15px;
    line-height: 24px;
    overflow-wrap: anywhere;
    white-space: pre-line;
}

.comment__footer { display: flex; gap: 16px; margin-top: 8px; color: var(--text-mute); font-size: 13px; }

.comment__footer span { display: inline-flex; align-items: center; gap: 5px; }

/* 아래에 고정된 줄: 좋아요 · 채팅 하기 */
.detail-cta {
    display: flex;
    align-items: center;
    flex: none;
    gap: 12px;
    padding: 10px 16px 14px;
    border-top: 1px solid var(--border);
}

.detail-cta__like {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: none;
    gap: 2px;
    width: 56px;
    height: 56px;
    border: 1px solid var(--border);
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
}

.detail-cta__like.is-on { border-color: var(--accent); color: var(--accent); }

.detail-cta__chat { height: 56px; border-radius: 28px; line-height: 56px; text-decoration: none; }

@media (max-width: 520px) {
    .detail-head, .detail-section { padding-left: 16px; padding-right: 16px; }
    .detail-card { margin-left: 8px; margin-right: 8px; }
    .detail-actions { gap: 32px; }
    .detail-hero { height: 300px; }
}

/* 댓글 ♥ 좋아요 · 삭제 / 신고 (앱과 같은 꽉 찬 빨간 하트) */
.comment__like { display: inline-flex; align-items: center; gap: 5px; color: inherit; font-size: inherit; }

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

.comment__action { margin-left: auto; color: var(--text-mute); font-size: inherit; }

.comment__action:hover { color: var(--text-sub); }

/* 찾을 수 없는 캐릭터 (M25) */
.detail-missing { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 140px 32px 0; text-align: center; }

.detail-missing__title { margin: 0; font-size: 20px; font-weight: 700; }

.detail-missing__desc { margin: 0; color: var(--text-sub); font-size: 14px; line-height: 21px; }

.detail-missing__home { display: grid; place-items: center; width: 220px; height: 52px; margin-top: 18px; font-size: 16px; text-decoration: none; }

/* 아래 ♥ — 좋아요면 빨간 하트 (카드 ♥와 같은 LikeButton) */
.detail-cta__like.is-liked { border-color: var(--danger); color: var(--danger); }

.detail-cta__like .like-button__count { font-size: 11px; }

/* 관련 콘텐츠 영상 창 (앱 RelatedVideoOverlay) */
button.related { padding: 0; border: 0; cursor: pointer; }

.video-player { position: fixed; inset: 0; z-index: 40; display: flex; flex-direction: column; background: #000; outline: none; }

.video-player__bar { display: flex; flex: none; align-items: center; height: 56px; padding: 0 8px; color: #fff; }

.video-player__close { color: #fff; }

.video-player__stage { display: flex; flex: 1; align-items: stretch; justify-content: center; min-height: 0; }

.video-player__frame { width: 100%; height: 100%; max-width: 760px; border: 0; }

.video-player__frame.is-hidden { display: none; }

.video-player__fallback { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 24px; color: #fff; text-align: center; }

.video-player__link { display: grid; place-items: center; width: 220px; height: 50px; font-size: 15px; text-decoration: none; }

/* 영상을 보고 돌아왔을 때 [채팅 하기] 3번 깜박임 (앱 AttentionPulse) */
.detail-cta__chat.is-pulsing { animation: chat-pulse 0.8s ease-in-out 3; }

@keyframes chat-pulse {
    50% { opacity: 0.4; transform: scale(1.04); }
}
