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

:root {
  --bg: #fafafa;
  --surface: #fff;
  --border: #e2e8f0;
  --text: #1a202c;
  --text-secondary: #718096;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.1);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "SF Mono", Menlo, Monaco, monospace;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
}
.header-inner {
  display: flex; justify-content: space-between; align-items: center;
  max-width: 1200px; margin: 0 auto; padding: 0 24px;
}
.logo { font-size: 1.25rem; font-weight: 700; color: var(--text); }
.logo:hover { text-decoration: none; }
.header-actions { display: flex; gap: 12px; align-items: center; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px; border-radius: var(--radius); font-size: 0.875rem;
  font-weight: 500; cursor: pointer; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); transition: all 0.15s;
}
.btn:hover { background: var(--bg); text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-danger { color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: #fef2f2; }

/* Cards */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow);
}

/* Hero (landing) */
.hero {
  text-align: center; padding: 80px 24px 60px;
}
.hero h1 { font-size: 2.5rem; font-weight: 800; margin-bottom: 16px; }
.hero p { font-size: 1.15rem; color: var(--text-secondary); max-width: 600px; margin: 0 auto 32px; }

/* Steps */
.steps {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 24px; padding: 40px 0;
}
.step {
  text-align: center; padding: 32px 20px;
}
.step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--primary); color: #fff; font-weight: 700; margin-bottom: 16px;
}
.step h3 { margin-bottom: 8px; }
.step p { color: var(--text-secondary); font-size: 0.9rem; }

/* Live feed */
.feed { padding: 40px 0; }
.feed h2 { text-align: center; margin-bottom: 24px; }
.feed-list { display: flex; flex-direction: column; gap: 12px; max-width: 700px; margin: 0 auto; }
.feed-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 20px;
  display: flex; justify-content: space-between; align-items: center;
}
.feed-outcome { font-size: 0.8rem; padding: 4px 10px; border-radius: 12px; font-weight: 500; }
.feed-outcome.high { background: #d1fae5; color: #065f46; }
.feed-outcome.moderate { background: #fef3c7; color: #92400e; }
.feed-outcome.low { background: #fee2e2; color: #991b1b; }

/* Dashboard layout */
.dashboard { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; padding: 24px 0; }
@media (max-width: 768px) { .dashboard { grid-template-columns: 1fr; } }

/* Poll form */
.poll-form textarea {
  width: 100%; min-height: 120px; padding: 12px; border: 1px solid var(--border);
  border-radius: var(--radius); font-family: var(--font); font-size: 0.95rem;
  resize: vertical;
}
.poll-form textarea:focus { outline: none; border-color: var(--primary); }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 500; margin-bottom: 6px; font-size: 0.875rem; }
.form-group input, .form-group select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 0.95rem;
}
.form-group input:focus, .form-group select:focus { outline: none; border-color: var(--primary); }
.char-count { font-size: 0.8rem; color: var(--text-secondary); text-align: right; margin-top: 4px; }
.form-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; }

/* User info bar */
.user-bar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--border);
}
.user-email { font-weight: 500; }
.balance-display { font-size: 0.9rem; color: var(--text-secondary); }
.balance-amount { font-weight: 600; color: var(--text); }

/* History list */
.history-list { display: flex; flex-direction: column; gap: 10px; }
.history-item {
  padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius);
  display: flex; justify-content: space-between; align-items: center; cursor: pointer;
  transition: background 0.15s;
}
.history-item:hover { background: var(--bg); }
.history-summary { font-size: 0.9rem; flex: 1; margin-right: 12px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-meta { font-size: 0.8rem; color: var(--text-secondary); white-space: nowrap; }

/* Result detail */
.result-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; padding: 24px 0; }
@media (max-width: 768px) { .result-layout { grid-template-columns: 1fr; } }
.result-header { padding: 24px 0 0; }
.result-header h1 { font-size: 1.5rem; }
.result-id { color: var(--text-secondary); font-family: var(--mono); font-size: 0.85rem; }

.confidence-badge {
  display: inline-block; padding: 4px 12px; border-radius: 12px;
  font-weight: 500; font-size: 0.85rem;
}
.confidence-badge.high { background: #d1fae5; color: #065f46; }
.confidence-badge.moderate { background: #fef3c7; color: #92400e; }
.confidence-badge.low { background: #fee2e2; color: #991b1b; }

.model-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; margin-bottom: 12px;
}
.model-card h4 { font-size: 0.9rem; margin-bottom: 8px; }
.model-card p { font-size: 0.85rem; color: var(--text-secondary); white-space: pre-wrap; }
.model-meta { display: flex; gap: 16px; font-size: 0.8rem; color: var(--text-secondary); margin-top: 8px; }

/* Loading */
.loading { text-align: center; padding: 40px; color: var(--text-secondary); }
.spinner {
  display: inline-block; width: 24px; height: 24px; 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); } }

/* Pricing */
.pricing-card { max-width: 500px; margin: 40px auto; }
.pricing-card h2 { margin-bottom: 8px; }
.pricing-card .fee-note { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 20px; }
.pricing-breakdown { background: var(--bg); padding: 16px; border-radius: var(--radius); margin: 16px 0; font-size: 0.9rem; }
.pricing-breakdown div { display: flex; justify-content: space-between; padding: 4px 0; }
.pricing-breakdown .total { font-weight: 600; border-top: 1px solid var(--border); margin-top: 8px; padding-top: 8px; }

/* Footer */
.footer {
  border-top: 1px solid var(--border); padding: 24px 0; margin-top: 60px;
  text-align: center; font-size: 0.8rem; color: var(--text-secondary);
}
.footer a { color: var(--text-secondary); margin: 0 8px; }

/* Alert */
.alert {
  padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: 0.9rem;
}
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

/* Poll result animation */
.poll-result { animation: fadeIn 0.3s ease-in; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
