/* 酒桌双骰摇杯：纯前端，零模型调用。磨砂黑 + 香槟金，无彩色 emoji。 */
.dice-app {
  /* 纯黑背景；白骰黑点。不随日间主题变。 */
  --d-bg: #000; --d-bg2: #0b0b0d; --d-line: rgba(255,255,255,.10);
  --d-text: #F4F1EA; --d-muted: #C9C4BB; --d-aux: #A7A39A;
  --d-gold: #C9A45A; --d-gold-ink: #1A1408; --d-off: #3a3a40; --d-knob: #F4F1EA;
  --d-hint-bg: #121216; --d-hint-line: rgba(201,164,90,.35); --d-hint-text: #EDE9DF;
  --cardGap: 12px;
  /* 骰子随可用高度缩放（viewport − 顶栏 − 颗数 − 卡片 − 余量）。开提示：略小并上移；关提示：略大并偏下。3 颗品字形。 */
  --dieVw: 30vw; --dieMax: 152px; --dieGapK: .42; --diceShiftY: -6%;
  --topBarH: 52px; --countH: 36px; --playPad: 36px; --dieCount: 2;
  --dieRows: var(--dieCount); --dieCols: 1;
  position: relative; display: flex; flex-direction: column; width: 100%; height: 100%;
  background: var(--d-bg); color: var(--d-text);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Noto Sans SC", "Noto Sans Thai", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased; box-sizing: border-box; overflow: hidden;
}
.dice-app *, .dice-app *::before, .dice-app *::after { box-sizing: border-box; }
.dice-app button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.dice-app { -webkit-user-select: none; user-select: none; touch-action: manipulation; }
.dice-top { position: relative; z-index: 3; flex: none; height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 12px 0 4px; background: var(--d-bg); }
.dice-back { flex: none; min-height: 44px; min-width: 64px; padding: 0 12px; font-size: 14px; color: var(--d-muted); text-align: left; white-space: nowrap; }
.dice-title { margin: 0; font-size: 16px; font-weight: 700; white-space: nowrap; }
.dice-sw { flex: none; display: flex; align-items: center; gap: 8px; min-height: 44px; font-size: 12px; color: var(--d-muted); white-space: nowrap; }
.dice-sw-track { position: relative; display: inline-block; width: 34px; height: 20px; border-radius: 999px; background: var(--d-off); transition: background .15s; flex: none; }
.dice-sw-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--d-knob); transition: left .15s, background .15s; }
.dice-sw[aria-checked="true"] .dice-sw-track { background: var(--d-gold); }
.dice-sw[aria-checked="true"] .dice-sw-track::after { left: 16px; background: var(--d-gold-ink); }
/* 骰子区：flex 吃掉顶栏/卡片之外的高度；用容器查询按可用高宽算 --dieS，开关提示时平滑缩放。 */
.dice-play {
  position: relative; flex: 1; min-height: 0; width: 100%;
  display: flex; align-items: center; justify-content: center;
  z-index: 1; background: #000;
  container-type: size;
  --dieS: min(var(--dieVw), var(--dieMax), calc((100cqh - var(--playPad)) / (var(--dieRows) + max(0, var(--dieRows) - 1) * var(--dieGapK))), calc((100cqw - 32px) / (var(--dieCols) + max(0, var(--dieCols) - 1) * var(--dieGapK))));
  --dieGap: calc(var(--dieS) * var(--dieGapK));
}
.dice-app.is-pure { --dieVw: 33vw; --dieMax: 168px; --diceShiftY: 12%; --playPad: 28px; }
.dice-app[data-count="1"] { --dieCount: 1; --dieVw: 34vw; --dieMax: 168px; }
.dice-app.is-pure[data-count="1"] { --dieVw: 38vw; --dieMax: 188px; }
.dice-app[data-count="3"] { --dieCount: 3; --dieRows: 2; --dieCols: 2; --dieVw: 28vw; --dieMax: 142px; --dieGapK: .36; }
.dice-app.is-pure[data-count="3"] { --dieVw: 31vw; --dieMax: 156px; }
.dice-pair { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--dieGap); transform: translateY(var(--diceShiftY)); cursor: pointer;
  transition: gap .3s ease, transform .3s ease; }
