/* ==========================================================================
   快乐学霸AI工作台 · Component layer
   Buttons, surfaces, inputs, tabs, tables, overlays — one visual language.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Icon sizing
   -------------------------------------------------------------------------- */

.ic {
  width: 16px;
  height: 16px;
  flex: none;
  stroke-width: 1.6;
}

.ic-14 { width: 14px; height: 14px; }
.ic-18 { width: 18px; height: 18px; }
.ic-20 { width: 20px; height: 20px; }
.ic-22 { width: 22px; height: 22px; }
.ic-28 { width: 28px; height: 28px; stroke-width: 1.4; }
.ic-36 { width: 36px; height: 36px; stroke-width: 1.4; }

/* --------------------------------------------------------------------------
   Button
   -------------------------------------------------------------------------- */

.btn {
  --btn-h: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: var(--btn-h);
  padding: 0 13px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-2);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(250, 250, 249, 0.94));
  color: var(--ink-800);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.005em;
  white-space: nowrap;
  box-shadow: var(--sh-1);
  transition: background var(--t-fast) var(--ease-out),
    border-color var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out),
    box-shadow var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-out);
  user-select: none;
}

.btn:hover {
  background: var(--white);
  border-color: var(--line-3);
  box-shadow: var(--sh-2);
}

.btn:active {
  transform: translateY(0.5px) scale(0.988);
  box-shadow: var(--sh-1);
}

