/* ============================================================
 * 球球 AI 教学助手 — 设计令牌与全局基础
 * 基于 ui-color-typography + ui-core-principles
 * ============================================================ */

:root {
  /* ----- 中性层（7 级）----- */
  --bg:           #f5f6f8;
  --surface:      #ffffff;
  --surface-2:    #fafbfc;
  --line:         #e6e8ec;
  --line-strong:  #cdd1d7;
  --text:         #1a1d23;
  --text-muted:   #6b7280;

  /* ----- 品牌色（仅一个，克制使用）----- */
  --brand:        #3155d4;
  --brand-hover:  #2647b8;
  --brand-soft:   #ecf0fb;
  --brand-soft-2: #e0e7fa;

  /* ----- 语义状态（4 态）----- */
  --waiting:       #6b7280;
  --waiting-soft:  #eef0f3;
  --success:       #16a34a;
  --success-soft:  #dcfce7;
  --review:        #d97706;
  --review-soft:   #fef3c7;
  --error:         #dc2626;
  --error-soft:    #fee2e2;

  /* ----- 字号（compact product scale）----- */
  --fs-page-title:   24px;
  --fs-panel-title:  18px;
  --fs-card-title:   17px;
  --fs-body-l:       16px;
  --fs-body:         15px;
  --fs-label:        14px;
  --fs-meta:         13px;
  --fs-caption:      12px;

  /* ----- 行高 ----- */
  --lh-tight:  1.35;
  --lh-normal: 1.6;
  --lh-loose:  1.8;

  /* ----- 间距 ----- */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;

  /* ----- 圆角 ----- */
  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 14px;
  --radius-pill: 999px;

  /* ----- 阴影（克制）----- */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 1px rgba(15, 23, 42, .03);
  --shadow:    0 4px 12px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .04);
  --shadow-lg: 0 10px 30px rgba(15, 23, 42, .08), 0 4px 12px rgba(15, 23, 42, .04);

  /* ----- 过渡 ----- */
  --easing: cubic-bezier(.4, 0, .2, 1);
  --t-fast: 120ms;
  --t-base: 200ms;
}

/* ============================================================
 * 全局重置与排版
 * ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC",
               "Source Han Sans CN", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: var(--fs-body);
  line-height: var(--lh-normal);
  font-feature-settings: "tnum" on;  /* 数字等宽 */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

a {
  color: var(--brand);
  text-decoration: none;
  transition: color var(--t-fast) var(--easing);
}
a:hover { color: var(--brand-hover); }

/* ============================================================
 * 排版角色
 * ============================================================ */

.t-page-title  { font-size: var(--fs-page-title); font-weight: 700; line-height: var(--lh-tight); color: var(--text); }
.t-panel-title { font-size: var(--fs-panel-title); font-weight: 600; line-height: var(--lh-tight); color: var(--text); }
.t-card-title  { font-size: var(--fs-card-title); font-weight: 600; line-height: var(--lh-tight); color: var(--text); }
.t-body-l      { font-size: var(--fs-body-l); font-weight: 400; line-height: var(--lh-normal); color: var(--text); }
.t-body        { font-size: var(--fs-body); font-weight: 400; line-height: var(--lh-normal); color: var(--text); }
.t-label       { font-size: var(--fs-label); font-weight: 600; line-height: var(--lh-tight); color: var(--text); }
.t-meta        { font-size: var(--fs-meta); font-weight: 500; color: var(--text-muted); }
.t-caption     { font-size: var(--fs-caption); font-weight: 400; color: var(--text-muted); }

.t-muted { color: var(--text-muted); }
.t-mono  { font-feature-settings: "tnum" on; font-variant-numeric: tabular-nums; }

/* ============================================================
 * 通用 Card
 * ============================================================ */

.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  padding: var(--space-5);
}

.card-lg {
  padding: var(--space-5) var(--space-6);
}

.card-title {
  font-size: var(--fs-card-title);
  font-weight: 600;
  color: var(--text);
  margin-bottom: var(--space-4);
}

.section-eyebrow {
  font-size: var(--fs-caption);
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--space-3);
}

