:root {
  --bg: #2b1d12;
  --panel: #3a2a1a;
  --line: #5a4630;
  --text: #f0e2c8;
  --muted: #b39a76;
  --gold: #d6a860;
  --green: #7fae6f;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100dvh; background: var(--bg); color: var(--text); font-family: "Noto Serif TC", serif; }

.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

#loading {
  min-height: 100dvh; display: flex; align-items: center; justify-content: center;
  font-size: 20px; letter-spacing: 0.2em;
}

.view { max-width: 1100px; margin: 0 auto; padding: 12px 14px calc(20px + env(safe-area-inset-bottom, 0)); }

.topbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 6px 0 12px; }
.topbar h1 { font-size: 22px; margin: 0; color: var(--gold); letter-spacing: 0.12em; }
.topbar h2 { font-size: 18px; margin: 0; color: var(--gold); }

/* 地圖 */
.map-wrap { position: relative; border: 2px solid var(--line); border-radius: 8px; overflow: hidden; }
.map-wrap img { display: block; width: 100%; }
#map-hotspots { position: absolute; inset: 0; }
.hotspot {
  position: absolute; transform: translate(-50%, -50%);
  min-width: 54px; padding: 8px 10px;
  font-family: inherit; font-size: 13px; font-weight: 700;
  color: var(--bg); background: var(--gold);
  border: 2px solid #fff3; border-radius: 20px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,.5);
  animation: hotspot-breathe 2s ease-in-out infinite;
}
.hotspot.done { background: var(--green); animation: none; }
.hotspot-name { display: block; font-size: 12px; }
@keyframes hotspot-breathe { 0%,100% { transform: translate(-50%,-50%) scale(1); } 50% { transform: translate(-50%,-50%) scale(1.07); } }

.hint { text-align: center; color: var(--muted); font-size: 13px; }

/* 場景 */
#scene-checklist { display: flex; gap: 8px; flex-wrap: wrap; list-style: none; margin: 0; padding: 0; margin-left: auto; }
#scene-checklist li {
  padding: 4px 10px; font-size: 13px;
  border: 1px solid var(--line); border-radius: 14px; color: var(--text);
  background: var(--panel);
}
#scene-checklist li.found { color: var(--bg); background: var(--green); border-color: var(--green); text-decoration: line-through; }

.canvas-wrap {
  border: 2px solid var(--line);
  border-radius: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
/* 可見的金色細滾軸（iOS 預設會藏，styled 版直立模式也看得到） */
.canvas-wrap::-webkit-scrollbar { height: 8px; }
.canvas-wrap::-webkit-scrollbar-track { background: var(--panel); }
.canvas-wrap::-webkit-scrollbar-thumb { background: var(--gold); border-radius: 4px; }
.canvas-wrap { scrollbar-color: var(--gold) var(--panel); scrollbar-width: thin; }

#scene-canvas { display: block; width: 100%; height: auto; touch-action: pan-x pan-y; cursor: crosshair; }

.scroll-hint { display: none; text-align: center; color: var(--muted); font-size: 12px; margin: 6px 0 0; }

/* 手機直立：場景 200% 寬、左右拖曳平移，道具維持可點大小 */
@media (max-width: 700px) {
  #scene-canvas { width: 200%; }
  .scroll-hint { display: block; }
}
#scene-canvas.shake { animation: shake 0.25s ease; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

.btn-ghost {
  padding: 8px 12px; font-family: inherit; font-size: 14px;
  color: var(--gold); background: none; border: 1px solid var(--gold); border-radius: 6px; cursor: pointer;
}

/* 結果 */
#view-result { display: flex; min-height: 90dvh; align-items: center; justify-content: center; }
.result-card {
  max-width: 420px; width: 100%; text-align: center;
  background: var(--panel); border: 2px solid var(--gold); border-radius: 10px;
  padding: 30px 24px;
  box-shadow: 0 20px 60px rgba(0,0,0,.55);
}
.kicker { letter-spacing: 0.3em; font-size: 12px; color: var(--muted); margin: 0 0 8px; }
#result-label { font-size: 30px; margin: 0 0 14px; color: var(--gold); }
#result-stats { font-size: 15px; }
#result-stats b { color: var(--gold); }
.btn-primary {
  margin-top: 18px; padding: 12px 28px;
  font-family: inherit; font-size: 16px; font-weight: 700; letter-spacing: 0.15em;
  color: var(--bg); background: var(--gold);
  border: none; border-radius: 6px; cursor: pointer;
}
