/* ============================================
   设计系统 - 人工智能训练师练习平台
   ============================================ */

:root {
  /* 主色调 - 精致玫瑰红 */
  --rose-50: #fff1f2;
  --rose-100: #ffe4e6;
  --rose-200: #fecdd3;
  --rose-400: #fb7185;
  --rose-500: #f43f5e;
  --rose-600: #e11d48;
  --rose-700: #be123c;

  /* 功能色 */
  --emerald-50: #ecfdf5;
  --emerald-100: #d1fae5;
  --emerald-400: #34d399;
  --emerald-500: #10b981;
  --emerald-600: #059669;
  --emerald-700: #047857;

  --amber-50: #fffbeb;
  --amber-100: #fef3c7;
  --amber-400: #fbbf24;
  --amber-500: #f59e0b;
  --amber-600: #d97706;

  /* 中性色 - 暖灰 */
  --gray-0: #ffffff;
  --gray-50: #fafaf9;
  --gray-100: #f5f5f4;
  --gray-200: #e7e5e4;
  --gray-300: #d6d3d1;
  --gray-400: #a8a29e;
  --gray-500: #78716c;
  --gray-600: #57534e;
  --gray-700: #44403c;
  --gray-800: #292524;
  --gray-900: #1c1917;

  /* 语义变量 */
  --bg: var(--gray-50);
  --surface: var(--gray-0);
  --text: var(--gray-900);
  --text-secondary: var(--gray-500);
  --text-tertiary: var(--gray-400);
  --border: rgba(28, 25, 23, 0.06);
  --border-strong: rgba(28, 25, 23, 0.1);

  --primary: var(--rose-600);
  --primary-soft: var(--rose-50);
  --primary-light: var(--rose-100);
  --primary-hover: var(--rose-700);
  --primary-ring: rgba(225, 29, 72, 0.2);

  --success: var(--emerald-600);
  --success-soft: var(--emerald-50);
  --success-light: var(--emerald-100);

  --warn: var(--amber-600);
  --warn-soft: var(--amber-50);
  --warn-light: var(--amber-100);

  /* 阴影 - 自然深色 */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.06), 0 4px 6px -2px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.06), 0 10px 10px -5px rgba(0, 0, 0, 0.02);

  /* 圆角 */
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-full: 999px;

  /* 过渡 */
  --transition-fast: 0.12s ease;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   基础重置
   ============================================ */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

/* ============================================
   布局容器
   ============================================ */

.shell {
  max-width: 460px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 20px 16px 40px;
}

/* ============================================
   卡片系统
   ============================================ */

.login-card,
.panel,
.question-card,
.sheet {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
}

.login-card {
  margin-top: 14vh;
  padding: 32px 28px;
}

.panel {
  padding: 20px;
  margin-bottom: 12px;
}

.question-card {
  padding: 20px;
  margin-bottom: 12px;
}

.sheet {
  padding: 20px;
  margin-bottom: 12px;
}

/* ============================================
   登录页
   ============================================ */

.login-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.login-hero .headline {
  margin: 0;
}

.login-mark {
  width: 56px;
  height: 56px;
  border-radius: var(--r-lg);
  background: linear-gradient(135deg, #ff7f67, var(--primary));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.04em;
  box-shadow: 0 8px 20px rgba(225, 29, 72, 0.22);
  flex-shrink: 0;
}

.headline {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0 0 10px;
}

.subline {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0 0 28px;
}

.field {
  margin-bottom: 12px;
}

.input {
  width: 100%;
  border: 1.5px solid var(--border);
  background: var(--surface);
  border-radius: var(--r);
  padding: 14px 16px;
  font-size: 15px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.input::placeholder {
  color: var(--text-tertiary);
}

.input:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

.btn {
  border-radius: var(--r);
  padding: 14px 18px;
  font-size: 15px;
  font-weight: 600;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  width: 100%;
  color: #fff;
  background: linear-gradient(135deg, #ff6b6b, var(--primary));
  box-shadow: 0 4px 12px rgba(225, 29, 72, 0.25);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #ff5252, var(--primary-hover));
  box-shadow: 0 6px 16px rgba(225, 29, 72, 0.32);
  transform: translateY(-1px);
}

.btn-light {
  background: var(--rose-50);
  color: var(--primary);
  border: 1px solid var(--rose-100);
}

.btn-light:hover {
  background: var(--rose-100);
  border-color: var(--rose-200);
}

.btn-favorite {
  background: var(--surface);
  color: var(--primary);
  border: 1.5px solid var(--rose-100);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--r-full);
  transition: all var(--transition-fast);
}

.btn-favorite:hover {
  background: var(--rose-50);
  border-color: var(--rose-200);
  transform: translateY(-1px);
}

.filter-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.filter-row .btn {
  flex: 1;
  padding: 10px 8px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--r-full);
}

.btn-filter {
  background: var(--gray-50);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  transition: all var(--transition-fast);
}

.btn-filter:hover {
  background: var(--rose-50);
  color: var(--primary);
  border-color: var(--rose-100);
}

.btn-filter.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(225, 29, 72, 0.25);
}