.btn[disabled],
.btn.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.btn-primary {
  background: linear-gradient(180deg, #22252b, #14161b);
  border-color: #0d0f13;
  color: #f7f7f6;
  box-shadow: 0 1px 2px rgba(20, 22, 27, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.btn-primary:hover {
  background: linear-gradient(180deg, #2c3037, #1b1e23);
  border-color: #0d0f13;
  color: #fff;
  box-shadow: 0 2px 6px rgba(20, 22, 27, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* 浅品牌色按钮：配色跟 .badge-brand（例如页头的「吴子越」标签）一致，
   但保持 .btn 自己的圆角与高度（用户要求只换配色，不改圆角比例） */
.btn-soft-brand {
  background: var(--brand-50);
  border-color: rgba(13, 114, 100, 0.18);
  color: var(--brand-700);
  box-shadow: none;
  font-weight: 600;
}

.btn-soft-brand:hover {
  background: var(--brand-100);
  border-color: rgba(13, 114, 100, 0.28);
  color: var(--brand-700);
  box-shadow: none;
}

.btn-brand {
  background: linear-gradient(180deg, var(--brand-600), var(--brand-700));
  border-color: var(--brand-700);
  color: #f2fbf8;
  box-shadow: 0 1px 2px rgba(6, 60, 52, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.btn-brand:hover {
  background: linear-gradient(180deg, var(--brand-500), var(--brand-600));
  color: #fff;
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--ink-600);
}

.btn-ghost:hover {
  background: rgba(20, 22, 27, 0.055);
  border-color: transparent;
  box-shadow: none;
  color: var(--ink-900);
}

.btn-quiet {
  background: rgba(20, 22, 27, 0.045);
  border-color: transparent;
  box-shadow: none;
  color: var(--ink-700);
}

.btn-quiet:hover {
  background: rgba(20, 22, 27, 0.08);
  border-color: transparent;
  box-shadow: none;
}

.btn-danger {
  color: var(--danger-600);
  border-color: rgba(176, 66, 58, 0.22);
  background: linear-gradient(180deg, #fff, #fdf6f5);
}

.btn-danger:hover {
  background: var(--danger-100);
  border-color: rgba(176, 66, 58, 0.32);
  color: var(--danger-600);
}

.btn-sm {
  --btn-h: 29px;
  padding: 0 10px;
  font-size: 12.5px;
  border-radius: var(--r-sm);
  gap: 5px;
}

.btn-lg {
  --btn-h: 40px;
  padding: 0 18px;
  font-size: 13.5px;
  border-radius: var(--r-lg);
}

.btn-block {
  width: 100%;
}

.btn-icon {
  width: var(--btn-h);
  padding: 0;
}

.btn-text {
  height: auto;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  color: var(--brand-700);
  font-weight: 500;
}

.btn-text:hover {
  background: none;
  box-shadow: none;
  color: var(--brand-900);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.btn .ic {
  color: currentColor;
  opacity: 0.85;
}

/* --------------------------------------------------------------------------
   Surface / Card
   -------------------------------------------------------------------------- */

.card {
  position: relative;
  border-radius: var(--r-xl);
  border: 1px solid var(--line);
  background: var(--surface);
  backdrop-filter: saturate(140%) blur(16px);
  -webkit-backdrop-filter: saturate(140%) blur(16px);
  box-shadow: var(--sh-2), var(--sh-inset-top);
}

.card-pad {
  padding: var(--gap-5);
}

.card-pad-lg {
  padding: var(--gap-6);
}

.card-flat {
  box-shadow: none;
  background: var(--surface-solid);
}

.card-solid {
  background: var(--surface-solid);
}

.card-dark {
  background: linear-gradient(168deg, #191c21 0%, #12141a 62%, #101318 100%);
  border-color: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.82);
  box-shadow: var(--sh-3);
}

.card-dark .h1,
.card-dark .h2,
.card-dark .h3,
.card-dark .num-lg,
.card-dark .num-md {
  color: #fff;
}

.card-dark .muted,
.card-dark .sub,
.card-dark .micro {
  color: rgba(255, 255, 255, 0.58);
}

.card-hover {
  transition: border-color var(--t-base) var(--ease-out),
    box-shadow var(--t-base) var(--ease-out), transform var(--t-base) var(--ease-out);
}

.card-hover:hover {
  border-color: var(--line-2);
  box-shadow: var(--sh-3), var(--sh-inset-top);
  transform: translateY(-1px);
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--gap-4);
  flex-wrap: wrap;
  padding: 18px var(--gap-5) 14px;
}

.card-head > .row,
.card-head > .segmented,
.card-head > .legend {
  flex: none;
  margin-left: auto;
}

.card-head + .card-body {
  padding-top: 0;
}

.card-body {
  padding: var(--gap-5);
}

.card-body-flush {
  padding: 0;
}

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap-3);
  padding: 12px var(--gap-5);
  border-top: 1px solid var(--line);
  background: rgba(247, 247, 245, 0.6);
  border-radius: 0 0 var(--r-xl) var(--r-xl);
}

.card-title-row {
  display: flex;
  align-items: center;
  gap: var(--gap-2);
}

.card-title {
  font-size: var(--fs-h3);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink-900);
}

/* 大卡片头：真正像"标题"的层次（用于知识点掌握明细这类主列表） */
.card-head-lg {
  padding: 20px var(--gap-5) 16px;
  border-bottom: 1px solid var(--line);
}

.card-head-lg .card-title {
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.015em;
}

.card-head-lg .card-title-row {
  gap: 10px;
}

.card-head-lg .card-title-row .ic-18 {
  width: 20px;
  height: 20px;
  color: var(--ink-700);
}

.card-head-lg .card-head-sub {
  margin-top: 7px;
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--ink-500);
  max-width: 760px;
}

.card-head-lg + .card-body {
  padding-top: 18px;
}

.section-label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: var(--gap-4);
}

.section-index {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--ink-300);
  border: 1px solid var(--line-2);
  border-radius: var(--r-xs);
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.7);
}

/* --------------------------------------------------------------------------
   Badge / chip / pill
   -------------------------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border-radius: var(--r-full);
  font-size: var(--fs-micro);
  font-weight: 500;
  letter-spacing: 0.005em;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink-600);
  white-space: nowrap;
}

.badge-brand {
  border-color: rgba(13, 114, 100, 0.18);
  background: var(--brand-50);
  color: var(--brand-700);
}

.badge-amber {
  border-color: rgba(184, 130, 43, 0.2);
  background: var(--amber-50);
  color: var(--amber-700);
}

.badge-danger {
  border-color: rgba(176, 66, 58, 0.18);
  background: #fdf3f1;
  color: var(--danger-600);
}

.badge-ok {
  border-color: rgba(47, 122, 78, 0.18);
  background: #f1f7f3;
  color: var(--ok-600);
}

.badge-ink {
  background: var(--ink-900);
  border-color: var(--ink-900);
  color: #fff;
}

.badge-dashed {
  border-style: dashed;
  background: transparent;
  color: var(--ink-400);
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink-300);
  flex: none;
}

.dot-brand { background: var(--brand-500); }
.dot-ok { background: var(--ok-600); }
.dot-amber { background: var(--amber-500); }
.dot-danger { background: var(--danger-600); }

.dot-pulse {
  position: relative;
}

.dot-pulse::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1px solid currentColor;
  opacity: 0.35;
}

/* --------------------------------------------------------------------------
   Avatar
   -------------------------------------------------------------------------- */

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--r-md);
  background: linear-gradient(180deg, #f2f2f0, #e7e8e6);
  border: 1px solid var(--line);
  color: var(--ink-600);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  flex: none;
  overflow: hidden;
}

.avatar-sm { width: 28px; height: 28px; border-radius: var(--r-sm); font-size: 11px; }
.avatar-lg { width: 44px; height: 44px; border-radius: var(--r-lg); font-size: 14px; }
.avatar-xl { width: 56px; height: 56px; border-radius: var(--r-xl); font-size: 17px; }

