/* ============================================================
   方块九宫 · Block Nines
   视觉：纸感底 + 木块质感（PDD §9.1）
   ============================================================ */

:root {
  --paper: #f6f1e7;
  --paper-2: #efe8da;
  --panel: #fffdf8;
  --ink: #2e2a24;
  --ink-2: #7a7062;
  --ink-3: #a89d8c;
  --line: #e6dcc9;
  --line-strong: #cdbb9d;
  --wood: #c8622f;
  --wood-hi: #e08a52;
  --wood-lo: #9c4620;
  --accent: #2f8f7b;

  --c1: #3e6e8e; --c1-hi: #5f8fae; --c1-lo: #2c5068;
  --c2: #2f8f7b; --c2-hi: #4fb49c; --c2-lo: #1f6a5a;
  --c3: #d08b2c; --c3-hi: #e6a955; --c3-lo: #a56a1c;
  --c4: #b4573f; --c4-hi: #cf7459; --c4-lo: #8a3d2b;
  --c5: #6b5b95; --c5-hi: #8a7ab4; --c5-lo: #4d3f70;

  --cell: #efe7d8;
  --cell-empty: #efe7d8;
  --board-bg: #e7dcc8;
  --radius: 18px;
  --shadow-lg: 0 22px 44px -28px rgba(78, 60, 32, 0.55);
  --shadow-md: 0 10px 22px -16px rgba(78, 60, 32, 0.5);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

body[data-skin='paper'] {
  --cell: #f1ece0;
  --cell-empty: #f1ece0;
  --board-bg: #e9e2d2;
  --line-strong: #cfc3ac;
}

body[data-skin='glass'] {
  --paper: #eef3f5;
  --paper-2: #e2ebef;
  --panel: #fbfdfe;
  --ink: #22313a;
  --ink-2: #5c7280;
  --line: #d8e4e9;
  --cell: #e4eef2;
  --cell-empty: #e4eef2;
  --board-bg: #d7e5ea;
  --line-strong: #b9ced6;
  --wood: #3e6e8e;
  --wood-hi: #6f9dbb;
  --wood-lo: #2c5068;
}

body[data-skin='night'] {
  --paper: #1e1f24;
  --paper-2: #26282f;
  --panel: #2a2c34;
  --ink: #f2eee6;
  --ink-2: #a9a396;
  --ink-3: #7d786d;
  --line: #3a3d47;
  --cell: #33363f;
  --cell-empty: #33363f;
  --board-bg: #2a2d34;
  --line-strong: #454a56;
  --wood: #d08b2c;
  --wood-hi: #e6a955;
  --wood-lo: #a56a1c;
  --shadow-lg: 0 24px 48px -26px rgba(0, 0, 0, 0.8);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB',
    'Microsoft YaHei', 'Noto Sans SC', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  user-select: none;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(120, 100, 70, 0.055) 1px, transparent 1px);
  background-size: 4px 4px;
  z-index: 0;
}

#app { position: relative; height: 100%; z-index: 1; }

