/* 烤肉模拟器：项目自己的样式。尺寸都用 --u（画面宽的百分之一）；圆钮边长 --btn 至少 56 像素。
   暗色烤肉店：深褐黑的桌面、深酒红标题条、浅灰的圆钮和气泡、粉灰的盘子；物件（.art）是一块和外壳一样大的画布，图案由 art/ 下的脚本画。 */
:root {
  --bg: #1d1715;
  --page: #2f2927;
  --surface: #3a302d;
  --surface-2: #4a3c38;
  --field: #2a211f;
  --bar: #6a2e2e;
  --disc: #cfccc9;
  --disc-edge: #a9a5a1;
  --ink: #f0e6df;
  --ink-2: #d2c1b6;
  --ink-3: #9a8a81;
  --line: #655450;
  --accent: #e0a24f;
  --danger: #b8473a;
  --on-dark: #f6ebe3;
  --band: #5a2a2a;
  --band-edge: #3f1c1c;
  --title: #efe4dc;
  --btn-ink: #2f2624;
  --bubble: #e2e5e7;
  --bubble-ink: #2a2422;
  --bubble-bad: #8a2c22;
  --gold: #f6d85a;
  --box: #171210;
  --box-edge: #0b0807;
  --fs-small: calc(var(--u) * 3.2);
  --btn-h: calc(var(--text) * 2.5);
}

html,
body {
  background: var(--bg);
}

#app {
  position: fixed;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
}

.frame {
  position: absolute;
  overflow: hidden;
  background: var(--page);
}

.frame:not(.is-ready) {
  visibility: hidden;
}

