/* ==================================================================
   风动石 · 真相探究团 —— 玩家端 H5 样式
   移动端优先，案卷纸质风 / 墨蓝 + 朱红 + 鎏金
   ================================================================== */

:root {
  --paper:      #F3EFE7;
  --paper-2:    #EAE5DA;
  --card:       #FFFFFF;
  --ink:        #1B2637;
  --ink-2:      #5B6577;
  --ink-3:      #8A94A6;
  --line:       #E7E2D7;
  --line-2:     #F0ECE4;
  --brand:      #1F3A5F;
  --brand-2:    #2C5285;
  --gold:       #C8A15A;
  --gold-deep:  #A88341;
  --red:        #B3301F;
  --green:      #1E8E4E;
  --shadow:     0 2px 10px rgba(27, 38, 55, .06);
  --shadow-lg:  0 8px 28px rgba(27, 38, 55, .16);
  --radius:     12px;
  --safe-b:     env(safe-area-inset-bottom, 0px);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  background: var(--paper);
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Hiragino Sans GB", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

body { min-height: 100vh; }

img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input { font-family: inherit; }

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--paper);
  position: relative;
  overflow-x: hidden;
}

[hidden] { display: none !important; }

/* ======================= 通用按钮 ======================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 44px; padding: 0 18px; border-radius: 10px;
  font-size: 15px; font-weight: 600; letter-spacing: .5px;
  transition: transform .12s ease, opacity .12s ease, box-shadow .12s ease;
}
.btn:active { transform: scale(.975); opacity: .9; }
.btn[disabled] { opacity: .45; pointer-events: none; }

.btn-block { display: flex; width: 100%; }
.btn-sm { height: 36px; padding: 0 14px; font-size: 13.5px; border-radius: 8px; }

.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 4px 14px rgba(31, 58, 95, .25); }
.btn-gold    { background: linear-gradient(135deg, #D8B878, var(--gold-deep)); color: #fff;
               box-shadow: 0 4px 14px rgba(168, 131, 65, .32); }
.btn-plain   { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn-danger  { background: var(--red); color: #fff; }
.btn-link    { background: none; color: var(--ink-3); font-size: 13px; height: 38px; font-weight: 500; text-decoration: underline; }

/* ======================= 页面 1：登录 ======================= */
.page-login { min-height: 100vh; position: relative; }

.login-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(120% 60% at 50% 0%, #2C5285 0%, #1F3A5F 42%, #14263C 100%);
}
.login-bg::after {
  content: ""; position: absolute; inset: 0; opacity: .13;
  background-image:
    repeating-linear-gradient(0deg, transparent 0 38px, rgba(255,255,255,.55) 38px 39px),
    repeating-linear-gradient(90deg, transparent 0 38px, rgba(255,255,255,.35) 38px 39px);
}
.login-inner { position: relative; padding: 46px 22px 32px; min-height: 100vh; display: flex; flex-direction: column; }

