/* ============ 伟人商店 · 样式 ============ */
:root {
  --bg: #07090a;
  --bg2: #0d1113;
  --panel: #101619;
  --panel2: #141c20;
  --line: #1e2a30;
  --green: #79c07f;
  --green-dim: #3f6b46;
  --red: #c0453e;
  --amber: #d4a017;
  --ink: #c8d6cf;
  --ink-dim: #7a8b85;
  --font: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
  --mono: "Consolas", "Courier New", monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  overflow: hidden;
}

button { font-family: var(--font); cursor: pointer; }
.hidden { display: none !important; }
.dim { color: var(--ink-dim); }
b { color: #fff; }

/* ---------- CRT 效果 ---------- */
.crt-overlay {
  position: fixed; inset: 0; pointer-events: none; z-index: 90;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,.18) 0 1px, transparent 1px 3px);
  mix-blend-mode: multiply;
}
.vignette {
  position: fixed; inset: 0; pointer-events: none; z-index: 91;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,.75) 100%);
}

@keyframes flicker { 0%,100%{opacity:1} 92%{opacity:1} 93%{opacity:.6} 94%{opacity:1} 97%{opacity:.75} 98%{opacity:1} }
.flicker-slow { animation: flicker 6s infinite; }

/* ---------- 屏幕 ---------- */
.screen {
  position: fixed; inset: 0; display: none; z-index: 1;
}
.screen.active { display: flex; }

/* ---------- 标题画面 ---------- */
#screen-title { align-items: center; justify-content: center; background: radial-gradient(ellipse at 50% 30%, #0c1210 0%, #050706 70%); }
.title-wrap { text-align: center; max-width: 720px; padding: 20px; }
.title-main {
  font-size: clamp(44px, 9vw, 96px);
  letter-spacing: .35em;
  color: #9fdca5;
  text-shadow: 0 0 18px rgba(121,192,127,.55), 0 0 60px rgba(121,192,127,.25);
  font-weight: 900;
}
.title-sub { margin-top: 14px; color: var(--ink-dim); letter-spacing: .2em; font-size: 14px; }
.title-story {
  margin: 28px auto 0; max-width: 560px; min-height: 120px;
  color: var(--ink); line-height: 1.9; font-size: 15px; text-align: left;
  border-left: 3px solid var(--green-dim); padding-left: 16px;
  white-space: pre-line;
}
.title-buttons { margin-top: 26px; display: flex; gap: 16px; justify-content: center; }
.title-foot { margin-top: 30px; color: var(--ink-dim); font-size: 12px; letter-spacing: .1em; }

