:root {
  --bg-primary: #07090e;
  --bg-secondary: #0f141c;
  --bg-card: #151b26;
  --bg-input: #1a2230;
  --border-gold: #c5a059;
  --border-gold-dim: rgba(197, 160, 89, 0.25);
  --gold-glow: rgba(197, 160, 89, 0.4);
  --gold-light: #f5d78e;
  --cyan-accent: #66fcf1;
  --cyan-dim: rgba(102, 252, 241, 0.2);
  --text-main: #f0f4f8;
  --text-muted: #8e9cae;
  --wood: #10b981;
  --fire: #f43f5e;
  --earth: #eab308;
  --metal: #f8fafc;
  --water: #38bdf8;
  --radius: 12px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang TC", "Noto Sans TC", sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  padding: 16px;
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(197, 160, 89, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(102, 252, 241, 0.04) 0%, transparent 40%);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding-bottom: 60px;
}

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-gold-dim);
  border-radius: var(--radius);
  margin-bottom: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.logo-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-icon {
  width: 44px;
  height: 44px;
}

.brand-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 1.5px;
  background: linear-gradient(135deg, #fff 0%, var(--gold-light) 50%, var(--border-gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-sub {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 20px;
  font-size: 12px;
  color: #34d399;
  font-weight: 600;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 8px #34d399;
}

/* Main Grid */
.main-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
}

@media (max-width: 900px) {
  .main-grid {
    grid-template-columns: 1fr;
  }
}

/* Cards */
.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-gold-dim);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--gold-light);
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-save-profile {
  padding: 6px 14px;
  background: rgba(197, 160, 89, 0.15);
  border: 1px solid var(--border-gold);
  border-radius: 8px;
  color: var(--gold-light);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn-save-profile:hover {
  background: rgba(197, 160, 89, 0.3);
  transform: translateY(-1px);
}

.btn-save-profile.saved {
  background: rgba(16, 185, 129, 0.2);
  border-color: #10b981;
  color: #34d399;
}

/* Profile Book */
.profile-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 480px;
  overflow-y: auto;
  padding-right: 4px;
}

.profile-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.profile-item:hover {
  background: #1c2433;
  border-color: var(--border-gold-dim);
  transform: translateX(2px);
}

.profile-item.active {
  background: linear-gradient(135deg, rgba(197, 160, 89, 0.15) 0%, rgba(102, 252, 241, 0.05) 100%);
  border-color: var(--border-gold);
  box-shadow: 0 0 12px rgba(197, 160, 89, 0.15);
}

.profile-name {
  font-weight: 600;
  font-size: 14px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.profile-info {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.profile-actions {
  display: flex;
  gap: 4px;
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  font-size: 13px;
  transition: all 0.2s;
}

.btn-icon:hover {
  color: #f43f5e;
  background: rgba(244, 63, 94, 0.1);
}

.btn-add-profile {
  width: 100%;
  padding: 10px;
  background: rgba(197, 160, 89, 0.1);
  border: 1px dashed var(--border-gold);
  border-radius: 10px;
  color: var(--gold-light);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn-add-profile:hover {
  background: rgba(197, 160, 89, 0.2);
}

/* Form Styles */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #cbd5e1;
  margin-bottom: 6px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #fff;
  font-size: 14px;
  transition: all 0.2s;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--border-gold);
  box-shadow: 0 0 8px var(--gold-glow);
}

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

.gender-toggle {
  display: flex;
  gap: 8px;
}

.gender-btn {
  flex: 1;
  padding: 10px;
  background: var(--bg-input);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.gender-btn.active {
  background: rgba(197, 160, 89, 0.2);
  border-color: var(--border-gold);
  color: var(--gold-light);
  box-shadow: 0 0 8px rgba(197, 160, 89, 0.2);
}

/* Shichen Pills */
.shichen-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin-top: 8px;
}

.shichen-btn {
  padding: 6px 2px;
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
}

.shichen-btn:hover {
  border-color: var(--border-gold-dim);
  color: #fff;
}

.shichen-btn.active {
  background: rgba(102, 252, 241, 0.15);
  border-color: var(--cyan-accent);
  color: var(--cyan-accent);
  font-weight: 700;
}

/* Tags */
.quick-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.tag-btn {
  padding: 4px 10px;
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s;
}

.tag-btn:hover {
  background: rgba(197, 160, 89, 0.15);
  border-color: var(--border-gold-dim);
  color: var(--gold-light);
}

/* Accordion */
.accordion-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 10px 0;
  background: transparent;
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  margin-top: 8px;
}

.accordion-content {
  display: none;
  padding-top: 12px;
}

.accordion-content.open {
  display: block;
}

/* Action Buttons */
.btn-submit {
  width: 100%;
  padding: 14px 20px;
  background: linear-gradient(135deg, #d4af37 0%, #aa7c11 100%);
  border: none;
  border-radius: 10px;
  color: #0b0d13;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(212, 175, 55, 0.3);
  transition: all 0.2s ease;
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(212, 175, 55, 0.45);
}

.btn-submit:active {
  transform: translateY(0);
}

/* Results Area */
.results-area {
  margin-top: 24px;
  display: none;
}

.results-area.show {
  display: block;
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Hero Result Card */
.hero-result {
  background: linear-gradient(180deg, #161e2a 0%, #0d121a 100%);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.four-pillars-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 16px 0;
}

.pillar-box {
  background: #111722;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 12px;
  text-align: center;
}

.pillar-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.pillar-chars {
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 2px;
  color: #fff;
}

.tst-banner {
  background: rgba(102, 252, 241, 0.08);
  border: 1px solid var(--cyan-dim);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 12px;
  color: var(--cyan-accent);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* AI Export Hub */
.ai-export-hub {
  background: #121824;
  border: 2px solid var(--border-gold);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  text-align: center;
}

.btn-copy-prompt {
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.3);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-copy-prompt:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(16, 185, 129, 0.45);
}

.btn-copy-prompt.copied {
  background: #047857;
}

.ai-buttons-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 12px;
}

.btn-ai-portal {
  padding: 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn-ai-portal.chatgpt { background: rgba(16, 163, 127, 0.15); border-color: rgba(16, 163, 127, 0.4); }
.btn-ai-portal.claude { background: rgba(217, 119, 6, 0.15); border-color: rgba(217, 119, 6, 0.4); }
.btn-ai-portal.deepseek { background: rgba(59, 130, 246, 0.15); border-color: rgba(59, 130, 246, 0.4); }

.btn-ai-portal:hover {
  transform: translateY(-2px);
}

/* JSON Tabs */
.json-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 8px;
}

.json-tab-btn {
  padding: 6px 14px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s;
}

.json-tab-btn.active {
  background: rgba(197, 160, 89, 0.2);
  color: var(--gold-light);
}

.json-box {
  background: #090c12;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 14px;
  color: #94a3b8;
  font-family: "SFMono-Regular", Consolas, Menlo, monospace;
  font-size: 12px;
  line-height: 1.5;
  max-height: 350px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

/* Archetypes Grid */
.archetypes-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 14px;
}

@media (max-width: 600px) {
  .archetypes-grid {
    grid-template-columns: 1fr;
  }
}

.archetype-card {
  background: #111722;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 10px;
}

.archetype-title {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}

.progress-bar-bg {
  height: 6px;
  background: #1e293b;
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #c5a059, #66fcf1);
  border-radius: 3px;
}