/* ============================================================
 * Button
 * ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: 40px;
  padding: 0 var(--space-4);
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: var(--fs-body);
  font-weight: 500;
  cursor: pointer;
  background: var(--brand);
  color: #fff;
  transition: background var(--t-fast) var(--easing),
              border-color var(--t-fast) var(--easing),
              transform var(--t-fast) var(--easing),
              box-shadow var(--t-fast) var(--easing);
  white-space: nowrap;
}
.btn:hover { background: var(--brand-hover); }
.btn:active { transform: translateY(1px); }

.btn[disabled],
.btn.is-loading {
  background: var(--line-strong);
  color: var(--text-muted);
  cursor: not-allowed;
  pointer-events: none;
}

.btn-ghost {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line);
}
.btn-ghost:hover {
  background: var(--bg);
  border-color: var(--line-strong);
  color: var(--text);
}

.btn-text {
  background: transparent;
  color: var(--brand);
  border-color: transparent;
  height: auto;
  padding: var(--space-1) var(--space-2);
}
.btn-text:hover { background: var(--brand-soft); }

.btn-danger {
  background: var(--error);
}
.btn-danger:hover { background: #b91c1c; }

.btn-sm  { height: 32px; padding: 0 var(--space-3); font-size: var(--fs-meta); border-radius: var(--radius-sm); }
.btn-lg  { height: 48px; padding: 0 var(--space-5); font-size: var(--fs-body-l); }

.btn-block { width: 100%; }

/* ============================================================
 * Field
 * ============================================================ */

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.field-label {
  font-size: var(--fs-label);
  font-weight: 600;
  color: var(--text);
}

.field-help {
  font-size: var(--fs-caption);
  color: var(--text-muted);
}

.field-error {
  font-size: var(--fs-caption);
  color: var(--error);
}

input[type="text"],
input[type="password"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 10px var(--space-3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  /* 桌面 15px；移动端 16px 防 iOS Safari 自动 zoom（在文件末尾 @media 覆盖） */
  font-size: var(--fs-body);
  line-height: var(--lh-normal);
  transition: border-color var(--t-fast) var(--easing),
              box-shadow var(--t-fast) var(--easing);
}
input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
textarea {
  min-height: 96px;
  resize: vertical;
}
input:disabled, textarea:disabled, select:disabled {
  background: var(--bg);
  color: var(--text-muted);
  cursor: not-allowed;
}

/* ============================================================
 * Badge / Pill
 * ============================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-caption);
  font-weight: 600;
  background: var(--waiting-soft);
  color: var(--waiting);
  white-space: nowrap;
}
.badge-brand    { background: var(--brand-soft); color: var(--brand); }
.badge-waiting  { background: var(--waiting-soft); color: var(--waiting); }
.badge-success  { background: var(--success-soft); color: var(--success); }
.badge-review   { background: var(--review-soft); color: var(--review); }
.badge-error    { background: var(--error-soft); color: var(--error); }

/* ============================================================
 * Notice
 * ============================================================ */

.notice {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  font-size: var(--fs-meta);
  background: var(--brand-soft);
  color: var(--brand);
  border-left: 3px solid var(--brand);
}
.notice-success { background: var(--success-soft); color: var(--success); border-left-color: var(--success); }
.notice-review  { background: var(--review-soft); color: var(--review); border-left-color: var(--review); }
.notice-error   { background: var(--error-soft); color: var(--error); border-left-color: var(--error); }

/* ============================================================
 * Empty / Loader
 * ============================================================ */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-7) var(--space-5);
  text-align: center;
  color: var(--text-muted);
}
.empty-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--brand-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-4);
  font-size: 28px;
  color: var(--brand);
}
.empty-title {
  font-size: var(--fs-card-title);
  font-weight: 600;
  color: var(--text);
  margin-bottom: var(--space-2);
}
.empty-tip {
  font-size: var(--fs-meta);
  color: var(--text-muted);
}

.loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-7) var(--space-5);
  color: var(--text-muted);
}
.loader-spinner {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid var(--brand-soft-2);
  border-top-color: var(--brand);
  animation: spin .9s linear infinite;
  margin-bottom: var(--space-3);
}
.loader-text {
  font-size: var(--fs-meta);
  color: var(--text-muted);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
 * 通用 utilities
 * ============================================================ */

.row { display: flex; align-items: center; gap: var(--space-3); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.row-wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-5 { gap: var(--space-5); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.mt-6 { margin-top: var(--space-6); }
.flex-1 { flex: 1; }
.text-center { text-align: center; }
.hidden { display: none !important; }

/* ============================================================
 * 首页入口（index.html）— 球球主题
 * 设计点：
 *   - 垂直居中，背景柔光晕 + dot grid + 浮动 blob
 *   - 一颗动态发光球作为"球球"主视觉
 *   - 三张入口卡（中间一张为主推「课堂展示端」）
 *   - 底部三句能力速览
 * ============================================================ */

.home {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-6) var(--space-5);
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse 720px 480px at 12% 6%, var(--brand-soft) 0%, transparent 55%),
    radial-gradient(ellipse 760px 540px at 88% 96%, #fde6e8 0%, transparent 55%),
    var(--bg);
}

/* 背景 dot grid，向中心淡出 */
.home::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(49, 85, 212, .07) 1px, transparent 1.4px);
  background-size: 26px 26px;
  pointer-events: none;
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
          mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
}

/* 浮动 blob（柔光斑） */
.home-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(72px);
  opacity: .55;
  pointer-events: none;
}
.home-blob-1 {
  width: 360px; height: 360px;
  background: radial-gradient(circle, #c5d2f7 0%, transparent 70%);
  top: -90px; left: -100px;
}
.home-blob-2 {
  width: 320px; height: 320px;
  background: radial-gradient(circle, #ffd9c8 0%, transparent 70%);
  bottom: -80px; right: -80px;
}

/* 主舞台 */
.home-stage {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 880px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ----- 球球主视觉 ----- */
.brand-orb-wrap {
  position: relative;
  margin-bottom: var(--space-5);
  width: 88px;
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.brand-orb {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, #93a8f4 0%, #4665d8 42%, #2647b8 78%, #1d3aa6 100%);
  box-shadow:
    0 24px 60px -10px rgba(49, 85, 212, .45),
    0 8px 24px rgba(49, 85, 212, .25),
    inset -8px -16px 28px rgba(0, 0, 0, .18),
    inset 8px 12px 24px rgba(255, 255, 255, .25);
  position: relative;
  animation: orb-float 5s ease-in-out infinite;
}
/* 球的高光 */
.brand-orb::before {
  content: '';
  position: absolute;
  top: 14%;
  left: 22%;
  width: 28%;
  height: 22%;
  border-radius: 50%;
  background: rgba(255, 255, 255, .55);
  filter: blur(3px);
}
/* 球的内圈光环 */
.brand-orb::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .2);
}
/* 球外的脉动光晕 */
.brand-orb-glow {
  position: absolute;
  inset: -36px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(49, 85, 212, .25) 0%, transparent 65%);
  z-index: -1;
  animation: orb-pulse 5s ease-in-out infinite;
}
/* 漂浮的小星点（AI 元素） */
.brand-spark {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 8px rgba(49, 85, 212, .6);
  animation: spark-float 3.5s ease-in-out infinite;
}
.brand-spark-1 { top: -4px;  right: -10px; animation-delay: 0s; }
.brand-spark-2 { bottom: 8px; left: -14px; width: 4px; height: 4px; animation-delay: 1.2s; }
.brand-spark-3 { top: 50%;   right: -18px; width: 5px; height: 5px; animation-delay: 2.4s; }

@keyframes orb-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-10px); }
}
@keyframes orb-pulse {
  0%, 100% { opacity: .5; transform: scale(1); }
  50%      { opacity: .85; transform: scale(1.08); }
}
@keyframes spark-float {
  0%, 100% { transform: translateY(0) scale(1);  opacity: .4; }
  50%      { transform: translateY(-12px) scale(1.4); opacity: 1; }
}

