/* ================================================================
   考试急 PWA — Layout v3.0
   页面容器、导航栏、TabBar、网格背景
   原则：纯色分层建立深度，不用毛玻璃
   ================================================================ */

/* ================================================================
   背景纹理 — 微妙噪点替代网格线
   ================================================================ */

body::before {
  content: '';
  position: fixed;
  inset: 0;
  /* 2×2 像素的噪点 SVG，仅 3% 透明度 — 给深色背景带来纸张般的质感 */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4'%3E%3Crect width='1' height='1' x='0' y='0' fill='rgba(255,255,255,0.35)'/%3E%3Crect width='1' height='1' x='2' y='2' fill='rgba(255,255,255,0.25)'/%3E%3C/svg%3E");
  background-size: 4px 4px;
  opacity: 0.03;
  pointer-events: none;
  z-index: 0;
}

/* ================================================================
   App 容器
   ================================================================ */

#app {
  position: relative;
  z-index: 1;
  min-height: calc(100vh - var(--nav-height));
  min-height: calc(100dvh - var(--nav-height));
  padding-bottom: var(--nav-height);
}

/* ================================================================
   顶部导航栏 — 纯色背景 + 底部细线
   ================================================================ */

.navbar {
  position: sticky;
  top: 0;
  background: var(--ink-base);
  padding: var(--space-sm) var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  z-index: 100;
  border-bottom: 1px solid var(--border-subtle);
  height: 52px;
}

.navbar-title {
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  color: var(--text);
  flex: 1;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.navbar-back {
  font-size: var(--text-sm);
  color: var(--amber);
  cursor: pointer;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  font-weight: var(--weight-medium);
  transition: background var(--duration-fast) var(--ease-default);
  flex-shrink: 0;
  white-space: nowrap;
}

.navbar-back:active {
  background: var(--amber-dim);
}

/* 导航栏右侧占位 (保持标题居中) */
.navbar-spacer {
  width: 48px;
  flex-shrink: 0;
}

/* ================================================================
   底部 Tab 栏 — 纯色 + 顶部细线
   ================================================================ */

.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  height: var(--nav-height);
  background: var(--ink-base);
  display: flex;
  border-top: 1px solid var(--border-subtle);
  z-index: 100;
}

.tabbar-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  font-size: var(--text-xs);
  gap: 2px;
  transition: color var(--duration-fast) var(--ease-default);
  position: relative;
}

.tabbar-item.active {
  color: var(--amber);
}

.tabbar-item.active::after {
  content: '';
  position: absolute;
  top: -1px;
  left: 30%;
  right: 30%;
  height: 2px;
  border-radius: 0 0 2px 2px;
  background: var(--amber);
}

.tabbar-item .tab-icon {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tabbar-item .tab-icon svg {
  width: 22px;
  height: 22px;
}

/* 向后兼容 — JS 中仍使用 .icon */
.tabbar-item .icon {
  font-size: 22px;
  transition: transform var(--duration-fast) var(--ease-default);
}
.tabbar-item:active .icon {
  transform: scale(1.1);
}

/* ================================================================
   页面内容区
   ================================================================ */

.page-content {
  padding: var(--space-md);
}

/* ================================================================
   空状态 — 居中占位
   ================================================================ */

.empty-state {
  text-align: center;
  padding: var(--space-2xl) var(--space-lg);
  color: var(--text-secondary);
}

.empty-state .empty-icon {
  display: block;
  margin: 0 auto var(--space-md);
  color: var(--text-muted);
}

.empty-state .empty-title {
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  color: var(--text);
  margin-bottom: var(--space-xs);
}

.empty-state .empty-desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  max-width: 280px;
  margin: 0 auto;
}

/* ================================================================
   进度条 — 纯色填充
   ================================================================ */

.progress-wrap {
  text-align: center;
  padding: var(--space-2xl) var(--space-lg);
  max-width: 400px;
  margin: 0 auto;
}

.progress-bar {
  width: 100%;
  height: 4px;
  background: var(--border-subtle);
  border-radius: 2px;
  overflow: hidden;
  margin: var(--space-lg) 0 0 0;
}

.progress-fill {
  height: 100%;
  background: var(--amber);
  border-radius: 2px;
  width: 0%;
  transition: width var(--duration-slow) var(--ease-decelerate);
}

.progress-info {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: var(--space-sm);
}

.progress-text {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin: 0;
}

.progress-pct {
  font-size: var(--text-xl);
  font-weight: var(--weight-black);
  color: var(--amber);
}

.progress-stage {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--space-xs);
}

/* ================================================================
   响应式 — 平板及以上居中
   ================================================================ */

@media (min-width: 600px) {
  body {
    max-width: 600px;
    border-left: 1px solid var(--border-subtle);
    border-right: 1px solid var(--border-subtle);
  }
}

@media (min-width: 768px) {
  body {
    max-width: 760px;
  }

  .tabbar {
    max-width: 760px;
  }

  .navbar {
    padding: var(--space-sm) var(--space-xl);
  }

  .page-content {
    padding: var(--space-lg);
  }
}

@media (min-width: 1024px) {
  body {
    max-width: 900px;
  }

  .tabbar {
    max-width: 900px;
  }
}