.avatar-brand {
  background: linear-gradient(180deg, var(--brand-100), #cfe4df);
  border-color: rgba(13, 114, 100, 0.16);
  color: var(--brand-700);
}

.avatar-amber {
  background: linear-gradient(180deg, #f6ecdc, #efe0c6);
  border-color: rgba(184, 130, 43, 0.18);
  color: var(--amber-700);
}

.avatar-ink {
  background: linear-gradient(180deg, #2a2e35, #191c21);
  border-color: #0f1114;
  color: rgba(255, 255, 255, 0.88);
}

.avatar-stack {
  display: flex;
  align-items: center;
}

.avatar-stack .avatar {
  margin-left: -8px;
  box-shadow: 0 0 0 2px var(--surface-solid);
}

.avatar-stack .avatar:first-child {
  margin-left: 0;
}

/* --------------------------------------------------------------------------
   Form controls
   -------------------------------------------------------------------------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.label {
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--ink-600);
  letter-spacing: -0.002em;
}

.label .req {
  color: var(--danger-600);
  margin-left: 2px;
}

.input,
.select,
.textarea {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-2);
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink-900);
  font-size: 13.5px;
  box-shadow: var(--sh-hairline);
  transition: border-color var(--t-fast) var(--ease-out),
    box-shadow var(--t-fast) var(--ease-out), background var(--t-fast) var(--ease-out);
}

.textarea {
  height: auto;
  min-height: 84px;
  padding: 10px 12px;
  line-height: 1.6;
  resize: vertical;
}

.input::placeholder,
.textarea::placeholder {
  color: var(--ink-300);
}

.input:hover,
.select:hover,
.textarea:hover {
  border-color: var(--line-3);
  background: var(--white);
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--brand-500);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(18, 140, 122, 0.13);
}

.input-affix {
  position: relative;
  display: flex;
  align-items: center;
}

.input-affix .ic {
  position: absolute;
  left: 12px;
  color: var(--ink-400);
  pointer-events: none;
}

.input-affix .input {
  padding-left: 36px;
}

.input-affix-2 .input {
  padding-right: 92px;
}

.input-affix-2 .affix-btn {
  position: absolute;
  right: 5px;
}

.input-icon-btn {
  position: absolute;
  right: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  color: var(--ink-400);
  transition: background var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out);
}

.input-icon-btn:hover {
  background: rgba(20, 22, 27, 0.06);
  color: var(--ink-700);
}

.select {
  appearance: none;
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238b9098' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.input-sm,
.select-sm {
  height: 32px;
  font-size: 12.5px;
  border-radius: var(--r-sm);
  padding: 0 10px;
}

.select-sm {
  padding-right: 28px;
  background-position: right 8px center;
}

.search {
  max-width: 300px;
}

.search .input {
  height: 34px;
  background: rgba(255, 255, 255, 0.62);
}

.search .kbd {
  position: absolute;
  right: 8px;
}

.kbd {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--r-xs);
  border: 1px solid var(--line-2);
  background: rgba(255, 255, 255, 0.9);
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-400);
  box-shadow: var(--sh-hairline);
}

/* Range slider (progress / completion) */

.range {
  width: 100%;
  height: 20px;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  cursor: pointer;
}

.range::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: var(--r-full);
  background: rgba(20, 22, 27, 0.09);
}

.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -6px;
  border-radius: 50%;
  background: var(--white);
  border: 1.5px solid var(--ink-900);
  box-shadow: var(--sh-1);
  transition: transform var(--t-fast) var(--ease-out);
}

.range:active::-webkit-slider-thumb {
  transform: scale(1.08);
}

.range::-moz-range-track {
  height: 4px;
  border-radius: var(--r-full);
  background: rgba(20, 22, 27, 0.09);
}

.range::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--white);
  border: 1.5px solid var(--ink-900);
}

.hint {
  font-size: var(--fs-micro);
  color: var(--ink-400);
  line-height: 1.5;
}

.error-text {
  font-size: var(--fs-micro);
  color: var(--danger-600);
}

/* Checkbox / radio / switch */

.check {
  display: inline-flex;
  align-items: flex-start;
  gap: 9px;
  cursor: pointer;
  font-size: var(--fs-xs);
  color: var(--ink-600);
  line-height: 1.55;
}

.check input {
  appearance: none;
  width: 16px;
  height: 16px;
  margin-top: 1px;
  border-radius: 5px;
  border: 1px solid var(--line-3);
  background: rgba(255, 255, 255, 0.9);
  flex: none;
  transition: background var(--t-fast) var(--ease-out),
    border-color var(--t-fast) var(--ease-out);
  position: relative;
}

.check input:hover {
  border-color: var(--ink-400);
}