/* 整页抖动：画面框挂一层；弹窗、悬浮层在框外，挂同一个滤镜 */
.bbq-boil,
.has-boil .modal,
.has-boil .popover {
  filter: url(#bbq-boil);
}

/* ---------- 标题条：两只圆钮，中间大字 ---------- */
.titlebar {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: var(--header-h);
  background: var(--band);
  border-bottom: calc(var(--u) * 0.8) solid var(--band-edge);
  z-index: 3;
}

.page-body {
  position: absolute;
  left: 0;
  top: var(--header-h);
  width: 100%;
  bottom: 0;
}

.page {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.titlebar .rbtn {
  position: absolute;
  top: 50%;
  margin-top: calc(var(--btn) / -2);
}

.frame[data-page="game"] .titlebar .rbtn {
  width: var(--btn-sm);
  height: var(--btn-sm);
  margin-top: calc(var(--btn-sm) / -2);
}

.frame[data-page="game"] .titlebar .rbtn::before {
  content: "";
  position: absolute;
  left: -6px;
  right: -6px;
  top: -6px;
  bottom: -6px;
}

.titlebar .hd-left {
  left: calc(var(--u) * 2.5);
}

.hd-label {
  display: block;
  font-size: var(--fs-small);
  line-height: 1.2;
  color: var(--title);
  opacity: 0.8;
}

.hd-time {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.hd-timeval {
  display: block;
  font-size: calc(var(--u) * 7.4);
  font-weight: var(--title-weight);
  line-height: 1.1;
  color: var(--title);
  white-space: nowrap;
}

.hd-cost {
  position: absolute;
  right: calc(var(--u) * 2.5);
  top: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
}

.hd-costval {
  font-size: calc(var(--u) * 4.4);
  font-weight: var(--title-weight);
  line-height: 1.15;
  color: var(--title);
  white-space: nowrap;
}

.hd-title {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(var(--u) * 8.4);
  font-weight: var(--title-weight);
  letter-spacing: 0.06em;
  line-height: 1.1;
  color: var(--title);
  white-space: nowrap;
  pointer-events: none;
}

:lang(en) .hd-title {
  font-size: calc(var(--u) * 6.4);
  letter-spacing: 0.02em;
}

/* ---------- 圆钮：浅灰的圆面、深一圈的边 ---------- */
.rbtn {
  position: relative;
  flex: none;
  width: var(--btn);
  height: var(--btn);
  touch-action: manipulation;
}

.rbtn-lg {
  width: var(--btn-lg);
  height: var(--btn-lg);
}

.rbtn-face {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--disc);
  border: calc(var(--u) * 0.6) solid var(--disc-edge);
}

.rbtn-ico {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 44%;
  height: 44%;
  transform: translate(-50%, -50%);
  color: var(--btn-ink);
}

.rbtn-ico .icon,
.rbtn-ico svg {
  display: block;
  width: 100%;
  height: 100%;
}

.rbtn:focus-visible {
  box-shadow: none;
  outline: calc(var(--u) * 0.5) solid var(--accent);
  outline-offset: calc(var(--u) * 0.3);
  border-radius: 50%;
}

/* 开始弹窗的遮罩从标题条下面开始，标题条上的图鉴照常能点 */
.modal-below-head {
  top: var(--header-h);
}

/* 语言：整行两个钮，各占一半，当前语言加亮 */
.lang-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-gap: var(--gap-2);
}

.lang-line {
  display: flex;
  align-items: center;
  grid-gap: var(--gap-3);
}

.lang-label {
  flex: none;
  font-weight: var(--title-weight);
}

.lang-line .lang-row {
  flex: 1;
  min-width: 0;
}

.lang-opt.is-on {
  background: var(--band);
  color: var(--title);
  border-color: var(--band-edge);
}

/* ---------- 物件：一块和外壳一样大的画布 ---------- */
.art {
  position: absolute;
}

.art-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.fill-art {
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
}

.piece-box {
  position: relative;
}

/* ---------- 气泡：底下一张画出来的气泡，上面放内容 ---------- */
.bubble {
  position: absolute;
  z-index: 2;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.2s;
}

.bubble.is-shown {
  visibility: visible;
  opacity: 1;
}

.bubble-art {
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
}

.f-bubble {
  pointer-events: none;
  --tfs: 10px;
  --tfp: 14px;
}

/* 朋友的气泡里：要的东西横着排，用 + 连着，每样上面是图、下面是熟度（要蘸料就再连一只蘸料小碟）；给完肉换成「好吃」 */
.fb-inner {
  position: absolute;
  left: 5%;
  right: 5%;
  top: 11%;
  bottom: 34%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tile {
  position: relative;
  display: flex;
  flex: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.t-text {
  display: block;
  margin-top: calc(var(--u) * 0.2);
  font-size: var(--tfs);
  font-weight: var(--title-weight);
  line-height: 1.15;
  white-space: nowrap;
  color: var(--bubble-ink);
}

.t-plus {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: calc(var(--u) * 2.4);
  font-size: var(--tfp);
  font-weight: var(--title-weight);
  line-height: 1;
  color: var(--bubble-ink);
}

.tile.is-got > * {
  opacity: 0.28;
}

.tile.is-got > .t-check {
  opacity: 1;
}

.t-check {
  position: absolute;
  left: 50%;
  top: 40%;
  width: calc(var(--u) * 6);
  height: calc(var(--u) * 6);
  transform: translate(-50%, -50%);
  color: #3f7a2e;
}

.t-check .icon,
.t-check svg {
  display: block;
  width: 100%;
  height: 100%;
}

.f-yum {
  position: absolute;
  left: 12%;
  right: 12%;
  top: 10%;
  bottom: 14%;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: calc(var(--u) * 4.2);
  font-weight: var(--title-weight);
  color: var(--bubble-ink);
}

.f-yum-text {
  display: block;
  width: 100%;
  text-align: center;
  line-height: 1.2;
  overflow-wrap: break-word;
}

.f-bubble.is-yum .f-yum {
  display: flex;
}

.f-eat {
  position: absolute;
  left: 4%;
  right: 4%;
  top: 10%;
  bottom: 14%;
  display: none;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: calc(var(--u) * 4.4);
  font-weight: var(--title-weight);
  line-height: 1.2;
  color: var(--bubble-ink);
}

.f-bubble.is-eat .f-eat {
  display: flex;
}

.f-bubble.is-yum .fb-inner,
.f-bubble.is-done .fb-inner,
.f-bubble.is-eat .fb-inner {
  visibility: hidden;
}

.f-bubble.is-eat .f-done {
  display: none;
}

.f-idle {
  position: absolute;
  left: 4%;
  right: 4%;
  top: 10%;
  bottom: 14%;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: calc(var(--u) * 6);
  font-weight: var(--title-weight);
  color: var(--bubble-ink);
}

.f-bubble.is-idle .f-idle {
  display: flex;
}

.f-bubble.is-idle .fb-inner {
  visibility: hidden;
}

.f-bubble.fx-shake {
  animation: shake 0.5s ease-in-out;
}

.f-bubble.is-warn .fb-inner {
  animation: warn 0.7s ease-in-out infinite alternate;
}

.f-done {
  position: absolute;
  left: 50%;
  top: 44%;
  display: none;
  width: calc(var(--u) * 8);
  height: calc(var(--u) * 8);
  transform: translate(-50%, -50%);
  color: #4f8a3a;
}

.f-done .icon,
.f-done svg {
  display: block;
  width: 100%;
  height: 100%;
}

.f-bubble.is-done .f-done {
  display: block;
}

.f-bubble.is-yum .f-done {
  display: none;
}

/* 我的提示气泡：浮在我的蘸料碟上面，短短一句，点一下收起 */
.me-bubble {
  z-index: 8;
  touch-action: manipulation;
}

.mb-inner {
  position: absolute;
  left: 4%;
  right: 4%;
  top: 0;
  bottom: 22%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.mb-text {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: calc(var(--u) * 4.4);
  line-height: 1.2;
  color: var(--bubble-ink);
}

.me-bubble.is-bad .mb-text {
  color: var(--bubble-bad);
}

/* ---------- 朋友的盘子、蘸料碟、我的盘子 ---------- */
.fplate,
.ftray,
.mytray,
.myplate,
.rplate,
.shelf,
.grillbox,
.trashbtn {
  position: absolute;
}

/* 饱腹程度：上面一行字，下面一条整条的进度条，填色从左往右涨到 100%，百分数叠在条上 */
.mw {
  position: absolute;
}

.mw-label {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--title-weight);
  line-height: 1;
  color: var(--ink);
  white-space: nowrap;
}

.meter {
  position: absolute;
  left: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--box);
  border: calc(var(--u) * 0.5) solid var(--box-edge);
  border-radius: calc(var(--u) * 2.4);
  overflow: hidden;
}

.meter-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  transition: width 0.7s ease-out;
}

.meter-pct {
  position: relative;
  font-weight: var(--title-weight);
  line-height: 1.1;
  color: #fff;
  white-space: nowrap;
  -webkit-text-stroke: calc(var(--u) * 0.6) #1a1210;
  paint-order: stroke fill;
}

.mw.is-full .meter-pct {
  color: var(--gold);
}

.sauce-zone {
  position: absolute;
}

/* ---------- 生肉盘、烤盘、换烤盘、垃圾桶 ---------- */
.r-pile,
.m-queue,
.g-layer {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
}

.r-piece {
  position: absolute;
}

/* 肉盘拿空了：盘里写点击补货 */
.r-restock {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  display: none;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: calc(var(--u) * 3.8);
  font-weight: var(--title-weight);
  color: #2a1e1c;
}

.r-restock.is-on {
  display: flex;
}

/* 这一档没有的菜：盘子压暗，中间写未解锁 */
.r-lock {
  white-space: pre-line;
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: calc(var(--u) * 4.2);
  font-weight: var(--title-weight);
  color: #e3d9d3;
  pointer-events: none;
}

/* 朋友的碗：已经给了、还没凑齐的东西 */
.f-bowl {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.gp {
  position: absolute;
  touch-action: none;
}

.gp-sprite {
  position: absolute;
  left: 0;
  top: 0;
}

.gp .gp-sprite.fx-flip {
  animation: flip 0.8s linear;
}

/* ---------- 我的盘子 ---------- */
.m-piece {
  position: absolute;
}

/* 拿着的肉对着的东西：垃圾桶开盖；盘子、烤盘沿着自己的轮廓勾一圈边；蘸料格描一圈 */
.is-aim > .fill-art {
  filter:
    drop-shadow(calc(var(--u) * 0.45) 0 0 var(--accent))
    drop-shadow(calc(var(--u) * -0.45) 0 0 var(--accent))
    drop-shadow(0 calc(var(--u) * 0.45) 0 var(--accent))
    drop-shadow(0 calc(var(--u) * -0.45) 0 var(--accent));
}

.sauce-zone.is-aim {
  outline: calc(var(--u) * 0.5) solid var(--accent);
  outline-offset: calc(var(--u) * 0.2);
  border-radius: calc(var(--u) * 1.2);
}

.trashbtn .trash-open {
  visibility: hidden;
}

.trashbtn.is-open .trash-closed {
  visibility: hidden;
}

.trashbtn.is-open .trash-open {
  visibility: visible;
}

/* ---------- 拖着走的肉：比手指高一截，带影子 ---------- */
.carry {
  position: absolute;
  z-index: 20;
  pointer-events: none;
  visibility: hidden;
  filter: drop-shadow(0 calc(var(--u) * 1) calc(var(--u) * 0.9) rgba(0, 0, 0, 0.55));
}

.carry.is-on {
  visibility: visible;
}

.carry-piece {
  position: absolute;
  left: 0;
  top: 0;
}

.gp.is-lifting {
  visibility: hidden;
}

.ghost {
  position: absolute;
  pointer-events: none;
}

.say-pop {
  position: absolute;
  z-index: 6;
  box-sizing: border-box;
  padding: calc(var(--u) * 1.4) calc(var(--u) * 2.2);
  font-size: calc(var(--u) * 3.6);
  line-height: 1.25;
  text-align: center;
  overflow-wrap: anywhere;
  color: var(--bubble-ink);
  background: #e2e5e7;
  border: calc(var(--u) * 0.5) solid var(--bubble-ink);
  border-radius: calc(var(--u) * 2.4);
  pointer-events: none;
  animation: saypop 1.7s ease-out forwards;
}

@keyframes saypop {
  0% { transform: scale(0.7); opacity: 0; }
  12% { transform: scale(1); opacity: 1; }
  80% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1); opacity: 0; }
}

