/* ==========================================================
   财富的深渊 — 对话系统 & 谜题样式
   ========================================================== */

/* ============ 对话面板 ============ */
.dialog-panel { inset: 0; display: flex; align-items: flex-end; }
.dialog-backdrop {
  position: absolute; inset: 0;
  background: rgba(4, 6, 10, .55);
  backdrop-filter: blur(2px);
  cursor: pointer;
}
.dialog-window {
  position: relative; z-index: 2;
  width: 100%;
  display: flex;
  gap: 18px;
  padding: 20px 26px 24px;
  background: linear-gradient(0deg, rgba(9, 12, 19, .97) 0%, rgba(12, 16, 25, .92) 82%, transparent);
  border-top: 1px solid var(--border);
  animation: dialogUp .35s ease;
  max-height: 60vh;
  align-items: flex-end;
}
@keyframes dialogUp { from { transform: translateY(100%); } to { transform: none; } }

.dialog-portrait {
  flex-shrink: 0;
  width: 128px; height: 170px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 8px 30px rgba(0, 0, 0, .5);
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.dialog-portrait img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}
.dialog-portrait .no-img { font-size: 40px; opacity: .5; }
.dialog-portrait .portrait-glow {
  position: absolute; inset: 0;
  background: linear-gradient(0deg, rgba(10, 14, 20, .75), transparent 45%);
  pointer-events: none;
}

.dialog-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.dialog-name {
  font-family: var(--font-serif);
  font-size: 17px; font-weight: 700;
  letter-spacing: 2px;
  color: var(--accent);
  display: flex; align-items: center; gap: 10px;
}
.dialog-relation {
  font-size: 11.5px;
  color: var(--text-faint);
  margin: 2px 0 10px;
  letter-spacing: 1px;
}
.dialog-text {
  font-size: 15px;
  line-height: 1.9;
  min-height: 64px;
  color: #dfe7ef;
  letter-spacing: .5px;
  cursor: pointer;
  user-select: none;
}
.dialog-text .caret::after {
  content: "▍";
  color: var(--amber);
  animation: caretBlink .8s steps(1) infinite;
  margin-left: 2px;
}
@keyframes caretBlink { 50% { opacity: 0; } }
.dialog-text.multiline-quote {
  font-style: italic;
  color: #c8d3de;
  border-left: 3px solid var(--amber-dim);
  padding-left: 14px;
}

.dialog-choices {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}
.dialog-choice {
  text-align: left;
  padding: 11px 16px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 9px;
  font-size: 14px;
  color: var(--text);
  letter-spacing: .5px;
  transition: all .18s ease;
  animation: choiceIn .3s ease both;
}
.dialog-choice:hover {
  border-color: var(--accent);
  background: rgba(77, 208, 225, .08);
  transform: translateX(4px);
}
.dialog-choice .choice-tag {
  font-size: 11px;
  color: var(--amber);
  margin-left: 8px;
  letter-spacing: 1px;
}
.dialog-choice:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@keyframes choiceIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; } }

.dialog-continue {
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-faint);
  letter-spacing: 2px;
  cursor: pointer;
  user-select: none;
  animation: continuePulse 1.4s ease-in-out infinite;
  align-self: flex-start;
}
@keyframes continuePulse { 0%, 100% { opacity: .4; } 50% { opacity: 1; } }

@media (max-width: 720px) {
  .dialog-portrait { width: 84px; height: 116px; }
  .dialog-window { padding: 14px 14px 18px; gap: 12px; }
  .dialog-text { font-size: 14px; }
}

/* ============ 谜题面板 ============ */
#puzzle-panel { inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(4, 6, 10, .8); backdrop-filter: blur(4px); }
.puzzle-window {
  width: min(560px, 94vw);
  max-height: 86vh;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: zoomIn .3s ease;
}
.puzzle-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--surface);
}
.puzzle-title { font-family: var(--font-serif); font-weight: 700; letter-spacing: 2px; font-size: 15px; }
.puzzle-desc {
  padding: 14px 22px 4px;
  font-size: 13.5px;
  color: var(--text-dim);
  line-height: 1.8;
}
.puzzle-body { padding: 14px 22px 6px; overflow-y: auto; flex: 1; }
.puzzle-hint-bar { padding: 10px 22px 16px; display: flex; justify-content: flex-end; }

/* --- 数字键盘 --- */
.pw-pad-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 300px; margin: 12px auto 4px; }
.pw-key {
  padding: 16px 0;
  font-size: 20px;
  font-family: var(--font-mono);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  transition: all .12s;
}
.pw-key:hover { background: var(--surface-2); border-color: var(--accent); color: var(--accent); }
.pw-key:active { transform: scale(.94); }
.pw-display {
  font-family: var(--font-mono);
  font-size: 24px;
  letter-spacing: 10px;
  text-align: center;
  padding: 12px;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--amber);
  margin-bottom: 12px;
  min-height: 52px;
}
.pw-actions { display: flex; justify-content: center; gap: 10px; margin: 6px 0 4px; }
.pw-hint-note {
  text-align: center;
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 10px;
  line-height: 1.8;
}
.pw-hint-note .hint-link { color: var(--amber); cursor: pointer; text-decoration: underline; }

