:root {
  --bg: #0f172a;
  --bg-soft: #111827;
  --panel: rgba(15, 23, 42, 0.78);
  --panel-border: rgba(148, 163, 184, 0.18);
  --text: #e5eef8;
  --muted: #9fb0c7;
  --accent: #38bdf8;
  --accent-strong: #0ea5e9;
  --positive: #22c55e;
  --negative: #f97316;
  --shadow: 0 24px 80px rgba(2, 6, 23, 0.45);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(56, 189, 248, 0.24), transparent 30%),
    radial-gradient(circle at bottom right, rgba(34, 197, 94, 0.14), transparent 32%),
    linear-gradient(145deg, #020617 0%, var(--bg) 55%, var(--bg-soft) 100%);
  background-attachment: fixed;
}

.page-shell {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0 64px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 42px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--panel-border);
}

.topbar > div {
  flex: 1;
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
}

h1, h2, h3, h4, p {
  margin-top: 0;
}

h1 {
  font-size: clamp(2rem, 4vw, 2.8rem);
  margin-bottom: 0;
  font-weight: 700;
}

h2 {
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  margin-bottom: 12px;
  font-weight: 700;
}

h3 {
  font-size: 1.3rem;
  margin-bottom: 12px;
  font-weight: 700;
}

h4 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.status-pill,
.confidence-badge,
.example-chip,
button {
  border-radius: 999px;
  transition: all 0.3s ease;
}

.status-pill {
  padding: 10px 16px;
  background: rgba(15, 118, 110, 0.18);
  border: 1px solid rgba(45, 212, 191, 0.26);
  color: #a7f3d0;
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
}

/* Layout */
.hero-grid {
  display: grid;
  grid-template-columns: 1.65fr 1fr;
  gap: 24px;
  align-items: stretch;
  margin-bottom: 32px;
}

.hero-card,
.info-card,
.result-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
  border-radius: 24px;
  padding: 32px;
}

.hero-card {
  display: flex;
  flex-direction: column;
}

.subtitle-text {
  color: var(--muted);
  line-height: 1.65;
  margin-bottom: 24px;
  font-size: 1rem;
}

/* Forms */
.input-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 600;
  text-transform: capitalize;
}

.textarea-input {
  width: 100%;
  min-height: 160px;
  resize: vertical;
  border-radius: 16px;
  border: 2px solid var(--panel-border);
  background: rgba(2, 6, 23, 0.48);
  color: var(--text);
  padding: 16px;
  font-size: 1rem;
  line-height: 1.6;
  font-family: inherit;
  outline: none;
  transition: all 0.3s ease;
}

.textarea-input::placeholder {
  color: rgba(159, 176, 199, 0.5);
}

.textarea-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.12);
  background: rgba(2, 6, 23, 0.68);
}

/* Buttons */
.btn-primary,
.btn-secondary {
  appearance: none;
  border: 0;
  font-weight: 700;
  cursor: pointer;
  padding: 14px 28px;
  font-size: 1rem;
  text-align: center;
  transition: all 0.3s ease;
}

.btn-primary {
  background: linear-gradient(135deg, #7dd3fc, #38bdf8 52%, #0ea5e9);
  color: #00111f;
  box-shadow: 0 12px 32px rgba(14, 165, 233, 0.3);
  width: 100%;
}

.btn-primary:hover {
  box-shadow: 0 16px 40px rgba(14, 165, 233, 0.5);
  transform: translateY(-2px);
}

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

.btn-secondary {
  background: rgba(56, 189, 248, 0.14);
  color: #bae6fd;
  border: 1px solid rgba(56, 189, 248, 0.4);
}

.btn-secondary:hover {
  background: rgba(56, 189, 248, 0.24);
  border-color: rgba(56, 189, 248, 0.6);
}

/* Examples */
.example-chips {
  display: grid;
  gap: 10px;
  margin-bottom: 24px;
}

.example-chip {
  padding: 12px 16px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.26);
  color: #dbeafe;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.example-chip:hover {
  background: rgba(56, 189, 248, 0.18);
  border-color: rgba(56, 189, 248, 0.4);
  transform: translateX(4px);
}

/* Info Box */
.info-box {
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: 16px;
  padding: 20px;
  margin-top: 20px;
}

.info-box h4 {
  margin-top: 0;
  margin-bottom: 12px;
  color: var(--accent);
}

.info-box ul {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.8;
}

.info-box li {
  margin-bottom: 8px;
}

/* Results */
.result-card {
  margin-top: 24px;
}

.result-card.positive {
  border-color: rgba(34, 197, 94, 0.35);
}

.result-card.negative {
  border-color: rgba(249, 115, 22, 0.35);
}

.result-card.error-state {
  border-color: rgba(248, 113, 113, 0.35);
}

.result-header-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.sentiment-badge {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  min-width: 200px;
}

.sentiment-badge.positive {
  color: var(--positive);
}

.sentiment-badge.negative {
  color: var(--negative);
}

.badge-icon {
  font-size: 2.4rem;
  line-height: 1;
}

.badge-label {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin: 0;
}

.badge-value {
  font-size: 1.8rem;
  font-weight: 700;
  margin: 0;
}

.confidence-badge {
  padding: 10px 16px;
  background: rgba(56, 189, 248, 0.14);
  border: 1px solid rgba(56, 189, 248, 0.22);
  color: #bae6fd;
  font-weight: 600;
  white-space: nowrap;
}

/* Meter */
.meter-container {
  margin: 24px 0;
}

.meter-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.14);
  margin-bottom: 12px;
}

.meter-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--negative), var(--accent), var(--positive));
  transition: width 0.6s ease;
}

.meter-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
}

/* Metrics */
.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 24px 0;
}

.metric-card {
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.15);
  border-radius: 12px;
  padding: 16px;
}

.metric-card.full-width {
  grid-column: 1 / -1;
}

.metric-label {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}

.metric-value {
  display: block;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.5;
}

.processed-text {
  word-break: break-word;
  font-style: italic;
  opacity: 0.9;
}

/* Actions */
.action-buttons {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

/* Error State */
.error-content {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.error-icon {
  font-size: 2rem;
  line-height: 1;
  flex-shrink: 0;
}

.error-content h3 {
  color: #fca5a5;
  margin-bottom: 8px;
}

.error-content p {
  color: var(--muted);
  margin: 0;
  line-height: 1.6;
}

/* Footer */
.footer {
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--panel-border);
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.footer a {
  color: inherit;
  text-decoration: none;
  transition: color 0.3s ease;
}

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

/* Responsive */
@media (max-width: 960px) {
  .hero-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .result-header-section {
    flex-direction: column;
    align-items: flex-start;
  }

  .result-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: calc(100% - 20px);
    padding: 24px 0 40px;
  }

  .topbar {
    margin-bottom: 24px;
    padding-bottom: 16px;
  }

  .hero-card,
  .info-card,
  .result-card {
    padding: 20px;
    border-radius: 20px;
  }

  h1 {
    font-size: 1.6rem;
  }

  h2 {
    font-size: 1.4rem;
  }

  .textarea-input {
    min-height: 120px;
  }

  .btn-primary,
  .btn-secondary {
    width: 100%;
  }

  .result-grid {
    grid-template-columns: 1fr;
  }

  .sentiment-badge {
    flex-direction: column;
    align-items: flex-start;
  }

  .badge-icon {
    font-size: 2rem;
  }

  .action-buttons {
    flex-direction: column;
  }

  .action-buttons button {
    width: 100%;
  }
}