* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: linear-gradient(160deg, #1a1a4e 0%, #2d2a6b 40%, #4a3b7c 100%);
    min-height: 100vh;
    color: #f3eefc;
}

.app {
    max-width: 520px;
    margin: 0 auto;
    padding: 24px 16px 40px;
}

header {
    text-align: center;
    padding: 24px 0 20px;
}

.logo {
    font-size: 44px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

h1 {
    font-size: 28px;
    margin-top: 8px;
    letter-spacing: 2px;
    background: linear-gradient(90deg, #ffd97a, #ffb86b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    color: #b9b3e6;
    font-size: 13px;
    margin-top: 6px;
}

.card {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    padding: 24px;
    margin-top: 16px;
}

.field {
    margin-bottom: 18px;
}

.field label {
    display: block;
    font-size: 14px;
    color: #cfc8f0;
    margin-bottom: 8px;
    font-weight: 500;
}

input[type="text"], select {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    outline: none;
    transition: border-color 0.2s;
}

input[type="text"]::placeholder {
    color: #8d86b8;
}

input[type="text"]:focus, select:focus {
    border-color: #ffb86b;
}

select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath fill='%23b9b3e6' d='M1 1l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
}

.length-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.length-hint {
    font-size: 13px;
    color: #ffb86b;
    font-weight: 500;
}

.length-range {
    width: 100%;
    height: 28px;
    accent-color: #ffb86b;
    cursor: pointer;
}

.length-scale {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #8d86b8;
}

.story-meta {
    text-align: center;
    font-size: 13px;
    color: #b9b3e6;
    margin-bottom: 14px;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.chip {
    padding: 8px 14px;
    font-size: 13px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.chip.active, .chip:hover {
    background: rgba(255, 184, 107, 0.25);
    border-color: #ffb86b;
}

/* 「换一批」小按钮(深色主题) */
.chips-more {
    margin-top: 12px;
    padding: 5px 14px;
    font-size: 12.5px;
    border-radius: 999px;
    border: 1px dashed rgba(255, 184, 107, 0.5);
    background: rgba(255, 184, 107, 0.06);
    color: #ffd97a;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}

.chips-more:hover {
    background: rgba(255, 184, 107, 0.16);
    border-color: #ffb86b;
}

.btn-primary {
    width: 100%;
    padding: 16px;
    font-size: 17px;
    font-weight: 600;
    border: none;
    border-radius: 16px;
    background: linear-gradient(135deg, #ffb86b, #ff8a5c);
    color: #3a2a10;
    cursor: pointer;
    transition: transform 0.15s, opacity 0.2s;
}

.btn-primary:hover { transform: translateY(-2px); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn-play {
    width: 100%;
    padding: 16px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 16px;
    background: linear-gradient(135deg, #6ee7b7, #34d399);
    color: #064e3b;
    cursor: pointer;
    margin-top: 16px;
    transition: transform 0.15s, opacity 0.2s;
}

.btn-play:hover { transform: translateY(-2px); }
.btn-play:disabled { opacity: 0.6; cursor: not-allowed; }

/* ===== 播放进度 + 睡眠定时(深色主题) ===== */
.playrow { margin-top: 14px; }
.seek-bar {
    width: 100%; height: 22px;
    accent-color: #ffb86b;
    cursor: pointer;
}
.seek-meta {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    margin-top: 4px; font-size: 12.5px; color: #b9b3e6;
    font-variant-numeric: tabular-nums;
}
.timer-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px dashed rgba(110, 231, 183, 0.5);
    color: #6ee7b7; border-radius: 999px;
    padding: 5px 13px; font-size: 12.5px; cursor: pointer;
    font-family: inherit; transition: all 0.2s;
}
.timer-btn:hover { background: rgba(110, 231, 183, 0.14); border-color: #6ee7b7; }
.timer-btn.on { background: rgba(110, 231, 183, 0.18); border-style: solid; }

.btn-ghost {
    width: 100%;
    padding: 14px;
    font-size: 15px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    background: transparent;
    color: #cfc8f0;
    cursor: pointer;
    margin-top: 12px;
}

.btn-back-last {
    width: 100%;
    padding: 13px;
    font-size: 14px;
    border-radius: 14px;
    border: 1px dashed rgba(255, 184, 107, 0.5);
    background: rgba(255, 184, 107, 0.08);
    color: #ffd97a;
    cursor: pointer;
    margin-bottom: 14px;
}

.history-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.history-title {
    font-size: 16px;
    color: #ffd97a;
}

.history-clear {
    background: none;
    border: none;
    color: #8d86b8;
    font-size: 12px;
    cursor: pointer;
    padding: 4px 6px;
}

.history-item {
    display: flex;
    align-items: center;
    width: 100%;
    text-align: left;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 11px 14px;
    margin-bottom: 8px;
    cursor: pointer;
    color: #f0edfb;
    transition: background 0.2s;
}

.history-item:active { background: rgba(255, 255, 255, 0.14); }

.history-item .hi-main {
    flex: 1;
    min-width: 0;
    display: block;
}

.history-item .hi-meta {
    display: block;
    font-size: 12px;
    color: #8d86b8;
    margin-top: 3px;
}

.history-item .hi-del {
    background: none;
    border: none;
    color: #8d86b8;
    font-size: 17px;
    cursor: pointer;
    padding: 2px 6px;
    line-height: 1;
}
.history-item .hi-fav {
    color: #6b6590;
    font-size: 16px;
    cursor: pointer;
    padding: 2px 6px;
    line-height: 1;
    transition: color 0.2s;
}
.history-item .hi-fav.active { color: #ffd97a; }

.history-empty {
    font-size: 13px;
    color: #8d86b8;
    text-align: center;
    padding: 6px 0 2px;
}

.history-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 4px;
    padding-top: 8px;
}

.history-pager.hidden { display: none; }

.pg-btn {
    font: inherit;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    color: #f0edfb;
    font-size: 13px;
    padding: 6px 16px;
    cursor: pointer;
    transition: background 0.2s;
}

.pg-btn:not(:disabled):active { background: rgba(255, 255, 255, 0.16); }

.pg-btn:disabled { opacity: 0.35; cursor: default; }

.pg-ind {
    font-size: 13px;
    color: #8d86b8;
    min-width: 44px;
    text-align: center;
}

.story-title {
    font-size: 22px;
    text-align: center;
    color: #ffd97a;
    margin-bottom: 16px;
}

.story-body p {
    font-size: 17px;
    line-height: 1.9;
    color: #f0edfb;
    margin-bottom: 14px;
    text-align: justify;
    border-radius: 6px;
    transition: background 0.25s, color 0.25s, box-shadow 0.25s;
}
.story-body p.story-para-active {
    background: rgba(255, 217, 122, 0.14);
    box-shadow: 0 0 0 5px rgba(255, 217, 122, 0.14);
    color: #fff3cf;
}
.story-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 6px; }
.story-tag {
    font-size: 12px; color: #d7d1f2; background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 999px; padding: 4px 10px; line-height: 1.4;
}

.loading {
    text-align: center;
    padding: 40px 0;
}

.stars-loader {
    position: relative;
    width: 152px;
    height: 64px;
    margin: 0 auto;
}

.stars-loader .star {
    position: absolute;
    color: #ffe08a;
    opacity: .3;
    text-shadow: 0 0 10px rgba(255, 224, 138, .85);
    animation: starTwinkle 1.8s ease-in-out infinite;
}

.stars-loader .s1 { left: 4px;   top: 26px; font-size: 22px; animation-delay: 0s; }
.stars-loader .s2 { left: 34px;  top: 2px;  font-size: 15px; animation-delay: .35s; }
.stars-loader .s3 { left: 64px;  top: 24px; font-size: 30px; animation-delay: .7s; }
.stars-loader .s4 { left: 102px; top: 3px;  font-size: 17px; animation-delay: 1.05s; }
.stars-loader .s5 { left: 126px; top: 30px; font-size: 21px; animation-delay: 1.4s; }

@keyframes starTwinkle {
    0%, 100% { opacity: .25; transform: translateY(4px) scale(.85) rotate(-8deg); }
    50%      { opacity: 1;   transform: translateY(-6px) scale(1.15) rotate(8deg); }
}

.loading p {
    margin-top: 16px;
    color: #cfc8f0;
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 40px;
    transform: translateX(-50%);
    max-width: 90%;
    padding: 14px 24px;
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    font-size: 14px;
    z-index: 99;
    text-align: center;
}

.toast.error {
    background: rgba(180, 60, 60, 0.95);
}

.hidden {
    display: none !important;
}

footer {
    text-align: center;
    color: #6d67a0;
    font-size: 12px;
    margin-top: 32px;
}

/* ===== 语言 / 音色 顶部开关 ===== */
.topbar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
}

.segmented {
    display: flex;
    gap: 4px;
    padding: 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
}

/* 灵感来源开关：放在表单里，宽度跟着内容走，不撑满 */
.source-seg {
    display: inline-flex;
}

.source-hint {
    margin: 8px 0 0;
    font-size: 12px;
    line-height: 1.5;
    color: rgba(207, 200, 240, 0.72);
}
.growth-chips { margin-top: 8px; }
.growth-cats { margin-top: 4px; }
.growth-cats .chip { font-size: 13px; }
.growth-step { font-size: 12px; color: #a9a3d6; margin: 8px 0 4px; }

/* 自定义下拉框：页面里所有 <select> 都换成这套，避免系统弹框样式 */
.dd { position: relative; }
.dd-btn {
    width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 10px 12px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.06); color: #f0edfb; font: inherit; font-size: 14px;
    text-align: left; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.dd-btn:active { background: rgba(255, 255, 255, 0.12); }
.dd-val { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-caret { color: #a9a3d6; flex-shrink: 0; }
.dd-panel {
    position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 60;
    background: #221f52; border: 1px solid rgba(255, 255, 255, 0.16); border-radius: 12px;
    padding: 6px; max-height: 260px; overflow: auto; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}
.dd-opt {
    display: block; width: 100%; text-align: left; padding: 9px 10px; border: none; border-radius: 8px;
    background: none; color: #e9e4ff; font: inherit; font-size: 13px; cursor: pointer;
}
.dd-opt.active { background: rgba(110, 231, 183, 0.15); color: #7ef0c0; }
.dd-native { display: none; }
.child-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.child-actions .btn-ghost { flex: 0 0 auto; }

.seg-btn {
    padding: 6px 16px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: #cfc8f0;
    font-size: 13px;
    line-height: 1.2;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.seg-btn:hover {
    color: #fff;
}

.seg-btn.active {
    background: linear-gradient(135deg, #ffb86b, #ff8a5c);
    color: #3a2a10;
    font-weight: 600;
}

/* ===== 家长声音卡片(声音复刻) ===== */
.voice-card { padding: 14px 16px; }
.voice-head {
    width: 100%; display: flex; align-items: center; justify-content: space-between;
    background: none; border: none; color: #f3eefc; cursor: pointer; font-family: inherit;
    font-size: 15px; font-weight: 600; text-align: left; padding: 2px 0;
}
.voice-title { color: #ffd97a; }
.voice-chev { color: #8d86b8; font-size: 13px; transition: transform .2s; }
.voice-body { margin-top: 12px; }
.voice-desc { font-size: 13px; color: #b9b3e6; margin-bottom: 12px; line-height: 1.6; }
/* 朗读声音: 标准声音 / 妈妈 / 爸爸 */
.vc-reader { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 12px; }
.vc-reader-label { font-size: 13px; color: #b9b3e6; }
.vc-reader .seg-btn { padding: 5px 12px; font-size: 12px; }

.vc-row {
    display: flex; align-items: center; gap: 12px;
    background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 14px; padding: 10px 12px; margin-bottom: 8px;
}
.vc-row.active { border-color: rgba(110, 231, 183, .6); background: rgba(110, 231, 183, .08); }
.vc-who { min-width: 58px; font-weight: 600; color: #f3eefc; font-size: 15px; }
.vc-right { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.vc-state { font-size: 12.5px; color: #b9b3e6; line-height: 1.35; text-align: right; }
.vc-state.muted { color: #8d86b8; }
.vc-state.st-ok { color: #6ee7b7; }
.vc-state.st-creating { color: #ffd97a; }
.vc-state.st-rejected, .vc-state.st-error { color: #ff8a8a; }
.vc-acts { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }

.btn-mini {
    border: none; border-radius: 999px; padding: 7px 13px; font-size: 13px; cursor: pointer;
    background: linear-gradient(135deg, #ffb86b, #ff8a5c); color: #3a2a10; font-weight: 600;
}
.btn-mini.ghost { background: transparent; border: 1px solid rgba(255, 255, 255, .2); color: #cfc8f0; font-weight: 400; }
.btn-mini.danger { background: transparent; border: 1px solid rgba(255, 138, 138, .4); color: #ff8a8a; font-weight: 400; }
.btn-mini:disabled { opacity: .55; cursor: not-allowed; }

.vc-rec-panel { margin-top: 6px; background: rgba(0, 0, 0, .14); border: 1px dashed rgba(255, 255, 255, .18); border-radius: 14px; padding: 14px; }
.vc-guide { font-size: 13px; color: #cfc8f0; line-height: 1.7; margin-bottom: 10px; }
.vc-meter { display: flex; align-items: center; gap: 8px; justify-content: center; font-size: 15px; color: #ffd97a; margin: 6px 0; }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: #ff5252; animation: recPulse 1s ease-in-out infinite; }
@keyframes recPulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
.vc-preview { width: 100%; margin: 4px 0 8px; }
.vc-consent { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; color: #b9b3e6; line-height: 1.5; margin: 6px 0 10px; cursor: pointer; }
.vc-consent input { margin-top: 2px; accent-color: #ffb86b; }
.vc-actions { display: flex; gap: 8px; }
.vc-actions .vc-sm { flex: 1; margin-top: 0; padding: 13px 10px; font-size: 14px; width: auto; }
.vc-file-row { margin-top: 10px; text-align: center; }
.vc-file-link { display: inline-block; font-size: 12.5px; color: #b9b3e6; border: 1px dashed rgba(185, 179, 230, .4); border-radius: 999px; padding: 6px 14px; cursor: pointer; background: rgba(255, 255, 255, .03); transition: all .2s; }
.vc-file-link:hover { background: rgba(255, 255, 255, .09); border-color: #b9b3e6; }

/* ===== 家庭码: 显示/复制/认领(换手机或换网址后找回声音和故事) ===== */
.family-card { padding: 16px 18px; }
.family-row { display: flex; align-items: center; gap: 8px; }
.family-label { font-size: 13px; color: #ffd97a; white-space: nowrap; }
.family-code {
    flex: 1; min-width: 0; font-family: ui-monospace, Menlo, Consolas, monospace;
    font-size: 11px; color: #b9b3e6; background: rgba(0, 0, 0, .18);
    border-radius: 8px; padding: 6px 8px; word-break: break-all; line-height: 1.4;
}
.family-btn {
    border: 1px solid rgba(255, 255, 255, .22); background: transparent; color: #cfc8f0;
    border-radius: 999px; padding: 6px 12px; font-size: 12px; cursor: pointer; white-space: nowrap;
}
.family-btn.primary { background: linear-gradient(135deg, #ffb86b, #ff8a5c); color: #3a2a10; border: none; font-weight: 600; }
.family-tip { font-size: 11.5px; color: #8d86b8; line-height: 1.6; margin: 8px 0; }
.family-claim { display: flex; gap: 8px; }
.family-input {
    flex: 1; min-width: 0; background: rgba(0, 0, 0, .18); border: 1px solid rgba(255, 255, 255, .15);
    border-radius: 10px; padding: 8px 10px; color: #f3eefc; font-size: 12px; font-family: ui-monospace, Menlo, Consolas, monospace;
}
.family-input::placeholder { color: #6d67a0; }
.family-input:focus { outline: none; border-color: rgba(255, 184, 107, .55); }

/* ===== 「跟它说句话」: 按住说话, 用爸爸妈妈的声音回答 ===== */
/* 2026-11-05 修: 手机上长按按钮时, 浏览器会把手势当成"选中文字"(常常选中按钮下面那行
   「还能聊 N 轮」), 选中手势一启动就发 pointercancel, 录音被提前掐断 → 误报"按得太短"。
   整张卡片禁止选中 + 禁止长按弹菜单, 只保留按钮自己的触摸处理。 */
.chat-card, .chat-card * {
    -webkit-user-select: none; -moz-user-select: none; user-select: none;
    -webkit-touch-callout: none;
}
/* 按住说话期间, 整页都选不中文字 —— 有的手机浏览器会无视按钮自己的 user-select,
   把手势变成"从头选到尾", 于是连旁边的文字也被拖蓝。这一条是兜底。 */
body.ptt-holding, body.ptt-holding * {
    -webkit-user-select: none !important; -moz-user-select: none !important; user-select: none !important;
    -webkit-touch-callout: none !important;
}
body.ptt-holding { -webkit-tap-highlight-color: transparent; }
.chat-card { padding: 16px 18px 18px; }
.chat-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.chat-title { font-size: 16px; color: #ffd97a; letter-spacing: .5px; }
.chat-persona .seg-btn { padding: 5px 10px; font-size: 12px; }
.chat-tools { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.chat-hf {
    padding: 5px 10px; border: 1px solid rgba(255, 255, 255, .18); border-radius: 999px;
    background: rgba(255, 255, 255, .08); color: #b9b3e6; font-size: 12px; line-height: 1.3;
    cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.chat-hf.on { background: #ffb86b; color: #3a2a10; border-color: transparent; font-weight: 600; }
.chat-rate { font-variant-numeric: tabular-nums; min-width: 52px; }
.chat-log {
    max-height: 260px; overflow-y: auto; margin: 12px 0;
    background: rgba(0, 0, 0, .16); border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 14px; padding: 12px;
    display: flex; flex-direction: column; gap: 8px;
    -webkit-overflow-scrolling: touch;
}
.chat-empty { text-align: center; color: #8d86b8; font-size: 13px; padding: 10px 0; line-height: 1.6; }
/* 切换口吻(爸爸妈妈/故事精灵)时插一条小字, 让人看得出确实换了 */
.chat-note {
    align-self: center; text-align: center; color: #8d86b8; font-size: 12px;
    line-height: 1.5; padding: 2px 0;
}
.chat-bubble {
    max-width: 86%; padding: 9px 12px; border-radius: 14px;
    font-size: 14.5px; line-height: 1.55; word-break: break-word; white-space: pre-wrap;
}
.chat-bubble.user { align-self: flex-end; background: rgba(255, 184, 107, .2); color: #ffe6c7; border-bottom-right-radius: 4px; }
.chat-bubble.bot { align-self: flex-start; background: rgba(255, 255, 255, .1); color: #f3eefc; border-bottom-left-radius: 4px; }
/* 每条回答后面的重播按钮: 播本地缓存, 不重新合成, 不花钱 */
.chat-replay {
    border: none; width: 26px; height: 26px; padding: 0; margin-left: 8px;
    border-radius: 50%; background: rgba(255, 255, 255, .16); color: #f3eefc;
    font-size: 13px; line-height: 26px; text-align: center; vertical-align: middle;
    cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.chat-replay:active { background: rgba(255, 184, 107, .45); }
/* 「它正在想…」的三个跳动小点: 松手到出声之间最多 2-3 秒, 有动静就不显得卡住 */
.chat-bubble.typing { display: inline-flex; align-items: center; gap: 4px; padding: 12px 14px; }
.chat-bubble.typing i { width: 6px; height: 6px; border-radius: 50%; background: #b9b3e6; animation: chatDot 1.1s infinite; }
.chat-bubble.typing i:nth-child(2) { animation-delay: .15s; }
.chat-bubble.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes chatDot {
    0%, 60%, 100% { opacity: .25; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-3px); }
}
.chat-ptt {
    width: 100%; padding: 16px; border: none; border-radius: 999px; cursor: pointer;
    background: linear-gradient(135deg, #ffb86b, #ff8a5c); color: #3a2a10;
    font-size: 17px; font-weight: 600; letter-spacing: 1px;
    user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
    touch-action: none; transition: transform .1s, opacity .2s;
}
.chat-ptt:active { transform: scale(.98); }
.chat-ptt.busy { opacity: .75; }
.chat-ptt:disabled { opacity: .5; cursor: not-allowed; }
.ptt-icon { margin-right: 6px; }
.chat-tip { margin-top: 8px; text-align: center; font-size: 12px; color: #8d86b8; line-height: 1.5; }

/* 有新版本时浮在底部的小按钮(微信里没有下拉刷新, 点它重载) */
.update-bar {
    position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom));
    transform: translateX(-50%); z-index: 950;
    padding: 10px 18px; border: none; border-radius: 999px; cursor: pointer;
    background: #ffb86b; color: #3a2a10; font-size: 13px; font-weight: 600;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .35); -webkit-tap-highlight-color: transparent;
}
.update-bar.hidden { display: none; }

/* ===== 对话全屏: 开口说话时聊天卡铺满手机, 聊完自动收回原位 ===== */
/* 进入时机是"手指松开"(不是按下), 避免手势中途改布局把手势打断。 */
.chat-collapse {
    display: none; width: 30px; height: 30px; padding: 0; border: none; border-radius: 50%;
    background: rgba(255, 255, 255, .14); color: #f3eefc; font-size: 14px; line-height: 30px;
    text-align: center; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
body.chat-full .chat-collapse { display: inline-flex; align-items: center; justify-content: center; }
body.chat-full .chat-head { flex-shrink: 0; }
body.chat-full { overflow: hidden; }
body.chat-full .chat-card {
    position: fixed; inset: 0; z-index: 900; margin: 0; border: none; border-radius: 0;
    display: flex; flex-direction: column;
    padding: calc(14px + env(safe-area-inset-top)) 16px calc(18px + env(safe-area-inset-bottom));
    background: linear-gradient(160deg, #1a1a4e 0%, #2d2a6b 40%, #4a3b7c 100%);
    backdrop-filter: none;
}
body.chat-full .chat-log { flex: 1 1 auto; max-height: none; min-height: 0; margin: 12px 0; }
body.chat-full .chat-ptt { flex-shrink: 0; }
body.chat-full .chat-tip { flex-shrink: 0; }

/* ===== 念诗 · 童谣（卡片） ===== */
.poem-card { padding: 0; overflow: hidden; }
.poem-head {
    width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 18px 20px; background: none; border: none; color: inherit; font: inherit;
    cursor: pointer; text-align: left; -webkit-tap-highlight-color: transparent;
}
.poem-head-main { display: flex; align-items: center; gap: 12px; }
.poem-icon { font-size: 24px; }
.poem-head-text { display: flex; flex-direction: column; gap: 3px; }
.poem-name { font-size: 16px; font-weight: 600; }
.poem-sub { font-size: 12px; color: #b9b3e6; }
.poem-chev { color: #b9b3e6; transition: transform 0.2s ease; }
.poem-head[aria-expanded="true"] .poem-chev { transform: rotate(180deg); }
.poem-body { padding: 0 16px 16px; }
.poem-cats {
    display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.poem-cats::-webkit-scrollbar { display: none; }
.poem-cat {
    flex: 0 0 auto; padding: 7px 13px; border-radius: 999px; cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.16); background: rgba(255, 255, 255, 0.06);
    color: #d9d4f5; font-size: 13px; font-family: inherit;
    -webkit-tap-highlight-color: transparent;
}
.poem-cat.active {
    background: linear-gradient(90deg, #ffd97a, #ffb86b); color: #2b2350;
    border-color: transparent; font-weight: 600;
}
.poem-list { display: flex; flex-direction: column; gap: 6px; max-height: 330px; overflow-y: auto; }
.poem-item {
    display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
    padding: 10px 12px; border-radius: 12px; border: none; cursor: pointer;
    background: rgba(255, 255, 255, 0.05); color: inherit; font: inherit; text-align: left;
    -webkit-tap-highlight-color: transparent;
}
.poem-item:active { background: rgba(255, 255, 255, 0.13); }
.poem-item-title { font-size: 14px; }
.poem-item.poem-cached .poem-item-title { color: #7ef0c0; }
.poem-item.poem-cached::after {
    content: ''; width: 6px; height: 6px; border-radius: 50%;
    background: #6ee7b3; flex-shrink: 0; align-self: center;
    box-shadow: 0 0 6px rgba(110, 231, 179, .7);
}
.poem-item-meta { font-size: 12px; color: #a9a3d6; flex-shrink: 0; }
.poem-empty { font-size: 13px; color: #b9b3e6; padding: 10px 4px; }

/* ===== 念诗 · 全屏阅读 ===== */
body.poem-open { overflow: hidden; }
.poem-full {
    position: fixed; inset: 0; z-index: 950; display: flex; flex-direction: column;
    padding: calc(12px + env(safe-area-inset-top)) 20px calc(14px + env(safe-area-inset-bottom));
    background: linear-gradient(170deg, #14143d 0%, #221f52 55%, #33285f 100%);
    color: #f3eefc;
}
.poem-full-top { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.poem-full-x {
    width: 34px; height: 34px; flex-shrink: 0; border: none; border-radius: 50%;
    background: rgba(255, 255, 255, 0.12); color: #f3eefc; font-size: 15px; cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.poem-full-meta { flex: 1 1 auto; font-size: 12px; color: #a9a3d6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.poem-loop {
    flex-shrink: 0; padding: 7px 12px; border-radius: 999px; cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.18); background: rgba(255, 255, 255, 0.06);
    color: #ffd97a; font-size: 12px; font-family: inherit; -webkit-tap-highlight-color: transparent;
}
.poem-full-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 18px 0 12px; }
.poem-full-title { font-size: 24px; letter-spacing: 2px; text-align: center; color: #ffe6a8; }
.poem-full-author { text-align: center; font-size: 13px; color: #b9b3e6; margin-top: 8px; }
.poem-lines { margin: 26px auto 0; max-width: 420px; }
.poem-line {
    font-size: 21px; line-height: 1.9; letter-spacing: 1px; text-align: center;
    padding: 6px 10px; border-radius: 10px; cursor: pointer;
    transition: background 0.25s ease, color 0.25s ease; -webkit-tap-highlight-color: transparent;
}
.poem-line.active { background: rgba(255, 217, 122, 0.16); color: #fff3cf; }
.poem-lower { margin: 26px auto 0; max-width: 420px; }
.poem-trans-toggle {
    width: 100%; padding: 10px; border-radius: 12px; cursor: pointer;
    border: 1px dashed rgba(255, 255, 255, 0.22); background: transparent;
    color: #cfc9ee; font-size: 13px; font-family: inherit; -webkit-tap-highlight-color: transparent;
}
.poem-trans { font-size: 14px; line-height: 1.8; color: #ded9f6; margin-top: 12px; }
.poem-note { font-size: 13px; line-height: 1.7; color: #a9a3d6; margin-top: 10px; font-style: italic; }
.poem-full-bottom { flex-shrink: 0; padding-top: 10px; }
.poem-play { width: 100%; }
.poem-tools { display: flex; gap: 8px; margin-top: 10px; }
.poem-tool {
    flex: 1 1 0; padding: 9px 4px; border-radius: 12px; cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.14); background: rgba(255, 255, 255, 0.06);
    color: #d9d4f5; font-size: 12px; font-family: inherit; white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}
.poem-tool.on { border-color: rgba(255, 217, 122, 0.7); color: #ffd97a; }
