/* ===== CSS Variables ===== */
:root {
  --primary: #7C3AED;
  --primary-light: #A78BFA;
  --primary-dark: #5B21B6;
  --accent: #F59E0B;
  --bg: #0F0F1A;
  --bg-card: #1A1A2E;
  --bg-input: #252540;
  --text: #F1F1F6;
  --text-dim: #9CA3AF;
  --border: #2D2D4A;
  --success: #10B981;
  --danger: #EF4444;
  --radius: 12px;
  --radius-sm: 8px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary-light); text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; border: none; outline: none; }
input, textarea { font-family: inherit; outline: none; }

/* ===== Utilities ===== */
.container { max-width: 420px; margin: 0 auto; padding: 0 16px; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.text-dim { color: var(--text-dim); }
.text-sm { font-size: 13px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }

/* ===== Buttons ===== */
.btn {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 48px;
  border-radius: var(--radius);
  font-size: 16px; font-weight: 600;
  transition: all 0.2s;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.4);
}
.btn-primary:active { transform: scale(0.97); opacity: 0.9; }
.btn-primary:disabled {
  background: var(--bg-input);
  box-shadow: none;
  color: var(--text-dim);
  cursor: not-allowed;
}
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--primary);
  color: var(--primary-light);
}
.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  font-weight: 400;
}
.btn-sm { height: 36px; font-size: 14px; border-radius: var(--radius-sm); }

/* ===== Cards ===== */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  border: 1px solid var(--border);
}

/* ===== Input ===== */
.input-group { margin-bottom: 16px; }
.input-group label {
  display: block; font-size: 13px; color: var(--text-dim);
  margin-bottom: 6px;
}
.input-field {
  width: 100%; height: 48px;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 14px;
  color: var(--text);
  font-size: 15px;
  transition: border-color 0.2s;
}
.input-field:focus { border-color: var(--primary); }
.input-field::placeholder { color: #6B7280; }
textarea.input-field {
  height: auto; min-height: 120px;
  padding: 12px 14px; resize: vertical;
  line-height: 1.6;
}

/* ===== Tags ===== */
.tag-group { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  background: var(--bg-input);
  color: var(--text-dim);
  border: 1px solid var(--border);
  transition: all 0.2s;
}
.tag.active {
  background: rgba(124, 58, 237, 0.2);
  color: var(--primary-light);
  border-color: var(--primary);
}

/* ===== Header ===== */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 0;
  position: sticky; top: 0;
  background: var(--bg);
  z-index: 100;
}
.page-header h1 { font-size: 20px; font-weight: 700; }
.back-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-card);
  border-radius: 50%;
  color: var(--text);
  font-size: 18px;
}

/* ===== Loading ===== */
.loading-spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Toast ===== */
.toast {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  background: var(--bg-card);
  color: var(--text);
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 14px;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.toast.show { opacity: 1; }

/* ===== Bottom Nav ===== */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: calc(56px + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 100;
}
.nav-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: var(--text-dim);
  font-size: 11px;
  gap: 3px;
  transition: color 0.2s;
}
.nav-item.active { color: var(--primary-light); }
.nav-icon { font-size: 22px; }

/* ===== Page transition ===== */
.page-enter {
  animation: pageIn 0.25s ease-out;
}
@keyframes pageIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}