.check input:checked {
  background: var(--ink-900);
  border-color: var(--ink-900);
}

.check input:checked::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 1.5px;
  width: 4px;
  height: 8px;
  border: 1.6px solid #fff;
  border-top: 0;
  border-left: 0;
  transform: rotate(42deg);
}

.check input:indeterminate {
  background: var(--ink-900);
  border-color: var(--ink-900);
}

.check input:indeterminate::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 6.5px;
  width: 8px;
  height: 1.6px;
  background: #fff;
}

.check input[type="radio"] {
  border-radius: 50%;
}

.check input[type="radio"]:checked {
  background: #fff;
  border-color: var(--ink-900);
  border-width: 5px;
}

.check input[type="radio"]:checked::after {
  display: none;
}

.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: none;
}

.switch input {
  appearance: none;
  width: 36px;
  height: 21px;
  border-radius: var(--r-full);
  background: rgba(20, 22, 27, 0.14);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--t-base) var(--ease-out);
}

.switch input::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(20, 22, 27, 0.28);
  transition: transform var(--t-base) var(--ease-out);
}

.switch input:checked {
  background: var(--brand-600);
}

.switch input:checked::after {
  transform: translateX(15px);
}

.switch input:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
}

.switch-sm input {
  width: 30px;
  height: 18px;
}

.switch-sm input::after {
  width: 12px;
  height: 12px;
  top: 3px;
  left: 3px;
}

.switch-sm input:checked::after {
  transform: translateX(12px);
}

/* Segmented control */

.segmented {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: var(--r-md);
  background: rgba(20, 22, 27, 0.05);
  border: 1px solid var(--line);
}

.segmented button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 11px;
  border-radius: var(--r-sm);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-500);
  white-space: nowrap;
  transition: background var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out),
    box-shadow var(--t-fast) var(--ease-out);
}

.segmented button:hover {
  color: var(--ink-800);
}

.segmented button.is-active {
  background: var(--white);
  color: var(--ink-900);
  box-shadow: var(--sh-1), 0 0 0 0.5px rgba(20, 22, 27, 0.05);
}

.segmented button:active {
  transform: scale(0.985);
}

.segmented-on-dark {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.1);
}

.segmented-on-dark button {
  color: rgba(255, 255, 255, 0.6);
}

.segmented-on-dark button.is-active {
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink-900);
}

/* Tabs (underline) */

.tabs {
  display: flex;
  align-items: center;
  gap: var(--gap-5);
  border-bottom: 1px solid var(--line);
}

.tab {
  position: relative;
  padding: 0 1px 11px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-500);
  transition: color var(--t-fast) var(--ease-out);
}

.tab:hover {
  color: var(--ink-800);
}

.tab.is-active {
  color: var(--ink-900);
}

.tab.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1.5px;
  background: var(--ink-900);
  border-radius: 2px;
}

/* --------------------------------------------------------------------------
   Progress & meters
   -------------------------------------------------------------------------- */

.progress {
  position: relative;
  height: 6px;
  border-radius: var(--r-full);
  background: rgba(20, 22, 27, 0.07);
  overflow: hidden;
}

.progress-sm { height: 4px; }
.progress-lg { height: 8px; }

.progress > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--ink-800);
  width: 0;
  transition: width 620ms var(--ease-out);
}

