/* ── 课包共用视觉 ─────────────────────────────────────
   沿用课件与第 1 课体验版：纸色底、白卡、黑体、贴在纸上的照片、有厚度的按钮、四色语义。
   颜色与 shared/tokens.css（PDF 课件）同值，不另做深色主题。 */
:root{
  --paper:#FBF6EC; --paper-2:#F3EBDD; --paper-3:#EAE0CC;
  --ink:#1F2A44; --ink-soft:#5B6478; --ink-faint:#8B93A6; --line:#E2D9C8;
  --coral:#F26B5B; --coral-deep:#D9503F;
  --mint:#3FB79A;  --mint-deep:#2E9079;
  --sun:#F7C548;   --sun-deep:#E0AB1F;
  --sky:#4F86E0;   --sky-deep:#3568C4;

  --font:"PingFang SC","Hiragino Sans GB","Noto Sans SC","Microsoft YaHei",sans-serif;
  --mono:"JetBrains Mono","SF Mono",Menlo,"PingFang SC",monospace;
  --radius:28px; --radius-sm:16px;
  --shadow:0 10px 30px rgba(31,42,68,.10);
  --shadow-lift:0 16px 40px rgba(31,42,68,.16);
  --avail:560px;

  --fs-h1:clamp(28px,3.4vw,50px);
  --fs-sub:clamp(17px,1.9vw,27px);
  --fs-body:clamp(16px,1.7vw,24px);
  --fs-card:clamp(15px,1.5vw,21px);
  --fs-min:15px;
  color-scheme:light;
}

*{box-sizing:border-box}
html{
  height:100%;
  overflow-x:hidden;
  overflow-x:clip;
  -webkit-text-size-adjust:100%;
  text-size-adjust:100%;
}
html,body{height:100%}
body{
  margin:0; background:var(--paper); color:var(--ink); font-family:var(--font);
  -webkit-font-smoothing:antialiased; -webkit-tap-highlight-color:transparent;
  min-height:100%; min-height:100dvh;
  overflow-x:hidden; overflow-x:clip;
}
button{font-family:inherit; cursor:pointer; border:0; background:none; color:inherit; padding:0}
figure{margin:0}
input,textarea,select{font-family:inherit; font-size:16px}
img{max-width:100%; height:auto}
[hidden]{display:none !important}

h1{font-size:var(--fs-h1); line-height:1.22; margin:0; font-weight:700; letter-spacing:.01em; text-wrap:balance}
h2{font-size:clamp(21px,2.4vw,32px); line-height:1.3; margin:0; font-weight:700; text-wrap:balance}
h3{margin:0; font-size:clamp(18px,1.8vw,24px); font-weight:700}
.lead{font-size:var(--fs-sub); line-height:1.6; color:var(--ink-soft); margin:0; max-width:30em}
.head{display:flex; flex-direction:column; gap:14px}

