/* 대화방 (시안 "캐릭터 대화" 04 ~ 05). 모바일 시안(1080 폭)의 치수를 홈 PC 시안과 같은 비율로 줄였습니다.
   색 · 폭 변수는 app.css의 :root에 있습니다. */

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

a.scene__enter { text-decoration: none; }

.avatar {
    display: inline-block;
    flex: none;
    overflow: hidden;
    border-radius: 50%;
    background: var(--placeholder);
}

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

.avatar--header { width: 36px; height: 36px; }
.avatar--message { width: 40px; height: 40px; }
.avatar--small { width: 28px; height: 28px; }
.avatar--row { width: 44px; height: 44px; }
.avatar--large { width: 56px; height: 56px; }

.rep-badge {
    flex: none;
    white-space: nowrap;
    padding: 2px 7px;
    border-radius: 999px;
    background: var(--accent);
    color: var(--on-accent);
    font-size: 11px;
    font-weight: 700;
    line-height: 14px;
}

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

.chat-header {
    display: flex;
    align-items: center;
    flex: none;
    gap: 12px;
    height: 60px;
    padding: 0 16px;
    border-bottom: 1px solid var(--border);
}

.chat-header__name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    font-size: 17px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-header__model {
    display: inline-flex;
    align-items: center;
    flex: none;
    gap: 6px;
    height: 32px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}

.chat-header__model .icon { color: var(--text-sub); }

.chat__feed {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 16px;
    min-height: 0;
    overflow-y: auto;
    padding: 12px var(--gutter) 24px;
    scrollbar-width: thin;
    scrollbar-color: #544c63 transparent;
}

.chat__notice {
    flex: none;
    padding: 7px 12px;
    border-radius: 10px;
    background: var(--surface);
    color: var(--text-mute);
    font-size: 13px;
    text-align: center;
}

.chat__notice--inline { align-self: center; background: none; }

.situation {
    flex: none;
    padding: 12px 16px;
    border-radius: 14px;
    background: var(--surface-selected);
}

.situation__label { color: var(--accent); font-size: 13px; font-weight: 700; line-height: 18px; }

.situation__text {
    margin-top: 2px;
    color: var(--text-sub);
    font-size: 14px;
    line-height: 21px;
    white-space: pre-line;
}

/* 말풍선 */
.msg { display: flex; flex: none; gap: 10px; }

.msg--user { justify-content: flex-end; }

.msg__body { min-width: 0; max-width: min(560px, 100%); }

.msg__speaker { margin-bottom: 4px; font-size: 14px; font-weight: 700; line-height: 18px; }

