/* ============================================================
   小J教育 · 统一设计系统 design-system.css (redesign-all-pages v1.1)
   与 Android res/values Token 一一对应，见 DOCUMENTATION/四端Token对照表_v1.1.md
   用法：在 Tailwind CDN 之后引入本文件，覆盖组件基础样式。
   ============================================================ */

:root {
  /* ---- 色彩（Color Tokens）---- */
  --rd-primary: #4F6BFF;
  --rd-primary-deep: #3D5CFF;
  --rd-primary-soft: #E9EDFF;
  --rd-bg: #F6F7FB;
  --rd-surface: #FFFFFF;
  --rd-text-primary: #171A21;
  --rd-text-secondary: #5B6472;
  --rd-text-tertiary: #9AA3B2;
  --rd-divider: #EDF0F5;
  --rd-success: #10B981;
  --rd-warning: #F59E0B;
  --rd-danger: #EF4444;
  --rd-shadow-color: rgba(23, 26, 33, 0.06);

  /* ---- 暗色玩法色板（Dark Play）---- */
  --rd-dp-bg-start: #0F1230;
  --rd-dp-bg-end: #1B2147;
  --rd-dp-card: rgba(30, 36, 72, 0.6);
  --rd-dp-text-primary: #F5F7FF;
  --rd-dp-text-secondary: #9AA3C4;

  /* ---- 圆角（Radius）---- */
  --rd-radius-sm: 8px;
  --rd-radius-md: 12px;
  --rd-radius-lg: 16px;
  --rd-radius-xl: 20px;
  --rd-radius-xxl: 24px;
  --rd-radius-pill: 999px;

  /* ---- 间距（Spacing，4px 网格）---- */
  --rd-space-4: 4px;
  --rd-space-8: 8px;
  --rd-space-12: 12px;
  --rd-space-16: 16px;
  --rd-space-20: 20px;
  --rd-space-24: 24px;

  /* ---- 尺寸（Component Sizes）---- */
  --rd-touch-target: 44px;
  --rd-list-row: 56px;
  --rd-btn-height: 52px;
  --rd-func-icon: 52px;

  /* ---- 阴影 ---- */
  --rd-card-shadow: 0 8px 24px var(--rd-shadow-color);

  /* ---- 动效 ---- */
  --rd-anim-duration: 260ms;
  --rd-anim-ease: cubic-bezier(0.25, 0.1, 0.25, 1);
}

/* ---- 基础排版 ---- */
html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
body {
  background: var(--rd-bg);
  color: var(--rd-text-primary);
  font-size: 15px;
  line-height: 1.5;
}

.rd-title { font-size: 24px; font-weight: 700; line-height: 1.4; }
.rd-card-title { font-size: 17px; font-weight: 700; line-height: 1.4; }
.rd-body { font-size: 15px; line-height: 1.5; }
.rd-sub { font-size: 14px; line-height: 1.5; }
.rd-caption { font-size: 13px; line-height: 1.5; color: var(--rd-text-secondary); }
.rd-tag { font-size: 12px; line-height: 1.5; }
.rd-display { font-size: 32px; font-weight: 700; line-height: 1.2; }

