/* Quad Splash · 水滴四溅 —— 主题样式 */

:root {
  --ink: #eaf7ff;
  --ink-dim: rgba(234, 247, 255, 0.62);
  --line: rgba(255, 255, 255, 0.16);
  --glass: rgba(255, 255, 255, 0.08);
  --glass-strong: rgba(255, 255, 255, 0.14);
  --aqua: #4fd8ff;
  --aqua-deep: #1b9ee0;
  --gold: #ffd76a;
  --radius-l: 22px;
  --radius-m: 14px;
  --shadow: 0 18px 40px rgba(2, 18, 35, 0.45);
  --board-max: 520px;   /* 棋盘最大宽度：上方状态面板跟它同宽 */
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: linear-gradient(170deg, #05243f 0%, #063a5e 45%, #075b7a 100%);
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* ---------- 背景水波 ---------- */

.ocean {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.ocean::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(900px 520px at 15% -10%, rgba(79, 216, 255, 0.22), transparent 60%),
    radial-gradient(700px 460px at 100% 10%, rgba(2, 136, 209, 0.28), transparent 62%);
}

.wave {
  position: absolute;
  left: -50%;
  width: 200%;
  border-radius: 45% 45% 48% 48%;
  background: rgba(255, 255, 255, 0.045);
  animation: drift linear infinite;
}

.wave-1 { height: 62vh; bottom: -32vh; animation-duration: 22s; }
.wave-2 { height: 54vh; bottom: -26vh; background: rgba(255, 255, 255, 0.03); animation-duration: 31s; animation-direction: reverse; }
.wave-3 { height: 46vh; bottom: -22vh; background: rgba(79, 216, 255, 0.05); animation-duration: 40s; }

@keyframes drift {
  0%   { transform: translateX(-6%) rotate(0deg); }
  50%  { transform: translateX(6%) rotate(1.2deg); }
  100% { transform: translateX(-6%) rotate(0deg); }
}

.bubble {
  position: absolute;
  bottom: -12vh;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0.06) 62%, transparent 70%);
  animation: rise linear infinite;
}

.b1 { left: 12%; width: 14px; height: 14px; animation-duration: 15s; }
.b2 { left: 34%; width: 9px;  height: 9px;  animation-duration: 19s; animation-delay: 3s; }
.b3 { left: 58%; width: 18px; height: 18px; animation-duration: 23s; animation-delay: 1.5s; }
.b4 { left: 76%; width: 10px; height: 10px; animation-duration: 17s; animation-delay: 6s; }
.b5 { left: 90%; width: 6px;  height: 6px;  animation-duration: 13s; animation-delay: 8s; }

@keyframes rise {
  0%   { transform: translate3d(0, 0, 0) scale(0.7); opacity: 0; }
  12%  { opacity: 0.75; }
  100% { transform: translate3d(24px, -120vh, 0) scale(1.15); opacity: 0; }
}

/* ---------- 布局 ---------- */

.app {
  position: relative;
  z-index: 1;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: max(14px, env(safe-area-inset-top)) 14px;
  /* 底部额外留出固定底栏的高度（--foot-h 由 JS 实测），否则底栏会压住棋盘 */
  padding-bottom: calc(var(--foot-h, 30px) + max(14px, env(safe-area-inset-bottom)));
  max-width: 640px;
  margin: 0 auto;
}

/* ---------- 顶栏 ---------- */

.topbar {
  width: 100%;
  max-width: var(--board-max);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #04243d;
  background: linear-gradient(150deg, #b6f0ff, #48c8f5 55%, #1b9ee0);
  box-shadow: 0 8px 22px rgba(43, 168, 226, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 19px; letter-spacing: 0.5px; }
.brand-text small { font-size: 12px; color: var(--ink-dim); letter-spacing: 3px; }

.stats { display: flex; align-items: center; gap: 8px; }

.stat {
  min-width: 54px;
  padding: 6px 10px;
  border-radius: 12px;
  text-align: center;
  background: var(--glass);
  border: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

.stat span { display: block; font-size: 10px; color: var(--ink-dim); letter-spacing: 1px; }
.stat b { font-size: 16px; font-variant-numeric: tabular-nums; }

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--glass);
  color: var(--ink);
  font-size: 17px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: transform .15s ease, background .15s ease;
}

/* 语言下拉：和右边的音效按钮同一套观感，窄屏只压宽度不挤掉其它元素 */
.lang-select {
  height: 40px;
  max-width: 124px;
  padding: 0 8px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--glass);
  color: var(--ink);
  font-family: inherit;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  text-align: center;
  text-overflow: ellipsis;
  backdrop-filter: blur(8px);
  transition: background .15s ease;
}