.phone {
  position: relative;
  height: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: calc(10px + var(--safe-top)) 14px calc(8px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.screen {
  position: absolute;
  inset: 0;
  padding: calc(10px + var(--safe-top)) 14px calc(8px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px) scale(0.995);
  transition: opacity .22s ease, transform .28s cubic-bezier(.2, .8, .25, 1);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: none;
}
.screen::-webkit-scrollbar { display: none; }
#screen-game { overflow: hidden; }
/* 首页整体一屏放下，不出现上下滚动（内容过高时由玩法速览卡片吸收，短屏则隐藏该卡片） */
#screen-home { overflow: hidden; }

.screen.on {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

/* ---------------- 通用 ---------------- */

.row { display: flex; align-items: center; }
.between { justify-content: space-between; }
.gap8 { gap: 8px; }
.gap12 { gap: 12px; }
.spacer { flex: 1; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  box-shadow: 0 2px 0 rgba(0, 0, 0, .02);
}

.pill .ico { font-size: 13px; opacity: .8; }
.pill.coin { color: #8a5a12; }
.pill.coin .dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f5d379, #d79a24 70%, #b47a12);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .5);
}

.btn {
  appearance: none;
  border: 0;
  font: inherit;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(180deg, var(--wood-hi), var(--wood) 55%, var(--wood-lo));
  border-radius: 16px;
  padding: 15px 18px;
  letter-spacing: .02em;
  box-shadow: 0 8px 18px -12px rgba(120, 60, 24, .9), inset 0 1px 0 rgba(255, 255, 255, .45),
    inset 0 -2px 0 rgba(0, 0, 0, .16);
  transition: transform .12s ease, filter .16s ease;
  cursor: pointer;
}

.btn:active { transform: translateY(1px) scale(.995); filter: brightness(.97); }

.btn.ghost {
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: 0 2px 0 rgba(0, 0, 0, .03);
}

.btn.flat {
  background: transparent;
  color: var(--ink-2);
  box-shadow: none;
  border: 1px dashed var(--line-strong);
}

.btn:disabled { opacity: .45; filter: grayscale(.3); }

.icon-btn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 16px;
  cursor: pointer;
  box-shadow: 0 2px 0 rgba(0, 0, 0, .03);
}

.icon-btn:active { transform: translateY(1px); }

.h1 { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin: 0; }
.h2 { font-size: 17px; font-weight: 800; margin: 0; }
.muted { color: var(--ink-2); font-size: 12.5px; line-height: 1.5; }
.tiny { font-size: 11px; color: var(--ink-3); letter-spacing: .04em; }
.num { font-variant-numeric: tabular-nums; }

/* ---------------- 首页 ---------------- */

.home-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 2px 0; }

.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(180deg, var(--wood-hi), var(--wood-lo));
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 2px; padding: 5px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4), 0 6px 14px -10px rgba(120, 60, 24, .9);
}
.brand-mark i { border-radius: 2px; background: rgba(255, 250, 240, .92); }
.brand-mark i:nth-child(2) { background: #f5e2c8; }
.brand-mark i:nth-child(3) { background: #f0d6b5; }

.brand-title { font-size: 19px; font-weight: 800; letter-spacing: -.01em; line-height: 1.1; }
.brand-sub { font-size: 9.5px; letter-spacing: .22em; color: var(--ink-3); margin-top: 2px; }

.hero { margin-top: 12px; }
.hero-card {
  position: relative;
  border-radius: 22px;
  padding: 14px 16px 12px;
  background: linear-gradient(160deg, #fffaf0, #f4ead8);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.hero-card::after {
  content: '';
  position: absolute; right: -40px; top: -60px; width: 150px; height: 150px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(200, 98, 47, .18), transparent 65%);
}
.hero-eyebrow { font-size: 11px; letter-spacing: .12em; color: var(--wood); font-weight: 700; }
.hero-title { font-size: 22px; font-weight: 800; margin: 6px 0 2px; }
.hero-target { font-size: 13px; color: var(--ink-2); }
.bar {
  height: 8px; border-radius: 99px; background: rgba(180, 160, 130, .25);
  overflow: hidden; margin: 10px 0 9px;
}
.bar > i {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--wood-hi), var(--wood));
  border-radius: 99px;
  transition: width .45s cubic-bezier(.2, .8, .3, 1);
}

.menu { margin-top: 12px; display: flex; flex-direction: column; gap: 7px; }
.menu-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; }

.tile {
  position: relative;
  display: flex; flex-direction: column; gap: 2px;
  padding: 12px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  text-align: left;
  box-shadow: 0 2px 0 rgba(0, 0, 0, .02);
  cursor: pointer;
  overflow: hidden;
}
.tile:active { transform: translateY(1px); }
.tile .t-ico {
  width: 30px; height: 30px; border-radius: 9px;
  display: grid; place-items: center;
  background: var(--paper-2);
  color: var(--wood);
  margin-bottom: 2px;
}
.ico-svg { width: 18px; height: 18px; display: block; }
.icon-btn .ico-svg { width: 19px; height: 19px; }
.tile .t-name { font-weight: 700; font-size: 14px; }
.tile .t-sub { font-size: 11.5px; color: var(--ink-2); }
.tile .badge {
  position: absolute; top: 10px; right: 10px;
  font-size: 10px; font-weight: 700; color: #fff;
  background: var(--accent); border-radius: 99px; padding: 2px 7px;
}

.home-foot {
  margin-top: auto;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px 0 0;
  font-size: 11px; color: var(--ink-3);
}

