/* ═══════════════════════════════════════════════════════════════
   I18N + STAR — chat auto-translation, live captions, bio
   translation, channel language chip, and the home-page
   "Star of OpenVibe" spotlight. Server side: server/i18n/translate.js
   ═══════════════════════════════════════════════════════════════ */

/* ── Chat: translation line under a message ─────────────────── */
.chat-translation {
    display: flex; align-items: flex-start; gap: 6px;
    margin: 2px 0 1px 12px; padding: 3px 8px;
    border-left: 2px solid color-mix(in srgb, var(--accent) 60%, transparent);
    border-radius: 0 8px 8px 0;
    background: color-mix(in srgb, var(--accent) 8%, transparent);
    color: var(--text-secondary); font-size: 0.82rem; line-height: 1.35;
    animation: i18nSlideIn 0.35s ease both;
}
.chat-translation i { color: var(--accent-light); margin-top: 2px; font-size: 0.8rem; }
.chat-translation-text { color: var(--text-primary); opacity: 0.92; }
@keyframes i18nSlideIn { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }

/* ── Chat: "auto-translated ↔ Japanese" pill in the tools row ── */
.chat-translate-hint {
    display: inline-flex; align-items: center; gap: 5px;
    margin-left: auto; padding: 2px 9px; border-radius: 999px;
    font-size: 0.7rem; font-weight: 600; letter-spacing: 0.02em; white-space: nowrap;
    color: var(--accent-light);
    background: color-mix(in srgb, var(--accent) 14%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
    cursor: help; animation: i18nPulse 3s ease-in-out infinite;
}
@keyframes i18nPulse { 0%,100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 0%, transparent); } 50% { box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 45%, transparent); } }

/* ── Channel: language chip in the info bar ─────────────────── */
.ch-lang-chip {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 2px 10px; border-radius: 999px; font-size: 0.72rem; font-weight: 700;
    color: #fde68a; background: linear-gradient(135deg, rgba(190,24,93,0.35), rgba(139,92,246,0.3));
    border: 1px solid rgba(253,230,138,0.45); white-space: nowrap; cursor: help;
}
.ch-lang-chip i { color: #fff; }

/* ── Channel: live captions panel (under the player) ─────────── */
.ch-captions {
    margin: 10px 0 0; border-radius: 14px; overflow: hidden;
    background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 10%, var(--bg-card)), var(--bg-card));
    border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
    box-shadow: 0 10px 30px rgba(0,0,0,0.25);
    animation: i18nSlideIn 0.4s ease both;
}
.ch-captions-head {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    padding: 8px 12px; border-bottom: 1px solid color-mix(in srgb, var(--accent) 25%, var(--border));
}
.ch-captions-title { display: inline-flex; align-items: center; gap: 7px; font-weight: 800; font-size: 0.88rem; color: var(--text-primary); }
.ch-captions-title i { color: var(--accent-light); }
.ch-captions-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--live-red); animation: i18nBlink 1.4s ease-in-out infinite; }
@keyframes i18nBlink { 0%,100% { opacity: 1; box-shadow: 0 0 0 0 rgba(231,76,60,0.6); } 50% { opacity: 0.55; box-shadow: 0 0 0 5px rgba(231,76,60,0); } }
.ch-captions-sub { color: var(--text-secondary); font-size: 0.76rem; }
.ch-captions-toggle { margin-left: auto; background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 4px 6px; border-radius: 6px; }
.ch-captions-toggle:hover { color: var(--text-primary); background: var(--bg-hover); }
.ch-captions-lines { max-height: 190px; overflow-y: auto; padding: 8px 12px; display: grid; gap: 6px; scroll-behavior: smooth; }
.ch-captions.collapsed .ch-captions-lines { display: none; }
.ch-captions.collapsed .ch-captions-toggle i { transform: rotate(180deg); }
.ch-captions-wait { color: var(--text-muted); font-size: 0.8rem; font-style: italic; }
.ch-caption { animation: i18nSlideIn 0.35s ease both; padding: 4px 0; border-bottom: 1px dashed color-mix(in srgb, var(--border) 70%, transparent); }
.ch-caption:last-child { border-bottom: none; }
.ch-caption-en { font-size: 0.95rem; color: var(--text-primary); line-height: 1.35; }
.ch-caption-src { font-size: 0.78rem; color: var(--text-secondary); margin-top: 2px; }
.ch-caption:last-child .ch-caption-en { font-weight: 600; }

/* ── About tab: bio translation ─────────────────────────────── */
.ch-about-bio-translated {
    margin: 8px 0 12px; padding: 10px 12px; border-radius: 10px;
    background: color-mix(in srgb, var(--accent) 8%, transparent);
    border-left: 3px solid var(--accent); white-space: pre-wrap; line-height: 1.5;
    animation: i18nSlideIn 0.4s ease both;
}
.ch-about-bio-translated-label { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent-light); margin-bottom: 4px; }