.lang-select:hover { background: var(--glass-strong); }
.lang-select:focus-visible { outline: 2px solid rgba(140, 230, 255, 0.75); outline-offset: 2px; }

/* 下拉展开后由系统绘制：给深色文字，免得白字白底看不清 */
.lang-select option { color: #04243d; background: #eaf7ff; }

.icon-btn:hover { background: var(--glass-strong); }
.icon-btn:active { transform: scale(0.94); }
.ico-sound.off { opacity: .35; text-decoration: line-through; }

/* ---------- 状态面板：左侧信息 + 右侧玻璃罐 ---------- */

.drop-panel {
  width: 100%;
  max-width: var(--board-max);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 14px;
  border-radius: var(--radius-l);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.05));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

/* 三行固定高度：文案长短不影响面板高度（避免点击时忽高忽低） */
.info {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* 第一行：盘数 */
.info-meta {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  letter-spacing: 1px;
  white-space: nowrap;
  color: var(--ink-dim);
}

.info-meta b {
  font-size: 17px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* 盘数：用小背景格包起来，一眼能看到当前是第几盘 */
.round-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 11px;
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--ink-dim);
  background: linear-gradient(150deg, rgba(79, 216, 255, 0.30), rgba(79, 216, 255, 0.09));
  border: 1px solid rgba(140, 230, 255, 0.45);
  box-shadow: 0 4px 12px rgba(3, 30, 54, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.round-chip b {
  font-size: 17px;
  line-height: 1;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 12px rgba(79, 216, 255, 0.7), 0 1px 2px rgba(2, 26, 46, 0.6);
}

/* 第二行：已清空 x 盘 + 得分 */
.info-score {
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 12px;
  line-height: 1.5;
  white-space: nowrap;
  color: var(--ink-dim);
}

.info-score > b {
  font-size: 15px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.score-tail {
  padding-left: 10px;
  border-left: 1px solid var(--line);
}

.score-tail b {
  display: inline-block;
  font-size: 18px;
  color: var(--aqua);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 12px rgba(79, 216, 255, 0.38);
}

/* 得分变化时跳一下 */
.info-score.bump .score-tail b { animation: scoreBump .45s cubic-bezier(.34, 1.56, .64, 1); }

@keyframes scoreBump {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.16); }
  100% { transform: scale(1); }
}

/* 第三行：工作状态描述，固定两行 */
.info-tip {
  margin: 0;
  font-size: 12px;
  line-height: 1.6;
  height: 3.2em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: rgba(234, 247, 255, 0.78);
}

.info-tip b { color: var(--aqua); }

/* 拿到回收奖励时提示条闪一下（去掉 animation 后回到常态样式） */
.info-tip.flash { animation: tipFlash .7s ease-out 2; }

@keyframes tipFlash {
  0%   { color: var(--aqua); text-shadow: 0 0 14px rgba(79, 216, 255, 0.55); }
  100% { color: rgba(234, 247, 255, 0.78); text-shadow: none; }
}

/* 球形玻璃罐：内部蓝色水按剩余比例填充 */
.jar {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

/* 标签与罐子同宽并居中，字号放大后也不会撑宽这一列 */
.jar-label {
  width: 92px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--aqua);
  text-shadow: 0 0 10px rgba(79, 216, 255, 0.5), 0 1px 2px rgba(2, 26, 46, 0.7);
}

.jar-ball {
  position: relative;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  overflow: hidden;
  border: 1.5px solid rgba(255, 255, 255, 0.34);
  background:
    radial-gradient(circle at 30% 24%, rgba(255, 255, 255, 0.26), rgba(255, 255, 255, 0.05) 46%, rgba(255, 255, 255, 0) 64%),
    linear-gradient(165deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.02));
  box-shadow:
    inset 0 6px 14px rgba(255, 255, 255, 0.16),
    inset 0 -12px 20px rgba(3, 26, 46, 0.38),
    0 10px 22px rgba(2, 20, 38, 0.45);
}

