/* ============================================================
   theme.css —— 修仙国风主题
   ------------------------------------------------------------
   配色约定（与需求一致）：
     金色  #d4a24a  升级 / 奖励 / 天道垂训
     暗红  #8c2b26  掉级 / 警告 / 遗忘惩罚
     青蓝  #3a7d8c  提示 / 信息
     淡紫  #7a5f9e  排行榜
   === 想换主题色，只改下面 :root 里的变量 ===
   ============================================================ */

:root {
  --gold: #d4a24a;
  --gold-bright: #f0c674;
  --red: #8c2b26;
  --red-bright: #c0392b;
  --blue: #3a7d8c;
  --blue-bright: #5fb3c4;
  --purple: #7a5f9e;
  --purple-bright: #a98fd0;

  --ink: #14110e;
  --ink-2: #1d1915;
  --paper: #221d18;
  --paper-2: #2b241d;
  --line: #3d3329;
  --text: #e8ddc9;
  --text-dim: #9d8f79;

  --ok: #3f9e6a;
  --err: #b8433c;

  --radius: 10px;
  --shadow: 0 8px 28px rgba(0,0,0,.45);
}

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

html, body {
  margin: 0; padding: 0;
  background: var(--ink);
  color: var(--text);
  font-family: "Noto Serif SC", "Songti SC", "Source Han Serif SC", serif;
  font-size: 16px;
  line-height: 1.65;
}

/* 背景：淡淡的云纹感，不用图片，纯 CSS 渐变 */
body::before {
  content: "";
  position: fixed; inset: 0;
  background:
    radial-gradient(circle at 20% 10%, rgba(212,162,74,.07), transparent 45%),
    radial-gradient(circle at 85% 85%, rgba(122,95,158,.07), transparent 45%);
  pointer-events: none; z-index: 0;
}

.app {
  position: relative; z-index: 1;
  max-width: 760px;
  margin: 0 auto;
  padding: 14px 14px 96px;
}

/* ---------------- 顶部：称号 + 经验条 ---------------- */
.topbar {
  background: linear-gradient(180deg, var(--paper-2), var(--paper));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow);
  position: sticky; top: 8px; z-index: 20;
  backdrop-filter: blur(6px);
}

.title-line {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px; flex-wrap: wrap;
}
.cultivator-title {
  font-size: 17px; letter-spacing: .5px;
  color: var(--gold-bright);
  font-weight: 600;
}
.cultivator-title .sect { color: var(--text-dim); font-size: 14px; }
.cultivator-title .realm { color: var(--blue-bright); }

.exp-wrap { margin-top: 9px; }
.exp-meta {
  display: flex; justify-content: space-between;
  font-size: 12px; color: var(--text-dim); margin-bottom: 4px;
}
.exp-bar {
  height: 9px; border-radius: 999px;
  background: #0f0d0b;
  border: 1px solid var(--line);
  overflow: hidden; position: relative;
}
.exp-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #8a6a2a, var(--gold), var(--gold-bright));
  transition: width .5s cubic-bezier(.22,.9,.3,1);
  box-shadow: 0 0 12px rgba(212,162,74,.55);
}
.exp-fill.flash { animation: pulseGold .8s ease; }
@keyframes pulseGold {
  0%,100% { box-shadow: 0 0 12px rgba(212,162,74,.55); }
  50%     { box-shadow: 0 0 24px rgba(240,198,116,.95); }
}

.status-line {
  margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap;
  font-size: 12px; color: var(--text-dim);
}
.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 9px;
  background: rgba(0,0,0,.25);
}
.chip.streak { color: var(--gold); border-color: rgba(212,162,74,.35); }

/* ---------------- 题目区 ---------------- */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-top: 14px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.qmeta {
  display: flex; gap: 6px; flex-wrap: wrap;
  font-size: 12px; color: var(--text-dim); margin-bottom: 10px;
}
.qmeta span {
  border: 1px solid var(--line); border-radius: 4px;
  padding: 1px 7px; background: rgba(0,0,0,.2);
}
.qmeta .type { color: var(--gold); border-color: rgba(212,162,74,.35); }
.qmeta .reason { color: var(--purple-bright); border-color: rgba(169,143,208,.35); }