.bubble {
    display: inline-block;
    padding: 11px 16px;
    border-radius: 18px;
    background: var(--surface-raised);
    font-size: 15px;
    line-height: 23px;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.bubble--user { max-width: min(560px, 82%); background: #473b78; }

.bubble__narration { color: var(--text-mute); font-style: italic; }
.bubble--user .bubble__narration { color: #ccc2ee; }

.msg__actions {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 8px;
    padding-left: 4px;
}

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

.msg__model { margin-left: auto; color: var(--text-mute); font-size: 12px; }

.msg__more { position: relative; display: flex; }

.popover-backdrop { position: fixed; inset: 0; z-index: 5; }

.popover {
    position: absolute;
    left: 0;
    top: 28px;
    z-index: 6;
    min-width: 168px;
    padding: 4px 6px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.popover__item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    height: 44px;
    padding: 0 10px;
    font-size: 15px;
}

.popover__item + .popover__item { border-top: 1px solid var(--border); }

.popover__item--danger { color: var(--alert); }

/* "(이름)으로 대화 중" 줄 */
.profile-summary {
    display: flex;
    align-items: center;
    flex: none;
    gap: 10px;
    height: 48px;
    padding: 0 16px 0 12px;
    border-radius: 14px;
    background: var(--surface);
}

.profile-summary__text { flex: 1; font-size: 15px; }

.profile-summary__change { color: var(--accent); font-size: 14px; font-weight: 700; }

/* 프로필 고르기 */
.picker { flex: none; margin: 8px calc(var(--gutter) * -1) 0; }

.picker__title { font-size: 17px; font-weight: 700; text-align: center; }

/* 소개를 쓰면 반영된다는 안내 (11-12 테스트 후기: 페르소나 효과를 모름 · 시험 B 9/40) */
.picker__hint { margin: 6px var(--gutter) 0; color: var(--text-sub); font-size: 14px; line-height: 20px; text-align: center; }

.picker__cards {
    gap: 12px;
    margin-top: 14px;
    padding: 4px var(--gutter);
    justify-content: safe center;
}

/* 카드 3장 + 목록 카드가 880 칼럼에 한 줄로 들어가는 크기 */
.profile-card {
    position: relative;
    flex: none;
    width: 200px;
    height: 300px;
    overflow: hidden;
    border-radius: 20px;
    background: var(--placeholder);
}

.profile-card.is-selected { box-shadow: inset 0 0 0 2px var(--accent), 0 0 0 1px var(--accent); }

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

.profile-card__tag {
    position: absolute;
    left: 12px;
    top: 12px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(71, 59, 120, 0.92);
    font-size: 12px;
    font-weight: 700;
}

.profile-card__info {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 14px 12px 12px;
    background: rgba(21, 19, 28, 0.78);
    text-align: center;
}

.profile-card__name { font-size: 20px; font-weight: 700; line-height: 26px; }

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

.profile-card__detail {
    max-height: 120px;
    margin-top: 8px;
    overflow-y: auto;
    color: var(--text-sub);
    font-size: 12px;
    line-height: 18px;
    text-align: left;
    white-space: pre-line;
}

.profile-card__expand { margin: 2px auto 6px; color: var(--text-sub); }
.profile-card__expand.is-open { transform: rotate(180deg); }

.profile-card__buttons { display: grid; grid-template-columns: 56px 1fr; gap: 6px; }

.profile-card__edit, .profile-card__select {
    height: 44px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    text-align: center;
}

.profile-card__edit { background: rgba(255, 255, 255, 0.16); }

.profile-card__select { background: var(--accent); color: var(--on-accent); }

.profile-list-card {
    flex: none;
    width: 200px;
    height: 300px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--surface);
}

.profile-list-card .profile-row { gap: 8px; padding: 0 12px; border-bottom: 1px solid var(--border); }

/* 200px 카드에서 이름 칸이 36px뿐이라 '김…'까지 줄던 것 — 아바타 · 간격을 줄여 세 글자 이름이 다 보이게 (11-12) */
.profile-list-card .profile-row__main { gap: 8px; }

.profile-list-card .avatar--row { width: 32px; height: 32px; }

/* 카드 아래 항상 보이는 '대화 프로필 추가' — 가로 스크롤 끝까지 가지 않아도 보이게 (11-12, 앱과 같은 배치) */
.picker__add.profile-row {
    width: calc(100% - var(--gutter) * 2);
    max-width: 360px;
    margin: 14px auto 0;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
}

.profile-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 68px;
    padding: 0 14px;
}

.profile-row--tall { min-height: 96px; padding-top: 12px; padding-bottom: 12px; }

.profile-row__main {
    display: flex;
    align-items: center;
    flex: 1;
    gap: 12px;
    min-width: 0;
    min-height: 44px;
}

.profile-row__plus { display: inline-grid; place-items: center; color: var(--text-sub); }

/* 좁은 목록 카드(200px)에서 '김정 / 훈'처럼 꺾이지 않게 한 줄 말줄임 (11-12) */
.profile-row__name { overflow: hidden; font-size: 15px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }

.profile-row__text { display: grid; gap: 4px; min-width: 0; }

.profile-row__detail {
    display: -webkit-box;
    overflow: hidden;
    color: var(--text-sub);
    font-size: 13px;
    font-weight: 400;
    line-height: 19px;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
}

.profile-row__avatar { position: relative; display: flex; flex: none; }

.profile-row__check {
    position: absolute;
    right: -2px;
    bottom: -2px;
    display: grid;
    place-items: center;
    width: 20px;
    height: 20px;
    border-radius: 6px;
    background: var(--accent);
    color: var(--on-accent);
}

.profile-row__edit { flex: none; color: var(--text-sub); }

/* 입력창 */
.chat-input {
    display: flex;
    align-items: flex-end;
    flex: none;
    gap: 10px;
    padding: 10px var(--gutter) 14px;
    border-top: 1px solid var(--border);
}

.chat-input__plus {
    flex: none;
    width: 36px;
    height: 36px;
    margin-bottom: 4px;
    border: 1.5px solid var(--text-sub);
    border-radius: 50%;
    color: var(--text-sub);
}

/* 글 칸 + 아래 글자 수 (쓰는 동안만) */
.chat-input__box {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
}

.chat-input__count {
    align-self: flex-end;
    margin: 4px 12px 0 0;
    color: var(--text-mute);
    font-size: 12px;
    line-height: 16px;
}

.chat-input__count--full { color: var(--danger); }

.chat-input__field {
    width: 100%;
    min-height: 44px;
    padding: 11px 18px;
    border: 0;
    border-radius: 22px;
    outline: none;
    resize: none;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    line-height: 22px;
    scrollbar-width: thin;
}

.chat-input__field::placeholder { color: var(--text-mute); }

.chat-input__field:focus-visible { box-shadow: inset 0 0 0 1px var(--accent); }

.chat-input__send {
    display: grid;
    place-items: center;
    flex: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--on-accent);
}