/* 每一组的落点：盘子加饱腹程度，不画东西，只接放下的肉 */
.zone {
  position: absolute;
  border-radius: calc(var(--u) * 2);
}

/* 整页最上层放飘字，不被气泡、进度条盖住 */
.fx-layer {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  z-index: 16;
  pointer-events: none;
}

/* ---------- 教程：压黑别处，只露出要点的地方；说明放在不挡着它的上面或下面 ---------- */
.tut-dim {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  display: none;
  pointer-events: none;
}

.tut-dim.is-on {
  display: block;
}

.tut-ring {
  fill: none;
  stroke: var(--accent);
  stroke-width: calc(var(--u) * 0.7);
  animation: glow 0.9s ease-in-out infinite alternate;
}

/* 拖动示范：指尖从起点按住、移到终点、抬起 */
.tut-finger {
  position: absolute;
  left: calc(var(--u) * -3.5);
  top: calc(var(--u) * -3.5);
  z-index: 11;
  width: calc(var(--u) * 7);
  height: calc(var(--u) * 7);
  border-radius: 50%;
  background: rgba(255, 242, 200, 0.85);
  border: calc(var(--u) * 0.6) solid var(--accent);
  display: none;
  pointer-events: none;
  opacity: 0;
}

.tut-finger.is-on {
  display: block;
  animation: tutdrag 2.4s ease-in-out infinite;
}

