:root {
  --bg: #07070f;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-strong: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.1);
  --text: #f5f5fa;
  --muted: #9a9eb8;
  --accent: #ec4899;
  --accent-2: #8b5cf6;
  --up: #f472b6;
  --down: #38bdf8;
  --radius: 20px;
}

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

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background-color: var(--bg);
  color: var(--text);
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.bg-glow {
  position: fixed;
  inset: -20%;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(circle at 38% 32%, rgba(139, 92, 246, 0.18), transparent 45%),
    radial-gradient(circle at 68% 68%, rgba(236, 72, 153, 0.14), transparent 50%);
  transition: background 1.2s ease;
}

.app-shell {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 22px 36px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-bottom: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Space Grotesk', sans-serif;
  letter-spacing: 0.08em;
  font-size: 1.1rem;
}

.brand-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  box-shadow: 0 0 14px rgba(236, 72, 153, 0.8);
}

.brand-title strong {
  background: linear-gradient(90deg, #f472b6, #c084fc, #38bdf8);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.status-pills {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  backdrop-filter: blur(12px);
}

.pill-live {
  color: #f9a8d4;
  border-color: rgba(244, 114, 182, 0.3);
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f472b6;
  box-shadow: 0 0 10px #f472b6;
  animation: pulseDot 1.8s infinite ease-in-out;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.75); }
}

.pill-provider {
  font-size: 0.72rem;
  color: #fde68a;
  border-color: rgba(251, 191, 36, 0.3);
}

/* Main Grid */
.main-grid {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(300px, 0.85fr);
  gap: 28px;
  align-items: start;
}

/* Orb Stage */
.orb-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.orb-canvas-wrap {
  position: relative;
  width: min(380px, 84vw);
  height: min(380px, 84vw);
  display: grid;
  place-items: center;
  cursor: pointer;
  user-select: none;
}

#orbCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

.orb-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  text-align: center;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.65);
}

.orb-score-row {
  display: flex;
  align-items: baseline;
  gap: 3px;
}

.orb-score {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(2.8rem, 7vw, 3.8rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
  color: #ffffff;
}

.orb-score-max {
  font-size: 1rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.65);
}

.orb-rank {
  margin-top: 8px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: rgba(7, 7, 15, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(8px);
}

.orb-delta-float {
  margin-top: 8px;
  min-height: 22px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.orb-delta-float.show {
  opacity: 1;
  transform: translateY(0);
}

.orb-delta-float.up {
  color: #f9a8d4;
}

.orb-delta-float.down {
  color: #7dd3fc;
}

.orb-subtitle {
  margin: -6px 0 4px;
  color: var(--muted);
  font-size: 0.94rem;
  text-align: center;
}

/* Scale Meter */
.scale-meter {
  width: 100%;
  max-width: 560px;
}

.scale-meter-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 8px;
}

.scale-meter-track {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: visible;
}

.scale-meter-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #334155 0%, #38bdf8 30%, #a855f7 60%, #ec4899 85%, #fbbf24 100%);
  transition: width 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.scale-meter-thumb {
  position: absolute;
  top: 50%;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid #ec4899;
  box-shadow: 0 0 16px rgba(236, 72, 153, 0.85);
  transform: translate(-50%, -50%);
  transition: left 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Submit Card */
.submit-card {
  width: 100%;
  max-width: 560px;
  margin-top: 6px;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  backdrop-filter: blur(18px);
}

.submit-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.88rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.char-count {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
}

.input-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

#actionInput {
  flex: 1;
  resize: none;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(7, 7, 15, 0.65);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.45;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#actionInput:focus {
  border-color: rgba(236, 72, 153, 0.7);
  box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.18);
}

#actionInput::placeholder {
  color: rgba(154, 158, 184, 0.6);
}

.submit-btn {
  position: relative;
  min-width: 108px;
  border: none;
  border-radius: 14px;
  padding: 0 18px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, filter 0.2s ease, opacity 0.2s ease;
}

.submit-btn:hover:not(:disabled) {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.submit-btn:active:not(:disabled) {
  transform: translateY(0);
}

.submit-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.btn-spinner {
  display: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  animation: spin 0.75s linear infinite;
}

.submit-btn.loading .btn-text {
  display: none;
}

.submit-btn.loading .btn-spinner {
  display: inline-block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.quick-prompts {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.quick-label {
  font-size: 0.74rem;
  color: var(--muted);
}

.chip {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: #d6d9ec;
  font-family: inherit;
  font-size: 0.74rem;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.chip:hover {
  background: rgba(236, 72, 153, 0.16);
  border-color: rgba(236, 72, 153, 0.45);
}

.form-error {
  margin: 10px 0 0;
  font-size: 0.84rem;
  color: #fda4af;
}

/* Verdict Card */
.verdict-card {
  width: 100%;
  max-width: 560px;
  padding: 16px 18px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.12), rgba(139, 92, 246, 0.12));
  border: 1px solid rgba(244, 114, 182, 0.3);
  animation: fadeSlideIn 0.35s ease;
}

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.verdict-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.verdict-badge {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.12);
}

.verdict-score {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
}

.verdict-delta {
  margin-left: auto;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
}

.verdict-delta.up { color: var(--up); }
.verdict-delta.down { color: var(--down); }

.verdict-action {
  margin: 0 0 6px;
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.8);
  font-style: italic;
}

.verdict-text {
  margin: 0;
  font-size: 0.94rem;
  line-height: 1.5;
  color: #fff;
}

/* Feed Panel */
.feed-panel {
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  backdrop-filter: blur(18px);
  padding: 18px;
  display: flex;
  flex-direction: column;
  max-height: 760px;
}

.feed-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
}

.feed-header h2 {
  margin: 0;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.05rem;
}

.feed-hint {
  font-size: 0.74rem;
  color: var(--muted);
}

.feed-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding-right: 4px;
}

.feed-list::-webkit-scrollbar {
  width: 5px;
}

.feed-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
}

.feed-empty {
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
  padding: 36px 12px;
}

.feed-item {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.07);
  transition: border-color 0.2s ease, background 0.2s ease;
}

.feed-item.fresh {
  animation: fadeSlideIn 0.4s ease;
  border-color: rgba(244, 114, 182, 0.35);
  background: rgba(244, 114, 182, 0.07);
}

.feed-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.feed-tag {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.feed-tag.high {
  color: #f9a8d4;
  background: rgba(236, 72, 153, 0.16);
}

.feed-tag.low {
  color: #7dd3fc;
  background: rgba(56, 189, 248, 0.14);
}

.feed-delta {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
}

.feed-delta.up { color: var(--up); }
.feed-delta.down { color: var(--down); }
.feed-delta.flat { color: var(--muted); }

.feed-action {
  margin: 0 0 6px;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.4;
  word-break: break-word;
}

.feed-verdict {
  margin: 0 0 6px;
  font-size: 0.8rem;
  line-height: 1.42;
  color: var(--muted);
}

.feed-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: rgba(154, 158, 184, 0.7);
}

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

.hidden {
  display: none !important;
}

@media (max-width: 900px) {
  .main-grid {
    grid-template-columns: 1fr;
  }

  .feed-panel {
    max-height: none;
  }

  .input-row {
    flex-direction: column;
  }

  .submit-btn {
    height: 46px;
    width: 100%;
  }
}