/* 玩法速览 */
.howto {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  flex: 0 0 auto;
  overflow: hidden;
}
/* 短屏（如 iPhone SE、小屏安卓）的首页压缩规则，见文件末尾 @media (max-height: 700px) */
.howto-t { font-size: 11px; letter-spacing: .14em; color: var(--ink-3); margin-bottom: 6px; }
.howto-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.hs { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.hs b { font-size: 11px; font-weight: 700; color: var(--ink-2); }
.mg {
  position: relative;
  width: 50px; height: 50px;
  border-radius: 7px;
  background:
    repeating-linear-gradient(to right, transparent 0 20%, rgba(255,255,255,.75) 20% calc(20% + 1px)),
    repeating-linear-gradient(to bottom, transparent 0 20%, rgba(255,255,255,.75) 20% calc(20% + 1px)),
    var(--cell);
  overflow: hidden;
}
.mg i {
  position: absolute; width: 20%; height: 20%;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--c4-hi), var(--c4) 60%, var(--c4-lo));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.4);
}
.mg i.hot { background: linear-gradient(180deg, var(--c3-hi), var(--c3) 60%, var(--c3-lo)); }
.mg i.gh { background: rgba(62,110,142,.25); box-shadow: inset 0 0 0 1.5px rgba(62,110,142,.6); }
.mg-badge {
  position: absolute; right: 2px; top: 2px;
  background: var(--wood); color: #fff;
  font-size: 9px; font-weight: 800;
  padding: 1px 5px; border-radius: 99px;
}

/* ---------------- 对局 ---------------- */

.game-top { display: flex; align-items: center; gap: 10px; padding: 2px 0 0; }
.score-box { flex: 1; text-align: center; }
.score-main {
  font-size: 30px; font-weight: 800; line-height: 1;
  font-variant-numeric: tabular-nums; letter-spacing: -.02em;
}
.score-sub { font-size: 10.5px; color: var(--ink-3); margin-top: 3px; letter-spacing: .04em; }
.score-main.bump { animation: bump .24s ease; }

@keyframes bump {
  0% { transform: scale(1); }
  45% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

.streak-wrap { display: flex; align-items: center; gap: 8px; padding: 6px 2px 0; }
.streak-label { font-size: 10px; color: var(--ink-3); letter-spacing: .1em; white-space: nowrap; }
.streak-bar { flex: 1; height: 4px; border-radius: 99px; background: rgba(160, 140, 110, .22); overflow: hidden; }
.streak-bar > i {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, #e0a03c, var(--wood));
  border-radius: 99px;
  transition: width .3s ease;
}
.streak-x { font-size: 10.5px; font-weight: 700; color: var(--wood); min-width: 26px; text-align: right; }

.board-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  gap: 12px;
  min-height: 0;
  padding: 10px 0 6px;
}

.board-wrap {
  position: relative;
  padding: 9px;
  border-radius: 22px;
  background: linear-gradient(165deg, var(--panel), var(--paper-2));
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, .8);
}

#board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  grid-template-rows: repeat(9, 1fr);
  border-radius: 12px;
  overflow: hidden;
  background: var(--board-bg);
  touch-action: none;
}

.cell {
  position: relative;
  background: var(--cell-empty);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .5);
}
.cell.q-r { box-shadow: inset -2px 0 0 var(--line-strong), inset 0 0 0 1px rgba(255, 255, 255, .5); }
.cell.q-b { box-shadow: inset 0 -2px 0 var(--line-strong), inset 0 0 0 1px rgba(255, 255, 255, .5); }
.cell.q-r.q-b {
  box-shadow: inset -2px 0 0 var(--line-strong), inset 0 -2px 0 var(--line-strong),
    inset 0 0 0 1px rgba(255, 255, 255, .5);
}

