/*
 * 今天吃什么
 *
 * 卡片与窗口的数值照 mtab 的 food 组件搬：
 *   卡片 data-v-da7f6b98（26px 标题 / 120×40 按钮）
 *   窗口 data-v-472c6f5e（42px 标题 / 160×50 按钮 / 自定义菜谱弹窗）
 * 只把 mtab 的 Tailwind 类换成普通类名，颜色、字号、圆角、阴影一律不动。
 */

/* ---------- 卡片 ---------- */

/*
 * 跟日历卡一样要自己撑成 flex 列：格子是普通块级，不写这个按钮就按内容高度缩着，
 * 卡片会比两行矮一大截。
 */
.app-card--food {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;

    /* 两种尺寸共用这块底：mtab 的 .food-app 就是这组渐变 */
    --food-bg: linear-gradient(135deg, #fff5f5 0%, #fef3e2 50%, #f0f9ff 100%);
}

/* 1x1：骨架用链接图标的 .app-icon，只换底色、按钮默认样式归零 */
.app-icon.food-mini {
    border: 0;
    padding: 0;
    cursor: pointer;
    background: var(--food-bg);
    box-shadow: 0 6px 16px rgba(18, 24, 38, .12);
    transition: transform .18s cubic-bezier(.2, .7, .3, 1), box-shadow .18s ease;
}

.app-icon.food-mini:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px rgba(18, 24, 38, .16);
}

/* mtab 那份 ico.png 本来就是一整张方图，跟 mtab 一样铺满格子 */
.app-icon.food-mini img {
    display: block;
    width: 100%;
    height: 100%;
    pointer-events: none;
    -webkit-user-drag: none;
}

/* 图标和名字之间的间距跟普通图标一致（.app 的 gap 是 8） */
.app-card--food[data-size="1x1"] {
    gap: 8px;
}

.food-card {
    position: relative;
    flex: 1;
    width: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 6px;
    border: 0;
    border-radius: var(--icon-radius);
    overflow: hidden;
    text-align: center;
    background: var(--food-bg);
    box-shadow: 0 6px 16px rgba(18, 24, 38, .12);
    cursor: pointer;
    transition: transform .18s cubic-bezier(.2, .7, .3, 1), box-shadow .18s ease;
}

.app-card--food .food-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 28px rgba(18, 24, 38, .16);
}

/* mtab 的 .food-app:before 那层纹理，抠出来当独立一层，免得挡住点击 */
.food-deco {
    position: absolute;
    inset: 0;
    opacity: .2;
    pointer-events: none;
    background-image: url(bg.svg);
    background-position: center;
    background-size: cover;
}

.food-ask {
    position: relative;
    margin: 0;
    font-size: 26px;
    font-weight: 700;
    line-height: 1.25;
    color: #3f3f3f;
    /* mtab 那份把标题右移 8px（要跟下面的飞字视觉对齐） */
    transform: translateX(8px);
}

.food-card .foodsName {
    position: relative;
    min-height: 34px;
    font-size: 26px;
    line-height: 1.3;
    font-weight: bolder;
    color: #e6a23c;
    word-break: break-all;
}

.food-start {
    position: relative;
    margin-top: 12px;
    -webkit-user-select: none;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 120px;
    height: 40px;
    padding: 12px 20px;
    font-size: 14px;
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    line-height: 1;
    border: 0;
    border-radius: 40px;
    cursor: pointer;
    color: #fff;
    background: #fff linear-gradient(135deg, #ec7e31, #f2b542);
    box-shadow: 0 2px 6px #f2b241;
    transition: .1s;
}

.food-start:active {
    transform: scale(.95);
}