.chat-input__send:disabled { opacity: 0.45; }

/* 시트 공통 (대화방) */
.sheet--wide { max-height: 86vh; overflow-y: auto; scrollbar-width: thin; }

.sheet__head { display: flex; align-items: baseline; justify-content: space-between; margin: 17px 8px 0; }

.sheet__title--inline { margin: 17px 8px 0; }

.sheet__head .sheet__title--inline { margin: 0; }

.sheet__help { margin: 8px 8px 16px; color: var(--text-sub); font-size: 14px; line-height: 20px; }

.sheet__note { margin: 14px 8px; color: var(--text-mute); font-size: 13px; line-height: 19px; }

.sheet__section { margin: 18px 8px 10px; font-size: 15px; font-weight: 700; }

.sheet__label { display: block; margin: 14px 8px 8px; font-size: 14px; font-weight: 700; }

.sheet-card { margin-bottom: 10px; border-radius: 16px; background: var(--surface-raised); }

.sheet-card .profile-row + .profile-row { border-top: 1px solid var(--border); }

.sheet__cancel {
    display: block;
    width: 100%;
    height: 52px;
    margin-top: 12px;
    border-radius: 14px;
    background: var(--surface-raised);
    font-size: 16px;
    font-weight: 700;
    text-align: center;
}

.sheet__cancel--strong:disabled { opacity: 0.45; }

.sheet__or {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 8px 0;
    color: var(--text-mute);
    font-size: 13px;
}

.sheet__or::before, .sheet__or::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.model-sheet__gems { color: var(--accent); font-size: 14px; font-weight: 700; }

.model-list { display: grid; gap: 10px; }

.model-row {
    display: grid;
    /* minmax(0, …): 긴 모델 이름이 가격 칸을 밀어내지 않게 (11-12 B2 글자 잘림) */
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 12px;
    align-items: center;
    padding: 14px 18px;
    border: 1px solid transparent;
    border-radius: 16px;
    background: var(--surface-raised);
}

.model-row.is-selected { border: 2px solid var(--accent); padding: 13px 17px; background: var(--surface-selected); }

.model-row__name { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 17px; font-weight: 700; }

.model-row__title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.model-row__cost { color: var(--accent); font-size: 14px; font-weight: 700; text-align: right; white-space: nowrap; }

.model-row.is-selected .model-row__cost { color: var(--text); }

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

.model-row__radio { justify-self: end; }

.model-row.is-selected > .radio::after { inset: 0; }

.menu-plot {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) auto;
    gap: 2px 12px;
    align-items: center;
    width: 100%;
    margin-top: 14px;
    padding: 4px 8px 14px;
}

.menu-plot__thumb {
    grid-row: 1 / span 2;
    width: 48px;
    height: 48px;
    overflow: hidden;
    border-radius: 10px;
    background: var(--placeholder);
}

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

/* 제목 · "캐릭터 · @작가"는 한 줄 말줄임 — 긴 이름이 [상세] 버튼을 밀어내지 않게 (11-12 B2 글자 잘림) */
.menu-plot__title { align-self: end; overflow: hidden; font-size: 16px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }

.menu-plot__sub { grid-column: 2; align-self: start; overflow: hidden; color: var(--text-sub); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }

.menu-plot__detail { grid-column: 3; grid-row: 1 / span 2; color: var(--accent); font-size: 14px; font-weight: 700; white-space: nowrap; }

.menu-item {
    display: grid;
    grid-template-columns: 24px 1fr;
    column-gap: 14px;
    align-items: center;
    width: 100%;
    min-height: 56px;
    padding: 6px 12px;
}

.menu-item .icon { grid-row: 1 / span 2; }