.tut-card {
  position: absolute;
  left: 8%;
  width: 84%;
  z-index: 12;
  display: none;
  flex-direction: column;
  align-items: center;
  padding: calc(var(--u) * 3) calc(var(--u) * 4);
  background: var(--surface);
  border: calc(var(--u) * 0.6) solid var(--accent);
  border-radius: calc(var(--u) * 3);
  touch-action: manipulation;
}

.tut-card.is-on {
  display: flex;
}

.tc-text {
  padding: 0 calc(var(--u) * 7);
  font-size: var(--fs-name);
  line-height: 1.35;
  text-align: center;
  color: var(--ink);
}

.tc-btns {
  display: none;
  margin-top: calc(var(--u) * 2);
}

.tut-card.has-go .tc-btns {
  display: flex;
}

/* 跳过：说明框右上角的小钮 */
.tut-skip {
  position: absolute;
  right: calc(var(--u) * 1.4);
  top: calc(var(--u) * 1.2);
  padding: 0 calc(var(--u) * 1.8);
  height: calc(var(--u) * 5);
  font-size: calc(var(--u) * 2.9);
  line-height: calc(var(--u) * 5);
  color: var(--btn-ink);
  background: var(--disc);
  border-radius: calc(var(--u) * 2.5);
  touch-action: manipulation;
}

.tut-skip::before {
  content: "";
  position: absolute;
  left: -10px;
  right: -10px;
  top: -10px;
  bottom: -10px;
}

.tut-card.has-go .tut-skip {
  display: none;
}

.tut-again {
  display: none;
}

.tut-card.is-end .tut-again {
  display: block;
}

.tc-btn {
  position: relative;
  min-height: 36px;
  margin: 0 calc(var(--u) * 1.2);
  padding: 0 calc(var(--u) * 4);
  font-size: var(--fs-name);
  font-weight: var(--title-weight);
  color: var(--btn-ink);
  background: var(--disc);
  border-radius: calc(var(--u) * 3);
  touch-action: manipulation;
}

.tc-btn::before {
  content: "";
  position: absolute;
  left: -4px;
  right: -4px;
  top: -4px;
  bottom: -4px;
}

.tut-go {
  color: var(--title);
  background: var(--band);
}

/* ---------- 飘字和各种反应：盘子本身不动，只闪亮一下 ---------- */
.float {
  position: absolute;
  text-align: center;
  font-size: calc(var(--u) * 5);
  font-weight: var(--title-weight);
  pointer-events: none;
  animation: rise 1.2s ease-out forwards;
  -webkit-text-stroke: calc(var(--u) * 0.6) #151110;
  paint-order: stroke fill;
}

