@import url('https://fonts.googleapis.com/css2?family=Pretendard:wght@400;500;600;700;800&display=swap');

html,
body {
    height: 100%;
}

body {
    font-family: 'Pretendard', 'Noto Sans KR', sans-serif;
    background: linear-gradient(180deg, #ffffff 0%, #f3f5ff 100%);
    color: #16234f;
    overflow: hidden;
}

body.hold-transition.layout-top-nav,
body.hold-transition.layout-top-nav .wrapper,
body.hold-transition.layout-top-nav .content-wrapper,
body.hold-transition.layout-top-nav .content,
body.hold-transition.layout-top-nav .container-fluid {
    overflow: hidden;
}

.counseling-page {
    min-height: 100dvh;
    min-height: 100svh;
    display: flex;
    align-items: center;
}

.mic-gain-field {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.modal-title {
    margin: 0;
    font-weight: 800;
    color: #16234f;
}

.modal-subtitle {
    margin: 4px 0 0;
    color: #7382b6;
}

.language-picker-count {
    margin: 10px 0 0;
    color: #2b3557;
    font-size: 1rem;
    font-weight: 700;
}

.language-picker-count strong {
    font-weight: 800;
}

.counseling-page {
    min-height: 100dvh;
    min-height: 100svh;
    display: flex;
    align-items: center;
}

.mobile-shell {
    width: 100vw;
    height: 100dvh;
    height: 100svh;
    max-height: 100dvh;
    max-height: 100svh;
    min-height: 100dvh;
    min-height: 100svh;
    background: #f4f6fb;
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: 0 18px 48px rgba(32, 61, 149, 0.12);
    padding: 24px 24px 0;
    display: grid;
    gap: 15px;
    overflow: hidden;
}

.app-header {
    display: grid;
    grid-template-columns: 200px 1fr 200px;
    align-items: center;
    gap: 18px;
}

.brand-block {
    display: flex;
    align-items: center;
}

.brand-logo {
    width: 200px;
    max-width: 100%;
    display: block;
}

.header-language-pill,
.header-action,
.control-chip {
    border-radius: 999px;
}

.header-language-pill {
    justify-self: center;
    display: inline-flex;
    align-items: center;
    gap: 15px;
    min-height: 63px;
    padding: 0 27px;
    background: #ffffff;
    color: #2d3d71;
    font-size: 1.3rem;
    font-weight: 700;
    box-shadow: 0 10px 24px rgba(60, 83, 168, 0.08);
}

.live-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #32d66b;
    box-shadow: 0 0 0 8px rgba(50, 214, 107, 0.12);
    flex: 0 0 auto;
}

.header-language-pill > span:not(#detectedLanguageBadge) {
    font-weight: 400;
}

.header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

.header-action {
    border: 0;
    background: #ffffff;
    min-height: 63px;
    padding: 0 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: #213c95;
    font-size: 1.3rem;
    font-weight: 700;
    box-shadow: 0 10px 24px rgba(60, 83, 168, 0.08);
}

.header-action-save {
    min-width: 183px;
}

.chat-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: #ffffff;
    border-radius: 22px;
    border: 1px solid rgba(222, 228, 239, 0.9);
    overflow: hidden;
}

.messages-scroll {
    flex: 1 1 auto;
    min-height: 0;
    padding: 16px 16px 28px;
    overflow-y: auto;
}

.message-row {
    display: flex;
    margin-bottom: 10px;
    gap: 0;
}

.message-row.self {
    justify-content: flex-end;
}

.message-row.peer {
    justify-content: flex-start;
}

.avatar-badge,
.message-name {
    display: none;
}

.message-body {
    max-width: min(82%, 760px);
}

.message-row.self .message-body {
    text-align: right;
}

.message-bubble {
    display: inline-block;
    max-width: 100%;
    padding: 16px 22px;
    border-radius: 20px;
    box-shadow: 0 10px 28px rgba(76, 92, 145, 0.08);
    overflow-wrap: anywhere;
    word-break: break-word;
}

.message-row.peer .message-bubble {
    background: #213c95;
    color: #ffffff;
    border-top-left-radius: 8px;
}

.message-row.self .message-bubble {
    background: #f6f8fc;
    color: #1b2440;
    border: 1px solid #e8edf6;
    border-radius: 22px;
    border-top-right-radius: 10px;
    box-shadow: none;
}