.menu-item__title { font-size: 16px; font-weight: 500; }

.menu-item__sub { grid-column: 2; color: var(--text-mute); font-size: 13px; }

.menu-item--danger { color: var(--alert); }

/* 대화 시작 옵션 (대화한 작품에서 [채팅 하기]) — 선택지를 테두리 카드로 */
.entry-sheet__options { display: grid; gap: 10px; }

.entry-option {
    min-height: 68px;
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-raised);
    text-align: left;
}

.persona-list { display: grid; gap: 8px; }

.persona-row {
    display: grid;
    grid-template-columns: 20px 28px 1fr;
    gap: 0 12px;
    align-items: center;
    min-height: 60px;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-raised);
}

.persona-row.is-selected { border-color: var(--accent); background: var(--surface-selected); }

.persona-row > .radio, .persona-row > .avatar { grid-row: 1 / span 2; }

.persona-row__name { font-size: 15px; font-weight: 700; }

.persona-row__summary { grid-column: 3; color: var(--text-mute); font-size: 13px; }

.text-field, .text-area {
    display: block;
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-raised);
}

.text-field, .text-area textarea {
    padding: 12px 16px;
    outline: none;
    color: var(--text);
    font: inherit;
}

.text-field { height: 48px; }

.text-area { position: relative; padding-bottom: 24px; }

.text-area textarea {
    display: block;
    width: 100%;
    border: 0;
    resize: none;
    background: none;
    line-height: 22px;
}

.text-field::placeholder, .text-area textarea::placeholder { color: var(--text-mute); }

.text-field:focus-visible, .text-area:focus-within { border-color: var(--accent); }

.text-area__counter { position: absolute; right: 14px; bottom: 8px; color: var(--text-mute); font-size: 12px; }

.report-list { margin-top: 10px; }

.report-row {
    display: grid;
    grid-template-columns: 1fr 24px;
    gap: 2px 12px;
    align-items: center;
    padding: 12px 8px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
}

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

.report-row__desc { grid-column: 1; color: var(--text-mute); font-size: 13px; }

.checkbox {
    grid-column: 2;
    grid-row: 1 / span 2;
    width: 22px;
    height: 22px;
    margin: 0;
    appearance: none;
    border: 1.5px solid var(--text-mute);
    border-radius: 5px;
    cursor: pointer;
}

.checkbox: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.5 3.3 3.3L15 7' fill='none' stroke='%231a1722' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 100% no-repeat;
}

/* 확인 대화상자 · 토스트 */
.dialog {
    position: fixed;
    left: 50%;
    top: 50%;
    z-index: 12;
    width: min(340px, calc(100% - 32px));
    padding: 24px 20px 16px;
    border-radius: 18px;
    background: var(--surface);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
    transform: translate(-50%, -50%);
}

.dialog__message { font-size: 16px; line-height: 24px; text-align: center; white-space: pre-line; }

.dialog__buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 20px; }

.dialog__button {
    height: 46px;
    border-radius: 12px;
    background: var(--surface-raised);
    font-size: 15px;
    font-weight: 700;
    text-align: center;
}

.dialog__button--confirm { background: var(--accent); color: var(--on-accent); }

.toast {
    position: fixed;
    left: 50%;
    bottom: 96px;
    z-index: 20;
    max-width: calc(100% - 32px);
    padding: 10px 18px;
    border-radius: 999px;
    background: rgba(42, 38, 51, 0.96);
    font-size: 14px;
    transform: translateX(-50%);
}

/* 부제가 없는 줄은 제목을 세로 가운데에 */
.menu-item__title:last-child, .persona-row__name:last-child { grid-row: 1 / span 2; }

.sheet--wide .sheet__apply { margin-top: 14px; }

@media (max-width: 520px) {
    .chat-header { gap: 8px; padding: 0 10px; }
    .profile-card, .profile-list-card { width: 230px; height: 320px; }
    .picker__cards { justify-content: flex-start; }
}

/* 안내 글이 길어도 입력창이 두 줄로 커지지 않게 */
.chat-input__field::placeholder { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 대화 목록 (W10 · W11) — 마이와 같은 칼럼 · 탭바 */
.chats { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }

.chats__title { margin: 0; font-size: 24px; font-weight: 700; }

.chats__toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 24px 10px;
    color: var(--text-mute);
    font-size: 14px;
}

.chats__count { flex: 1; }

.chats__edit { color: var(--accent); font-size: 15px; font-weight: 700; }

