:root {
  --bg: #f7f4ef;
  --panel: #fffdf9;
  --panel-soft: #fbf6ec;
  --ink: #2d1a12;
  --muted: #746a62;
  --line: #e6ddd3;
  --coffee: #5a2a13;
  --coffee-dark: #3d1b0d;
  --green: #126b22;
  --green-soft: #eaf5e6;
  --fair: #c08a18;
  --fair-soft: #fff3cf;
  --red: #d85d55;
  --red-dark: #c92a28;
  --red-soft: #fff0ed;
  --yellow: #f2cd6b;
  --shadow: 0 10px 30px rgba(47, 30, 18, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 20% 0%, rgba(255, 255, 255, 0.95), transparent 34rem),
    var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  background: rgba(255, 253, 249, 0.88);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 4px 18px rgba(47, 30, 18, 0.07);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--coffee);
  font-size: 24px;
}

.brand-name {
  font-size: 26px;
  font-weight: 800;
  white-space: nowrap;
}

.tagline {
  color: var(--muted);
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav {
  display: flex;
  gap: 18px;
}

button {
  font: inherit;
}

.nav-button,
.ghost-button {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  padding: 24px 40px 36px;
  max-width: 1760px;
  margin: 0 auto;
}

.content-grid {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 24px;
  align-items: start;
}

.main-column,
.side-column {
  min-width: 0;
  display: grid;
  gap: 16px;
  align-content: start;
}

.panel {
  min-width: 0;
  background: rgba(255, 253, 249, 0.95);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.input-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 620px;
  gap: 28px;
  align-items: center;
  padding: 18px 28px;
}

label {
  display: block;
  margin-bottom: 6px;
  font-weight: 650;
}

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

input {
  width: 100%;
  height: 46px;
  border: 1px solid #cfc6bd;
  border-radius: 6px;
  padding: 0 16px;
  font-size: 16px;
  color: var(--ink);
  background: #fff;
}

.primary-button {
  height: 46px;
  border: 0;
  border-radius: 6px;
  background: var(--coffee);
  color: #fff;
  font-weight: 750;
  cursor: pointer;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.2);
}

.primary-button:disabled {
  opacity: 0.68;
  cursor: wait;
}

.progress {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr auto;
  align-items: center;
  gap: 10px;
  margin: 0;
  max-width: none;
}

.step {
  display: grid;
  justify-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.step-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #d8d1ca;
  color: #fff;
  font-size: 13px;
}

.step.active .step-dot,
.step.done .step-dot {
  background: #1f982e;
}

.step-line {
  height: 2px;
  background: #d8d1ca;
  transform: translateY(-13px);
}

.status-text {
  grid-column: 2;
  margin: -8px 0 0;
  min-height: 20px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.panel h2 {
  margin: 0;
  padding: 14px 22px 12px;
  font-size: 20px;
  border-bottom: 1px solid var(--line);
}

.hero-verdict {
  --verdict-color: var(--green);
  --verdict-soft: var(--green-soft);
  position: relative;
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) 210px minmax(500px, 1.5fr);
  gap: 22px;
  align-items: center;
  padding: 28px 36px;
  border-color: var(--verdict-color);
  box-shadow: 0 14px 36px rgba(47, 30, 18, 0.12);
  overflow: hidden;
}

.hero-verdict::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 8px;
  background: var(--verdict-color);
}

.hero-verdict.is-pending,
.hero-verdict.is-loading {
  --verdict-color: #8d8176;
  --verdict-soft: #f0ebe5;
}

.hero-verdict.is-insufficient {
  --verdict-color: #8d8176;
  --verdict-soft: #f0ebe5;
}

.hero-verdict.is-good-value {
  --verdict-color: var(--green);
  --verdict-soft: var(--green-soft);
}

.hero-verdict.is-fair {
  --verdict-color: var(--fair);
  --verdict-soft: var(--fair-soft);
}

.hero-verdict.is-expensive {
  --verdict-color: var(--red-dark);
  --verdict-soft: var(--red-soft);
}

.hero-verdict.is-loading .hero-copy,
.hero-verdict.is-loading .hero-gauge,
.hero-verdict.is-loading .hero-metrics {
  opacity: 0.32;
}

.result-overlay {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  gap: 14px;
  color: var(--ink);
  background: rgba(255, 253, 249, 0.64);
  backdrop-filter: blur(1px);
  z-index: 2;
}

.hero-verdict.is-loading .result-overlay {
  display: grid;
}

