/* Shared: Auth modal, Toast, Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font: inherit; }
input, textarea { font: inherit; }

.room-cover-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
    display: block;
    min-width: 0;
    min-height: 0;
    max-width: 100%;
    max-height: 100%;
}

/* Avatar: large source images must not blow flex layouts (min-width: auto) */
.room-avatar,
.d-card-avatar,
.d-rank-av,
.m-card-avatar,
.m-profile-av,
.m-rank-av,
.m-rank-table-row .m-rank-av,
.d-rank-table-row .av,
.d-profile-av,
.m-avatar,
.d-avatar {
    overflow: hidden;
    flex-shrink: 0;
}

.avatar-img,
.room-avatar img,
.d-card-avatar img,
.d-rank-av img,
.m-card-avatar img,
.m-profile-av img,
.m-rank-av img,
.d-rank-table-row .av img,
.d-profile-av img,
.m-avatar img,
.d-avatar img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    min-width: 0;
    min-height: 0;
    max-width: 100%;
    max-height: 100%;
}

img.m-chat-av,
img.d-chat-av,
img.chat-room-avatar {
    display: block;
    object-fit: cover;
    flex-shrink: 0;
    min-width: 0;
    min-height: 0;
    max-width: 100%;
    max-height: 100%;
}

.toast {
    position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
    padding: 12px 24px; border-radius: 8px; color: #fff; font-size: 0.875rem; z-index: 99999;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}
.toast.success { background: #10b981; }
.toast.error { background: #ef4444; }

.modal-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.6);
    z-index: 100000; align-items: center; justify-content: center; padding: 16px;
    backdrop-filter: blur(4px);
}
.modal-overlay.show { display: flex; }

.auth-modal {
    background: #fff; border-radius: 16px; width: 100%; max-width: 420px;
    max-height: 90vh; overflow-y: auto; padding: 32px; position: relative;
    box-shadow: 0 24px 80px rgba(0,0,0,0.25);
}
.modal-close {
    position: absolute; top: 16px; right: 20px; font-size: 1.5rem;
    color: #999; line-height: 1;
}
.auth-tabs { display: flex; margin-bottom: 24px; border-bottom: 2px solid #eee; }
.auth-tab {
    flex: 1; padding: 12px; text-align: center; font-weight: 600;
    color: #999; border-bottom: 2px solid transparent; margin-bottom: -2px;
}
.auth-tab.active { color: #7c5cfc; border-bottom-color: #7c5cfc; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 0.8125rem; font-weight: 500; margin-bottom: 6px; color: #666; }
.form-group input {
    width: 100%; padding: 12px 14px; border: 1px solid #e0e0e0;
    border-radius: 8px; outline: none; font-size: 0.9375rem; transition: border-color 0.15s;
}
.form-group input:focus { border-color: #7c5cfc; box-shadow: 0 0 0 3px rgba(124,92,252,0.12); }
.form-check { display: flex; align-items: center; gap: 8px; font-size: 0.8125rem; color: #666; margin-bottom: 20px; }
.btn-primary {
    width: 100%; padding: 14px; background: #7c5cfc; color: #fff;
    border-radius: 10px; font-weight: 600; font-size: 0.9375rem; transition: background 0.15s;
}
.btn-primary:hover { background: #6344e0; }

/* Live video player */
.live-player-wrap {
    position: relative;
    width: 100%;
    height: 100%;
    background: #000;
}
.live-player-video {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    background: #000;
}
.m-live-video-player {
    aspect-ratio: 16/9;
    min-height: 200px;
    padding: 0 !important;
    display: block !important;
}
.m-live-video-player .live-player-wrap { aspect-ratio: 16/9; }

.d-theater-player-video {
    padding: 0 !important;
    min-height: 480px;
}
.d-theater-player-video .live-player-wrap { min-height: 480px; }

.live-player-end {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
}
.live-player-end.hidden { display: none; }
.live-player-end-inner { text-align: center; color: #fff; padding: 32px; max-width: 360px; }
.live-player-end-icon { font-size: 3.5rem; margin-bottom: 16px; }
.live-player-end-msg { font-size: 1.0625rem; font-weight: 600; line-height: 1.5; margin-bottom: 8px; }
.live-player-end-sub { font-size: 0.875rem; color: #aaa; margin-bottom: 20px; }
.live-player-end-btn {
    display: inline-block;
    padding: 12px 28px;
    background: #7c5cfc;
    color: #fff;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9375rem;
    border: none;
    cursor: pointer;
}
.live-player-end-btn:hover { background: #6344e0; }

/* Paywall */
.live-paywall {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    width: 100%; height: 100%; min-height: 200px; background: #111; color: #ccc; text-align: center; padding: 32px;
}
.live-paywall-icon { font-size: 3.5rem; margin-bottom: 16px; }
.live-paywall p { font-size: 1.0625rem; font-weight: 600; color: #fff; margin-bottom: 8px; }
.live-paywall-sub { font-size: 0.875rem; color: #888; margin-bottom: 16px; }

/* CHAT-only room */
.chat-room-only {
    width: 100%; min-height: 200px; background: linear-gradient(135deg, #1a1a2e, #16213e);
    color: #fff; padding: 24px; display: flex; flex-direction: column; justify-content: center;
}
.chat-room-header { display: flex; gap: 16px; align-items: center; margin-bottom: 12px; }
.chat-room-avatar { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.chat-room-avatar-fallback {
    display: flex; align-items: center; justify-content: center;
    background: #7c5cfc; font-weight: 700; font-size: 1.5rem;
}
.chat-room-header strong { display: block; font-size: 1.125rem; }
.chat-room-header p { font-size: 0.875rem; opacity: 0.85; margin-top: 4px; }
.chat-room-badge {
    display: inline-block; margin-top: 6px; background: #7c5cfc;
    padding: 2px 8px; border-radius: 4px; font-size: 0.6875rem; font-weight: 700;
}
.chat-room-hint { font-size: 0.8125rem; opacity: 0.75; }

.m-live-chat-only .m-live-chat-header { min-height: auto; padding: 0 !important; }
.d-theater-chat-only .d-theater-chat { flex: 1; }
.d-theater-chat-only-head { padding: 0; }
.d-theater-chat-only .d-theater-chat-only-head .chat-room-only { border-radius: 0; }

/* Chat lines */
/* Chat bubbles: BJ left, viewers right, gifts center */
.chat-msgs-area,
.m-live-chat,
.m-chat-full-msgs,
.d-theater-msgs,
.d-chat-full-msgs {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
}

.m-chat-full-input,
.m-live-input,
.d-chat-full-input,
.d-theater-input {
    flex-shrink: 0;
}

.chat-line {
    display: flex;
    width: 100%;
    font-size: 0.8125rem;
    line-height: 1.4;
}
.chat-line.chat-left { justify-content: flex-start; }
.chat-line.chat-right { justify-content: flex-end; }
.chat-line.chat-center { justify-content: center; }

.chat-bubble {
    max-width: 78%;
    padding: 8px 12px;
    border-radius: 14px;
    word-break: break-word;
}
.chat-bubble-left {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-bottom-left-radius: 4px;
}
.chat-bubble-right {
    background: #7c5cfc;
    color: #fff;
    border-bottom-right-radius: 4px;
}
.chat-bubble-right .nick { color: #e9e0ff; }
.chat-bubble-center {
    background: linear-gradient(135deg, #fff5f7, #fdf2f8);
    border: 1px solid #fbcfe8;
    color: #be185d;
    text-align: center;
    max-width: 90%;
    border-radius: 20px;
    padding: 10px 16px;
}
.chat-bubble-center.is-gift { font-weight: 600; }
.chat-bubble .nick {
    display: block;
    font-weight: 700;
    font-size: 0.6875rem;
    margin-bottom: 3px;
    color: #7c5cfc;
}
.chat-bubble-right .nick { color: rgba(255,255,255,0.85); }
.chat-bubble .text { display: block; }
.chat-gift-nick {
    display: block;
    font-size: 0.6875rem;
    font-weight: 700;
    margin-bottom: 2px;
    opacity: 0.85;
}
.chat-gift-text { display: block; font-size: 0.875rem; }

.d-theater-msgs .chat-bubble-left { background: var(--d-surface-2, #1e1e28); border-color: #333; color: #eee; }
.d-theater-msgs .chat-bubble-left .nick { color: #b49cff; }
.d-theater-msgs .chat-bubble-right { background: #6344e0; }

.m-live-chat .chat-bubble-left,
.m-chat-full-msgs .chat-bubble-left {
    background: var(--m-surface-2, #1e1e28);
    border-color: #333;
    color: #eee;
}
.m-live-chat .chat-bubble-left .nick,
.m-chat-full-msgs .chat-bubble-left .nick { color: #b49cff; }
.m-live-chat .chat-bubble-right,
.m-chat-full-msgs .chat-bubble-right { background: #6344e0; }

.d-chat-full-msgs .chat-bubble-left { background: var(--d-surface-2, #1e1e28); border-color: #333; color: #eee; }
.d-chat-full-msgs .chat-bubble-left .nick { color: #b49cff; }
.d-chat-full-msgs .chat-bubble-right { background: #6344e0; }

/* LIVE chat disabled — same layout, not clickable */
.chat-form-disabled {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
    opacity: 0.55;
    cursor: not-allowed;
}
.chat-form-disabled .gift-trigger,
.chat-form-disabled button[type="submit"] {
    pointer-events: none;
    cursor: not-allowed;
}
.chat-form-disabled input[disabled] {
    flex: 1;
    pointer-events: none;
    cursor: not-allowed;
    opacity: 1;
}
.d-theater-input.chat-form-disabled { gap: 8px; padding: 12px 16px; }
.d-chat-full-input.chat-form-disabled { gap: 10px; padding: 16px 32px; }
.m-live-input.chat-form-disabled,
.m-chat-full-input.chat-form-disabled {
    gap: 8px;
    padding: 10px 14px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
}
.m-chat-full-input.chat-form-disabled { padding: 12px 16px; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
.m-live-input.chat-form-disabled input[disabled],
.m-chat-full-input.chat-form-disabled input[disabled] {
    background: var(--m-bg, #0f0f13);
    border: 1px solid var(--m-border, rgba(255,255,255,0.08));
    color: var(--m-text-muted, #8b8b9e);
}
.chat-unlock-btn {
    flex: 1;
    padding: 10px 14px;
    background: #7c5cfc;
    color: #fff;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    text-align: center;
    display: inline-block;
}
.chat-form-disabled:has(.chat-unlock-btn) {
    opacity: 1;
    cursor: default;
}

.gift-trigger { background: none; border: none; font-size: 1.25rem; cursor: pointer; padding: 0 4px; }

/* Gift modal */
.gift-modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 100001;
    display: flex; align-items: center; justify-content: center; padding: 16px;
}
.gift-modal-overlay.hidden { display: none; }
.gift-modal {
    background: #fff; border-radius: 16px; padding: 24px; width: 100%; max-width: 400px; position: relative;
}
.gift-modal-close { position: absolute; top: 12px; right: 16px; font-size: 1.5rem; color: #999; background: none; border: none; }
.gift-modal h3 { text-align: center; margin-bottom: 16px; }
.gift-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.gift-option {
    display: flex; flex-direction: column; align-items: center; padding: 12px;
    border: 2px solid #eee; border-radius: 10px; cursor: pointer; text-align: center;
}
.gift-option:has(input:checked) { border-color: #7c5cfc; background: #f8f6ff; }
.gift-option input { display: none; }
.gift-icon { font-size: 1.5rem; }
.gift-name { font-size: 0.8125rem; font-weight: 600; margin-top: 4px; }
.gift-cost { font-size: 0.75rem; color: #888; }

/* ========== Support page (고객센터) ========== */
.support-page-wrap {
    max-width: 1040px;
    margin: 0 auto;
    padding-bottom: 24px;
}

.support-page { width: 100%; }

.support-hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    padding: 24px 22px;
    margin-bottom: 20px;
    color: #fff;
    box-shadow: 0 8px 28px rgba(102, 126, 234, 0.28);
}
.support-hero-inner {
    display: flex;
    align-items: center;
    gap: 16px;
}
.support-hero-icon {
    width: 52px; height: 52px;
    background: rgba(255,255,255,0.18);
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.625rem;
    flex-shrink: 0;
}
.support-hero h1 {
    font-size: 1.375rem;
    font-weight: 800;
    margin: 0 0 4px;
    line-height: 1.2;
}
.support-hero p {
    margin: 0;
    font-size: 0.875rem;
    opacity: 0.92;
}

.support-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    align-items: start;
}
@media (min-width: 1024px) {
    .support-layout {
        grid-template-columns: 1.15fr 0.85fr;
        gap: 24px;
    }
}

/* Chat panel */
.support-chat-panel {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 480px;
}
.support-chat-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    background: #0f0f13;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}
.support-chat-head-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.support-chat-avatar {
    width: 42px; height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7c5cfc, #a855f7);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 800;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.support-chat-head strong {
    display: block;
    color: #f0f0f5;
    font-size: 0.9375rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.support-chat-head span {
    display: block;
    color: #8b8b9e;
    font-size: 0.75rem;
    margin-top: 2px;
}
.support-status {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.6875rem;
    font-weight: 700;
    color: #34d399;
    background: rgba(52, 211, 153, 0.12);
    border: 1px solid rgba(52, 211, 153, 0.25);
    padding: 5px 10px;
    border-radius: 20px;
}
.support-status i {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: #34d399;
    animation: supportPulse 1.8s infinite;
}
@keyframes supportPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.45; transform: scale(0.85); }
}

.support-chat-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: #f4f5f9;
}

.support-chat-msgs {
    flex: 1;
    min-height: 300px;
    max-height: 420px;
    overflow-y: auto;
    padding: 18px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    -webkit-overflow-scrolling: touch;
}
@media (min-width: 1024px) {
    .support-chat-msgs { max-height: 480px; min-height: 360px; }
}

.support-chat-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 32px 20px;
    color: #9ca3af;
    min-height: 200px;
}
.support-chat-empty.hidden { display: none; }
.support-chat-empty-icon { font-size: 2.25rem; margin-bottom: 12px; opacity: 0.85; }
.support-chat-empty p {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.6;
    color: #888;
}

.support-chat-line {
    display: flex;
    width: 100%;
    font-size: 0.875rem;
    line-height: 1.5;
}
.support-chat-line.chat-left { justify-content: flex-start; }
.support-chat-line.chat-right { justify-content: flex-end; }

.support-chat-bubble {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 16px;
    word-break: break-word;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.support-chat-bubble.left {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 4px;
    color: #1f2937;
}
.support-chat-bubble.right {
    background: linear-gradient(135deg, #7c5cfc, #6344e0);
    color: #fff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 12px rgba(124, 92, 252, 0.25);
}
.support-chat-bubble .nick {
    display: block;
    font-weight: 700;
    font-size: 0.6875rem;
    margin-bottom: 4px;
    color: #7c5cfc;
}
.support-chat-bubble.right .nick { color: rgba(255,255,255,0.88); }
.support-chat-bubble .time {
    display: block;
    font-size: 0.625rem;
    opacity: 0.55;
    margin-top: 6px;
    text-align: right;
}

.support-chat-input {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 14px 16px;
    background: #fff;
    border-top: 1px solid #e8e8ec;
    flex-shrink: 0;
}
.support-chat-input input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e0e0e6;
    border-radius: 24px;
    font-size: 0.9375rem;
    outline: none;
    background: #f8f9fb;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.support-chat-input input:focus {
    border-color: #7c5cfc;
    box-shadow: 0 0 0 3px rgba(124, 92, 252, 0.12);
    background: #fff;
}
.support-chat-input input::placeholder { color: #aaa; }
.support-chat-input button {
    width: 44px; height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7c5cfc, #6344e0);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.12s, box-shadow 0.12s;
    box-shadow: 0 4px 12px rgba(124, 92, 252, 0.35);
}
.support-chat-input button:hover { transform: scale(1.04); }
.support-chat-input button:active { transform: scale(0.96); }

.support-chat-login {
    padding: 28px 20px;
    text-align: center;
    background: #fff;
    border-top: 1px solid #e8e8ec;
    flex-shrink: 0;
}
.support-chat-login-icon { font-size: 2rem; margin-bottom: 10px; }
.support-chat-login p {
    font-size: 0.875rem;
    color: #666;
    margin: 0 0 16px;
    line-height: 1.5;
}
.support-btn-primary {
    display: inline-block;
    padding: 12px 24px;
    background: linear-gradient(135deg, #7c5cfc, #6344e0);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9375rem;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(124, 92, 252, 0.3);
}

/* Sidebar */
.support-side {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.support-info-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}
@media (min-width: 480px) and (max-width: 1023px) {
    .support-info-grid { grid-template-columns: repeat(3, 1fr); }
}

.support-info-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: #fff;
    border-radius: 12px;
    padding: 14px 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.support-info-icon { font-size: 1.25rem; flex-shrink: 0; line-height: 1; }
.support-info-item strong {
    display: block;
    font-size: 0.8125rem;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 2px;
}
.support-info-item p {
    margin: 0;
    font-size: 0.75rem;
    color: #888;
    line-height: 1.4;
}

.support-card {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    overflow: hidden;
}
.support-card-title {
    padding: 14px 18px;
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 700;
    color: #1a1a2e;
    background: #fafafa;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.support-card-title::before {
    content: '';
    width: 4px;
    height: 16px;
    background: #7c5cfc;
    border-radius: 2px;
}

.support-faq-list { padding: 4px 0; }
.support-faq-item {
    border-bottom: 1px solid #f3f4f6;
}
.support-faq-item:last-child { border-bottom: none; }
.support-faq-item summary {
    padding: 14px 18px;
    font-size: 0.875rem;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    transition: background 0.12s;
}
.support-faq-item summary::-webkit-details-marker { display: none; }
.support-faq-item summary::after {
    content: '+';
    font-size: 1.125rem;
    font-weight: 400;
    color: #7c5cfc;
    flex-shrink: 0;
}
.support-faq-item[open] summary::after { content: '−'; }
.support-faq-item summary:hover { background: #faf9ff; }
.support-faq-item p {
    margin: 0;
    padding: 0 18px 14px;
    font-size: 0.8125rem;
    line-height: 1.65;
    color: #666;
}
.support-faq-item a { color: #7c5cfc; font-weight: 500; }

.support-links {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: #f0f0f0;
}
.support-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: #fff;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #444;
    transition: background 0.12s, color 0.12s;
}
.support-link span { font-size: 1.125rem; }
.support-link:hover {
    background: #faf9ff;
    color: #7c5cfc;
}
