/**
 * 渐变旋转描边 · 与 React BorderRotate 组件视觉一致（纯 CSS，无 Tailwind）
 * 用于首页、工具中心、课堂互动等按钮与卡片
 */
@property --jx-gradient-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

@keyframes jx-gradient-rotate {
  from {
    --jx-gradient-angle: 0deg;
  }
  to {
    --jx-gradient-angle: 360deg;
  }
}

@keyframes jx-gradient-rotate-slow {
  from {
    --jx-gradient-angle: 0deg;
  }
  to {
    --jx-gradient-angle: 360deg;
  }
}

/* 全站主按钮：绿色扁平（与 home-geo 一致，可被页面覆盖） */
:root {
  --jx-btn-primary: #22c55e;
  --jx-btn-primary-hover: #15803d;
  --jx-btn-primary-active: #166534;
  --jx-btn-primary-shadow: 0 4px 14px rgba(22, 101, 52, 0.26);
  --jx-btn-primary-shadow-hover: 0 8px 22px rgba(22, 101, 52, 0.32);
}

.jx-br {
  --jx-g1: #14532d;
  --jx-g2: #22c55e;
  --jx-g3: #fbbf24;
  --jx-bg: rgba(255, 255, 255, 0.96);
  --jx-border-w: 2px;
  --jx-radius: 999px;
  position: relative;
  display: inline-flex;
  vertical-align: middle;
  padding: 0;
  border-radius: var(--jx-radius);
  box-sizing: border-box;
  background-image: linear-gradient(var(--jx-bg), var(--jx-bg)),
    conic-gradient(
      from var(--jx-gradient-angle, 0deg),
      var(--jx-g1) 0%,
      var(--jx-g2) 35%,
      var(--jx-g3) 55%,
      var(--jx-g2) 75%,
      var(--jx-g1) 100%
    );
  background-origin: padding-box, border-box;
  background-clip: padding-box, border-box;
  border: var(--jx-border-w) solid transparent;
  animation: jx-gradient-rotate 5s linear infinite;
}

.jx-br--hover {
  animation: none;
}
.jx-br--hover:hover {
  animation: jx-gradient-rotate 5s linear infinite;
}

.jx-br--slow {
  animation-duration: 10s;
}

.jx-br--card {
  --jx-radius: 20px;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100%;
}

.jx-br--blue {
  --jx-g1: #1e3a8a;
  --jx-g2: #6366f1;
  --jx-g3: #38bdf8;
}

.jx-br--muted {
  animation: none;
}
.jx-br--muted,
.jx-br--muted:hover {
  background-image: linear-gradient(var(--jx-bg), var(--jx-bg)),
    linear-gradient(135deg, rgba(34, 197, 94, 0.35), rgba(99, 102, 241, 0.35));
  border-color: rgba(22, 101, 52, 0.15);
}

.jx-br__inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: calc(var(--jx-radius) - var(--jx-border-w));
  min-height: 44px;
  padding: 0 16px;
  box-sizing: border-box;
  width: 100%;
}

.jx-br button,
.jx-br .jx-br__btn {
  border: none;
  background: transparent;
  font: inherit;
  font-weight: 700;
  font-size: 15px;
  color: #14532d;
  cursor: pointer;
  border-radius: inherit;
  padding: 10px 14px;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  box-shadow: none;
  transition: transform 0.2s ease, filter 0.2s ease;
}
a.jx-br__btn {
  text-decoration: none;
  color: inherit;
}

.jx-br--pill .jx-br__inner {
  padding: 0;
}
.jx-br--pill button,
.jx-br--pill .jx-br__btn {
  border-radius: 999px;
}

.jx-br button:hover:not(:disabled),
.jx-br .jx-br__btn:hover:not(:disabled) {
  transform: scale(1.02);
}
.jx-br button:hover:not(:disabled):not(.primary),
.jx-br .jx-br__btn:hover:not(:disabled):not(.primary) {
  filter: brightness(1.05);
}

.jx-br button:active:not(:disabled),
.jx-br .jx-br__btn:active:not(:disabled) {
  transform: scale(0.98);
}