.spinner {
  width: 34px;
  height: 34px;
  border: 4px solid #d7cdc3;
  border-top-color: var(--coffee);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.result-overlay strong {
  padding: 7px 12px;
  border: 1px solid #d7cdc3;
  border-radius: 999px;
  background: rgba(255, 253, 249, 0.92);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

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

.hero-copy {
  min-width: 0;
}

.eyebrow {
  display: block;
  margin-bottom: 10px;
  color: var(--verdict-color);
  font-size: 15px;
  font-weight: 850;
  text-transform: uppercase;
}

.verdict {
  color: var(--verdict-color);
  font-size: 42px;
  font-weight: 850;
  line-height: 1.06;
}

.hero-copy p {
  max-width: 560px;
  margin: 16px 0 0;
  font-size: 17px;
  line-height: 1.45;
}

.hero-gauge {
  min-width: 0;
  display: grid;
  place-items: center;
}

.hero-metrics {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 249, 0.88);
  overflow: hidden;
}

.hero-metric {
  min-width: 0;
  min-height: 154px;
  display: grid;
  grid-template-rows: 42px 54px 40px;
  align-content: center;
  gap: 10px;
  padding: 18px 18px;
  border-right: 1px solid var(--line);
}

.hero-metric:last-child {
  border-right: 0;
}

.hero-metric span {
  align-self: start;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.15;
  font-weight: 800;
  text-transform: uppercase;
}

.hero-metric strong {
  display: flex;
  align-items: baseline;
  gap: 2px;
  align-self: center;
  color: var(--ink);
  font-size: clamp(30px, 2.4vw, 44px);
  line-height: 1;
  white-space: nowrap;
}

.hero-metric strong small {
  color: var(--muted);
  font-size: 0.48em;
  font-weight: 650;
}

.rating-denominator {
  transform: translateY(0.1em);
}

#predictedRating {
  color: inherit;
  font-size: inherit;
}

.hero-metric em {
  align-self: start;
  color: var(--muted);
  font-style: normal;
  font-size: 16px;
  overflow-wrap: anywhere;
}

.hero-metric em[id="ratingLabel"] {
  justify-self: start;
  padding: 5px 12px;
  border: 1px solid #cfe5c9;
  border-radius: 6px;
  color: var(--green);
  background: var(--green-soft);
  font-size: 14px;
  font-weight: 700;
}

.hero-metric.premium strong,
#pricePremium.is-expensive {
  color: var(--red-dark);
}

#pricePremium.is-value {
  color: var(--green);
}

.summary-panel {
  padding-bottom: 14px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0 18px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.summary-row {
  min-width: 0;
  min-height: 38px;
  display: grid;
  grid-template-columns: minmax(115px, 0.42fr) minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}

.summary-row:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.summary-row:nth-child(odd) {
  border-right: 1px solid var(--line);
}

.row-label {
  color: var(--muted);
}

.row-value {
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.25;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 4px 12px;
  border: 1px solid #cfe5c9;
  border-radius: 6px;
  color: #145d21;
  background: var(--green-soft);
  font-weight: 650;
  font-size: 14px;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 44px;
  padding: 0 22px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  padding: 16px 18px 8px;
}

.metric-card {
  min-height: 86px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
  text-align: center;
  min-width: 0;
  padding: 8px;
}

.metric-card span {
  color: var(--ink);
  font-size: 14px;
}

.metric-card strong {
  color: var(--green);
  font-size: 22px;
  overflow-wrap: anywhere;
}

.model-line {
  margin: 0 0 10px;
  text-align: center;
  color: var(--muted);
}

.warnings-panel {
  padding-bottom: 14px;
}

.inline-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
  padding: 12px 22px 0;
}

.inline-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 14px;
}

.inline-item::before {
  content: "✓";
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #1f982e;
  color: #fff;
  font-size: 12px;
}

.inline-item.warn::before {
  content: "!";
  background: #b45a13;
}

.details-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.details-header h2 {
  border-bottom: 0;
}

.ghost-button {
  padding: 12px 22px;
  font-size: 22px;
  color: var(--ink);
}

.tabs {
  display: flex;
  gap: 28px;
  padding: 10px 22px 0;
  border-bottom: 1px solid var(--line);
}

.tab {
  border: 0;
  background: transparent;
  padding: 0 0 10px;
  color: var(--ink);
  cursor: pointer;
  border-bottom: 3px solid transparent;
}

.tab.active {
  border-bottom-color: var(--coffee);
  font-weight: 700;
}