/* ---- 卡片 ---- */
.rd-card {
  background: var(--rd-surface);
  border-radius: var(--rd-radius-lg);
  padding: var(--rd-space-16);
  box-shadow: var(--rd-card-shadow);
}
.rd-card--flat {
  background: var(--rd-surface);
  border-radius: var(--rd-radius-lg);
  padding: var(--rd-space-16);
}
.rd-card--dp {
  background: var(--rd-dp-card);
  border-radius: var(--rd-radius-md);
  border: 1px solid rgba(245, 247, 255, 0.12);
  color: var(--rd-dp-text-primary);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* ---- 按钮 ---- */
.rd-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--rd-btn-height);
  min-height: var(--rd-touch-target);
  padding: 0 24px;
  border: none;
  border-radius: var(--rd-radius-pill);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--rd-anim-duration) var(--rd-anim-ease),
              opacity var(--rd-anim-duration) var(--rd-anim-ease);
}
.rd-btn:active { transform: scale(0.97); }
.rd-btn--primary {
  background: linear-gradient(135deg, var(--rd-primary), var(--rd-primary-deep));
  color: #FFFFFF;
}
.rd-btn--secondary {
  background: var(--rd-primary-soft);
  color: var(--rd-primary);
}
.rd-btn--text {
  background: transparent;
  color: var(--rd-primary);
  height: var(--rd-touch-target);
  padding: 0 8px;
}
.rd-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---- 输入框 ---- */
.rd-input {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  border: 1px solid var(--rd-divider);
  border-radius: var(--rd-radius-lg);
  font-size: 15px;
  background: var(--rd-surface);
  color: var(--rd-text-primary);
  outline: none;
  transition: border-color var(--rd-anim-duration) var(--rd-anim-ease);
}
.rd-input:focus { border-color: var(--rd-primary); }
.rd-input--error { border-color: var(--rd-danger); }

/* ---- Tab / 底部导航 ---- */
.rd-tabbar {
  display: flex;
  align-items: center;
  height: 56px;
  background: var(--rd-surface);
  border-top: 1px solid var(--rd-divider);
}
.rd-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: var(--rd-touch-target);
  font-size: 12px;
  color: var(--rd-text-tertiary);
  background: none;
  border: none;
  cursor: pointer;
  transition: color var(--rd-anim-duration) var(--rd-anim-ease);
}
.rd-tab--active { color: var(--rd-primary); font-weight: 600; }
.rd-tab--active .rd-tab-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--rd-primary);
}

/* ---- 列表项 ---- */
.rd-list-item {
  display: flex;
  align-items: center;
  min-height: var(--rd-list-row);
  padding: 0 var(--rd-space-16);
  background: var(--rd-surface);
}
.rd-list-item + .rd-list-item { border-top: 1px solid var(--rd-divider); }
.rd-list-item--inset + .rd-list-item--inset {
  border-top: none;
}
.rd-list-item--inset::after {
  content: "";
  position: absolute;
  left: 50px;
  right: 16px;
  bottom: 0;
  height: 1px;
  background: var(--rd-divider);
}
.rd-chevron {
  width: 20px;
  height: 20px;
  color: var(--rd-text-tertiary);
  flex-shrink: 0;
}

/* ---- 弹窗 / Toast ---- */
.rd-dialog {
  background: var(--rd-surface);
  border-radius: var(--rd-radius-xl);
  padding: 24px;
  box-shadow: var(--rd-card-shadow);
}
.rd-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 100;
}
.rd-toast {
  display: inline-flex;
  align-items: center;
  padding: 12px 20px;
  border-radius: var(--rd-radius-md);
  background: rgba(23, 26, 33, 0.85);
  color: #FFFFFF;
  font-size: 14px;
  animation: rd-fade-in var(--rd-anim-duration) var(--rd-anim-ease);
}

/* ---- 骨架屏（shimmer 1.2s）---- */
.rd-skeleton {
  position: relative;
  overflow: hidden;
  background: var(--rd-divider);
  border-radius: var(--rd-radius-sm);
}
.rd-skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
  animation: rd-shimmer 1.2s infinite;
}

/* ---- 动效 ---- */
@keyframes rd-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes rd-rise-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes rd-shimmer {
  100% { transform: translateX(100%); }
}
.rd-anim-page {
  animation: rd-rise-in var(--rd-anim-duration) var(--rd-anim-ease);
}

/* ---- 暗色玩法页容器 ---- */
.rd-darkplay {
  background: linear-gradient(180deg, var(--rd-dp-bg-start), var(--rd-dp-bg-end));
  color: var(--rd-dp-text-primary);
  min-height: 100vh;
}
.rd-darkplay .rd-caption { color: var(--rd-dp-text-secondary); }