/* 滚动中：红 */
.food-start.is-rolling {
    background: linear-gradient(90deg, #ea4b67, #ed908b);
    box-shadow: 0 2px 6px #f08984;
}

/* 已经有结果：蓝 */
.food-start.is-again {
    background-image: linear-gradient(90deg, #4996ee, #63cdf5);
    box-shadow: 0 2px 6px #60c4f6;
}

/* 乱飞的菜名：mtab 用绝对定位 + 1.2s 淡出动画 */
.food-fly {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.food-fly .foodItem {
    position: absolute;
    color: #3f3f3f80;
    opacity: 0;
    animation: foodFly 1.2s;
    white-space: nowrap;
}

@keyframes foodFly {
    0% { opacity: 0; }
    30% { opacity: .6; }
    to { opacity: 0; }
}

/* ---------- 窗口 ---------- */

/*
 * mtab 里这是占满整个 app 窗口的一页（.food-app 是 absolute inset:0）。
 * 在主题里它是一个弹窗，外壳沿用日历那套 .cal-sheet，这里只定尺寸。
 */
.fd-root {
    position: relative;
    width: min(760px, 100%);
    height: min(520px, 100%);
    display: flex;
    flex-direction: column;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(8, 12, 22, .34);
}

/* 窗口按钮：Windows 风（跟金额 / 计算器同款），不再是 mtab 的 mac 红点 */
.fd-dots {
    position: absolute;
    top: 10px;
    right: 12px;
    z-index: 60;
    display: flex;
    gap: 2px;
}

.fd-dot {
    display: grid;
    place-items: center;
    width: 34px;
    height: 30px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #4b4b4b;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease;
}

.fd-dot:hover {
    background: rgba(0, 0, 0, .07);
}

.fd-dot--close {
    --cs-x-focus: #e81123;
}

.fd-dot--close:hover {
    background: #e81123;
    color: #ffffff;
}

.fd-app {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #fff5f5 0%, #fef3e2 50%, #f0f9ff 100%);
}

.fd-app:before {
    position: absolute;
    content: " ";
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: .2;
    pointer-events: none;
    background-image: url(bg.svg);
    background-position: center;
    background-size: cover;
}

.fd-center {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: calc(100% - 40px);
    width: 100%;
    margin-top: 40px;
    text-align: center;
}

.fd-app .fd-ask {
    margin: 0;
    font-size: 42px;
    font-weight: 700;
    line-height: 1.25;
    color: #3f3f3f;
}

.fd-app .foodsName {
    min-height: 54px;
    font-size: 42px;
    line-height: 1.3;
    font-weight: bolder;
    color: #e6a23c;
    word-break: break-all;
}

/* 窗口里的按钮比卡片大一档（mtab：160×50 / 18px） */
.fd-app .food-start {
    margin-top: 20px;
    width: 160px;
    height: 50px;
    padding: 12px 20px;
    font-size: 18px;
}

/* 左下角「朋友帮我选」/ 右下角「自定义菜谱」 */
.fd-corner {
    position: absolute;
    z-index: 50;
    bottom: 32px;
    width: max-content;
    height: max-content;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: default;
}

.fd-corner--l { left: 32px; }
.fd-corner--r { right: 32px; }

.custom-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    font-size: 14px;
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    color: #fff;
    background: linear-gradient(135deg, #f0a43d 0%, #e8842a 100%);
    box-shadow: 0 2px 8px #f0a43d66;
    transition: all .2s;
    -webkit-user-select: none;
    user-select: none;
}

.custom-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px #f0a43d80;
}

.custom-btn:active {
    transform: scale(.96);
}

.custom-btn .btn-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.custom-switch {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
}

.custom-switch.disabled {
    opacity: .4;
    cursor: not-allowed;
}

.custom-switch .switch-track {
    width: 44px;
    height: 24px;
    border-radius: 12px;
    background: #d9d9d9;
    position: relative;
    transition: background .3s;
}

.custom-switch.active .switch-track {
    background: linear-gradient(135deg, #f0a43d, #e8842a);
}

.custom-switch .switch-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: left .3s;
    box-shadow: 0 1px 3px #0003;
}

.custom-switch.active .switch-thumb {
    left: 22px;
}

.custom-switch .switch-label {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

/* 自定义菜谱弹窗 */
.dialog-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fdFadeIn .2s;
}

/*
 * 类选择器写了 display:flex，会盖掉 hidden 属性自带的 display:none ——
 * 不补这条，弹窗一进页面就是开着的（踩过）。
 */
.dialog-overlay[hidden] {
    display: none;
}

@keyframes fdFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.dialog-panel {
    background: #fff;
    border-radius: 16px;
    width: 500px;
    max-width: 90%;
    max-height: 80%;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px #00000026;
    animation: fdSlideUp .25s ease-out;
}

@keyframes fdSlideUp {
    from { transform: translateY(12px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 0;
}

.dialog-header .dialog-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.dialog-header .dialog-close {
    width: 34px;
    height: 30px;
    border: 0;
    background: transparent;
    border-radius: 6px;
    color: #4b4b4b;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: background-color .15s ease, color .15s ease;
}

.dialog-header .dialog-close:hover {
    background: #e81123;
    color: #ffffff;
}

.dialog-header .dialog-close svg {
    width: 16px;
    height: 16px;
    color: inherit;
}

.dialog-body {
    padding: 16px 24px 20px;
    flex: 1;
    overflow-y: auto;
}

.dialog-body .dialog-tip {
    font-size: 13px;
    color: #999;
    margin-bottom: 12px;
    line-height: 1.6;
}

.dialog-body .custom-textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.6;
    resize: none;
    outline: none;
    transition: border-color .2s;
    box-sizing: border-box;
    font-family: inherit;
}

.dialog-body .custom-textarea:focus {
    border-color: #f0a43d;
    box-shadow: 0 0 0 3px #f0a43d1a;
}

.dialog-body .custom-textarea::placeholder {
    color: #ccc;
}

.dialog-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 0 24px 20px;
}

.dialog-footer .dialog-btn {
    padding: 8px 24px;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all .2s;
    font-family: inherit;
}

.dialog-footer .dialog-btn.cancel {
    background: #f5f5f5;
    color: #666;
}

.dialog-footer .dialog-btn.cancel:hover {
    background: #e8e8e8;
}

.dialog-footer .dialog-btn.confirm {
    background: linear-gradient(135deg, #f0a43d, #e8842a);
    color: #fff;
    box-shadow: 0 2px 8px #f0a43d66;
}

.dialog-footer .dialog-btn.confirm:hover {
    box-shadow: 0 4px 12px #f0a43d80;
    transform: translateY(-1px);
}

.dialog-footer .dialog-btn.confirm:active {
    transform: scale(.96);
}

/* 手机端标题收一档：42px 的整句在 390 屏上会被折成「…吃什 / 么！」两行 */
@media (max-width: 720px) {
    .fd-app .fd-ask {
        font-size: 26px;
    }
}
