/* ============================================================
   合成大西瓜 · 乘法挑战
   布局：竖版手机优先，PC 端居中显示，两侧纯色
   ============================================================ */

:root{
  /* PC 两侧配色：从 assets/背景.png 采样得到的天空 → 云 → 草地竖直渐变 */
  --side-top:#C9EEFB;
  --side-mid:#F4FBFD;
  --side-low:#EDF8C8;
  --side-bot:#A6CC72;

  /* 画布未拿到背景图时的兜底底色 */
  --bg-top:#FFFCF5;
  --bg-mid:#FCEFD8;
  --bg-bot:#F4E1BF;

  --ink:#4C3A28;
  --ink-soft:#8A755C;
  --line:#E0CDAE;

  --brand:#E85A4F;
  --brand-dark:#C74438;
  --leaf:#5FA05C;
  --leaf-dark:#46803F;

  --app-max:480px;   /* 仅作为 JS 未介入时的兜底，实际列宽由脚本计算 */
  --hud-h:60px;
  --radius:18px;

  --font: "PingFang SC","Hiragino Sans GB","Microsoft YaHei","Noto Sans SC",
          system-ui,-apple-system,"Segoe UI",sans-serif;
}

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

html,body{
  height:100%;
  overflow:hidden;
  background:linear-gradient(180deg,
    var(--side-top) 0%,
    var(--side-mid) 26%,
    #FBFDF3 52%,
    var(--side-low) 76%,
    var(--side-bot) 100%);
  background-attachment:fixed;
  font-family:var(--font);
  color:var(--ink);
  -webkit-tap-highlight-color:transparent;
  -webkit-user-select:none;user-select:none;
  -webkit-font-smoothing:antialiased;
  overscroll-behavior:none;
  touch-action:manipulation;
}

body{
  display:flex;
  justify-content:center;
  align-items:center;
}

/* ===================== 应用容器 =====================
   宽度由 JS 按世界宽高比实时计算：手机正好铺满整屏，
   PC / 平板收窄成中间一列，两侧露出 body 的纯色。 */
#app{
  position:relative;
  width:100vw;
  height:100vh;
  height:100dvh;
  display:flex;
  flex-direction:column;
  overflow:hidden;
  /* 只有顶部 HUD 与底部工具栏会露出这层壳，画布自己铺满中段 */
  background:
    radial-gradient(120% 60% at 50% 0%, #FFFDF8 0%, rgba(255,253,248,0) 60%),
    linear-gradient(180deg,var(--bg-top) 0%,var(--bg-mid) 46%,var(--bg-bot) 100%);
  box-shadow:
    0 0 0 1px rgba(150,118,74,.14),
    0 28px 80px rgba(104,76,40,.34);
  isolation:isolate;
}

/* 细纹装饰 */
#app::before{
  content:"";
  position:absolute;inset:0;
  background-image:radial-gradient(rgba(160,130,90,.10) 1px, transparent 1px);
  background-size:16px 16px;
  opacity:.55;
  pointer-events:none;
  z-index:0;
}

/* ===================== 顶部 HUD ===================== */
#hud{
  position:relative;
  z-index:3;
  flex:0 0 auto;
  height:var(--hud-h);
  padding:0 14px;
  display:grid;
  /* 第 4 条 auto 轨道放右上角的全屏按钮。前三格的 1fr 会被它挤窄一点点
     （按钮约 34px），换来的是「右上角不再空着」且任何屏宽都不会和最高分重叠。 */
  grid-template-columns:1fr 1fr 1fr auto;
  align-items:center;
  gap:8px;
}

.hud-cell{
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  line-height:1.1;
  min-width:0;
}
.hud-cell.hud-center{align-items:center;}

.hud-label{
  font-size:10.5px;
  letter-spacing:.08em;
  color:var(--ink-soft);
  font-weight:600;
  margin-bottom:3px;
  white-space:nowrap;
}

.hud-value{
  font-size:19px;
  font-weight:800;
  font-variant-numeric:tabular-nums;
  letter-spacing:.01em;
  color:var(--ink);
}

.hud-score{color:var(--brand);font-size:21px;}

