/**
 * flicker-guard.css — 安卓/国产浏览器闪屏与合成层卡顿防护
 *
 * 覆盖：真心话大冒险进入闪屏、一起听歌顶栏歌名闪、按钮 :active scale 卡顿、
 * overlay 键盘态输入框字号/颜色可见性。
 *
 * 命中 html.lovemi-flat-glass（安卓 Chromium / 国产 WebView）时降级毛玻璃与动画；
 * iPhone Safari / 桌面端不命中 flat-glass，仅消费键盘态规则。
 *
 * v1.0.2
 */

/* ------------------------------------------------------------------ */
/* 1) 真心话大冒险：瞬时显隐，避免与游乐场双层 opacity 交叉淡入闪屏   */
/* ------------------------------------------------------------------ */
.truth-or-dare-game.tod--instant,
.truth-or-dare-game.tod--instant.is-visible {
    transition: none !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.lt-overlay.lt--instant,
.lt-overlay.lt--instant.is-visible {
    transition: none !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* ------------------------------------------------------------------ */
/* 2) 安卓毛玻璃降级：顶栏去模糊后加深底色，避免半透明叠层闪一下       */
/* ------------------------------------------------------------------ */
html.lovemi-flat-glass .tod-header {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: linear-gradient(180deg, rgba(17, 12, 28, 0.96), rgba(17, 12, 28, 0.88)) !important;
}

html.lovemi-flat-glass .tod-band,
html.lovemi-flat-glass .tod-inputbar,
html.lovemi-flat-glass .tod-compose-card,
html.lovemi-flat-glass .tod-hb-mask {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

/* 安卓易闪屏环境关闭星尘动画，减少进入首帧合成压力 */
html.lovemi-flat-glass .tod-shell::before {
    animation: none !important;
    opacity: 0.55 !important;
}

html.lovemi-flat-glass .lt-topbar,
html.lovemi-flat-glass .lt-player__card,
html.lovemi-flat-glass .lt-ctrl,
html.lovemi-flat-glass .lt-icon-btn,
html.lovemi-flat-glass .lt-comment-zone__input,
html.lovemi-flat-glass .lt-comment-send-btn,
html.lovemi-flat-glass .lt-sheet,
html.lovemi-flat-glass .lt-cover__title-strip {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

html.lovemi-flat-glass .lt-topbar {
    background: rgba(255, 252, 253, 0.96) !important;
}

html.lovemi-flat-glass .lt-cover__title-strip {
    background: rgba(20, 16, 22, 0.72) !important;
}

/* ------------------------------------------------------------------ */
/* 3) 一起听歌按钮：去掉 :active scale，减轻安卓合成层卡顿             */
/* ------------------------------------------------------------------ */
html.lovemi-flat-glass .lt-icon-btn:active,
html.lovemi-flat-glass .lt-ctrl:active,
html.lovemi-flat-glass .lt-pill:active,
html.lovemi-flat-glass .lt-row:active,
html.lovemi-flat-glass .lt-menu-item:active,
html.lovemi-flat-glass .lt-overlay .lt-share-btn:active,
html.lovemi-flat-glass .lt-overlay .lt-share-target:active,
html.lovemi-flat-glass .lt-recent-action-btn:active {
    transform: none !important;
}

html.lovemi-flat-glass .lt-icon-btn,
html.lovemi-flat-glass .lt-ctrl {
    transition: background 140ms ease, color 140ms ease !important;
}

/* ------------------------------------------------------------------ */
/* 4) Overlay 键盘态：抬起输入区 + 强制文字/光标可见 + iOS 16px 防缩放 */
/* ------------------------------------------------------------------ */
/* padding-bottom / bottom 由 overlay-keyboard-compat-guard.js 写入像素值 */
body[data-lovemi-overlay-kb="1"] #truth-or-dare-game .tod-shell,
body[data-lovemi-overlay-kb="1"] #listen-together-overlay {
    box-sizing: border-box !important;
}

body[data-lovemi-overlay-kb="1"] #truth-or-dare-game input,
body[data-lovemi-overlay-kb="1"] #truth-or-dare-game textarea,
body[data-lovemi-overlay-kb="1"] #listen-together-overlay input:not([type="range"]):not([type="file"]),
body[data-lovemi-overlay-kb="1"] #listen-together-overlay textarea {
    font-size: 16px !important; /* 防止 iOS Safari 聚焦时整页缩放导致编辑框错位 */
    color: inherit !important;
    -webkit-text-fill-color: currentColor !important;
    caret-color: currentColor !important;
    opacity: 1 !important;
}

/* 真心话输入区：深色底上强制浅色字，避免「打了字看不见」 */
body[data-lovemi-overlay-kb="1"] #truth-or-dare-game .tod-input-field,
body[data-lovemi-overlay-kb="1"] #truth-or-dare-game .tod-compose-card textarea,
body[data-lovemi-overlay-kb="1"] #truth-or-dare-game .tod-compose-field textarea,
body[data-lovemi-overlay-kb="1"] #truth-or-dare-game input[data-tod-search] {
    color: #e8dcc0 !important;
    -webkit-text-fill-color: #e8dcc0 !important;
    caret-color: #d9b863 !important;
    background-color: rgba(10, 8, 16, 0.92) !important;
}

/* 一起听歌评论/搜索：浅色底上强制深色字 */
body[data-lovemi-overlay-kb="1"] #listen-together-overlay .lt-comment-zone__textarea,
body[data-lovemi-overlay-kb="1"] #listen-together-overlay .lt-search__input,
body[data-lovemi-overlay-kb="1"] #listen-together-overlay .lt-lrc-editor__textarea,
body[data-lovemi-overlay-kb="1"] #listen-together-overlay .lt-share-compose__text,
body[data-lovemi-overlay-kb="1"] #listen-together-overlay .lt-pl-editor-input {
    color: #2d2a2c !important;
    -webkit-text-fill-color: #2d2a2c !important;
    caret-color: #2d2a2c !important;
    background-color: rgba(255, 252, 253, 0.98) !important;
}

/* 非键盘态也兜底：部分 Edge/安卓 WebView 组合输入时文字透明 */
#truth-or-dare-game .tod-input-field,
#truth-or-dare-game .tod-compose-card textarea,
#truth-or-dare-game .tod-compose-field textarea {
    color: #e8dcc0;
    -webkit-text-fill-color: #e8dcc0;
    caret-color: #d9b863;
}

#listen-together-overlay .lt-comment-zone__textarea,
#listen-together-overlay .lt-search__input,
#listen-together-overlay .lt-lrc-editor__textarea,
#listen-together-overlay .lt-share-compose__text,
#listen-together-overlay .lt-pl-editor-input {
    color: #2d2a2c;
    -webkit-text-fill-color: #2d2a2c;
    caret-color: #2d2a2c;
}