.float.is-good {
  color: #9ce07a;
}

.float.is-ok {
  color: #f0c85a;
}

.fx-lit {
  animation: lit 0.7s ease-out;
}

@keyframes lit {
  0% { filter: brightness(1.7); }
  100% { filter: brightness(1); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(calc(var(--u) * -1.6)); }
  40% { transform: translateX(calc(var(--u) * 1.6)); }
  60% { transform: translateX(calc(var(--u) * -1.1)); }
  80% { transform: translateX(calc(var(--u) * 1.1)); }
}

@keyframes warn {
  0% { opacity: 1; }
  100% { opacity: 0.35; }
}

@keyframes glow {
  0% { border-color: var(--accent); }
  100% { border-color: #fff2c8; }
}

@keyframes rise {
  0% { transform: translateY(0); opacity: 1; }
  100% { transform: translateY(calc(var(--u) * -9)); opacity: 0; }
}

/* 翻面：肉掀起来、放大、朝手滑的方向（--fx、--fy）转到立起来（这时换面），再转回落下 */
@keyframes flip {
  0% { transform: perspective(calc(var(--u) * 70)) translate(0, 0) scale(1) rotate3d(var(--ax, 1), var(--ay, 0), 0, 0deg); animation-timing-function: ease-in; }
  50% { transform: perspective(calc(var(--u) * 70)) translate(calc(var(--fx, 0) * var(--u) * 3), calc(var(--fy, 1) * var(--u) * 3)) scale(1.5) rotate3d(var(--ax, 1), var(--ay, 0), 0, 90deg); }
  50.01% { transform: perspective(calc(var(--u) * 70)) translate(calc(var(--fx, 0) * var(--u) * 3), calc(var(--fy, 1) * var(--u) * 3)) scale(1.5) rotate3d(var(--ax, 1), var(--ay, 0), 0, -90deg); animation-timing-function: ease-out; }
  100% { transform: perspective(calc(var(--u) * 70)) translate(0, 0) scale(1) rotate3d(var(--ax, 1), var(--ay, 0), 0, 0deg); }
}

@keyframes tutdrag {
  0% { transform: translate(var(--x0), var(--y0)) scale(1); opacity: 0; }
  12% { transform: translate(var(--x0), var(--y0)) scale(1); opacity: 1; }
  24% { transform: translate(var(--x0), var(--y0)) scale(0.8); opacity: 1; }
  72% { transform: translate(var(--x1), var(--y1)) scale(0.8); opacity: 1; }
  84% { transform: translate(var(--x1), var(--y1)) scale(1); opacity: 0; }
  100% { transform: translate(var(--x1), var(--y1)) scale(1); opacity: 0; }
}

/* ---------- 开始页：标题条里的标题和两个钮，下面是一桌烤肉 ---------- */
.st-smoke,
.st-layer {
  position: absolute;
  pointer-events: none;
}

.st-puff {
  position: absolute;
  bottom: 0;
  width: calc(var(--u) * 9);
  height: calc(var(--u) * 9);
  border-radius: 50%;
  background: rgba(240, 230, 223, 0.18);
  animation: puff 3.6s ease-in infinite;
}

.st-puff-0 { left: calc(var(--u) * 8); }
.st-puff-1 { left: calc(var(--u) * 20); animation-delay: 0.9s; }
.st-puff-2 { left: calc(var(--u) * 31); animation-delay: 1.8s; }
.st-puff-3 { left: calc(var(--u) * 40); animation-delay: 2.7s; }

@keyframes puff {
  0% { transform: translateY(0) scale(0.6); opacity: 0.8; }
  100% { transform: translateY(calc(var(--u) * -18)) scale(1.4); opacity: 0; }
}

.st-meat {
  position: absolute;
}

/* ---------- 弹窗：深色的板，酒红的标题行，浅灰的按钮 ---------- */
.modal {
  width: var(--modal-w);
  border: calc(var(--u) * 0.6) solid var(--surface-2);
}

.modal-head {
  background: var(--band);
  border-bottom: calc(var(--u) * 0.6) solid var(--band-edge);
}

.modal-title {
  font-weight: var(--title-weight);
  color: var(--title);
}

.modal-close {
  color: var(--title);
}

.modal-locked.modal-untitled .modal-body {
  padding-top: var(--gap-3);
}

.modal .btn {
  position: relative;
  height: var(--btn-h);
  min-height: var(--btn-h);
  background: var(--disc);
  border-color: var(--disc-edge);
  color: var(--btn-ink);
  font-weight: var(--title-weight);
}

.modal .btn-primary {
  background: var(--band);
  border-color: var(--band-edge);
  color: var(--title);
}

.modal .btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

/* 底部按钮竖着排，每个占满一行 */
.modal-vertical .modal-foot {
  display: block;
}

.modal-vertical .modal-foot .btn {
  display: block;
  width: 100%;
  margin: 0 0 var(--gap-2);
}

.modal-vertical .modal-foot .btn:last-child {
  margin-bottom: 0;
}

/* 底部按钮两个一排，单出来的一个占满一行 */
.modal-grid-foot .modal-foot {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-gap: var(--gap-2);
}

.modal-grid-foot .modal-foot .btn {
  margin: 0;
}

.modal-grid-foot .modal-foot .btn:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

/* 文字钮高度只贴着字（--btn-h），点击区用伪元素往外扩到 44 像素 */
.modal .btn::before,
.wide-btn::before,
.seg::before,
.pf-slot::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: calc((var(--btn-h) - var(--touch)) / 2);
  bottom: calc((var(--btn-h) - var(--touch)) / 2);
}