/* ---- 右上角：全屏切换 ---- */
.hud-fs{
  justify-self:end;              /* 贴住 HUD 右端 */
  width:34px;height:34px;
  flex:0 0 auto;
  display:flex;align-items:center;justify-content:center;
  border:1.5px solid var(--line);
  border-radius:11px;
  background:rgba(255,255,255,.62);
  color:var(--ink-soft);
  cursor:pointer;
  padding:0;
  transition:background .16s, border-color .16s, color .16s, transform .12s;
  -webkit-tap-highlight-color:transparent;
}
.hud-fs svg{
  width:19px;height:19px;
  fill:none;
  stroke:currentColor;
  stroke-width:1.9;
  stroke-linecap:round;
  stroke-linejoin:round;
  display:block;
}
/* 未全屏时显示「展开」图标，全屏时显示「收起」图标 */
.hud-fs .fs-off{display:none;}
.hud-fs.is-full .fs-on{display:none;}
.hud-fs.is-full .fs-off{display:block;}

.hud-fs:hover{background:#fff;border-color:#CDB68F;color:var(--ink);}
.hud-fs:active{transform:scale(.92);}
.hud-fs:focus-visible{outline:2px solid var(--brand);outline-offset:2px;}
/* 浏览器不支持全屏（iOS Safari 等）时整颗按钮不出现，免得点了个没反应的东西 */
.hud-fs.hidden{display:none;}

#hud-time.urgent{
  color:var(--brand);
  animation:pulse .8s ease-in-out infinite;
}
@keyframes pulse{
  0%,100%{transform:scale(1);opacity:1}
  50%{transform:scale(1.09);opacity:.72}
}

/* ===================== 舞台 ===================== */
#stage{
  position:relative;
  z-index:1;
  flex:1 1 auto;
  min-height:0;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:0;
}

#game{
  display:block;
  touch-action:none;
}

/* 续时飘字 */
.float-badge{
  position:absolute;
  left:50%;
  top:38%;
  transform:translate(-50%,-50%) scale(.6);
  font-size:30px;
  font-weight:900;
  color:#FFD34E;
  text-shadow:0 3px 0 #C9781E, 0 8px 18px rgba(180,110,20,.45);
  opacity:0;
  pointer-events:none;
  letter-spacing:.02em;
  z-index:5;
  white-space:nowrap;
}
.float-badge.show{
  animation:floatUp 1.5s cubic-bezier(.18,.9,.28,1) forwards;
}
@keyframes floatUp{
  0%{opacity:0;transform:translate(-50%,-50%) scale(.5)}
  22%{opacity:1;transform:translate(-50%,-58%) scale(1.14)}
  42%{transform:translate(-50%,-62%) scale(1)}
  100%{opacity:0;transform:translate(-50%,-108%) scale(1)}
}

/* ===================== 遮罩层 ===================== */
#overlay{
  position:absolute;
  inset:0;
  z-index:10;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:18px;
  background:rgba(64,45,26,.42);
  backdrop-filter:blur(7px);
  -webkit-backdrop-filter:blur(7px);
  transition:opacity .28s ease;
}
#overlay.hidden{display:none;}
#overlay.fade-in{animation:ovIn .28s ease both;}
@keyframes ovIn{from{opacity:0}to{opacity:1}}

