/* 主光固定左上。废弃蜜桃/紫顶栏/绿牌桌三套世界，旧名映射到木桌 token。 */
:root {
  --desk: #3A2A1E;
  --desk-deep: #2A1C14;
  --paper: #F4EFE6;
  --paper-2: #EBE4D8;
  --ink: #2B241C;
  --muted: #7A7064;
  --accent: #C45C26;
  --accent-dark: #9A4318;
  --ok: #3F6B4E;
  --danger: #A33A2C;
  --gold: #D4A017;
  --line: #D9CDB8;
  --card: #FFFBF4;
  --wood: #D7B07A;
  --wood-frame: #8B5318;
  --wood-in: #C48A3C;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --space: 8px;
  --shadow-1: 0 2px 6px rgba(42, 28, 20, 0.18);
  --shadow-2: 0 10px 24px rgba(42, 28, 20, 0.28);
  --font-display: "Smiley Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-body: "PingFang SC", "Microsoft YaHei", sans-serif;
  --fs-display: 28px;
  --fs-hero: 44px;
  --fs-title: 18px;
  --fs-btn: 15px;
  --fs-body: 14px;
  --fs-meta: 12px;
  --bg: var(--paper);
  --brand: var(--accent);
  --brand-dark: var(--accent-dark);
  --teal: var(--ok);
  --dusk: var(--desk);
  --sunset: var(--accent);
  --shadow: var(--shadow-2);
  --phone-w: 375px;
  --phone-h: 812px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

@font-face {
  font-family: "Smiley Sans";
  src: url("../fonts/SmileySans-Oblique.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  overscroll-behavior: none;
}
body {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  color: var(--ink);
  background: var(--desk-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  -webkit-tap-highlight-color: transparent;
}

button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: 0.45; cursor: not-allowed; }

.desktop-note {
  position: fixed;
  left: 24px;
  top: 24px;
  width: 220px;
  color: var(--paper-2);
  font-size: var(--fs-meta);
  line-height: 1.55;
}
.desktop-note strong {
  font-family: var(--font-display);
  color: var(--paper);
  display: block;
  margin-bottom: 6px;
  font-size: var(--fs-title);
}

.phone {
  width: var(--phone-w);
  height: min(var(--phone-h), 96vh);
  background: var(--bg);
  border-radius: 28px;
  border: 1px solid rgba(58, 42, 30, 0.55);
  box-shadow: var(--shadow-2);
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  overscroll-behavior: none;
}

.topbar {
  position: relative;
  overflow: hidden;
  background: var(--desk);
  color: var(--paper);
  padding-top: var(--safe-top);
  padding-bottom: 4px;
  flex-shrink: 0;
}
.phone.playing .topbar,
.phone.playing .tabbar { display: none; }
.nav {
  height: 46px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.nav h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--fs-title);
  letter-spacing: 0.02em;
  font-weight: 400;
  color: var(--paper);
  white-space: nowrap;
}
.nav-side { width: 72px; display: flex; align-items: center; gap: 6px; }
.nav-side.right { justify-content: flex-end; }
.back-btn, .icon-btn {
  border: 0;
  background: transparent;
  color: var(--paper);
  min-width: 36px;
  min-height: 36px;
  border-radius: var(--radius-sm);
}
.icon-btn { font-size: 13px; color: var(--brand-dark); }

.wallet {
  display: flex;
  gap: 8px;
  padding: 0 16px 14px;
  flex-shrink: 0;
}
.chip {
  background: rgba(244, 239, 230, 0.14);
  border: 1px solid rgba(244, 239, 230, 0.22);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: var(--fs-meta);
  color: var(--paper);
}
.chip em { font-style: normal; font-weight: 700; display: inline-block; }
.chip.gold em { color: var(--gold); }
.chip.hint em { color: var(--paper); }

.screens {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: var(--paper);
}
.screen {
  display: none;
  position: absolute;
  inset: 0;
  overflow: auto;
  padding: 16px 16px 12px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.screen::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}
.screen.active {
  display: block;
  animation: screen-in 0.28s ease;
}
@keyframes screen-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
#screen-home {
  padding-top: 16px;
}
#screen-me,
#screen-gallery {
  padding-top: 20px;
}