.qcontent {
  font-size: 17px; line-height: 1.8;
  white-space: pre-wrap;
  margin-bottom: 14px;
}

/* 选项 */
.options { display: flex; flex-direction: column; gap: 9px; }

.opt {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-2);
  cursor: pointer;
  transition: border-color .18s, background .18s, transform .12s;
  user-select: none;
  font-size: 15.5px;
}
.opt:hover { border-color: rgba(212,162,74,.45); }
.opt:active { transform: scale(.995); }

.opt .key {
  flex: 0 0 auto;
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  font-size: 13px; color: var(--text-dim);
  background: rgba(0,0,0,.3);
  transition: all .18s;
}
.opt .txt { flex: 1; }

.opt.selected {
  border-color: var(--gold);
  background: rgba(212,162,74,.1);
}
.opt.selected .key {
  border-color: var(--gold); background: var(--gold); color: #1a1408;
}

/* 判分高亮 */
.opt.correct {
  border-color: var(--ok);
  background: rgba(63,158,106,.14);
}
.opt.correct .key { border-color: var(--ok); background: var(--ok); color: #08150e; }

.opt.wrong {
  border-color: var(--err);
  background: rgba(184,67,60,.14);
}
.opt.wrong .key { border-color: var(--err); background: var(--err); color: #fff; }

.opt.locked { cursor: default; }
.opt.locked:hover { border-color: var(--line); }
.opt.correct.locked:hover { border-color: var(--ok); }
.opt.wrong.locked:hover { border-color: var(--err); }

/* 解析 */
.analysis {
  margin-top: 14px;
  border-top: 1px dashed var(--line);
  padding-top: 12px;
  font-size: 14.5px;
  color: var(--text-dim);
  animation: fadeIn .3s ease;
}
.analysis b { color: var(--gold); }
.analysis .verdict { font-size: 15px; margin-bottom: 6px; }
.analysis .verdict.ok { color: var(--ok); }
.analysis .verdict.err { color: var(--err); }

@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------------- 底部操作栏 ---------------- */
.actions {
  position: fixed; left: 0; right: 0; bottom: 0;
  z-index: 30;
  background: linear-gradient(180deg, rgba(20,17,14,.85), var(--ink));
  border-top: 1px solid var(--line);
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  backdrop-filter: blur(8px);
}
.actions-inner {
  max-width: 760px; margin: 0 auto;
  display: flex; gap: 9px; align-items: center;
}

.btn {
  flex: 1;
  padding: 11px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--paper-2);
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  cursor: pointer;
  transition: all .18s;
}
.btn:hover { border-color: rgba(212,162,74,.5); }
.btn:disabled { opacity: .4; cursor: not-allowed; }

.btn.primary {
  background: linear-gradient(180deg, #a8802f, #8a6a2a);
  border-color: var(--gold);
  color: #fff8e8;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(212,162,74,.25);
}
.btn.primary:hover { background: linear-gradient(180deg, #c2953a, #9c782f); }

.btn.ghost { flex: 0 0 auto; padding: 11px 14px; color: var(--text-dim); }

/* ---------------- 天道垂训弹窗 ---------------- */
.dialog-mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(8,6,4,.78);
  display: grid; place-items: center;
  padding: 20px;
  animation: fadeIn .25s ease;
}

.scroll {
  width: min(520px, 100%);
  max-height: 82vh;
  overflow-y: auto;
  background:
    linear-gradient(180deg, #2e2519, #241d15);
  border: 2px solid var(--gold);
  border-radius: 6px;
  box-shadow:
    0 0 0 1px rgba(240,198,116,.25),
    0 0 40px rgba(212,162,74,.35),
    0 18px 60px rgba(0,0,0,.7);
  padding: 22px 20px 18px;
  position: relative;
  /* 卷轴展开动画 */
  animation: unroll .5s cubic-bezier(.2,.85,.3,1);
  transform-origin: top center;
}
@keyframes unroll {
  0%   { transform: scaleY(.04) translateY(-10px); opacity: 0; }
  60%  { transform: scaleY(1.02); opacity: 1; }
  100% { transform: scaleY(1); }
}

.scroll::before, .scroll::after {
  content: "";
  position: absolute; left: -6px; right: -6px; height: 8px;
  background: linear-gradient(90deg, #6b5120, var(--gold-bright), #6b5120);
  border-radius: 4px;
}
.scroll::before { top: -6px; }
.scroll::after { bottom: -6px; }

.scroll.tone-red    { border-color: var(--red-bright); box-shadow: 0 0 40px rgba(192,57,43,.3), 0 18px 60px rgba(0,0,0,.7); }
.scroll.tone-blue   { border-color: var(--blue-bright); box-shadow: 0 0 40px rgba(95,179,196,.3), 0 18px 60px rgba(0,0,0,.7); }
.scroll.tone-purple { border-color: var(--purple-bright); box-shadow: 0 0 40px rgba(169,143,208,.3), 0 18px 60px rgba(0,0,0,.7); }

.scroll .eyebrow {
  text-align: center;
  font-size: 11px;
  letter-spacing: 6px;
  color: var(--gold);
  opacity: .7;
  margin-bottom: 12px;
  text-indent: 6px;
}

.scroll .dialog-avatar {
  width: 92px; height: 92px;
  margin: 0 auto 14px;
  display: block;
}

.scroll h3 {
  margin: 0 0 14px;
  font-size: 18px; letter-spacing: 2px;
  color: var(--gold-bright);
  text-align: center;
  font-weight: 600;
}
.scroll.tone-red h3 { color: #e07a6f; }
.scroll.tone-blue h3 { color: var(--blue-bright); }
.scroll.tone-purple h3 { color: var(--purple-bright); }

.scroll .body {
  font-size: 15px; line-height: 2;
  white-space: pre-wrap;
  color: #ddd0b8;
  border-top: 1px solid rgba(212,162,74,.2);
  border-bottom: 1px solid rgba(212,162,74,.2);
  padding: 16px 4px;
  margin-bottom: 16px;
}
.scroll .confirm {
  width: 100%;
  padding: 12px;
  background: linear-gradient(180deg, #a8802f, #8a6a2a);
  border: 1px solid var(--gold);
  color: #fff8e8;
  font-family: inherit; font-size: 16px; letter-spacing: 4px;
  border-radius: 6px; cursor: pointer;
}
.scroll .confirm:hover { background: linear-gradient(180deg, #c2953a, #9c782f); }

/* ---------------- 系统短提示 ---------------- */
.toast-root {
  position: fixed; left: 50%; top: 84px;
  transform: translateX(-50%);
  z-index: 90;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
  width: max-content; max-width: 90vw;
}
.toast {
  background: rgba(30,25,20,.95);
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 14px;
  color: var(--text);
  box-shadow: var(--shadow);
  animation: toastIn .3s ease, toastOut .4s ease 2.2s forwards;
}
.toast.gain { border-left-color: var(--gold); color: var(--gold-bright); }
.toast.lose { border-left-color: var(--red-bright); color: #e08a80; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-6px); } }

/* ---------------- 退出按钮（原演示工具条已移除） ---------------- */
.quit-btn {
  margin-left: auto;          /* 靠右 */
  flex: 0 0 auto;
  padding: 4px 11px;
  font-family: inherit;
  font-size: 12.5px;
  letter-spacing: 1px;
  color: var(--text-dim);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 20px;
  cursor: pointer;
  transition: .2s;
}
.quit-btn:hover {
  color: var(--gold);
  border-color: rgba(212, 162, 74, .5);
}

/* ---------------- 空状态 ---------------- */
.empty {
  text-align: center; color: var(--text-dim);
  padding: 40px 10px;
  font-size: 15px;
  line-height: 2;
}

/* ---------------- 登录页 ---------------- */
[hidden] { display: none !important; }

.login-screen {
  position: fixed; inset: 0; z-index: 200;
  display: flex;              /* 不用 grid：内容超高时 flex + margin:auto 不会裁掉顶部 */
  align-items: flex-start;
  justify-content: center;
  padding: 24px 18px calc(24px + env(safe-area-inset-bottom));
  overflow-y: auto;
  background:
    radial-gradient(circle at 50% 30%, rgba(212,162,74,.1), transparent 55%),
    var(--ink);
}
.login-screen.hidden { display: none; }

.login-card {
  width: min(400px, 100%);
  margin: auto;               /* 竖直居中，超高时可滚动 */
  background: linear-gradient(180deg, var(--paper-2), var(--paper));
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 26px 22px 22px;
  text-align: center;
  box-shadow: var(--shadow);
  animation: fadeIn .4s ease;
}

.login-title {
  margin: 0 0 6px;
  font-size: 26px;
  letter-spacing: 7px;
  color: var(--gold-bright);
  font-weight: 600;
  text-indent: 7px;   /* 抵消末字多出的字距 */
}

.login-stage {
  margin: 0 0 22px;
  font-size: 13px;
  letter-spacing: 2px;
  color: var(--text-dim);
}

.field { text-align: left; margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 12.5px;
  letter-spacing: 1px;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.field input {
  width: 100%;
  padding: 12px 14px;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 16px;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}
.field input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212,162,74,.1);
}
.field input::placeholder { color: #6d6152; }

#lgCode {
  letter-spacing: 10px;
  text-align: center;
  font-size: 20px;
  text-indent: 10px;
  font-variant-numeric: tabular-nums;
}

.login-err {
  min-height: 20px;
  font-size: 13px;
  color: #e08a80;
  opacity: 0;
  transition: opacity .2s;
  margin-bottom: 6px;
}
.login-err.show { opacity: 1; }

.login-btn {
  width: 100%;
  padding: 13px;
  font-size: 16px;
  letter-spacing: 3px;
}

.login-tip {
  margin: 16px 0 0;
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.9;
}

/* ---------------- 境界形象 ---------------- */
.avatar-frame {
  position: relative;
  border-radius: 50%;
  overflow: hidden;
  flex: 0 0 auto;
  background: #0c0a08;
  border: 2px solid var(--ring, var(--line));
  box-shadow: 0 0 16px -3px var(--ring, transparent);
  transition: border-color .4s, box-shadow .4s;
}
.avatar-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-mini { width: 48px; height: 48px; }
.avatar-login { width: 130px; height: 130px; margin: 4px auto 18px; }

.cultivator-id { display: flex; align-items: center; gap: 11px; min-width: 0; }
.id-text { min-width: 0; }
.id-sub { margin-top: 5px; }

/* ---------------- 模式切换 ---------------- */
.mode-row {
  display: flex; gap: 6px;
  margin-top: 12px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}
.mode-row::-webkit-scrollbar { display: none; }

.mode-btn {
  flex: 0 0 auto;
  padding: 7px 13px;
  font-size: 13.5px;
  font-family: inherit;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,.2);
  color: var(--text-dim);
  cursor: pointer;
  transition: all .18s;
  white-space: nowrap;
}
.mode-btn:hover { color: var(--text); border-color: rgba(212,162,74,.4); }
.mode-btn.active {
  background: rgba(212,162,74,.14);
  border-color: var(--gold);
  color: var(--gold-bright);
}

.prog-line {
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--text-dim);
  text-align: right;
  padding-right: 2px;
}

/* 静音按钮固定宽度，别被主按钮挤变形 */
.btn.ghost { flex: 0 0 46px; min-width: 46px; padding-left: 0; padding-right: 0; text-align: center; }
.btn.ghost.muted { opacity: .55; }

/* ---------------- 移动端适配 ---------------- */
@media (max-width: 480px) {
  html, body { font-size: 15px; }
  .app { padding: 10px 10px 92px; }
  .topbar { top: 6px; padding: 10px 12px; }
  .cultivator-title { font-size: 15.5px; }
  .qcontent { font-size: 16px; }
  .card { padding: 13px; }
  .actions-inner { gap: 7px; }
  .btn { padding: 11px 10px; font-size: 14.5px; }
  .scroll { padding: 18px 16px 14px; }
  .scroll .body { font-size: 14.5px; line-height: 1.9; }
}

/* ---------------- 登录页：身份代码 / 道名 / 性别 ---------------- */
.code-state {
  margin-top: 6px;
  font-size: 12.5px;
  min-height: 17px;
  color: var(--text-dim);
  transition: color .3s;
}
.code-state.ok  { color: var(--gold-bright); }
.code-state.new { color: var(--blue-bright); }

.field input:disabled {
  opacity: .65;
  cursor: default;
  border-color: var(--line);
  background: #1a1612;
}

.gender-row { display: flex; gap: 10px; }
.gender-btn {
  flex: 1;
  padding: 11px 0;
  font-size: 15px;
  font-family: inherit;
  color: var(--text-dim);
  background: #1a1612;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: .25s;
}
.gender-btn:hover { color: var(--text); border-color: rgba(212,162,74,.4); }
.gender-btn.active {
  color: #1a1206;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  border-color: var(--gold-bright);
  font-weight: 600;
}
.gender-btn.locked { opacity: .7; cursor: default; }
.gender-btn:disabled { pointer-events: none; }

.login-hint {
  font-size: 12.5px;
  color: var(--text-dim);
  line-height: 1.7;
  margin-bottom: 6px;
  min-height: 20px;
  text-align: center;
}
.login-hint b { color: var(--gold-bright); }

/* ---------------- 悬浮立绘 ---------------- */
.avatar-frame img { object-fit: contain; }

@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-7px); }
}
.float { animation: floatY 3.6s ease-in-out infinite; }

.avatar-login {
  width: 150px; height: 150px;
  margin: 2px auto 16px;
  background: radial-gradient(circle at 50% 62%, rgba(212,162,74,.16), transparent 68%);
  border-width: 2px;
  box-shadow: 0 0 26px -4px var(--ring, transparent), 0 10px 26px rgba(0,0,0,.5);
}

/* ---------------- 气泡（答错解析 / 升级报境界） ---------------- */
.bubble-mask {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 14px calc(18px + env(safe-area-inset-bottom));
  background: rgba(8, 6, 4, .55);
  backdrop-filter: blur(2px);
  animation: bubbleMaskIn .22s ease;
}
@keyframes bubbleMaskIn { from { opacity: 0; } to { opacity: 1; } }

.bubble {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: 70vh;
  overflow-y: auto;
  padding: 18px 18px 14px;
  background: linear-gradient(180deg, #2b241d, #201a15);
  border: 2px solid var(--gold);
  border-radius: 16px;
  box-shadow: 0 0 32px -6px rgba(212,162,74,.55), 0 18px 50px rgba(0,0,0,.65);
  animation: bubbleUp .28s cubic-bezier(.2,.9,.3,1.1);
}
@keyframes bubbleUp {
  from { opacity: 0; transform: translateY(26px) scale(.96); }
  to   { opacity: 1; transform: none; }
}

/* 小尾巴：指向下方（像游戏里的对话框） */
.bubble-tail {
  position: absolute;
  left: 42px;
  bottom: -11px;
  width: 20px; height: 20px;
  background: #201a15;
  border-right: 2px solid var(--gold);
  border-bottom: 2px solid var(--gold);
  transform: rotate(45deg);
}

.bubble.tone-red {
  border-color: var(--red-bright);
  box-shadow: 0 0 32px -6px rgba(192,57,43,.55), 0 18px 50px rgba(0,0,0,.65);
  background: linear-gradient(180deg, #2f1f1c, #201513);
}
.bubble.tone-red .bubble-tail { border-color: var(--red-bright); background: #201513; }

.bubble.tone-gold { border-color: var(--gold-bright); }

.bubble-title {
  font-size: 15px;
  letter-spacing: 3px;
  color: var(--gold-bright);
  margin-bottom: 8px;
}
.bubble.tone-red .bubble-title { color: #e07a6f; }

.bubble-figure {
  position: relative;
  width: 170px; height: 170px;
  margin: 2px auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.bubble-figure img {
  position: relative; z-index: 2;
  width: 100%; height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 0 16px rgba(240,198,116,.35)) drop-shadow(0 10px 18px rgba(0,0,0,.6));
  animation: floatY 3.8s ease-in-out infinite;
}

.bubble-body {
  font-size: 15px;
  line-height: 1.95;
  color: var(--text);
  white-space: pre-wrap;     /* 保留解析里的换行 */
  word-break: break-word;
}

.bubble-close {
  display: block;
  width: 100%;
  margin-top: 14px;
  padding: 12px 0;
  font-family: inherit;
  font-size: 15px;
  letter-spacing: 2px;
  color: #1a1206;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: filter .2s;
}
.bubble-close:hover { filter: brightness(1.06); }
.bubble.tone-red .bubble-close {
  color: #f6e6e3;
  background: linear-gradient(180deg, #c0392b, #8c2b26);
}

@media (max-width: 480px) {
  .bubble { padding: 15px 14px 12px; border-radius: 14px; }
  .bubble-body { font-size: 14.5px; line-height: 1.9; }
  .bubble-figure { width: 124px; height: 124px; }
  .avatar-login { width: 128px; height: 128px; }
}

/* ============================================================
   镂空悬浮立绘
   ------------------------------------------------------------
   做法：去掉圆框、底色、overflow:clip，
        立绘 PNG 直接浮在页面上，靠三层投影营造"离地"：
          1) 内层淡金光（描出轮廓，把人物从背景里"剥"出来）
          2) 外层深投影（落地阴影）
        人物本身做上下浮动，影子单独做呼吸缩放 —— 
        影子不跟着人走，才像真的浮着。
   ============================================================ */

/* 登录页大立绘 */
.hero-float {
  position: relative;
  width: min(190px, 54vw);
  height: min(190px, 54vw);
  margin: 0 auto 6px;
}
.hero-float img {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter:
    drop-shadow(0 0 12px rgba(240, 198, 116, .30))
    drop-shadow(0 12px 16px rgba(0, 0, 0, .62));
  animation: floatY 4.2s ease-in-out infinite;
}
.hero-shadow {
  position: absolute;
  z-index: 1;
  left: 50%;
  bottom: 0;
  width: 60%;
  height: 12%;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, .6), transparent 70%);
  filter: blur(5px);
  animation: shadowBreathe 4.2s ease-in-out infinite;
}
@keyframes shadowBreathe {
  0%, 100% { transform: translateX(-50%) scale(1);   opacity: .55; }
  50%      { transform: translateX(-50%) scale(.84); opacity: .28; }
}

/* 顶部小头像 */
.avatar-float {
  position: relative;
  flex: 0 0 auto;
}
.avatar-float.mini {
  width: 52px;
  height: 52px;
}
.avatar-float img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, .62));
  animation: floatY 5s ease-in-out infinite;
}

/* 多日未登录：形象蒙尘（掉色变灰），登录答题后自动恢复 */
.avatar-float.dusty img,
.avatar-frame.dusty img {
  filter: grayscale(1) brightness(.72) drop-shadow(0 3px 5px rgba(0, 0, 0, .5));
  opacity: .78;
}
.avatar-float.dusty::after,
.avatar-frame.dusty::after {
  content: '蒙尘';
  position: absolute;
  left: 50%;
  bottom: -2px;
  transform: translateX(-50%);
  font-size: 10px;
  letter-spacing: 1px;
  color: #9aa0a6;
  white-space: nowrap;
}

/* 卷轴 / 旧容器：一并去框，别一块方底糊在纸上 */
.avatar-frame {
  border: 0;
  background: none;
  box-shadow: none;
  overflow: visible;
}
.avatar-frame img {
  object-fit: contain;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, .55));
  animation: floatY 4.5s ease-in-out infinite;
}
.scroll .dialog-avatar {
  width: 118px;
  height: 118px;
  margin: 4px auto 12px;
}

/* ---------------- 注册弹层 ---------------- */
.reg-mask {
  position: fixed;
  inset: 0;
  z-index: 210;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
  overflow-y: auto;
  background: rgba(6, 5, 4, .74);
  backdrop-filter: blur(3px);
  animation: bubbleMaskIn .2s ease;
}

.reg-card {
  width: min(420px, 100%);
  margin: auto;
  padding: 22px 20px 18px;
  text-align: left;
  background: linear-gradient(180deg, #2b241d, #201a15);
  border: 1px solid var(--gold);
  border-radius: 16px;
  box-shadow: 0 0 40px -10px rgba(212, 162, 74, .5), 0 20px 50px rgba(0, 0, 0, .72);
  animation: bubbleUp .26s cubic-bezier(.2, .9, .3, 1.1);
}

.reg-head { text-align: center; margin-bottom: 16px; }
.reg-head h3 {
  margin: 0 0 6px;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 6px;
  text-indent: 6px;
  color: var(--gold-bright);
}
.reg-head p {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-dim);
  letter-spacing: .5px;
}

.reg-actions { display: flex; gap: 10px; margin-top: 14px; }
.btn.ghost.wide {
  flex: 1;
  padding: 12px 0;
  letter-spacing: 2px;
}
.reg-actions .btn.primary { flex: 1.4; }

/* ---------------- 登录页按钮与校验态 ---------------- */
.login-sub {
  width: 100%;
  margin-top: 4px;
  padding: 11px 0;
  letter-spacing: 3px;
  color: var(--text-dim);
  background: transparent;
  border: 1px dashed var(--line);
  font-size: 14.5px;
}
.login-sub:hover {
  color: var(--gold);
  border-color: rgba(212, 162, 74, .5);
}

.code-state.bad { color: #e08a80; }

@keyframes shiver {
  0%, 100% { transform: none; }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}
.shiver { animation: shiver .36s ease; }

/* 减少动效偏好 */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ============================================================
   青云榜（云端排行榜）
   ============================================================ */
.rank-btn {
  appearance: none;
  border: 1px solid var(--gold);
  background: rgba(212, 162, 74, .12);
  color: var(--gold-bright);
  font: inherit;
  font-size: 13px;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .18s, transform .18s;
}
.rank-btn:hover { background: rgba(212, 162, 74, .24); }
.rank-btn:active { transform: scale(.96); }

.rank-mask {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(8, 6, 5, .78);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(4px);
}
.rank-mask[hidden] { display: none; }

.rank-card {
  width: min(480px, 100%);
  max-height: min(82vh, 720px);
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--paper-2), var(--paper));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.rank-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 10px;
  border-bottom: 1px solid var(--line);
}
.rank-head h3 {
  margin: 0;
  font-size: 19px;
  letter-spacing: 3px;
  color: var(--gold-bright);
}
.rank-head p {
  margin: 5px 0 0;
  font-size: 12px;
  color: var(--text-dim);
}
.rank-x {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-dim);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
.rank-x:hover { color: var(--text); }

.rank-tip {
  padding: 8px 18px 0;
  font-size: 12px;
  color: var(--text-dim);
  min-height: 18px;
}
.rank-tip.ok { color: var(--ok); }
.rank-tip.bad { color: var(--err); }

.rank-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px 12px;
  -webkit-overflow-scrolling: touch;
}