.blk {
  position: absolute;
  inset: 1.5px;
  border-radius: 20%;
  background: linear-gradient(180deg, var(--hi) 0%, var(--base) 45%, var(--base) 60%, var(--lo) 100%);
  box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, .45), inset 0 -2px 0 rgba(0, 0, 0, .18),
    0 1px 2px rgba(60, 40, 20, .18);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  color: rgba(255, 255, 255, .92);
  text-shadow: 0 1px 1px rgba(0, 0, 0, .3);
  transition: transform .16s cubic-bezier(.2, .9, .3, 1.4), opacity .22s ease;
}
.blk::after {
  content: '';
  position: absolute;
  inset: 2px 2px auto 2px;
  height: 38%;
  border-radius: 14% 14% 40% 40%;
  background: linear-gradient(180deg, rgba(255, 255, 255, .26), rgba(255, 255, 255, 0));
  pointer-events: none;
}
.blk.num {
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .34), inset 0 1.5px 0 rgba(255, 255, 255, .45),
    inset 0 -2px 0 rgba(0, 0, 0, .18), 0 1px 2px rgba(60, 40, 20, .18);
  font-size: 12px;
  letter-spacing: -.02em;
}
.blk.drop { animation: drop .19s cubic-bezier(.2, .9, .3, 1.25); }
@keyframes drop {
  0% { transform: scale(1.16); opacity: .6; }
  100% { transform: scale(1); opacity: 1; }
}
.blk.clearing {
  animation: clearing .26s cubic-bezier(.3, .7, .4, 1) forwards;
  z-index: 3;
}
@keyframes clearing {
  0% { transform: scale(1); filter: brightness(1); }
  38% { transform: scale(1.12); filter: brightness(1.55); }
  100% { transform: scale(.25); filter: brightness(1.9); opacity: 0; }
}
.blk.kept { animation: kept .3s ease; }
@keyframes kept {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-2px); }
  60% { transform: translateX(2px); }
}

/* 落点预览 */
.drop-ghost {
  position: absolute;
  inset: 2px;
  border-radius: 20%;
  background: rgba(62, 110, 142, .3);
  border: 1.5px solid rgba(62, 110, 142, .65);
  pointer-events: none;
  z-index: 2;
}
.drop-ghost.bad {
  background: rgba(180, 87, 63, .22);
  border-color: rgba(180, 87, 63, .6);
}
.drop-ghost.rowline { box-shadow: 0 0 0 2px rgba(224, 160, 60, .55); }

/* 对局数据条 */
.meta-strip { display: flex; gap: 6px; width: 100%; }
.meta-item {
  flex: 1;
  padding: 5px 4px 6px;
  border-radius: 10px;
  background: rgba(255, 253, 248, .72);
  border: 1px solid var(--line);
  text-align: center;
}
.meta-item b { display: block; font-size: 13px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.meta-item span { font-size: 9.5px; color: var(--ink-3); }

/* 托盘 */
.tray-area { width: 100%; }
.tray {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  min-height: var(--tray-h, 80px);
}
.slot {
  position: relative;
  height: var(--tray-h, 74px);
  border-radius: 14px;
  background: rgba(255, 253, 248, .6);
  border: 1px dashed rgba(180, 160, 130, .45);
  display: grid;
  place-items: center;
  touch-action: none;
  transition: background .2s ease, border-color .2s ease, transform .16s ease;
}
.slot.has { border-style: solid; border-color: rgba(180, 160, 130, .3); background: rgba(255, 253, 248, .95); }
.slot.sel {
  border-color: var(--wood);
  background: rgba(255, 246, 232, 1);
  transform: translateY(-2px);
  box-shadow: 0 8px 16px -12px rgba(120, 60, 24, .8);
}
.slot.sel::after {
  content: '';
  position: absolute; inset: -3px;
  border-radius: 16px;
  border: 2px solid rgba(200, 98, 47, .45);
}
.piece-grid { display: grid; }
.pc {
  border-radius: 22%;
  background: linear-gradient(180deg, var(--hi), var(--base) 55%, var(--lo));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), inset 0 -1px 0 rgba(0, 0, 0, .16);
}
.pc.void { background: transparent; box-shadow: none; }

.tools {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding-top: 8px;
}
.tool {
  position: relative;
  height: 56px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--ink);
  cursor: pointer;
  transition: transform .12s ease;
  box-shadow: 0 2px 0 rgba(0, 0, 0, .02);
}
.tool:active { transform: translateY(1px); }
.tool .ti { height: 19px; display: grid; place-items: center; }
.x2 { font-size: 14px; font-weight: 800; letter-spacing: -.02em; color: var(--wood); }
.tool .tl { font-size: 10.5px; color: var(--ink-2); }
.tool .cnt {
  position: absolute; top: -5px; right: -4px;
  min-width: 18px; height: 18px; padding: 0 4px;
  border-radius: 99px;
  background: var(--wood); color: #fff;
  font-size: 10px; font-weight: 800;
  display: grid; place-items: center;
  box-shadow: 0 2px 6px -2px rgba(0, 0, 0, .4);
}
.tool .cnt.ad { background: var(--accent); font-size: 9px; }
.tool.off { opacity: .45; }
.tool.armed { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(47, 143, 123, .18); }

