:root {
  --ink: #1b1b1f;
  --paper: #fffdf5;
  --accent: #e63946;
  --accent2: #2c3e50;
  --ok: #1e8449;
  --line: #e3ddd0;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: system-ui, -apple-system, "PingFang SC", "Noto Sans CJK SC", sans-serif;
  background: #f2ece0;
  color: var(--ink);
}
.screen { display: none; min-height: 100%; padding: 14px; }
.screen.active { display: block; }
.screen#game.active { display: flex; flex-direction: column; height: 100%; }

.hero { text-align: center; padding: 10px 0 4px; }
.hero h1 { margin: 0; font-size: 26px; letter-spacing: 1px; }
.hero .sub { margin: 4px 0 0; color: #777; font-size: 13px; }

.panel {
  background: var(--paper); border: 2px solid var(--line); border-radius: 14px;
  padding: 12px; margin: 10px 0; box-shadow: 0 2px 0 rgba(0,0,0,.04);
}
.panel h2 { margin: 0 0 10px; font-size: 15px; color: var(--accent2); }
.muted { color: #8a8578; font-size: 12px; }

.stats-panel { display: flex; justify-content: space-around; text-align: center; }
.stat b { display: block; font-size: 18px; }
.stat span { font-size: 12px; color: #8a8578; }

.pack-list { display: grid; gap: 8px; }
.pack-card {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  border: 2px solid var(--line); border-radius: 12px; padding: 10px; cursor: pointer;
  background: #fff;
}
.pack-card:active { transform: translateY(1px); }
.pack-card b { font-size: 15px; }
.pack-card .progress { font-size: 12px; color: #8a8578; }

.tier-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; margin-bottom: 10px; }
.tier {
  border: 2px solid var(--line); background: #fff; border-radius: 12px; padding: 10px 6px;
  text-align: center; font-size: 13px; cursor: pointer;
}
.tier.sel { border-color: var(--accent); background: #fff4f4; }

.btn {
  border: 2px solid var(--line); background: #fff; border-radius: 12px;
  padding: 10px 14px; font-size: 15px; font-family: inherit; cursor: pointer;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.ghost { background: transparent; }
.btn.wide { width: 100%; }

.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; }
.album-cell {
  aspect-ratio: 1/1; border-radius: 10px; border: 2px dashed var(--line);
  display: flex; align-items: center; justify-content: center; font-size: 20px; color: #c9c2b2;
  background: #fff; overflow: hidden; cursor: pointer;
}
.album-cell.got { border-style: solid; border-color: var(--ok); }
.album-cell img { width: 100%; height: 100%; object-fit: cover; }

.topbar { display: flex; align-items: center; gap: 10px; }
.topbar .title { flex: 1; text-align: center; display: flex; flex-direction: column; }
.topbar .title b { font-size: 15px; }
.hud { font-size: 14px; color: #555; }
.mission { text-align: center; font-size: 14px; color: var(--accent2); margin: 8px 0; }

.canvas-wrap { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 0; }
#board { touch-action: none; border-radius: 16px; }

.controls { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 8px; }
.tips { text-align: center; margin: 8px 0 4px; }

.overlay {
  display: none; position: fixed; inset: 0; background: rgba(20,18,14,.62);
  align-items: center; justify-content: center; padding: 16px; z-index: 20;
}
.overlay.show { display: flex; }
.card {
  background: var(--paper); border-radius: 18px; padding: 16px; width: min(460px, 100%);
  max-height: 92vh; overflow: auto; text-align: center;
}
.card h2 { margin: 0 0 8px; }
.stars { color: #f2b705; font-size: 26px; letter-spacing: 4px; }
.poster { width: 100%; border-radius: 12px; margin: 8px 0; }
.result { font-size: 14px; color: #555; }
.know { background: #fff8e5; border-radius: 12px; padding: 10px; margin: 10px 0; text-align: left; }
.know b { color: var(--accent); font-size: 13px; }
.know p { margin: 4px 0 0; font-size: 13px; line-height: 1.5; }
.row { display: flex; gap: 8px; justify-content: center; }
