/* =========================================================
   全站统一导航、科目切换与练习数据看板 (connected.css)
   ========================================================= */

/* 全局顶部导航条 */
.global-header {
  position: sticky;
  top: 0;
  z-index: 70;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 6px 16px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid #E5E7EB;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI", sans-serif;
  box-sizing: border-box;
}

.global-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: #111827;
  font-size: 15px;
  font-weight: 750;
  letter-spacing: -0.3px;
  min-height: 38px;
  white-space: nowrap;
}

.global-brand b {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #111827;
  color: #FFFFFF;
  font-size: 13px;
  font-weight: 750;
  box-shadow: 0 2px 6px rgba(17, 24, 39, 0.15);
}

.subject-picker {
  min-height: 32px;
  max-width: 55%;
  padding: 0 12px;
  border: 1px solid #E2E8F0;
  border-radius: 99px;
  background: #F1F3F7;
  color: #1E293B;
  font: 600 12.5px/1.4 -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.subject-picker:active {
  background: #E5E7EB;
  transform: scale(0.97);
}

.app, .tabbar {
  max-width: 480px;
}

.appbar {
  top: 52px;
}

/* 科目抽屉 (底部弹窗) */
.subject-drawer {
  position: fixed;
  inset: auto 0 0;
  margin: 0 auto;
  width: 100%;
  max-width: 480px;
  max-height: 85dvh;
  border: 1px solid #E5E7EB;
  border-bottom: 0;
  border-radius: 24px 24px 0 0;
  padding: 22px 20px calc(22px + env(safe-area-inset-bottom));
  background: #FFFFFF;
  color: #111827;
  box-sizing: border-box;
  overflow: auto;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI", sans-serif;
  box-shadow: 0 -20px 48px -12px rgba(15, 23, 42, 0.25);
}

.subject-drawer::backdrop {
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.drawer-head h2 {
  font-size: 19px;
  font-weight: 750;
  margin: 0;
  color: #111827;
}

.drawer-close {
  position: static;
  border: 0;
  background: #F1F5F9;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 20px;
  line-height: 1;
  color: #64748B;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.15s;
}

.drawer-close:active {
  background: #E2E8F0;
}

.drawer-hint {
  font-size: 12.5px;
  color: #6B7280;
  line-height: 1.5;
  margin: 0 0 16px;
}

.drawer-tracks {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  background: #F1F5F9;
  padding: 4px;
  border-radius: 12px;
}

.drawer-tracks button {
  flex: 1;
  min-height: 38px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #64748B;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.15s ease;
}

.drawer-tracks button[aria-pressed="true"] {
  background: #FFFFFF;
  color: #0F172A;
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08);
}

.drawer-modules {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.drawer-module {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  text-align: left;
  gap: 5px;
  min-height: 74px;
  padding: 12px 14px;
  border: 1px solid #E2E8F0;
  background: #FFFFFF;
  border-radius: 14px;
  font-size: 14.5px;
  font-weight: 650;
  color: #111827;
  cursor: pointer;
  transition: all 0.15s ease;
}

.drawer-module:active {
  transform: scale(0.98);
  background: #F8FAFC;
}

.drawer-module small {
  font-size: 11.5px;
  color: #6B7280;
  font-weight: 500;
  font-family: ui-monospace, SFMono-Regular, monospace;
}

.drawer-module[aria-current] {
  border-color: #059669;
  background: #F0FDF4;
}

.drawer-module[aria-current] span {
  color: #065F46;
  font-weight: 750;
}

.drawer-module[aria-current] small {
  color: #059669;
  font-weight: 600;
}

.drawer-status {
  font-size: 12.5px;
  line-height: 1.6;
  color: #6B7280;
  margin: 12px 0 6px;
}

.drawer-status:empty {
  display: none;
}

.drawer-home {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 44px;
  margin-top: 16px;
  text-decoration: none;
  color: #374151;
  background: #F1F5F9;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 600;
  transition: all 0.15s;
}

.drawer-home:active {
  background: #E2E8F0;
}

/* 首页练习数据看板 */
.practice-dashboard {
  background: #FFFFFF;
  border: 1px solid #E5E7EB;
  border-radius: 18px;
  padding: 16px;
  margin: 16px 0 18px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.dashboard-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
}

.dashboard-heading h2 {
  font-size: 16.5px;
  font-weight: 750;
  margin: 0;
  color: #111827;
  letter-spacing: -0.2px;
}

.today-stat {
  font-size: 11.5px;
  font-weight: 600;
  color: #059669;
  background: #ECFDF5;
  border: 1px solid #A7F3D0;
  border-radius: 99px;
  padding: 3px 9px;
  font-family: ui-monospace, SFMono-Regular, monospace;
  white-space: nowrap;
}

.data-filters {
  display: flex;
  background: #F1F5F9;
  border-radius: 10px;
  padding: 3px;
  gap: 3px;
  margin-bottom: 14px;
}

.data-filters button {
  flex: 1;
  border: 0;
  border-radius: 8px;
  min-height: 34px;
  background: transparent;
  color: #64748B;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.data-filters button[aria-pressed="true"] {
  color: #0F172A;
  background: #FFFFFF;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.data-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.data-metric {
  background: #F8FAFC;
  border: 1px solid #EDF2F7;
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.data-metric b {
  font-size: 24px;
  line-height: 1.15;
  color: #111827;
  font-weight: 800;
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-variant-numeric: tabular-nums;
}

.data-metric span {
  font-size: 11.5px;
  color: #6B7280;
  font-weight: 500;
}

.data-metric[data-stat="accuracy"] b {
  color: #059669;
}

.module-data {
  margin-top: 14px;
  border-top: 1px solid #F1F5F9;
  padding-top: 4px;
}

.module-data summary {
  min-height: 38px;
  font-size: 13px;
  font-weight: 650;
  color: #374151;
  cursor: pointer;
  display: list-item;
  padding-top: 8px;
}

.module-stat-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 6px 0;
}

.module-stat-row {
  display: flex;
  flex-direction: column;
  gap: 7px;
  width: 100%;
  text-align: left;
  padding: 11px 12px;
  border: 1px solid #EDF2F7;
  background: #F8FAFC;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.module-stat-row:active {
  background: #F1F5F9;
}

.module-stat-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.module-stat-heading b {
  font-size: 13.5px;
  font-weight: 700;
  color: #111827;
}

.module-stat-heading > span {
  font-size: 11.5px;
  color: #6B7280;
  font-family: ui-monospace, SFMono-Regular, monospace;
}

.module-stat-bar {
  display: block;
  width: 100%;
  height: 4px;
  background: #E2E8F0;
  border-radius: 99px;
  overflow: hidden;
}

.module-stat-bar > span {
  display: block;
  height: 100%;
  background: #111827;
  border-radius: 99px;
}

.module-stat-row small {
  font-size: 11px;
  color: #94A3B8;
  line-height: 1.5;
  font-family: ui-monospace, SFMono-Regular, monospace;
}

.data-explanation {
  font-size: 11.5px;
  line-height: 1.6;
  color: #94A3B8;
  margin: 8px 0 0;
}

/* 接着上次学 (Recent) */
.recent-learning {
  margin: 18px 0;
}

.recent-learning h2 {
  font-size: 16.5px;
  font-weight: 750;
  margin-bottom: 10px;
  color: #111827;
}

.recent-module, .resume-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 13px 15px;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 14px;
  min-height: 68px;
  text-align: left;
  color: #111827;
  cursor: pointer;
  margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03);
  transition: all 0.15s ease;
}

.recent-module:active, .resume-card:active {
  transform: scale(0.985);
  background: #F8FAFC;
}

.recent-module b, .resume-card b {
  display: block;
  font-size: 14.5px;
  font-weight: 700;
  color: #111827;
}

.recent-module small, .resume-card small {
  display: block;
  font-size: 11.5px;
  color: #6B7280;
  margin-top: 3px;
  font-family: ui-monospace, SFMono-Regular, monospace;
}

.recent-module > span:last-child, .resume-card > span:last-child {
  white-space: nowrap;
  font-size: 12px;
  font-weight: 650;
  color: #059669;
  background: #ECFDF5;
  border: 1px solid #A7F3D0;
  border-radius: 99px;
  padding: 4px 10px;
}

.subject-drawer button:focus-visible, .subject-picker:focus-visible {
  outline: 2px solid #111827;
  outline-offset: 2px;
}

@media (max-width: 350px) {
  .global-header {
    gap: 7px;
    padding: 6px 12px;
  }
  .global-brand {
    font-size: 14px;
  }
  .subject-picker {
    font-size: 11.5px;
    padding: 0 8px;
  }
  .drawer-modules {
    grid-template-columns: 1fr 1fr;
  }
  .practice-dashboard {
    padding: 12px;
  }
}