.tabbar {
  height: auto;
  min-height: 58px;
  padding-bottom: var(--safe-bottom);
  border-top: 1px solid var(--line);
  background: var(--paper);
  display: flex;
  flex-shrink: 0;
}
.tabbar button {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: var(--fs-meta);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
.tabbar button.on { color: var(--accent); font-weight: 700; }
.tabbar .ico {
  width: 16px;
  height: 16px;
  display: block;
  box-sizing: border-box;
  border: 1.5px solid currentColor;
  margin-bottom: 2px;
}
.ico-home { border-radius: 3px; }
.ico-grid {
  border-radius: 2px;
  box-shadow: inset 6px 0 0 -4.5px currentColor, inset -6px 0 0 -4.5px currentColor;
}
.ico-me { border-radius: 99px; }

.hero, .card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
}
.cover {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 1;
  margin-top: 4px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-2);
}
.skel {
  background: linear-gradient(90deg, var(--paper-2) 0%, #f7f1e7 45%, var(--paper-2) 100%);
  background-size: 200% 100%;
  animation: skel 1.1s ease infinite;
}
@keyframes skel {
  to { background-position: -200% 0; }
}
.cover-skel {
  position: absolute;
  inset: 0;
  z-index: 1;
}
.cover:not(.is-loading) .cover-skel { display: none; }
.cover.is-loading .cover-img,
.cover.is-loading .cover-fade,
.cover.is-loading .cover-copy { opacity: 0; }
.cover-fail {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 5;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 20px;
  background: rgba(42, 28, 20, 0.78);
  color: var(--paper);
  text-align: center;
}
.cover.is-fail .cover-fail { display: flex; }
.cover-fail p { margin: 0; font-size: var(--fs-body); }
.cover-fail .btn { width: auto; min-width: 140px; }
.cover.frame {
  border: 10px solid var(--wood-frame);
  box-shadow: inset 0 0 0 2px var(--wood-in), var(--shadow-2);
}
.cover-img,
.thumb img,
.splash-still img,
.collection img {
  filter: saturate(0.92) contrast(1.04);
}
.cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.cover-fade {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 38%, rgba(18, 10, 8, 0.78) 100%);
}
.cover-copy {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  color: #fff;
}
.cover-copy h2 {
  margin: 6px 0 4px;
  font-family: var(--font-display);
  font-size: var(--fs-display);
  font-weight: 400;
  letter-spacing: 0.04em;
}
.cover-copy p { margin: 0 0 12px; font-size: var(--fs-meta); color: rgba(255,255,255,0.82); }
.badge {
  display: inline-block;
  background: var(--gold);
  color: var(--desk-deep);
  font-size: var(--fs-meta);
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 2px;
}
.home-alt {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: var(--fs-meta);
}
.text-link {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px 4px;
  font-size: var(--fs-meta);
}
.peek-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.peek {
  border: 0;
  padding: 0;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 10px rgba(80, 30, 10, 0.1);
}
.peek img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.peek span { display: block; font-size: var(--fs-meta); padding: 5px 4px 7px; color: var(--ink); }
.kicker {
  font-size: var(--fs-meta);
  color: var(--accent);
  margin: 10px 0 4px;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.hero h2 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: var(--fs-title);
  font-weight: 400;
}
.meta { font-size: var(--fs-meta); color: var(--muted); margin-bottom: 12px; }

.btn {
  border: 0;
  border-radius: var(--radius-sm);
  min-height: 44px;
  padding: 0 16px;
  font-size: var(--fs-btn);
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  width: 100%;
  box-shadow: var(--shadow-1);
}
.btn-ghost {
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  width: 100%;
}
.btn-row { display: flex; gap: 8px; margin-top: 10px; }
.btn-row .btn { flex: 1; }
.btn-tiny {
  min-height: 32px;
  font-size: var(--fs-meta);
  padding: 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--card);
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 16px 0 8px;
  font-size: var(--fs-title);
  font-weight: 700;
}
.section-title span { font-weight: 400; font-size: var(--fs-meta); color: var(--muted); }