.login-brand { text-align: center; color: #fff; margin-bottom: 26px; }
.login-seal {
  width: 60px; height: 60px; margin: 0 auto 14px; border-radius: 14px;
  background: linear-gradient(135deg, #E0C48C, var(--gold-deep));
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; font-weight: 700; color: #46331A;
  box-shadow: 0 8px 22px rgba(0,0,0,.28);
  transform: rotate(-4deg);
}
.login-title { font-size: 22px; font-weight: 700; letter-spacing: 1.5px; }
.login-sub { font-size: 12.5px; color: #B9C7DC; margin-top: 6px; letter-spacing: 2px; }

.login-card {
  background: var(--card); border-radius: 16px; padding: 20px 18px 22px;
  box-shadow: var(--shadow-lg);
}
.form-label { font-size: 13px; color: var(--ink-3); margin-bottom: 10px; letter-spacing: .5px; }
.form-label + .form-label { margin-top: 20px; }

.group-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.gitem {
  height: 52px; border-radius: 10px; border: 1.5px solid var(--line);
  background: #FCFBF8; display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 600; color: var(--ink-2); transition: all .15s ease;
}
.gitem small { display: block; font-size: 10.5px; font-weight: 400; color: var(--ink-3); margin-top: 1px; }
.gitem.on {
  background: var(--brand); border-color: var(--brand); color: #fff;
  box-shadow: 0 4px 12px rgba(31,58,95,.28);
}
.gitem.on small { color: #C7D6EA; }

.code-wrap { position: relative; margin-top: 2px; }
.code-boxes { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.cbox {
  height: 48px; border-radius: 10px; border: 1.5px solid var(--line); background: #FCFBF8;
  display: flex; align-items: center; justify-content: center;
  font-size: 21px; font-weight: 700; color: var(--ink);
}
.cbox.filled { border-color: var(--brand); background: #F4F8FE; }
.code-input {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; font-size: 16px; letter-spacing: 40px; border: none; outline: none;
  background: transparent; cursor: text;
}

.login-err { min-height: 18px; margin: 10px 0 2px; font-size: 12.5px; color: var(--red); text-align: center; }
.login-card .btn-block { margin-top: 12px; height: 48px; font-size: 16px; letter-spacing: 3px; }

.login-foot { margin-top: auto; padding-top: 26px; text-align: center; font-size: 12px; color: #93A6C0; }

/* ======================= 顶栏 ======================= */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; background: var(--brand); color: #fff;
  box-shadow: 0 2px 10px rgba(20,38,60,.18);
}
.tb-back { width: 30px; height: 30px; font-size: 26px; line-height: 1; color: #fff; flex: none; margin-left: -4px; }
.tb-left { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tb-group { font-size: 15.5px; font-weight: 700; letter-spacing: .5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-tip { font-size: 11px; color: #AFC1D8; }
.tb-right { flex: none; text-align: right; display: flex; flex-direction: column; align-items: flex-end; }
.tb-pt-label { font-size: 10.5px; color: #AFC1D8; letter-spacing: 1px; }
.tb-pt { font-size: 21px; font-weight: 800; color: var(--gold); line-height: 1.1; font-variant-numeric: tabular-nums; }

/* ======================= 统计条 ======================= */
.stat {
  display: flex; align-items: center; background: var(--card);
  border-bottom: 1px solid var(--line); padding: 12px 0;
}
.stat-item { flex: 1; text-align: center; }
.stat-item b { display: block; font-size: 19px; font-weight: 800; color: var(--brand); font-variant-numeric: tabular-nums; }
.stat-item span { font-size: 11.5px; color: var(--ink-3); }
.stat-sep { width: 1px; height: 26px; background: var(--line); }

.notice {
  margin: 12px 14px 0; padding: 9px 12px; border-radius: 8px;
  background: #FBF6E9; border: 1px solid #EFE3C6;
  font-size: 12.5px; color: var(--gold-deep); line-height: 1.5;
}

/* ======================= 点位列表 ======================= */
.spot-list, .clue-list { padding: 12px 14px; display: flex; flex-direction: column; gap: 11px; }

.spot-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px; display: flex; align-items: center; gap: 12px;
  border-left: 4px solid var(--brand); transition: transform .12s ease;
}
.spot-card:active { transform: scale(.988); }
.spot-card.done { border-left-color: var(--green); }
.spot-idx {
  width: 40px; height: 40px; flex: none; border-radius: 10px;
  background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 800;
}
.spot-card.done .spot-idx { background: var(--green); }
.spot-main { flex: 1; min-width: 0; }
.spot-name { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 7px; }
.spot-meta { font-size: 12px; color: var(--ink-3); margin-top: 3px; }
.spot-side { flex: none; text-align: right; }
.spot-total { font-size: 15px; font-weight: 800; color: var(--gold-deep); }
.spot-total i { font-style: normal; font-size: 11px; font-weight: 500; color: var(--ink-3); margin-left: 1px; }
.spot-flag { font-size: 11px; margin-top: 3px; color: var(--ink-3); }
.spot-flag.done { color: var(--green); font-weight: 600; }

/* ======================= 线索卡片 ======================= */
.clue-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px; display: flex; gap: 12px; align-items: flex-start;
}
.clue-card.owned { background: #FCFAF3; }
.clue-badge {
  width: 44px; height: 44px; flex: none; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff; background: var(--ink-3);
}
.clue-badge.lv-1 { background: #6B7A8D; }
.clue-badge.lv-2 { background: var(--brand-2); }
.clue-badge.lv-3 { background: var(--red); }
.clue-main { flex: 1; min-width: 0; }
.clue-name { font-size: 16px; font-weight: 700; letter-spacing: .5px; }
.clue-form { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.clue-desc { font-size: 12.5px; color: var(--ink-2); margin-top: 7px; line-height: 1.6; }
.clue-side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; min-width: 74px; }
.clue-cost { font-size: 16px; font-weight: 800; color: var(--gold-deep); font-variant-numeric: tabular-nums; }
.clue-cost i { font-style: normal; font-size: 11px; color: var(--ink-3); font-weight: 500; }
.tag-owned { font-size: 12px; color: var(--green); font-weight: 700; }
.tag-lock { font-size: 11px; color: var(--ink-3); }

/* ======================= 线索详情 ======================= */
.clue-detail { padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.cd-head {
  background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
}
.cd-title { font-size: 20px; font-weight: 800; letter-spacing: 1px; }
.cd-chips { display: flex; gap: 7px; margin-top: 10px; flex-wrap: wrap; }
.chip {
  height: 24px; padding: 0 10px; border-radius: 20px; display: inline-flex; align-items: center;
  font-size: 12px; font-weight: 600; background: var(--paper-2); color: var(--ink-2);
}
.chip.lv-1 { background: #EDF0F3; color: #5A6675; }
.chip.lv-2 { background: #E8F0FB; color: var(--brand-2); }
.chip.lv-3 { background: #FBE9E6; color: var(--red); }
.chip.gold { background: #F8F0DF; color: var(--gold-deep); }
.cd-desc { margin-top: 12px; font-size: 14px; line-height: 1.75; color: var(--ink-2); }
.cd-content { margin-top: 10px; font-size: 14px; line-height: 1.8; color: var(--ink); white-space: pre-wrap; }

.cd-sec-title {
  font-size: 13px; font-weight: 700; color: var(--ink-2);
  display: flex; align-items: center; gap: 8px; margin: 2px 0 -2px;
}
.cd-sec-title::before { content: ""; width: 3px; height: 14px; background: var(--gold); border-radius: 2px; }

.cd-img {
  background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
}
.cd-img img { width: 100%; }
.cd-img .ci-cap { padding: 9px 12px; font-size: 12px; color: var(--ink-3); border-top: 1px solid var(--line-2); }

.cd-original {
  background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
}
.co-frame { width: 100%; overflow: hidden; position: relative; }
.co-frame iframe { position: absolute; left: 0; top: 0; border: 0; transform-origin: 0 0; pointer-events: none; }
.co-foot {
  padding: 10px 12px; border-top: 1px solid var(--line-2);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.co-foot span { font-size: 12px; color: var(--ink-3); }

/* ======================= 底部固定按钮 ======================= */
.pbtm {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: linear-gradient(180deg, rgba(243,239,231,0), var(--paper) 38%);
  padding: 10px 14px calc(10px + var(--safe-b));
  pointer-events: none;
}
.pbtm .btn { pointer-events: auto; max-width: 452px; margin: 0 auto; height: 50px; font-size: 16px; }
.pbtm-ico { font-size: 15px; }
.pbtm-count {
  min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: rgba(255,255,255,.28);
  font-size: 12.5px; display: inline-flex; align-items: center; justify-content: center;
}
.pb-space { height: 88px; }

/* ======================= 打卡弹层 ======================= */
.sheet-mask {
  position: fixed; inset: 0; z-index: 60; background: rgba(15, 25, 40, .5);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fadeIn .18s ease;
}
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes slideUp { from { transform: translateY(100%) } to { transform: translateY(0) } }
.sheet {
  width: 100%; max-width: 480px; background: var(--paper);
  border-radius: 16px 16px 0 0; padding-bottom: calc(14px + var(--safe-b));
  animation: slideUp .22s cubic-bezier(.2,.8,.3,1);
  max-height: 88vh; overflow-y: auto;
}
.sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 18px 8px;
}
.sheet-head b { font-size: 16.5px; }
.sheet-close { font-size: 18px; color: var(--ink-3); padding: 2px 4px; }
.sheet-body { padding: 4px 18px 8px; }
.sheet-tip { font-size: 12.5px; color: var(--ink-3); margin-bottom: 12px; }

.photo-box {
  width: 100%; aspect-ratio: 4 / 3; border-radius: 12px; border: 2px dashed #D6CEBE;
  background: #FCFBF8; overflow: hidden; position: relative;
  display: flex; align-items: center; justify-content: center;
}
.photo-box img { width: 100%; height: 100%; object-fit: cover; }
.photo-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--ink-3); font-size: 13px; }
.photo-ico { font-size: 30px; color: #CFC6B4; line-height: 1; }
.photo-actions { display: flex; gap: 10px; margin-top: 12px; }
.sheet-err { min-height: 18px; margin-top: 8px; font-size: 12.5px; color: var(--red); text-align: center; }
.sheet-body .btn-primary { margin-top: 10px; }

/* ======================= 汇总弹窗 ======================= */
.modal {
  position: fixed; inset: 0; z-index: 70; background: rgba(15, 25, 40, .55);
  display: flex; align-items: center; justify-content: center; padding: 18px;
  animation: fadeIn .18s ease;
}
.modal-inner {
  width: 100%; max-width: 460px; max-height: 86vh; background: var(--paper);
  border-radius: 16px; display: flex; flex-direction: column; overflow: hidden;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 16px 10px; border-bottom: 1px solid var(--line);
}
.modal-head b { font-size: 16.5px; }
.modal-close { font-size: 18px; color: var(--ink-3); }
.modal-sub { padding: 10px 16px; font-size: 12.5px; color: var(--ink-3); background: #FBF8F1; }
.modal-body { flex: 1; overflow-y: auto; padding: 12px 14px; -webkit-overflow-scrolling: touch; }
.modal-foot {
  padding: 12px 14px calc(12px + var(--safe-b)); border-top: 1px solid var(--line);
  display: flex; gap: 10px;
}
.modal-foot .btn { flex: 1; }

.sum-spot { margin-bottom: 12px; }
.sum-spot-h {
  display: flex; align-items: center; gap: 8px; margin-bottom: 7px;
  font-size: 13.5px; font-weight: 700; color: var(--brand);
}
.sum-spot-h::before { content: ""; width: 3px; height: 13px; background: var(--brand); border-radius: 2px; }
.sum-item {
  background: var(--card); border-radius: 9px; padding: 10px 12px; margin-bottom: 6px;
  display: flex; align-items: center; gap: 10px; box-shadow: 0 1px 4px rgba(27,38,55,.05);
}
.sum-item .si-lv {
  flex: none; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 5px;
  background: var(--paper-2); color: var(--ink-2);
}
.sum-item .si-lv.lv-2 { background: #E8F0FB; color: var(--brand-2); }
.sum-item .si-lv.lv-3 { background: #FBE9E6; color: var(--red); }
.sum-item .si-name { flex: 1; font-size: 14px; font-weight: 600; }
.sum-item .si-cost { font-size: 12.5px; color: var(--gold-deep); font-weight: 700; }
.sum-empty { text-align: center; color: var(--ink-3); font-size: 13.5px; padding: 40px 0; }

/* ======================= 查看器 ======================= */
.viewer { position: fixed; inset: 0; z-index: 90; background: #0E1522; display: flex; flex-direction: column; }
.viewer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; color: #fff; font-size: 14px; background: rgba(0,0,0,.3);
}
.viewer-close { color: #fff; font-size: 19px; }
.viewer-body { flex: 1; overflow: auto; -webkit-overflow-scrolling: touch; background: #0E1522; }
.viewer-inner { position: relative; overflow: hidden; margin: 0 auto; }
.viewer-inner iframe { position: absolute; left: 0; top: 0; border: 0; transform-origin: 0 0; }
.viewer-inner img { width: 100%; }
.viewer-foot {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 10px 16px calc(10px + var(--safe-b)); background: rgba(0,0,0,.35);
}
.vbtn {
  min-width: 42px; height: 36px; padding: 0 12px; border-radius: 8px;
  background: rgba(255,255,255,.14); color: #fff; font-size: 15px; font-weight: 600;
}
.vbtn-wide { font-size: 13px; }
.vscale { color: #C9D4E4; font-size: 13px; min-width: 52px; text-align: center; font-variant-numeric: tabular-nums; }

/* ======================= Toast ======================= */
.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%);
  z-index: 120; max-width: 82%; padding: 11px 18px; border-radius: 22px;
  background: rgba(20, 30, 46, .93); color: #fff; font-size: 13.5px; text-align: center;
  box-shadow: var(--shadow-lg); animation: fadeIn .18s ease;
}

/* ======================= 空状态 ======================= */
.empty { text-align: center; padding: 60px 20px; color: var(--ink-3); font-size: 13.5px; }
.empty-ico { font-size: 34px; display: block; margin-bottom: 10px; opacity: .5; }