/* ---------- 按钮 ---------- */
.btn {
  background: var(--panel2); color: var(--ink);
  border: 1px solid var(--line); border-radius: 6px;
  padding: 10px 18px; font-size: 15px;
  transition: all .15s;
  user-select: none;
}
.btn:hover { border-color: var(--green-dim); color: #fff; box-shadow: 0 0 12px rgba(121,192,127,.2); }
.btn:disabled { opacity: .35; cursor: not-allowed; box-shadow: none; }
.btn-big { padding: 14px 34px; font-size: 18px; letter-spacing: .15em; }
.btn-green { background: #14351c; border-color: #2c6b39; color: #9fdca5; }
.btn-green:hover { background: #1b4526; }
.btn-mini { padding: 4px 10px; font-size: 13px; }
.btn-sell { background: #1b3a22; border-color: #35734a; color: #a5e0af; font-weight: 700; padding: 12px 22px; }
.btn-sell:hover { background: #22492b; }
.btn-reject { background: #3a1b1e; border-color: #733535; color: #e0a5a5; font-weight: 700; padding: 12px 22px; }
.btn-reject:hover { background: #492222; }
.tool-btn { padding: 9px 14px; font-size: 14px; }
.tool-btn.used { opacity: .45; border-style: dashed; }

/* ---------- 游戏画面布局 ---------- */
#screen-game { flex-direction: column; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px; background: var(--panel); border-bottom: 1px solid var(--line);
  gap: 10px; flex-wrap: wrap;
}
.topbar-left, .topbar-mid, .topbar-right { display: flex; align-items: center; gap: 8px; }
.hud-chip {
  background: var(--panel2); border: 1px solid var(--line); border-radius: 4px;
  padding: 4px 10px; font-size: 13px; font-family: var(--mono); white-space: nowrap;
}
.hud-chip.money { color: var(--amber); }
.hud-chip.rep { color: var(--green); }
.rep-bar { width: 90px; height: 8px; background: #1a1113; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
#rep-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #733535, #c07f45, #79c07f); transition: width .4s; }

.game-layout {
  flex: 1; display: flex; gap: 12px; padding: 12px 14px; min-height: 0;
}

/* ---------- 客人区 ---------- */
.customer-zone {
  flex: 1.1; display: flex; flex-direction: column; gap: 10px; min-width: 0;
}
.cust-scene {
  flex: 1; position: relative; border: 1px solid var(--line); border-radius: 8px;
  background:
    radial-gradient(ellipse at 50% 20%, rgba(121,192,127,.06), transparent 60%),
    linear-gradient(180deg, #0b1012 0%, #080b0d 100%);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; min-height: 200px;
}
.cust-scene::before {
  content: "伟 人 商 店"; position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  color: rgba(121,192,127,.14); letter-spacing: .5em; font-size: 12px;
}
#avatar { width: min(46vh, 300px); height: auto; image-rendering: pixelated; filter: drop-shadow(0 6px 18px rgba(0,0,0,.6)); }
.cust-shadow { position: absolute; bottom: 26px; width: 180px; height: 22px; left: 50%; transform: translateX(-50%); background: radial-gradient(ellipse, rgba(0,0,0,.65), transparent 70%); }
.nameplate {
  position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
  font-family: var(--mono); font-size: 13px; color: var(--ink-dim);
  border: 1px solid var(--line); background: rgba(10,14,16,.85); padding: 3px 12px; border-radius: 4px;
}
.dialogue {
  min-height: 74px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel); padding: 12px 16px; font-size: 15px; line-height: 1.8;
}
.dialogue::before { content: "💬 "; }

/* ---------- 检查区 ---------- */
.inspect-zone { flex: 1; display: flex; flex-direction: column; gap: 10px; min-width: 320px; max-width: 460px; overflow-y: auto; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.panel-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px; border-bottom: 1px solid var(--line);
  font-size: 13px; color: var(--green); letter-spacing: .08em;
}
.panel-body { padding: 10px 12px; font-size: 14px; line-height: 1.8; }

/* 身份证 */
.id-card {
  margin: 10px; padding: 10px; border-radius: 6px;
  background: linear-gradient(160deg, #1a2327, #131a1e);
  border: 1px solid #2a3a42; font-size: 13px;
  box-shadow: inset 0 0 30px rgba(0,0,0,.5);
}
.id-title { text-align: center; color: #d8c690; letter-spacing: .3em; border-bottom: 1px dashed #3a4a52; padding-bottom: 6px; margin-bottom: 8px; }
.id-body { display: flex; gap: 12px; }
.id-photo { border: 1px solid #3a4a52; background: #0d1316; padding: 2px; align-self: flex-start; }
.id-photo canvas { image-rendering: pixelated; width: 72px; height: auto; display: block; }
.id-fields { display: flex; flex-direction: column; gap: 4px; line-height: 1.5; }
.id-num { margin-top: 8px; font-family: var(--mono); letter-spacing: .12em; color: #b9cdd4; }
.id-dates { margin-top: 4px; color: var(--ink-dim); font-size: 12px; }

/* 盘问 */
.ask-list { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; }
.ask-btn {
  text-align: left; background: var(--panel2); border: 1px solid var(--line); color: var(--ink);
  padding: 8px 12px; border-radius: 6px; font-size: 14px;
}
.ask-btn:hover:not(:disabled) { border-color: var(--green-dim); color: #fff; }
.ask-btn:disabled { opacity: .35; cursor: not-allowed; }
.ask-count { color: var(--amber); font-family: var(--mono); }

/* ---------- 柜台 ---------- */
.counter {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 10px 14px; background: var(--panel); border-top: 2px solid #24313a;
  flex-wrap: wrap;
}
.counter-left { flex: 1; min-width: 180px; }
.want-line { font-size: 15px; color: var(--amber); }
.counter-mid { display: flex; gap: 8px; flex-wrap: wrap; }
.counter-right { display: flex; gap: 10px; }

/* ---------- 阶段画面 ---------- */
#screen-stage { align-items: center; justify-content: center; background: var(--bg); }
.stage-wrap { max-width: 640px; width: 92%; }
#stage-box { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 34px 38px; }

.stage-date { text-align: center; color: var(--ink-dim); letter-spacing: .3em; font-size: 13px; }
.stage-title { text-align: center; font-size: 34px; margin: 12px 0 4px; color: #9fdca5; letter-spacing: .2em; text-shadow: 0 0 16px rgba(121,192,127,.4); }
.stage-desc { margin: 18px 0; line-height: 2; font-size: 15px; }
.stage-stats { font-family: var(--mono); font-size: 14px; line-height: 2; border-top: 1px dashed var(--line); border-bottom: 1px dashed var(--line); padding: 10px 0; margin: 14px 0; }
.stage-buttons { display: flex; gap: 12px; justify-content: center; margin-top: 22px; flex-wrap: wrap; }

.news { border-left: 3px solid var(--amber); padding: 8px 12px; background: rgba(212,160,23,.05); color: #d8c690; font-size: 13px; line-height: 1.8; margin-top: 10px; }
.news::before { content: "📰 今日雾山晚报："; }

.shop-goods { display: flex; flex-direction: column; gap: 10px; margin: 16px 0; }
.goods-item {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 12px 16px;
}
.goods-item.owned { opacity: .5; border-style: dashed; }
.goods-info b { display: block; font-size: 15px; }
.goods-info span { font-size: 12px; color: var(--ink-dim); }
.goods-price { color: var(--amber); font-family: var(--mono); white-space: nowrap; }

/* ---------- 结局 ---------- */
.ending-title { text-align: center; font-size: 40px; letter-spacing: .25em; margin: 10px 0; }
.ending-title.good { color: #9fdca5; text-shadow: 0 0 20px rgba(121,192,127,.5); }
.ending-title.bad { color: #e07a74; text-shadow: 0 0 20px rgba(192,69,62,.5); }
.ending-title.dark { color: #b48ef0; text-shadow: 0 0 20px rgba(120,80,200,.5); }
.ending-ach { margin-top: 16px; font-size: 13px; color: var(--amber); line-height: 1.9; }

/* ---------- 弹窗/浮层 ---------- */
.modal {
  position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,.7);
  display: flex; align-items: center; justify-content: center;
}
.modal-box {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  max-width: 620px; width: 92%; max-height: 86vh; overflow-y: auto; padding: 26px 30px;
}
.modal-title { font-size: 20px; color: var(--green); margin-bottom: 14px; }
.modal-content { font-size: 14px; line-height: 1.9; }
.modal-content ul { margin: 8px 0 8px 20px; }
.modal-content li { margin: 4px 0; }
.modal-content .btn { margin-top: 16px; }

.overlay {
  position: fixed; inset: 0; z-index: 150; background: rgba(0,0,0,.65);
  display: flex; align-items: center; justify-content: center;
}
.feedback-box {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  max-width: 520px; width: 90%; padding: 26px 30px; text-align: center;
}
.fb-verdict { font-size: 26px; font-weight: 900; letter-spacing: .15em; margin-bottom: 10px; }
.fb-verdict.ok { color: #9fdca5; }
.fb-verdict.err { color: #e07a74; }
.fb-detail { line-height: 2; font-size: 15px; }
.fb-quote { margin-top: 12px; color: var(--ink-dim); font-size: 13px; font-style: italic; }
.fb-button { margin-top: 18px; }

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
  .game-layout { flex-direction: column; overflow-y: auto; }
  .inspect-zone { max-width: none; min-width: 0; }
  .cust-scene { min-height: 260px; }
  #avatar { width: min(40vh, 220px); }
}

/* ---------- 检查结果样式 ---------- */
.warn { color: #e07a74; font-weight: 700; text-shadow: 0 0 8px rgba(192,69,62,.35); }
.ok { color: #9fdca5; }
.uv-glow { color: #b48ef0; text-shadow: 0 0 10px rgba(120,80,200,.4); margin-bottom: 6px; }
.mirror-frame {
  display: inline-block; padding: 6px; border: 3px solid #3a4a52; border-radius: 6px;
  background: linear-gradient(160deg, #16202a, #0d141a); margin-bottom: 8px;
  box-shadow: inset 0 0 20px rgba(120,180,255,.08);
}
.mirror-frame canvas { image-rendering: pixelated; width: 120px; height: auto; display: block; filter: brightness(.8) saturate(.7); }

/* ---------- 盘问记录 ---------- */
.ask-log {
  border-left: 2px solid var(--line); padding: 6px 10px; margin-top: 2px;
  background: rgba(255,255,255,.02); border-radius: 0 6px 6px 0; font-size: 14px; line-height: 1.7;
}
.ask-log + .ask-btn { margin-top: 6px; }

/* ---------- 成就提示 ---------- */
.toast {
  position: fixed; top: 20px; right: -400px; z-index: 300;
  background: #1a2327; border: 1px solid var(--amber); color: var(--amber);
  padding: 12px 18px; border-radius: 8px; font-size: 14px;
  box-shadow: 0 4px 24px rgba(0,0,0,.6); transition: right .5s ease; max-width: 340px;
}
.toast.show { right: 20px; }
