/* 全局样式：CSS 变量、布局、响应式 */
:root {
  --color-primary: #1677ff;
  --color-primary-dark: #0958d9;
  --color-primary-light: #e6f4ff;
  --color-accent: #52c41a;
  --color-warn: #fa8c16;
  --color-error: #ff4d4f;
  --color-text: #1f2328;
  --color-text-secondary: #57606a;
  --color-text-muted: #8c959f;
  --color-bg: #f5f7fa;
  --color-bg-card: #ffffff;
  --color-border: #e1e4e8;
  --color-border-light: #eef0f3;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;
  --space-2xl: 32px;
  --max-width: 960px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei',
               'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}

a {
  color: var(--color-primary);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

img { max-width: 100%; }

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

textarea, input[type="text"], select {
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: #fff;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea:focus, input[type="text"]:focus, select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(22,119,255,0.12);
}

textarea {
  min-height: 200px;
  resize: vertical;
  line-height: 1.7;
}

/* 顶部导航 */
.app-header {
  background: #fff;
  border-bottom: 1px solid var(--color-border);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 10;
  padding-top: calc(12px + env(safe-area-inset-top));
}
.app-header .back-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--color-bg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--color-text-secondary);
}
.app-header .back-btn:hover { background: var(--color-primary-light); color: var(--color-primary); }
.app-header h1 {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-header .subtitle {
  font-size: 13px;
  color: var(--color-text-muted);
  font-weight: 400;
  margin-left: 8px;
}

/* 主体容器 */
.app-main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-lg);
}

/* 主页 hero 区域 */
.home-hero {
  text-align: center;
  padding: 32px 16px 16px;
}
.home-hero h1 {
  font-size: 26px;
  margin: 0 0 6px;
  color: var(--color-text);
}
.home-hero p {
  margin: 0;
  color: var(--color-text-secondary);
  font-size: 14px;
}

/* 主分类卡片 */
.category-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 16px;
}
.category-card {
  background: var(--color-bg-card);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border-light);
}
.category-card .cat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.category-card .cat-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--color-primary-light);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.category-card.coming .cat-icon { background: #fff7e6; color: var(--color-warn); }
.category-card .cat-title {
  font-size: 17px;
  font-weight: 600;
  margin: 0;
}
.category-card .cat-desc {
  font-size: 13px;
  color: var(--color-text-muted);
  margin: 2px 0 0;
}

.module-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.module-list a {
  background: var(--color-bg);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--color-text);
  text-decoration: none;
  border: 1px solid transparent;
  transition: all .15s;
  font-size: 14px;
  min-height: 48px;
}
.module-list a:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  text-decoration: none;
}
.module-list a .m-icon {
  font-size: 18px;
  flex-shrink: 0;
}
.module-list a.disabled {
  color: var(--color-text-muted);
  background: #fafbfc;
  cursor: not-allowed;
}
.module-list a.disabled:hover {
  border-color: transparent;
  background: #fafbfc;
}
.module-list a .badge {
  margin-left: auto;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 10px;
  background: #fff7e6;
  color: var(--color-warn);
}

/* 通用面板 */
.panel {
  background: var(--color-bg-card);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
  border: 1px solid var(--color-border-light);
  box-shadow: var(--shadow-sm);
}
.panel h2 {
  font-size: 16px;
  margin: 0 0 12px;
}
.panel .hint {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-top: 4px;
}

/* 占位页 */
.coming-soon {
  text-align: center;
  padding: 80px 24px;
  color: var(--color-text-muted);
}
.coming-soon .icon {
  font-size: 48px;
  margin-bottom: 12px;
}
.coming-soon h2 {
  margin: 0 0 6px;
  color: var(--color-text-secondary);
  font-weight: 600;
}

/* 响应式 */
@media (min-width: 640px) {
  .home-hero h1 { font-size: 30px; }
  .category-grid {
    grid-template-columns: 1fr 1fr;
  }
  .app-main { padding: var(--space-xl); }
  textarea { min-height: 240px; }
}