.progress-brand > i { background: linear-gradient(90deg, var(--brand-500), var(--brand-600)); }
.progress-amber > i { background: linear-gradient(90deg, #d0a05a, var(--amber-500)); }
.progress-danger > i { background: linear-gradient(90deg, #cc6a5f, var(--danger-600)); }
.progress-soft > i { background: var(--ink-300); }

.meter-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: var(--gap-2) var(--gap-4);
}

.meter-label {
  font-size: 12.5px;
  color: var(--ink-700);
}

.meter-value {
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-600);
}

.meter-row .progress {
  grid-column: 1 / -1;
}

/* Segmented progress (mastery breakdown) — no borders on filled marks */

.stacked-bar {
  display: flex;
  height: 8px;
  border-radius: var(--r-full);
  overflow: hidden;
  background: rgba(20, 22, 27, 0.06);
  gap: 2px;
}

.stacked-bar > i {
  display: block;
  height: 100%;
  transition: width 620ms var(--ease-out);
}

.stacked-bar > i:first-child { border-radius: var(--r-full) 0 0 var(--r-full); }
.stacked-bar > i:last-child { border-radius: 0 var(--r-full) var(--r-full) 0; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: var(--fs-micro);
  color: var(--ink-500);
}

.swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex: none;
}

/* --------------------------------------------------------------------------
   Table
   -------------------------------------------------------------------------- */

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.table {
  min-width: 640px;
  font-size: 13px;
}

.table th {
  text-align: left;
  font-size: var(--fs-micro);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-400);
  padding: 0 var(--gap-4) 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.table td {
  padding: 13px var(--gap-4);
  border-bottom: 1px solid var(--line);
  color: var(--ink-700);
  vertical-align: middle;
}

.table tbody tr {
  transition: background var(--t-fast) var(--ease-out);
}

.table tbody tr:hover {
  background: rgba(20, 22, 27, 0.022);
}

.table tbody tr.is-selected {
  background: rgba(18, 140, 122, 0.045);
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.table .cell-strong {
  color: var(--ink-900);
  font-weight: 500;
}

.table .num,
.table .end {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.table .tight {
  padding-top: 9px;
  padding-bottom: 9px;
}

.table-flush th:first-child,
.table-flush td:first-child {
  padding-left: var(--gap-5);
}

.table-flush th:last-child,
.table-flush td:last-child {
  padding-right: var(--gap-5);
}

/* --------------------------------------------------------------------------
   Menu / dropdown
   -------------------------------------------------------------------------- */

.menu {
  position: absolute;
  z-index: 50;
  min-width: 194px;
  padding: 5px;
  border-radius: var(--r-lg);
  border: 1px solid var(--line-2);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  box-shadow: var(--sh-4);
  animation: menu-in 160ms var(--ease-out);
}

@keyframes menu-in {
  from { opacity: 0; transform: translateY(-4px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 9px;
  border-radius: var(--r-sm);
  font-size: 13px;
  color: var(--ink-700);
  text-align: left;
  transition: background var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out);
}

.menu-item:hover {
  background: rgba(20, 22, 27, 0.055);
  color: var(--ink-900);
}

.menu-item .ic {
  color: var(--ink-400);
}

.menu-item:hover .ic {
  color: var(--ink-600);
}

.menu-item-danger {
  color: var(--danger-600);
}

.menu-item-danger:hover {
  background: var(--danger-100);
  color: var(--danger-600);
}

.menu-item-danger .ic {
  color: currentColor;
}

.menu-label {
  padding: 7px 9px 5px;
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-300);
}

.menu-sep {
  height: 1px;
  margin: 5px 4px;
  background: var(--line);
}

.menu-meta {
  margin-left: auto;
  font-size: var(--fs-micro);
  color: var(--ink-400);
}

/* --------------------------------------------------------------------------
   Modal / drawer / sheet
   -------------------------------------------------------------------------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--gap-5);
  background: rgba(18, 20, 24, 0.34);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: fade-in 180ms var(--ease-out);
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  border-radius: var(--r-2xl);
  border: 1px solid var(--line-2);
  background: var(--surface-solid);
  box-shadow: var(--sh-4);
  animation: modal-in 220ms var(--ease-out);
  overflow: hidden;
}

.modal-lg { max-width: 640px; }
.modal-xl { max-width: min(1080px, 94vw); }   /* 放视频用：屏幕越宽越大，手机上仍是一整屏 */
.modal-sm { max-width: 400px; }

/* 弹窗标题栏右侧的操作区（全屏 + 关闭） */
.modal-head-tools {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: none;
}

/* 全屏：真全屏（:fullscreen）与退化模式（铺满窗口）都铺满、圆角去掉；
   背景用不透明白底，避免透出后面的灰色。 */
.modal:fullscreen,
.modal.is-fullpage {
  max-width: none;
  width: 100vw;
  height: 100vh;
  max-height: 100vh;
  border-radius: 0;
  border: 0;
  background: var(--surface-solid, #fff);
}

.modal:fullscreen .modal-body,
.modal.is-fullpage .modal-body {
  max-height: none;
}

body.modal-fullpage-lock {
  overflow: hidden;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--gap-4);
  padding: var(--gap-5) var(--gap-5) var(--gap-4);
  border-bottom: 1px solid var(--line);
}

.modal-body {
  padding: var(--gap-5);
  overflow-y: auto;
}

.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--gap-3);
  padding: var(--gap-4) var(--gap-5);
  border-top: 1px solid var(--line);
  background: var(--surface-sunken);
}

.drawer-scrim {
  position: fixed;
  inset: 0;
  z-index: var(--z-drawer);
  background: rgba(18, 20, 24, 0.28);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation: fade-in 180ms var(--ease-out);
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: calc(var(--z-drawer) + 1);
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  background: var(--surface-solid);
  border-left: 1px solid var(--line-2);
  box-shadow: var(--sh-4);
  animation: drawer-in 260ms var(--ease-out);
}

@keyframes drawer-in {
  from { transform: translateX(24px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap-3);
  padding: var(--gap-4) var(--gap-5);
  border-bottom: 1px solid var(--line);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--gap-5);
}

.drawer-foot {
  display: flex;
  align-items: center;
  gap: var(--gap-3);
  padding: var(--gap-4) var(--gap-5);
  border-top: 1px solid var(--line);
  background: var(--surface-sunken);
}

/* --------------------------------------------------------------------------
   Toast
   -------------------------------------------------------------------------- */

.toast-layer {
  position: fixed;
  z-index: var(--z-toast);
  right: var(--gap-5);
  bottom: var(--gap-5);
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 380px;
  padding: 11px 14px;
  border-radius: var(--r-lg);
  background: rgba(19, 21, 25, 0.94);
  backdrop-filter: blur(10px);
  color: rgba(255, 255, 255, 0.92);
  font-size: 12.5px;
  box-shadow: var(--sh-4);
  animation: toast-in 240ms var(--ease-out);
}

.toast.is-out {
  animation: toast-out 200ms var(--ease-out) forwards;
}

.toast .ic {
  color: rgba(255, 255, 255, 0.75);
}

.toast .toast-title {
  color: #fff;
  font-weight: 500;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

@keyframes toast-out {
  to { opacity: 0; transform: translateY(4px); }
}

/* --------------------------------------------------------------------------
   超前学收获动画（views/cheer.js · 数学 / 语文 / 英语共用）

   用户 2026-10-09：练的内容是学校还没讲到的时候，关掉答题报告要给一段鼓励动画，
   数字从小滚到「已经超越同学 N 个知识点」。主角是**用户自己给的兔子动画**
   （assets/media/cheer-rabbit.mp4，白底视频靠 multiply 融进卡片，与学习陪伴小萌宠同一招），
   文字只留一行小字 + 一个大数字 + 一条小胶囊（用户口径：字少一点、要激动人心）。
   -------------------------------------------------------------------------- */

.cheer-overlay {
  /* 比练习弹窗高一层：练习弹窗先关，这段动画后出来 */
  z-index: var(--z-toast);
  cursor: pointer;          /* 点哪儿都能关（奖励不该拦路） */
}

.cheer-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  padding: 16px 20px 20px;
  border-radius: var(--r-2xl);
  border: 1px solid var(--line-2);
  background: linear-gradient(180deg, var(--white) 0%, var(--brand-50) 100%);
  box-shadow: var(--sh-4);
  text-align: center;
  animation: cheer-card-in 420ms var(--ease-out);
}

@keyframes cheer-card-in {
  0% { opacity: 0; transform: translateY(14px) scale(0.9); }
  58% { opacity: 1; transform: translateY(0) scale(1.012); }
  100% { opacity: 1; transform: none; }
}

/* 用户给的兔子动画（4.1 秒、1280×720）：铺满卡片宽度，白底靠 multiply 融进卡片底色 */
.cheer-video {
  display: block;
  width: 100%;
  /* 原视频 16:9、兔子在中景，四周留白多 —— 裁成 4:3 让主角更大更带感（只裁左右，不会切到兔子） */
  aspect-ratio: 4 / 3;
  object-fit: cover;
  object-position: center 46%;
  border-radius: var(--r-xl);
  mix-blend-mode: multiply;
  pointer-events: none;      /* 点视频 = 点蒙层，直接关掉 */
  animation: cheer-video-in 640ms var(--ease-out) 40ms backwards;
}

@keyframes cheer-video-in {
  0% { opacity: 0; transform: scale(0.86); }
  100% { opacity: 1; transform: none; }
}

.cheer-line {
  margin-top: 2px;
  font-size: var(--fs-xs);
  letter-spacing: 0.01em;
  color: var(--ink-500);
}

.cheer-metric {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  margin-top: 2px;
}

.cheer-num {
  font-size: 52px;
  line-height: 1.06;
  font-weight: 750;
  letter-spacing: -0.035em;
  color: var(--brand-700);
  font-variant-numeric: tabular-nums;
}

.cheer-num.is-pop {
  animation: cheer-num-pop 340ms var(--ease-out);
}

@keyframes cheer-num-pop {
  0% { transform: scale(1); }
  42% { transform: scale(1.11); }
  100% { transform: scale(1); }
}

.cheer-unit {
  font-size: 14px;
  color: var(--ink-600);
}

.cheer-delta {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 10px;
  padding: 4px 11px;
  border-radius: var(--r-full);
  background: var(--brand-100);
  color: var(--brand-700);
  font-size: var(--fs-xs);
  font-weight: 600;
  animation: cheer-card-in 300ms var(--ease-out) 760ms backwards;
}

.cheer-card > .btn {
  width: 100%;
  justify-content: center;
  margin-top: 16px;
}

@media (prefers-reduced-motion: reduce) {
  .cheer-card,
  .cheer-video,
  .cheer-delta,
  .cheer-num.is-pop {
    animation: none;
  }
}

/* ==========================================================================
   手机端（≤640px）：弹窗与控件铺满宽度，手指点得准
   （用户 2026-10-10：手机上「立即练习」这类弹窗也是乱的）
   ========================================================================== */
@media (max-width: 640px) {
  .overlay {
    padding: 10px;
  }

  .modal {
    max-width: none;
    border-radius: var(--r-xl);
  }

  .modal-head {
    padding: 14px 14px 10px;
  }

  .modal-body {
    padding: 14px;
  }

  .modal-foot {
    flex-wrap: wrap;
    justify-content: stretch;
    gap: 8px;
    padding: 12px 14px;
  }

  .modal-foot .btn {
    flex: 1 1 40%;
    justify-content: center;
  }

  /* 题目选项：竖排整行（原来是一排小药丸，手机上容易点错） */
  .q-options {
    flex-direction: column;
    align-items: stretch;
  }

  .q-opt {
    width: 100%;
    justify-content: flex-start;
    border-radius: var(--r-md);
    padding: 10px 12px;
  }

  /* 分段控件（AI创造的功能页签、明细筛选…）允许折行，别撑破页面 */
  .segmented {
    flex-wrap: wrap;
  }

  .segmented button {
    flex: 1 1 auto;
    justify-content: center;
  }

  /* 长表格一律在容器里横向滑动 */
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* --------------------------------------------------------------------------
   Tooltip
   -------------------------------------------------------------------------- */

[data-tip] {
  position: relative;
}

[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(2px);
  padding: 5px 9px;
  border-radius: var(--r-sm);
  background: rgba(19, 21, 25, 0.95);
  color: rgba(255, 255, 255, 0.92);
  font-size: var(--fs-micro);
  font-weight: 400;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-out);
  z-index: 60;
}

[data-tip]:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

[data-tip-align="right"]::after {
  left: auto;
  right: 0;
  transform: translateY(2px);
}

[data-tip-align="right"]:hover::after {
  transform: translateY(0);
}

/* --------------------------------------------------------------------------
   Misc
   -------------------------------------------------------------------------- */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--gap-3);
  padding: var(--gap-12) var(--gap-5);
  text-align: center;
}

.empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: var(--surface-sunken);
  color: var(--ink-400);
}

.skeleton {
  border-radius: var(--r-sm);
  background: linear-gradient(90deg, rgba(20,22,27,.05), rgba(20,22,27,.09), rgba(20,22,27,.05));
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}

@keyframes shimmer {
  to { background-position: -200% 0; }
}

.pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.kv {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--gap-4);
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
}

.kv:last-child { border-bottom: 0; }
.kv dt { color: var(--ink-500); }
.kv dd { margin: 0; color: var(--ink-900); font-weight: 500; }

.dotlist {
  display: flex;
  flex-direction: column;
}

.dotlist li {
  position: relative;
  display: flex;
  gap: var(--gap-3);
  padding-bottom: var(--gap-5);
}

.dotlist li::before {
  content: "";
  position: absolute;
  left: 4.5px;
  top: 14px;
  bottom: 2px;
  width: 1px;
  background: var(--line-2);
}

.dotlist li:last-child {
  padding-bottom: 0;
}

.dotlist li:last-child::before {
  display: none;
}

.dotlist .bullet {
  position: relative;
  z-index: 1;
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 50%;
  border: 1.5px solid var(--line-3);
  background: var(--surface-solid);
  flex: none;
}

.dotlist .bullet.is-brand {
  border-color: var(--brand-500);
  background: var(--brand-100);
}

