:root {
  --primary: #4f6ef7;
  --primary-dark: #3d57d4;
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #1a1d26;
  --muted: #6b7280;
  --success: #10b981;
  --danger: #ef4444;
  --border: #e5e7eb;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(79, 110, 247, 0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC',
    'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

#app {
  min-height: 100vh;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

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

.btn-primary {
  background: var(--primary);
  color: #fff;
  width: 100%;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--primary);
  color: var(--primary);
}

.btn-danger {
  background: #fee2e2;
  color: var(--danger);
  padding: 8px 12px;
  font-size: 13px;
}

.input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 16px;
  outline: none;
  background: #fff;
}

.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 110, 247, 0.15);
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}

.page {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: 88px;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 16px;
}

.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-bottom: 16px;
  padding-bottom: 4px;
}

.tab {
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 13px;
  background: #fff;
  border: 1px solid var(--border);
  cursor: pointer;
  color: var(--muted);
}

.tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.nav-bottom {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  z-index: 100;
}

/* iOS 壳：底部原生服务器栏占位，避免与 H5 底栏重叠 */
html.wordloop-ios-app {
  --ios-server-bar: 40px;
}

html.wordloop-ios-app .page {
  padding-bottom: calc(88px + var(--ios-server-bar));
}

html.wordloop-ios-app .nav-bottom {
  bottom: var(--ios-server-bar);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 10px;
  color: var(--muted);
  padding: 4px 6px;
  text-decoration: none;
  min-width: 0;
  flex: 1;
}

.nav-item.router-link-active {
  color: var(--primary);
  font-weight: 600;
}

.nav-icon {
  font-size: 20px;
  margin-bottom: 2px;
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
  box-shadow: var(--shadow);
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
}

.stat-label {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}

.badge-new { background: #dbeafe; color: #1d4ed8; }
.badge-learning { background: #fef3c7; color: #b45309; }
.badge-mastered { background: #d1fae5; color: #047857; }
.badge-weak { background: #fee2e2; color: #b91c1c; }

.message {
  padding: 10px 14px;
  border-radius: var(--radius);
  margin-bottom: 12px;
  font-size: 14px;
}

.message.error {
  background: #fee2e2;
  color: var(--danger);
}

.message.success {
  background: #d1fae5;
  color: #047857;
}

.message.warning {
  background: #fef3c7;
  color: #b45309;
}
