/* 首页英雄区的两个小组件：会轮播的大厅聊天、戳一下小凛（脚本见 js/home-widgets.js）。
   控件和隐藏的初始状态都挂在 html.js / .has-loop 下，关掉 JS 时英雄区照常是静态聊天。 */

/* ── 大厅聊天 ── */
.hero-chat .chat-pause { display: none; }
.hero-chat .typing { display: none; }

.hero-chat.has-loop .chat-head { align-items: center; }
.hero-chat.has-loop .chat-pause {
    display: inline-flex; align-items: center; justify-content: center;
    margin-left: auto; width: 28px; height: 28px; padding: 0;
    border: 0; border-radius: 6px; background: transparent; color: var(--dc-muted); cursor: pointer;
}
.hero-chat .chat-pause:hover { background: var(--dc-deep); color: var(--dc-name); }
.hero-chat .chat-pause svg { width: 16px; height: 16px; }
.hero-chat .chat-pause[aria-pressed="true"] .i-pause,
.hero-chat .chat-pause[aria-pressed="false"] .i-play { display: none; }

.hero-chat.has-loop .chat-body {
    overflow: hidden; justify-content: flex-end; padding-bottom: 6px;
    /* 顶上那条被挤出去的消息淡出，看着像在往上滚，而不是被切掉 */
    -webkit-mask-image: linear-gradient(to bottom, transparent, #000 28px);
    mask-image: linear-gradient(to bottom, transparent, #000 28px);
}

/* Discord 的“正在输入…”：一直占着这一行，只切换看不看得见，免得聊天框跳动 */
.hero-chat.has-loop .typing {
    display: flex; align-items: center; gap: 3px; height: 22px; padding: 0 20px 10px;
    font-size: 13px; color: var(--dc-muted); visibility: hidden;
}
.hero-chat .typing.on { visibility: visible; }
.hero-chat .typing b { color: var(--dc-name); font-weight: 600; }
.hero-chat .typing i {
    width: 6px; height: 6px; border-radius: 50%; background: var(--dc-muted);
    animation: typing-dot 1.2s ease-in-out infinite;
}
.hero-chat .typing i:nth-child(2) { animation-delay: .15s; }
.hero-chat .typing i:nth-child(3) { animation-delay: .3s; margin-right: 6px; }
@keyframes typing-dot { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-3px); opacity: 1; } }
.hero-chat.is-paused .typing i { animation-play-state: paused; }

/* 首屏入场放完后，换成每条新消息各自入场（首屏那几条的错开延迟不再起作用） */
html.js .hero-chat.is-live .msg { opacity: 1; animation: none; }
html.js .hero-chat.is-live .msg.live { animation: msg-in .3s ease-out both; }
/* 被自动审核删掉的广告：先划掉，再淡出 */
html.js .hero-chat.is-live .msg.deleting { opacity: 0; transition: opacity .45s ease-in .25s; }
.hero-chat .msg.deleting > div:last-child { color: var(--dc-gone); text-decoration: line-through; }

/* ── 戳一下小凛 ── */
.stk-poke {
    display: block; padding: 0; border: 0; background: none; color: inherit; font: inherit;
    cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.stk-poke.poked img { animation: poke .5s ease-out; }
@keyframes poke {
    0%, 100% { transform: none; }
    20% { transform: rotate(-7deg) scale(1.04); }
    45% { transform: rotate(5deg) scale(.98); }
    70% { transform: rotate(-2deg); }
}

/* 漫画式对话气泡：白底、墨线、尾巴指向小凛 */
.rin-say { display: none; }
html.js .rin-say {
    display: block; position: absolute; z-index: 2;
    --say-left: calc(32px + var(--stk) * .78);
    left: var(--say-left); top: calc(var(--stk) * .1);
    width: max-content; max-width: min(260px, calc(100% - var(--say-left))); margin: 0; padding: 10px 14px;
    box-sizing: border-box;
    border: 1.5px solid var(--text); border-radius: 18px; background: var(--panel); color: var(--text);
    font-family: var(--display); font-size: 16px; font-weight: 500; line-height: 1.45;
    opacity: 0; transform: translateY(4px); transition: opacity .2s, transform .2s;
    pointer-events: none;
}
html.js .rin-say.on { opacity: 1; transform: none; }
.rin-say::before, .rin-say::after {
    content: ''; position: absolute; left: -11px; bottom: 12px;
    border: 7px solid transparent; border-right: 11px solid var(--text); border-left: 0;
}
.rin-say::after { left: -8px; border-right-color: var(--panel); }
.rin-say .say-shown:empty::after { content: '\200b'; }
.say-sr {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

@media (max-width: 600px) {
    html.js .rin-say { --say-left: calc(16px + var(--stk) * .78); font-size: 15px; padding: 8px 12px; }
    .hero-chat.has-loop .typing { padding: 0 14px 10px; }
}

@media (prefers-reduced-motion: reduce) {
    .hero-chat .typing i { animation: none; opacity: 1; }
    .stk-poke.poked img { animation: none; }
    html.js .rin-say { transition: none; transform: none; }
}