.dotlist .bullet.is-amber {
  border-color: var(--amber-500);
  background: var(--amber-100);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap-2) var(--gap-4);
  font-size: var(--fs-micro);
  color: var(--ink-400);
}

.tag-list li {
  display: flex;
  align-items: center;
  gap: 6px;
}
/* Child switcher (family with more than one student) */

.child-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 8px 0 6px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.68);
  transition: border-color var(--t-fast) var(--ease-out), background var(--t-fast) var(--ease-out);
}

.child-switch:hover {
  background: var(--white);
  border-color: var(--line-2);
}

.child-switch-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.15;
}

.child-switch-name {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-900);
}

.child-switch-grade {
  font-size: 10.5px;
  color: var(--ink-400);
}

/* 在线练习：一道题一行（AI 出题，可能带内联 SVG 的图） */
.q-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--paper);
}

.q-row + .q-row {
  margin-top: 10px;
}

.q-row.is-right {
  border-color: color-mix(in srgb, var(--brand-500) 45%, var(--line));
  background: color-mix(in srgb, var(--brand-500) 6%, var(--paper));
}

.q-row.is-wrong {
  border-color: color-mix(in srgb, #d9534f 45%, var(--line));
  background: color-mix(in srgb, #d9534f 5%, var(--paper));
}

.q-no {
  flex: 0 0 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--ink-50, #f1efeb);
  color: var(--ink-700);
  font-size: 11.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.q-text {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--ink-900);
  white-space: pre-wrap;   /* 题干里可能带换行（多行填空、竖式），保留换行 */
}

/* AI 出的图形题：白底内联 SVG，居中显示 */
.q-figure {
  margin-top: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: #fff;
  display: flex;
  justify-content: center;
}

.q-figure svg {
  max-width: 100%;
  height: auto;
}

/* 选择题 / 判断题：可点的选项按钮（不是输入框） */
.q-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.q-opt {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-800);
  font-size: 13px;
  line-height: 1.2;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.q-opt:hover:not(:disabled) {
  border-color: var(--brand-400, #7fb2a6);
  background: color-mix(in srgb, var(--brand-500) 7%, var(--surface));
}

.q-opt:disabled {
  cursor: default;
}

.q-opt-key {
  font-weight: 700;
  font-size: 12.5px;
  color: var(--ink-500);
}

.q-opt.is-picked {
  border-color: var(--brand-500);
  background: color-mix(in srgb, var(--brand-500) 14%, var(--surface));
  color: var(--ink-900);
  font-weight: 600;
}

.q-opt.is-picked .q-opt-key {
  color: var(--brand-700, #0b5f52);
}

.q-opt.is-right {
  border-color: var(--brand-500);
  background: color-mix(in srgb, var(--brand-500) 18%, var(--surface));
  color: var(--ink-900);
  font-weight: 600;
}

.q-opt.is-wrong {
  border-color: #d9534f;
  background: color-mix(in srgb, #d9534f 12%, var(--surface));
  color: #8d2b28;
  text-decoration: line-through;
}

.q-opt.q-judge {
  min-width: 92px;
  justify-content: center;
  font-size: 13.5px;
  font-weight: 600;
}

@media (max-width: 640px) {
  .child-switch-grade {
    display: none;
  }
}

/* --------------------------------------------------------------------------
   答题报告（立即练习交卷后 / 学科 › 练习记录 里看同一条）
   结构：顶部成绩条 + 几个分区（做得好的地方 / 知识点掌握 / 错题与原因 / 下一步）
   -------------------------------------------------------------------------- */

.rp {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.rp-head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  border-radius: var(--r-xl);
  border: 1px solid var(--line);
  background: var(--surface-sunken);
}

.rp-rate {
  flex: none;
  width: 96px;
  text-align: center;
  font-size: 34px;
  font-weight: 700;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  color: var(--brand-700);
}

.rp-rate span {
  font-size: 16px;
  margin-left: 2px;
}

.rp-rate.is-amber { color: var(--amber-700, #a76d16); }
.rp-rate.is-danger { color: var(--danger-600); }

.rp-rate .micro {
  margin-top: 4px;
  font-weight: 400;
  color: var(--ink-400);
}

.rp-cheer {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--brand-50, #eef7f5);
  color: var(--brand-700);
  font-size: 12.5px;
}

.rp-block {
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 14px 16px;
  background: var(--white);
}

.rp-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-800);
  margin-bottom: 10px;
}

.rp-list {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--ink-700);
}

.rp-steps {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13.5px;
  line-height: 1.8;
  color: var(--ink-800);
}

.rp-kp,
.rp-wrong {
  padding: 11px 12px;
  border-radius: var(--r-lg);
  background: var(--surface-sunken);
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--ink-800);
}

.rp-kp + .rp-kp,
.rp-wrong + .rp-wrong {
  margin-top: 8px;
}

.rp-wrong {
  border-left: 3px solid var(--danger-600);
}

.rp-foot {
  padding-top: 2px;
  color: var(--ink-400);
}

/* --------------------------------------------------------------------------
   练习记录列表（学科 › 练习记录）
   -------------------------------------------------------------------------- */

.pl-table {
  display: flex;
  flex-direction: column;
}

.pl-row {
  display: grid;
  grid-template-columns: 104px 84px 100px minmax(0, 1fr) 62px 74px 82px 92px;
  align-items: center;
  gap: 10px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-800);
}

.pl-row.pl-head {
  border-bottom: 1px solid var(--line-2);
  font-size: 12px;
  color: var(--ink-400);
  font-weight: 600;
}

.pl-row:not(.pl-head):hover {
  background: var(--surface-sunken);
}

@media (max-width: 720px) {
  .pl-row {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 12px 4px;
  }

  .pl-row.pl-head {
    display: none;
  }
}
