/* style.css — Needle in a Haystack */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: ui-rounded, "SF Pro Rounded", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: #1a1206;
  color: #f5ead2;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap; border: 0;
}

/* ---- 全屏界面 ---- */
.screen {
  position: fixed; inset: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 40%, rgba(40,26,8,0.55), rgba(12,8,3,0.88));
  padding: 16px;
}
.panel {
  text-align: center;
  max-width: 420px; width: 100%;
  max-height: 92vh; overflow-y: auto;
  background: rgba(28, 19, 7, 0.82);
  border: 1px solid rgba(214, 170, 90, 0.35);
  border-radius: 18px;
  padding: 26px 24px;
  backdrop-filter: blur(8px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

/* ---- 标题屏：可滚动内容页（游戏面板 + 介绍/FAQ/页脚）---- */
#title-screen { display: block; overflow-y: auto; padding: 24px 16px; }
#title-screen.hidden { display: none !important; }
.title-scroll { max-width: 460px; margin: 0 auto; }
.title-scroll .panel { max-height: none; margin: 0 auto 16px; }
.info-panel { text-align: left; font-size: 14px; line-height: 1.65; color: #d8c49a; }
.info-panel h2 { color: #f0c662; font-size: 19px; margin-bottom: 8px; text-align: center; }
.info-panel h3 { color: #e8cf9a; font-size: 14.5px; margin: 12px 0 2px; }
.info-panel p { margin: 8px 0; }
.info-panel strong { color: #ffe9a8; }
.site-footer { text-align: center; font-size: 12px; color: #77663f; line-height: 1.7; padding: 4px 0 20px; }
.logo {
  font-size: 34px; letter-spacing: 3px; line-height: 1.05;
  color: #f0c662;
  text-shadow: 0 3px 0 #6a4a10, 0 6px 18px rgba(0,0,0,0.6);
  margin-bottom: 14px;
}
.logo span { display: block; font-size: 14px; letter-spacing: 8px; color: #c8a05a; margin: 4px 0; }
.tagline { color: #cbb37f; margin-bottom: 10px; }
.day { font-size: 12px; color: #8f7a4e; margin-bottom: 14px; }

button {
  font: inherit; color: inherit; cursor: pointer;
  border: none; background: none;
}
button.big {
  display: block; width: 100%; margin: 8px 0;
  padding: 14px; font-size: 19px; font-weight: 800;
  color: #2a1c05; background: linear-gradient(180deg, #f0c662, #d09c36);
  border-radius: 14px;
  box-shadow: 0 4px 0 #8a6420, 0 8px 20px rgba(0,0,0,0.4);
  transition: transform 0.08s, box-shadow 0.08s;
}
button.big:active { transform: translateY(3px); box-shadow: 0 1px 0 #8a6420; }
button.big.hard { background: linear-gradient(180deg, #9a6ab0, #5a2a70); color: #f4e8ff; box-shadow: 0 4px 0 #3a1548, 0 8px 20px rgba(0,0,0,0.4); }
button.link { color: #c8a05a; text-decoration: underline; margin-top: 6px; font-size: 14px; }
button.link.dev { display: block; margin: 4px auto 0; color: #6a8aba; font-size: 12px; }

#board-panel { max-height: 0; overflow: hidden; transition: max-height 0.3s; }
#board-panel.open { max-height: 360px; }
.board-modes { display: flex; margin-top: 12px; border: 1px solid rgba(214, 170, 90, 0.4); border-radius: 6px; }
.board-modes button { flex: 1; min-height: 34px; font-size: 13px; color: #c8a05a; }
.board-modes button.active { color: #1a1206; background: #f0c662; font-weight: 800; }
#board-list, #win-board { margin: 10px 0; font-size: 14px; }
#board-list { max-height: 284px; overflow-y: auto; }
.row { display: flex; gap: 10px; justify-content: space-between; padding: 3px 14px; color: #d8c49a; }
.row.me { color: #ffd968; font-weight: 800; }
.row .tag { font-weight: 800; letter-spacing: 2px; }
.row.empty { justify-content: center; color: #8f7a4e; }
.best { margin-top: 10px; font-size: 13px; color: #a8e06a; }
.controls-hint { margin-top: 14px; font-size: 11px; color: #77663f; line-height: 1.7; }

/* ---- HUD ---- */
#hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
#top-bar {
  position: absolute; top: max(10px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  display: flex; gap: 18px; align-items: center;
  font-size: 17px; font-weight: 700;
  background: rgba(20, 13, 5, 0.55); border-radius: 999px;
  padding: 8px 20px; backdrop-filter: blur(4px);
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}
#timer { font-variant-numeric: tabular-nums; color: #ffe9a8; min-width: 74px; }
#mute-icon { font-size: 14px; opacity: 0.8; }
#btn-pause {
  display: none;
  pointer-events: auto;
  font-size: 15px; line-height: 1;
  padding: 4px 6px; border-radius: 8px;
  background: rgba(255,255,255,0.12);
}
body.touch #btn-pause { display: block; }

#crosshair {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 8px; height: 8px; border-radius: 50%;
  background: rgba(255, 240, 200, 0.9);
  box-shadow: 0 0 6px rgba(0,0,0,0.6);
}
#crosshair.hot { animation: pulse 0.4s infinite alternate; }
@keyframes pulse { from { transform: translate(-50%,-50%) scale(1); } to { transform: translate(-50%,-50%) scale(2.2); } }
#heat-wrap {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 5px; height: 46px; border-radius: 3px;
  background: rgba(0,0,0,0.45); overflow: hidden;
  display: flex; align-items: flex-end;
}
#heat-fill { width: 100%; height: 0%; background: #ffe9a8; transition: height 0.15s; }

#message {
  position: absolute; left: 50%; top: 22%; transform: translateX(-50%);
  font-size: 20px; font-weight: 800; color: #ffe9a8;
  text-shadow: 0 2px 8px rgba(0,0,0,0.9);
  opacity: 0; transition: opacity 0.3s; white-space: nowrap;
}
#message.show { opacity: 1; }
#hint {
  position: absolute; left: 50%; bottom: 18%; transform: translateX(-50%);
  font-size: 15px; color: #d8c49a; text-shadow: 0 1px 4px #000;
  opacity: 0; transition: opacity 0.3s;
}
#hint.show { opacity: 1; }

#minimap {
  position: absolute; right: 14px; bottom: calc(14px + env(safe-area-inset-bottom));
  width: 150px; height: 150px;
  background: rgba(16, 11, 5, 0.62);
  border: 1px solid rgba(214, 170, 90, 0.45);
  border-radius: 50%;
  backdrop-filter: blur(3px);
  pointer-events: auto;
  cursor: pointer;
}
#minimap.mini { width: 44px; height: 44px; opacity: 0.75; }
body.touch #minimap { width: 110px; height: 110px; right: auto; left: 50%; transform: translateX(-50%); bottom: calc(150px + env(safe-area-inset-bottom)); }
body.touch #minimap.mini { width: 40px; height: 40px; }

/* ---- 触屏 ---- */
#joystick {
  position: fixed; left: 26px; bottom: calc(26px + env(safe-area-inset-bottom)); z-index: 15;
  width: 120px; height: 120px; border-radius: 50%;
  background: rgba(255, 235, 190, 0.08);
  border: 2px solid rgba(255, 235, 190, 0.25);
}
#joy-knob {
  position: absolute; left: 50%; top: 50%; margin: -26px;
  width: 52px; height: 52px; border-radius: 50%;
  background: rgba(240, 198, 98, 0.55);
}
#btn-blow, #btn-jump {
  position: fixed; z-index: 15;
  width: 76px; height: 76px; border-radius: 50%;
  font-weight: 800; font-size: 14px; color: #2a1c05;
  background: rgba(240, 198, 98, 0.75);
  border: 2px solid rgba(255,255,255,0.3);
}
#btn-blow { right: 26px; bottom: calc(96px + env(safe-area-inset-bottom)); }
#btn-jump { right: 116px; bottom: calc(26px + env(safe-area-inset-bottom)); background: rgba(200, 210, 230, 0.6); }
body:not(.touch) #joystick, body:not(.touch) #btn-blow, body:not(.touch) #btn-jump { display: none; }

/* ---- 分享图预览 ---- */
.overlay {
  position: fixed; inset: 0; z-index: 40;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10, 6, 2, 0.72); padding: 16px;
}
.share-panel { max-width: 340px; }
#share-img {
  width: 100%; border-radius: 12px; margin: 10px 0;
  border: 1px solid rgba(214, 170, 90, 0.4);
  box-shadow: 0 8px 30px rgba(0,0,0,0.5);
}
.share-tip { font-size: 13px; color: #b09a6a; margin-bottom: 10px; }

/* ---- 结算 ---- */
.win-title { font-size: 26px; margin-bottom: 4px; }
.win-time { font-size: 46px; font-weight: 900; color: #ffd968; font-variant-numeric: tabular-nums; margin: 6px 0; }
.win-rank { color: #a8e06a; font-weight: 700; margin-bottom: 6px; }
.quip { color: #b09a6a; font-style: italic; margin-bottom: 10px; }
.share-row { display: flex; gap: 8px; justify-content: center; margin: 12px 0; flex-wrap: wrap; }
.tag-save-row { display: flex; gap: 8px; justify-content: center; align-items: center; margin: 12px 0 4px; }
#win-tag {
  width: 220px; max-width: 60%; padding: 8px; text-align: center;
  font-size: 17px; font-weight: 800; letter-spacing: 1px;
  color: #f0c662; background: rgba(0,0,0,0.4);
  border: 2px dashed rgba(214,170,90,0.5); border-radius: 10px;
  outline: none;
}
#btn-save-score {
  padding: 9px 16px; border-radius: 10px; font-weight: 800; font-size: 14px;
  color: #2a1c05; background: linear-gradient(180deg, #f0c662, #d09c36);
  box-shadow: 0 3px 0 #8a6420;
}
#btn-save-score:disabled { opacity: 0.6; box-shadow: none; }
.share-row button {
  padding: 9px 14px; border-radius: 10px; font-weight: 700; font-size: 13px;
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2);
}
.share-row button:hover { background: rgba(255,255,255,0.2); }

@media (max-width: 480px) {
  .logo { font-size: 26px; }
  #top-bar { font-size: 14px; gap: 12px; padding: 6px 14px; }
}
