/* 实验室小课堂：奶油纸张、黑板绿与暖木色 */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root { --ink: #293d33; --muted: #73786b; --green: #304e3d; --line: #e5e4d8; --paper: #faf8f0; }
html, body { min-height: 100%; }
body { font-family: "PingFang SC", "Microsoft YaHei", sans-serif; color: var(--ink); background: #705134; }
button, input { font: inherit; }
button, a, [role="button"] { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid #c28a43; outline-offset: 4px; }
.bg-decor { position: fixed; inset: 0; pointer-events: none; background: linear-gradient(180deg, rgba(19,30,22,.44), transparent 28%, rgba(36,25,13,.16)), url("assets/backgrounds/warm-laboratory.png") center / cover no-repeat; }
.app { position: relative; display: grid; grid-template-columns: minmax(340px, 410px) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); column-gap: clamp(32px, 5vw, 90px); max-width: 1320px; height: 100vh; height: 100svh; min-height: 700px; margin: auto; padding: 24px 40px 40px; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: #b6ce9e; flex-shrink: 0; }
.chat-panel { display: flex; flex-direction: column; align-self: center; min-height: 0; height: min(100%, 760px); border: 1px solid #fff9e8c7; border-radius: 24px; background: rgba(250,248,240,.97); box-shadow: 0 24px 70px #241c1233, inset 0 1px 0 #ffffff; overflow: hidden; }
.chat-header { display: flex; align-items: center; gap: 12px; padding: 22px 24px 18px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, #fdfcf6, transparent); }
.avatar-mini { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 15px; background: linear-gradient(135deg, #e9eddc, #d7dfc9); color: var(--green); font-family: serif; font-size: 26px; box-shadow: inset 0 0 0 1px #ffffffb3, 0 2px 6px #293d3314; }
.peer-info h1 { font-size: 21px; font-weight: 600; letter-spacing: .5px; }
.status { display: flex; align-items: center; gap: 6px; margin-top: 5px; color: var(--muted); font-size: 12px; }
.status .dot { position: relative; background: #729264; }
.status .dot::after { content: ""; position: absolute; inset: -3px; border-radius: 50%; border: 1px solid #729264; opacity: 0; animation: dotPulse 2.4s ease-out infinite; }
@keyframes dotPulse { 0% { transform: scale(.4); opacity: .7; } 70%, 100% { transform: scale(1.4); opacity: 0; } }
.messages { flex: 1; min-height: 70px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; padding: 18px 24px 24px; scrollbar-width: thin; scrollbar-color: #cbd1c0 transparent; }
.messages::-webkit-scrollbar { width: 5px; }
.messages::-webkit-scrollbar-thumb { border-radius: 3px; background: #cbd1c0; }
.messages::-webkit-scrollbar-thumb:hover { background: #aab39c; }
.messages::-webkit-scrollbar-track { background: transparent; }
.msg { flex-shrink: 0; max-width: 92%; padding: 13px 15px; border-radius: 16px; font-size: 13px; line-height: 1.85; overflow-wrap: anywhere; white-space: pre-wrap; animation: msgIn .28s cubic-bezier(.21, .9, .35, 1.1); }
.msg.bot { align-self: flex-start; background: #fffefb; border: 1px solid #e6e7dc; border-bottom-left-radius: 4px; box-shadow: 0 2px 8px #293d3310; }
.msg.user { align-self: flex-end; color: #fffdf5; background: linear-gradient(135deg, #3a5c47, var(--green)); border-bottom-right-radius: 4px; box-shadow: 0 4px 12px #304e3d2e; }
@keyframes msgIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.lesson-q { font-weight: 600; }
.lesson-options { display: flex; gap: 8px; margin-top: 10px; }
.lesson-options button { padding: 7px 18px; border: 1px solid #dddfd1; border-radius: 999px; background: #fbfaf4; color: var(--ink); font-size: 12px; transition: background .18s, border-color .18s, transform .18s; }
.lesson-options button:hover:not(:disabled) { background: #eef1e2; border-color: #98ab8b; transform: translateY(-1px); }
.lesson-options button:disabled { cursor: default; opacity: .7; }
.lesson-options button.chosen { background: #e4eed9; border-color: #729264; color: var(--green); font-weight: 600; opacity: 1; }
.chat-controls { flex-shrink: 0; padding: 12px 22px 12px; border-top: 1px solid var(--line); background: #f5f3e9; }
.suggestion-label { font-size: 10px; color: #858677; margin-bottom: 8px; letter-spacing: 1px; }
.quick-replies { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.quick-replies button { flex-shrink: 0; white-space: nowrap; min-height: 32px; padding: 6px 12px; border: 1px solid #dddfd1; border-radius: 999px; background: #fbfaf4; color: #55614e; font-size: 11px; text-align: left; transition: background .18s, border-color .18s, transform .18s, box-shadow .18s; }
.quick-replies button span { color: #8f9b76; margin-right: 5px; font-size: 14px; transition: transform .18s; }
.quick-replies button:hover { background: #eef1e2; border-color: #98ab8b; transform: translateY(-1px); box-shadow: 0 4px 10px #293d3314; }
.quick-replies button:hover span { transform: translateY(-1px); }
.quick-replies button:active { transform: translateY(0); box-shadow: none; }
.composer { display: flex; align-items: center; gap: 8px; padding: 6px; border: 1px solid #d5d9c9; border-radius: 13px; background: #fffefb; transition: border-color .2s, box-shadow .2s; }
.composer:focus-within { border-color: #729264; box-shadow: 0 0 0 3px #72926426; }
.composer input { min-width: 0; width: 100%; padding: 9px 8px; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 13px; }
.composer input::placeholder { color: #969b8f; }
.composer button { display: grid; place-items: center; flex-shrink: 0; width: 36px; height: 36px; border: 0; border-radius: 9px; background: var(--green); color: #fff9e8; transition: background .2s, transform .15s, box-shadow .2s; }
.composer button:hover { background: #466a50; transform: translateY(-1px); box-shadow: 0 4px 10px #304e3d38; }
.composer button:active { transform: translateY(0); box-shadow: none; }
.composer button:disabled { opacity: .45; cursor: wait; }
.input-hint { display: flex; justify-content: space-between; gap: 10px; margin-top: 10px; font-size: 10px; color: #919383; }
.typing { display: inline-flex; gap: 4px; padding: 4px 0; }
.typing i { width: 5px; height: 5px; border-radius: 50%; background: #7d946f; animation: typingBounce 1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes typingBounce { 0%,60%,100% { transform: translateY(0); } 30% { transform: translateY(-4px); } }
/* 阴影置于人物画布内，对齐素材底部约 96% 的鞋底位置。 */
.stage { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; min-width: 0; padding: 42px 0 12px; }
.character { position: relative; flex-shrink: 0; height: min(65vh, 650px); height: min(65svh, 650px, max(400px, calc(100svh - 300px)), calc((100vw - 580px) * 1.5)); max-width: 100%; aspect-ratio: 2 / 3; cursor: pointer; border-radius: 20px; }
.puppet { position: relative; height: 100%; aspect-ratio: 1024 / 1536; margin: auto; z-index: 1; }
.puppet img { position: absolute; user-select: none; -webkit-user-drag: none; pointer-events: none; will-change: transform; transition: opacity .08s; }
.puppet img.layer-hidden { opacity: 0; }
.stage-shadow { position: absolute; left: 27%; bottom: 2%; width: 46%; height: 4%; border-radius: 50%; background: radial-gradient(ellipse, #281c1399, #281c1333 45%, transparent 72%); }
.teacher-card { display: flex; align-items: center; justify-content: space-between; gap: 22px; width: min(100%, 410px); padding: 13px 18px; border: 1px solid #fff9e8c7; border-radius: 16px; background: rgba(250,248,240,.92); color: var(--ink); box-shadow: 0 12px 32px #241c122e, inset 0 1px 0 #ffffff; -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
.stage-name { font-size: 17px; font-weight: 600; white-space: nowrap; }
.stage-name span { margin-left: 6px; font-size: 10px; font-weight: 400; color: var(--muted); }
.stage-hint { margin-top: 5px; font-size: 10px; color: var(--muted); }
.interaction-hint { font-size: 10px; color: #8c784f; white-space: nowrap; }
.interaction-hint > span { margin-left: 6px; }
.speech-bubble { position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: max-content; max-width: min(90%, 320px); padding: 12px 17px; border: 1px solid #fff6dd73; border-radius: 16px 16px 4px 16px; background: #faf7ecf5; color: var(--ink); box-shadow: 0 8px 24px #1822191f; font-size: 12px; line-height: 1.8; z-index: 5; transition: opacity .25s; pointer-events: none; }
.speech-bubble.hidden { opacity: 0; }
.loading-hint { position: absolute; inset: 0; display: grid; place-items: center; color: #fff6df; font-size: 14px; pointer-events: none; z-index: 2; }
.loading-hint.hidden { display: none; }
.loading-hint.error { color: #ffd4bd; }
.hearts { position: absolute; inset: 0; pointer-events: none; z-index: 4; }
.heart { position: absolute; font-size: 18px; animation: heartFly 1.6s ease-out forwards; }
@keyframes heartFly { 0% { transform: translateY(0) scale(.4); opacity: 0; } 20% { opacity: 1; } 100% { transform: translateY(-100px) scale(1.1) rotate(12deg); opacity: 0; } }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media (min-width: 1600px) { .app { max-width: 1460px; grid-template-columns: 430px minmax(0,1fr); padding-top: 32px; padding-bottom: 60px; } .chat-panel { height: min(100%, 820px); } .character { height: min(68svh, 800px, calc(100svh - 330px)); } }
@media (max-width: 900px) { .app { padding: 20px 24px 28px; column-gap: 28px; grid-template-columns: 340px minmax(0,1fr); } .interaction-hint { display: none; } .teacher-card { width: fit-content; } .character { height: min(60svh, 510px, calc((100vw - 416px) * 1.5)); } }
@media (max-width: 700px) {
  .bg-decor { background-position: 62% center; }
  .app { display: flex; flex-direction: column; gap: 20px; height: auto; min-height: 100svh; padding: 16px 16px max(20px, env(safe-area-inset-bottom)); }
  .stage { order: 1; padding: 34px 0 0; }
  .character { height: min(39svh, 370px); }
  .teacher-card { padding: 10px 16px; gap: 12px; }
  .stage-name { font-size: 14px; } .stage-hint { font-size: 10px; }
  .speech-bubble { top: -5px; padding: 9px 13px; font-size: 11px; }
  .chat-panel { order: 2; align-self: stretch; height: 570px; min-height: 480px; border-radius: 20px; }
  .chat-header { padding: 16px 20px; }
  .messages { padding: 16px 20px; }
  .chat-controls { padding: 14px 16px; }
  .composer input { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
