:root {
  --bg-body: #050507;
  --bg-panel: rgba(9, 12, 17, 0.86);
  --bg-panel-soft: rgba(14, 17, 24, 0.88);
  --bg-chip: rgba(255, 255, 255, 0.04);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text-main: #f4f4f5;
  --text-muted: #a1a1aa;
  --text-soft: #71717a;
  --accent: #67e8a5;
  --accent-soft: rgba(103, 232, 165, 0.12);
  --primary: #3b82f6;
  --primary-soft: rgba(59, 130, 246, 0.16);
  --success-soft: rgba(16, 185, 129, 0.12);
  --warn-soft: rgba(251, 146, 60, 0.14);
  --danger-soft: rgba(244, 63, 94, 0.14);
  --shadow-panel: 0 18px 52px rgba(0, 0, 0, 0.28);
  --font: "Inter", sans-serif;
  --font-heading: "Space Grotesk", "Inter", sans-serif;
  --font-data: "IBM Plex Mono", monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font);
  color: var(--text-main);
  background:
    radial-gradient(circle at top left, rgba(16, 185, 129, 0.12), transparent 24%),
    radial-gradient(circle at 85% 0%, rgba(245, 158, 11, 0.08), transparent 22%),
    linear-gradient(180deg, #050507 0%, #090d12 58%, #050507 100%);
  transition: background 0.28s ease, color 0.22s ease;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(circle at 50% 16%, rgba(0, 0, 0, 0.8), transparent 82%);
  opacity: 0.35;
}

body.light-theme {
  --bg-body: #eef3f7;
  --bg-panel: rgba(255, 255, 255, 0.86);
  --bg-panel-soft: rgba(247, 250, 252, 0.92);
  --bg-chip: rgba(255, 255, 255, 0.82);
  --border: rgba(148, 163, 184, 0.2);
  --border-strong: rgba(100, 116, 139, 0.3);
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-soft: #64748b;
  --accent: #0f9f6e;
  --accent-soft: rgba(16, 185, 129, 0.12);
  --primary: #2563eb;
  --primary-soft: rgba(37, 99, 235, 0.12);
  --success-soft: rgba(16, 185, 129, 0.1);
  --warn-soft: rgba(249, 115, 22, 0.12);
  --danger-soft: rgba(244, 63, 94, 0.1);
  --shadow-panel: 0 20px 48px rgba(15, 23, 42, 0.1);
  background:
    radial-gradient(circle at top left, rgba(16, 185, 129, 0.1), transparent 26%),
    radial-gradient(circle at 85% 0%, rgba(245, 158, 11, 0.09), transparent 22%),
    linear-gradient(180deg, #f8fafc 0%, #eef2f7 52%, #f8fafc 100%);
}

body.light-theme::before {
  background-image:
    linear-gradient(rgba(15, 23, 42, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.025) 1px, transparent 1px);
  opacity: 0.45;
}

.hidden {
  display: none !important;
}

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

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.brand-block {
  display: grid;
  gap: 14px;
}

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

.back-link:hover {
  color: var(--text-main);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: var(--accent-soft);
  border: 1px solid rgba(103, 232, 165, 0.2);
  color: var(--accent);
  font-size: 1.55rem;
  font-weight: 700;
}

.eyebrow,
.status-label {
  display: inline-block;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-soft);
  font-weight: 700;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 4vw, 2.9rem);
  line-height: 0.96;
  letter-spacing: -0.04em;
}

h2 {
  font-family: var(--font-heading);
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
}

h3 {
  font-family: var(--font-heading);
  font-size: 1.18rem;
  line-height: 1.18;
  letter-spacing: -0.02em;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--bg-chip);
  border: 1px solid var(--border);
  backdrop-filter: blur(10px);
}

.user-chip-label {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.user-chip-value {
  color: var(--text-main);
  font-weight: 700;
}

.ghost-btn,
#analyzeButton {
  font: inherit;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, opacity 0.16s ease;
}

.ghost-btn {
  border: 1px solid var(--border);
  background: var(--bg-panel-soft);
  color: var(--text-main);
  padding: 10px 16px;
  backdrop-filter: blur(12px);
}

.ghost-btn:hover {
  border-color: var(--border-strong);
}

.utility-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.utility-icon {
  font-size: 0.95rem;
  line-height: 1;
}

.page {
  display: grid;
  gap: 20px;
}

