/* ============================================================
 * 今天吃什么 — 暖光食堂主题（亮色系 3.0）
 * 奶油暖白底 + 食欲暖橙，亮堂有胃口；饭点 = 图标小卡片
 * ============================================================*/

.we-app {
    position: relative;
    width: min(var(--ls-width, 1200px), calc(100% - 24px));
    /* 卡片正好占满「页头之下」的一屏：页头高度跟主题变量走，矮屏不再把底部的切换栏顶出首屏 */
    height: calc(100vh - var(--ls-header-height, 64px) - 48px);
    min-height: 560px;
    max-height: 820px;
    margin: 24px auto;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 20px 48px rgba(120, 72, 20, 0.14), 0 0 0 1px rgba(233, 178, 110, 0.22);
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

/* 移动端：整屏。dvh 跟着浏览器地址栏伸缩，不认它的老浏览器回落到 vh */
.we-app.is-mobile {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    min-height: 480px;
    max-height: none;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
}

/* 被站长设成底部 Tab 时让出标签栏的位置（这时不出导航栏） */
.we-app.we-in-tab {
    height: calc(100vh - var(--ls-tabbar-height, 50px) - var(--ls-safe-bottom, 0px));
    height: calc(100dvh - var(--ls-tabbar-height, 50px) - var(--ls-safe-bottom, 0px));
}

/* 作为普通内页打开：外壳把导航栏提到滚动容器外盖在最上面，内容容器按官方约定用
   ls-page-has-navbar 留出导航栏的高度（含刘海安全区），卡片用 flex 把剩下的高度占满。
   不留的话卡片顶端钻到导航栏底下、屏幕底部又空出一条 */
.we-page.ls-page-has-navbar {
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    min-height: 100%;
}
.we-page.ls-page-has-navbar .we-app.is-mobile {
    flex: 1 1 0;
    height: auto;
}

/* 键盘操作（Enter / 空格）时的焦点框 */
.we-title:focus-visible,
.we-start:focus-visible,
.we-tab:focus-visible {
    outline: 2px solid rgba(249, 115, 22, 0.7);
    outline-offset: 4px;
    border-radius: 8px;
}

/* ---- 背景层：奶油底 + 底部暖光 + 美食图标漂浮 ---- */
.we-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 0;
    overflow: hidden;
    background:
        radial-gradient(110% 80% at 50% 115%, rgba(255, 171, 87, 0.30), transparent 60%),
        radial-gradient(60% 46% at 84% 8%, rgba(255, 214, 165, 0.55), transparent 62%),
        linear-gradient(168deg, #fffcf7 0%, #fff6ea 52%, #ffeeda 100%);
    transform: translate3d(0, 0, 0);
}
.we-bg.has-image .we-food-icon { display: none; }

.we-bg .we-food-icon {
    position: absolute;
    left: calc((var(--i) * 9.5% + 4%));
    bottom: -12%;
    font-size: calc(28px + (var(--i) % 4) * 10px);
    opacity: 0;
    pointer-events: none;
    filter: drop-shadow(0 5px 10px rgba(150, 90, 20, 0.16));
    will-change: transform, opacity;
    animation: we-float var(--dur, 14s) linear infinite;
    animation-delay: calc(var(--i) * -2.2s);
}
.we-bg .we-food-icon:nth-child(3n) { --dur: 17s; }
.we-bg .we-food-icon:nth-child(3n+1) { --dur: 12s; }
.we-bg .we-food-icon:nth-child(3n+2) { --dur: 15s; }

@keyframes we-float {
    0%   { transform: translateY(0) translateX(0) rotate(-8deg) scale(0.7); opacity: 0; }
    8%   { opacity: 0.5; }
    50%  { transform: translateY(-52vh) translateX(14px) rotate(8deg) scale(1); opacity: 0.42; }
    92%  { opacity: 0.5; }
    100% { transform: translateY(-104vh) translateX(-10px) rotate(-6deg) scale(0.75); opacity: 0; }
}

/* ---- 主体 ---- */
.we-wrapper {
    width: 90%;
    max-width: 640px;
    text-align: center;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate3d(-50%, -54%, 0);
    z-index: 3;
}

.we-title {
    margin: 0 0 20px;
    padding: 0;
    font-weight: 400;
    font-size: clamp(24px, 4.2vw, 34px);
    color: #4a3426;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.we-title.shake { animation: we-shake .4s; }
@keyframes we-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    50% { transform: translateX(5px); }
    75% { transform: translateX(-3px); }
}

.we-time {
    font-weight: 600;
    color: #ea8a2e;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    border-bottom: 2px dashed transparent;
    transition: border-color .15s ease;
}
.we-time:hover { border-bottom-color: rgba(234, 138, 46, 0.45); }

.we-what {
    font-weight: 800;
    color: #f26b1d;
}
.we-punct { color: #4a3426; }

.we-os {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translate3d(-50%, 30px, 0);
    color: #9a7a5e;
    font-size: 14px;
    line-height: 1.5;
    width: 80%;
    min-height: 1.5em;
}

/* 首次提示气泡 */
.we-tip {
    position: absolute;
    top: -50px;
    left: 50%;
    display: block;
    padding: 7px 14px;
    background: #ffffff;
    border: 1px solid rgba(234, 149, 63, 0.35);
    color: #b45309;
    white-space: nowrap;
    border-radius: 15px;
    box-shadow: 0 6px 18px rgba(180, 110, 30, 0.14);
    transform: translate3d(-50%, 0, 0);
    animation: we-dinnerTip 3s 1s linear both;
}
.we-tip:after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -6px;
    border: 7px solid transparent;
    border-top-color: #ffffff;
}

/* 吐槽气泡 */
.we-comment {
    position: absolute;
    top: -46px;
    left: 50%;
    padding: 8px 15px;
    background: #ffffff;
    border: 1px solid rgba(234, 149, 63, 0.40);
    border-radius: 14px;
    color: #7c4a1e;
    font-size: 13.5px;
    white-space: nowrap;
    max-width: 92%;
    box-shadow: 0 8px 22px rgba(180, 110, 30, 0.16);
    animation: we-comment 3.2s ease-out both;
    pointer-events: none;
}
@keyframes we-comment {
    0% { transform: translate3d(-50%, 8px, 0); opacity: 0; }
    12% { transform: translate3d(-50%, 0, 0); opacity: 1; }
    82% { opacity: 1; }
    100% { opacity: 0; }
}

/* ---- 开始按钮：暖橙大胶囊 ---- */
.we-start {
    display: inline-block;
    cursor: pointer;
    padding: 0;
    border-radius: 999px;
    background: transparent;
}
.we-start span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 188px;
    height: 60px;
    border-radius: 999px;
    background: linear-gradient(180deg, #ff9a3d 0%, #f97316 100%);
    color: #fff;
    text-align: center;
    font-size: 26px;
    font-weight: 800;
    letter-spacing: 0.14em;
    box-shadow: 0 12px 30px rgba(249, 115, 22, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.28);
    transition: box-shadow .16s ease, transform .12s ease;
}
.we-start:hover span {
    box-shadow: 0 16px 36px rgba(249, 115, 22, 0.46), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}
.we-start:active span { transform: translateY(1px); }

/* ---- 滚动时洒出的临时文字（深棕，亮底清晰） ---- */
.we-temp {
    transform: translate3d(0, 0, 0);
    overflow: hidden;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
}
.we-temp-item {
    position: absolute;
    animation: we-flash 1.6s ease-out both;
    white-space: nowrap;
    pointer-events: none;
}

/* ---- 正常/非正常 切换（白底胶囊） ---- */
.we-toggle {
    position: absolute;
    bottom: 56px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(233, 178, 110, 0.45);
    box-shadow: 0 6px 18px rgba(180, 110, 30, 0.10);
    padding: 3px;
    transition: .3s;
    z-index: 4;
    font-size: 13px;
    display: flex;
}
.we-tab {
    color: #a98868;
    padding: 8px 20px;
    display: inline-block;
    cursor: pointer;
    transition: color .25s;
    line-height: 1.4;
    position: relative;
    z-index: 1;
    white-space: nowrap;
}
.we-tab.selected { color: #fff; }
.we-hb {
    box-sizing: border-box;
    background: linear-gradient(180deg, #ff9a3d, #f97316);
    position: absolute;
    top: 3px;
    bottom: 3px;
    left: 3px;
    width: 0;
    border-radius: 999px;
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.35);
    transition: left .28s cubic-bezier(.4, .0, .2, 1), width .28s cubic-bezier(.4, .0, .2, 1);
    z-index: 0;
}

/* 播放中：标题轻微收淡，让结果词更突出 */
body.playing .we-title { color: rgba(74, 52, 38, 0.6); }
body.playing .we-time { color: rgba(234, 138, 46, 0.75); }

/* ---- 干饭实况弹幕（顶部两轨，从右往左横飘） ---- */
.we-danmaku {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 96px;
    z-index: 6;
    overflow: hidden;
    pointer-events: none;
}
.we-dm-item {
    position: absolute;
    left: 100%;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    max-width: 62%;
    padding: 7px 16px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(234, 149, 63, 0.35);
    color: #7c4a1e;
    font-size: 13px;
    line-height: 1.5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: 0 6px 18px rgba(180, 110, 30, 0.14);
    animation: we-dm-fly 9s linear forwards;
    will-change: transform;
}
.we-dm-name {
    font-weight: 700;
    color: #f26b1d;
    text-decoration: none;
    pointer-events: auto;
    margin: 0 1px;
}
a.we-dm-name:hover { text-decoration: underline; }
@keyframes we-dm-fly {
    from { transform: translateX(0); }
    to { transform: translateX(var(--fly, -120vw)); }
}

/* ---- 全站飘屏（非模块页；容器 #we-site-dm 由后端 slot.html 输出在页面尾部，
        胶囊复用上面的 .we-dm-item 样式——module.css 在槽页面由外壳自动带上） ---- */
#we-site-dm {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 24px;
    height: 48px;
    z-index: var(--ls-z-tip, 3000);
    overflow: hidden;
    pointer-events: none;
}
#we-site-dm .we-dm-item { pointer-events: auto; }
#we-site-dm .we-dm-go {
    margin-left: 8px;
    padding-left: 9px;
    border-left: 1px solid rgba(234, 149, 63, 0.35);
    color: #ea8a2e;
    font-size: 12px;
    text-decoration: none;
}
#we-site-dm .we-dm-go:hover { text-decoration: underline; }
/* 手机端：让开底部标签栏与安全区 */
@media (max-width: 768px) {
    #we-site-dm { bottom: calc(var(--ls-tabbar-height, 50px) + var(--ls-safe-bottom, 0px) + 8px); }
}
/* 减动效用户：全站这份整个不飘（模块页内的保留，它们主动点击才动） */
@media (prefers-reduced-motion: reduce) {
    #we-site-dm { display: none; }
}

/* 错误兜底 */
.we-app .we-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    color: #9a7a5e;
    font-size: 14px;
}

/* 移动端微调 */
.is-mobile .we-wrapper { transform: translate3d(-50%, -50%, 0); }
.is-mobile .we-start span { width: 168px; height: 54px; font-size: 23px; }
.is-mobile .we-toggle { bottom: 40px; font-size: 12px; }

@keyframes we-dinnerTip {
    0% { opacity: 0; transform: translate3d(-50%, -8px, 0); }
    10% { opacity: 1; transform: translate3d(-50%, 0, 0); }
    85% { opacity: 1; }
    100% { opacity: 0; transform: translate3d(-50%, -6px, 0); }
}
@keyframes we-flash {
    0% { opacity: 0; transform: scale(0.6); }
    18% { opacity: 1; transform: scale(1.05); }
    30% { transform: scale(1); }
    78% { opacity: 0.9; }
    100% { opacity: 0; transform: translateY(-26px) scale(0.92); }
}

@media (prefers-reduced-motion: reduce) {
    .we-bg .we-food-icon { animation: none; opacity: 0.4; }
}