.diff {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.diff button {
  flex: 1;
  min-height: 36px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
}
.diff button.on { border-color: var(--accent); color: var(--accent-dark); background: var(--paper-2); }

.cats-bar {
  margin: 0 -16px 4px;
  padding: 10px 16px 8px;
  background: var(--paper);
  border-bottom: 1px solid transparent;
}
.cats-bar.open {
  border-bottom-color: var(--line);
  box-shadow: 0 8px 16px rgba(80, 24, 8, 0.06);
}
.cats-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.cats {
  display: flex;
  gap: 8px;
  flex: 1;
  min-width: 0;
  overflow: visible;
  padding: 0;
  margin: 0;
}
.cats-toggle {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 32px;
  padding: 0 2px 0 8px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}
.cats-toggle.on {
  color: var(--brand-dark);
  font-weight: 700;
}
.cats-toggle.open {
  color: var(--ink);
  font-weight: 700;
}
.cats-toggle .chev {
  width: 7px;
  height: 7px;
  margin-top: -3px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.18s ease, margin-top 0.18s ease;
}
.cats-toggle.open .chev {
  margin-top: 3px;
  transform: rotate(-135deg);
}
.cats-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 0 2px;
}
.cats-panel[hidden] { display: none; }
.cats-panel button {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 13px;
}
.cats-panel button.on {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.cats button {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 13px;
}
.cats button.on {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.thumb {
  border: 0;
  padding: 6px 6px 0;
  background: var(--wood-frame);
  border-radius: 6px;
  overflow: hidden;
  text-align: left;
  position: relative;
  box-shadow: var(--shadow-1);
}
.thumb img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  border-radius: 2px;
  opacity: 0;
}
.thumb.ready img { opacity: 1; }
.thumb.fail img { opacity: 0.28; }
.thumb-skel {
  position: absolute;
  left: 6px;
  right: 6px;
  top: 6px;
  aspect-ratio: 1;
  border-radius: 2px;
  z-index: 1;
}
.thumb.ready .thumb-skel,
.thumb.fail .thumb-skel { display: none; }
.thumb.fail::after {
  content: "加载失败，点重试";
  position: absolute;
  left: 8px;
  right: 8px;
  top: 38%;
  z-index: 2;
  text-align: center;
  color: #fff;
  font-size: var(--fs-meta);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.55);
}
.thumb p { margin: 0; padding: 8px 6px 4px; font-size: var(--fs-meta); color: var(--paper); }
.stage-pips {
  display: flex;
  gap: 4px;
  padding: 0 8px 10px;
}
.stage-pips i {
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: rgba(244, 239, 230, 0.35);
}
.stage-pips i.on { background: var(--gold); }
.stage-pips i.jag {
  border-radius: 2px;
  transform: rotate(45deg);
}
.thumb .lock {
  position: absolute;
  inset: 0;
  background: rgba(44, 36, 28, 0.45);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}
.upload-tile {
  border: 1px dashed var(--line);
  background: var(--paper-2);
  min-height: 168px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--accent-dark);
  font-size: var(--fs-meta);
}