/* 收纳盒 */
.store-line { display: flex; align-items: center; gap: 8px; padding-top: 8px; }
.store-lab { font-size: 10px; color: var(--ink-3); letter-spacing: .08em; white-space: nowrap; }
.store { display: flex; gap: 6px; flex: 1; }
.store-slot {
  flex: 1;
  height: 46px;
  border-radius: 11px;
  border: 1px dashed rgba(180, 160, 130, .45);
  display: grid;
  place-items: center;
  background: rgba(255, 253, 248, .55);
  touch-action: none;
}
.store-slot.has { border-style: solid; background: rgba(255, 253, 248, .95); }

/* ---------------- 浮层 ---------------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(38, 32, 24, .52);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.overlay.on { opacity: 1; pointer-events: auto; }

.sheet {
  width: 100%;
  max-width: 400px;
  max-height: 86vh;
  overflow: auto;
  border-radius: 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .6);
  padding: 18px;
  transition: opacity .2s ease;
  opacity: 0;
  -webkit-overflow-scrolling: touch;
}
.overlay.on .sheet { opacity: 1; }

.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.sheet-title { font-size: 17px; font-weight: 800; }

.list-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}
.list-item:last-child { border-bottom: 0; }
.li-main { flex: 1; min-width: 0; }
.li-title { font-size: 13.5px; font-weight: 700; }
.li-sub { font-size: 11.5px; color: var(--ink-2); margin-top: 2px; line-height: 1.4; }
.li-ico {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--paper-2); color: var(--wood); font-size: 15px; font-weight: 800;
}
.li-ico.done { background: rgba(47, 143, 123, .14); color: var(--accent); }

.empty { text-align: center; color: var(--ink-3); font-size: 12px; padding: 22px 0; }

/* 结算 */
.result-score { font-size: 46px; font-weight: 800; text-align: center; line-height: 1; letter-spacing: -.03em; }
.result-label { text-align: center; font-size: 11px; letter-spacing: .16em; color: var(--ink-3); margin-bottom: 4px; }
.result-record {
  text-align: center; font-size: 12px; color: var(--wood); font-weight: 700; margin-top: 6px;
  min-height: 16px;
}
.result-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0; }
.stat {
  border-radius: 12px; background: var(--paper-2); padding: 9px 6px; text-align: center;
}
.stat b { display: block; font-size: 15px; font-variant-numeric: tabular-nums; }
.stat span { font-size: 10px; color: var(--ink-2); }
.sheet-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }

/* 广告 */
.ad-layer {
  position: fixed; inset: 0; z-index: 90;
  background: #101317;
  color: #fff;
  display: none;
  flex-direction: column;
  padding: calc(16px + var(--safe-top)) 16px calc(16px + var(--safe-bottom));
}
.ad-layer.on { display: flex; }
.ad-tag { font-size: 10px; letter-spacing: .16em; color: #8b929c; }
.ad-body { flex: 1; display: grid; place-items: center; text-align: center; gap: 8px; }
.ad-body .big { font-size: 22px; font-weight: 800; letter-spacing: .02em; }
.ad-body .sub { font-size: 12px; color: #9aa2ad; }
.ad-art {
  width: 148px; height: 148px; border-radius: 28px;
  background: radial-gradient(circle at 30% 25%, #3b4c63, #1a2029 70%);
  display: grid; place-items: center; font-size: 54px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12);
}
.ad-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ad-timer { font-size: 12px; color: #9aa2ad; font-variant-numeric: tabular-nums; }
.ad-skip {
  border: 1px solid #333a44; background: #1b2028; color: #fff;
  border-radius: 999px; padding: 9px 18px; font-size: 13px; font-weight: 700;
}
.ad-skip:disabled { color: #5b626b; }
.ad-fake-note {
  position: absolute; bottom: auto; font-size: 9px; color: #4d545e; letter-spacing: .1em;
}

/* 提示 */
.toast-wrap {
  position: fixed; left: 0; right: 0; top: calc(96px + var(--safe-top));
  display: flex; flex-direction: column-reverse; align-items: center; gap: 6px;
  z-index: 80; pointer-events: none;
}
.toast {
  max-width: 86%;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(46, 42, 36, .9);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: 0 10px 20px -14px rgba(0, 0, 0, .8);
  animation: toastIn .22s ease, toastOut .3s ease 1.5s forwards;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px); } }

/* 飘分 */
.float {
  position: fixed;
  z-index: 55;
  pointer-events: none;
  font-weight: 800;
  color: var(--wood);
  font-size: 16px;
  text-shadow: 0 2px 6px rgba(255, 253, 248, .9), 0 0 2px rgba(255, 255, 255, .9);
  animation: floatUp .95s cubic-bezier(.2, .8, .3, 1) forwards;
  white-space: nowrap;
}
.float small { font-size: 11px; display: block; text-align: center; color: var(--ink-2); }
@keyframes floatUp {
  0% { opacity: 0; transform: translate(-50%, 0) scale(.9); }
  18% { opacity: 1; transform: translate(-50%, -8px) scale(1.04); }
  100% { opacity: 0; transform: translate(-50%, -48px) scale(1); }
}

/* 拖拽层 */
#drag-layer {
  position: fixed; inset: 0; z-index: 70; pointer-events: none; display: none;
}
#drag-layer.on { display: block; }
.drag-piece {
  position: absolute;
  display: grid;
  filter: drop-shadow(0 12px 14px rgba(60, 40, 20, .3));
  transform-origin: center;
}

/* 月历 */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 10px; }
.cal-d {
  aspect-ratio: 1;
  border-radius: 8px;
  display: grid; place-items: center;
  font-size: 11px;
  color: var(--ink-2);
  background: var(--paper-2);
  position: relative;
}
.cal-d.done { background: rgba(47, 143, 123, .16); color: var(--accent); font-weight: 800; }
.cal-d.done::after { content: '✓'; position: absolute; bottom: 0; right: 3px; font-size: 8px; }
.cal-d.today { outline: 2px solid var(--wood); outline-offset: -2px; }
.cal-d.miss { opacity: .45; }
.cal-w { font-size: 9px; text-align: center; color: var(--ink-3); }

/* 图鉴卡片 */
.cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 10px; }
.card {
  border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: var(--paper-2);
}
.card-art { height: 76px; position: relative; overflow: hidden; }
.card-art::after {
  content: ''; position: absolute; inset: 0;
  background: repeating-linear-gradient(115deg, rgba(255, 255, 255, .12) 0 6px, transparent 6px 12px);
}
.card-t { padding: 8px 10px 10px; }
.card-t b { font-size: 12.5px; display: block; }
.card-t span { font-size: 10px; color: var(--ink-3); }
.card.locked .card-art { filter: grayscale(1) brightness(.9); opacity: .55; }
.card.locked .card-t b { color: var(--ink-3); }