.chats__list { margin: 0; padding: 0; list-style: none; }

.chat-row {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 12px 24px;
    text-align: left;
}

.chat-row:hover { background: var(--surface); }

.chat-row__check { flex: none; }

.chat-row__avatar { width: 56px; height: 56px; }

.chat-row__body { display: flex; flex: 1; flex-direction: column; gap: 3px; min-width: 0; }

.chat-row__head { display: flex; align-items: baseline; gap: 8px; }

.chat-row__title { flex: 1; overflow: hidden; font-size: 17px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }

.chat-row__time { flex: none; color: var(--text-mute); font-size: 12px; }

.chat-row__meta { color: var(--text-sub); font-size: 13px; }

.chat-row__line { overflow: hidden; color: var(--text-sub); font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }

.chats__leave-bar { position: sticky; bottom: 0; padding: 12px 24px; background: var(--bg); }

.chats__leave:disabled { opacity: .4; cursor: default; }

.chats__notice {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 120px 32px 0;
    text-align: center;
}

.chats__notice-title { margin: 0; font-size: 18px; font-weight: 700; }

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

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

/* 대화방 코인 (앱 C01 ~ C04) — 헤더 아이콘 · 팝오버 · 입력창 위 부족 카드 */
.chat-header__coin { color: var(--text-sub); }

.coin-popover {
    position: absolute;
    right: 16px;
    top: 60px;
    z-index: 6;
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 260px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface-raised);
}

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

.coin-popover__amount { font-size: 22px; font-weight: 700; }

.coin-popover__amount.is-debt { color: var(--danger); }

.coin-popover__turn { color: var(--text); font-size: 14px; }

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

.coin-popover__charge { height: 44px; margin-top: 8px; font-size: 15px; }

.coin-short {
    position: relative;
    margin: 0 16px 8px;
    padding: 14px 40px 14px 16px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface-raised);
}

.coin-short__title { margin: 0; font-size: 15px; font-weight: 700; }

.coin-short__detail { margin: 4px 0 12px; color: var(--text-sub); font-size: 13px; }

.coin-short__buttons { display: flex; flex-wrap: wrap; gap: 8px; }

.coin-short__charge { width: auto; height: 40px; padding: 0 16px; font-size: 14px; }

.coin-short__fallback {
    height: 40px;
    padding: 0 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    color: var(--text);
    font-size: 14px;
}

.coin-short__close { position: absolute; right: 8px; top: 8px; color: var(--text-mute); }

/* 글을 쓰는 중(입력칸에 포커스)이면 안내를 위쪽에 — 휴대폰 브라우저에서 키보드가 아래 안내를 가리지 않게 (앱 Toast.UseKeyboard와 같은 목적) */
:root:has(input:focus, textarea:focus) .toast { top: 76px; bottom: auto; }

/* 생성 중 · 중단 · 오류 카드 (Figma 483:2 S01 ~ S06) · 답변 ♥ */
.typing-dots { display: inline-flex; gap: 5px; padding: 4px 2px; }

.typing-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-mute);
    animation: typing-dot 1.2s ease-in-out infinite;
}

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

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

@keyframes typing-dot {
    0%, 60%, 100% { opacity: .3; }
    30% { opacity: 1; }
}

.msg__status { margin: 0 0 4px; color: var(--text-mute); font-size: 12px; }

.msg__stopped {
    padding: 1px 8px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-mute);
    font-size: 11px;
}

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

.error-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 4px 18px 18px 18px;
    background: var(--surface);
}

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

.error-card__retry {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 14px;
    border: 1px solid var(--accent);
    border-radius: 999px;
    color: var(--accent);
    font-size: 13px;
    font-weight: 700;
}

.error-card__retry:disabled { opacity: .4; cursor: default; }

.chat-input__stop { background: var(--surface-raised); }

.chat-input__stop-mark { width: 14px; height: 14px; border-radius: 3px; background: var(--text); }

/* GL · BL 작품에서 성별 때문에 빠진 프로필 안내 */
.profile-hidden-note { margin: 10px 4px 0; color: var(--text-mute); font-size: 12px; line-height: 17px; }

/* 말풍선 아래 "기억에 고정됨" · 내 말풍선 메뉴 · 기억 칩 (앱 MemoryNoticeView) */
.msg__mine { position: relative; display: flex; flex-direction: column; align-items: flex-end; max-width: min(560px, 82%); }

