/* 墨墨小屋 · 入口样式（main.js 自己的那几样东西）
 * 场景骨架在 base.css；这里只管：启动画面、启动失败提示、自测输出。颜色字体全部取 tokens.css。
 */

/* ---------- 启动画面：课程与识别数据加载期间盖在背景上，首个场景挂好后淡出 ---------- */

.mx-boot {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: grid;
  place-items: center;
  padding: 24px;
  background: color-mix(in srgb, var(--paper) 40%, transparent);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  animation: mx-fade-in var(--dur-card) var(--ease-out) both;
}
.mx-boot.is-leaving { animation: mx-fade-out var(--dur-exit) var(--ease-in) both; pointer-events: none; }

.mx-boot__card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  min-width: min(100%, 320px);
  text-align: center;
}

/* logo：书法体的「墨墨小屋」，下面一枚跳动的小墨滴 */
.mx-boot__logo {
  font-family: var(--font-brush);
  font-size: 44px;
  line-height: 1.2;
  color: var(--ink);
  letter-spacing: .06em;
}
.mx-boot__drop {
  width: 34px;
  height: 40px;
  color: var(--ink);
  animation: mx-boot-bob 1.4s var(--ease-out) infinite;
}
.mx-boot__drop svg { width: 100%; height: 100%; }
.mx-boot__hint {
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--ink-soft);
}

/* 启动失败：同一张卡换成说明 + 重试 */
.mx-boot.is-error .mx-boot__drop { animation: none; color: var(--bad); }
.mx-boot__error {
  max-width: 460px;
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  word-break: break-word;
}
.mx-boot__error code {
  display: block;
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: var(--radius);
  background: rgba(120, 90, 50, .08);
  font-size: 14px;
  color: var(--ink-soft);
  text-align: left;
  white-space: pre-wrap;
}

@keyframes mx-boot-bob {
  0%, 100% { transform: translateY(0) scale(1); }
  45%      { transform: translateY(-8px) scale(1.04, .96); }
}

/* ---------- 无 JS ---------- */

.mx-noscript {
  position: fixed;
  inset: auto 16px 24px;
  z-index: var(--z-toast);
  padding: 14px 18px;
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow);
  text-align: center;
}

/* ---------- ?autotest=1 的结果：留在 DOM 里给无头浏览器读，屏幕上只占右下角一小块 ---------- */

#autotest {
  position: fixed;
  right: 8px;
  bottom: 8px;
  z-index: var(--z-toast);
  max-width: 46vw;
  max-height: 34vh;
  margin: 0;
  padding: 8px 10px;
  overflow: auto;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--ink) 88%, transparent);
  color: var(--paper);
  font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
  opacity: .92;
}

@media (prefers-reduced-motion: reduce) {
  .mx-boot__drop { animation: none; }
}

/* 多家庭：输入家庭码（family.js / main.js askCode） */
.mx-boot__login { display: flex; gap: 10px; align-items: center; justify-content: center; margin-top: 4px; }
.mx-boot__code {
  width: 11em; padding: 10px 14px; border-radius: 12px;
  border: 1.5px solid var(--line, rgba(0,0,0,0.15)); background: rgba(255,255,255,.8);
  font: inherit; font-size: 22px; letter-spacing: .12em; text-align: center; text-transform: uppercase; color: var(--ink);
}
.mx-boot__code:focus { outline: 3px solid color-mix(in srgb, var(--ok, #5cae6a), transparent 50%); outline-offset: 1px; }
.mx-boot__codeerr { min-height: 1.4em; font-size: 15px; color: var(--bad-text, #b8442d); }