/* ===================== 面板 ===================== */
.panel{
  width:100%;
  max-width:392px;
  max-height:100%;
  overflow-y:auto;
  padding:22px 20px 20px;
  border-radius:26px;
  background:linear-gradient(180deg,#FFFDF7 0%,#FDF4E4 100%);
  box-shadow:
    0 1px 0 rgba(255,255,255,.9) inset,
    0 20px 48px rgba(70,48,22,.34);
  border:1.5px solid rgba(214,188,148,.85);
  animation:panelIn .34s cubic-bezier(.2,1.2,.35,1) both;
  -webkit-overflow-scrolling:touch;
}
.panel.hidden{display:none;}
@keyframes panelIn{
  from{opacity:0;transform:translateY(16px) scale(.955)}
  to{opacity:1;transform:none}
}
.panel::-webkit-scrollbar{width:0;}

/* ---------- 主菜单 ---------- */
/* 标题直接用 assets/logo.png：JS 按内容包围盒裁切后画进 canvas */
.menu-logo{
  width:100%;
  max-width:292px;
  margin:2px auto 4px;
  display:flex;align-items:center;justify-content:center;
}
.menu-logo canvas{
  display:block;
  width:100%;height:auto;
  filter:drop-shadow(0 7px 12px rgba(120,80,40,.26));
}

.title{
  text-align:center;
  font-size:30px;
  font-weight:900;
  letter-spacing:.04em;
  color:var(--leaf-dark);
  text-shadow:0 2px 0 #fff, 0 3px 0 rgba(90,140,80,.28);
}

.subtitle{
  text-align:center;
  font-size:12.5px;
  color:var(--ink-soft);
  margin-top:7px;
  letter-spacing:.06em;
}

.rule-box{
  margin:18px 0 4px;
  padding:12px 13px;
  border-radius:15px;
  background:rgba(255,255,255,.75);
  border:1.5px solid rgba(224,205,174,.9);
}
.rule-row{
  display:flex;
  gap:9px;
  font-size:12px;
  line-height:1.55;
  padding:3.5px 0;
  color:#6B563E;
}
.rule-row b{
  flex:0 0 34px;
  color:var(--leaf-dark);
  font-weight:800;
}
.rule-row span{flex:1;}

.pick-label{
  margin:17px 0 10px;
  text-align:center;
  font-size:12px;
  font-weight:700;
  color:var(--ink-soft);
  letter-spacing:.1em;
}

.pick-row{
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:10px;
}

.pick-btn{
  position:relative;
  padding:14px 4px 12px;
  border:none;
  border-radius:17px;
  background:linear-gradient(180deg,#FF8A73 0%,#EC5A48 100%);
  color:#fff;
  font-family:inherit;
  cursor:pointer;
  box-shadow:0 5px 0 var(--brand-dark), 0 10px 18px rgba(199,68,56,.32);
  transition:transform .1s ease, box-shadow .1s ease, filter .2s;
  display:flex;flex-direction:column;align-items:center;gap:1px;
}
.pick-btn b{font-size:23px;font-weight:900;line-height:1;letter-spacing:.02em;text-shadow:0 2px 0 rgba(0,0,0,.14);}
.pick-btn span{font-size:10.5px;opacity:.9;font-weight:700;letter-spacing:.12em;}
.pick-btn:active{transform:translateY(4px);box-shadow:0 1px 0 var(--brand-dark);}
.pick-btn:disabled{
  filter:grayscale(.82) brightness(1.04);
  opacity:.5;
  box-shadow:0 5px 0 #9A9086;
  cursor:not-allowed;
}
.pick-btn.alt{
  background:linear-gradient(180deg,#8CCB7B 0%,#5FA05C 100%);
  box-shadow:0 5px 0 var(--leaf-dark), 0 10px 18px rgba(70,128,63,.3);
}
.pick-btn.alt:active{box-shadow:0 1px 0 var(--leaf-dark);}

.cooldown-tip{
  margin-top:13px;
  text-align:center;
  font-size:12.5px;
  font-weight:700;
  color:#B4553F;
  min-height:17px;
  line-height:1.35;
}

/* ---------- 答题面板 ---------- */
.quiz-head{text-align:center;margin-bottom:14px;}
.quiz-tag{
  display:inline-block;
  padding:3.5px 13px;
  border-radius:999px;
  background:linear-gradient(180deg,#FFD265,#F0A72C);
  color:#5C3A05;
  font-size:11.5px;
  font-weight:900;
  letter-spacing:.1em;
  box-shadow:0 2px 0 #C98714;
}
.quiz-title{
  font-size:21px;
  font-weight:900;
  margin-top:9px;
  color:var(--leaf-dark);
  letter-spacing:.02em;
}
.quiz-sub{
  font-size:11.5px;
  color:var(--ink-soft);
  margin-top:6px;
  line-height:1.5;
}
.quiz-sub b{color:var(--brand);font-size:13px;}

.quiz-card{
  padding:14px 16px 12px;
  border-radius:18px;
  background:linear-gradient(180deg,#FFFDF6,#FBF0D9);
  border:1.5px solid rgba(224,205,174,.95);
  box-shadow:0 3px 10px rgba(150,120,80,.1) inset;
  text-align:center;
  margin-bottom:14px;
}
.quiz-question{
  font-size:31px;
  font-weight:900;
  letter-spacing:.05em;
  color:var(--ink);
  font-variant-numeric:tabular-nums;
  line-height:1.2;
}
.quiz-input{
  margin-top:9px;
  min-height:38px;
  border-radius:12px;
  background:rgba(255,255,255,.9);
  border:2px solid var(--line);
  display:flex;align-items:center;justify-content:center;
  gap:2px;
  font-size:26px;
  font-weight:900;
  color:var(--leaf-dark);
  font-variant-numeric:tabular-nums;
  letter-spacing:.06em;
}
.quiz-input .caret{
  display:inline-block;
  width:2px;height:20px;
  background:var(--leaf);
  animation:blink 1s steps(1) infinite;
  border-radius:2px;
  margin-left:2px;
}
@keyframes blink{0%,49%{opacity:1}50%,100%{opacity:0}}

.quiz-card.wrong{animation:shake .42s ease;}
@keyframes shake{
  0%,100%{transform:translateX(0)}
  18%{transform:translateX(-9px)}
  36%{transform:translateX(8px)}
  54%{transform:translateX(-6px)}
  72%{transform:translateX(4px)}
}
.quiz-card.right{
  border-color:#7FC06E;
  box-shadow:0 0 0 3px rgba(127,192,110,.25), 0 3px 10px rgba(150,120,80,.1) inset;
}

.quiz-hint{
  margin-top:8px;
  min-height:16px;
  font-size:12px;
  font-weight:700;
  color:#C9553F;
  letter-spacing:.02em;
}
.quiz-hint.good{color:#4E9440;}

.keypad{
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:8px;
}
.key{
  padding:13px 0;
  border:none;
  border-radius:14px;
  background:linear-gradient(180deg,#FFFFFF,#F1E6D2);
  color:var(--ink);
  font-family:inherit;
  font-size:21px;
  font-weight:800;
  cursor:pointer;
  box-shadow:0 3.5px 0 rgba(190,166,132,.9), 0 7px 12px rgba(120,92,54,.12);
  transition:transform .07s ease, box-shadow .07s ease;
  font-variant-numeric:tabular-nums;
}
.key:active{transform:translateY(3px);box-shadow:0 0.5px 0 rgba(190,166,132,.9);}
.key-fn{font-size:14px;color:var(--ink-soft);font-weight:800;}
.key-ok{
  grid-column:span 3;
  background:linear-gradient(180deg,#8DD17A,#5FA05C);
  color:#fff;
  font-size:16px;
  letter-spacing:.14em;
  box-shadow:0 4px 0 var(--leaf-dark), 0 8px 14px rgba(70,128,63,.3);
  margin-top:2px;
}
.key-ok:active{box-shadow:0 .5px 0 var(--leaf-dark);}

.ghost-btn{
  display:block;
  width:100%;
  margin-top:13px;
  padding:11px 0;
  border-radius:14px;
  background:transparent;
  border:1.5px dashed rgba(180,85,63,.55);
  color:#B4553F;
  font-family:inherit;
  font-size:12.5px;
  font-weight:800;
  letter-spacing:.08em;
  cursor:pointer;
  transition:background .18s;
}
.ghost-btn:active{background:rgba(180,85,63,.1);}

/* 冷却中主菜单的「答题解锁」入口。
   冷却不是死锁：点它答对一道乘法题，就能立刻解除冷却开始新的一局。
   所以这里用实线 + 金色，做成一枚明确的行动召唤，而不是灰色的"禁用提示"。 */
.ghost-btn.menu-unlock{
  margin-top:10px;
  border-style:solid;
  border-color:rgba(212,148,32,.7);
  background:linear-gradient(180deg,#FFF7E0,#FFE6A6);
  color:#8A5A05;
  box-shadow:0 3px 0 rgba(201,135,20,.32), 0 9px 18px rgba(180,130,30,.18);
}
.ghost-btn.menu-unlock:active{background:linear-gradient(180deg,#FFEEC4,#FFDA88);}
.ghost-btn.hidden{display:none;}

/* ---------- 结算 ---------- */
.result-badge{
  width:76px;height:76px;
  margin:2px auto 12px;
  border-radius:50%;
  display:flex;align-items:center;justify-content:center;
  font-size:36px;
  font-weight:900;
  background:linear-gradient(180deg,#FFD265,#F0A72C);
  box-shadow:0 5px 0 #C98714, 0 12px 22px rgba(180,130,30,.34);
  color:#5C3A05;
}
.result-title{
  text-align:center;
  font-size:20px;
  font-weight:900;
  color:var(--leaf-dark);
  letter-spacing:.04em;
}
.result-score{
  text-align:center;
  font-size:54px;
  font-weight:900;
  color:var(--brand);
  line-height:1.15;
  font-variant-numeric:tabular-nums;
  text-shadow:0 3px 0 rgba(199,68,56,.2);
  margin:4px 0 2px;
}
.result-meta{
  text-align:center;
  font-size:12.5px;
  color:var(--ink-soft);
  line-height:1.7;
  margin-bottom:18px;
}
.result-meta b{color:var(--ink);}

.primary-btn{
  display:block;
  width:100%;
  padding:14px 0;
  border:none;
  border-radius:16px;
  background:linear-gradient(180deg,#8DD17A,#5FA05C);
  color:#fff;
  font-family:inherit;
  font-size:15.5px;
  font-weight:900;
  letter-spacing:.12em;
  cursor:pointer;
  box-shadow:0 4.5px 0 var(--leaf-dark), 0 10px 18px rgba(70,128,63,.3);
  transition:transform .08s ease, box-shadow .08s ease;
}
.primary-btn:active{transform:translateY(3px);box-shadow:0 .5px 0 var(--leaf-dark);}
.primary-btn:disabled{
  filter:grayscale(.8);
  opacity:.55;
  box-shadow:0 4.5px 0 #8A8078;
  cursor:not-allowed;
}

/* ---------- Toast ---------- */
.toast{
  position:absolute;
  left:50%;
  top:74px;
  transform:translate(-50%,-14px);
  z-index:20;
  padding:9px 18px;
  border-radius:999px;
  background:rgba(60,42,24,.9);
  color:#FFF6E4;
  font-size:12.5px;
  font-weight:700;
  letter-spacing:.05em;
  white-space:nowrap;
  opacity:0;
  pointer-events:none;
  transition:opacity .25s, transform .25s;
  max-width:88%;
  overflow:hidden;
  text-overflow:ellipsis;
}
.toast.show{opacity:1;transform:translate(-50%,0);}

/* ===================== 底部工具栏 =====================
   4 个道具常驻在底部；非游戏状态整条淡出（仍占位，避免画布高度跳动）。 */
.toolbar{
  position:relative;
  z-index:3;
  flex:0 0 auto;
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:6px;
  padding:7px 9px calc(7px + env(safe-area-inset-bottom, 0px));
  background:linear-gradient(180deg,#FFFDF7 0%,#FAF1DE 58%,#F4E7CE 100%);
  border-top:1.5px solid rgba(214,188,148,.9);
  box-shadow:0 -7px 18px rgba(120,92,54,.12);
  transition:opacity .26s ease;
}
.toolbar.off{opacity:0;pointer-events:none;}

.tool-btn{
  position:relative;
  display:flex;flex-direction:column;align-items:center;gap:1px;
  padding:6px 2px 5px;
  border:1.5px solid rgba(216,190,150,.9);
  border-radius:15px;
  background:linear-gradient(180deg,#FFFFFF,#F4E8D3);
  color:var(--ink);
  font-family:inherit;
  cursor:pointer;
  box-shadow:0 3px 0 rgba(196,170,134,.85), 0 6px 12px rgba(120,92,54,.10);
  transition:transform .08s ease, box-shadow .08s ease, filter .2s, background .2s, border-color .2s;
}
.tool-btn:active{transform:translateY(2.5px);box-shadow:0 .5px 0 rgba(196,170,134,.85);}

.tool-ico{
  width:34px;height:34px;
  display:flex;align-items:center;justify-content:center;
}
.tool-ico img{
  width:100%;height:100%;
  object-fit:contain;display:block;
  filter:drop-shadow(0 2px 3px rgba(120,90,50,.30));
}
.tool-name{
  font-size:10.5px;font-weight:800;letter-spacing:.05em;
  color:var(--ink-soft);white-space:nowrap;
}

.tool-badge{
  position:absolute;top:-6px;right:-3px;
  min-width:19px;height:19px;padding:0 5px;
  border-radius:999px;
  background:linear-gradient(180deg,#FFD265,#F0A72C);
  color:#5C3A05;
  font-size:11px;font-weight:900;line-height:19px;text-align:center;
  font-variant-numeric:tabular-nums;
  box-shadow:0 2px 4px rgba(150,110,20,.35), 0 0 0 2px #FFFDF7;
  transition:background .2s,color .2s;
}

/* 次数为 0：整颗灰掉（但仍可点，点了会提示怎么解锁） */
.tool-btn.empty{filter:grayscale(.92) brightness(1.04);opacity:.6;}
.tool-btn.empty .tool-badge{
  background:linear-gradient(180deg,#DED7CB,#BEB5A6);
  color:#6B6255;
  box-shadow:0 2px 4px rgba(90,80,60,.25), 0 0 0 2px #FFFDF7;
}

/* 已确认使用、等待在画面上指定目标 */
.tool-btn.armed{
  background:linear-gradient(180deg,#FFEBBA,#FFCF6B);
  border-color:#E9A73A;
  box-shadow:0 3px 0 #C98714, 0 0 0 3px rgba(240,167,44,.30), 0 8px 16px rgba(200,140,30,.30);
  filter:none;opacity:1;
  animation:toolPulse 1.05s ease-in-out infinite;
}
.tool-btn.armed .tool-name{color:#7A4A05;}
@keyframes toolPulse{
  0%,100%{transform:translateY(0)}
  50%{transform:translateY(-2.5px)}
}
.tool-btn:disabled{cursor:not-allowed;}

/* 彩蛋模式解锁后，「选果」按钮亮起来（角标显示 ∞） */
.tool-btn.cheat{
  background:linear-gradient(180deg,#FFF6DA,#FFE7AE);
  border-color:#E9B93A;
  box-shadow:0 3px 0 #C99A14, 0 0 0 3px rgba(240,196,44,.26), 0 8px 16px rgba(200,150,30,.30);
  filter:none;opacity:1;
}
.tool-btn.cheat .tool-name{color:#8A5A05;}
.tool-btn.cheat .tool-badge{
  background:linear-gradient(180deg,#FFE57F,#F2B01A);
  color:#5C3A05;
  font-size:13px;
  box-shadow:0 2px 4px rgba(150,110,20,.40), 0 0 0 2px #FFFDF7,
             0 0 10px 2px rgba(255,196,60,.75);
}

/* 武装状态下的操作提示（浮在工具栏上方） */
.tool-hint{
  position:absolute;
  left:50%;
  bottom:calc(100% + 9px);
  transform:translate(-50%,7px);
  padding:7px 16px;
  border-radius:999px;
  background:linear-gradient(180deg,#FFD98A,#F0A72C);
  color:#4A2E05;
  font-size:11.5px;font-weight:800;letter-spacing:.03em;
  white-space:nowrap;
  max-width:94%;
  overflow:hidden;text-overflow:ellipsis;
  box-shadow:0 7px 18px rgba(160,110,20,.42);
  opacity:0;pointer-events:none;
  transition:opacity .2s ease, transform .2s ease;
}
.tool-hint.show{opacity:1;transform:translate(-50%,0);}

/* 画布在「需要指定目标」时光标变化 */
#game.tooling{cursor:crosshair;}

/* ===================== 弹窗（确认使用 / 选择水果） ===================== */
.modal{
  position:absolute;
  inset:0;
  z-index:30;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:18px;
  background:rgba(48,34,18,.46);
  backdrop-filter:blur(5px);
  -webkit-backdrop-filter:blur(5px);
  animation:ovIn .2s ease both;
}
.modal.hidden{display:none;}

.modal-card{
  width:100%;
  max-width:334px;
  max-height:100%;
  overflow-y:auto;
  padding:20px 18px 16px;
  border-radius:24px;
  background:linear-gradient(180deg,#FFFDF7,#FDF3E1);
  border:1.5px solid rgba(214,188,148,.9);
  box-shadow:0 20px 46px rgba(60,40,18,.40);
  text-align:center;
  animation:panelIn .3s cubic-bezier(.2,1.2,.35,1) both;
}
.modal-card::-webkit-scrollbar{width:0;}

.modal-ico{
  width:68px;height:68px;
  margin:0 auto 9px;
  display:flex;align-items:center;justify-content:center;
  border-radius:50%;
  background:linear-gradient(180deg,#FFF4D6,#FFE0A0);
  box-shadow:inset 0 0 0 2px rgba(240,180,60,.45), 0 6px 14px rgba(190,140,30,.22);
}
.modal-ico img{width:78%;height:78%;object-fit:contain;display:block;}

.modal-title{
  font-size:17.5px;font-weight:900;
  color:var(--leaf-dark);letter-spacing:.02em;
}
.modal-desc{
  margin-top:7px;
  font-size:12.5px;line-height:1.55;
  color:var(--ink-soft);
}
.modal-left{
  margin-top:9px;
  font-size:12.5px;font-weight:800;
  color:var(--brand);
}

/* 彩蛋模式的提示条（只在解锁后显示） */
.modal-desc.cheat-note{
  margin-top:9px;
  padding:8px 11px;
  border-radius:12px;
  background:linear-gradient(180deg,#FFF6DA,#FFE9B8);
  border:1.5px solid rgba(233,185,58,.85);
  color:#8A5A05;
  font-weight:800;
  line-height:1.45;
}
.modal-desc.cheat-note.hidden{display:none;}

.modal-actions{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
  margin-top:16px;
}
.modal-actions.single{grid-template-columns:1fr;}

.modal-btn{
  padding:12px 0;
  border:none;
  border-radius:14px;
  font-family:inherit;
  font-size:14.5px;font-weight:900;letter-spacing:.08em;
  cursor:pointer;
  transition:transform .08s ease, box-shadow .08s ease;
}
.modal-btn.ghost{
  background:#F3E9D6;color:var(--ink-soft);
  box-shadow:0 3.5px 0 rgba(196,170,134,.9);
}
.modal-btn.primary{
  background:linear-gradient(180deg,#8DD17A,#5FA05C);
  color:#fff;
  box-shadow:0 4px 0 var(--leaf-dark), 0 9px 16px rgba(70,128,63,.30);
}
.modal-btn:active{transform:translateY(3px);box-shadow:0 .5px 0 rgba(196,170,134,.9);}

/* 选择水果：10 宫格 */
.picker-grid{
  display:grid;
  grid-template-columns:repeat(5,1fr);
  gap:8px;
  margin-top:15px;
}
.pick-fruit{
  display:flex;flex-direction:column;align-items:center;gap:2px;
  padding:6px 2px 5px;
  border:1.5px solid rgba(216,190,150,.85);
  border-radius:13px;
  background:linear-gradient(180deg,#FFFFFF,#F6EEDE);
  cursor:pointer;
  font-family:inherit;
  box-shadow:0 3px 0 rgba(196,170,134,.7);
  transition:transform .08s ease, box-shadow .08s ease;
}
.pick-fruit:active{transform:translateY(2px);box-shadow:0 0 0 rgba(196,170,134,.7);}
.pick-fruit canvas{display:block;}
.pick-fruit span{
  font-size:9.5px;font-weight:800;
  color:var(--ink-soft);letter-spacing:.02em;
  white-space:nowrap;
}

/* ===================== 小屏微调 ===================== */
@media (max-height:720px){
  :root{--hud-h:52px;}
  .menu-logo{max-width:246px;}
  .title{font-size:25px;}
  .rule-box{margin:13px 0 2px;padding:10px 12px;}
  .rule-row{font-size:11.5px;line-height:1.45;padding:2.5px 0;}
  .pick-label{margin:13px 0 8px;}
  .pick-btn{padding:11px 4px 9px;}
  .pick-btn b{font-size:20px;}
  .quiz-question{font-size:27px;}
  .key{padding:10px 0;font-size:19px;}
  .key-ok{padding:12px 0;}
  .panel{padding:18px 16px 16px;}
  .tool-ico{width:30px;height:30px;}
  .tool-btn{padding:5px 2px 4px;}
  .toolbar{gap:5px;padding:6px 8px calc(6px + env(safe-area-inset-bottom, 0px));}
}

@media (max-height:600px){
  .menu-logo{max-width:208px;}
  .rule-box{display:none;}
  .tool-name{display:none;}
  .tool-ico{width:32px;height:32px;}
}
