/* 4a 홈 호스트 카드·쉬는 중 행 (design_handoff_web_app_4a README "홈").
 * 마크업은 partials/_character_card.html, 상태 갱신은 index.html SSE 스크립트.
 * 레거시 style.css 홈 카드 규칙(2열 사진 카드, 절대 위치 .live-badge 등)을
 * .home-section 범위에서 덮는다. 칩·배너·섹션 머리는 home-4a.css. */

/* ── 호스트 카드(공통) ── */
.home-card-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.home-section .character-card {
    display: block;
    padding: 16px;
    border: 1px solid var(--c4a-line);
    border-radius: var(--c4a-radius-card);
    background: var(--c4a-surface);
    box-shadow: none;
    color: var(--c4a-ink);
    overflow: visible;
    content-visibility: auto;
    contain-intrinsic-size: auto 220px;
    transform: none;
}

.home-section [data-host-grid] .character-card {
    cursor: pointer;
}

.home-section .character-card:hover {
    border-color: var(--c4a-line);
    box-shadow: none;
}

.home-card-list > .character-card.hc-first,
.home-card-list:not(:has(.hc-first)) > .character-card:first-child {
    box-shadow: var(--c4a-shadow);
}

.home-section .character-card.is-filtered-out {
    display: none !important;
}

.home-section .character-card.status-highlight {
    animation: none;
    box-shadow: 0 0 0 2px var(--c4a-green);
}

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

.hc-avatar {
    position: relative;
    flex: none;
    width: 56px;
    height: 56px;
}

.hc-avatar .character-image {
    width: 100%;
    height: 100%;
    border-radius: 99px;
    object-fit: cover;
    background: var(--c4a-surface-alt);
}

.hc-avatar .placeholder-image {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--c4a-ink);
    color: #ffffff;
    font: 700 18px/1 var(--c4a-font-text);
}

.hc-dot {
    position: absolute;
    right: 0;
    bottom: 1px;
    width: 14px;
    height: 14px;
    border: 2.5px solid var(--c4a-surface);
    border-radius: 99px;
    background: var(--c4a-text-tertiary);
}

[data-state='available'] .hc-dot,
[data-state='request'] .hc-dot {
    background: var(--c4a-green);
}

[data-state='busy'] .hc-dot,
[data-state='scheduled'] .hc-dot {
    background: var(--c4a-amber);
}

.hc-ident {
    flex: 1;
    min-width: 0;
}

.hc-name-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    min-width: 0;
}

.home-section .character-name {
    display: block;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    color: var(--c4a-ink);
    font: 700 17px/1.2 var(--c4a-font-text);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hc-verified {
    font-size: 16px;
    color: var(--c4a-green);
}

.hc-new-host {
    flex: none;
    padding: 3px 7px;
    border-radius: 99px;
    background: var(--c4a-green-soft);
    color: var(--c4a-green-text);
    font: 700 11px/1.4 var(--c4a-font-text);
}

/* 상태 칩: 텍스트 병기, green / amber / gray. 레거시 절대 위치 배지를 인라인 칩으로. */
.home-section .live-badge {
    position: static;
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 20px;
    margin-left: 4px;
    padding: 0 7px;
    border-radius: 6px;
    background: var(--c4a-green-soft);
    color: var(--c4a-green);
    font: 600 11px/1 var(--c4a-font-text);
    white-space: nowrap;
    box-shadow: none;
    transform: none;
}

.home-section .live-badge .live-dot {
    display: none;
}

.home-section .live-badge.busy,
.home-section .live-badge.scheduled {
    background: var(--c4a-amber-soft);
    color: var(--c4a-amber-text);
}

.home-section .live-badge.resting {
    background: var(--c4a-surface-alt);
    color: var(--c4a-text-secondary);
}

.home-section .character-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0 6px;
    margin: 5px 0 0;
    color: var(--c4a-text-secondary);
    font: 400 13px/1.3 var(--c4a-font-text);
    font-variant-numeric: tabular-nums;
}

.home-section .character-meta > * + *::before {
    content: '·';
    margin-right: 6px;
}

.home-section .character-stat {
    display: inline;
    gap: 0;
    color: inherit;
    font-weight: 400;
}

.home-section .character-stat .character-stat-label,
.home-section .character-stat .character-stat-value {
    color: inherit;
    font-size: inherit;
    font-weight: 400;
    letter-spacing: 0;
    text-transform: none;
}

.home-section .stat-rating .ms {
    margin-right: 2px;
    font-size: 14px;
    color: var(--c4a-amber);
    vertical-align: -2px;
}

/* 무료통화/무료 메시지(상호배타 한 자리) — 레거시 절대 위치 배지를 메타 한 칸으로. */
.home-section .hc-perk {
    position: static;
    padding: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    color: var(--c4a-green);
    font-size: inherit;
    font-weight: 600;
    line-height: inherit;
    letter-spacing: 0;
}

