:root {
  --bg: #faf7f2;
  --card-bg: #ffffff;
  --text: #2b2620;
  --muted: #6b6258;
  --accent: #a35d3a;
  --accent-light: #f1e2d5;
  --border: #e5ddd0;
  --success: #4c7a5a;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1c1a17;
    --card-bg: #26231f;
    --text: #efe9e1;
    --muted: #a89e90;
    --accent: #e0a37c;
    --accent-light: #3a2f26;
    --border: #3a352d;
    --success: #7fb894;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  line-height: 1.5;
  padding: 16px;
}

.app {
  max-width: 780px;
  margin: 0 auto;
}

header {
  margin-bottom: 24px;
}

header h1 {
  font-size: 1.5rem;
  margin: 0 0 4px;
}

header p {
  color: var(--muted);
  margin: 0;
  font-size: 0.95rem;
}

.input-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
}

textarea {
  width: 100%;
  min-height: 110px;
  resize: vertical;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
}

textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.hint {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 6px 2px 12px;
}

button {
  font-family: inherit;
  font-size: 0.95rem;
  border-radius: 8px;
  border: none;
  padding: 10px 18px;
  cursor: pointer;
}

#analyzeBtn {
  background: var(--accent);
  color: white;
  font-weight: 600;
}

#analyzeBtn:hover {
  filter: brightness(1.05);
}

.empty-state {
  color: var(--muted);
  padding: 20px 8px;
  text-align: center;
}

.hidden {
  display: none !important;
}

.section-group {
  margin-bottom: 20px;
}

.section-group h3 {
  font-size: 0.95rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 0 0 8px 2px;
}

.goal-card {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 8px;
  cursor: pointer;
}

.goal-card input[type="checkbox"] {
  margin-top: 3px;
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.goal-content {
  flex: 1;
}

.goal-id {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 2px;
}

.goal-text {
  font-size: 0.95rem;
}

.goal-keywords {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 4px;
}

.results-footer {
  position: sticky;
  bottom: 0;
  background: var(--bg);
  padding: 12px 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 12px;
  border-top: 1px solid var(--border);
  margin-top: 12px;
}

#copyBtn {
  flex-shrink: 0;
}

#summaryBar {
  color: var(--muted);
  font-size: 0.9rem;
}

#copyBtn {
  background: var(--accent-light);
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
}

footer.source-note {
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
  margin-top: 28px;
}
