@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=IBM+Plex+Mono:wght@400;500&display=swap");

:root {
  --bg: #f4f5f7;
  --card: #ffffffcc;
  --card-solid: #ffffff;
  --ink: #0b1118;
  --muted: #66717f;
  --line: #dfe4ea;
  --line-strong: #ced5dd;
  --accent: #101214;
  --accent-soft: #f2f4f7;
  --good: #097969;
  --warn: #9b6a00;
  --bad: #a11f2d;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  overflow-x: hidden;
}

body {
  font-family: "Manrope", "Avenir Next", "Segoe UI", sans-serif;
  line-height: 1.45;
}

.ambient {
  position: fixed;
  z-index: 0;
  pointer-events: none;
  width: 44vw;
  height: 44vw;
  max-width: 640px;
  max-height: 640px;
  border-radius: 999px;
  filter: blur(80px);
  opacity: 0.4;
}

.ambient-a {
  top: -12rem;
  left: -8rem;
  background: #d7e2f0;
}

.ambient-b {
  right: -10rem;
  bottom: -14rem;
  background: #ebedf2;
}

.shell {
  position: relative;
  z-index: 1;
  width: min(980px, 92vw);
  margin: 2.5rem auto 3.2rem;
  display: grid;
  gap: 1rem;
}

.topbar {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0.2rem 0.2rem 0.6rem;
}

.brand-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.05rem;
  min-width: 0;
}

.brand-logo {
  height: 216px;
  width: auto;
  max-width: 100%;
  display: block;
}

.brand-name {
  margin: 0;
  margin-top: -14px;
  color: var(--ink);
  font-family: "Manrope", "Avenir Next", "Segoe UI", sans-serif;
  font-weight: 800;
  font-size: 1.3rem;
  letter-spacing: 0.02em;
  line-height: 1.05;
  text-align: center;
}

.brand-subtitle {
  margin: 0;
  margin-top: 0.1rem;
  color: var(--muted);
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  text-align: center;
}

.brand-note {
  margin: 0;
  margin-top: 0.16rem;
  color: #4f5d6b;
  font-size: 0.82rem;
  line-height: 1.4;
  text-align: center;
  max-width: 74ch;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 1.15rem 1.2rem;
  backdrop-filter: blur(14px);
  box-shadow: 0 6px 24px #0b11180d;
  min-width: 0;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: -0.01em;
}

h1 {
  font-size: 1rem;
  line-height: 1.45;
  font-weight: 800;
  letter-spacing: 0;
}

h2 {
  font-size: 1.22rem;
}

h3 {
  font-size: 0.93rem;
  margin-bottom: 0.4rem;
}

.lede {
  margin: 0.75rem 0 1rem;
  color: var(--muted);
  max-width: 74ch;
  font-size: 1rem;
}

.query-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.72rem;
}

.row {
  display: grid;
  gap: 0.4rem;
}

.row-full {
  grid-column: 1 / -1;
}

label {
  font-size: 0.84rem;
  color: #43505d;
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  background: var(--card-solid);
  color: var(--ink);
  border-radius: 14px;
  padding: 0.75rem 0.8rem;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

textarea {
  resize: vertical;
  min-height: 170px;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #9da8b4;
  box-shadow: 0 0 0 3px #dce2e8;
}

.actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 0.5rem;
  margin-top: 0.2rem;
}

button {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.62rem 1rem;
  cursor: pointer;
  transition: transform 160ms ease, opacity 160ms ease, background-color 160ms ease;
  font-weight: 600;
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

#submit-btn,
#compare-btn {
  background: var(--accent);
  color: #fff;
}

.button-subtle {
  background: var(--accent-soft);
  color: #2a333c;
  border-color: var(--line);
}

.status {
  margin: 0.75rem 0 0;
  color: var(--muted);
  min-height: 1.3rem;
}

.status-error {
  color: var(--bad);
}

.progress {
  margin-top: 0.68rem;
  height: 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #eef2f6;
  overflow: hidden;
}

.progress-fill {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #98a3af 0%, #1a2028 100%);
  transition: width 280ms ease;
}

.analysis-head {
  display: flex;
  justify-content: space-between;
  gap: 0.9rem;
  align-items: center;
}

#analysis:not(.hidden) {
  display: grid;
  gap: 0.68rem;
}

.score-pill {
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: #f8fafc;
  padding: 0.35rem 0.6rem;
  min-width: 95px;
  text-align: right;
}

.score-pill span {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.1;
}

.score-pill strong {
  font-family: "IBM Plex Mono", "Menlo", monospace;
  font-size: 1.02rem;
}

.meta {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 0.83rem;
}

.overview {
  margin: 0;
  font-size: clamp(1.06rem, 1.2vw, 1.28rem);
  line-height: 1.66;
  letter-spacing: -0.01em;
  color: #15202b;
}

.answer-hero {
  margin: 0;
  padding: 0.98rem 1.02rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f9fbfd 100%);
}

.answer-hero h3 {
  margin: 0 0 0.48rem;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #546271;
}

.dimensions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.62rem;
  margin: 0;
}