/* ═══════════════════════════════════════════════════════════════
   STAR OF OPENVIBE — home spotlight
   ═══════════════════════════════════════════════════════════════ */
.home-star-section { margin: 4px 0 28px; }
.star-card-border {
    position: relative; border-radius: 22px; padding: 2px; overflow: hidden; isolation: isolate;
    animation: starCardIn 0.8s cubic-bezier(.2,1.3,.3,1) both;
}
.star-card-border::before {
    content: ''; position: absolute; inset: -60%; z-index: -1;
    background: conic-gradient(from 0deg, #fbbf24, #f472b6, var(--accent), #fbbf24);
    animation: starSpin 7s linear infinite;
}
@keyframes starSpin { to { transform: rotate(360deg); } }
@keyframes starCardIn { from { opacity: 0; transform: translateY(24px) scale(0.97); } to { opacity: 1; transform: none; } }
.star-card {
    position: relative; border-radius: 20px; overflow: hidden;
    display: grid; grid-template-columns: auto 1fr; gap: 22px; align-items: start;
    padding: 22px 24px;
    background:
        radial-gradient(60% 80% at 100% 0%, color-mix(in srgb, #f472b6 18%, transparent), transparent 60%),
        radial-gradient(50% 70% at 0% 100%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%),
        var(--bg-card);
    color: var(--text-primary);
}
.star-card.is-live { grid-template-columns: auto 1fr minmax(260px, 340px); }
.star-card > * { position: relative; z-index: 1; }

/* Drifting sakura petals */
.star-petals { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.star-petals span {
    position: absolute; top: -20px; font-size: 1.1rem; opacity: 0;
    animation: starPetal 9s linear infinite;
    filter: drop-shadow(0 2px 3px rgba(0,0,0,0.3));
}
.star-petals span:nth-child(1) { left: 6%;  animation-delay: 0s;   }
.star-petals span:nth-child(2) { left: 22%; animation-delay: -2s;  font-size: 0.9rem; }
.star-petals span:nth-child(3) { left: 41%; animation-delay: -5s;  }
.star-petals span:nth-child(4) { left: 58%; animation-delay: -1s;  font-size: 1.3rem; }
.star-petals span:nth-child(5) { left: 74%; animation-delay: -7s;  }
.star-petals span:nth-child(6) { left: 90%; animation-delay: -3.5s; font-size: 0.85rem; }
@keyframes starPetal {
    0%   { transform: translate(0, -20px) rotate(0deg); opacity: 0; }
    10%  { opacity: 0.8; }
    100% { transform: translate(-60px, 320px) rotate(300deg); opacity: 0; }
}

.star-avatar-wrap { position: relative; width: 112px; height: 112px; flex: none; }
.star-avatar-ring {
    position: absolute; inset: -6px; border-radius: 50%;
    background: conic-gradient(from 0deg, #fbbf24, #f472b6, var(--accent), #fbbf24);
    animation: starSpin 5s linear infinite;
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
    mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
}
.star-avatar-glow { position: absolute; inset: -14px; border-radius: 50%; background: radial-gradient(circle, rgba(251,191,36,0.35), transparent 65%); animation: starGlow 2.6s ease-in-out infinite; }
@keyframes starGlow { 0%,100% { transform: scale(0.9); opacity: 0.6; } 50% { transform: scale(1.15); opacity: 1; } }
.star-avatar {
    position: relative; width: 100%; height: 100%; border-radius: 50%; object-fit: cover;
    background: var(--bg-tertiary); display: grid; place-items: center;
    font-size: 2.4rem; font-weight: 900; color: #fff; overflow: hidden;
}
.star-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.star-badge {
    position: absolute; bottom: -6px; left: 50%; transform: translateX(-50%);
    padding: 2px 10px; border-radius: 999px; white-space: nowrap;
    background: linear-gradient(135deg, #fde68a, #fbbf24); color: #1c1002;
    font-size: 0.66rem; font-weight: 900; letter-spacing: 0.1em; text-transform: uppercase;
    box-shadow: 0 4px 14px rgba(251,191,36,0.45);
}
.star-live-pill {
    position: absolute; top: -4px; right: -6px; padding: 2px 8px; border-radius: 999px;
    background: var(--live-red); color: #fff; font-size: 0.64rem; font-weight: 900; letter-spacing: 0.08em;
    animation: i18nBlink 1.4s ease-in-out infinite;
}

.star-body { min-width: 0; }
.star-kicker { display: inline-flex; align-items: center; gap: 7px; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: #fbbf24; margin-bottom: 4px; }
.star-kicker i { animation: starTwinkle 1.8s ease-in-out infinite; }
@keyframes starTwinkle { 0%,100% { transform: scale(1) rotate(0); opacity: 1; } 50% { transform: scale(1.35) rotate(20deg); opacity: 0.7; } }
.star-name { margin: 0 0 6px; font-size: clamp(1.4rem, 3vw, 2rem); font-weight: 900; line-height: 1.1; letter-spacing: -0.01em; }
.star-name a { color: inherit; text-decoration: none; }
.star-name a:hover { color: var(--accent-light); }
.star-name .star-jp { display: block; font-size: 0.55em; font-weight: 600; color: var(--text-secondary); margin-top: 2px; }
.star-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 10px; }
.star-chip {
    display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px;
    font-size: 0.74rem; font-weight: 700; color: var(--text-primary);
    background: color-mix(in srgb, var(--accent) 12%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
}
.star-chip.gold { color: #fde68a; background: rgba(251,191,36,0.12); border-color: rgba(251,191,36,0.45); }
.star-chip.pink { color: #fbcfe8; background: rgba(244,114,182,0.12); border-color: rgba(244,114,182,0.45); }
.star-bio { margin: 0 0 4px; color: var(--text-primary); line-height: 1.5; white-space: pre-wrap; font-size: 0.95rem; }
.star-bio-src { margin: 0 0 8px; color: var(--text-secondary); font-size: 0.82rem; white-space: pre-wrap; line-height: 1.45; }
.star-bio-label { font-size: 0.68rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-light); margin: 6px 0 2px; }
.star-overview { color: var(--text-secondary); font-size: 0.84rem; line-height: 1.45; margin: 8px 0 0; }
.star-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.star-actions .btn { font-weight: 700; }
.star-btn-watch {
    background: linear-gradient(135deg, #fde68a, #fbbf24 50%, #f59e0b); color: #1c1002; border: none;
    box-shadow: 0 8px 24px rgba(251,191,36,0.4); position: relative; overflow: hidden;
}
.star-btn-watch::after { content: ''; position: absolute; inset: 0; background: linear-gradient(115deg, transparent 35%, rgba(255,255,255,0.6) 50%, transparent 65%); background-size: 250% 100%; animation: starSheen 2.6s linear infinite; pointer-events: none; }
@keyframes starSheen { 0% { background-position: 120% 0; } 100% { background-position: -120% 0; } }
.star-live-card { align-self: stretch; }
.star-live-card .stream-card { height: 100%; }
.star-offline { color: var(--text-muted); font-size: 0.8rem; margin-top: 8px; }

@media (max-width: 860px) {
    .star-card, .star-card.is-live { grid-template-columns: 1fr; text-align: center; gap: 14px; padding: 20px 16px; }
    .star-avatar-wrap { margin: 0 auto; }
    .star-chips, .star-actions { justify-content: center; }
    .star-live-card { max-width: 420px; width: 100%; margin: 0 auto; }
}

@media (prefers-reduced-motion: reduce) {
    .chat-translation, .chat-translate-hint, .ch-captions, .ch-caption, .ch-captions-dot, .ch-about-bio-translated,
    .star-card-border, .star-card-border::before, .star-petals span, .star-avatar-ring, .star-avatar-glow, .star-live-pill,
    .star-kicker i, .star-btn-watch::after { animation: none !important; }
    .star-petals { display: none; }
    .chat-translation, .ch-caption, .star-card-border { opacity: 1; transform: none; }
}

/* ── Chat: "translate to my language" hover button (sits left of the reply button) ── */
.chat-msg-hoverable .chat-translate-btn {
    display: none; position: absolute; right: 30px; top: 2px;
    padding: 2px 6px; font-size: 0.65rem; line-height: 1; z-index: 5; cursor: pointer;
    background: var(--bg-card, #1e1e2e); border: 1px solid var(--border, #333); border-radius: var(--radius-sm, 4px);
    color: var(--text-muted, #888); transition: color 0.15s, border-color 0.15s;
}
.chat-msg-hoverable:hover .chat-translate-btn { display: inline-flex; }
.chat-msg-hoverable .chat-translate-btn:hover { color: var(--accent-light); border-color: var(--accent); }
.chat-translation[hidden] { display: none; }

/* Lite mode (phones / weak GPUs): no blur, no filters, no shadow animations */
.rs-lite .star-card-border::before { animation: none; background: linear-gradient(135deg, #fbbf24, #f472b6, var(--accent)); inset: 0; }
.rs-lite .star-avatar-glow, .rs-lite .star-petals { display: none; }
.rs-lite .star-avatar-ring { animation: none; }
.rs-lite .star-btn-watch::after, .rs-lite .star-kicker i, .rs-lite .star-live-pill { animation: none; }
.rs-lite .star-btn-watch { box-shadow: none; }
.rs-lite .ch-captions-dot, .rs-lite .chat-translate-hint { animation: none; box-shadow: none; }
