:root {
  --bg: #f3efe7; --card: #fffdf8; --ink: #1f2a2e; --sub: #6b7275; --line: #e3ddd2;
  --sea: #0e7c86; --hit: #12b886; --hint: #f59f00; --miss: #e03131;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: var(--bg); color: var(--ink); }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased; overscroll-behavior: none;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.screen { height: 100vh; height: 100dvh; display: flex; flex-direction: column; max-width: 1100px; margin: 0 auto; }
.hidden { display: none !important; }

/* 首页 */
#home { overflow-y: auto; padding-bottom: 24px; }
.cover { position: relative; flex: none; width: 100%; aspect-ratio: 3 / 2; max-height: 46vh; background: #cfc8bb center / cover no-repeat; }
.cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,0) 35%, rgba(0,0,0,.6)); }
.cover-text { position: absolute; left: 20px; right: 20px; bottom: 18px; color: #fff; z-index: 1; }
.cover h1 { font-size: 34px; letter-spacing: 2px; font-weight: 800; }
.cover p { margin-top: 6px; font-size: 15px; opacity: .92; }
.levels { list-style: none; padding: 18px 16px 0; display: grid; gap: 10px; width: 100%; max-width: 560px; margin: 0 auto; }
.lv { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; text-align: left; }
.lv:active { background: #f6f1e7; }
.lv img { width: 84px; height: 56px; object-fit: cover; border-radius: 8px; flex: none; }
.lv .no { font-size: 13px; color: var(--sub); }
.lv .nm { font-size: 17px; font-weight: 700; margin-top: 2px; }
.lv .meta { margin-left: auto; font-size: 13px; color: var(--sub); text-align: right; line-height: 1.5; flex: none; }
.tag { display: inline-block; font-size: 11px; padding: 0 6px; border-radius: 6px; background: #eee6d8; color: #8a6d3b; margin-left: 6px; }
.empty { color: var(--sub); text-align: center; padding: 20px 0; }
.foot { text-align: center; color: var(--sub); font-size: 12px; margin-top: 22px; }

/* 游戏页 */
.bar { display: flex; align-items: center; gap: 8px; padding: 8px 10px 2px; padding-top: max(8px, env(safe-area-inset-top)); }
.icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--ink); flex: none; }
.icon:active { background: #e9e3d8; }
.title { flex: 1; text-align: center; line-height: 1.25; min-width: 0; }
.title small { display: block; font-size: 12px; color: var(--sub); }
.title span { font-size: 17px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.status { display: flex; align-items: center; gap: 12px; padding: 4px 16px 8px; font-size: 15px; }
.dots { display: flex; gap: 5px; }
.dots i { width: 10px; height: 10px; border-radius: 50%; background: #d9d2c5; transition: background .2s; }
.dots i.on { background: var(--hit); }
.dots i.hint { background: var(--hint); }
.count { margin-left: auto; }
.count b { font-size: 18px; }
.timer { font-variant-numeric: tabular-nums; min-width: 44px; text-align: right; color: var(--sub); }
.boards { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 0 8px; }
.boards.stack { flex-direction: column; }
.board { position: relative; flex: none; border-radius: 10px; overflow: hidden; background: #ddd6ca; touch-action: manipulation; cursor: crosshair; box-shadow: 0 1px 3px rgba(0,0,0,.14); }
.board img { display: block; width: 100%; height: 100%; pointer-events: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.marks { position: absolute; inset: 0; pointer-events: none; }
.mark { position: absolute; aspect-ratio: 1; border-radius: 50%; border: 3px solid var(--hit); box-shadow: 0 0 0 2px rgba(255,255,255,.9), 0 0 10px rgba(0,0,0,.35); transform: translate(-50%, -50%) scale(.4); opacity: 0; transition: transform .28s cubic-bezier(.2,1.6,.4,1), opacity .2s; }
.mark.show { transform: translate(-50%, -50%) scale(1); opacity: 1; }
.mark.hint { border-color: var(--hint); }
.miss { position: absolute; color: var(--miss); font-size: 30px; font-weight: 900; line-height: 1; text-shadow: 0 0 3px #fff, 0 0 6px #fff; animation: miss .7s ease-out forwards; }
@keyframes miss {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.5); }
  20% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1); }
}
.shake { animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.actions { display: flex; gap: 10px; justify-content: center; padding: 10px 16px; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
.actions button, .row button { min-width: 120px; height: 44px; padding: 0 18px; border-radius: 22px; background: var(--sea); color: #fff; font-weight: 700; font-size: 16px; }
.actions button:disabled { opacity: .4; cursor: default; }
.actions .ghost, .row .ghost { background: transparent; color: var(--sea); border: 1.5px solid var(--sea); }
.toast { position: fixed; left: 50%; top: 42%; transform: translate(-50%, -50%); background: rgba(20,28,30,.86); color: #fff; padding: 10px 18px; border-radius: 20px; font-size: 15px; z-index: 40; pointer-events: none; }

/* 找齐后的地点卡 */
.modal { position: fixed; inset: 0; background: rgba(15,20,22,.5); display: grid; place-items: center; padding: 20px; z-index: 30; animation: fade .25s; }
@keyframes fade { from { opacity: 0; } }
.card { width: 100%; max-width: 380px; background: var(--card); border-radius: 20px; padding: 22px 20px 12px; text-align: center; box-shadow: 0 20px 50px rgba(0,0,0,.25); animation: pop .3s cubic-bezier(.2,1.4,.4,1); }
@keyframes pop { from { transform: scale(.9); opacity: 0; } }
.big { font-size: 28px; font-weight: 800; }
.stats { color: var(--sub); font-size: 14px; margin-top: 6px; }
.place { margin: 16px 0 14px; padding: 14px; border-radius: 14px; background: #f1ece2; text-align: left; }
.pname { font-size: 19px; font-weight: 800; }
.pwhere { font-size: 13px; color: var(--sub); margin-top: 2px; }
.place p { font-size: 15px; line-height: 1.6; margin-top: 8px; }
.place p:empty, .pwhere:empty, .credit:empty { display: none; }
.credit a { color: inherit; text-decoration: underline; }
.credit { font-size: 12px; color: var(--sub); margin-top: 8px; }
.row { display: flex; gap: 10px; justify-content: center; }
.row button { min-width: 0; flex: 1; }
.link { margin-top: 8px; color: var(--sub); font-size: 14px; padding: 8px; }