.message-original,
.message-translation {
    margin: 0;
    line-height: 1.45;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.message-original {
    font-size: 1.5rem;
    font-weight: 500;
}

.message-translation {
    margin-top: 10px;
    font-size: 1.5rem;
    font-weight: 500;
}

.message-row.peer .message-translation {
    color: #56d5ff;
}

.message-row.self .message-original {
    color: #2346c7;
}

.message-row.self .message-translation {
    color: #232734;
}

.message-meta {
    margin-top: 8px;
    padding: 0 4px;
    display: flex;
    gap: 8px;
    color: #a2a9bb;
    font-size: 1rem;
}

.message-row.self .message-meta {
    justify-content: flex-end;
}

.message-row.self .message-time {
    color: #a8afbf;
}

.message-row.self .message-latency {
    color: #bcc3d2;
}

.message-replay-button {
    border: 0;
    background: #e8eefc;
    color: #2346c7;
    min-height: 32px;
    padding: 0 12px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.92rem;
    font-weight: 700;
}

.message-replay-button i {
    font-size: 0.95rem;
    line-height: 1;
}

.system-message {
    display: flex;
    justify-content: center;
    margin: 10px 0 14px;
}

.system-message span {
    display: inline-block;
    max-width: 100%;
    padding: 7px 12px;
    border-radius: 999px;
    background: #eef2f8;
    color: #7a8299;
    font-size: 1.1rem;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.floating-toast {
    position: absolute;
    left: 50%;
    bottom: max(18px, env(safe-area-inset-bottom, 0px) + 18px);
    transform: translate(-50%, 18px);
    max-width: min(calc(100% - 32px), 420px);
    padding: 11px 16px;
    border-radius: 999px;
    background: rgba(38, 44, 59, 0.94);
    color: #ffffff;
    font-size: 0.98rem;
    font-weight: 600;
    line-height: 1.35;
    text-align: center;
    box-shadow: 0 12px 28px rgba(16, 21, 31, 0.22);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 40;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.floating-toast.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

.audio-panel {
    background: #ffffff;
    border: 1px solid rgba(222, 228, 239, 0.9);
    border-radius: 18px;
    padding: 15px 18px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 15px;
    align-items: center;
}

.audio-status {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 21px;
    align-items: center;
    min-width: 0;
}

.audio-status-label {
    display: inline-flex;
    align-items: center;
    gap: 15px;
    white-space: nowrap;
    color: #37513e;
    font-size: 1.3rem;
    font-weight: 700;
}

.voice-meter-inline-shell {
    width: auto;
    max-width: none;
    height: 60px;
    border-radius: 999px;
    background: #fafbfe;
    border: 1px solid #edf1f7;
    overflow: hidden;
}

.voice-meter-inline {
    width: 100%;
    height: 100%;
    display: block;
}

.speak-button {
    min-width: 205px;
    min-height: 63px;
    padding: 0 27px;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, #28459f 0%, #365ac2 100%);
    color: #ffffff;
    font-size: 1.3rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    box-shadow: none;
}

.speak-button.is-listening {
    background: linear-gradient(135deg, #0f7ca0 0%, #10a6d7 100%);
}

.control-chip-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    width: 100%;
}

.control-chip {
    border: 1px solid #d9deea;
    background: #f8f9fd;
    min-height: 45px;
    padding: 0 5px 0 15px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #5d6787;
    font-size: 1.2rem;
    font-weight: 700;
}

.control-chip strong {
    min-width: 51px;
    min-height: 33px;
    padding: 0 12px;
    border-radius: 999px;
    background: #c4cad8;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.control-chip[aria-pressed="true"] {
    border-color: #9bb0f0;
    color: #213c95;
    background: #eef3ff;
}

.control-chip[aria-pressed="true"] strong {
    background: #4d69d8;
}

#languagePickerModal .modal-dialog {
    max-width: 480px;
}

#languagePickerModal .settings-modal {
    border: 0;
    border-radius: 30px;
    overflow: hidden;
}

#languagePickerModal .modal-header {
    padding: 28px 26px 18px;
}

#languagePickerModal .btn-close {
    margin: 0;
    padding: 8px;
    opacity: 1;
}

.language-picker-body {
    padding: 0 26px 26px;
}

.language-flag-grid {
    max-height: min(58vh, 520px);
    overflow-y: auto;
    padding-right: 6px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.language-flag-grid::-webkit-scrollbar {
    width: 8px;
}

.language-flag-grid::-webkit-scrollbar-thumb {
    background: rgba(138, 146, 170, 0.45);
    border-radius: 999px;
}

.language-flag-option {
    position: relative;
    min-height: 94px;
    border: 1px solid #eceff5;
    border-radius: 12px;
    background: #f9f9fb;
    padding: 14px 14px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #202632;
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.language-flag-option:hover {
    transform: translateY(-1px);
    border-color: #d9dfeb;
    box-shadow: 0 8px 20px rgba(57, 77, 139, 0.06);
}

.language-flag-option.is-active {
    border-color: #6170ff;
    border-width: 2px;
    background: #eef1ff;
    box-shadow: none;
}

.language-picker-flag {
    width: auto;
    height: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0;
    background: transparent;
    font-size: 2rem;
    line-height: 1;
}

.language-option-label {
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.2;
    text-align: center;
    word-break: keep-all;
}

.language-option-check {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #6170ff;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    box-shadow: 0 0 0 2px #ffffff;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.language-flag-option.is-active .language-option-check {
    opacity: 1;
    transform: scale(1);
}

.bottom-nav {
    margin: 0 -24px;
    padding: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: #ffffff;
    border-top: 1px solid #dfe5f0;
    display: grid;
    flex-shrink: 0;
    overflow: hidden;
}

.bottom-nav-item {
    border: 0;
    background: transparent;
    min-height: 72px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    color: #8a91a9;
    font-size: 1.32rem;
    font-weight: 600;
    border-right: 1px solid #eceff5;
}

.bottom-nav-item i {
    font-size: 1.43rem;
    line-height: 1;
}

.bottom-nav-item:last-child {
    border-right: 0;
}

.bottom-nav-item.is-active {
    background: #dce6ff;
    color: #1f2f78;
    font-weight: 700;
}

@media (min-width: 576px) {
    .language-flag-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 767.98px) {
    html,
    body,
    body.hold-transition.layout-top-nav,
    body.hold-transition.layout-top-nav .wrapper,
    .counseling-page {
        height: 100dvh;
        height: 100svh;
        min-height: 100dvh;
        min-height: 100svh;
    }

    .counseling-page {
        align-items: stretch;
    }

    .mobile-shell {
        width: 100%;
        min-height: 0;
        height: 100%;
        max-height: 100%;
        padding-top: 12px;
    }
}