.hint-text {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-bottom: 12px;
  line-height: 1.5;
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.btn-reset-sm {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--r-full);
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  transition: all var(--transition-fast);
}

.btn-reset-sm:hover {
  background: var(--rose-50);
  color: var(--primary);
  border-color: var(--rose-100);
}

/* ---------- 滑块验证 ---------- */

.slider-box {
  position: relative;
  height: 44px;
  border-radius: var(--r);
  background: var(--gray-100);
  border: 1px solid var(--border);
  overflow: hidden;
  user-select: none;
  touch-action: none;
  margin-bottom: 12px;
}

.slider-track {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.slider-text {
  font-size: 13px;
  color: var(--text-tertiary);
  z-index: 1;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.slider-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  background: linear-gradient(90deg, var(--emerald-400), var(--emerald-500));
  z-index: 0;
  border-radius: var(--r) 0 0 var(--r);
}

.slider-thumb {
  position: absolute;
  left: 0;
  top: 0;
  width: 44px;
  height: 44px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--text-secondary);
  cursor: pointer;
  z-index: 2;
  box-shadow: var(--shadow-sm);
  transition: left 0.3s ease, background 0.3s ease, border-color 0.3s ease;
}

.slider-thumb:active {
  cursor: grabbing;
}

.slider-thumb.success {
  background: var(--emerald-500);
  border-color: var(--emerald-500);
  color: #fff;
  cursor: default;
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.login-tips {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-tertiary);
}

/* ============================================
   Dashboard
   ============================================ */

.hero {
  padding: 8px 4px 20px;
}

.hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--r-lg);
  background: linear-gradient(160deg, #6366f1, #4f46e5);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  line-height: 1.3;
  padding: 4px;
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.22);
  flex-shrink: 0;
}

.title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.tiny {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
}

.mastery {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.mastery > div:first-child {
  font-size: 15px;
  font-weight: 600;
}

.mastery .tiny {
  margin-top: 4px;
}

.meter {
  width: 100%;
  height: 10px;
  background: var(--gray-100);
  border-radius: var(--r-full);
  overflow: hidden;
  margin-top: 12px;
}

.meter-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--rose-500), var(--rose-400));
  border-radius: var(--r-full);
  color: transparent;
  font-size: 0;
  min-width: 4px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   Dashboard Banner
   ============================================ */

.dashboard-banner {
  display: flex;
  align-items: center;
  gap: 16px;
}

.dashboard-divider {
  width: 1px;
  align-self: stretch;
  background: var(--border);
}

.banner-value {
  font-size: 36px;
  line-height: 1;
  font-weight: 800;
  color: var(--primary);
  margin: 8px 0 4px;
  letter-spacing: -0.02em;
}

.banner-side {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.banner-chip {
  padding: 6px 12px;
  border-radius: var(--r-full);
  background: var(--gray-50);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.banner-chip:hover {
  background: var(--rose-50);
  border-color: var(--rose-100);
  color: var(--primary);
}

/* ============================================
   Bank List
   ============================================ */

.bank-list {
  display: grid;
  gap: 10px;
}

.bank-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--transition), transform var(--transition-fast), border-color var(--transition-fast);
}

.bank-item:hover {
  box-shadow: var(--shadow);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.bank-main {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 14px;
  align-items: center;
}

.bank-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--r);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}

.bank-item:hover .bank-icon {
  transform: scale(1.08);
}

.bank-icon[data-type="judgement"] {
  background: var(--rose-50);
  color: var(--primary);
}

.bank-icon[data-type="single"] {
  background: var(--emerald-50);
  color: var(--emerald-600);
}

.bank-icon[data-type="multiple"] {
  background: var(--amber-50);
  color: var(--amber-600);
}

.bank-title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.bank-meta {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
  line-height: 1.5;
}

.bank-action {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
}

.bank-action .btn {
  padding: 10px 16px;
  font-size: 13px;
  border-radius: var(--r);
  white-space: nowrap;
}

.btn-reset {
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  transition: all var(--transition-fast);
}

.btn-reset:hover {
  background: var(--gray-50);
  color: var(--text);
  border-color: var(--gray-300);
}

/* ============================================
   题目页
   ============================================ */

.toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.toolbar .btn {
  flex: 1;
  font-size: 14px;
  padding: 12px 16px;
}

.question-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.question-top .title {
  font-size: 20px;
  margin-top: 4px;
}

.question-top .btn {
  padding: 8px 14px;
  font-size: 13px;
  flex-shrink: 0;
}

.stem-card {
  padding: 20px;
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, var(--rose-50), var(--surface));
  border: 1.5px solid var(--rose-100);
}

.stem-type {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: var(--r-full);
  background: var(--rose-50);
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 12px;
  border: 1px solid var(--rose-100);
}

.stem-text {
  font-size: 18px;
  line-height: 1.75;
  letter-spacing: 0.01em;
  color: var(--text);
  font-weight: 500;
}

.option-list {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--r);
  border: 1.5px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  transition: all var(--transition-fast);
  font-size: 15px;
}

.option:hover {
  border-color: var(--rose-200);
  background: var(--rose-50);
}

.option.active {
  border-color: var(--primary);
  background: var(--rose-50);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

.option-tag {
  width: 32px;
  height: 32px;
  border-radius: var(--r-full);
  background: var(--gray-100);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.option:hover .option-tag {
  background: var(--rose-100);
  color: var(--primary);
}

.option.active .option-tag {
  background: linear-gradient(135deg, var(--rose-500), var(--primary));
  color: #fff;
  box-shadow: 0 2px 8px rgba(225, 29, 72, 0.25);
}

.actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 20px;
}

.result {
  margin-top: 16px;
  border-radius: var(--r-lg);
  padding: 16px;
  font-size: 14px;
  line-height: 1.6;
  font-weight: 500;
  animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.result.ok {
  background: var(--emerald-50);
  color: var(--emerald-700);
  border: 1px solid var(--emerald-100);
}

.result.bad {
  background: var(--rose-50);
  color: var(--primary);
  border: 1px solid var(--rose-100);
}

.result.pending {
  background: var(--amber-50);
  color: var(--amber-600);
  border: 1px solid var(--amber-100);
}

.explanation {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  line-height: 1.8;
  font-weight: 400;
}

/* ============================================
   Sheet / 答题卡
   ============================================ */

.sheet .section-heading {
  margin-bottom: 12px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-title {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.note-box {
  width: 100%;
  min-height: 80px;
  resize: vertical;
  border-radius: var(--r);
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 14px;
  line-height: 1.6;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.note-box:focus {
  outline: none;
  border-color: var(--rose-200);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

.note-box::placeholder {
  color: var(--text-tertiary);
}

.row {
  display: flex;
  gap: 8px;
}

.row > * {
  flex: 1;
}

.number-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.num {
  aspect-ratio: 1;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.num:hover {
  border-color: var(--rose-200);
  background: var(--rose-50);
  transform: translateY(-1px);
  box-shadow: var(--shadow-xs);
}

.num.answered {
  background: var(--rose-50);
  color: var(--primary);
  border-color: var(--rose-200);
}

.num.correct {
  background: var(--emerald-50);
  color: var(--emerald-700);
  border-color: var(--emerald-400);
}

.num.wrong {
  background: var(--rose-50);
  color: var(--primary);
  border-color: var(--rose-400);
}

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

.hidden {
  display: none !important;
}

.empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 14px;
}

.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(28, 25, 23, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
  backdrop-filter: blur(6px);
}

.dialog-card {
  width: min(100%, 360px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  padding: 22px 18px 18px;
  animation: fadeInUp 0.18s ease;
}

.dialog-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
}

.dialog-text {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-secondary);
}

.dialog-message {
  min-height: 20px;
  margin-top: 10px;
  font-size: 13px;
  color: var(--primary);
}

.dialog-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(12px);
  min-width: 180px;
  max-width: calc(100vw - 32px);
  padding: 12px 16px;
  border-radius: var(--r-full);
  background: rgba(28, 25, 23, 0.92);
  color: #fff;
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  z-index: 1100;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.success {
  background: rgba(4, 120, 87, 0.95);
}

.toast.error {
  background: rgba(190, 24, 93, 0.95);
}

/* ============================================
   响应式
   ============================================ */

@media (max-width: 380px) {
  .shell {
    padding: 16px 12px 32px;
  }

  .login-card {
    padding: 24px 20px;
  }

  .headline {
    font-size: 24px;
  }

  .stem-text {
    font-size: 16px;
  }

  .dashboard-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .dashboard-divider {
    width: 100%;
    height: 1px;
  }

  .bank-item {
    padding: 14px 16px;
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .bank-action {
    flex-direction: row;
    justify-content: flex-end;
  }
}