/* 内容里一整行宽的按钮 */
.wide-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: var(--btn-h);
  min-height: var(--btn-h);
  padding: 0 var(--gap-3);
  font-size: var(--text);
  font-weight: var(--title-weight);
  color: var(--btn-ink);
  background: var(--disc);
  border: var(--border-w) solid var(--disc-edge);
  border-radius: var(--radius);
  touch-action: manipulation;
}

.wide-btn.is-primary {
  background: var(--band);
  border-color: var(--band-edge);
  color: var(--title);
}

.wide-btn[disabled] {
  color: var(--ink-3);
  background: var(--field);
  border-color: var(--line);
}

/* ---------- 选套餐：两句话，八块价牌，一行开始 ---------- */
.pkg {
  text-align: center;
}

.pkg-text {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.pkg-lead,
.pkg-ask {
  margin: 0;
  font-size: var(--text);
  line-height: 1.5;
  color: var(--ink-2);
}

.pkg-ask {
  margin-top: var(--gap-1);
  font-size: calc(var(--u) * 4.6);
  font-weight: var(--title-weight);
  color: var(--ink);
}

.pkg-people {
  display: flex;
  align-items: center;
  justify-content: center;
}

.pp-word {
  font-size: calc(var(--u) * 4.4);
  font-weight: var(--title-weight);
  color: var(--ink);
}

.pp-segs {
  display: flex;
  margin: 0 var(--gap-2);
}

.pkg-people:empty {
  display: none;
}

.seg {
  position: relative;
  height: var(--btn-h);
  min-height: var(--btn-h);
  padding: 0 calc(var(--u) * 3.4);
  font-size: var(--text);
  font-weight: var(--title-weight);
  color: var(--btn-ink);
  background: var(--disc);
  border: var(--border-w) solid var(--disc-edge);
  touch-action: manipulation;
}

.seg:first-child {
  border-radius: var(--radius) 0 0 var(--radius);
}

.seg:last-child {
  border-radius: 0 var(--radius) var(--radius) 0;
}

.seg + .seg {
  margin-left: calc(var(--border-w) * -1);
}

.seg.is-on {
  background: var(--band);
  color: var(--title);
  border-color: var(--band-edge);
}

.pkg-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-gap: var(--gap-2);
}

.tag {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(var(--u) * 16);
  padding: var(--gap-1) 0;
  background: var(--disc);
  border: var(--border-w) solid var(--disc-edge);
  border-radius: var(--radius-sm);
  color: var(--btn-ink);
  touch-action: manipulation;
}

.tag::before {
  content: "";
  position: absolute;
  left: 50%;
  top: calc(var(--u) * 1.2);
  width: calc(var(--u) * 1.8);
  height: calc(var(--u) * 1.8);
  margin-left: calc(var(--u) * -0.9);
  border-radius: 50%;
  background: var(--band-edge);
}

.tag.is-on {
  background: var(--band);
  border-color: var(--accent);
  color: var(--title);
}

.tag.is-on::before {
  background: var(--accent);
}

.tag.is-locked {
  background: var(--field);
  border-color: var(--line);
  color: var(--ink-3);
}

.tag.is-locked::before {
  background: var(--line);
}

.tag-price {
  margin-top: calc(var(--u) * 1.6);
  font-size: calc(var(--u) * 4);
  font-weight: var(--title-weight);
  line-height: 1.2;
  white-space: nowrap;
}