/* ── 목소리 플레이어(한 번에 하나 — home-voice-preview.js) ── */
.hc-voice {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 14px;
    padding: 10px 12px;
    border-radius: 14px;
    background: var(--c4a-surface-alt);
}

.hc-voice .voice-preview-btn {
    position: static;
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--c4a-btn-border);
    border-radius: 99px;
    background: var(--c4a-surface);
    color: var(--c4a-ink);
    backdrop-filter: none;
    animation: none;
    transform: none;
}

.hc-voice .voice-preview-btn.playing {
    border-color: var(--c4a-green);
    background: var(--c4a-green);
    color: #ffffff;
    box-shadow: none;
}

.hc-voice .voice-preview-btn .ms {
    font-size: 24px;
    margin: 0;
}

.hc-voice .voice-pause-icon,
.hc-voice .voice-preview-btn.playing .voice-play-icon {
    display: none;
}

.hc-voice .voice-preview-btn.playing .voice-pause-icon {
    display: inline-block;
}

.hc-wave {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 3px;
    min-width: 0;
    height: 28px;
    overflow: hidden;
}

.hc-wave i {
    flex: none;
    width: 3px;
    border-radius: 99px;
    background: var(--c4a-text-tertiary);
}

.hc-voice:has(.playing) .hc-wave i {
    background: var(--c4a-green);
    animation: hcWave 1s ease-in-out infinite alternate;
}

.hc-voice:has(.playing) .hc-wave i:nth-child(3n) {
    animation-delay: -.4s;
}

.hc-voice:has(.playing) .hc-wave i:nth-child(3n + 1) {
    animation-delay: -.7s;
}

@keyframes hcWave {
    from { transform: scaleY(.45); }
    to { transform: scaleY(1); }
}

.hc-voice-label {
    flex: none;
    color: var(--c4a-text-secondary);
    font: 500 12px/1 var(--c4a-font-text);
}

.home-section .hc-greeting {
    display: block;
    margin: 14px 0 0;
    color: var(--c4a-ink);
    font: 400 15px/1.55 var(--c4a-font-text);
    -webkit-line-clamp: unset;
    overflow-wrap: anywhere;
}

/* ── 가격 + CTA ── */
.hc-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 16px;
}

.hc-foot .character-price {
    display: inline;
    color: var(--c4a-text-secondary);
    font: 400 13px/1 var(--c4a-font-text);
}

.hc-foot .character-price strong {
    color: var(--c4a-ink);
    font: 700 16px/1 var(--c4a-font-text);
    font-variant-numeric: tabular-nums;
}

.hc-cta {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 44px;
    padding: 0 20px;
    border-radius: var(--c4a-radius-btn);
    font: 600 14px/1 var(--c4a-font-text);
    text-decoration: none;
}

.hc-cta .ms {
    font-size: 18px;
}

.hc-cta-call {
    display: none;
    background: var(--c4a-ink);
    color: #ffffff;
}

.hc-cta-message {
    border: 1px solid var(--c4a-btn-border);
    background: var(--c4a-surface);
    color: var(--c4a-ink);
}

[data-state='available'] .hc-cta-call {
    display: inline-flex;
}

[data-state='available'] .hc-cta-message {
    display: none;
}

/* ── 쉬는 중 · AI 행 ── */
.home-row-list {
    padding-bottom: 20px;
}

.home-section .character-card.hc-row {
    display: flex;
    flex-direction: row; /* style.css 레거시 카드가 column 이다 */
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border: 0;
    border-top: 1px solid var(--c4a-list-divider);
    border-radius: 0;
    box-shadow: none;
    contain-intrinsic-size: auto 68px;
    text-decoration: none;
}

.hc-row .hc-head {
    flex: 1;
}

.hc-row .hc-avatar {
    width: 44px;
    height: 44px;
    filter: grayscale(.5);
}

.hc-row .hc-dot {
    display: none;
}

.hc-row .character-name {
    font-size: 15px;
}

.hc-row .character-meta {
    font-size: 12.5px;
}

.hc-row .character-price {
    display: inline;
    color: inherit;
    font: inherit;
}

.hc-notify {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--c4a-btn-border);
    border-radius: 99px;
    background: var(--c4a-surface);
    color: var(--c4a-ink);
    font: 600 13px/1 var(--c4a-font-text);
    cursor: pointer;
}

.hc-notify .ms {
    font-size: 16px;
}

.hc-notify[aria-pressed='true'] {
    border-color: var(--c4a-green-soft);
    background: var(--c4a-green-soft);
    color: var(--c4a-green);
}

.ai-character-list .hc-avatar {
    filter: none;
}

/* 태블릿·데스크톱은 깨지지 않게만: 카드 2열, 행은 그대로. */
@media (min-width: 768px) {
    .home-card-list {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