.rank-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid transparent;
}
.rank-row + .rank-row { margin-top: 4px; }
.rank-row.me {
  background: rgba(212, 162, 74, .1);
  border-color: rgba(212, 162, 74, .38);
}
.rank-row.dusty .rank-name,
.rank-row.dusty .rank-sub { opacity: .55; }

.rank-no {
  width: 26px;
  flex: none;
  text-align: center;
  font-size: 13px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.rank-row.top1 .rank-no { color: #f0c674; font-weight: 700; font-size: 15px; }
.rank-row.top2 .rank-no { color: #cfd4d8; font-weight: 700; }
.rank-row.top3 .rank-no { color: #cd8b52; font-weight: 700; }
.rank-row.top1 { background: rgba(240, 198, 116, .08); }

.rank-main { flex: 1; min-width: 0; }
.rank-name {
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rank-me-tag,
.rank-dusty-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 16px;
}
.rank-me-tag {
  background: rgba(212, 162, 74, .2);
  color: var(--gold-bright);
}
.rank-dusty-tag {
  background: rgba(140, 140, 140, .18);
  color: var(--text-dim);
}
.rank-sub {
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--text-dim);
}

.rank-right {
  flex: none;
  width: 78px;
  text-align: right;
}
.rank-pct {
  font-size: 14px;
  color: var(--gold-bright);
  font-variant-numeric: tabular-nums;
}
.rank-bar {
  margin-top: 4px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .08);
  overflow: hidden;
}
.rank-bar i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold), var(--gold-bright));
  transition: width .35s ease;
}

.rank-empty {
  padding: 40px 16px;
  text-align: center;
}
.rank-empty-title {
  font-size: 15px;
  color: var(--text);
  margin-bottom: 8px;
}
.rank-empty-desc {
  font-size: 12.5px;
  color: var(--text-dim);
  line-height: 1.7;
}

.rank-card > .btn.ghost {
  margin: 0 18px 16px;
  flex: none;
}

@media (max-width: 420px) {
  .rank-card { max-height: 88vh; }
  .rank-right { width: 64px; }
}