.tag-lock {
  display: flex;
  width: calc(var(--u) * 4);
  height: calc(var(--u) * 4);
  margin-top: calc(var(--u) * 0.6);
}

.tag-lock .icon,
.tag-lock svg {
  display: block;
  width: 100%;
  height: 100%;
}

.stars {
  display: inline-flex;
}

.star {
  display: block;
  width: calc(var(--u) * 3.2);
  height: calc(var(--u) * 3.2);
  color: #8a7e78;
}

.star svg {
  display: block;
  width: 100%;
  height: 100%;
  stroke-width: 5;
}

.star.is-on {
  color: var(--gold);
}

.star.is-on svg {
  fill: var(--gold);
}

.tag-stars {
  margin-top: calc(var(--u) * 0.6);
}

.tag.is-on .star {
  color: #8a5c5c;
}

.tag.is-on .star.is-on {
  color: var(--gold);
}

.pkg-friends {
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  height: calc(var(--touch) + var(--gap-2) * 2 + var(--border-w) * 2);
  padding: 0 var(--gap-2);
  background: var(--box);
  border: var(--border-w) solid var(--box-edge);
  border-radius: var(--radius);
}

.pkg-friends:empty {
  display: none;
}

.pf-slots {
  flex: 1;
  min-width: 0;
  display: flex;
  justify-content: center;
}

.pf-slot {
  flex: 1 1 0;
  position: relative;
  min-width: 0;
  height: var(--btn-h);
  min-height: var(--btn-h);
  margin: 0 var(--gap-1);
  padding: 0 var(--gap-2);
  font-size: var(--text);
  color: var(--btn-ink);
  background: var(--disc);
  border: var(--border-w) solid var(--disc-edge);
  border-radius: var(--radius);
  touch-action: manipulation;
}

.pf-name {
  display: block;
  white-space: nowrap;
  text-align: center;
}

.pf-locked {
  width: 100%;
  text-align: center;
  white-space: nowrap;
  font-size: var(--text);
  font-weight: var(--title-weight);
  color: var(--ink-2);
}

.pf-dice {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--touch);
  height: var(--touch);
  color: var(--ink);
  touch-action: manipulation;
}

.pf-dice .icon,
.pf-dice svg {
  display: block;
  width: calc(var(--u) * 6);
  height: calc(var(--u) * 6);
}

/* ---------- 图鉴：一排三格，格子是方的 ---------- */
.codex-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-gap: var(--gap-2);
}

.cx {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: var(--gap-1);
  color: var(--btn-ink);
  background: var(--disc);
  border: var(--border-w) solid var(--disc-edge);
  border-radius: var(--radius-sm);
}

.cx.is-unknown {
  color: var(--ink-3);
  background: var(--field);
  border-color: var(--line);
}

.cx.is-use {
  opacity: 0.5;
}

.cx-name {
  font-size: var(--fs-name);
  font-weight: var(--title-weight);
  line-height: 1.3;
  text-align: center;
  overflow-wrap: break-word;
}

.cx-count {
  position: absolute;
  right: calc(var(--u) * 0.8);
  top: calc(var(--u) * 0.8);
  padding: 0 calc(var(--u) * 1.2);
  font-size: var(--fs-small);
  line-height: 1.5;
  color: var(--title);
  background: var(--band);
  border-radius: calc(var(--u) * 2);
}

.cx-rarity {
  margin-top: var(--gap-1);
}

.cx-rarity .star {
  width: calc(var(--u) * 2.6);
  height: calc(var(--u) * 2.6);
  color: #a39893;
}

.cx.is-unknown .cx-rarity .star {
  color: #5e514c;
}

/* ---------- 结果：星星、已消费、两个小框 ---------- */
.result {
  align-items: center;
  text-align: center;
}

.result-stars .star {
  width: calc(var(--u) * 9);
  height: calc(var(--u) * 9);
  margin: 0 calc(var(--u) * 0.6);
}

.result-big {
  font-size: calc(var(--u) * 10);
  font-weight: var(--title-weight);
  line-height: 1.2;
}

.result-sub {
  margin-top: 0;
  font-size: var(--fs-name);
  line-height: 1.3;
  color: var(--ink-3);
}

.result-boxes {
  display: flex;
  width: 100%;
}

.rbox {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  margin-left: var(--gap-2);
  padding: var(--gap-2) var(--gap-1);
  background: var(--field);
  border: var(--border-w) solid var(--surface-2);
  border-radius: var(--radius-sm);
}

