/* Styling for the Live chat page. Self-contained so it does not depend on
   uncompiled Tailwind utilities. */

.chat {
    max-width: 760px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 1.25rem;
    background: #faf8f5;
    overflow: hidden;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
}

.chat-namebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1.25rem;
    background: #fff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.07);
    font-size: 0.95rem;
    color: #6b6258;
}
.chat-name-label strong { color: #2a2622; }
.chat-link {
    background: none;
    border: none;
    color: #5d7e1c;
    font-weight: 600;
    cursor: pointer;
    padding: 0.25rem 0.4rem;
    border-radius: 0.4rem;
    -webkit-tap-highlight-color: transparent;
}
.chat-link:hover { text-decoration: underline; }

.chat-messages {
    height: clamp(320px, 52vh, 560px);
    overflow-y: auto;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    scroll-behavior: smooth;
}

.chat-empty {
    margin: auto;
    color: #9a9186;
    font-style: italic;
    text-align: center;
}

.msg {
    max-width: 78%;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    align-self: flex-start;
}
.msg.mine { align-self: flex-end; align-items: flex-end; }

.msg-meta {
    font-size: 0.78rem;
    color: #9a9186;
    padding: 0 0.35rem;
}
.msg-meta .msg-author { font-weight: 700; color: #6b6258; }
.msg.mine .msg-meta .msg-author { color: #5d7e1c; }

.msg-bubble {
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.07);
    padding: 0.6rem 0.9rem;
    border-radius: 1rem;
    border-top-left-radius: 0.3rem;
    color: #2a2622;
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}
.msg.mine .msg-bubble {
    background: #6b8e23;
    border-color: #6b8e23;
    color: #fff;
    border-top-left-radius: 1rem;
    border-top-right-radius: 0.3rem;
}
.msg-voice-badge {
    display: inline-block;
    margin-right: 0.4rem;
    padding: 0.05rem 0.35rem;
    border-radius: 999px;
    background: #e7eef8;
    color: #315b87;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
.msg.is-transcript .msg-bubble,
.msg.mine.is-transcript .msg-bubble {
    background: #f3f7fb;
    border-color: rgba(49, 91, 135, 0.24);
    color: #274866;
}
.msg-ai-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.22rem;
    margin-right: 0.4rem;
    padding: 0.05rem 0.4rem;
    border-radius: 999px;
    background: #efe7fb;
    color: #5a3aa0;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
.msg-ai-badge::before {
    content: "\2726"; /* sparkle glyph */
    font-size: 0.72rem;
    line-height: 1;
}
.msg.is-ai .msg-meta .msg-author { color: #5a3aa0; }
.msg.is-ai .msg-bubble {
    background: #f6f2fd;
    border-color: rgba(90, 58, 160, 0.28);
    color: #2f2545;
    border-top-left-radius: 0.3rem;
}
.msg.is-partial {
    opacity: 0.78;
}
.msg.is-partial .msg-bubble {
    border-style: dashed;
    font-style: italic;
}
.msg.is-partial .msg-bubble::after {
    content: "\2026";
    margin-left: 0.2rem;
}

.chat-form {
    display: flex;
    gap: 0.6rem;
    padding: 0.9rem 1rem;
    background: #fff;
    border-top: 1px solid rgba(0, 0, 0, 0.07);
}
.chat-input {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 1rem;
    padding: 0.75rem 1rem;
    border: 1px solid rgba(0, 0, 0, 0.14);
    border-radius: 999px;
    background: #faf8f5;
    color: #2a2622;
}
.chat-input:focus {
    outline: none;
    border-color: #6b8e23;
    background: #fff;
}
.chat-send {
    flex: 0 0 auto;
    font-weight: 700;
    color: #fff;
    background: #6b8e23;
    border: none;
    border-radius: 999px;
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    transition: background-color 0.18s ease, transform 0.12s ease;
    -webkit-tap-highlight-color: transparent;
}
.chat-send:hover { background: #5d7e1c; }
.chat-send:active { transform: scale(0.97); }
.chat-send:disabled { opacity: 0.5; cursor: default; }

/* name picker overlay */
.name-modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(42, 38, 34, 0.55);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
}
.name-modal[hidden] { display: none; }
.name-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 1.25rem;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.25);
}
.name-title {
    font-family: "Playfair Display", serif;
    font-size: 1.6rem;
    font-weight: 800;
    color: #2a2622;
    margin-bottom: 0.5rem;
}
.name-sub { color: #6b6258; margin-bottom: 1.25rem; }
.name-input {
    width: 100%;
    font-size: 1.1rem;
    padding: 0.8rem 1rem;
    border: 1px solid rgba(0, 0, 0, 0.16);
    border-radius: 0.75rem;
    margin-bottom: 1rem;
    color: #2a2622;
}
.name-input:focus { outline: none; border-color: #6b8e23; }
.name-save { width: 100%; }

/* ---------- voice chat panel ---------- */
.voice {
    max-width: 760px;
    margin: 0 auto 1.25rem;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 1.25rem;
    background: #fff;
    overflow: hidden;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
}
.voice[hidden] { display: none; }

.voice-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1.25rem;
    background: #faf8f5;
    border-bottom: 1px solid rgba(0, 0, 0, 0.07);
}
.voice-title {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    color: #2a2622;
    font-size: 1rem;
}
.voice-dot {
    width: 0.6rem;
    height: 0.6rem;
    border-radius: 50%;
    background: #c3bcb2;
    flex: 0 0 auto;
}
.voice-dot.is-live {
    background: #6b8e23;
    box-shadow: 0 0 0 0 rgba(107, 142, 35, 0.5);
    animation: voice-pulse 1.6s ease-out infinite;
}
@keyframes voice-pulse {
    to { box-shadow: 0 0 0 0.5rem rgba(107, 142, 35, 0); }
}
.voice-status {
    font-size: 0.85rem;
    color: #6b6258;
}

.voice-body {
    padding: 1rem 1.25rem 1.25rem;
}
.voice-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.6rem;
}
.voice-transcript-status {
    display: inline-flex;
    align-items: center;
    min-height: 2.25rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: #f0ede8;
    color: #6b6258;
    font-size: 0.8rem;
    font-weight: 600;
}
.voice-transcript-status[hidden] { display: none; }
.voice-transcript-status.is-live {
    background: #e7eef8;
    color: #315b87;
}
.voice-transcript-consent {
    margin: 0.8rem 0 0;
    color: #6b6258;
    font-size: 0.84rem;
    line-height: 1.45;
}
.voice-transcript-consent strong { color: #2a2622; }
.voice-btn {
    font-weight: 700;
    font-size: 0.95rem;
    color: #2a2622;
    background: #f0ede8;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 999px;
    padding: 0.6rem 1.25rem;
    cursor: pointer;
    transition: background-color 0.18s ease, transform 0.12s ease;
    -webkit-tap-highlight-color: transparent;
}
.voice-btn:hover { background: #e7e3dc; }
.voice-btn:active { transform: scale(0.97); }
.voice-btn:disabled { opacity: 0.5; cursor: default; }
.voice-btn[hidden] { display: none; }
.voice-btn-primary {
    color: #fff;
    background: #6b8e23;
    border-color: transparent;
}
.voice-btn-primary:hover { background: #5d7e1c; }
.voice-btn.is-muted {
    color: #fff;
    background: #b45309;
    border-color: transparent;
}
.voice-btn.is-muted:hover { background: #9a4708; }
.voice-btn-danger {
    color: #b3261e;
    background: #fbeceb;
    border-color: rgba(179, 38, 30, 0.25);
}
.voice-btn-danger:hover { background: #f7ddda; }
.voice-btn-ai {
    color: #5f3d84;
    background: #f2ecf9;
    border-color: rgba(95, 61, 132, 0.28);
}
.voice-btn-ai:hover { background: #e9dff5; }
.voice-btn-ai.is-active {
    color: #fff;
    background: #6d4c9f;
    border-color: transparent;
}
.voice-btn-ai.is-active:hover { background: #5d4089; }

.voice-people {
    margin-top: 1rem;
}
.voice-people[hidden] { display: none; }
.voice-people-label {
    display: block;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #8a8177;
    margin-bottom: 0.5rem;
}
.voice-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.voice-person {
    font-size: 0.9rem;
    color: #2a2622;
    background: #faf8f5;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 999px;
    padding: 0.35rem 0.85rem;
}
.voice-person.is-me {
    background: #eef3e2;
    border-color: rgba(107, 142, 35, 0.35);
    color: #4a631a;
    font-weight: 600;
}
.voice-note {
    margin: 0.9rem 0 0;
    font-size: 0.9rem;
    color: #b3261e;
}
.voice-note[hidden] { display: none; }

/* ---- Voice translation (Translate app) ---- */
.tv-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.6rem;
}
.tv-lang-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-right: auto;
}
.tv-lang-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #8a8177;
}
.tv-lang {
    font-size: 0.95rem;
    color: #2a2622;
    background: #faf8f5;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 0.75rem;
    padding: 0.55rem 0.85rem;
    min-width: 12rem;
    cursor: pointer;
}
.tv-lang:disabled { opacity: 0.6; cursor: default; }

.tv-name-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.tv-name {
    font-size: 0.95rem;
    color: #2a2622;
    background: #faf8f5;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 0.75rem;
    padding: 0.55rem 0.85rem;
    min-width: 10rem;
}
.tv-name:disabled { opacity: 0.6; cursor: default; }

.tv-people { margin-top: 1rem; }

.tv-captions {
    margin-top: 1rem;
    max-height: 18rem;
    overflow-y: auto;
    padding: 0.75rem;
    background: #faf8f5;
    border: 1px solid rgba(0, 0, 0, 0.07);
    border-radius: 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
.tv-empty {
    color: #8a8177;
    font-size: 0.9rem;
    text-align: center;
    padding: 1.5rem 0.5rem;
}
.tv-caption {
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.07);
    border-radius: 0.75rem;
    padding: 0.55rem 0.75rem;
}
.tv-caption.is-mine {
    background: #eef3e2;
    border-color: rgba(107, 142, 35, 0.28);
}
.tv-caption-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.15rem;
}
.tv-caption-who {
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    color: #6b6258;
}
.tv-caption-time {
    flex: none;
    font-size: 0.72rem;
    color: #a89f93;
    font-variant-numeric: tabular-nums;
}
.tv-caption.is-mine .tv-caption-who { color: #4a631a; }
.tv-caption.is-partial {
    background: #faf8f4;
    border-style: dashed;
    border-color: rgba(0, 0, 0, 0.12);
    opacity: 0.85;
}
.tv-caption.is-partial .tv-caption-text {
    font-style: italic;
    color: #6b6258;
}
.tv-caption-text {
    color: #2a2622;
    font-size: 0.98rem;
    line-height: 1.4;
}
.tv-caption-sub {
    margin-top: 0.2rem;
    font-size: 0.82rem;
    color: #8a8177;
    font-style: italic;
}
.tv-live {
    margin: 0.75rem 0 0;
    min-height: 1.2rem;
    font-size: 0.9rem;
    color: #6b6258;
    font-style: italic;
}
.tv-live[hidden] { display: none; }

/* whispering AI mode — a private sub-region, not a nested card */
.voice-whisper {
    margin-top: 1rem;
    padding: 0.9rem 1.1rem 1rem;
    border-radius: 0.75rem;
    background: #f5f0fb;
}
.voice-whisper[hidden] { display: none; }
.voice-whisper-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.voice-whisper-head strong {
    color: #4a2f6b;
    font-size: 0.95rem;
}
.voice-whisper-dot {
    width: 0.6rem;
    height: 0.6rem;
    border-radius: 50%;
    background: #c9bcd8;
    flex: 0 0 auto;
}
.voice-whisper-dot.is-live {
    background: #6d4c9f;
    box-shadow: 0 0 0 0 rgba(109, 76, 159, 0.5);
    animation: voice-whisper-pulse 1.6s ease-out infinite;
}
@keyframes voice-whisper-pulse {
    to { box-shadow: 0 0 0 0.5rem rgba(109, 76, 159, 0); }
}
.voice-whisper-status {
    margin-left: auto;
    font-size: 0.8rem;
    font-weight: 600;
    color: #6d5a86;
}
.voice-whisper-privacy {
    margin: 0.6rem 0 0;
    font-size: 0.82rem;
    line-height: 1.5;
    color: #5b5064;
}
.voice-whisper-log {
    margin-top: 0.8rem;
    max-height: 12rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}
.voice-whisper-log[hidden] { display: none; }
.voice-whisper-line {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.voice-whisper-who {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #8a6fae;
}
.voice-whisper-line.is-you .voice-whisper-who { color: #4a631a; }
.voice-whisper-text {
    font-size: 0.92rem;
    line-height: 1.5;
    color: #2f2838;
}
@media (prefers-reduced-motion: reduce) {
    .voice-whisper-dot.is-live { animation: none; }
}