/* --- 字母输入 --- */
.pw-letter-input {
  display: flex; gap: 8px; justify-content: center;
  margin: 14px 0 10px;
}
.pw-letter-input input {
  width: 46px; height: 56px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 22px;
  text-transform: uppercase;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  outline: none;
}
.pw-letter-input input:focus { border-color: var(--accent); box-shadow: 0 0 12px rgba(77, 208, 225, .25); }
.pw-letter-input input[type="text"] { width: 54px; }

/* --- 文件解密 --- */
.pw-cipher-box {
  font-family: var(--font-mono);
  background: #0a1420;
  border: 1px solid var(--accent-dim);
  border-radius: 10px;
  padding: 16px;
  font-size: 15px;
  letter-spacing: 2px;
  color: var(--accent);
  line-height: 2;
  margin: 10px 0;
  word-break: break-all;
}
.pw-cipher-input {
  display: flex; gap: 10px; margin: 10px 0;
}
.pw-cipher-input input {
  flex: 1;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 10px 14px;
  font-size: 14px;
  outline: none;
}
.pw-cipher-input input:focus { border-color: var(--accent); }

/* --- 时间线拼图 --- */
.pw-timeline { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.pw-tl-slot {
  border: 1.5px dashed var(--border);
  border-radius: 10px;
  min-height: 52px;
  display: flex; align-items: center;
  padding: 4px 10px;
  transition: all .2s;
}
.pw-tl-slot.filled { border-style: solid; border-color: var(--accent-dim); background: rgba(77, 208, 225, .05); }
.pw-tl-slot.drag-over { border-color: var(--accent); background: rgba(77, 208, 225, .12); }
.pw-tl-chip {
  padding: 9px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  cursor: grab;
  user-select: none;
  width: 100%;
  color: var(--text);
  transition: all .15s;
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.pw-tl-chip:hover { border-color: var(--amber); }
.pw-tl-chip .chip-time { font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); }
.pw-tl-pool { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.pw-tl-pool .pw-tl-chip { cursor: pointer; }
.pw-tl-pool .pw-tl-chip:hover { border-color: var(--accent); transform: translateX(3px); }

/* --- 选择类谜题 --- */
.pw-options { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.pw-option {
  text-align: left;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 9px;
  font-size: 13.5px;
  color: var(--text);
  transition: all .15s;
  line-height: 1.7;
}
.pw-option:hover { border-color: var(--accent); background: rgba(77, 208, 225, .07); }
.pw-option.correct { border-color: var(--success); background: rgba(62, 207, 142, .1); color: var(--success); }
.pw-option.wrong { border-color: var(--danger); background: rgba(214, 69, 69, .08); color: #ff9a9a; }

/* --- 笔迹对比 --- */
.pw-handwriting {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  margin: 10px 0;
}
.pw-hw-sample {
  background: #e8e2d0;
  color: #2a2418;
  border-radius: 6px;
  padding: 18px;
  font-family: var(--font-serif);
  font-size: 15px;
  line-height: 2.1;
  position: relative;
  min-height: 120px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all .2s;
}
.pw-hw-sample:hover { border-color: var(--amber); }
.pw-hw-sample.selected { border-color: var(--accent); box-shadow: 0 0 16px rgba(77, 208, 225, .3); }
.pw-hw-sample .hw-label { position: absolute; top: 8px; left: 12px; font-size: 11px; color: #8a7a55; letter-spacing: 2px; }
.pw-hw-sample .hw-diff { background: rgba(214, 69, 69, .3); border-radius: 3px; padding: 0 2px; text-decoration: underline wavy rgba(214, 69, 69, .8) 1.5px; }
.pw-hw-note { font-size: 12px; color: var(--text-faint); text-align: center; margin: 6px 0; line-height: 1.8; }

/* --- 资金追踪 --- */
.pw-wallet-chain { display: flex; flex-direction: column; gap: 14px; margin: 10px 0; }
.pw-wallet-node {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.8;
}
.pw-wallet-node .node-name { color: var(--accent); font-size: 12.5px; letter-spacing: 1px; display: block; margin-bottom: 4px; }
.pw-wallet-node.flagged { border-color: var(--danger); background: rgba(214, 69, 69, .06); }
.pw-wallet-node.flagged .node-name { color: var(--danger); }
.pw-wallet-arrow { text-align: center; color: var(--text-faint); font-size: 18px; line-height: 0; }

/* 结果反馈 */
.pw-result { text-align: center; padding: 16px 0; }
.pw-result .pw-result-icon { font-size: 42px; margin-bottom: 8px; }
.pw-result .pw-result-text { font-size: 14px; color: var(--text); line-height: 1.9; }
.pw-result .pw-result-reward { margin-top: 10px; font-size: 12.5px; color: var(--amber); }