.dice-app[data-count="3"] .dice-pair {
  display: grid;
  grid-template-columns: var(--dieS) var(--dieS);
  grid-template-rows: var(--dieS) var(--dieS);
  justify-items: center;
  align-items: center;
  gap: var(--dieGap);
  width: calc(var(--dieS) * 2 + var(--dieGap));
  height: calc(var(--dieS) * 2 + var(--dieGap));
  transition: width .3s ease, height .3s ease, gap .3s ease, transform .3s ease;
}
.dice-app[data-count="3"] .dice-die:nth-child(1) { grid-column: 1 / -1; justify-self: center; }
.dice-die { position: relative; flex: none; width: var(--dieS); height: var(--dieS); perspective: calc(var(--dieS) * 5); transition: width .3s ease, height .3s ease, perspective .3s ease; }
.dice-cube { position: absolute; left: 0; top: 0; width: var(--dieS); height: var(--dieS); transform-style: preserve-3d; will-change: transform; transition: width .3s ease, height .3s ease; }
.dice-f { position: absolute; left: 0; top: 0; width: var(--dieS); height: var(--dieS); margin: 0; padding: 0; border-radius: 17%; backface-visibility: hidden; transition: width .3s ease, height .3s ease;
  background: linear-gradient(150deg, #FFFFFF 0%, #F6F6F6 60%, #ECECEC 100%);
  box-shadow: inset 0 0 calc(var(--dieS) * .06) rgba(0,0,0,.10), inset 0 calc(var(--dieS) * -.02) calc(var(--dieS) * .03) rgba(0,0,0,.06); }
.dice-f[data-n="1"] { transform: translateZ(calc(var(--dieS) / 2)); }
.dice-f[data-n="6"] { transform: rotateY(180deg) translateZ(calc(var(--dieS) / 2)); background: linear-gradient(150deg, #F2F2F2, #E4E4E4); }
.dice-f[data-n="3"] { transform: rotateY(90deg) translateZ(calc(var(--dieS) / 2)); background: linear-gradient(150deg, #F0F0F0, #E2E2E2); }
.dice-f[data-n="4"] { transform: rotateY(-90deg) translateZ(calc(var(--dieS) / 2)); background: linear-gradient(150deg, #F4F4F4, #E6E6E6); }
.dice-f[data-n="2"] { transform: rotateX(90deg) translateZ(calc(var(--dieS) / 2)); background: linear-gradient(180deg, #FFFFFF, #F3F3F3); }
.dice-f[data-n="5"] { transform: rotateX(-90deg) translateZ(calc(var(--dieS) / 2)); background: linear-gradient(180deg, #E8E8E8, #DCDCDC); }
.dice-f i { position: absolute; display: block; width: calc(var(--dieS) * .19); height: calc(var(--dieS) * .19); margin: calc(var(--dieS) * -.095) 0 0 calc(var(--dieS) * -.095); border-radius: 50%; }
.dice-f i.p { background: #0c0c0c; box-shadow: inset 0 calc(var(--dieS) * .012) calc(var(--dieS) * .02) rgba(0,0,0,.65); }
.dice-zone {
  position: relative; z-index: 2; flex: none;
  margin: 0 12px calc(10px + env(safe-area-inset-bottom, 0px));
  max-height: 220px; min-height: 0; overflow: hidden; opacity: 1;
  transition: max-height .3s ease, opacity .25s ease, margin .3s ease;
}
.dice-app.is-pure .dice-zone {
  max-height: 0; min-height: 0; opacity: 0; margin-bottom: 0;
  pointer-events: none; visibility: hidden;
  transition: max-height .3s ease, opacity .22s ease, margin .3s ease, visibility 0s linear .3s;
}
.dice-hint { position: relative; overflow: hidden; border-radius: 14px; background: var(--d-hint-bg); border: 1px solid var(--d-hint-line); display: flex; flex-direction: column; }
.dice-hint-head { flex: none; min-height: 40px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 4px 0 14px; }
.dice-hint-lead { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.dice-hint-label { flex: none; font-size: 12px; font-weight: 600; color: var(--d-muted); letter-spacing: .02em; white-space: nowrap; }
.dice-app .dice-custom { flex: none; font-size: 13px; font-weight: 600; color: var(--d-gold); min-height: 40px; padding: 0 4px 0 0; letter-spacing: .02em; white-space: nowrap; }
.dice-hint-note { margin: 6px 0 0; font-size: 12px; line-height: 1.45; color: var(--d-aux); overflow-wrap: anywhere; }
.dice-hint-note[hidden] { display: none !important; }
.dice-hint-tools { flex: none; display: flex; align-items: center; gap: 6px; min-width: 0; }
.dice-x { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 50%; color: var(--d-text); flex: none; }
.dice-x::before { content: "×"; width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 20px; line-height: 1; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.28); padding-bottom: 2px; }
.dice-hint-body { flex: none; padding: 0 14px 12px; display: flex; flex-direction: column; }
.dice-hint-loc { margin: 0; font-size: 15px; font-weight: 500; line-height: 1.45; color: var(--d-hint-text); overflow-wrap: anywhere; }
.dice-hint-zh { margin: 4px 0 0; font-size: 20px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.dice-app .dice-script { flex: none; display: flex; align-items: stretch; height: 22px; border: 1px solid rgba(201,164,90,.45); border-radius: 999px; overflow: hidden; }
.dice-app .dice-script button { min-width: 24px; padding: 0 6px; font-size: 11px; font-weight: 600; line-height: 20px; color: var(--d-aux); }
.dice-app .dice-script button.is-on { background: var(--d-gold); color: var(--d-gold-ink); }
.dice-hint-en { margin: 4px 0 0; font-size: 14px; font-weight: 400; line-height: 1.4; color: var(--d-hint-text); overflow-wrap: anywhere; }
.dice-app .dice-lang { flex: none; display: flex; align-items: center; min-height: 26px; padding: 0 8px; border-radius: 999px; border: 1px solid rgba(201,164,90,.45); color: var(--d-gold); font-size: 11px; font-weight: 600; letter-spacing: .02em; white-space: nowrap; }
.dice-lang::after { content: " ▾"; font-size: 9px; }
.dice-hint.is-pulse { animation: dice-pulse .7s ease-out 1; }
@keyframes dice-pulse { 0% { border-color: var(--d-hint-line); box-shadow: 0 0 0 0 rgba(201,164,90,0); } 30% { border-color: rgba(201,164,90,.8); box-shadow: 0 0 14px 1px rgba(201,164,90,.22); } 100% { border-color: var(--d-hint-line); box-shadow: 0 0 0 0 rgba(201,164,90,0); } }
.dice-hint.is-pass .dice-hint-zh { color: var(--d-muted); }
.dice-hint.is-idle .dice-hint-zh { color: var(--d-hint-text); font-weight: 600; }
.dice-hint.is-idle .dice-hint-en, .dice-hint.is-idle .dice-hint-loc { color: var(--d-aux); }
.dice-hint.is-busy .dice-hint-loc, .dice-hint.is-busy .dice-hint-en { display: none; }
.dice-hint.is-busy .dice-hint-zh { margin-top: 0; font-size: 16px; color: var(--d-muted); font-weight: 600; }
/* Local-line fonts: Thai / Lao / JP / KR / Viet / Latin fallbacks (system or Noto). */
.dice-loc-th { font-family: "Sarabun", "Kanit", "Noto Sans Thai", "Thonburi", "Leelawadee UI", sans-serif; }
.dice-loc-lo { font-family: "Noto Sans Lao", "Lao Sangam MN", "Phetsarath OT", "Phetsarath", sans-serif; }
.dice-loc-ja { font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "YuGothic", "Noto Sans JP", "Noto Sans CJK JP", sans-serif; }
.dice-loc-ko { font-family: "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", "Noto Sans CJK KR", sans-serif; }
.dice-loc-vi { font-family: "Be Vietnam Pro", "Noto Sans", "SF Pro Text", ui-sans-serif, system-ui, sans-serif; }
.dice-loc-tl, .dice-loc-id { font-family: "Noto Sans", "SF Pro Text", ui-sans-serif, system-ui, sans-serif; }
/* 站内入口：全屏层，沿用 .sheet 的返回/历史处理 */
.sheet.dice-sheet { background: #000; padding: 0; justify-content: flex-start; align-items: stretch; z-index: 30; }
.sheet.dice-sheet::before, .sheet.dice-sheet::after { display: none; }
.dice-standalone { height: var(--vvh, 100dvh); max-width: 520px; margin: 0 auto; }

/* ---- custom-rule editor ---- */
.dice-ed { position: absolute; inset: 0; z-index: 10; background: #000; display: flex; flex-direction: column; color: var(--d-text); }
.dice-ed[hidden], .dice-langs[hidden], .dice-mask[hidden], .dice-toast[hidden] { display: none !important; }
.dice-ed-top { flex: none; position: relative; height: 52px; display: flex; align-items: center; justify-content: space-between; padding: 0 12px 0 4px; background: #000; border-bottom: 1px solid var(--d-line); }
.dice-ed-top .dice-title { position: absolute; left: 0; right: 0; text-align: center; pointer-events: none; }
.dice-ed-top .dice-ed-side { width: 80px; flex: none; }
.dice-ed-note { flex: none; padding: 10px 16px 12px; font-size: 12px; line-height: 1.55; color: var(--d-aux); border-bottom: 1px solid var(--d-line); background: #000; }
.dice-ed-note b { color: var(--d-muted); font-weight: 600; }
.dice-ed-list { flex: 1; min-height: 0; overflow: auto; -webkit-overflow-scrolling: touch; background: #000; }
.dice-ed-row { display: flex; align-items: center; gap: 12px; width: 100%; height: 51px; padding: 0 16px; border-bottom: 1px solid rgba(255,255,255,.06); text-align: left; color: inherit; }
.dice-ed-num { flex: none; min-width: 52px; font-size: 15px; font-weight: 700; }
.dice-ed-rule { flex: 1; min-width: 0; font-size: 15px; color: var(--d-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dice-ed-tag { flex: none; font-size: 11px; font-weight: 600; color: var(--d-gold); letter-spacing: .04em; }
.dice-ed-chev { flex: none; color: rgba(255,255,255,.28); font-size: 18px; line-height: 1; padding-left: 4px; }
.dice-ed-row.is-custom .dice-ed-rule { color: var(--d-text); }
.dice-ed-row.is-active { background: rgba(201,164,90,.08); box-shadow: inset 2px 0 0 var(--d-gold); }
.dice-ed-foot { flex: none; height: 64px; display: flex; align-items: center; justify-content: center; border-top: 1px solid var(--d-line); background: #000; padding-bottom: env(safe-area-inset-bottom, 0px); }
.dice-app .dice-ed-ghost { min-height: 44px; padding: 0 18px; font-size: 14px; color: var(--d-muted); border: 1px solid rgba(255,255,255,.18); border-radius: 999px; }
.dice-ed-body { flex: 1; min-height: 0; overflow: auto; padding: 18px 16px 12px; background: #000; }
.dice-ed-lab { font-size: 12px; color: var(--d-aux); letter-spacing: .06em; margin-bottom: 8px; display: flex; align-items: center; justify-content: space-between; }
.dice-ed-lab .dice-ed-hint { font-size: 11px; letter-spacing: 0; }
.dice-ed-field { width: 100%; min-height: 72px; border-radius: 12px; background: #1A1A1F; border: 1px solid rgba(201,164,90,.45); padding: 12px 14px; font: inherit; font-size: 18px; font-weight: 600; line-height: 1.4; color: var(--d-text); resize: none; outline: none; -webkit-user-select: text; user-select: text; }
.dice-ed-field.ro { border-color: var(--d-line); font-weight: 500; font-size: 16px; color: var(--d-hint-text); min-height: 56px; display: flex; align-items: center; }
.dice-ed-field.is-th { font-size: 17px; }
.dice-ed-block { margin-top: 18px; }
.dice-ed-field.is-fail { border-color: rgba(201,164,90,.45); }
.dice-spin-row { display: flex; align-items: center; gap: 10px; color: var(--d-aux); font-size: 14px; }
.dice-spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(201,164,90,.25); border-top-color: var(--d-gold); animation: dice-spin .8s linear infinite; flex: none; }
@keyframes dice-spin { to { transform: rotate(360deg); } }
.dice-ed-warn { margin-top: 14px; padding: 10px 12px; border-radius: 10px; background: rgba(201,164,90,.10); border: 1px solid rgba(201,164,90,.35); font-size: 13px; line-height: 1.55; color: var(--d-muted); }
.dice-ed-warn b { color: var(--d-gold); font-weight: 600; }
.dice-app .dice-ed-retry { color: var(--d-gold); font-weight: 600; background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }
.dice-ed-actions { flex: none; height: 88px; padding: 12px 16px calc(20px + env(safe-area-inset-bottom, 0px)); display: flex; align-items: center; gap: 10px; background: #000; border-top: 1px solid var(--d-line); }
.dice-btn { flex: 1; height: 48px; border-radius: 999px; display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 600; }
.dice-app .dice-btn-ghost { color: var(--d-muted); border: 1px solid rgba(255,255,255,.18); background: transparent; }
.dice-app .dice-btn-gold { color: var(--d-gold-ink); background: var(--d-gold); border: 1px solid var(--d-gold); }
.dice-app .dice-btn-gold:disabled, .dice-app .dice-btn-gold.is-wait { opacity: .45; pointer-events: none; }

/* language picker: compact bottom sheet, fits 360px */
.dice-langs { position: absolute; left: 0; right: 0; bottom: 0; z-index: 16; max-height: min(380px, calc(100dvh - 52px)); overflow: auto; background: #121216; border-top: 1px solid var(--d-hint-line); border-radius: 16px 16px 0 0; padding: 4px 8px calc(8px + env(safe-area-inset-bottom, 0px)); }
.dice-langs-h { text-align: center; font-size: 12px; font-weight: 600; color: var(--d-muted); padding: 6px 8px 4px; }
.dice-langs button { display: flex; align-items: center; justify-content: space-between; width: 100%; height: 40px; padding: 0 14px; border-radius: 10px; font-size: 15px; text-align: left; color: var(--d-text); }
.dice-langs button.is-on { color: var(--d-gold); background: rgba(201,164,90,.10); }
.dice-langs button.is-on::after { content: "✓"; font-size: 15px; }

/* reset confirm */
.dice-mask { position: absolute; inset: 0; z-index: 20; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; padding: 24px; }
.dice-dialog { width: 100%; max-width: 320px; background: #16161a; border: 1px solid rgba(201,164,90,.35); border-radius: 16px; padding: 22px 18px 16px; }
.dice-dialog p { margin: 0; font-size: 15px; line-height: 1.55; text-align: center; color: var(--d-text); }
.dice-dialog-row { display: flex; gap: 10px; margin-top: 18px; }

/* 1–3 dice stepper */
.dice-count { position: relative; z-index: 3; flex: none; height: var(--countH); display: flex; align-items: center; justify-content: center; gap: 16px; background: #000; }
.dice-app .dice-count-btn { width: 32px; height: 32px; border-radius: 50%; border: 1px solid rgba(255,255,255,.20); color: var(--d-text); font-size: 18px; line-height: 1; display: flex; align-items: center; justify-content: center; }
.dice-app .dice-count-btn:disabled { opacity: .32; }
.dice-count-n { min-width: 44px; text-align: center; font-size: 14px; font-weight: 600; color: var(--d-text); letter-spacing: .04em; }
.dice-app .dice-share {
  position: absolute; right: 0; top: 50%; transform: translateY(-50%);
  width: auto; min-width: 36px; height: 36px; padding: 0 4px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  color: var(--d-gold); opacity: .92;
  font-size: 10px; font-weight: 600; line-height: 1; letter-spacing: 0; white-space: nowrap;
}
.dice-app .dice-share svg { display: block; width: 15px; height: 15px; flex: none; }
.dice-toast { position: absolute; left: 50%; top: calc(var(--topBarH) + var(--countH) + 10px); transform: translateX(-50%); z-index: 15; width: max-content; max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 12px; background: #1a1a1e; border: 1px solid rgba(201,164,90,.45); color: var(--d-hint-text); font-size: 14px; font-weight: 500; line-height: 1.45; text-align: center; white-space: normal; pointer-events: none; box-shadow: 0 8px 24px rgba(0,0,0,.45); }
.dice-toast[hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  .dice-die, .dice-cube, .dice-f, .dice-pair,
  .dice-zone, .dice-app.is-pure .dice-zone { transition: none; }
}

/* 界面语言小开关：中 / EN / ไทย，放在颗数栏左边，不抢眼 */
.dice-ui { position: absolute; left: 8px; top: 50%; transform: translateY(-50%); display: flex; align-items: stretch; height: 24px; border: 1px solid rgba(255,255,255,.14); border-radius: 999px; overflow: hidden; }
.dice-app .dice-ui button { min-width: 24px; padding: 0 6px; font-size: 11px; font-weight: 600; line-height: 22px; color: var(--d-aux); white-space: nowrap; }
.dice-app .dice-ui button.is-on { background: rgba(201,164,90,.18); color: var(--d-gold); }

/* ---- 5 颗吹牛模式：2-1-2（像骰子 5 点），不显示规则卡 ---- */
.dice-app[data-count="5"], .dice-app.is-pure[data-count="5"] { --dieCount: 5; --dieRows: 3; --dieCols: 3; --dieGapK: .2; --dieVw: 23vw; --dieMax: 108px; --diceShiftY: 0%; --playPad: 44px; }
.dice-app[data-count="5"] .dice-pair {
  display: grid; position: relative;
  grid-template-columns: repeat(3, var(--dieS)); grid-template-rows: repeat(3, var(--dieS));
  justify-items: center; align-items: center; gap: var(--dieGap);
  width: calc(var(--dieS) * 3 + var(--dieGap) * 2); height: calc(var(--dieS) * 3 + var(--dieGap) * 2);
  transition: width .3s ease, height .3s ease, gap .3s ease;
}
.dice-app[data-count="5"] .dice-die:nth-child(1) { grid-column: 1; grid-row: 1; }
.dice-app[data-count="5"] .dice-die:nth-child(2) { grid-column: 3; grid-row: 1; }
.dice-app[data-count="5"] .dice-die:nth-child(3) { grid-column: 2; grid-row: 2; }
.dice-app[data-count="5"] .dice-die:nth-child(4) { grid-column: 1; grid-row: 3; }
.dice-app[data-count="5"] .dice-die:nth-child(5) { grid-column: 3; grid-row: 3; }
.dice-app[data-count="5"] .dice-zone { display: none; }
.dice-app[data-count="5"] .dice-tips { display: none; }
.dice-pair { position: relative; }

/* 点数规则开关（1–3 颗），放在分享左边；文案短，避免在 360 宽上碰到颗数按钮 */
.dice-app .dice-tips { position: absolute; right: 42px; top: 50%; transform: translateY(-50%); height: 22px; min-width: 0; padding: 0 8px; border-radius: 999px; border: 1px solid rgba(255,255,255,.16); font-size: 11px; font-weight: 600; letter-spacing: 0; color: var(--d-aux); white-space: nowrap; }
.dice-app .dice-tips.is-on { color: var(--d-gold); border-color: rgba(201,164,90,.55); }

/* 开局提示（仅 5 颗） */
.dice-tap { position: absolute; left: 16px; right: 16px; top: 6px; margin: 0; text-align: center; font-size: 12px; line-height: 1.4; color: var(--d-aux); pointer-events: none; z-index: 2; }
.dice-tap[hidden] { display: none; }
.dice-app:not([data-count="5"]) .dice-tap, .dice-app:not([data-count="5"]) .dice-help { display: none; }

/* 「? 玩法」小图标：左下，不常驻大卡 */
.dice-app .dice-help { position: absolute; left: 10px; bottom: 8px; z-index: 4; height: 28px; padding: 0 10px 0 6px; border-radius: 999px; display: flex; align-items: center; gap: 5px; border: 1px solid rgba(201,164,90,.4); background: rgba(14,14,16,.7); color: var(--d-gold); font-size: 12px; font-weight: 600; white-space: nowrap; }
.dice-help b { width: 18px; height: 18px; border-radius: 50%; border: 1px solid rgba(201,164,90,.7); display: flex; align-items: center; justify-content: center; font-size: 11px; line-height: 1; }

/* 小喇叭：右下角，和左下「玩法」错开，不挡住顶栏分享和底栏按钮 */
.dice-app .dice-sound {
  position: absolute; right: 10px; bottom: 8px; z-index: 4;
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(201,164,90,.4); background: rgba(14,14,16,.7); color: var(--d-gold);
}
.dice-app .dice-sound svg { display: none; width: 18px; height: 18px; }
.dice-app .dice-sound:not(.is-off) .dice-sound-on { display: block; }
.dice-app .dice-sound.is-off .dice-sound-off { display: block; }
.dice-app .dice-sound.is-off { opacity: .55; color: var(--d-aux); border-color: rgba(255,255,255,.22); }
.dice-app .dice-sound:not(:disabled):active { background: rgba(201,164,90,.22); }

/* ---- 骰盅：黑金暗色磨砂 + 金色描边，只动 transform/opacity ---- */
.dice-cup {
  position: absolute; z-index: 5;
  left: calc(var(--dieS) * -.25); right: calc(var(--dieS) * -.25); top: calc(var(--dieS) * -.25); bottom: calc(var(--dieS) * -.2);
  border-radius: 16% 16% 12% 12% / 11% 11% 8% 8%;
  background: radial-gradient(120% 90% at 50% 8%, #2a2a30 0%, #17171b 46%, #0b0b0d 100%);
  border: 1.5px solid rgba(201,164,90,.75);
  box-shadow: 0 10px 26px rgba(0,0,0,.65), inset 0 0 0 1px rgba(255,255,255,.04), inset 0 -10px 22px rgba(0,0,0,.55);
  transform: translateY(-135%); opacity: 0; pointer-events: none; will-change: transform;
  transition: transform .26s cubic-bezier(.2,.8,.25,1), opacity .2s ease;
  touch-action: none; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none;
}
.dice-cup-rim { position: absolute; left: 12%; right: 12%; bottom: 7%; height: 2px; border-radius: 2px; background: linear-gradient(90deg, transparent, rgba(201,164,90,.8), transparent); }
.dice-cup::before { content: ""; position: absolute; left: 50%; top: 9%; width: 16%; aspect-ratio: 1; transform: translateX(-50%); border-radius: 50%; border: 1.5px solid rgba(201,164,90,.55); }
.dice-app[data-cup="down"] .dice-cup { transform: translateY(0); opacity: 1; pointer-events: auto; cursor: grab; }
.dice-app[data-cup="peek"] .dice-cup { transform: translateY(-98%) rotate(-5deg); opacity: .96; pointer-events: none; transition-duration: .12s; }
/* 骰子在盅里：摇的是整组（骰子+盅），盖严时骰子先藏起来，只有开盖/偷看才露出来。 */
.dice-app[data-cup="down"] .dice-die,
.dice-app[data-cup="shake"] .dice-die { visibility: hidden; }
.dice-app[data-cup="shake"] .dice-cup { opacity: 1; pointer-events: none; transform: translateY(0); }
.dice-app[data-cup="shake"] .dice-pair {
  transition: none;
  animation: dice-cup-drop .18s ease-out 1 both, dice-cup-shake 1.5s linear .18s infinite;
}
.dice-app[data-cup="shake"][data-again="1"] .dice-pair { animation: dice-cup-shake 1.5s linear infinite; }
@keyframes dice-cup-drop {
  0% { transform: translateY(calc(var(--diceShiftY) - 120%)) scale(.88); }
  100% { transform: translateY(var(--diceShiftY)) scale(.88); }
}
/* 1.5 秒一轮：左右甩 + 上下颠。先缩小再摇，360–465 宽保持在屏内。 */
@keyframes dice-cup-shake {
  0% { transform: translateY(var(--diceShiftY)) translate(0, 0) rotate(0deg) scale(.88); }
  12% { transform: translateY(var(--diceShiftY)) translate(12px, -22px) rotate(5deg) scale(.9); }
  25% { transform: translateY(var(--diceShiftY)) translate(6px, 10px) rotate(2deg) scale(.88); }
  38% { transform: translateY(var(--diceShiftY)) translate(-12px, -24px) rotate(-5deg) scale(.91); }
  50% { transform: translateY(var(--diceShiftY)) translate(-5px, 8px) rotate(-2deg) scale(.88); }
  62% { transform: translateY(var(--diceShiftY)) translate(12px, -18px) rotate(5deg) scale(.9); }
  75% { transform: translateY(var(--diceShiftY)) translate(5px, 12px) rotate(2deg) scale(.88); }
  88% { transform: translateY(var(--diceShiftY)) translate(-11px, -20px) rotate(-5deg) scale(.9); }
  100% { transform: translateY(var(--diceShiftY)) translate(0, 0) rotate(0deg) scale(.88); }
}
.dice-app[data-cup="off"] .dice-cup { display: none; }
.dice-app[data-cup="up"] .dice-cup { display: block; }

/* 底部两个按钮：按住偷看 / 开盖（不可选中、不弹长按菜单） */
.dice-cupbar { position: relative; z-index: 3; flex: none; display: none; gap: 8px; padding: 8px 10px calc(12px + env(safe-area-inset-bottom, 0px)); background: #000;
  -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; touch-action: none; }
.dice-app.has-cup .dice-cupbar { display: flex; }
.dice-app.has-cup:not([data-count="5"]) .dice-cupbar { padding-bottom: 6px; }
.dice-app .dice-cupbtn { flex: 1 1 0; min-width: 0; min-height: 46px; padding: 0 6px; border-radius: 14px; border: 1px solid rgba(255,255,255,.2); color: var(--d-text); font-size: 14px; font-weight: 600; line-height: 1.2;
  -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; touch-action: none; transition: opacity .15s, background .15s; }
.dice-app .dice-cupbtn-gold { background: var(--d-gold); border-color: var(--d-gold); color: var(--d-gold-ink); }
.dice-app .dice-cupbtn:disabled { opacity: .34; }
.dice-app .dice-cupbtn:not(:disabled):active { background: rgba(201,164,90,.22); }
.dice-app .dice-cupbtn-gold:not(:disabled):active { background: #b8934a; }
.dice-app.has-cup .dice-zone { margin-top: 0; }

/* ---- 吹牛玩法卡：半屏黑金磨砂 ---- */
.dice-rules { position: absolute; inset: 0; z-index: 12; display: flex; align-items: flex-end; background: rgba(0,0,0,.45); }
.dice-rules[hidden] { display: none !important; }
.dice-rules-card { width: 100%; max-height: 62%; display: flex; flex-direction: column; border-radius: 20px 20px 0 0; border: 1px solid rgba(201,164,90,.45); border-bottom: 0;
  background: rgba(16,16,19,.94); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: 0 -12px 34px rgba(0,0,0,.6); padding-bottom: env(safe-area-inset-bottom, 0px); }
.dice-rules-head { flex: none; display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 14px 14px 8px 16px; }
.dice-rules-head h3 { margin: 4px 0 0; min-width: 0; font-size: 15px; font-weight: 700; line-height: 1.35; color: var(--d-text); overflow-wrap: anywhere; }
.dice-rules-sw { flex: none; display: flex; height: 26px; border: 1px solid rgba(201,164,90,.5); border-radius: 999px; overflow: hidden; }
.dice-app .dice-rules-sw button { min-width: 34px; padding: 0 9px; font-size: 12px; font-weight: 600; line-height: 24px; color: var(--d-aux); white-space: nowrap; }
.dice-app .dice-rules-sw button.is-on { background: var(--d-gold); color: var(--d-gold-ink); }
.dice-rules-body { flex: 1; min-height: 0; overflow: auto; -webkit-overflow-scrolling: touch; padding: 4px 16px 16px; user-select: text; -webkit-user-select: text; }
.dice-rule { display: flex; gap: 10px; padding: 9px 0; border-top: 1px solid rgba(255,255,255,.07); }
.dice-rule:first-child { border-top: 0; }
.dice-rule-n { flex: none; width: 20px; height: 20px; margin-top: 1px; border-radius: 50%; border: 1px solid rgba(201,164,90,.6); color: var(--d-gold); font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.dice-rule > div { min-width: 0; flex: 1; }
.dice-rule-h { font-size: 14px; font-weight: 700; color: var(--d-gold); line-height: 1.4; }
.dice-rule-b { margin: 2px 0 0; font-size: 14px; line-height: 1.55; color: var(--d-text); overflow-wrap: anywhere; }
.dice-rule-s { margin: 3px 0 0; font-size: 11.5px; line-height: 1.5; color: var(--d-aux); overflow-wrap: anywhere; }
@media (prefers-reduced-motion: reduce) { .dice-cup { transition: none; } .dice-app[data-cup="shake"] .dice-cup { animation: none; transform: translateY(0); opacity: 1; } .dice-app[data-cup="shake"] .dice-pair { animation: none; transform: translateY(var(--diceShiftY)); } }
