:root {
  --bg: #fafafa;
  --text: #222;
  --muted: #666;
  --border: #e0e0e0;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

header {
  margin-bottom: 2rem;
  text-align: center;
}

header h1 {
  font-size: 2rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

header .subtitle {
  color: var(--muted);
  font-size: 1rem;
}

.main-nav {
  margin-top: 1rem;
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.main-nav .nav-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.875rem;
}

.main-nav .nav-link:hover {
  color: var(--accent);
}

/* Categories nav */
.categories {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
  justify-content: center;
}

.categories a {
  padding: 0.375rem 0.75rem;
  border-radius: 1rem;
  text-decoration: none;
  font-size: 0.875rem;
  color: var(--muted);
  background: white;
  border: 1px solid var(--border);
  transition: all 0.15s;
}

.categories a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.categories a.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* Article list */
.articles article {
  background: white;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.articles article h2 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.articles article h2 a {
  color: var(--text);
  text-decoration: none;
}

.articles article h2 a:hover {
  color: var(--accent);
}

.articles article .summary {
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.articles article footer {
  font-size: 0.8125rem;
  color: var(--muted);
  display: flex;
  gap: 1rem;
}

/* Category badges */
.category {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  margin-bottom: 0.5rem;
  background: #e5e7eb;
  color: #374151;
}

.category.politics { background: #fee2e2; color: #991b1b; }
.category.business { background: #dbeafe; color: #1e40af; }
.category.technology { background: #d1fae5; color: #065f46; }
.category.health { background: #fce7f3; color: #9d174d; }
.category.science { background: #ede9fe; color: #5b21b6; }
.category.entertainment { background: #fef3c7; color: #92400e; }
.category.sports { background: #ffedd5; color: #9a3412; }
.category.world { background: #e0e7ff; color: #3730a3; }
.category.environment { background: #dcfce7; color: #166534; }

/* Political lean badges */
.lean {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 500;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  margin-left: 0.5rem;
  background: #f3f4f6;
  color: var(--muted);
}

/* Back link */
.back {
  margin-bottom: 1.5rem;
}

.back a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.875rem;
}

.back a:hover {
  color: var(--accent);
}

/* Article detail */
.detail h1 {
  font-size: 1.75rem;
  line-height: 1.3;
  margin-bottom: 1rem;
}

.detail .calm-summary {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 0.5rem;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.detail .calm-summary h3 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #166534;
  margin-bottom: 0.5rem;
}

.detail .calm-summary p {
  color: #14532d;
}

.detail .meta {
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
}

.detail .image {
  margin-bottom: 1.5rem;
}

.detail .image img {
  width: 100%;
  height: auto;
  border-radius: 0.5rem;
}

.detail .description {
  margin-bottom: 1.5rem;
  font-size: 1.0625rem;
}

.detail .analysis {
  background: white;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.detail .analysis h3 {
  font-size: 1rem;
  margin-bottom: 1rem;
}

.detail .tags {
  margin-bottom: 0.75rem;
}

.detail .tag {
  display: inline-block;
  background: #f3f4f6;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.8125rem;
  margin: 0.125rem;
}

.detail .entities {
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
}

.detail .entity-group {
  margin-left: 1rem;
}

.detail .model-info {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 1rem;
}

.detail .no-analysis {
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: 0.5rem;
  padding: 1rem;
  margin-bottom: 1.5rem;
  color: #92400e;
}

.detail .original {
  margin-top: 1.5rem;
}

.detail .original a {
  display: inline-block;
  padding: 0.75rem 1.25rem;
  background: var(--accent);
  color: white;
  text-decoration: none;
  border-radius: 0.375rem;
  font-weight: 500;
}

.detail .original a:hover {
  background: var(--accent-hover);
}

/* Flash messages */
.notice {
  background: #d1fae5;
  border: 1px solid #6ee7b7;
  color: #065f46;
  padding: 0.75rem 1rem;
  border-radius: 0.375rem;
  margin-bottom: 1.5rem;
}

.alert {
  background: #fee2e2;
  border: 1px solid #fca5a5;
  color: #991b1b;
  padding: 0.75rem 1rem;
  border-radius: 0.375rem;
  margin-bottom: 1.5rem;
}

/* Prompt section */
.prompt-section {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.prompt-section h2 {
  font-size: 1.25rem;
  margin-bottom: 1rem;
}

.prompt-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.prompt-tabs .tab {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  background: white;
  border-radius: 0.375rem;
  cursor: pointer;
  font-size: 0.875rem;
}

.prompt-tabs .tab:hover {
  border-color: var(--accent);
}

.prompt-tabs .tab.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.tab-content {
  background: white;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.tab-content.hidden {
  display: none;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
}

.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-family: inherit;
}

.form-group textarea {
  font-family: ui-monospace, monospace;
  font-size: 0.8125rem;
  line-height: 1.5;
  resize: vertical;
}

.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.btn {
  display: inline-block;
  padding: 0.625rem 1rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
}

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

.current-prompt {
  margin-top: 1rem;
}

.current-prompt summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.875rem;
}

.current-prompt summary:hover {
  color: var(--accent);
}

.current-prompt pre {
  margin-top: 0.75rem;
  padding: 1rem;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  font-size: 0.8125rem;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre-wrap;
}

/* Entity links */
.entity-link {
  color: var(--accent);
  text-decoration: none;
}

.entity-link:hover {
  text-decoration: underline;
}

/* Entity list page */
.entities-list {
  display: grid;
  gap: 0.75rem;
}

.entity-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: white;
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  padding: 0.75rem 1rem;
}

.entity-card .entity-name {
  flex: 1;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
}

.entity-card .entity-name:hover {
  color: var(--accent);
}

.entity-card .entity-count {
  font-size: 0.8125rem;
  color: var(--muted);
}

/* Entity type badges */
.entity-type {
  display: inline-block;
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.4rem;
  border-radius: 0.25rem;
  background: #e5e7eb;
  color: #374151;
}

.entity-type.person { background: #dbeafe; color: #1e40af; }
.entity-type.organization { background: #fce7f3; color: #9d174d; }
.entity-type.place { background: #d1fae5; color: #065f46; }
.entity-type.publisher { background: #ede9fe; color: #5b21b6; }
.entity-type.author { background: #ffedd5; color: #9a3412; }
.entity-type.tag { background: #f3f4f6; color: #374151; }
.entity-type.category { background: #fee2e2; color: #991b1b; }

/* Entity header */
.entity-header {
  margin-bottom: 2rem;
}

.entity-header h1 {
  font-size: 2rem;
  margin: 0.5rem 0 0.25rem;
}

.entity-header .subtitle {
  color: var(--muted);
}