.home-title {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -.5px;
  color: var(--text);
  margin-bottom: var(--space-2);
  background: linear-gradient(135deg, var(--text) 0%, var(--brand) 100%);
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
}
.home-slogan {
  font-size: var(--fs-body-l);
  color: var(--text-muted);
  margin-bottom: var(--space-7);
  max-width: 540px;
  line-height: var(--lh-normal);
}

/* ----- 三张入口卡 ----- */
.home-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-4);
  width: 100%;
  max-width: 760px;
  margin-bottom: var(--space-7);
}
.home-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  padding: var(--space-5);
  text-decoration: none;
  color: var(--text);
  transition: transform var(--t-base) var(--easing),
              box-shadow var(--t-base) var(--easing),
              border-color var(--t-base) var(--easing);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  position: relative;
  overflow: hidden;
}
.home-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 55%, var(--brand-soft) 110%);
  opacity: 0;
  transition: opacity var(--t-base) var(--easing);
  pointer-events: none;
}
.home-card:hover {
  transform: translateY(-4px);
  border-color: var(--brand);
  box-shadow: 0 24px 48px -20px rgba(49, 85, 212, .3);
  text-decoration: none;
}
.home-card:hover::after { opacity: 1; }

.home-card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  background: var(--brand-soft);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: var(--space-3);
  position: relative;
  z-index: 1;
}
.home-card h3 {
  font-size: var(--fs-card-title);
  font-weight: 600;
  margin-bottom: 4px;
  position: relative;
  z-index: 1;
}
.home-card p {
  font-size: var(--fs-meta);
  color: var(--text-muted);
  position: relative;
  z-index: 1;
}

/* 中间一张主推 */
.home-card-primary {
  background: linear-gradient(135deg, var(--brand) 0%, #5577e0 100%);
  border-color: var(--brand);
  color: #fff;
}
.home-card-primary .home-card-icon {
  background: rgba(255, 255, 255, .2);
  color: #fff;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .3) inset;
}
.home-card-primary h3 { color: #fff; }
.home-card-primary p  { color: rgba(255, 255, 255, .85); }
.home-card-primary:hover {
  border-color: var(--brand-hover);
  box-shadow: 0 24px 48px -16px rgba(49, 85, 212, .5);
}
.home-card-primary::after { display: none; }
.home-card-tag {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  font-size: 10px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  background: rgba(255, 255, 255, .25);
  color: #fff;
  z-index: 2;
}

/* ----- 底部能力速览 ----- */
.home-features {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--fs-meta);
  color: var(--text-muted);
}
.home-features .feat strong {
  color: var(--text);
  font-weight: 600;
}
.home-features .feat-dot {
  color: var(--line-strong);
  font-weight: 700;
}

.home-footer {
  position: absolute;
  bottom: var(--space-4);
  left: 0;
  right: 0;
  text-align: center;
  font-size: var(--fs-caption);
  color: var(--text-muted);
  z-index: 1;
}

/* ----- 首页移动端 ----- */
@media (max-width: 720px) {
  .home { padding: var(--space-5) var(--space-4); }
  .brand-orb-wrap, .brand-orb { width: 72px; height: 72px; }
  .home-title { font-size: 26px; }
  .home-slogan {
    font-size: var(--fs-body);
    margin-bottom: var(--space-5);
  }
  .home-grid {
    grid-template-columns: 1fr;
    gap: var(--space-3);
    margin-bottom: var(--space-5);
  }
  .home-card { padding: var(--space-4); flex-direction: row; align-items: center; gap: var(--space-3); }
  .home-card-icon {
    width: 44px;
    height: 44px;
    margin-bottom: 0;
    flex-shrink: 0;
  }
  .home-card h3 { margin-bottom: 2px; }
  .home-card-tag {
    position: static;
    margin-left: auto;
    flex-shrink: 0;
  }
  .home-features {
    flex-direction: column;
    gap: var(--space-1);
  }
  .home-features .feat-dot { display: none; }
  .home-blob { filter: blur(48px); }
}

/* ============================================================
 * 全局移动端：input 字号 16px 防 iOS Safari zoom
 * ============================================================ */

@media (max-width: 768px) {
  input[type="text"],
  input[type="password"],
  input[type="number"],
  textarea,
  select {
    font-size: 16px;
  }
}