.tone-snow { background: linear-gradient(160deg, #dbe6f1, #b8cbdd); }
.tone-lamp { background: linear-gradient(160deg, #f3d7a8, #e0a86b); }
.tone-sprout { background: linear-gradient(160deg, #cfe3c4, #8fbc84); }
.tone-rain { background: linear-gradient(160deg, #cfdbe2, #9cb3c1); }
.tone-flower { background: linear-gradient(160deg, #f0d3dc, #d99cb0); }
.tone-day { background: linear-gradient(160deg, #f7e8bb, #ecce7e); }
.tone-sea { background: linear-gradient(160deg, #b9dbe0, #6fa9b6); }
.tone-cicada { background: linear-gradient(160deg, #d9e2b5, #a9bd72); }
.tone-desk { background: linear-gradient(160deg, #d8cbb8, #a89078); }
.tone-leaf { background: linear-gradient(160deg, #e8c9a2, #c2854f); }
.tone-fire { background: linear-gradient(160deg, #f0bf94, #c9713e); }
.tone-night { background: linear-gradient(160deg, #2f3a52, #1b2233); }

/* 排行榜 */
.rank-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 10px; font-size: 13px;
}
.rank-row.me { background: rgba(200, 98, 47, .12); font-weight: 800; }
.rank-row .rl { width: 22px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.rank-row .rn { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-row .rs { font-variant-numeric: tabular-nums; }
.rank-row.top1 .rl, .rank-row.top2 .rl, .rank-row.top3 .rl { color: var(--wood); font-weight: 800; }

/* 教学提示 */
.hint-bubble {
  position: fixed;
  z-index: 65;
  max-width: 240px;
  background: #2e2a24;
  color: #fff;
  font-size: 12.5px;
  line-height: 1.5;
  padding: 10px 13px;
  border-radius: 12px;
  box-shadow: 0 16px 30px -20px rgba(0, 0, 0, .8);
  animation: toastIn .2s ease;
}
.hint-bubble::after {
  content: '';
  position: absolute;
  left: 24px; bottom: -6px;
  width: 12px; height: 12px;
  background: #2e2a24;
  transform: rotate(45deg);
}

/* ---------------- 隐私政策页 ---------------- */

.privacy-screen { gap: 0; }

.privacy-top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 10px;
  background: linear-gradient(var(--paper) 78%, rgba(246, 241, 231, 0));
  position: sticky;
  top: calc(-10px - var(--safe-top));
  z-index: 2;
  margin: 0 -2px;
  padding-top: 2px;
}

.privacy-heading {
  flex: 1;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: .01em;
}

/* 分段切换（隐私页 中文 / EN） */
.seg {
  display: inline-flex;
  padding: 3px;
  border-radius: 12px;
  background: rgba(180, 160, 130, .16);
  gap: 2px;
}
.seg button {
  border: 0;
  background: transparent;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 700;
  padding: 5px 11px;
  border-radius: 9px;
  transition: background .18s ease, color .18s ease;
}
.seg button.on {
  background: #fffdf8;
  color: var(--ink);
  box-shadow: 0 4px 10px -8px rgba(90, 60, 30, .9);
}

.privacy-body { padding-bottom: 24px; }

.privacy-body h3 {
  font-size: 13.5px;
  font-weight: 800;
  margin: 18px 0 6px;
  color: var(--ink);
}
.privacy-body h3:first-child { margin-top: 4px; }
.privacy-body p {
  font-size: 12.5px;
  line-height: 1.72;
  color: var(--ink-2);
  margin: 0 0 2px;
}
.privacy-body .privacy-meta {
  font-size: 11px;
  color: var(--ink-3);
  margin: 2px 0 12px;
  letter-spacing: .02em;
}
.privacy-body .privacy-intro {
  padding: 12px 13px;
  border-radius: 14px;
  background: rgba(255, 253, 248, .8);
  border: 1px solid rgba(180, 160, 130, .22);
  color: var(--ink);
  font-size: 12.5px;
  line-height: 1.6;
}

/* ---------------- 语言选择 ---------------- */

.lang-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 4px;
  border: 0;
  border-bottom: 1px solid rgba(180, 160, 130, .18);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  text-align: left;
  transition: background .16s ease;
}
.lang-row:active { background: rgba(200, 98, 47, .07); }
.lang-row:last-child { border-bottom: 0; }
.lang-row .lr-name { flex: 1; font-size: 13.5px; font-weight: 700; }
.lang-row .lr-tag {
  font-size: 10px;
  letter-spacing: .08em;
  color: var(--ink-3);
  text-transform: uppercase;
}
.lang-row .lr-check { color: var(--wood); font-weight: 800; width: 16px; text-align: center; }

/* 设置里的跳转行（语言 / 隐私） */
.jump-row { cursor: pointer; }
.jump-row .chev { color: var(--ink-3); font-size: 16px; margin-left: 6px; }

/* 桌面适配 */
@media (min-width: 520px) {
  .phone { padding-left: 20px; padding-right: 20px; }
  .screen { padding-left: 20px; padding-right: 20px; }
  body { background: #efe8da; }
  body::before { opacity: .8; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------------- 短屏适配（放在末尾以保证优先级） ---------------- */
@media (max-height: 700px) {
  .hero { margin-top: 10px; }
  .menu { margin-top: 10px; }
  .howto { display: none; }
}

/* 首页「一屏放下」兜底：JS 发现内容超高时加 .compact，收起玩法速览 */
#screen-home.compact .howto { display: none; }
#screen-home.compact .hero { margin-top: 10px; }
#screen-home.compact .menu { margin-top: 10px; }