/* 游戏工具：青紫渐变旋转描边；内层主按钮为全站绿色 */
.jx-br--game {
  --jx-g1: #06b6d4;
  --jx-g2: #22d3ee;
  --jx-g3: #a855f7;
  --jx-bg: rgba(255, 255, 255, 0.98);
  --jx-border-w: 2px;
  filter: drop-shadow(0 3px 10px rgba(124, 58, 237, 0.12));
}
.jx-br--game .jx-br__inner {
  padding: 2px;
  min-height: 0;
  border-radius: calc(var(--jx-radius) - 1px);
}
/* 默认：描边上的幽灵/线框按钮 — 深蓝字 */
.jx-br--game button:not(.primary),
.jx-br--game .jx-br__btn:not(.primary) {
  color: #1e3a8a;
  font-weight: 650;
}
/* 主行动：绿色扁平 + 轻内高光 */
.jx-br--game button.primary,
.jx-br--game .jx-br__btn.primary {
  background: var(--jx-btn-primary) !important;
  color: #fff !important;
  font-weight: 700 !important;
  letter-spacing: 0.02em;
  padding: 13px 28px !important;
  min-height: 48px !important;
  border: none !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    var(--jx-btn-primary-shadow) !important;
  transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease !important;
}
.jx-br--game button.primary:hover:not(:disabled),
.jx-br--game .jx-br__btn.primary:hover:not(:disabled) {
  background: var(--jx-btn-primary-hover) !important;
  filter: none !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    var(--jx-btn-primary-shadow-hover) !important;
}

.jx-br--game-round {
  --jx-radius: 999px;
  width: 56px;
  height: 56px;
  min-width: 56px;
  min-height: 56px;
  padding: 0;
  align-items: center;
  justify-content: center;
}
.jx-br--game-round .jx-br__inner {
  min-height: 0;
  width: 100%;
  height: 100%;
  padding: 0;
}
.jx-br--game-round button {
  width: 100%;
  height: 100%;
  min-height: 0;
  border-radius: 50%;
  font-size: 20px;
  font-weight: 800;
  padding: 0;
}

/* 圆形返回按钮（无旋转动画，更稳） */
.jx-br--back {
  animation: jx-gradient-rotate-slow 8s linear infinite;
}
.jx-br--back:hover {
  filter: brightness(1.02);
}

@media (prefers-reduced-motion: reduce) {
  .jx-br,
  .jx-br--back {
    animation: none !important;
    background-image: linear-gradient(var(--jx-bg), var(--jx-bg)),
      linear-gradient(135deg, var(--jx-g1), var(--jx-g2) 50%, var(--jx-g3));
  }
}

/* 首页：主 CTA 外包一层 */
.jx-br--cta {
  --jx-radius: 16px;
}
.jx-br--cta .jx-btn--primary,
.jx-br--cta .btn-primary {
  margin: 0;
  border-radius: 14px;
  box-shadow: none;
}

/* 导航链接：精致药丸 */
.nav-mid a.jx-nav-pill,
.nav-mid .footer-link-btn.jx-nav-pill {
  position: relative;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(22, 101, 52, 0.12);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset;
}
.nav-mid a.jx-nav-pill:hover,
.nav-mid .footer-link-btn.jx-nav-pill:hover {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.25);
  color: var(--primary-700, #166534);
}

