/* 观城 OJ · 答题中心（浅蓝主题，与全站 sailian.css 一致） */

.ans-wrap, .ans-wrap *, .ans-mask, .ans-mask * { box-sizing: border-box; }

.ans-wrap {
  margin: 10px 0 16px;
  height: calc(100vh - 118px);
  min-height: 540px;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid #dbe9fb;
  border-radius: 16px;
  box-shadow: 0 6px 22px rgba(44, 128, 232, .07);
  overflow: hidden;
}

.ans-wrap.full {
  position: fixed;
  left: 0; top: 0; right: 0; bottom: 0;
  margin: 0; height: 100vh; min-height: 0;
  border-radius: 0; border: 0; z-index: 3000;
}
.ans-wrap.full .ans-left { display: none; }

/* -------- 顶部标题 -------- */
/* 从状态页点 C++/Edit 进来时的提示条 */
.ans-note {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 10px;
  padding: 9px 16px;
  font-size: 13px;
  line-height: 1.5;
  border-bottom: 1px solid #e8f1fc;
}
.ans-note b { font-weight: 700; }
.ans-note.peek { background: #EAF3FE; color: #1F66B8; }
.ans-note.peek b { color: #12518F; }
.ans-note.peek a {
  margin-left: auto;
  color: #2C80E8;
  font-size: 12.5px;
  text-decoration: none;
  border-bottom: 1px dashed rgba(44, 128, 232, .5);
}
.ans-note.peek a:hover { color: #12518F; border-bottom-style: solid; }
.ans-note.warn { background: #FFF8E6; color: #8a6412; border-bottom-color: #f3e3ba; }
.ans-note.err { background: #FDECEC; color: #B03A2E; border-bottom-color: #f6cdc9; }

.ans-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 14px;
  padding: 11px 16px;
  background: linear-gradient(180deg, #F7FBFF 0%, #FFFFFF 100%);
  border-bottom: 1px solid #e8f1fc;
}
.ans-title { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.ans-title h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: #1f4e79;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ans-no {
  font-size: 12.5px;
  color: #5AA8F5;
  font-weight: 700;
  background: #EAF3FE;
  border: 1px solid #d6e8fb;
  border-radius: 6px;
  padding: 2px 7px;
}
.ans-tags { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.ans-pill {
  font-size: 12px;
  color: #5b7691;
  background: #F7FBFF;
  border: 1px solid #e3eefb;
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
}
.ans-pill b { color: #1F66B8; }
.ans-pill.clock { color: #1F66B8; background: #EAF3FE; border-color: #d6e8fb; font-weight: 600; font-variant-numeric: tabular-nums; }
.ans-pill.clock.over { color: #C0392B; background: #FDECEC; border-color: #f5c9c7; }
.ans-pill.spj { color: #A9660B; background: #FFF3E0; border-color: #f7e0b8; }
.ans-pill.login { color: #C0392B; background: #FDECEC; border-color: #f5c9c7; text-decoration: none; }
.ans-pill.login:hover { background: #fbdedd; text-decoration: none; }
.ans-pill.stat { text-decoration: none; }
.ans-pill.stat:hover { background: #EAF3FE; border-color: #d6e8fb; color: #2C80E8; text-decoration: none; }
.ans-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  padding: 0 14px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .3px;
  line-height: 1;
  color: #fff;
  background: #1E9C62;
  border: 0;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(30, 156, 98, .3);
  transition: background .15s, box-shadow .15s;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: geometricPrecision;
}
.ans-tool.data { background: #2C80E8; box-shadow: 0 1px 3px rgba(44, 128, 232, .3); }
.ans-tool:hover,
.ans-tool:focus,
.ans-tool:active { color: #fff; text-decoration: none; }
.ans-tool:link,
.ans-tool:visited { color: #fff; }
.ans-tool:hover {
  background: #17824F;
  box-shadow: 0 2px 6px rgba(30, 156, 98, .34);
}
.ans-tool.data:hover { background: #1F66B8; box-shadow: 0 2px 6px rgba(44, 128, 232, .34); }
/* 点过之后焦点留在按钮上时，不要浏览器默认的黑框，换成贴合主题的柔光环 */
.ans-wrap a:focus { outline: none; }
.ans-wrap a:focus-visible { outline: 2px solid #5AA8F5; outline-offset: 2px; }
.ans-wrap .ans-tool:focus { outline: none; color: #fff; }
.ans-wrap .ans-tool:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(30, 156, 98, .26), 0 1px 3px rgba(30, 156, 98, .3);
}
.ans-wrap .ans-tool.data:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(44, 128, 232, .24), 0 1px 3px rgba(44, 128, 232, .3);
}
.ans-link { font-size: 12.5px; color: #2C80E8; white-space: nowrap; }
.ans-nav { display: flex; align-items: center; gap: 12px; white-space: nowrap; }
.ans-nav .ans-link { text-decoration: none; }
.ans-nav .ans-link:hover { text-decoration: underline; }

/* -------- 分栏 -------- */
.ans-split { flex: 1 1 auto; display: flex; min-height: 0; }

.ans-left {
  width: 50%;
  min-width: 300px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #e8f1fc;
  background: #fff;
}
.ans-tabs {
  flex: 0 0 auto;
  display: flex;
  gap: 22px;
  height: 41px;
  padding: 0 16px;
  border-bottom: 1px solid #eaf2fc;
}
.ans-tabs button {
  position: relative;
  height: 41px;
  padding: 0 2px;
  border: 0;
  background: none;
  font-size: 13.5px;
  color: #5b7691;
  cursor: pointer;
  outline: none;
}
.ans-tabs button:hover { color: #1F66B8; }
.ans-tabs button.on { color: #1F66B8; font-weight: 700; }
.ans-tabs button.on::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  background: #2C80E8;
  border-radius: 2px 2px 0 0;
}

.ans-scroll { flex: 1 1 auto; overflow-y: auto; padding: 14px 18px 34px; }
.ans-scroll::-webkit-scrollbar { width: 9px; }
.ans-scroll::-webkit-scrollbar-thumb { background: #dbe9f8; border-radius: 8px; border: 2px solid #fff; }
.ans-scroll::-webkit-scrollbar-thumb:hover { background: #c3dbf5; }

.ans-sec { margin-bottom: 16px; }
.ans-sec h4 {
  position: relative;
  margin: 0 0 8px;
  padding-left: 10px;
  font-size: 13.5px;
  font-weight: 700;
  color: #1F66B8;
  line-height: 1.5;
}
.ans-sec h4::before {
  content: "";
  position: absolute;
  left: 0; top: 4px; bottom: 4px;
  width: 3px;
  border-radius: 2px;
  background: linear-gradient(180deg, #5AA8F5, #2C80E8);
}
.ans-md { font-size: 13.5px; line-height: 1.95; color: #26435e; word-wrap: break-word; }
.ans-md p { margin: 0 0 6px; }
.ans-md img { max-width: 100%; height: auto; }
.ans-md pre {
  background: #F7FBFF;
  border: 1px solid #e3eefb;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12.5px;
}
.ans-md.source { font-size: 12.5px; color: #5b7691; }

.ans-samples { display: flex; gap: 14px; }
.sample { flex: 1 1 0; min-width: 0; }
.sample-hd {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 700;
  color: #1F66B8;
  margin-bottom: 6px;
}
.sample-hd .copy {
  margin-left: auto;
  border: 1px solid #dbe9fb;
  background: #F7FBFF;
  color: #5b7691;
  font-size: 11.5px;
  border-radius: 6px;
  padding: 1px 7px;
  cursor: pointer;
  font-weight: 400;
}
.sample-hd .copy:hover { background: #EAF3FE; color: #1F66B8; }
.sample-bd {
  margin: 0;
  padding: 9px 12px;
  max-height: 200px;
  overflow: auto;
  background: #F7FBFF;
  border: 1px solid #e3eefb;
  border-radius: 8px;
  font-family: "Cascadia Code", Consolas, "Courier New", monospace;
  font-size: 12.8px;
  line-height: 1.7;
  color: #26435e;
  white-space: pre-wrap;
  word-break: break-all;
}

/* -------- 右侧编辑区 -------- */
.ans-right { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.ans-toolbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 41px;
  padding: 0 12px;
  border-bottom: 1px solid #eaf2fc;
}
.ans-toolbar label { margin: 0; font-size: 12.5px; color: #5b7691; font-weight: 400; }
.ans-select {
  height: 29px;
  padding: 0 26px 0 9px;
  border: 1px solid #cfe3fb;
  border-radius: 8px;
  background: #fff url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'><path d='M1 3.2 5 7l4-3.8' fill='none' stroke='%238aa4bd' stroke-width='1.3'/></svg>") no-repeat right 8px center;
  font-size: 13px;
  color: #24384d;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  width: 120px;
}
.ans-select:focus { border-color: #5AA8F5; box-shadow: 0 0 0 3px rgba(90, 168, 245, .16); }
.grow { flex: 1 1 auto; }
.ans-mini {
  height: 26px;
  min-width: 27px;
  padding: 0 7px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: #5b7691;
  font-size: 12.5px;
  cursor: pointer;
  outline: none;
}
.ans-mini:hover { background: #EAF3FE; color: #1F66B8; border-color: #dbe9fb; }

.ans-editor { flex: 1 1 auto; min-height: 220px; position: relative; overflow: hidden; }
.ans-editor #src {
  position: absolute;
  left: 0; top: 0; right: 0; bottom: 0;
  margin: 0; padding: 0;
  border: 0; border-radius: 0;
  display: block;
  width: 100% !important;
  height: 100% !important;
}
.ace_editor { font-family: "Cascadia Code", Consolas, "Courier New", monospace !important; }
.ans-editor .ace_gutter,
.ans-editor .ace-chrome .ace_gutter,
.ans-editor .ace_editor .ace_gutter { background: #FBFDFF !important; color: #a9bccf !important; border-right: 1px solid #f0f6fd; }
.ans-editor .ace_gutter-active-line { background: #F2F8FF !important; }
.ans-editor .ace_marker-layer .ace_active-line { background: #F7FBFF !important; }
.ans-editor .ace_scrollbar-v { width: 9px; }

.ans-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  height: 53px;
  padding: 0 14px;
  border-top: 1px solid #eaf2fc;
  background: #FCFDFF;
}
/* 提示文字可压缩并省略，绝不挤掉右侧按钮 */
.ans-tip {
  margin-right: auto;
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  font-size: 11.5px;
  color: #a9bccf;
  white-space: nowrap;
  overflow: hidden;
}
.ans-tip #ansTip {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* 快捷键提示可整段丢弃：窗口不够宽时先牺牲它，保住状态文字 */
.ans-keys { flex: 0 0 auto; color: #b8c8d8; }
@media (max-width: 1240px) {
  .ans-keys { display: none; }
}
.ans-tip #ansTip:not(:empty) + .ans-keys::before {
  content: "·";
  margin: 0 6px;
  color: #cfdbe8;
}
.ans-btn {
  height: 31px;
  padding: 0 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  text-shadow: none;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* 窄屏下按钮不收缩、文字不换行，避免被压成两行/被底栏裁掉 */
  flex: 0 0 auto;
  box-sizing: border-box;
  white-space: nowrap;
  line-height: 1;
  writing-mode: horizontal-tb;
}
.ans-btn.ghost { color: #22A566; background: #fff; border-color: #a7e0bc; }
.ans-btn.ghost:hover { background: #EFFAF4; border-color: #7ed3a0; color: #17794A; }
.ans-btn.ghost2 { color: #1F66B8; background: #fff; border-color: #cfe3fb; font-weight: 500; }
.ans-btn.ghost2:hover { background: #EAF3FE; text-decoration: none; }
.ans-btn.primary {
  color: #fff;
  background: linear-gradient(180deg, #5AA8F5 0%, #2C80E8 100%);
  border-color: #2C80E8;
  box-shadow: 0 2px 8px rgba(44, 128, 232, .26);
}
.ans-btn.primary:hover { background: linear-gradient(180deg, #4A9BEF 0%, #1F66B8 100%); color: #fff; }
.ans-btn[disabled] { opacity: .55; cursor: not-allowed; }

/* -------- 我的提交 -------- */
.subs-empty { color: #8aa4bd; font-size: 13px; text-align: center; padding: 30px 0; }

/* 老师：全班 / 只看我 + 用户名筛选 */
.subs-tool {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 0 10px;
  border-bottom: 1px solid #eef4fc;
  margin-bottom: 4px;
}
.subs-switch {
  display: inline-flex;
  padding: 2px;
  border-radius: 8px;
  background: #EEF5FE;
  border: 1px solid #dbe9fb;
}
.subs-switch button {
  border: 0;
  background: transparent;
  color: #5b7691;
  font-family: inherit;
  font-size: 12.5px;
  line-height: 1;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
}
.subs-switch button.on {
  background: #fff;
  color: #1F66B8;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(44, 128, 232, .16);
}
.subs-switch button:hover { color: #1F66B8; }
.subs-input {
  width: 148px;
  height: 30px;
  padding: 0 10px;
  font-family: inherit;
  font-size: 12.5px;
  color: #26425e;
  background: #fff;
  border: 1px solid #dbe9fb;
  border-radius: 8px;
  outline: none;
}
.subs-input:focus { border-color: #5AA8F5; box-shadow: 0 0 0 3px rgba(90, 168, 245, .16); }
.subs-input::placeholder { color: #a7bdd4; }
.subs-hint { font-size: 12px; color: #8aa4bd; }
.subs-item .subs-user {
  font-size: 12.5px;
  font-weight: 700;
  color: #26425e;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.subs-item {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  padding: 10px 2px;
  border-bottom: 1px solid #f2f7fd;
  font-size: 13px;
}
.subs-item .meta { color: #8aa4bd; font-size: 12px; }
.subs-item .link {
  margin-left: auto;
  color: #2C80E8;
  font-size: 12.5px;
  white-space: nowrap;
}
.subs-item button.link {
  border: 0;
  background: none;
  padding: 0;
  font-family: inherit;
  cursor: pointer;
}
.subs-item button.link:hover { text-decoration: underline; }
.subs-sum { display: flex; gap: 16px; font-size: 12.5px; color: #8aa4bd; padding: 4px 0 12px; }
.subs-sum b { color: #1F66B8; }

/* -------- 弹窗 -------- */
.ans-mask {
  position: fixed;
  left: 0; top: 0; right: 0; bottom: 0;
  background: rgba(20, 48, 80, .38);
  z-index: 4000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow: auto;
}
.ans-modal {
  width: min(660px, calc(100vw - 96px));
  max-width: 100%;
  max-height: calc(100vh - 32px);
  background: #fff;
  border: 1px solid #dbe9fb;
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(24, 68, 120, .24);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.ans-modal-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  background: linear-gradient(180deg, #EAF3FE, #F7FBFF);
  border-bottom: 1px solid #dbe9fb;
  font-size: 15px;
  font-weight: 700;
  color: #1F66B8;
}
/* 标题里的用户名 + 提交号过长时省略，不要把关闭按钮挤出去 */
.ans-modal-hd > span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ans-modal-hd .x {
  flex: 0 0 auto;
  border: 0;
  background: none;
  font-size: 22px;
  line-height: 1;
  color: #7d9ab5;
  cursor: pointer;
  padding: 0 4px;
}
.ans-modal-hd .x:hover { color: #1F66B8; }
.ans-modal-bd { padding: 16px 18px; overflow-y: auto; }

/* 查看提交代码 */
.ans-modal.wide { width: min(760px, calc(100vw - 120px)); }
.ans-modal.wide .ans-modal-bd { padding: 0; }
.ans-code {
  margin: 0;
  padding: 14px 18px;
  min-height: 120px;
  max-height: min(60vh, calc(100vh - 220px));
  overflow: auto;
  background: #FBFDFF;
  font-family: Menlo, Consolas, "Courier New", monospace;
  font-size: 13px;
  line-height: 1.65;
  color: #294a68;
  white-space: pre;
  tab-size: 4;
}
.ans-modal-ft {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid #eaf2fc;
  background: #FCFDFF;
}

.ans-field { margin-bottom: 14px; }
.ans-field:last-child { margin-bottom: 0; }
.ans-field > label { display: block; font-size: 12.5px; font-weight: 600; color: #5b7691; margin-bottom: 6px; }
.ans-field > label em { font-style: normal; font-weight: 400; color: #a9bccf; }
.ans-io {
  width: 100%;
  margin: 0;
  padding: 10px 12px;
  min-height: 42px;
  max-height: 220px;
  overflow: auto;
  background: #F7FBFF;
  border: 1px solid #e3eefb;
  border-radius: 8px;
  font-family: "Cascadia Code", Consolas, "Courier New", monospace;
  font-size: 12.8px;
  line-height: 1.7;
  color: #26435e;
  white-space: pre-wrap;
  word-break: break-all;
  resize: vertical;
  outline: none;
}
textarea.ans-io { min-height: 92px; }
textarea.ans-io:focus { border-color: #5AA8F5; box-shadow: 0 0 0 3px rgba(90, 168, 245, .16); background: #fff; }
.ans-io.err { background: #FFF7F7; border-color: #f5c9c7; color: #B33A32; }

.run-meta { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: #8aa4bd; margin-bottom: 10px; }
.st { font-weight: 700; }
.st.ok { color: #17794A; }
.st.bad { color: #C0392B; }

.ans-judging { text-align: center; padding: 26px 0; color: #8aa4bd; font-size: 13px; }
.spin {
  display: block;
  width: 26px; height: 26px;
  margin: 0 auto 14px;
  border: 2.5px solid #e3eefb;
  border-top-color: #2C80E8;
  border-radius: 50%;
  animation: ansspin .8s linear infinite;
}
@keyframes ansspin { to { transform: rotate(360deg); } }

/* 评测结果 */
.vd {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid #e3eefb;
  background: #F7FBFF;
  margin-bottom: 14px;
}
.vd .mark {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 800;
  background: #fff;
  border: 1px solid currentColor;
}
.vd .name { font-size: 18px; font-weight: 800; letter-spacing: .2px; }
.vd .zh { font-size: 12.5px; font-weight: 700; }
.vd .meta { margin-left: auto; text-align: right; font-size: 12.5px; color: #5b7691; line-height: 1.8; }
.vd .meta b { color: #1F66B8; }

.vd.v-AC { color: #17794A; background: #EFFAF4; border-color: #c5e9d5; }
.vd.v-WA { color: #C0392B; background: #FDF0F0; border-color: #f5c9c7; }
.vd.v-TLE { color: #A9660B; background: #FFF7EA; border-color: #f7e0b8; }
.vd.v-RE { color: #6B3FA0; background: #F5F0FF; border-color: #e2d6ff; }
.vd.v-CE { color: #5b7691; background: #F2F6FB; border-color: #dfe9f4; }
.vd.v-PD { color: #5b7691; background: #F7FBFF; border-color: #e3eefb; }

.chip {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.chip.v-AC { color: #17794A; background: #E3F7EC; }
.chip.v-WA { color: #C0392B; background: #FDECEC; }
.chip.v-TLE { color: #A9660B; background: #FFF3E0; }
.chip.v-RE { color: #6B3FA0; background: #F3EDFF; }
.chip.v-CE { color: #5b7691; background: #EEF4FB; }
.chip.v-PD { color: #5b7691; background: #EEF4FB; }

.hidden { display: none !important; }

/* -------- 窄屏 -------- */
@media (max-width: 900px) {
  .ans-wrap { height: auto; min-height: 0; }
  .ans-head { flex-wrap: wrap; }
  .ans-tags { margin-left: 0; }
  .ans-split { flex-direction: column; }
  .ans-left { width: 100%; height: 44vh; border-right: 0; border-bottom: 1px solid #e8f1fc; }
  .ans-right { height: 62vh; }
  .ans-samples { flex-direction: column; }
  .ans-tip { display: none; }
}

/* -------- 萌宠：页面底部走来走去的小恐龙（悬停看状态） -------- */
.ans-pet {
  position: fixed; left: 0; top: 0;
  width: 64px; height: 74px;
  z-index: 900;
  cursor: grab;
  touch-action: none;
  will-change: transform;
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: filter .3s ease;
}
.ans-pet.drag { cursor: grabbing; }
.ans-pet.drag .ans-pet-fig { transform: scale(1.05); }
.ans-pet.drag .ans-pet-fig img { filter: drop-shadow(0 10px 9px rgba(38, 72, 110, .22)); }
.ans-pet-fig {
  position: absolute; left: 0; top: 0; right: 0; bottom: 0;
  display: flex; align-items: flex-end; justify-content: center;
  transform-origin: 50% 100%;
}
.ans-pet-fig img {
  width: 64px; height: 74px;
  object-fit: contain; display: block;
  transform-origin: 50% 92%;
  filter: drop-shadow(0 3px 5px rgba(38, 72, 110, .18));
  transition: transform .2s ease;
}
.ans-pet.flip .ans-pet-fig img { transform: scaleX(-1); }

/* 走动：身体上下起伏 + 轻微左右摆，像在迈步 */
.ans-pet.walking .ans-pet-fig { animation: petBob .3s ease-in-out infinite alternate; }
@keyframes petBob {
  from { transform: translateY(0) rotate(-1deg); }
  to   { transform: translateY(-2px) rotate(1deg); }
}
/* 点击：蹦两下 */
.ans-pet.hop .ans-pet-fig { animation: petHop .55s cubic-bezier(.3, .8, .4, 1) 2; }
@keyframes petHop {
  0%, 100% { transform: translateY(0); }
  40%      { transform: translateY(-16px); }
  70%      { transform: translateY(-4px); }
}
/* 答错：左右摇头委屈 */
.ans-pet.wrong .ans-pet-fig { animation: petShake .5s ease 2; }
@keyframes petShake {
  0%, 100% { transform: rotate(0); }
  25%      { transform: rotate(-4.5deg); }
  75%      { transform: rotate(4.5deg); }
}
/* 升级：放大回弹 */
.ans-pet.levelup .ans-pet-fig { animation: petLevel .9s ease; }
@keyframes petLevel {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.22) translateY(-9px); }
  70%  { transform: scale(1.06); }
  100% { transform: scale(1); }
}
/* 打盹：缩小、褪色、缓慢呼吸，头顶冒 z */
.ans-pet.sleeping .ans-pet-fig { animation: petBreath 3.6s ease-in-out infinite; }
.ans-pet.sleeping .ans-pet-fig img {
  filter: drop-shadow(0 2px 4px rgba(38, 72, 110, .12)) saturate(.7) brightness(.98);
}
.ans-pet.sleeping::after {
  content: 'z z Z';
  position: absolute; right: -2px; top: -16px;
  font-size: 12px; font-weight: 700; letter-spacing: 1.5px;
  color: #6C9ACB;
  animation: petZzz 2.8s ease-in-out infinite;
  pointer-events: none;
}
@keyframes petZzz {
  0%   { opacity: 0; transform: translate(0, 3px) scale(.85); }
  30%  { opacity: 1; }
  100% { opacity: 0; transform: translate(9px, -20px) scale(1.1); }
}
@keyframes petBreath {
  0%, 100% { transform: scale(.94); }
  50%      { transform: scale(.975) translateY(-1px); }
}
.ans-pet.sleeping .ans-pet-lv { opacity: .4; }
.ans-pet.hover .ans-pet-lv { opacity: 0; }

/* 地面投影 */
.ans-pet-shadow {
  position: absolute; left: 50%; bottom: 0;
  width: 34px; height: 6px; margin-left: -17px;
  border-radius: 50%;
  background: rgba(44, 128, 232, .16);
  filter: blur(1.2px);
  pointer-events: none;
}

/* 头顶常驻等级牌 */
.ans-pet-lv {
  position: absolute; right: -4px; top: -3px;
  padding: 0 5px;
  border-radius: 999px;
  background: #2C80E8;
  color: #fff;
  font-size: 10px; font-weight: 700; line-height: 15px;
  box-shadow: 0 2px 6px rgba(44, 128, 232, .35);
  transition: background .3s ease, box-shadow .3s ease;
  pointer-events: none;
}
.ans-pet.max .ans-pet-lv {
  background: linear-gradient(135deg, #F6B93B, #E08A1E);
  box-shadow: 0 2px 8px rgba(224, 138, 30, .45);
}

/* 悬停气泡：等级 / 称号 / 经验条 / 进度 */
.ans-pet-bubble {
  position: absolute; bottom: calc(100% + 8px); left: 50%;
  width: 192px; margin-left: -96px;
  padding: 9px 11px 10px;
  background: #fff;
  border: 1px solid #dbe9fb;
  border-radius: 12px;
  box-shadow: 0 10px 26px rgba(44, 128, 232, .2);
  opacity: 0; transform: translateY(6px) scale(.96);
  transform-origin: 50% 100%;
  transition: opacity .18s ease, transform .18s ease;
  pointer-events: none;
}
.ans-pet-bubble::after {
  content: '';
  position: absolute; left: 50%; bottom: -5px;
  width: 9px; height: 9px; margin-left: -5px;
  background: #fff;
  border-right: 1px solid #dbe9fb;
  border-bottom: 1px solid #dbe9fb;
  transform: rotate(45deg);
}
.ans-pet.hover .ans-pet-bubble { opacity: 1; transform: translateY(0) scale(1); }
.ans-pet.bub-l .ans-pet-bubble { left: 0; margin-left: -4px; }
.ans-pet.bub-l .ans-pet-bubble::after { left: 24px; }
.ans-pet.bub-r .ans-pet-bubble { left: auto; right: 0; margin-left: 0; }
.ans-pet.bub-r .ans-pet-bubble::after { left: auto; right: 24px; margin-left: 0; }
.ans-pet.pop .ans-pet-bubble { opacity: 0; }

.ans-pet-row { display: flex; align-items: baseline; gap: 5px; }
.ans-pet-row b { font-size: 13px; font-weight: 700; color: #1F66B8; }
.ans-pet-title { font-size: 12px; color: #6b87a3; }
.ans-pet-bar { margin-top: 6px; height: 6px; border-radius: 999px; background: #EAF3FE; overflow: hidden; }
.ans-pet-bar i {
  display: block; height: 100%; width: 0;
  border-radius: 999px;
  background: #2C80E8;
  transition: width .6s ease;
}
.ans-pet-sub { margin-top: 6px; font-size: 11.5px; line-height: 1.4; color: #8aa4bd; }

/* 飘字：+30 EXP / 升级 / 再试一次 */
.ans-pet-pop {
  position: absolute; left: 50%; bottom: calc(100% + 2px);
  width: 150px; margin-left: -75px;
  text-align: center;
  font-size: 13px; font-weight: 700; color: #1E9C62;
  opacity: 0; transform: translateY(4px);
  transition: opacity .3s ease, transform .3s ease;
  pointer-events: none;
}
.ans-pet.pop .ans-pet-pop { opacity: 1; transform: translateY(-16px); }
.ans-pet.pop.bad .ans-pet-pop { color: #C2413B; }

@media (max-width: 767px) {
  .ans-pet { width: 52px; height: 60px; }
  .ans-pet-fig img { width: 52px; height: 60px; }
  .ans-pet-bubble { width: 168px; margin-left: -84px; }
}
@media (prefers-reduced-motion: reduce) {
  .ans-pet.walking .ans-pet-fig,
  .ans-pet.hop .ans-pet-fig,
  .ans-pet.wrong .ans-pet-fig,
  .ans-pet.levelup .ans-pet-fig { animation: none; }
}
