:root {
  --orange: #ff8a3d;
  --orange-d: #f0691a;
  --blue: #3d7bff;
  --bg: #fff6ee;
  --card: #ffffff;
  --ink: #333;
  --sub: #8a7466;
  --line: #f0e2d4;
  --ok: #1aa654;
  --no: #d94f4f;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* hidden 属性必须赢过作者样式里的 display:flex/block,否则弹层关不掉 */
[hidden] { display: none !important; }
html { font-size: 17px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
  line-height: 1.65;
}
header {
  position: sticky; top: 0; z-index: 5;
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px;
  background: linear-gradient(135deg, var(--orange), #ffb15e);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
.logo { font-size: 20px; font-weight: 700; }
button {
  font: inherit; border: 0; border-radius: 12px; cursor: pointer;
  transition: transform .05s, filter .15s, background .15s;
}
button:active { transform: scale(.97); }
button:disabled { opacity: .6; cursor: wait; }
.ghost { background: rgba(255,255,255,.22); color: #fff; padding: 8px 14px; }
.big {
  flex: 1; background: #fff; border: 2px solid var(--line);
  padding: 14px 8px; color: var(--ink); font-size: 16px;
}
.big.small { flex: 0 0 auto; padding: 14px 16px; }
.primary {
  width: 100%; background: var(--orange); color: #fff;
  font-size: 19px; font-weight: 700; padding: 16px; margin-top: 12px;
  box-shadow: 0 4px 14px rgba(240,105,26,.35);
}
.link { background: none; color: var(--blue); text-decoration: underline; padding: 8px 0; }

main { max-width: 680px; margin: 0 auto; padding: 14px 14px 40px; }
.card {
  background: var(--card); border-radius: 18px; padding: 16px 18px;
  margin-bottom: 14px; box-shadow: 0 2px 10px rgba(120,80,30,.07);
}
.banner {
  max-width: 680px; margin: 12px auto 0; padding: 12px 16px;
  background: #fff3cd; color: #7a5b00; border-radius: 14px; border: 1px solid #ffe39a;
  font-size: 15px;
}

.preview {
  border: 2px dashed var(--orange); border-radius: 16px;
  min-height: 150px; display: flex; align-items: center; justify-content: center;
  overflow: hidden; background: #fffdf9; margin-bottom: 12px;
}
.ph { color: var(--sub); text-align: center; font-size: 15px; padding: 20px; }
.preview img { width: 100%; display: block; border-radius: 12px; }
.btnrow { display: flex; gap: 10px; }
#qtext {
  width: 100%; margin-top: 10px; padding: 12px; border-radius: 12px;
  border: 2px solid var(--line); font-size: 16px; resize: vertical;
}
.hint { color: var(--sub); font-size: 13px; margin: 8px 2px 0; }

/* 加载 */
.loading { text-align: center; padding: 34px 16px; }
.spinner {
  width: 54px; height: 54px; margin: 0 auto 14px;
  border: 6px solid #ffe1c7; border-top-color: var(--orange);
  border-radius: 50%; animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loadmsg { font-size: 18px; font-weight: 600; }
.loadsec { color: var(--sub); margin-top: 4px; }
.loadnote { color: var(--sub); font-size: 14px; margin-top: 10px; }

/* 结果卡片 */
.card h2 { margin: 0 0 10px; font-size: 18px; color: var(--orange-d); }
.card h2 .sub { font-size: 13px; color: var(--sub); font-weight: 400; margin-left: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  background: #fff1e2; color: var(--orange-d); border: 1px solid #ffd9b8;
  padding: 4px 12px; border-radius: 999px; font-size: 15px;
}
.unit { margin: 10px 0 0; color: #5b4a3a; }
.qthumb { width: 100%; border-radius: 12px; margin-bottom: 10px; border: 1px solid var(--line); }
.qtext { font-size: 17px; background: #faf5ef; padding: 12px 14px; border-radius: 12px; margin: 0; }

.steps { counter-reset: st; list-style: none; padding: 0; margin: 0; }
.steps li {
  position: relative; padding: 0 0 14px 44px; margin: 0;
}
.steps li::before {
  counter-increment: st; content: counter(st);
  position: absolute; left: 0; top: 2px;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--orange); color: #fff; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.steps li::after {
  content: ""; position: absolute; left: 14px; top: 34px; bottom: 4px;
  width: 2px; background: var(--line);
}
.steps li:last-child::after { display: none; }
.stepT { font-weight: 700; }
.stepX { color: #4a4a4a; }

.warn { border: 2px solid #ffd28a; background: #fffbea; }
.warn h2 { color: #b26a00; }

.reveal {
  width: 100%; background: #eef3ff; color: var(--blue); padding: 12px; font-size: 16px;
}
.reveal.slim { width: auto; padding: 6px 14px; font-size: 14px; background: #f2f6ff; }
.ansbox { margin-top: 12px; text-align: center; }
.ans {
  display: inline-block; font-size: 22px; font-weight: 800; color: var(--ok);
  background: #e8f8ee; padding: 10px 22px; border-radius: 14px;
}
.mis { margin: 0; padding-left: 22px; }
.mis li { margin-bottom: 6px; }

.pitem {
  border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 14px; margin-bottom: 12px; background: #fffdf9;
}
.pq { font-weight: 600; margin-bottom: 10px; }
.prow { display: flex; gap: 8px; }
.pans {
  flex: 1; min-width: 0; padding: 10px 12px; border-radius: 12px;
  border: 2px solid var(--line); font-size: 16px;
}
.chk { background: var(--blue); color: #fff; padding: 10px 14px; white-space: nowrap; }
.fb { margin: 10px 0; padding: 10px 14px; border-radius: 12px; font-size: 15px; }
.fb.good { background: #e8f8ee; color: #14683c; }
.fb.oops { background: #fdecec; color: #a33; }
.fans { margin-top: 10px; background: #f4f9ff; padding: 10px 14px; border-radius: 12px; }
.fans b { color: var(--blue); font-size: 18px; }
.fans p { margin: 6px 0 0; color: #5b6b80; }

.meta { color: var(--sub); font-size: 13px; }
.raw { white-space: pre-wrap; word-break: break-all; background: #f7f3ee; padding: 12px; border-radius: 10px; font-size: 14px; }

/* 历史 */
.hitem { padding: 10px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
.hitem:last-child { border-bottom: 0; }
.hdate { color: var(--sub); font-size: 13px; }
.htitle { font-weight: 600; }
.hmeta { color: var(--sub); font-size: 12px; float: right; }

footer { text-align: center; color: var(--sub); font-size: 13px; padding: 18px 10px 30px; }

/* 设置弹层 */
.overlay {
  position: fixed; inset: 0; background: rgba(40,20,0,.45);
  display: flex; align-items: flex-end; justify-content: center; z-index: 20;
}
.sheet { width: 100%; max-width: 680px; border-radius: 22px 22px 0 0; padding: 20px 20px 30px; }
.sheet label { display: block; margin-bottom: 12px; font-size: 15px; color: var(--sub); }
.sheet select, .sheet input {
  width: 100%; margin-top: 4px; padding: 12px; font-size: 16px;
  border-radius: 12px; border: 2px solid var(--line); background: #fffdf9; color: var(--ink);
}

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%);
  background: #333; color: #fff; padding: 12px 20px; border-radius: 14px;
  max-width: 86vw; z-index: 30; font-size: 15px; box-shadow: 0 4px 16px rgba(0,0,0,.3);
}
.toast.bad { background: #b3423a; }

/* 模式切换 */
.modes { display: flex; gap: 8px; margin-bottom: 6px; }
.mode { flex: 1; background: #f6f1ea; color: var(--sub); border: 2px solid transparent; padding: 12px; font-size: 16px; font-weight: 600; border-radius: 14px; }
.mode.on { background: #fff1e2; color: var(--orange-d); border-color: var(--orange); box-shadow: 0 2px 8px rgba(240,105,26,.15); }
.modehint { color: var(--sub); font-size: 13px; margin: 0 2px 12px; }

/* 引导式对话 */
.chatlog { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 12px; }
.bub { display: flex; align-items: flex-start; gap: 8px; max-width: 92%; }
.bub.kid { align-self: flex-end; flex-direction: row-reverse; }
.bwho { flex: 0 0 auto; font-size: 12px; color: #fff; background: var(--blue); border-radius: 999px; padding: 2px 9px; margin-top: 6px; }
.bub.teach .bwho { background: var(--orange); }
.btext { background: #f2f6ff; border-radius: 14px 14px 14px 4px; padding: 10px 14px; font-size: 16px; line-height: 1.6; white-space: pre-wrap; }
.bub.kid .btext { background: #e8f8ee; border-radius: 14px 14px 4px 14px; }
.chatrow { display: flex; gap: 8px; }
.chatrow input { flex: 1; min-width: 0; padding: 12px 14px; border-radius: 12px; border: 2px solid var(--line); font-size: 16px; }
.sendbtn { flex: 0 0 auto; width: auto; padding: 12px 22px; font-size: 16px; margin: 0; }

/* 头部用户区 */
.hbtns { display: flex; align-items: center; gap: 8px; }
.who { color: #fff; font-size: 14px; background: rgba(255,255,255,.2); padding: 5px 10px; border-radius: 999px; }
.adminlink { color: #fff; font-weight: 700; text-decoration: underline; }

/* 登录 / 改密遮罩 */
.loginmask {
  position: fixed; inset: 0; z-index: 40;
  background: linear-gradient(135deg, #ff8a3d, #ffb15e);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.logincard {
  width: 100%; max-width: 360px; background: #fff; border-radius: 20px;
  padding: 26px 22px; box-shadow: 0 10px 40px rgba(0,0,0,.2);
}
.loginlogo { font-size: 22px; font-weight: 800; text-align: center; color: var(--orange-d); }
.logintip { text-align: center; color: var(--sub); font-size: 14px; margin: 8px 0 18px; }
.logincard input {
  width: 100%; padding: 13px 14px; margin-bottom: 12px; font-size: 16px;
  border: 2px solid var(--line); border-radius: 12px; background: #fffdf9; color: var(--ink);
}
.logincard input:focus { outline: none; border-color: var(--orange); }
.loginerr { background: #fdecec; color: #a33; padding: 10px 12px; border-radius: 10px; font-size: 14px; margin-top: 10px; }
.loginfoot { color: var(--sub); font-size: 12px; text-align: center; margin: 16px 0 0; }
body.locked { overflow: hidden; }