/* 购买区：价格行 */
.shop-price-tiers {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}
.shop-tier {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(248, 250, 252, 0.98));
  border: 1px solid rgba(22, 101, 52, 0.1);
  font-size: 13px;
  font-weight: 800;
  color: var(--gray-900, #2a2a2a);
}
.shop-tier strong {
  font-size: 1.05rem;
  font-weight: 950;
  letter-spacing: -0.02em;
  color: #15803d;
}
.shop-tier small {
  display: block;
  font-size: 11px;
  font-weight: 650;
  color: var(--text-tertiary, #737373);
  margin-top: 2px;
}

/* 与「开始游戏」同排工具栏：主按钮占满剩余宽度 */
.input-actions > .jx-br--game {
  flex: 1;
  min-width: 160px;
}
.input-actions > .jx-br--game .jx-br__inner,
.input-actions > .jx-br--game button.primary {
  width: 100%;
  box-sizing: border-box;
}

/* 玩法弹窗底部主按钮：与游戏页一致 */
.game-help-actions {
  margin-top: 4px;
}
.game-help-actions > .jx-br--game {
  width: 100%;
  display: flex;
}
.game-help-actions > .jx-br--game .jx-br__inner,
.game-help-actions > .jx-br--game button.primary {
  width: 100%;
  box-sizing: border-box;
}

/* ========== 站点统一按钮（可不依赖 jx-br 包裹，与课堂「渐变描边」同源） ========== */
.jx-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
  font-weight: 700;
  font-size: 14px;
  line-height: 1.25;
  box-sizing: border-box;
  cursor: pointer;
  text-decoration: none;
  border: none;
  margin: 0;
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease,
    border-color 0.2s ease;
}
.jx-btn--pill {
  border-radius: 999px;
  padding: 10px 20px;
  min-height: 44px;
}
.jx-btn--md {
  border-radius: 14px;
  padding: 12px 24px;
  min-height: 46px;
  font-size: 15px;
}
.jx-btn--sm {
  border-radius: 12px;
  padding: 8px 16px;
  min-height: 36px;
  font-size: 13px;
  font-weight: 650;
}
/* 次要：白底 + 绿色描边（与主站一致） */
.jx-btn--ghost {
  color: #166534;
  font-weight: 650;
  border: 2px solid rgba(22, 101, 52, 0.28);
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  box-shadow: 0 2px 10px rgba(22, 101, 52, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.95);
}
.jx-btn--ghost:hover {
  transform: translateY(-1px);
  filter: none;
  background: rgba(220, 252, 231, 0.95);
  border-color: rgba(34, 197, 94, 0.45);
  box-shadow: 0 6px 18px rgba(22, 101, 52, 0.12), inset 0 1px 0 #fff;
}
.jx-btn--ghost:active {
  transform: translateY(0);
}
/* 主行动：绿色扁平 */
.jx-btn--primary {
  color: #fff !important;
  font-weight: 700;
  border-radius: 14px;
  padding: 13px 28px;
  min-height: 48px;
  font-size: 15px;
  background: var(--jx-btn-primary);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), var(--jx-btn-primary-shadow);
  transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}
.jx-btn--primary:hover {
  filter: none;
  background: var(--jx-btn-primary-hover);
  transform: translateY(-1px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), var(--jx-btn-primary-shadow-hover);
}
.jx-btn--primary:active {
  background: var(--jx-btn-primary-active);
  transform: translateY(0);
}
/* 中性次要：白底细边框 */
.jx-btn--secondary {
  color: #0f172a;
  font-weight: 650;
  border-radius: 14px;
  padding: 12px 22px;
  min-height: 44px;
  font-size: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
  border: 1px solid rgba(15, 23, 42, 0.1);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}
.jx-btn--secondary:hover {
  transform: translateY(-1px);
  border-color: rgba(34, 197, 94, 0.28);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}
.jx-btn--block {
  width: 100%;
  justify-content: center;
}
@media (prefers-reduced-motion: reduce) {
  .jx-btn--ghost:hover,
  .jx-btn--primary:hover,
  .jx-btn--secondary:hover {
    transform: none;
  }
}

/* =========================
   自定义 alert（替换原生 alert）
   用于统一美化“只有确定按钮”的弹窗
   ========================= */
.jx-alert-mask {
  position: fixed;
  inset: 0;
  z-index: 10090;
  background: rgba(26, 26, 26, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  place-items: center;
  padding: 16px;
}
.jx-alert-mask.on {
  display: grid;
}
.jx-alert-panel {
  width: min(92vw, 520px);
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid rgba(22, 101, 52, 0.12);
  box-shadow: 0 24px 60px rgba(22, 101, 52, 0.12), 0 16px 40px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}
.jx-alert-body {
  padding: 20px 20px 10px;
  font-size: 14px;
  line-height: 1.65;
  color: #0f172a;
  white-space: pre-wrap;
  word-break: break-word;
}
.jx-alert-actions {
  padding: 14px 20px 18px;
  display: flex;
  justify-content: flex-end;
}