.card,
.hero-card,
.loading-card {
  border-radius: 24px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-panel);
  backdrop-filter: blur(14px);
}

.hero-card,
.card {
  padding: 24px;
}

.hero-card {
  display: grid;
  gap: 20px;
  position: relative;
  overflow: hidden;
}

.hero-card::after {
  content: "";
  position: absolute;
  inset: auto -12% -42% auto;
  width: 340px;
  height: 340px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(103, 232, 165, 0.12), transparent 68%);
  pointer-events: none;
}

.hero-copy {
  display: grid;
  gap: 10px;
  max-width: 920px;
}

.hero-copy p,
.muted {
  color: var(--text-muted);
  line-height: 1.6;
}

.hero-copy code {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
  padding: 2px 6px;
  border-radius: 8px;
}

.hero-status {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.status-card {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--bg-panel-soft);
  border: 1px solid var(--border);
  min-height: 106px;
}

.status-note {
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

#usage-status,
.metric-primary,
.metric-value,
.book-price,
.book-value,
.right-metric strong {
  font-family: var(--font-data);
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.input-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.field-block {
  display: grid;
  gap: 10px;
}

.field-block span {
  font-size: 0.92rem;
  font-weight: 600;
}

.field-block input {
  width: 100%;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(6, 8, 11, 0.92);
  color: var(--text-main);
  padding: 15px 18px;
  font: inherit;
}

body.light-theme .field-block input {
  background: rgba(255, 255, 255, 0.86);
}

.field-block input:focus {
  outline: none;
  border-color: rgba(103, 232, 165, 0.42);
  box-shadow: 0 0 0 3px rgba(103, 232, 165, 0.08);
}

#analyzeButton {
  align-self: end;
  border: 1px solid transparent;
  background: var(--accent);
  color: #07110a;
  font-weight: 800;
  padding: 15px 22px;
  min-width: 190px;
  box-shadow: 0 10px 22px rgba(16, 185, 129, 0.14);
}

#analyzeButton:hover:not(:disabled) {
  transform: translateY(-1px);
}

#analyzeButton:disabled,
.ghost-btn:disabled {
  cursor: not-allowed;
  opacity: 0.7;
  transform: none;
}

.feedback {
  border-radius: 18px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  background: var(--bg-panel-soft);
}

.feedback.error {
  border-color: rgba(244, 63, 94, 0.22);
  background: var(--danger-soft);
}

.feedback.info {
  border-color: rgba(16, 185, 129, 0.22);
  background: var(--success-soft);
}

.feedback.neutral {
  border-color: var(--border);
}

.feedback .error-title {
  display: block;
  margin-bottom: 6px;
  font-weight: 700;
}

.loading-card {
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 28px;
  text-align: center;
}

.loader-mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1.35rem;
}

.loading-card p {
  font-size: 1.05rem;
  font-weight: 600;
}

.loading-card span {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.section-tag {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.82rem;
}

.market-options {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.outcome-option {
  width: 100%;
  text-align: left;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(6, 8, 11, 0.78);
  color: var(--text-main);
  padding: 16px;
  cursor: pointer;
}

.outcome-option:hover {
  border-color: rgba(255, 255, 255, 0.14);
}

.outcome-option.active {
  border-color: rgba(103, 232, 165, 0.54);
  background: rgba(103, 232, 165, 0.08);
  box-shadow: 0 0 0 1px rgba(103, 232, 165, 0.12) inset;
}

.results {
  display: grid;
  gap: 18px;
}

.summary-card {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1.1fr) minmax(260px, 0.9fr);
}

.summary-main {
  display: grid;
  gap: 14px;
}

.pill-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.info-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(103, 232, 165, 0.2);
  background: rgba(103, 232, 165, 0.1);
  color: var(--accent);
  font-size: 0.76rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 700;
}

.muted-pill {
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
}

.summary-side {
  display: grid;
  gap: 18px;
  align-content: end;
}

.metric-primary {
  margin-top: 10px;
  font-size: clamp(2.8rem, 6vw, 4.2rem);
  font-weight: 800;
  color: var(--accent);
  line-height: 0.95;
}

.token-label {
  margin-top: 10px;
  color: var(--text-main);
  font-size: 0.95rem;
  line-height: 1.45;
  word-break: break-all;
}

.metric-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric-card {
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-panel);
  padding: 18px;
}