.jar-water {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 100%;
  background: linear-gradient(180deg, #8ceaff 0%, #45c2f2 45%, #1a80c8 100%);
  transition: height .5s cubic-bezier(.33, 1, .68, 1);
}

/* 水面：两条细亮波浪线，横向流动 */
.jar-wave {
  position: absolute;
  left: 0;
  top: -12px;
  width: 200%;
  height: 24px;
  overflow: visible;
  pointer-events: none;
}

.jar-wave path {
  fill: none;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.jar-wave .w-front {
  stroke: #f4ffff;
  stroke-width: 2.4;
  filter: drop-shadow(0 0 6px rgba(150, 235, 255, 0.95));
  animation: waveFlow 2.6s linear infinite;
}

.jar-wave .w-back {
  stroke: rgba(186, 240, 255, 0.55);
  stroke-width: 1.6;
  animation: waveFlow 3.9s linear infinite reverse;
}

@keyframes waveFlow {
  from { transform: translateX(0); }
  to   { transform: translateX(-50px); }
}

/* 增减水滴时晃一下 */
.jar-water.slosh { animation: waterSlosh .7s ease; }

@keyframes waterSlosh {
  0%   { transform: translateY(0); }
  30%  { transform: translateY(3px); }
  60%  { transform: translateY(-2px); }
  100% { transform: translateY(0); }
}

/* 罐身玻璃反光（压在水面之上） */
.jar-gloss {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
  background:
    radial-gradient(circle at 26% 20%, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0) 26%),
    radial-gradient(circle at 74% 78%, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0) 22%);
}

/* 剩余水滴数值：放进罐子正中 */
.jar-value {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}

.jar-value b {
  font-size: 25px;
  line-height: 1;
  color: #ffffff;
  text-shadow: 0 2px 6px rgba(2, 26, 46, 0.9), 0 0 16px rgba(79, 216, 255, 0.55);
}

.jar-value i {
  font-style: normal;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.75);
  text-shadow: 0 1px 4px rgba(2, 26, 46, 0.85);
}

/* 告急配色：低于 6 滴转黄，低于 3 滴转红（数字跟着跳一下） */
.jar-value.warn b {
  color: #ffd76a;
  text-shadow: 0 2px 6px rgba(2, 26, 46, 0.9), 0 0 18px rgba(255, 190, 70, 0.85);
}

.jar-value.danger b {
  color: #ff6b6b;
  text-shadow: 0 2px 6px rgba(2, 26, 46, 0.9), 0 0 18px rgba(255, 90, 90, 0.9);
  animation: dropsPulse .9s ease-in-out infinite;
}

.jar-value.warn i { color: rgba(255, 215, 106, 0.9); }
.jar-value.danger i { color: rgba(255, 140, 140, 0.92); }

@keyframes dropsPulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.12); }
}

/* 告急：罐子呼吸发光 */
.jar-ball.low { animation: jarLow 1.6s ease-in-out infinite; }

@keyframes jarLow {
  0%, 100% {
    box-shadow: inset 0 6px 14px rgba(255, 255, 255, 0.16),
                inset 0 -12px 20px rgba(3, 26, 46, 0.38),
                0 10px 22px rgba(2, 20, 38, 0.45);
  }
  50% {
    box-shadow: inset 0 6px 14px rgba(255, 255, 255, 0.16),
                inset 0 -12px 20px rgba(3, 26, 46, 0.38),
                0 10px 26px rgba(255, 150, 90, 0.6);
  }
}

/* 倒水：跟着飞出去的那滴水，罐子朝落点方向倾一下再回弹。
 * 排在 .low 之后，告急时也能正常播，播完由 JS 摘掉 class 让 .low 继续 */
.jar-ball.pour { animation: jarPour .34s ease-out; }

@keyframes jarPour {
  0%   { transform: translateY(0) rotate(0deg) scale(1); }
  32%  { transform: translateY(-3px) rotate(-7deg) scale(1.05); }
  70%  { transform: translateY(1px) rotate(3deg) scale(0.985); }
  100% { transform: translateY(0) rotate(0deg) scale(1); }
}