.msg__mine .bubble--user { max-width: 100%; text-align: left; cursor: pointer; }

.msg__mine .bubble--user:disabled { cursor: default; }

.msg__mine-popover { left: auto; right: 0; top: auto; bottom: calc(100% + 6px); }

.msg__pinned { display: flex; align-items: center; gap: 4px; margin-top: 6px; color: var(--accent); font-size: 12px; }

.memory-chip {
    align-self: center;
    flex: none;
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-sub);
    font-size: 13px;
}

.memory-chip__link { color: var(--accent); font-weight: 700; }

.menu-item--count { grid-template-columns: 24px 1fr auto; }

.menu-item__count { grid-column: 3; grid-row: 1 / span 2; color: var(--text-mute); font-size: 13px; }

/* 기억 화면 (앱 MemoryScreenView · Figma 318:2) — 대화방 칼럼을 덮습니다 */
.memory, .note-editor {
    position: absolute;
    inset: 0;
    z-index: 8;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    outline: none;
}

.note-editor { z-index: 9; }

.memory__head { display: flex; flex: none; align-items: center; gap: 8px; height: 56px; padding: 0 12px; }

.memory__title { font-size: 18px; font-weight: 700; }

.memory__head-end { margin-left: auto; color: var(--text-sub); }

.memory__tabs { display: flex; flex: none; border-bottom: 1px solid var(--border); }

.memory__tab { flex: 1; height: 46px; border-bottom: 2px solid transparent; color: var(--text-mute); font-size: 15px; text-align: center; }

.memory__tab.is-active { border-bottom-color: var(--accent); color: var(--text); font-weight: 700; }

.memory__body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px var(--gutter) 32px; }

.memory-usage { padding: 14px 16px; border-radius: 14px; background: var(--surface); }

.memory-usage__row { display: flex; align-items: center; justify-content: space-between; }

.memory-usage__label { font-size: 15px; font-weight: 700; white-space: pre-wrap; }

.memory-usage.is-full .memory-usage__label { color: var(--alert); }

.memory-usage__more { color: var(--accent); font-size: 13px; font-weight: 500; }

.memory-usage__bar {
    display: block;
    width: 100%;
    height: 6px;
    margin-top: 10px;
    border: 0;
    border-radius: 3px;
    overflow: hidden;
    appearance: none;
    background: var(--border);
}

.memory-usage__bar::-webkit-progress-bar { background: var(--border); }

.memory-usage__bar::-webkit-progress-value { background: var(--accent); }

.memory-usage__bar::-moz-progress-bar { background: var(--accent); }

.memory-usage.is-full .memory-usage__bar::-webkit-progress-value { background: var(--alert); }

.memory-usage.is-full .memory-usage__bar::-moz-progress-bar { background: var(--alert); }

.memory-usage__hint { margin-top: 8px; color: var(--text-mute); font-size: 12px; line-height: 17px; }

.memory-empty { padding: 36px 0; color: var(--text-mute); font-size: 14px; line-height: 21px; text-align: center; white-space: pre-line; }

.memory-group { display: flex; align-items: center; gap: 4px; margin: 22px 0 10px; color: var(--text-sub); font-size: 14px; font-weight: 700; }

.memory-group__hint { margin: -4px 0 10px; color: var(--text-mute); font-size: 12px; line-height: 17px; }

.memory-card { padding: 12px 14px 8px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }

.memory-card + .memory-card { margin-top: 10px; }

.memory-card.is-pinned { border-color: var(--accent); }

.memory-card.is-inactive { opacity: 0.5; }

.memory-card__text { font-size: 15px; line-height: 22px; overflow-wrap: anywhere; white-space: pre-wrap; }

.memory-card__foot { display: flex; align-items: center; gap: 10px; margin-top: 6px; }

.memory-card__meta { margin-right: auto; color: var(--text-mute); font-size: 12px; }

.memory-card__pin, .memory-card__edit { color: var(--text-mute); }

.memory-card__pin[aria-pressed="true"] { color: var(--accent); }

.memory-add, .memory-outline {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    height: 48px;
    margin-top: 16px;
    border: 1px solid var(--accent);
    border-radius: 12px;
    color: var(--accent);
    font-size: 15px;
    font-weight: 500;
}

.memory-add { border-style: dashed; }

.memory-outline:disabled { opacity: 0.4; }

.memory-outline.is-remaking { animation: memory-breathe 1.6s ease-in-out infinite; }