.list { display: flex; flex-direction: column; gap: 8px; }
.row {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  min-height: 52px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.row .ttl { font-size: var(--fs-body); }
.row .sub { font-size: var(--fs-meta); color: var(--muted); margin-top: 2px; }
.pause-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.pause-stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 12px 12px;
  text-align: center;
}
.pause-stat em {
  display: block;
  font-family: var(--font-display);
  font-style: normal;
  font-size: var(--fs-display);
  line-height: 1;
  color: var(--ink);
}
.num-pop { animation: num-pop 0.28s ease; }
@keyframes num-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.18); }
  100% { transform: scale(1); }
}
.pause-stat span {
  display: block;
  margin-top: 6px;
  font-size: var(--fs-meta);
  color: var(--muted);
}
.pause-toggles {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.toggle-chip {
  flex: 1;
  min-height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-size: var(--fs-meta);
}
.toggle-chip.off {
  color: var(--muted);
}

.empty, .error-box {
  text-align: center;
  padding: 28px 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}
.empty strong, .error-box strong { display: block; color: var(--ink); margin-bottom: 6px; font-size: 15px; }
.empty span { display: block; margin-bottom: 12px; }
.empty .btn { max-width: 220px; margin: 0 auto; }

.collection { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.collection img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; }

/* play */
#screen-play {
  padding-top: max(12px, var(--safe-top));
  padding-right: max(14px, var(--safe-right));
  padding-bottom: max(22px, calc(10px + var(--safe-bottom)));
  padding-left: max(14px, var(--safe-left));
  overflow: hidden;
  overscroll-behavior-x: none;
  display: none;
  flex-direction: column;
  background: var(--desk-deep) url("../assets/ui/wood-desk.png") center/256px repeat;
}
#screen-play.active {
  display: flex;
  animation: screen-in 0.28s ease;
}
.play-hud {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 2px 10px;
  flex-shrink: 0;
  font-size: var(--fs-meta);
  color: var(--paper);
}
.play-pips {
  display: flex;
  gap: 4px;
}
.play-pips i {
  width: 7px;
  height: 7px;
  border-radius: 99px;
  background: rgba(244, 239, 230, 0.28);
}
.play-pips i.on { background: var(--gold); }
.play-pips i.jag { border-radius: 2px; transform: rotate(45deg); }
#play-progress { flex: 1; font-variant-numeric: tabular-nums; }
#play-time { font-variant-numeric: tabular-nums; opacity: 0.85; }
.play-menu-btn {
  border: 1px solid rgba(244, 239, 230, 0.28);
  background: rgba(244, 239, 230, 0.1);
  color: var(--paper);
  min-height: 32px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-meta);
}
.table {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 0 6px;
}
.tray-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  margin: 4px 0 0;
}
.tray-arrow {
  flex: 0 0 32px;
  width: 32px;
  height: 88px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
  font-size: var(--fs-display);
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow-1);
}
.tray-arrow.is-off {
  opacity: 0.32;
}
.tray-viewport {
  flex: 1;
  min-width: 0;
  height: 118px;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  touch-action: pan-x;
  scrollbar-width: none;
  -ms-overflow-style: none;
  background: url("../assets/ui/wood-desk.png") center/cover;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.28);
  border-radius: 12px;
}
.tray-viewport::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}
.tray {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  align-items: center;
  width: max-content;
  min-width: 100%;
  height: 118px;
  padding: 8px;
  box-sizing: border-box;
}
.play-bar {
  height: 6px;
  background: rgba(0,0,0,0.25);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 6px;
}
.play-bar i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--gold);
  transition: width 0.2s ease;
}
.play-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: var(--fs-meta);
  color: var(--paper);
  padding: 0 2px;
}
.time-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 72px;
  font-variant-numeric: tabular-nums;
}
.hourglass {
  width: 12px;
  height: 14px;
  flex-shrink: 0;
  color: var(--gold);
}
.play-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.sound-btn {
  border: 0;
  background: rgba(244, 239, 230, 0.16);
  color: var(--gold);
  min-width: 28px;
  min-height: 28px;
  border-radius: var(--radius-sm);
  padding: 0;
  line-height: 1;
  font-size: var(--fs-meta);
}
.sound-btn.off {
  color: var(--paper-2);
  text-decoration: none;
  opacity: 0.55;
}
.board-frame {
  width: 342px;
  max-width: 100%;
  padding: 12px;
  background: url("../assets/ui/wood-desk.png") center/cover;
  border-radius: 10px;
  box-shadow:
    inset 2px 2px 0 rgba(255, 220, 160, 0.18),
    inset -3px -5px 10px rgba(0, 0, 0, 0.42),
    0 12px 22px rgba(0, 0, 0, 0.32);
  flex-shrink: 0;
}
.board-wrap {
  width: 318px;
  max-width: 100%;
  height: auto;
  aspect-ratio: 1;
  margin: 0 auto;
  background: #E8D5B0;
  border-radius: 4px;
  position: relative;
  overflow: hidden;
  border: 0;
  box-shadow: inset 2px 2px 8px rgba(60, 30, 8, 0.28);
  box-sizing: border-box;
}
.board-wrap.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  background: linear-gradient(90deg, #e2d0aa 0%, #f0e2c4 45%, #e2d0aa 100%);
  background-size: 200% 100%;
  animation: skel 1.1s ease infinite;
}
.board-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("../assets/ui/wood-board.png") center/cover;
  opacity: 0.22;
  pointer-events: none;
  z-index: 0;
}
.board-wrap.combo-hit {
  animation: combo-pulse 0.22s ease;
}
@keyframes combo-pulse {
  0% { filter: brightness(1.08); }
  100% { filter: none; }
}
.board-wrap.shattering .piece {
  animation: shatter-out 0.62s ease forwards;
}
.board-wrap.shattering .board-ghost {
  opacity: 0.9;
  animation: shatter-flash 0.62s ease;
}
@keyframes shatter-out {
  0% { transform: translate(0, 0) rotate(0) scale(1); opacity: 1; }
  100% {
    transform: translate(var(--sx, 12px), var(--sy, 18px)) rotate(var(--sr, 14deg)) scale(0.22);
    opacity: 0;
  }
}
@keyframes shatter-flash {
  0% { opacity: 0.22; }
  35% { opacity: 0.9; }
  100% { opacity: 0.35; }
}
.board-ghost {
  position: absolute;
  inset: 0;
  z-index: 1;
  background-size: 100% 100%;
  opacity: 0.42;
  filter: saturate(0.9);
  pointer-events: none;
  display: block;
}
.board-ghost.reveal {
  opacity: 1;
  filter: none;
  transition: opacity 0.35s ease, filter 0.35s ease;
}
.board-ghost.peeking {
  opacity: 0.72;
  filter: none;
}
.board-grid {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
}
.slot {
  border: 0;
  box-shadow: inset 0 0 0 1px rgba(80, 48, 16, 0.12);
  background: transparent;
}
.slot.magnet {
  background: rgba(196, 92, 38, 0.18);
  box-shadow: inset 0 0 0 1px rgba(196, 92, 38, 0.35);
}
.board-wrap.jigsaw .slot {
  border: 0;
  background: transparent;
}
.board-wrap.jigsaw .slot.magnet {
  background: rgba(196, 92, 38, 0.2);
  box-shadow: none;
}
.piece {
  position: absolute;
  background-repeat: no-repeat;
  outline: 0;
  box-shadow:
    inset 1px 1px 0 rgba(255, 255, 255, 0.38),
    inset -2px -3px 4px rgba(40, 20, 8, 0.38),
    2px 3px 5px rgba(0, 0, 0, 0.32);
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  cursor: grab;
  z-index: 2;
}
.piece::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.26) 0%, transparent 38%, rgba(0, 0, 0, 0.2) 100%);
}
.piece.jigsaw {
  box-shadow: none;
  filter: drop-shadow(2px 3px 3px rgba(0, 0, 0, 0.34));
}
.piece.jigsaw::after {
  clip-path: inherit;
  -webkit-clip-path: inherit;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.28) 0%, transparent 40%, rgba(0, 0, 0, 0.24) 100%);
}
.piece.locked,
.piece.given {
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(40, 24, 10, 0.12);
  outline: 0;
  z-index: 1;
  filter: none;
}
.piece.locked::after,
.piece.given::after {
  opacity: 0.12;
}
.piece.nudge { animation: nudge 0.28s ease; }
@keyframes nudge {
  0%, 100% { filter: none; }
  40% { filter: brightness(1.28); }
}
.piece.just-in { animation: pop-in 0.22s ease; }
.piece.settling {
  transition: left 0.1s ease, top 0.1s ease, transform 0.1s ease;
  transform: none;
}
.piece.dragging {
  cursor: grabbing;
  z-index: 40;
  outline: 0;
  will-change: transform;
  transition: none;
  box-shadow:
    inset 1px 1px 0 rgba(255, 255, 255, 0.4),
    0 16px 24px rgba(0, 0, 0, 0.42);
}
.piece.jigsaw.dragging {
  filter: drop-shadow(0 14px 16px rgba(0, 0, 0, 0.42));
}
.piece.from-hint {
  animation: hint-flash 0.2s ease;
}
@keyframes hint-flash {
  0% { filter: brightness(1.5); }
  100% { filter: none; }
}
@keyframes pop-in {
  0% { transform: scale(1.06); }
  100% { transform: scale(1); }
}
.piece.reject {
  animation: tray-reject 0.32s ease;
}
@keyframes tray-reject {
  0% { transform: translateX(-10px) rotate(-5deg); }
  55% { transform: translateX(5px) rotate(2deg); }
  100% { transform: none; }
}
.spark {
  position: absolute;
  width: 5px;
  height: 5px;
  margin: -2px 0 0 -2px;
  border-radius: 1px;
  background: var(--gold);
  pointer-events: none;
  z-index: 8;
  animation: spark-out 0.4s ease forwards;
}
@keyframes spark-out {
  to {
    transform: translate(var(--sx), var(--sy)) scale(0.2);
    opacity: 0;
  }
}
.tray .piece { flex: 0 0 auto; }
.tray.deal-in .piece { animation: deal 0.34s ease backwards; }
@keyframes deal {
  from { transform: translateY(14px) scale(0.9); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.tray-empty { width: 100%; text-align: center; color: var(--paper-2); font-size: var(--fs-meta); padding-top: 18px; }
.play-fail {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  background: rgba(42, 28, 20, 0.84);
  color: var(--paper);
  text-align: center;
}
.play-fail[hidden] { display: none !important; }
.play-fail strong {
  font-family: var(--font-display);
  font-size: var(--fs-title);
  font-weight: 400;
}
.play-fail p { margin: 0 0 8px; font-size: var(--fs-meta); color: var(--paper-2); }
.play-fail .btn { max-width: 220px; }

/* crop */
.crop-box {
  width: 100%;
  aspect-ratio: 1;
  background: #1c1814;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
}
.crop-box canvas { width: 100%; height: 100%; display: block; }
.hint-text { font-size: var(--fs-meta); color: var(--muted); margin: 8px 0 12px; line-height: 1.5; }

/* overlay */
.overlay {
  display: none;
  pointer-events: none;
  position: absolute;
  inset: 0;
  background: rgba(28, 22, 16, 0.46);
  z-index: 30;
  align-items: flex-end;
  justify-content: center;
}
.overlay.show {
  display: flex;
  pointer-events: auto;
  animation: overlay-in 0.24s ease;
}
@keyframes overlay-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.sheet {
  display: none;
  width: 100%;
  background: var(--paper);
  border-radius: 16px 16px 0 0;
  padding: 18px 16px calc(22px + var(--safe-bottom));
  max-height: 86%;
  overflow: auto;
}
.sheet.center {
  margin: auto 16px;
  border-radius: 16px;
  max-height: 80%;
}
.sheet h3 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: var(--fs-title);
  font-weight: 400;
}
.sheet p { margin: 0 0 12px; font-size: var(--fs-meta); color: var(--muted); line-height: 1.55; }
.reward { font-size: 14px; color: var(--ink); line-height: 1.7; margin-bottom: 12px; }
.overlay.show[data-sheet="result"] {
  background: rgba(42, 28, 20, 0.62);
  align-items: center;
}
.clear-card {
  position: relative;
  overflow: hidden;
  text-align: center;
  background: var(--paper) url("../assets/ui/paper.png") center/180px repeat;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-2);
}
.clear-card h3 {
  font-family: var(--font-display);
  font-size: var(--fs-display);
  font-weight: 400;
  letter-spacing: 0.04em;
  margin: 0 0 6px;
  color: var(--ink);
}
.clear-card #result-desc {
  margin: 0 0 10px;
  font-size: var(--fs-body);
  color: var(--muted);
}
.clear-kicker {
  margin: 0 0 4px;
  font-size: var(--fs-meta);
  letter-spacing: 0.28em;
  text-indent: 0.28em;
  color: var(--accent);
  font-weight: 700;
}
.clear-photo {
  width: 96px;
  height: 96px;
  margin: 0 auto 12px;
  border-radius: 4px;
  background: var(--desk) center/cover no-repeat;
  border: 8px solid var(--wood-frame);
  box-shadow:
    inset 0 0 0 1px var(--wood-in),
    var(--shadow-1);
  filter: saturate(0.92) contrast(1.04);
}
.clear-card.grand .clear-photo {
  width: 112px;
  height: 112px;
}
.clear-card.grand .clear-kicker {
  letter-spacing: 0.2em;
}
.clear-card.grand .btn {
  animation: screen-in 0.28s ease 0.55s both;
}
.clear-card.grand .clear-burst i {
  animation-duration: 1.15s;
}
.clear-gold {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  margin: 0 auto 12px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--gold);
  color: var(--desk-deep);
  font-size: var(--fs-meta);
  font-weight: 700;
}
.clear-gold em {
  font-style: normal;
  font-family: var(--font-display);
  font-size: var(--fs-display);
  line-height: 1;
  color: var(--desk-deep);
}
.clear-bar {
  width: 72%;
  height: 4px;
  margin: 4px auto 8px;
  border-radius: 99px;
  background: rgba(180, 80, 40, 0.14);
  overflow: hidden;
}
.clear-bar i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  animation: clear-bar 2s linear forwards;
}
@keyframes clear-bar {
  from { width: 0; }
  to { width: 100%; }
}
.clear-burst {
  pointer-events: none;
  position: absolute;
  inset: -12px;
}
.clear-burst i {
  position: absolute;
  left: 50%;
  top: 28%;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--dot, #ffb020);
  opacity: 0;
  animation: burst-fly 0.9s ease-out forwards;
  animation-delay: calc(var(--i) * 0.04s);
}
@keyframes burst-fly {
  0% { transform: rotate(var(--r)) translateY(0) scale(0.4); opacity: 0; }
  18% { opacity: 1; }
  100% { transform: rotate(var(--r)) translateY(-88px) scale(1); opacity: 0; }
}
.sheet.auto-next {
  margin: auto 28px;
  border-radius: 24px;
  text-align: center;
  padding: 22px 18px 18px;
}
.sheet.auto-next #result-next,
.sheet.auto-next #result-more,
.sheet.auto-next #result-again,
.sheet.auto-next #result-home {
  display: none !important;
}
#result-auto {
  display: none;
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
}
.sheet.auto-next #result-auto { display: block; }
.sheet.auto-next .clear-gold { display: inline-flex; }
.ad-box { text-align: center; padding: 12px 0 8px; }
.ad-fake {
  height: 168px;
  border-radius: var(--radius-md);
  background: var(--desk);
  color: var(--paper);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}