/* ---------- 从罐子飞向棋盘的水滴 ---------- */

/* 盖在界面之上、弹窗之下（overlay z-index 20） */
.fly-layer {
  position: fixed;
  inset: 0;
  z-index: 15;
  pointer-events: none;
  overflow: hidden;
}

.fly-drop {
  position: absolute;
  left: 0;
  top: 0;
  width: 13px;
  height: 13px;
  margin: -6.5px 0 0 -6.5px;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #ffffff, #c3f2ff 42%, #4fc6f5 100%);
  box-shadow: 0 0 10px rgba(150, 230, 255, 0.9), 0 0 22px rgba(79, 198, 245, 0.45);
  will-change: transform;
}

/* 拖尾：父元素已按速度方向旋转，尾巴固定在身后即可 */
.fly-drop::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 26px;
  height: 5px;
  margin: -2.5px 0 0 -26px;
  border-radius: 3px;
  background: linear-gradient(90deg, rgba(190, 240, 255, 0), rgba(214, 246, 255, 0.85));
}

/* ---------- 奖励提示：触发格子上的 +N 徽章 ---------- */

/* 铺满棋盘面板（含内边距），奖励徽章按格子中心定位在这一层里 */
.board-fx {
  position: absolute;
  inset: 0;
  z-index: 2;
  overflow: hidden;
  pointer-events: none;
  border-radius: inherit;
}

.cell-badge {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 5px 12px 6px;
  border-radius: 14px;
  white-space: nowrap;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(198, 242, 255, 0.94));
  border: 1px solid rgba(255, 255, 255, 0.92);
  box-shadow: 0 6px 18px rgba(2, 20, 38, 0.5), 0 0 26px rgba(120, 225, 255, 0.8);
  animation: badgePop .98s cubic-bezier(.2, 1.2, .35, 1) forwards;
}

.cell-badge b {
  font-size: 22px;
  line-height: 1;
  color: #04587f;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.9);
}

.cell-badge span {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .3px;
  color: #04678f;
}

/* 清盘奖励是金色的，和回收（蓝色）一眼分得开 */
.cell-badge.clear {
  background: linear-gradient(180deg, #fff8de, #ffd76a);
  border-color: #fff3c6;
  box-shadow: 0 6px 18px rgba(2, 20, 38, 0.5), 0 0 30px rgba(255, 205, 90, 0.9);
}

.cell-badge.clear b { color: #7a4b00; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.75); }
.cell-badge.clear span { color: #8a5a06; }

/* 弹出 → 停一下 → 上浮淡出，全程都不挡视线 */
@keyframes badgePop {
  0%   { opacity: 0; transform: translate(-50%, -26%) scale(.5); }
  20%  { opacity: 1; transform: translate(-50%, -50%) scale(1.16); }
  38%  { transform: translate(-50%, -52%) scale(1); }
  70%  { opacity: 1; transform: translate(-50%, -62%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -88%) scale(.94); }
}

/* 飞回罐子的奖励水滴：金色，比注入的蓝水滴更扎眼 */
.fly-drop.gain {
  width: 15px;
  height: 15px;
  margin: -7.5px 0 0 -7.5px;
  background: radial-gradient(circle at 34% 30%, #ffffff, #ffe9a8 42%, #ffc23d 100%);
  box-shadow: 0 0 12px rgba(255, 228, 150, 0.95), 0 0 26px rgba(255, 190, 70, 0.6);
}

/* 水滴砸进罐子：罐子沉一下再回弹，和水位上涨同步 */
.jar-ball.fill { animation: jarFill .42s cubic-bezier(.3, 1.2, .4, 1); }

@keyframes jarFill {
  0%   { transform: translateY(0) scale(1); }
  35%  { transform: translateY(2px) scale(1.06); }
  70%  { transform: translateY(-1px) scale(.985); }
  100% { transform: translateY(0) scale(1); }
}

/* ---------- 棋盘 ---------- */

.board-area {
  width: 100%;
  display: grid;
  place-items: center;
}

.board-wrap {
  position: relative;
  width: 100%;
  max-width: var(--board-max);
  aspect-ratio: 1 / 1;
  border-radius: 26px;
  padding: 10px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04));
  border: 1px solid var(--line);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(10px);
  transition: background .35s ease, border-color .35s ease, box-shadow .35s ease;
}

#board {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: manipulation;
  cursor: pointer;
}

/* 告急：不闪烁，只要还在告急区底板就常驻一层很淡的底色
 * （黄=低于 6 滴，红=低于 3 滴）；格子本身不着色，颜色全部压得很浅以免喧宾夺主 */
.board-wrap.warn-low {
  background: linear-gradient(160deg, rgba(255, 214, 120, 0.12), rgba(255, 200, 74, 0.05));
  border-color: rgba(255, 215, 106, 0.4);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.22),
              0 0 22px rgba(255, 200, 74, 0.3), 0 0 54px rgba(255, 176, 60, 0.14);
}

