/* ============================================================
   天启智教 PC · app.css
   Design tokens + reset + brand loader + micro-interactions.
   Tailwind Play CDN (preflight disabled) owns utilities; this
   file owns the reset, tokens, keyframes and polish layer.
   ============================================================ */

:root {
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-active: #006edb;
  --accent-on: #ffffff;
  --bg: #ffffff;
  --surface: #f5f5f7;
  --surface-warm: #fbfbfd;
  --fg: #1d1d1f;
  --fg-2: #424245;
  --muted: #6e6e73;
  --meta: #86868b;
  --border: #d2d2d7;
  --border-soft: #e8e8ed;
  --hero-bg: #08090e;
  --success: #16a34a;
  --warn: #eab308;
  --danger: #dc2626;

  --font-display: 'Manrope', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-body: 'Noto Sans SC', ui-sans-serif, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', monospace;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  color: var(--fg);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100%;
  font-feature-settings: 'kern' 1, 'liga' 1;
  overflow-x: hidden;
}
button { font-family: inherit; cursor: pointer; background: none; border: none; color: inherit; }
a { color: inherit; text-decoration: none; }
input, textarea { font-family: inherit; }
svg { display: block; }
[hidden] { display: none !important; }

/* Number-heavy surfaces get tabular figures */
.tnum, .font-mono { font-variant-numeric: tabular-nums; }

/* ---- Canvas scaler (1920 design frame → zoom to fit width) ---- */
#scaler { transform-origin: top left; }

/* ============================================================
   Brand loader (ForceData mark) — orbit + core breathing
   ============================================================ */
@keyframes fd-orbit {
  0%   { transform: rotate(-18deg) scale(.96); opacity: .58; }
  42%  { transform: rotate(0deg)   scale(1.02); opacity: 1; }
  100% { transform: rotate(342deg) scale(.96); opacity: .58; }
}
@keyframes fd-core {
  0%, 100% { transform: scale(.88); opacity: .68; }
  38%      { transform: scale(1.06); opacity: 1; }
  66%      { transform: scale(.98); opacity: .86; }
}
.fd-loader__orbit {
  transform-box: fill-box; transform-origin: center;
  will-change: transform, opacity;
  animation: fd-orbit 1.45s cubic-bezier(.55,0,.22,1) infinite;
}
.fd-loader__core {
  transform-box: fill-box; transform-origin: center;
  will-change: transform, opacity;
  animation: fd-core 1.45s cubic-bezier(.4,0,.2,1) infinite;
}

/* ---- Boot splash ---- */
#boot {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface);
  transition: opacity .4s ease, visibility .4s ease;
}
#boot.gone { opacity: 0; visibility: hidden; pointer-events: none; }
.boot-mark { animation: boot-float 2.4s ease-in-out infinite; }
@keyframes boot-float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

/* ============================================================
   Entrance animations
   ============================================================ */
@keyframes slide-right-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes slide-left-in  { from { transform: translateX(-24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade-up        { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade-in        { from { opacity: 0; } to { opacity: 1; } }
@keyframes scale-in       { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes dot-bounce     { 0%,80%,100% { transform: translateY(0); opacity:.4; } 40% { transform: translateY(-4px); opacity:1; } }

.animate-slide-right { animation: slide-right-in .34s cubic-bezier(.22,.61,.36,1) both; }
.animate-slide-left  { animation: slide-left-in  .28s cubic-bezier(.22,.61,.36,1) both; }
.animate-fade-up     { animation: fade-up .24s cubic-bezier(.22,.61,.36,1) both; }
.animate-fade-in     { animation: fade-in .2s ease both; }
.animate-scale-in    { animation: scale-in .22s cubic-bezier(.22,.61,.36,1) both; }

/* Page enter — content layers fade/slide in with a small stagger */
#page-outlet > * { animation: fade-up .34s cubic-bezier(.22,.61,.36,1) both; }
.stagger > * { animation: fade-up .4s cubic-bezier(.22,.61,.36,1) both; }
.stagger > *:nth-child(1) { animation-delay: .02s; }
.stagger > *:nth-child(2) { animation-delay: .07s; }
.stagger > *:nth-child(3) { animation-delay: .12s; }
.stagger > *:nth-child(4) { animation-delay: .17s; }
.stagger > *:nth-child(5) { animation-delay: .22s; }
.stagger > *:nth-child(6) { animation-delay: .27s; }
.stagger > *:nth-child(7) { animation-delay: .32s; }

/* ============================================================
   Micro-interactions
   ============================================================ */
/* Card lift on hover */
.lift { transition: transform .2s cubic-bezier(.22,.61,.36,1), box-shadow .2s ease, border-color .2s ease; }
.lift:hover { transform: translateY(-3px); box-shadow: 0 10px 30px -8px rgba(0,0,0,.14); border-color: #d2d2d7 !important; }

/* Row hover tint */
.rowhover { transition: background-color .16s ease; }
.rowhover:hover { background-color: #fafafb; }

/* Generic button press */
.press { transition: transform .12s ease, background-color .16s ease, border-color .16s ease, opacity .16s ease; }
.press:hover { filter: brightness(1.02); }
.press:active { transform: scale(.97); }

/* Pill / chip hover */
.chip { transition: background-color .16s ease, border-color .16s ease, color .16s ease, transform .12s ease; }
.chip:hover { transform: translateY(-1px); }

/* Link arrow slide */
.arrow-link { transition: color .16s ease; }
.arrow-link .arrow { display: inline-block; transition: transform .18s ease; }
.arrow-link:hover .arrow { transform: translateX(3px); }

/* Tab underline slider */
.tabbar { position: relative; }
.tab-ind {
  position: absolute; bottom: 0; height: 2px; background: var(--accent);
  transition: left .28s cubic-bezier(.22,.61,.36,1), width .28s cubic-bezier(.22,.61,.36,1);
  border-radius: 2px;
}

/* Focus ring */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
button:focus:not(:focus-visible) { outline: none; }

/* Selection */
::selection { background: #0071e333; color: var(--fg); }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d2d2d7; border-radius: 4px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #b8b8bf; background-clip: padding-box; }
* { scrollbar-width: thin; scrollbar-color: #d2d2d7 transparent; }

/* ---- Scrim ---- */
.scrim { animation: fade-in .2s ease both; }

/* ---- Chat typing dots ---- */
.typing span { display: inline-block; animation: dot-bounce 1.2s infinite; font-size: 20px; line-height: 8px; }
.typing span:nth-child(2) { animation-delay: .15s; }
.typing span:nth-child(3) { animation-delay: .3s; }

/* ---- Accordion body reveal ---- */
.acc-body { overflow: hidden; transition: max-height .3s cubic-bezier(.22,.61,.36,1), opacity .24s ease; }

/* ---- Toast ---- */
#toast-root { position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%); z-index: 120; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: #1d1d1f; color: #fff; font-size: 13px; font-weight: 500;
  padding: 10px 18px; border-radius: 980px; box-shadow: 0 8px 28px rgba(0,0,0,.24);
  animation: fade-up .24s cubic-bezier(.22,.61,.36,1) both;
}

/* ---- iframe (courseware stage) ---- */
.cw-frame { width: 100%; height: 100%; border: none; background: #fff; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