.rbox:first-child {
  margin-left: 0;
}

.rbox-label {
  font-size: var(--fs-name);
  line-height: 1.2;
  color: var(--ink-2);
}

.rbox-value {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: var(--gap-1);
  text-align: center;
  font-size: calc(var(--u) * 4.4);
  font-weight: var(--title-weight);
  line-height: 1.2;
}

.rbox.is-ok .rbox-value {
  color: #8fcf6a;
}

.rbox.is-bad .rbox-value {
  color: #e0705a;
}

.result-unlock {
  font-size: var(--fs-name);
  color: var(--accent);
}

/* ---------- 朋友气泡底部的等待条：越满越红，走满朋友就把烤盘上的肉吃光 ---------- */
.f-wait {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 17%;
  height: 10%;
  display: none;
  background: var(--box);
  border: calc(var(--u) * 0.4) solid var(--box-edge);
  border-radius: calc(var(--u) * 2);
  overflow: hidden;
}

.f-bubble.has-wait .f-wait {
  display: block;
}

.f-wait-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
}

/* ---------- 左下：两个烤盘钮（画加猛烈 / 均匀），点哪个换成哪个 ---------- */
.gbtn {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--box);
  border: calc(var(--u) * 0.5) solid var(--box-edge);
  border-radius: calc(var(--u) * 2.4);
  opacity: 0.72;
  touch-action: manipulation;
}

.gbtn::before {
  content: "";
  position: absolute;
  left: -5px;
  right: -5px;
  top: -5px;
  bottom: -5px;
}

.gbtn.is-on {
  opacity: 1;
  border-color: var(--accent);
  border-width: calc(var(--u) * 0.8);
}

.gb-art {
  position: relative;
  flex: none;
  width: calc(var(--u) * 9 * var(--k, 1));
  height: calc(var(--u) * 9 * var(--k, 1));
  margin-right: calc(var(--u) * 1.4);
}

.gb-name {
  font-size: calc(var(--u) * 4.4 * var(--k, 1));
  font-weight: var(--title-weight);
  line-height: 1.1;
  color: var(--ink);
  white-space: nowrap;
}

/* ---------- 饿晕的大提示：盖在画面中间，字在底板里面换行 ---------- */
.raid-pop {
  position: absolute;
  left: 22%;
  width: 56%;
  top: 40%;
  z-index: 14;
  display: none;
  padding: calc(var(--u) * 2.4);
  background: var(--box);
  border: calc(var(--u) * 0.8) solid var(--danger);
  border-radius: calc(var(--u) * 3);
  pointer-events: none;
}

.raid-pop.is-on {
  display: block;
  animation: popin 0.3s ease-out;
}

.raid-text {
  font-size: calc(var(--u) * 3.8);
  font-weight: var(--title-weight);
  line-height: 1.4;
  text-align: center;
  color: var(--ink);
}

/* ---------- 开局倒数：盖住整个画面，数字在正中 ---------- */
.cd-pop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 15;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(8, 5, 4, 0.35);
  touch-action: none;
}

.cd-pop.is-on {
  display: flex;
}

.cd-num {
  width: calc(var(--u) * 26);
  height: calc(var(--u) * 26);
  line-height: calc(var(--u) * 26);
  text-align: center;
  font-size: calc(var(--u) * 16);
  font-weight: var(--title-weight);
  color: var(--ink);
  background: var(--box);
  border: calc(var(--u) * 0.8) solid var(--accent);
  border-radius: calc(var(--u) * 5);
}

.cd-num.is-pop {
  animation: popin 0.3s ease-out;
}

@keyframes popin {
  0% { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* 生肉吃多了：我的盘子上盖一层，写晕了，晕完才能继续吃 */
.me-dizzy {
  position: absolute;
  display: none;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
  background: rgba(20, 12, 10, 0.78);
  color: #f4e3d4;
  font-weight: var(--title-weight);
  border-radius: calc(var(--u) * 3);
  z-index: 3;
}

.me-dizzy.is-on {
  display: flex;
}

/* 英文的朋友名字一行放不下时排成两行 */
:lang(en) .pf-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  height: auto;
  padding-top: calc(var(--gap-1) * 0.5);
  padding-bottom: calc(var(--gap-1) * 0.5);
}

:lang(en) .pf-name {
  white-space: normal;
  line-height: 1.15;
  overflow-wrap: break-word;
}

/* 英文的熟度词一行太长时，在气泡里排成两行（按单词断） */
:lang(en) .t-text {
  width: min-content;
  min-width: 100%;
  white-space: normal;
  text-align: center;
}
