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

:root {
  --bg: #f5f0eb;
  --card: #ffffff;
  --card-shadow: 0 2px 12px rgba(0,0,0,0.06);
  --text: #1a1a1a;
  --text-dim: #777;
  --text-light: #aaa;
  --accent: #2563eb;
  --accent-light: #dbeafe;
  --border: #e5e5e5;
  --radius: 16px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "SF Pro Text", "Noto Sans TC", "Helvetica Neue", sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: 420px;
  margin: 0 auto;
  padding: 16px 16px 32px;
}

/* Header */
header { padding: 8px 0 20px; }
.logo { display: flex; align-items: center; gap: 10px; }
.logo-emoji { font-size: 32px; line-height: 1; }
.logo h1 { font-size: 22px; font-weight: 800; letter-spacing: -0.5px; }
.tagline { font-size: 12px; color: var(--text-dim); font-weight: 500; }

/* Intro */
.intro { font-size: 14px; color: var(--text-dim); line-height: 1.7; margin-bottom: 20px; }

/* Steps */
.step { display: none; }
.step.active { display: block; animation: fadeUp 0.25s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.step-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.back-btn {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  box-shadow: var(--card-shadow);
}
.back-btn:active { background: #f0f0f0; }
.step-label { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 700; }
.step-num {
  background: var(--accent);
  color: white;
  font-size: 11px;
  font-weight: 800;
  width: 24px; height: 24px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
}
.step-hint { font-size: 12px; color: var(--text-light); margin-bottom: 14px; }

/* Category Grid — 2 columns, big cards with images */
.cat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.cat-card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--card-shadow);
  transition: transform 0.12s, box-shadow 0.12s;
  border: 1.5px solid transparent;
}
.cat-card:active { transform: scale(0.97); }
.cat-card:hover { border-color: var(--accent-light); }

.cat-img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  background: #e8e4df;
}

.cat-body {
  padding: 10px 12px 12px;
}
.cat-name {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 2px;
}
.cat-tagline {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.4;
}
.cat-badge-ai {
  font-size: 9px;
  color: #94a3b8;
  background: #f0f0f0;
  padding: 2px 6px;
  border-radius: 8px;
  font-weight: 600;
  vertical-align: middle;
  margin-left: 4px;
}
.mentor-wiki {
  font-size: 9px;
  color: var(--accent);
  background: var(--accent-light);
  padding: 1px 5px;
  border-radius: 6px;
  margin-left: 4px;
}
.mentor-generic {
  font-size: 9px;
  color: #94a3b8;
  background: #f0f0f0;
  padding: 1px 5px;
  border-radius: 6px;
  margin-left: 4px;
}

/* Mentor List */
.mentor-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.mentor-row {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: border-color 0.12s, transform 0.12s;
  box-shadow: var(--card-shadow);
}
.mentor-row.selected { border-color: var(--accent); background: var(--accent-light); }
.mentor-row:active { transform: scale(0.98); }
.mentor-avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.mentor-info { flex: 1; }
.mentor-name { font-size: 14px; font-weight: 700; }
.mentor-role { font-size: 11px; color: var(--text-dim); margin-top: 1px; }
.mentor-check {
  width: 22px; height: 22px;
  border: 2px solid var(--border);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
  transition: all 0.12s;
}
.mentor-row.selected .mentor-check {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* Mode Row */
.mode-row { display: flex; gap: 8px; margin-bottom: 14px; }
.mode-pill {
  flex: 1;
  background: var(--card);
  border: 1.5px solid var(--border);
  color: var(--text-dim);
  padding: 10px;
  border-radius: 10px;
  font-size: 13px;
  cursor: pointer;
  box-shadow: var(--card-shadow);
  transition: all 0.12s;
}
.mode-pill.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

/* Go Button */
.go-btn {
  width: 100%;
  background: var(--accent);
  border: none;
  color: white;
  padding: 14px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.12s;
  box-shadow: 0 4px 12px rgba(37,99,235,0.2);
}
.go-btn:disabled { opacity: 0.4; cursor: default; box-shadow: none; }
.go-btn:not(:disabled):active { opacity: 0.85; }
.go-btn.secondary {
  background: var(--card);
  color: var(--accent);
  border: 1.5px solid var(--accent);
  box-shadow: var(--card-shadow);
}

/* Chips */
.chips-row { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.chip {
  background: var(--accent-light);
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

/* Question Input */
#question-input {
  width: 100%;
  background: var(--card);
  border: 1.5px solid var(--border);
  color: var(--text);
  padding: 14px;
  border-radius: 12px;
  font-size: 15px;
  resize: none;
  margin-bottom: 12px;
  font-family: inherit;
  line-height: 1.6;
  box-shadow: var(--card-shadow);
}
#question-input:focus { outline: none; border-color: var(--accent); }
#question-input::placeholder { color: var(--text-light); }

/* Loading */
.loading-state { text-align: center; padding: 40px 0; color: var(--text-dim); }
.spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-state p { font-size: 13px; }

/* Response Cards */
.resp-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
  box-shadow: var(--card-shadow);
  animation: fadeUp 0.3s ease;
}
.resp-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.resp-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.resp-name { font-weight: 700; font-size: 14px; }
.resp-role { font-size: 10px; color: var(--text-dim); }
.resp-text {
  font-size: 13.5px;
  line-height: 1.8;
  color: var(--text);
  white-space: pre-wrap;
}

/* Summary Block */
.summary-block {
  background: var(--accent-light);
  border: 1.5px solid var(--accent);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 8px;
}
.summary-block h3 { font-size: 14px; margin-bottom: 8px; color: var(--accent); }
.summary-block p { font-size: 13px; line-height: 1.8; }