.board-wrap.warn-danger {
  background: linear-gradient(160deg, rgba(255, 132, 132, 0.14), rgba(255, 92, 92, 0.06));
  border-color: rgba(255, 122, 122, 0.44);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.22),
              0 0 24px rgba(255, 108, 108, 0.32), 0 0 58px rgba(255, 70, 70, 0.15);
}

/* ---------- 工具栏 ---------- */

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
}

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--glass);
  color: var(--ink);
  font-size: 14px;
  padding: 10px 18px;
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: transform .15s ease, background .18s ease, box-shadow .18s ease;
}

.btn:hover { background: var(--glass-strong); }
.btn:active { transform: scale(0.95); }

.btn.primary {
  border: none;
  color: #04243d;
  font-weight: 700;
  background: linear-gradient(150deg, #b6f0ff, #48c8f5 55%, #1b9ee0);
  box-shadow: 0 12px 26px rgba(43, 168, 226, 0.42);
}

.btn.ghost { font-size: 13px; padding: 9px 15px; }

/* ---------- 站点底栏（常驻挂底：版权 + 页面链接） ---------- */

.site-foot {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 14;          /* 界面之上、飞水层（15）与弹窗（20）之下 */
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1px 4px;
  padding: 6px 12px calc(env(safe-area-inset-bottom) + 7px);
  font-size: 11px;
  letter-spacing: .4px;
  color: rgba(214, 240, 255, 0.46);
  background: linear-gradient(180deg, rgba(4, 30, 50, 0.7), rgba(3, 22, 38, 0.94));
  border-top: 1px solid rgba(150, 224, 255, 0.14);
  backdrop-filter: blur(8px);
}

.foot-copy { white-space: nowrap; margin-right: 4px; }

.foot-nav { display: inline; }

.foot-nav button {
  appearance: none;
  border: none;
  background: none;
  padding: 2px 3px;
  font: inherit;
  color: rgba(214, 240, 255, 0.62);
  cursor: pointer;
  white-space: nowrap;
}

.foot-nav button:hover { color: var(--aqua); text-decoration: underline; }
.foot-nav button + button::before { content: '·'; margin-right: 4px; color: rgba(214, 240, 255, 0.26); }

/* 底栏弹出的站点页面正文（攻略 / FAQ / 关于 / 条款 / 隐私），换行原样保留 */
.pagebody {
  max-height: 46vh;
  margin-top: 4px;
  overflow: auto;
  text-align: left;
  font-size: 12.5px;
  line-height: 1.75;
  color: rgba(234, 247, 255, 0.82);
  white-space: pre-line;
}

/* ---------- 弹窗 ---------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(3, 20, 34, 0.62);
  backdrop-filter: blur(6px);
  transition: opacity .22s ease;
}

.overlay.hidden { opacity: 0; pointer-events: none; }

.dialog {
  width: 100%;
  max-width: 380px;
  /* 说明页带配图会长过一屏：弹窗内部滚动，别顶出屏幕 */
  max-height: 86vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 26px 24px 22px;
  text-align: center;
  border-radius: 26px;
  background: linear-gradient(165deg, rgba(12, 58, 92, 0.96), rgba(6, 32, 54, 0.96));
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 26px 60px rgba(1, 12, 22, 0.6);
  animation: dialogIn .28s cubic-bezier(.34, 1.4, .64, 1);
}

