/* style.css —— 动态几何母题库 */
:root {
  --bg: #f7f8fa;
  --card: #ffffff;
  --ink: #1a202c;
  --muted: #718096;
  --line: #e2e8f0;
  --primary: #3182ce;
  --green: #38a169;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg); color: var(--ink); line-height: 1.6;
}
#app { max-width: 1100px; margin: 0 auto; padding: 24px 20px 60px; }

/* ===== 首页 ===== */
.home-topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 0 0; margin-bottom: 8px;
}
.home-brand { font-size: 20px; font-weight: 800; color: var(--ink); text-decoration: none; letter-spacing: 1px; }
.hero { text-align: center; padding: 20px 0 32px; }
.hero h1 { font-size: 34px; letter-spacing: 1px; }
.hero p { color: var(--muted); margin-top: 8px; }
.grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.topic-group { margin-bottom: 30px; }
.topic-head {
  font-size: 16px; font-weight: 700; color: #2d3748; margin: 0 0 12px;
  padding-bottom: 8px; border-bottom: 2px solid #edf2f7; display: flex; align-items: center; gap: 8px;
}
.topic-count { font-size: 12px; font-weight: 600; color: var(--primary); background: #ebf3fc; padding: 1px 9px; border-radius: 99px; }
.card {
  display: block; background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 20px; text-decoration: none; color: inherit;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 10px 26px rgba(49,130,206,.12); border-color: #bcd6f0; }
.card-grade { font-size: 12px; color: var(--primary); font-weight: 600; }
.card h3 { font-size: 21px; margin: 6px 0 8px; }
.card-summary { color: var(--muted); font-size: 14px; min-height: 44px; }
.card-thumb { margin: 10px 0 4px; background: #fbfdff; border: 1px solid #eef2f7; border-radius: 10px; overflow: hidden; }
.card-thumb svg { display: block; width: 100%; height: auto; }
.tags { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 12px; background: #edf2f7; color: #4a5568; padding: 3px 10px; border-radius: 99px; }
.foot { text-align: center; color: var(--muted); font-size: 13px; margin-top: 40px; }

/* 分类筛选 + 搜索 */
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin: 0 0 20px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font: inherit; font-size: 14px; border: 1px solid var(--line); background: #fff; color: #4a5568; padding: 7px 16px; border-radius: 99px; cursor: pointer; transition: all .15s; }
.chip:hover { border-color: #bcd6f0; }
.chip.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.search { font: inherit; font-size: 14px; border: 1px solid var(--line); border-radius: 99px; padding: 8px 16px; min-width: 220px; flex: 1; max-width: 320px; outline: none; }
.search:focus { border-color: var(--primary); }
.empty { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 40px 0; }

/* ===== 演示页 ===== */
.topbar { display: flex; align-items: center; gap: 14px; padding: 4px 0 18px; }
.back { color: var(--primary); text-decoration: none; font-weight: 600; white-space: nowrap; }
.demo-title { font-size: 18px; font-weight: 700; white-space: nowrap; }
.spacer { flex: 1; }
.demo { max-width: 760px; margin: 0 auto; }

/* 师生模式切换 */
.mode-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 99px; overflow: hidden; }
.mode-toggle button { font: inherit; font-size: 14px; font-weight: 600; border: 0; background: #fff; color: #4a5568; padding: 7px 16px; cursor: pointer; }
.mode-toggle button.on { background: var(--primary); color: #fff; }
.btn.small { padding: 7px 14px; font-size: 14px; }

/* 老师投屏模式：整体放大、字更大 */
.demo.teacher { max-width: 980px; }
.demo.teacher .caption { font-size: 21px; }
.demo.teacher .btn { font-size: 17px; padding: 12px 22px; }
.demo.teacher .demo-title { font-size: 22px; }
.demo.teacher .hint { font-size: 16px; }

/* 老师模式下被隐藏的讲解 */
.caption.masked { color: var(--primary); cursor: pointer; background: #eef5fc; border-left-color: #90cdf4; font-weight: 600; }
.board-wrap { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px; }
.board { width: 100%; height: auto; display: block; touch-action: none; }

/* 拖拽点光晕提示 */
.gb-draggable { filter: drop-shadow(0 0 0 rgba(56,161,105,.6)); animation: pulse 2s infinite; }
@keyframes pulse {
  0%,100% { filter: drop-shadow(0 0 2px rgba(56,161,105,.4)); }
  50% { filter: drop-shadow(0 0 7px rgba(56,161,105,.8)); }
}
.gb-label, .gb-dyntext {
  user-select: none; pointer-events: none;
  paint-order: stroke; stroke: #fff; stroke-width: 3.5px; stroke-linejoin: round; /* 白色光晕，压在线上也清晰 */
}

/* 旁白字幕：与动画同步更新 */
.caption {
  margin: 14px 0 12px; padding: 14px 18px; min-height: 58px;
  background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--primary);
  border-radius: 10px; font-size: 16px; line-height: 1.6; color: #2d3748;
}

/* 控制条 */
.controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.btn { font: inherit; font-weight: 600; border: 0; border-radius: 9px; padding: 10px 18px; cursor: pointer; transition: opacity .15s; }
.btn:disabled { opacity: .38; cursor: not-allowed; }
.btn.primary { background: var(--primary); color: #fff; }
.btn.ghost { background: #edf2f7; color: #4a5568; }
.btn:not(:disabled):hover { opacity: .88; }
.counter { font-size: 14px; font-weight: 700; color: var(--muted); min-width: 46px; text-align: center; }
.hint { margin-top: 10px; color: var(--green); font-size: 14px; font-weight: 600; min-height: 20px; }

@media (max-width: 640px) {
  #app { padding: 16px 14px 50px; }
  .hero { padding: 24px 0 20px; }
  .hero h1 { font-size: 27px; }
  /* 顶栏换行：标题一行，师生切换+分享挪到下一行 */
  .topbar { flex-wrap: wrap; gap: 10px 12px; }
  .spacer { flex-basis: 100%; height: 0; }
  /* 筛选竖排，搜索框占满 */
  .filters { flex-direction: column; align-items: stretch; }
  .search { max-width: none; min-width: 0; }
  .caption { font-size: 15px; }
  .controls { gap: 8px; }
  .btn { padding: 9px 13px; font-size: 14px; }
  /* 老师模式在手机上别放太大 */
  .demo.teacher .caption { font-size: 17px; }
  .demo.teacher .btn { font-size: 15px; padding: 10px 16px; }
}

/* 分享弹窗 */
.modal-backdrop { position: fixed; inset: 0; background: rgba(26,32,44,.5); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal-backdrop.hidden { display: none; }
.modal { background: #fff; border-radius: 16px; padding: 26px; width: 340px; max-width: 100%; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal h3 { font-size: 19px; }
.modal-sub { color: var(--muted); font-size: 14px; margin: 6px 0 18px; }
.modal-note { color: #b7791f; font-size: 12px; margin: 10px 0 0; }
.qr-wrap { display: flex; justify-content: center; }
.qr { width: 200px; height: 200px; border: 1px solid var(--line); border-radius: 10px; }
.qr-fail { width: 200px; height: 200px; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 13px; border: 1px dashed var(--line); border-radius: 10px; padding: 16px; }
.url-row { display: flex; gap: 8px; margin: 18px 0 12px; }
.url-row input { flex: 1; font: inherit; font-size: 13px; border: 1px solid var(--line); border-radius: 9px; padding: 9px 12px; color: #4a5568; outline: none; }
.modal .btn { width: 100%; }
.url-row .btn { width: auto; white-space: nowrap; }

/* ===== 首页顶栏登录 ===== */
.hero-auth { margin-top: 12px; display: flex; justify-content: center; gap: 8px; }
.hero-member { font-size: 14px; font-weight: 700; color: #e67700; }

/* ===== 登录/注册弹窗 ===== */
.modal-dialog {
  background: #fff; border-radius: 16px; padding: 26px; width: 340px; max-width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,.25); text-align: center;
}
.modal-dialog h3 { font-size: 19px; margin-bottom: 16px; }
.auth-dialog { padding-top: 0; overflow: hidden; }

/* 登录/注册标签切换 */
.auth-tabs { display: flex; margin: 0 -26px 20px; border-bottom: 1px solid var(--line); }
.auth-tab {
  flex: 1; padding: 13px 0; font: inherit; font-size: 15px; font-weight: 600;
  border: none; background: none; color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent; transition: all .15s;
}
.auth-tab.on { color: var(--primary); border-bottom-color: var(--primary); }

.auth-form { text-align: left; }
.auth-form label { display: block; font-size: 14px; color: #4a5568; margin-bottom: 10px; }
.auth-form input {
  display: block; width: 100%; margin-top: 4px;
  font: inherit; font-size: 15px; border: 1px solid var(--line); border-radius: 9px;
  padding: 10px 12px; outline: none;
}
.auth-form input:focus { border-color: var(--primary); }
.form-error { color: #e53e3e; font-size: 13px; min-height: 18px; margin: 4px 0; }
.form-switch { font-size: 13px; color: var(--muted); margin: 12px 0 0; text-align: center; }
.form-switch a { color: var(--primary); font-weight: 600; cursor: pointer; text-decoration: none; }

/* ===== 会员徽章 ===== */
.member-badge { font-size: 13px; font-weight: 700; color: #e67700; white-space: nowrap; }

/* ===== 卡片锁标 ===== */
.card-lock { float: right; font-size: 14px; opacity: 0.7; }

/* ===== 付费遮罩 ===== */
.paywall {
  text-align: center; padding: 50px 20px;
  background: linear-gradient(180deg, #fefcf5 0%, #fff 40%);
  border-radius: 14px; min-height: 400px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.paywall-icon { font-size: 56px; margin-bottom: 16px; }
.paywall h2 { font-size: 24px; margin-bottom: 6px; }
.paywall-title { font-size: 17px; font-weight: 600; color: #2d3748; margin-bottom: 10px; }
.paywall-desc { color: var(--muted); font-size: 14px; max-width: 380px; line-height: 1.7; }
.paywall-actions { margin-top: 20px; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.paywall-free-hint { margin-top: 20px; font-size: 13px; color: #a0aec0; }
.paywall-free-hint a { color: var(--primary); font-weight: 600; text-decoration: none; }
.paywall-sub { font-size: 13px !important; color: #a0aec0 !important; }

/* ===== 会员方案列表 ===== */
.plan-list { display: flex; gap: 12px; margin: 16px 0; flex-wrap: wrap; justify-content: center; }
.plan-card {
  flex: 1; min-width: 140px; max-width: 200px;
  background: #f7f8fa; border: 2px solid var(--line); border-radius: 14px;
  padding: 18px 14px; text-align: center; position: relative;
  transition: border-color .15s;
}
.plan-card:hover { border-color: #bcd6f0; }
.plan-recommend { border-color: #f6ad55; background: #fffaf0; }
.plan-badge {
  position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  background: #f6ad55; color: #fff; font-size: 11px; font-weight: 700;
  padding: 2px 12px; border-radius: 99px;
}
.plan-name { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.plan-price { font-size: 24px; font-weight: 800; color: var(--primary); }
.plan-price span { font-size: 13px; color: var(--muted); font-weight: 400; }
.plan-desc { font-size: 12px; color: var(--muted); margin: 4px 0 10px; }
.plan-btn { width: 100%; padding: 8px 0; font-size: 14px; }
