:root { color-scheme: light; font-family: "Microsoft YaHei", "PingFang SC", sans-serif; color: #fffaf0; }
* { box-sizing: border-box; }
body { margin: 0; background: #2f392c; }
button, textarea { font: inherit; }
button { cursor: pointer; border: 0; border-radius: 10px; padding: 11px 17px; color: inherit; background: transparent; transition: background .18s, transform .18s; }
button:hover { background: #ffffff20; }
button:active { transform: translateY(1px); }
button:disabled { cursor: default; opacity: .45; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid #ecd2a0; outline-offset: 4px; }
.scene { position: relative; height: 100vh; height: 100dvh; overflow: hidden; isolation: isolate; }
.backdrop { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; object-position: center; z-index: -3; }
.scene::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, #17211660 0%, transparent 22%, transparent 45%, #1b211ba3 100%); z-index: -2; pointer-events: none; }
.toolbar { position: absolute; top: max(22px, env(safe-area-inset-top)); left: 4vw; right: 4vw; display: flex; align-items: center; justify-content: space-between; }
h1 { margin: 0; font-family: "KaiTi", "STKaiti", serif; font-weight: 400; letter-spacing: .17em; font-size: clamp(24px, 2.4vw, 36px); text-shadow: 0 2px 12px #26331e70; }
nav { display: flex; gap: 5px; padding: 4px; border-radius: 12px; background: #27312555; backdrop-filter: blur(16px); }
nav button { font-size: 12px; padding: 9px 13px; }
.interaction { position: absolute; bottom: calc(env(safe-area-inset-bottom) + 42px); left: 7vw; right: 7vw; display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(270px, 1fr); gap: 24px; align-items: end; max-width: 1320px; margin: auto; }
.speech { border-radius: 14px; padding: 14px 24px 8px; background: rgb(28 33 24 / 70%); border: 1px solid #e5e0c638; box-shadow: 0 6px 18px #15211522; }
.speaker { display: flex; justify-content: space-between; align-items: center; gap: 16px; color: #f2ead8; font-size: 14px; }
#round { color: #e7e0cf; font-size: 12px; }
#teacher { margin: 9px 0 4px; font-size: clamp(19px, 1.8vw, 28px); line-height: 1.55; text-wrap: pretty; }
.speechControls { display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: #e7e0cf; }
.speechControls button { padding: 5px 8px; font-size: 12px; }
.response { padding: 13px 16px; background: rgb(255 251 239 / 72%); color: #21392a; border: 1px solid #fffaf05c; border-radius: 14px; box-shadow: 0 6px 18px #15211522; }
.primary { background: #41644c; color: #fffdf6; }
.primary:hover { background: #33543f; }
#start { width: 100%; padding: 17px; font-size: 17px; }
textarea { display: block; width: 100%; height: 49px; resize: none; border: 0; border-bottom: 1px solid #3f584561; background: transparent; color: #21392a; font-size: 16px; line-height: 1.4; padding: 2px 0 5px; border-radius: 0; outline-color: #43664f; }
textarea::placeholder { color: #2e4435; }
.answerActions { display: flex; gap: 10px; margin-top: 9px; }
.answerActions button { flex: 1; white-space: nowrap; font-size: 14px; padding: 9px 13px; }
#mic { background: #e5eadd; }
#mic.listening { background: #d2e1c8; }
#status { margin: 7px 0 0; font-size: 11px; line-height: 1.6; color: #293e2c; }
#status:empty { display: none; }
.textButton { font-size: 11px; padding: 9px 0 0; color: inherit; }
#ending p { margin: 0 0 14px; font-size: 19px; }
#download { display: block; }
footer { position: absolute; bottom: max(16px, env(safe-area-inset-bottom)); left: 4vw; right: 4vw; display: flex; align-items: center; justify-content: space-between; color: #e4e7db; font-size: 10px; }
footer button { padding: 0 !important; }
dialog { border: 1px solid #d9decf; border-radius: 16px; max-width: 550px; width: calc(100% - 32px); max-height: 82dvh; overflow: auto; background: #fbfaf4; color: #3c5140; padding: 28px; }
dialog::backdrop { background: #18251780; backdrop-filter: blur(5px); }
dialog p { font-size: 14px; line-height: 1.9; }
dialog h2 { font-size: 21px; font-weight: 500; }
dialog a { display: inline-block; color: #577a55; font-size: 12px; margin-top: 20px; }
.close { float: right; font-size: 24px; padding: 0 8px; }
details { font-size: 13px; line-height: 1.8; }
summary { cursor: pointer; }
#history p { white-space: pre-line; border-bottom: 1px solid #dce1d4; padding-bottom: 10px; }
.srOnly { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
[hidden] { display: none !important; }
@media (min-aspect-ratio: 2/1) { .interaction { bottom: 44px; } #teacher { font-size: 20px; } }
@media (max-width: 700px) {
  .toolbar { top: max(15px, env(safe-area-inset-top)); left: 18px; right: 18px; }
  h1 { font-size: 24px; }
  nav button { font-size: 11px; padding: 7px 9px; }
  .interaction { left: 16px; right: 16px; bottom: max(35px, calc(env(safe-area-inset-bottom) + 24px)); grid-template-columns: 1fr; gap: 10px; }
  .speech { padding: 16px 19px 8px; border-radius: 12px; }
  #teacher { font-size: 18px; line-height: 1.6; margin: 10px 0 4px; }
  .speaker { font-size: 12px; }
  .response { padding: 13px 16px; border-radius: 12px; }
  textarea { font-size: 16px; line-height: 1.4; height: 47px; padding-bottom: 3px; }
  .answerActions { margin-top: 9px; gap: 8px; }
  .answerActions button { padding: 10px 12px; }
  #skip { padding-top: 8px; }
  #status { margin-top: 6px; font-size: 10px; }
  footer { font-size: 9px; left: 18px; right: 18px; bottom: max(9px, env(safe-area-inset-bottom)); }
}
@media (max-height: 600px) and (min-width: 701px) {
  .toolbar { top: 12px; }
  .interaction { left: 5vw; right: 5vw; gap: 18px; bottom: 35px; }
  .speech { padding: 15px 20px 8px; }
  #teacher { font-size: 18px; line-height: 1.5; margin: 8px 0; }
  .response { padding: 13px; }
  textarea { height: 48px; }
  .answerActions { margin-top: 8px; }
  footer { bottom: 10px; }
}
@media (max-height: 640px) and (max-width: 700px) { #teacher { font-size: 16px; line-height: 1.5; } .speech { padding: 12px 16px 6px; } .interaction { gap: 8px; } .speechControls { font-size: 10px; } }