@keyframes memory-breathe {
    50% { opacity: 0.4; }
}

.memory-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }

.memory-line__meta, .memory-line__count { color: var(--text-mute); font-size: 13px; }

.memory-line__title { font-size: 15px; font-weight: 700; }

.memory-doc { padding: 14px 16px; border-radius: 14px; background: var(--surface); }

.memory-doc__line { min-height: 22px; font-size: 15px; line-height: 22px; overflow-wrap: anywhere; white-space: pre-wrap; }

.memory-doc__line.is-heading { color: var(--accent); font-weight: 700; }

.memory-switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 16px; padding: 4px 8px; }

.memory-switch__text { display: grid; gap: 4px; }

.memory-switch__title { font-size: 15px; font-weight: 500; }

.memory-switch__desc { color: var(--text-mute); font-size: 12px; line-height: 17px; }

.memory-switch .toggle:disabled { opacity: 0.4; }

.memory-info { margin-bottom: 14px; padding: 12px 14px; border-radius: 12px; background: var(--surface-selected); color: var(--text-sub); font-size: 13px; line-height: 19px; }

.memory-segments.is-remaking { opacity: 0.45; }

.memory-segment { padding: 12px 14px; border-radius: 14px; background: var(--surface); }

.memory-segment + .memory-segment { margin-top: 10px; }

.memory-segment__head { display: flex; align-items: center; gap: 8px; }

.memory-segment__range { color: var(--text-sub); font-size: 13px; font-weight: 700; }

.memory-segment__latest { padding: 2px 7px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 700; }

.memory-segment__edit { margin-left: auto; color: var(--text-mute); }

.memory-segment__text { margin-top: 6px; font-size: 14px; line-height: 21px; overflow-wrap: anywhere; white-space: pre-wrap; }

.memory-remake-note { margin-top: 8px; color: var(--text-mute); font-size: 12px; text-align: center; }

/* 사건 기억 편집 시트 */
.memory-sheet__field, .note-editor__field {
    display: block;
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 12px;
    outline: none;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    resize: none;
}

.memory-sheet__field { margin-top: 14px; padding: 12px 14px; line-height: 22px; }

.memory-sheet__field:focus, .note-editor__field:focus { border-color: var(--accent); }

.memory-sheet__field::placeholder, .note-editor__field::placeholder { color: var(--text-mute); }

.memory-sheet__count { margin-top: 6px; color: var(--text-mute); font-size: 12px; text-align: right; }

.memory-sheet__origin { display: flex; align-items: center; justify-content: space-between; width: 100%; height: 48px; padding: 0 8px; font-size: 15px; }

.memory-sheet__origin-turn { color: var(--text-mute); font-size: 13px; }

.memory-sheet__buttons { display: flex; align-items: center; gap: 12px; margin-top: 14px; }

.memory-sheet__delete { display: flex; flex: none; align-items: center; gap: 4px; height: 52px; padding: 0 12px; color: var(--danger); font-size: 15px; }

.memory-sheet__save { flex: 1; height: 52px; font-size: 16px; }

/* 글 편집기 (앱 NoteEditorView · L06 · L07) */
.note-editor__top-save { color: var(--accent); font-size: 15px; font-weight: 700; }

.note-editor__top-save:disabled { color: var(--text-mute); }

.note-editor__body { flex: 1; min-height: 0; overflow-y: auto; padding: 8px var(--gutter) 32px; }

.note-editor__headings { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }

.note-editor__headings-label { flex-basis: 100%; color: var(--text-sub); font-size: 13px; font-weight: 700; }

.note-editor__chip { padding: 6px 12px; border-radius: 999px; background: var(--surface-raised); color: var(--text-sub); font-size: 13px; }

.note-editor__field { height: 300px; padding: 14px; line-height: 23px; }

.note-editor__field.is-full, .note-editor__field.is-full:focus { border-color: var(--danger); }

.note-editor__count { margin-top: 6px; color: var(--text-mute); font-size: 12px; text-align: right; }

.note-editor__count.is-full { color: var(--danger); }

.note-editor__banner { display: flex; align-items: center; gap: 12px; margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: var(--surface-selected); }

.note-editor__banner-text { display: grid; flex: 1; gap: 4px; font-size: 13px; }

.note-editor__banner-text span { color: var(--text-sub); }

.note-editor__banner-button { flex: none; padding: 8px 12px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: 13px; font-weight: 700; }