.metric-value {
  display: block;
  margin-top: 12px;
  margin-bottom: 8px;
  font-size: 2rem;
  line-height: 1;
}

.two-col {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  align-items: start;
}

.whale-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.wall-card,
.list-item,
.insight-card,
.empty-state,
.book-row {
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--bg-panel-soft);
}

.wall-card,
.list-item,
.insight-card,
.book-row {
  padding: 16px;
}

.wall-card {
  display: grid;
  gap: 12px;
}

.wall-meta,
.list-item-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: flex-start;
  gap: 12px;
}

.wall-meta > div:first-child,
.list-item-top > div:first-child {
  min-width: 0;
}

.right-metric {
  display: grid;
  gap: 4px;
  text-align: right;
  max-width: 190px;
  min-width: 0;
}

.right-metric strong {
  color: var(--text-main);
  font-size: 1.05rem;
}

.right-metric .muted,
.list-item strong {
  overflow-wrap: anywhere;
}

.tone-bid {
  color: #6ee7b7;
}

.tone-ask {
  color: #fdba74;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.chip.bid {
  background: var(--success-soft);
  color: #6ee7b7;
}

.chip.ask {
  background: var(--warn-soft);
  color: #fdba74;
}

.wallet-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  font-size: 0.82rem;
  color: var(--text-muted);
  min-width: 0;
}

.mini-tag,
.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 5px 9px;
}

.copy-btn {
  font: inherit;
  cursor: pointer;
}

.copy-btn:hover {
  border-color: var(--border-strong);
  color: var(--text-main);
}

.bar-track {
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.45s ease;
}

.bar-fill.bid {
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.95), rgba(45, 212, 191, 0.88));
}

.bar-fill.ask {
  background: linear-gradient(90deg, rgba(251, 146, 60, 0.96), rgba(251, 191, 36, 0.9));
}

.insights-list,
.stack-list {
  display: grid;
  gap: 12px;
}

.insight-card.bid {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.16);
}

.insight-card.ask {
  background: rgba(251, 146, 60, 0.08);
  border-color: rgba(251, 146, 60, 0.18);
}

body.light-theme .insight-card.bid {
  background: rgba(16, 185, 129, 0.08);
}

body.light-theme .insight-card.ask {
  background: rgba(249, 115, 22, 0.08);
}

.empty-state {
  padding: 18px;
  color: var(--text-muted);
  line-height: 1.6;
}

.book-row {
  position: relative;
  overflow: hidden;
}

.book-fill {
  position: absolute;
  inset: 0 auto 0 0;
  transition: width 0.45s ease;
}

.book-fill.bid {
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.14), rgba(16, 185, 129, 0.04));
}

.book-fill.ask {
  background: linear-gradient(90deg, rgba(251, 146, 60, 0.14), rgba(251, 146, 60, 0.04));
}

.book-grid {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
}

.book-price {
  font-size: 1.1rem;
  font-weight: 700;
}

.book-price.bid {
  color: #6ee7b7;
}

.book-price.ask {
  color: #fdba74;
}

.book-value {
  text-align: right;
  color: var(--text-main);
  font-size: 0.9rem;
}

@media (max-width: 1100px) {
  .summary-card,
  .two-col {
    grid-template-columns: 1fr;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .topbar {
    gap: 20px;
  }

  .topbar-actions {
    justify-content: flex-start;
  }

  .hero-status {
    grid-template-columns: 1fr;
  }

  .status-card {
    min-height: 0;
  }
}

@media (max-width: 720px) {
  .shell {
    width: min(100% - 24px, 1280px);
    padding-top: 18px;
  }

  .topbar,
  .topbar-actions,
  .summary-side {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-status,
  .input-grid,
  .metric-grid,
  .whale-grid {
    grid-template-columns: 1fr;
  }

  .wall-meta,
  .list-item-top {
    grid-template-columns: 1fr;
  }

  .right-metric {
    max-width: none;
    text-align: left;
  }

  #analyzeButton {
    width: 100%;
  }

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

@media (max-width: 560px) {
  h1 {
    font-size: clamp(1.85rem, 7vw, 2.4rem);
  }

  h2 {
    font-size: clamp(1.4rem, 6vw, 1.85rem);
  }

  .brand-row {
    align-items: flex-start;
  }

  .brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 14px;
  }

  .user-chip,
  .ghost-btn {
    width: 100%;
    justify-content: center;
  }

  .section-head {
    align-items: flex-start;
  }
}
