/* ECHOFORM — 暗场解谜主题 */

:root {
  --bg: #12100e; --ink: #f4ead9; --soft: #b8a894;
  --line: rgba(232, 217, 190, 0.16); --glass: rgba(24, 20, 16, 0.72); --accent: #e8a24a;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; height: 100%; background: var(--bg); color: var(--ink);
  font-family: "Inter", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  overflow: hidden; -webkit-tap-highlight-color: transparent; overscroll-behavior: none;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
/* 结算面板的玩家名输入框是唯一需要打字的地方，其余界面不让 iPad 弹出选中菜单/输入法 */
#player-name { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.hidden { display: none !important; }
.eyebrow { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--soft); font-weight: 600; }
.glass { background: var(--glass); border: 1px solid var(--line); border-radius: 14px; backdrop-filter: blur(14px) saturate(1.15); -webkit-backdrop-filter: blur(14px) saturate(1.15); }

/* ---------------------------------------------------------------- 触屏移动区：整屏可按下起摇杆，跳跃键单独在右下角常驻 */
.touch-zone { position: fixed; inset: 0; bottom: 92px; z-index: 8; touch-action: none; }

/* 虚拟摇杆：按下点出现，拖动范围内跟手，松手归位——按下在哪，摇杆就在哪，不再是固定的左右半屏 */
.joy-base { position: fixed; width: 92px; height: 92px; margin: -46px 0 0 -46px; border-radius: 50%;
  background: rgba(24, 20, 16, .34); border: 2px solid rgba(232, 217, 190, .28); z-index: 9; pointer-events: none; }
.joy-knob { position: fixed; width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%;
  background: rgba(232, 162, 74, .38); border: 2px solid rgba(232, 162, 74, .6); z-index: 9; pointer-events: none; }

/* ---------------------------------------------------------------- 覆盖层 */
.ov { position: fixed; inset: 0; z-index: 20; display: none; align-items: center; justify-content: center; padding: 20px;
  background: radial-gradient(120% 100% at 50% 0%, rgba(60, 45, 26, .5), rgba(10, 8, 6, .92)); overflow-y: auto; }
.ov.show { display: flex; }
.pnl { width: min(560px, 100%); padding: 26px 24px; border-radius: 20px; animation: rise .28s ease; }
.pnl.wide { width: min(880px, 100%); } .pnl.center { text-align: center; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }

.logo { margin: 6px 0 2px; font-size: clamp(30px, 8vw, 48px); letter-spacing: .1em; font-weight: 800;
  background: linear-gradient(100deg, #f4ead9, #e8a24a 45%, #6a8cff 80%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.zh-title { margin: 0 0 12px; letter-spacing: .6em; font-size: 15px; color: var(--soft); text-indent: .6em; }
.tagline { margin: 0 auto 18px; max-width: 42ch; color: var(--soft); font-size: 14px; line-height: 1.7; }
.pnl-title { margin: 0 0 16px; font-size: 20px; font-weight: 700; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pnl-sub { margin: 10px 0 0; font-size: 12.5px; color: var(--soft); } .pnl-sub.accent { color: var(--accent); }

button { font: inherit; cursor: pointer; }
.b-pri, .b-sec { border-radius: 12px; padding: 13px 20px; font-weight: 700; font-size: 15px; border: 1px solid transparent;
  transition: transform .12s ease, filter .12s ease; }
.b-pri { width: 100%; background: linear-gradient(100deg, #e8a24a, #f4ead9); color: #241a0e; box-shadow: 0 10px 26px rgba(232, 162, 74, .25); }
.b-sec { background: rgba(232, 217, 190, .1); border-color: var(--line); color: var(--ink); }
.b-pri.sm, .b-sec.sm { padding: 9px 16px; font-size: 13.5px; width: auto; }
.b-pri:hover, .b-sec:hover { transform: translateY(-1px); filter: brightness(1.1); }
.b-pri:disabled { opacity: .4; filter: none; transform: none; cursor: not-allowed; }
.row { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; justify-content: center; }
.row > button { flex: 1 1 140px; }
.icon-btn { width: 34px; height: 34px; border-radius: 10px; background: rgba(232, 217, 190, .12); border: 1px solid var(--line); color: var(--ink); font-size: 20px; line-height: 1; }
.text-link { color: var(--accent); text-decoration: none; } .text-link:hover { text-decoration: underline; }
.howto { margin: 18px 0 0; padding: 14px 16px; list-style: none; text-align: left; border-radius: 12px;
  background: rgba(30, 24, 16, .5); border: 1px solid var(--line); font-size: 13px; line-height: 1.9; color: var(--soft); }
.meta-row { margin-top: 16px; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 12px; color: var(--soft); flex-wrap: wrap; }
.meta-dot { opacity: .4; } .meta-row b { color: var(--accent); }

/* ---------------------------------------------------------------- HUD */
.hud { position: fixed; top: 0; left: 0; right: 0; z-index: 12; display: flex; justify-content: space-between; gap: 8px; padding: 10px; pointer-events: none; }
.hud > * { pointer-events: auto; padding: 8px 12px; }
.hud-l { display: flex; align-items: center; gap: 10px; }
.hud-title { display: flex; flex-direction: column; line-height: 1.25; } .hud-title strong { font-size: 15px; }
.hud-r { display: flex; align-items: center; gap: 6px; font-size: 13.5px; }
.hud-r strong { font: 800 15px/1 ui-monospace, monospace; }
.sep { width: 1px; height: 16px; background: var(--line); margin: 0 4px; }

.teach { position: fixed; left: 50%; transform: translateX(-50%); top: 66px; z-index: 11; margin: 0;
  max-width: min(560px, 90vw); padding: 8px 14px; border-radius: 999px; background: rgba(26, 20, 14, .66);
  border: 1px solid var(--line); font-size: 12.5px; color: var(--soft); text-align: center; backdrop-filter: blur(8px); }

.death-prompt { position: fixed; left: 50%; top: 40%; transform: translate(-50%, -50%); z-index: 15;
  padding: 16px 20px; border-radius: 16px; text-align: center; }
.death-prompt p { margin: 0 0 10px; font-size: 14px; }

/* 站点弹幕输入条占着底部正中，控制条靠左，跳跃键单独放右下，两边都避开它 */
.controls { position: fixed; left: 12px; bottom: max(14px, env(safe-area-inset-bottom)); z-index: 12; display: flex; gap: 8px; align-items: center; padding: 8px 12px; touch-action: manipulation; }
.jump-btn { position: fixed; right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); z-index: 12; width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(140deg, #e8a24a, #c9762a); color: #241a0e; font-weight: 800; font-size: 14px; border: none;
  box-shadow: 0 6px 18px rgba(232, 162, 74, .35); transition: transform .08s ease; touch-action: manipulation; }
.jump-btn:active { transform: scale(.9); }

.topright { position: fixed; top: 10px; right: 10px; z-index: 30; }
.chip { padding: 6px 10px; border-radius: 999px; background: rgba(24, 20, 16, .7); border: 1px solid var(--line); color: var(--soft); font-size: 13px; backdrop-filter: blur(8px); }

/* ---------------------------------------------------------------- 章节 / 关卡 */
.chapter-list { display: grid; gap: 18px; max-height: 62vh; overflow-y: auto; padding-right: 4px; }
.chapter header h3 { margin: 0 0 10px; font-size: 15px; }
.chapter.locked { opacity: .45; }
.lv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 8px; }
.lv-cell { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; padding: 10px; border-radius: 12px; text-align: left;
  background: rgba(232, 217, 190, .07); border: 1px solid var(--line); color: var(--ink); transition: all .14s ease; }
.lv-cell:hover:not(:disabled) { background: rgba(232, 217, 190, .16); transform: translateY(-2px); }
.lv-cell.done { border-color: rgba(232, 162, 74, .5); } .lv-cell.locked { opacity: .4; cursor: not-allowed; }
.lv-id { font: 800 11px/1 ui-monospace, monospace; color: var(--accent); } .lv-name { font-size: 13px; font-weight: 600; }
.lv-stars { font-size: 11px; color: #ffd76b; letter-spacing: 2px; }

/* ---------------------------------------------------------------- 商店 / 图鉴 */
#shopBody h4 { margin: 14px 0 8px; font-size: 13px; color: var(--soft); font-weight: 600; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.shop-card { display: flex; flex-direction: column; gap: 5px; align-items: flex-start; padding: 10px; border-radius: 12px; text-align: left;
  background: rgba(232, 217, 190, .07); border: 1px solid var(--line); color: var(--ink); }
.shop-card.on { border-color: var(--accent); background: rgba(232, 162, 74, .14); }
.shop-card b { font-size: 13px; } .shop-card i { font-style: normal; font-size: 11px; color: var(--soft); }
.shard-tag { font-size: 12px; font-weight: 600; color: var(--soft); } .shard-tag b { color: var(--accent); }
.codex { display: grid; gap: 8px; max-height: 60vh; overflow-y: auto; }
.codex-item { padding: 11px 13px; border-radius: 12px; background: rgba(30, 24, 16, .5); border: 1px solid var(--line); }
.codex-item b { font-size: 14px; } .codex-item p { margin: 5px 0 0; font-size: 12.5px; color: var(--soft); line-height: 1.7; }

/* ---------------------------------------------------------------- 结算 */
.stars { font-size: 30px; letter-spacing: 10px; color: rgba(255, 215, 107, .22); margin: 6px 0 12px; }
.stars .star.on { color: #ffd76b; text-shadow: 0 0 18px rgba(255, 215, 107, .7); }
.res-detail { text-align: left; display: grid; gap: 6px; margin-bottom: 14px; }
.res-row { display: flex; align-items: baseline; gap: 8px; padding: 9px 12px; border-radius: 10px;
  background: rgba(30, 24, 16, .5); border: 1px solid var(--line); font-size: 13px; }
.res-row span { color: var(--soft); min-width: 42px; } .res-row b { font: 800 15px/1 ui-monospace, monospace; }
.res-row i { margin-left: auto; font-style: normal; font-size: 11.5px; color: var(--soft); }
.submit-row { display: flex; gap: 8px; margin: 12px 0 6px; }
.text-input { flex: 1; padding: 11px 13px; border-radius: 11px; background: rgba(30, 24, 16, .7); border: 1px solid var(--line); color: var(--ink); font: inherit; font-size: 14px; }
.soft { font-size: 12px; color: var(--soft); min-height: 16px; }
.board-card { margin-top: 12px; padding: 12px; border-radius: 12px; text-align: left; background: rgba(30, 24, 16, .5); border: 1px solid var(--line); }
.card-title { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--soft); margin-bottom: 8px; }
.board-list { display: grid; gap: 5px; }
.board-row { display: grid; grid-template-columns: 30px 1fr auto; gap: 8px; align-items: center; font-size: 12.5px; }
.board-rank { color: var(--accent); font-weight: 700; } .board-name { font-weight: 600; }
.board-meta { font-size: 10.5px; color: var(--soft); } .board-score { font: 800 13px/1 ui-monospace, monospace; }
.board-empty { font-size: 12px; color: var(--soft); }

.toast { position: fixed; left: 50%; bottom: 96px; transform: translate(-50%, 12px); z-index: 40; padding: 10px 16px; border-radius: 999px;
  background: rgba(24, 20, 16, .9); border: 1px solid var(--line); font-size: 13px; color: var(--ink);
  opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; backdrop-filter: blur(10px); max-width: 84vw; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 720px) {
  .hud-r { font-size: 12px; } .hud-r strong { font-size: 13px; }
  .teach { top: 74px; font-size: 12px; }
  .pnl { padding: 20px 16px; }
  .lv-grid { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }
  .controls { gap: 6px; }
}