/* ── 按钮：有厚度，像可以按下去 ── */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:10px; min-height:48px;
  padding:13px 30px; border-radius:999px; font-size:clamp(17px,1.6vw,22px); font-weight:700;
  background:var(--ink); color:var(--paper); box-shadow:0 5px 0 rgba(31,42,68,.28);
  transition:transform .12s, box-shadow .12s, background .2s, opacity .2s; text-decoration:none; white-space:nowrap;
}
.btn:active{transform:translateY(4px); box-shadow:0 1px 0 rgba(31,42,68,.28)}
.btn.primary{background:var(--coral); color:#fff; box-shadow:0 5px 0 var(--coral-deep)}
.btn.mint{background:var(--mint); color:#fff; box-shadow:0 5px 0 var(--mint-deep)}
.btn.ghost{background:#fff; color:var(--ink); box-shadow:0 5px 0 var(--line)}
.btn.small{min-height:40px; padding:8px 20px; font-size:17px}
.btn:disabled{opacity:.42; cursor:not-allowed; transform:none}
.btn:focus-visible,.icon-btn:focus-visible{outline:4px solid var(--sky); outline-offset:4px}
.icon-btn{
  width:44px; height:44px; border-radius:50%; background:#fff; box-shadow:var(--shadow);
  display:grid; place-items:center; color:var(--ink); flex:0 0 auto;
}
.icon-btn svg{width:22px; height:22px}
.row{display:flex; gap:14px; flex-wrap:wrap; align-items:center}

/* ── 星能：电池、价签、飞行的闪电 ── */
.bolt{width:1em; height:1em; fill:currentColor; flex:0 0 auto}
.price{
  display:inline-flex; align-items:center; gap:2px; padding:3px 11px 3px 7px; margin-left:4px;
  border-radius:999px; background:rgba(255,255,255,.24); font-size:.8em; font-weight:700;
  font-variant-numeric:tabular-nums; line-height:1.2;
}
.price .bolt{fill:var(--sun)}
.btn.ghost .price{background:var(--paper-2)}
.btn.ghost .price .bolt{fill:var(--sun-deep)}
.battery{
  display:inline-flex; align-items:center; gap:8px; min-height:44px; padding:6px 16px 6px 12px;
  border-radius:999px; background:#fff; box-shadow:var(--shadow); font-size:16px; font-weight:700;
  color:var(--ink); white-space:nowrap;
}
.battery .cell{position:relative; width:30px; height:17px; border:2.5px solid var(--ink); border-radius:5px; padding:2px; margin-right:6px}
.battery .cell::after{content:''; position:absolute; right:-6px; top:3.5px; width:3.5px; height:6px; border-radius:0 2px 2px 0; background:var(--ink)}
.battery .cell i{display:block; height:100%; width:var(--level,100%); border-radius:2px; background:var(--mint); transition:width .6s}
.battery.low .cell i{background:var(--coral)}
.battery .label{font-weight:400; color:var(--ink-soft); font-size:14px}
.battery .num{font-variant-numeric:tabular-nums}
.battery .sep{color:var(--line); margin:0 2px}
.battery.asleep .cell i{background:var(--ink-faint); width:22%}
.battery.asleep .num{color:var(--ink-soft); font-weight:600}
.fly{
  position:fixed; left:0; top:0; z-index:95; pointer-events:none; display:flex; align-items:center; gap:3px;
  padding:6px 13px 6px 9px; border-radius:999px; background:var(--sun); color:var(--ink);
  font-weight:700; font-size:18px; box-shadow:var(--shadow-lift);
}

/* ── 选择卡 ── */
.choices{display:grid; gap:16px; width:100%}
.choices.two{grid-template-columns:1fr 1fr}
.choices.three{grid-template-columns:repeat(3,1fr)}
.choices.tags .choice{text-align:center; font-size:clamp(18px,1.9vw,26px); padding:22px 18px}
.choice{
  text-align:left; background:#fff; border:3px solid transparent; border-radius:var(--radius-sm);
  padding:18px 24px; font-size:var(--fs-body); line-height:1.55; font-weight:600;
  box-shadow:var(--shadow); min-height:56px; transition:border-color .2s, transform .15s, box-shadow .2s;
}
.choice:hover:not(.locked){border-color:var(--sky); transform:translateY(-3px); box-shadow:var(--shadow-lift)}
.choice:focus-visible{outline:4px solid var(--sky); outline-offset:3px}
.choice.picked{border-color:var(--sun)}
.choice.right{border-color:var(--mint); background:#F1FAF7}
.choice.wrong{border-color:var(--coral); background:#FEF2F0}
.choice.locked{cursor:default}

/* ── 照片：像贴在纸上 ── */
.photoframe{background:#fff; padding:14px; border-radius:12px; box-shadow:var(--shadow); align-self:center; max-width:100%; transform:rotate(-1.2deg)}
.photoframe img,.photoframe video{display:block; width:100%; border-radius:6px; object-fit:cover}
.photoframe.flat{transform:none}
.photoframe.tilt-r{transform:rotate(1.4deg)}

/* ── 输入 ── */
.promptbox{
  width:100%; display:flex; flex-direction:column; gap:12px;
  background:#fff; border:4px solid var(--line); border-radius:var(--radius); padding:20px 26px;
}
.promptbox:focus-within{border-color:var(--sky)}
.promptbox textarea,.promptbox input{
  background:transparent; border:0; resize:none; color:var(--ink); width:100%;
  font-size:clamp(19px,2.1vw,28px); line-height:1.55; outline:none; font-weight:700;
}
.promptbox textarea{min-height:88px}
.promptbox textarea::placeholder,.promptbox input::placeholder{color:var(--ink-faint); font-weight:400}
.counter{font-size:14px; color:var(--ink-faint); text-align:right; font-variant-numeric:tabular-nums}
.chips{display:flex; flex-wrap:wrap; gap:10px}
.chip{
  padding:9px 18px; border-radius:999px; background:var(--paper-2); border:1px solid var(--line);
  font-size:var(--fs-min); color:var(--ink-soft); min-height:40px; transition:background .2s, color .2s, border-color .2s;
}
.chip:hover{background:var(--sun); border-color:var(--sun-deep); color:var(--ink)}

/* ── 卡片 ── */
.cards{display:grid; gap:20px; width:100%}
.cards.two{grid-template-columns:repeat(2,1fr)}
.cards.three{grid-template-columns:repeat(3,1fr)}
.cards.four{grid-template-columns:repeat(4,1fr)}
.card{background:#fff; border-radius:var(--radius); box-shadow:var(--shadow); padding:22px; display:flex; flex-direction:column; gap:12px}
.card img{width:100%; height:min(calc(var(--avail) * .28), 170px); object-fit:contain; background:var(--paper-2); border-radius:var(--radius-sm)}
/* 产品真实图标：统一装进白底圆角瓷砖，各家图标形状底色不一也能摆齐 */
.tool-icon,.card img.tool-icon,.cards .card img.tool-icon{width:min(calc(var(--avail) * .15), 84px); height:min(calc(var(--avail) * .15), 84px); flex:0 0 auto; display:block; border-radius:20px; object-fit:contain; padding:8px; background:#fff; border:3px solid var(--line)}
.card p{margin:0; font-size:var(--fs-card); line-height:1.6; color:var(--ink-soft)}
.conclude{
  align-self:center; background:#fff; border-radius:999px; box-shadow:var(--shadow);
  padding:18px 44px; font-size:clamp(19px,2.1vw,29px); font-weight:700; line-height:1.5; text-align:center; max-width:100%;
}
.pill{
  display:inline-flex; align-items:center; gap:6px; padding:5px 14px; border-radius:999px;
  background:var(--paper-2); color:var(--ink-soft); font-size:15px; font-weight:600; white-space:nowrap;
}

/* ── AI 卡片：AI 现场生成的内容一律装在这里，带「AI 生成」标识 ── */
.ai-card{
  position:relative; background:#fff; border:3px solid var(--sky); border-radius:var(--radius);
  box-shadow:var(--shadow); padding:30px 28px 22px; width:100%;
}
.ai-tag{
  position:absolute; top:-15px; left:22px; display:inline-flex; align-items:center; gap:6px;
  padding:4px 14px; border-radius:999px; background:var(--sky); color:#fff; font-size:15px; font-weight:700; letter-spacing:.04em;
}
.ai-tag::before{content:''; width:8px; height:8px; border-radius:50%; background:#fff; opacity:.85}
.ai-card .ai-body{font-size:var(--fs-body); line-height:1.8; white-space:pre-wrap; word-break:break-word}
.ai-card .ai-body.thinking::after{content:'▍'; animation:blink 1s steps(1) infinite; color:var(--sky)}
@keyframes blink{50%{opacity:0}}
.mine{
  display:flex; gap:12px; align-items:baseline; font-size:var(--fs-card); line-height:1.6; color:var(--ink);
  background:var(--paper-2); border-radius:var(--radius-sm); padding:12px 18px;
}
.mine-tag{flex:0 0 auto; padding:2px 12px; border-radius:999px; background:var(--coral); color:#fff; font-size:14px; font-weight:700}

/* ── 弹层 ── */
.modal{
  position:fixed; inset:0; z-index:80; background:rgba(31,42,68,.55);
  display:flex; align-items:center; justify-content:center;
  padding:max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  animation:fadeIn .2s both;
}
.modal .sheet{
  background:var(--paper); border-radius:var(--radius); box-shadow:0 30px 80px rgba(0,0,0,.3);
  padding:28px 30px; width:100%; max-width:560px;
  max-height:calc(100vh - 32px); max-height:calc(100dvh - 32px); overflow:auto;
  display:flex; flex-direction:column; gap:16px; align-items:center; text-align:center;
  -webkit-overflow-scrolling:touch;
}
.modal .sheet:focus{outline:none}
.modal .sprite{width:112px; height:112px; object-fit:contain}
.modal h2{font-size:clamp(22px,2.6vw,32px)}
.modal p{font-size:var(--fs-body); line-height:1.6; margin:0; color:var(--ink-soft)}
.modal .echo{
  width:100%; text-align:left; font-size:var(--fs-card); line-height:1.65; background:#fff;
  border-left:10px solid var(--sky); border-radius:0 var(--radius-sm) var(--radius-sm) 0; padding:14px 20px;
}
.modal .row{justify-content:center}
.modal.energy-help .row{flex-wrap:wrap; gap:10px}
.modal.crisis .sheet{border:5px solid var(--coral)}
.modal.wide .sheet{max-width:760px}
@keyframes fadeIn{from{opacity:0}to{opacity:1}}
@keyframes popIn{from{opacity:0; transform:translate(-50%,12px) scale(.96)}to{opacity:1; transform:translate(-50%,0)}}

/* ── 精灵说一句（只有字幕，不配音） ── */
.sprite-say{
  position:fixed; left:50%; top:84px; transform:translateX(-50%); z-index:75;
  display:flex; align-items:center; gap:10px; width:max-content; max-width:min(640px, calc(100vw - 32px));
  animation:popIn .3s both; pointer-events:none;
}
.sprite-say img{width:76px; height:76px; object-fit:contain; flex:0 0 auto}
.sprite-say .words{
  background:#fff; border-radius:20px; padding:14px 20px; box-shadow:var(--shadow-lift);
  font-size:var(--fs-card); line-height:1.6; font-weight:600;
}

/* ── 出错兜底 ── */
.errbox{
  background:#fff; border:3px solid var(--coral); border-radius:var(--radius); padding:22px 26px;
  font-size:var(--fs-body); line-height:1.7; box-shadow:var(--shadow);
  display:flex; flex-direction:column; gap:16px; max-width:820px; align-self:center; width:100%;
}
.errbox p{margin:0}

@media (max-width:900px), (orientation:portrait){
  .choices.two,.choices.three,.cards.two,.cards.three,.cards.four{grid-template-columns:1fr}
  .choices.three.tags{grid-template-columns:1fr 1fr}
  .cards .card{display:grid; grid-template-columns:92px 1fr; grid-template-areas:"m t" "m p"; gap:4px 16px; align-items:center; padding:16px 18px}
  .cards .card img{grid-area:m; width:92px; height:92px; margin:0}
  .cards .card h3{grid-area:t}
  .cards .card p{grid-area:p}
  .modal .sheet{padding:22px 18px}
  .sprite-say{top:72px}
  .sprite-say img{width:56px; height:56px}
  .btn{white-space:normal; text-align:center}
  .btn.small{font-size:16px}
}
@media (prefers-reduced-motion:reduce){
  *{animation-duration:.01ms !important; transition-duration:.01ms !important}
}

/* 精灵字幕挪到右上角（电池下面），不压标题 */
.sprite-say{left:auto; right:max(24px, env(safe-area-inset-right, 0px)); top:max(84px, calc(env(safe-area-inset-top, 0px) + 64px)); transform:none; animation:popInR .3s both}
@keyframes popInR{from{opacity:0; transform:translateY(-10px) scale(.96)}to{opacity:1; transform:none}}
@media (max-width:900px), (orientation:portrait){
  .sprite-say{left:max(12px, env(safe-area-inset-left, 0px)); right:max(12px, env(safe-area-inset-right, 0px)); top:auto; bottom:calc(178px + env(safe-area-inset-bottom, 0px)); width:auto; max-width:none}
}
/* 超窄屏：选择卡 / 词条再收一点 */
@media (max-width:380px){
  .choice{padding:14px 16px; font-size:16px}
  .chip{padding:8px 14px; font-size:15px}
  .cards .card{grid-template-columns:72px 1fr; padding:12px 14px}
  .cards .card img{width:72px; height:72px}
}

/* 微信内置浏览器：底栏/顶栏会吃安全区外的空间 */
html.wechat body{padding-bottom:env(safe-area-inset-bottom, 0px)}
html.wechat .toast{bottom:calc(28px + env(safe-area-inset-bottom, 0px))}