.code-block {
  margin: 12px;
  padding: 16px 18px;
  min-height: 96px;
  max-height: 320px;
  overflow: auto;
  border-radius: 6px;
  background: #14191c;
  color: #f2f2e8;
  font: 13px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.gauge {
  width: min(260px, 100%);
  height: 150px;
  display: block;
  margin: 0 auto;
}

.gauge-arc {
  fill: none;
  stroke-width: 15;
  stroke-linecap: butt;
}

.gauge-red {
  stroke: #e46862;
}

.gauge-yellow {
  stroke: #f2cf70;
}

.gauge-green {
  stroke: #63b95c;
}

.needle-line {
  stroke: #2d2518;
  stroke-width: 5;
  stroke-linecap: round;
}

.needle-hub {
  fill: #2d2518;
  stroke: #fff8e8;
  stroke-width: 4;
}

.quality-card,
.checks-card {
  padding-bottom: 14px;
}

.quality-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 18px;
  border-bottom: 1px solid var(--line);
}

.quality-row:last-child {
  border-bottom: 0;
}

.quality-row strong {
  color: var(--green);
}

.checks-card ul {
  list-style: none;
  margin: 0;
  padding: 8px 22px 12px;
}

.checks-card li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
}

.checks-card li::before {
  content: "✓";
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--coffee);
  font-size: 12px;
}

.hidden {
  display: none;
}

.about-dialog {
  width: min(760px, calc(100vw - 32px));
  max-height: min(680px, calc(100vh - 32px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--panel);
  box-shadow: 0 24px 80px rgba(47, 30, 18, 0.28);
}

.about-dialog::backdrop {
  background: rgba(45, 26, 18, 0.28);
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.dialog-header h2 {
  border-bottom: 0;
}

.dialog-header {
  gap: 18px;
  padding-left: 22px;
}

.dialog-header .eyebrow {
  margin-bottom: 4px;
  color: var(--coffee);
  font-size: 12px;
}

.dialog-header h2 {
  padding: 0;
}

.about-body {
  display: grid;
  gap: 20px;
  padding: 18px 22px 22px;
  overflow: auto;
}

.about-body p {
  margin: 0;
  color: var(--ink);
  line-height: 1.55;
}

.about-section {
  display: grid;
  gap: 10px;
}

.about-section h3 {
  margin: 0;
  color: var(--coffee-dark);
  font-size: 15px;
  text-transform: uppercase;
}

.highlight-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.highlight-list li {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
  line-height: 1.35;
}

.highlight-list li::before {
  content: "✓";
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--coffee);
  font-size: 12px;
  transform: translateY(1px);
}

.repo-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.repo-links a {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: inherit;
  background: var(--panel-soft);
  text-decoration: none;
}

.repo-links a:hover {
  border-color: #c8b6a5;
  background: #fffaf2;
}

.repo-links strong,
.repo-links span {
  overflow-wrap: anywhere;
}

.repo-links span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.3;
}

@media (max-width: 1320px) {
  .content-grid,
  .hero-verdict,
  .input-panel {
    grid-template-columns: 1fr;
  }

  .shell {
    max-width: 820px;
    padding-inline: 24px;
  }

  .status-text {
    grid-column: 1;
  }

  .hero-verdict {
    justify-items: stretch;
  }

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

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

@media (max-width: 760px) {
  .topbar {
    height: auto;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
  }

  .brand {
    flex-wrap: wrap;
  }

  .brand-name {
    font-size: 22px;
  }

  .tagline {
    width: 100%;
    white-space: normal;
  }

  .nav {
    flex: 0 0 auto;
    gap: 8px;
  }

  .nav-button {
    padding: 8px 0;
    white-space: nowrap;
  }

  .shell {
    padding: 16px;
  }

  .input-row,
  .summary-grid,
  .metric-grid,
  .hero-metrics {
    grid-template-columns: 1fr;
  }

  .hero-verdict {
    padding: 24px;
  }

  .verdict {
    font-size: 34px;
  }

  .hero-metric {
    min-height: 120px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .hero-metric:last-child {
    border-bottom: 0;
  }

  .hero-metric strong {
    font-size: 36px;
  }

  .summary-row {
    grid-template-columns: 120px minmax(0, 1fr);
    border-right: 0 !important;
  }

  .summary-row:nth-last-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .progress {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .step {
    grid-template-columns: 24px 1fr;
    justify-items: start;
    text-align: left;
  }

  .step-line {
    display: none;
  }

  .repo-links {
    grid-template-columns: 1fr;
  }

  .tabs {
    gap: 14px;
    overflow-x: auto;
  }
}
