/* 全屏画布，没有滚动条 */
html, body {
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: #3f8f7f;
  color: #22313a;
  font-family: Georgia, "Songti SC", "SimSun", "PingFang SC", "Microsoft YaHei", serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
button { font-family: inherit; }
button:focus-visible { outline: 2px solid #f1dca5; outline-offset: 4px; }

canvas {
  display: block;
}

/* 开始界面：浏览器只允许在点击之后打开摄像头和声音 */
#intro {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 20% 25%, rgba(122, 143, 184, 0.8), transparent 60%),
    radial-gradient(ellipse at 85% 80%, rgba(201, 183, 214, 0.5), transparent 55%), #366d68;
  z-index: 10;
  padding: 16px;
  overflow-y: auto;
}

.card {
  max-width: 660px;
  padding: 28px 32px;
  background: rgba(244, 238, 230, 0.92);
  border: 2px solid #b0536b;
  border-radius: 10px;
  text-align: center;
}

.card h1 {
  font-size: clamp(2.6rem, 10vw, 4.8rem);
  margin: 0;
  letter-spacing: 0.12em;
  font-weight: normal;
}

.sub {
  margin: 4px 0 20px;
  opacity: 0.8;
}

.intro-note { max-width: 440px; margin: 0 auto 20px; line-height: 1.75; color: #506660; }
.start-tip { font-size: 0.85rem; line-height: 1.65; color: #5b626a; margin: 0 0 16px; }
.credit { font-size: 0.75rem; color: #7c7e7d; margin: 14px 0 0; }

.card ul {
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
  line-height: 1.9;
  text-align: left;
}

kbd {
  border: 1px solid currentColor;
  border-radius: 4px;
  padding: 0 6px;
  font-size: 0.85em;
}

#start {
  font-family: inherit;
  font-size: 1.2rem;
  padding: 12px 36px;
  border: none;
  border-radius: 6px;
  background: #7a8fb8;
  color: #ffffff;
  cursor: pointer;
  letter-spacing: 0.15em;
}

#start:hover {
  filter: brightness(1.15);
}

/* 角落里的状态提示 */
#status {
  position: fixed;
  left: 16px;
  bottom: 78px;
  font-size: 0.9rem;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(244, 238, 230, 0.92);
  pointer-events: none;
  max-width: calc(100vw - 48px);
  z-index: 3;
  line-height: 1.6;
}

#status:empty { display: none; }
#scene-readout {
  position: fixed; top: 50px; left: 22px; z-index: 2;
  font-size: 0.8rem; color: #f6ebdc; opacity: 0.85; pointer-events: none;
  text-shadow: 0 1px 5px rgba(22, 46, 58, 0.65);
}
.separator { padding: 0 10px; }
#controls {
  position: fixed; bottom: 16px; right: 18px; z-index: 4;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 8px; border: 1px solid rgba(248, 241, 225, 0.4); border-radius: 14px;
  background: rgba(29, 56, 64, 0.75); backdrop-filter: blur(12px);
  box-shadow: 0 4px 22px rgba(15, 32, 43, 0.14);
}
#controls button {
  border: 1px solid transparent; border-radius: 8px; background: transparent;
  color: #f5ebdd; padding: 9px 12px; font-size: 0.85rem; cursor: pointer;
}
#controls button:hover { background: rgba(244, 238, 230, 0.12); }
#controls button.active { background: #eed7b2; color: #334e56; }
#controls button:disabled { opacity: 0.4; cursor: default; }
.control-divider { height: 22px; width: 1px; background: rgba(244, 238, 230, 0.25); margin: 0 3px; }
#help {
  position: fixed; bottom: 86px; right: 18px; z-index: 5;
  width: min(430px, calc(100vw - 32px)); max-height: calc(100dvh - 125px); overflow-y: auto;
  padding: 22px 24px; border-radius: 14px; background: rgba(248, 240, 227, 0.97);
  box-shadow: 0 8px 36px rgba(22, 38, 48, 0.22); border: 1px solid #cab7a5;
}
#help h2 { font-weight: normal; font-size: 1.2rem; margin: 0 24px 16px 0; }
#help p { font-size: 0.88rem; line-height: 1.85; margin: 12px 0; }
#help .shortcuts { font-size: 0.75rem; color: #657278; }
#help-close { position: absolute; right: 12px; top: 10px; border: none; background: transparent; color: #566e72; font-size: 1.6rem; cursor: pointer; }
@media (max-width: 600px) {
  #intro { padding: 12px; }
  .card { padding: 22px 20px; }
  .card ul { font-size: 0.88rem; line-height: 1.8; margin-bottom: 16px; }
  #controls { left: 12px; right: 12px; bottom: 12px; justify-content: center; gap: 2px; padding: 6px; }
  #controls button { padding: 9px 8px; font-size: 0.78rem; }
  #status { bottom: 116px; left: 12px; font-size: 0.78rem; max-width: calc(100vw - 24px); }
  #help { bottom: 116px; right: 12px; max-height: calc(100dvh - 145px); }
  .control-divider { display: none; }
}
@media (max-height: 760px) {
  #intro { align-items: flex-start; }
}