.ad-fake small { opacity: 0.7; margin-top: 6px; }
.signin-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 8px 0 16px; }
.day {
  border: 1px solid var(--line);
  border-radius: 10px;
  min-height: 68px;
  padding: 8px 4px;
  text-align: center;
  font-size: 11px;
  background: #fff;
}
.day b { display: block; font-size: 12px; margin-bottom: 4px; }
.day.got { background: var(--paper-2); border-color: var(--ok); color: var(--ok); }
.day.today { border-color: var(--accent); background: var(--paper-2); }

.toast {
  display: none;
  position: absolute;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  background: rgba(42, 28, 20, 0.88);
  color: var(--paper);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-meta);
  z-index: 40;
  max-width: 80%;
  text-align: center;
}
.toast.show { display: block; }
.toast.warn { background: rgba(160, 28, 36, 0.92); }

.splash {
  position: absolute;
  inset: 0;
  z-index: 50;
  overflow: hidden;
  background: var(--desk-deep);
}
.splash.out {
  animation: splash-leave 0.38s ease forwards;
  pointer-events: none;
}
@keyframes splash-leave {
  to { opacity: 0; }
}
.splash-still {
  position: absolute;
  left: 36px;
  right: 36px;
  top: calc(72px + var(--safe-top));
  aspect-ratio: 1;
  border: 10px solid var(--wood-frame);
  box-shadow: inset 0 0 0 2px var(--wood-in), var(--shadow-2);
  overflow: hidden;
  z-index: 1;
}
.splash-still img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  animation: splash-settle 1.2s ease forwards;
}
@keyframes splash-settle {
  from { transform: rotate(-8deg) scale(1.12); opacity: 0.55; }
  to { transform: rotate(0deg) scale(1); opacity: 1; }
}
.splash-veil { display: none; }
.splash-skel {
  position: absolute;
  inset: 0;
  z-index: 1;
}
.splash-copy {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: calc(28px + var(--safe-bottom));
  z-index: 3;
  color: var(--paper);
  text-align: left;
}
.splash-copy h2 {
  margin: 0 0 16px;
  font-family: var(--font-display);
  font-size: var(--fs-hero);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: 0.08em;
}
.ad-track {
  height: 6px;
  background: var(--paper-2);
  border-radius: 99px;
  overflow: hidden;
}
.ad-track i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
}

.rotate-hint {
  position: absolute;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--desk-deep);
  color: var(--paper);
  text-align: center;
  font-family: var(--font-display);
  font-size: var(--fs-title);
  line-height: 1.4;
}
.rotate-hint[hidden] { display: none !important; }

@media (max-width: 820px) {
  .desktop-note { display: none; }
  body { background: var(--desk-deep); }
  .phone {
    width: 100%;
    height: 100dvh;
    height: 100vh;
    border-radius: 0;
    border: 0;
  }
}