.metric {
  border: 1px solid var(--line);
  background: #fafbfc;
  border-radius: 13px;
  padding: 0.58rem 0.65rem;
}

.metric-head {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: baseline;
  margin-bottom: 0.35rem;
  font-size: 0.8rem;
}

.metric-head strong {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.86rem;
}

.metric-track {
  height: 7px;
  border-radius: 999px;
  background: #e6ebf1;
  overflow: hidden;
}

.metric-track span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #9aa4af, #15191e);
  transition: width 360ms ease;
}

.grid-two {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.62rem;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fbfcfd;
  padding: 0.72rem 0.78rem;
  min-width: 0;
}

.panel p {
  margin: 0;
}

.scorecard-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
}

.scorecard-overall {
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 0.24rem 0.64rem;
  font-family: "IBM Plex Mono", monospace;
  font-weight: 600;
  background: #ffffff;
  text-transform: uppercase;
  font-size: 0.76rem;
  letter-spacing: 0.03em;
}

.snapshot-wrap {
  margin-top: 0.58rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  background: #ffffff;
}

.snapshot-table {
  width: 100%;
  min-width: 1280px;
  border-collapse: collapse;
  table-layout: fixed;
}

.snapshot-table td {
  border-bottom: 1px solid #eef2f6;
  border-right: 1px solid #f2f5f8;
  padding: 0.34rem 0.42rem;
  vertical-align: middle;
  overflow: hidden;
}

.snapshot-table tr:last-child td {
  border-bottom: none;
}

.snapshot-table td:last-child {
  border-right: none;
}

.snapshot-label {
  display: block;
  max-width: 100%;
  font-size: 0.77rem;
  font-weight: 600;
  color: #5c6a78;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: help;
}

.snapshot-value {
  font-size: 0.81rem;
  min-width: 0;
}

.snapshot-value-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.34rem;
  min-width: 0;
  width: 100%;
}

.snapshot-value-main {
  display: block;
  max-width: 100%;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.79rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: help;
}

.snapshot-message {
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
}

.snapshot-empty {
  background: #fbfcfd;
}

ul {
  margin: 0;
  padding-left: 1.1rem;
}

li {
  margin-bottom: 0.35rem;
}

a {
  color: #1d5e7f;
}

.news-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.6rem;
}

.news-item {
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 0.62rem 0.7rem;
  background: #ffffff;
}

.news-top {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.news-top a {
  font-size: 0.88rem;
}

.meta,
.overview,
.panel p,
.news-top a,
.history-subtitle {
  overflow-wrap: anywhere;
}

.stance {
  display: inline-block;
  min-width: 52px;
  text-align: center;
  text-transform: uppercase;
  font-size: 0.66rem;
  letter-spacing: 0.05em;
  border-radius: 999px;
  padding: 0.14rem 0.38rem;
  border: 1px solid var(--line-strong);
}

.stance-bull {
  background: #e8f7f2;
  color: #1a6a54;
}

.stance-bear {
  background: #fdeef0;
  color: #8f2231;
}

.stance-neutral {
  background: #f3f5f7;
  color: #4d5a66;
}

.news-meta,
.news-why {
  margin: 0.24rem 0 0;
  font-size: 0.79rem;
  color: var(--muted);
}

.news-why {
  color: #465462;
}

.history-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

.history-actions {
  display: flex;
  gap: 0.45rem;
}

.history-list {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}

.history-item {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 0.7rem;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.52rem 0.58rem;
  background: #fcfdff;
}

.history-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
}

.history-main {
  min-width: 0;
}

.history-title {
  margin: 0;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-subtitle {
  margin: 0.05rem 0 0;
  color: var(--muted);
  font-size: 0.79rem;
}

.history-score {
  min-width: 58px;
  text-align: right;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.89rem;
}

.history-empty {
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  padding: 0.7rem;
  color: var(--muted);
  text-align: center;
}

.table-wrap {
  margin-top: 0.6rem;
  overflow-x: auto;
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

.compare-table th,
.compare-table td {
  border-bottom: 1px solid var(--line);
  padding: 0.55rem 0.4rem;
  text-align: left;
  font-size: 0.84rem;
  vertical-align: top;
}

.compare-table th {
  font-size: 0.79rem;
  color: #2e3a45;
  font-weight: 700;
  background: #f8fafc;
}

.hidden {
  display: none;
}

.fade-in {
  animation: fadeIn 420ms ease both;
}

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

@media (max-width: 900px) {
  .query-form,
  .dimensions,
  .grid-two {
    grid-template-columns: 1fr;
  }

  .topbar {
    padding-bottom: 0.35rem;
  }

  .brand-logo {
    height: 156px;
  }

  .brand-name {
    margin-top: -10px;
    font-size: 1.06rem;
    letter-spacing: 0.015em;
  }

  .brand-subtitle {
    margin-top: 0.08rem;
    font-size: 0.84rem;
  }

  .brand-note {
    margin-top: 0.12rem;
    font-size: 0.76rem;
    max-width: 92vw;
  }

  .history-item {
    grid-template-columns: auto 1fr auto;
  }

  .history-item .open-run {
    grid-column: 2 / -1;
    justify-self: end;
  }

  .news-top {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.25rem;
  }
}