@keyframes dialogIn {
  from { transform: translateY(16px) scale(.96); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.dialog-badge {
  width: 54px;
  height: 54px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-weight: 800;
  font-size: 18px;
  color: #04243d;
  background: linear-gradient(150deg, #b6f0ff, #48c8f5 55%, #1b9ee0);
  box-shadow: 0 10px 24px rgba(43, 168, 226, 0.45), inset 0 1px 0 rgba(255, 255, 255, .7);
}

.dialog-title { margin: 0 0 8px; font-size: 22px; letter-spacing: 1px; }
.dialog-desc { margin: 0 0 14px; font-size: 13px; line-height: 1.7; color: var(--ink-dim); }

.dialog-body { margin: 0 0 18px; }

.score-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.score-cell {
  padding: 10px 6px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line);
}

.score-cell span { display: block; font-size: 10px; letter-spacing: 1px; color: var(--ink-dim); }
.score-cell b { font-size: 18px; font-variant-numeric: tabular-nums; }
.score-cell.gold b { color: var(--gold); }

/* 玩法说明配图：真实规则推演 + 本体渲染器画出来的两列小图 */
.fig-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.fig { margin: 0; text-align: center; }

.fig img {
  display: block;
  width: 100%;
  border-radius: 14px;
  background: rgba(4, 30, 50, 0.5);
  border: 1px solid rgba(150, 224, 255, 0.16);
}

.fig figcaption {
  margin-top: 6px;
  font-size: 10px;
  line-height: 1.5;
  color: rgba(234, 247, 255, 0.62);
}

.rule-list { margin: 0; padding: 0; list-style: none; text-align: left; }

.rule-list li {
  position: relative;
  padding: 7px 0 7px 20px;
  font-size: 13px;
  line-height: 1.65;
  color: rgba(234, 247, 255, 0.82);
  border-bottom: 1px dashed rgba(255, 255, 255, 0.1);
}

.rule-list li:last-child { border-bottom: none; }
.rule-list li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 15px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: linear-gradient(150deg, #b6f0ff, #1b9ee0);
}

.dialog-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ---------- RTL（阿拉伯语等从右到左的语言） ---------- */

/* 大部分排版靠 <html dir="rtl"> 自动镜像，这里只补写死了 left / right 的几处 */
[dir="rtl"] .score-tail {
  padding-left: 0;
  padding-right: 10px;
  border-left: none;
  border-right: 1px solid var(--line);
}

[dir="rtl"] .rule-list li {
  padding: 7px 20px 7px 0;
  text-align: right;
}

[dir="rtl"] .rule-list li::before {
  left: auto;
  right: 2px;
}

[dir="rtl"] .pagebody { text-align: right; }

[dir="rtl"] .foot-copy { margin-right: 0; margin-left: 4px; }

/* 语言下拉在 RTL 里也保持拉丁字母左起，读起来不乱 */
[dir="rtl"] .lang-select { direction: ltr; }

/* ---------- 响应式 ---------- */

@media (max-width: 420px) {
  .brand-text small { letter-spacing: 2px; }
  .stat { min-width: 48px; padding: 5px 8px; }
  .stat b { font-size: 15px; }
  .lang-select { max-width: 96px; font-size: 11px; padding: 0 6px; }
  .info-score > b { font-size: 21px; }
  .drop-panel { gap: 12px; }
  .jar-ball { width: 78px; height: 78px; }
  .jar-label { width: 78px; font-size: 12px; letter-spacing: 1px; }
  .jar-value b { font-size: 21px; }
  .jar-value i { font-size: 11px; }
  .btn.ghost { font-size: 12px; padding: 8px 13px; }
  /* 窄屏底栏更紧凑：尽量单行放下，少占棋盘高度 */
  .site-foot { font-size: 10.5px; gap: 0 3px; letter-spacing: .2px; padding: 5px 8px calc(env(safe-area-inset-bottom) + 6px); }
  .foot-nav button { padding: 2px 1px; }
}

@media (max-height: 700px) and (min-width: 480px) {
  /* 棋盘收窄，状态面板跟着一起收窄，两者始终同宽 */
  :root { --board-max: 440px; }
  .info-tip { display: none; }
}