.note-editor__load { display: grid; gap: 4px; width: 100%; margin-top: 10px; padding: 12px 14px; border-radius: 12px; background: var(--surface); text-align: left; }

.note-editor__load-title { font-size: 15px; font-weight: 500; }

.note-editor__load-sub { color: var(--text-mute); font-size: 12px; }

.note-editor__tips { margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: var(--surface); color: var(--text-sub); font-size: 13px; line-height: 20px; }

.note-editor__tips summary { color: var(--text); font-size: 14px; font-weight: 500; cursor: pointer; }

.note-editor__tips p:first-of-type { margin-top: 8px; }

.note-editor__save { height: 52px; margin-top: 16px; font-size: 16px; }

.note-editor__hint { margin-top: 8px; color: var(--text-mute); font-size: 12px; text-align: center; }

.note-load { display: grid; gap: 8px; margin: 14px 0 0; }

.note-load__row { display: grid; gap: 4px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; text-align: left; }

.note-load__row.is-selected { border-color: var(--accent); background: var(--surface-selected); }

.note-load__title { overflow: hidden; font-size: 15px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }

.note-load__preview {
    display: -webkit-box;
    overflow: hidden;
    color: var(--text-mute);
    font-size: 13px;
    line-height: 19px;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

/* 사건 기억 한도 팝업 (L10) */
.memory-limit { display: grid; justify-items: center; color: var(--text); text-align: center; }

.memory-limit .icon { color: var(--accent); }

.memory-limit__title { margin-top: 8px; font-size: 17px; font-weight: 700; }

.memory-limit__desc { margin-top: 8px; color: var(--text-sub); font-size: 14px; line-height: 20px; }

.memory-limit__compare { display: flex; align-items: center; gap: 12px; margin-top: 14px; color: var(--text-sub); font-size: 14px; }

.memory-limit__compare strong { color: var(--text); }

.memory-limit__button { height: 52px; margin-top: 16px; font-size: 15px; }

.memory-limit .memory-outline { margin-top: 10px; }

.memory-limit__close { height: 40px; margin-top: 6px; color: var(--text-mute); font-size: 14px; }

/* 추천 메시지 ✦ (앱 ReplySuggestionBar · Figma 486:2) */
.suggest { position: relative; z-index: 6; flex: none; padding: 6px var(--gutter) 0; border-top: 1px solid var(--border); background: var(--bg); }

.suggest + .chat-input { border-top: 0; }

/* 패널이 열려 있을 때 바깥을 누르면 닫히지만, 입력창은 그대로 쓸 수 있게 닫는 영역 위로 올립니다 */
.chat:has(.suggest__panel) .chat-input { position: relative; z-index: 6; background: var(--bg); }

.suggest__spark {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--surface);
    color: var(--accent);
}

.suggest__spark.is-active { background: var(--accent); color: var(--on-accent); }

.suggest__spark:disabled { opacity: 0.35; }

.suggest__panel { margin-bottom: 8px; padding: 12px 14px; border-radius: 14px; background: var(--surface); }

.suggest__head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }

.suggest__title { margin-right: auto; font-size: 14px; font-weight: 700; }

.suggest__pager { display: flex; align-items: center; gap: 4px; color: var(--text-sub); font-size: 12px; }

.suggest__pager .icon-button:disabled { opacity: 0.3; }

.suggest__refresh { display: flex; align-items: center; gap: 4px; color: var(--accent); font-size: 13px; }

.suggest__refresh:disabled { opacity: 0.4; }

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

.suggest__list { display: grid; gap: 8px; max-height: 38vh; margin-top: 10px; overflow-y: auto; scrollbar-width: thin; }

.suggest__card {
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--surface-raised);
    font-size: 14px;
    line-height: 21px;
    overflow-wrap: anywhere;
    text-align: left;
    white-space: pre-wrap;
}

.suggest__skeleton { display: grid; gap: 8px; margin-top: 10px; animation: memory-breathe 1.2s ease-in-out infinite; }

.suggest__skeleton span { height: 40px; border-radius: 10px; background: var(--surface-raised); }

.suggest-sheet__text { margin: 0 8px; color: var(--text-sub); font-size: 14px; line-height: 22px; white-space: pre-line; }

.suggest-sheet__hide { display: flex; align-items: center; gap: 10px; margin: 18px 8px 0; color: var(--text-sub); font-size: 14px; cursor: pointer; }
