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

:root {
  --bg: #0c0f14;
  --surface: #141a22;
  --border: #243044;
  --border-strong: #324056;
  --text: #e8edf5;
  --muted: #8b9cb3;
  --text-muted: #8b9cb3;
  --accent: #3dd6c6;
  --accent-dim: #2a9d8f;
  --accent-soft: rgba(61, 214, 198, 0.08);
  --accent-soft-strong: rgba(61, 214, 198, 0.12);
  --warn: #f4a261;
  --err: #ef6b6b;
  --ok: #3dd6c6;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.35);
  --font: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", "SF Mono", Consolas, monospace;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(
    1200px 800px at 10% -10%,
    #132028 0%,
    var(--bg) 55%
  );
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.55;
}

.shell {
  max-width: 640px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
}

.hero {
  margin-bottom: 2rem;
}

.hero .brand {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1rem 0;
}

.hero-rule {
  margin: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--border),
    transparent
  );
  border: 0;
}

.step-footer-rule {
  margin-top: 1.5rem;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--accent-dim), var(--accent));
  color: var(--bg);
  font-weight: 700;
  font-size: 1.35rem;
}

h1 {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.tagline {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  font-weight: 400;
}

.step-heading {
  margin: 0 0 1.25rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.01em;
  text-transform: none;
}

h2:not(.step-heading) {
  margin: 0 0 1rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.5rem 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.step-card {
  padding-top: 1.5rem;
}

/* —— GitHub connection strip —— */
.connection-strip {
  margin-bottom: 1.5rem;
  padding: 1rem 1.15rem;
  background: rgba(19, 32, 40, 0.65);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.connection-strip-label {
  margin: 0 0 0.5rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.connection-strip-body {
  min-height: 2.75rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.connection-state.hidden {
  display: none !important;
}

.connection-loading-text {
  color: var(--muted);
  font-size: 0.95rem;
}

.connection-state-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
}

.connection-ok {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent);
}

.connection-error {
  margin: 0.5rem 0 0;
  font-size: 0.9rem;
  color: var(--err);
}

.connection-error.hidden {
  display: none !important;
}

.step2-lead {
  margin: 0 0 1rem;
  font-size: 0.95rem;
  color: var(--muted);
}

.stage-radios,
.review-kind-radios {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.stage-option,
.review-kind-option {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  background: var(--surface);
}

.stage-option:has(input:checked),
.review-kind-option:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: var(--shadow-sm);
}

.stage-option input,
.review-kind-option input {
  margin-top: 0.2rem;
  accent-color: var(--accent);
}

.stage-option span,
.review-kind-option span {
  flex: 1;
  font-size: 0.95rem;
  color: var(--text);
}

.mode-toggle {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.mode-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: var(--surface);
}

.mode-option:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.mode-option input {
  accent-color: var(--accent);
}

.mode-option span {
  color: var(--text);
  font-size: 0.95rem;
}

.github-panel {
  margin-top: 1.25rem;
}

.paste-panel.hidden {
  display: none !important;
}

.field-label {
  margin: 1rem 0 0.5rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.browse-hint {
  margin: 0 0 0.35rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.reviewing-banner {
  margin: 0.5rem 0 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
}

.reviewing-banner.hidden {
  display: none !important;
}

.browser-block {
  margin-top: 1rem;
}

.tree-panel.hidden,
.latest-panel.hidden {
  display: none !important;
}

.latest-title {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
}

.latest-sub {
  margin: 0 0 0.85rem;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.5;
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
}

.row.actions {
  margin-top: 0.25rem;
  align-items: center;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 200px;
}

.field.grow {
  flex: 1;
  min-width: 180px;
}

.field span {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

select,
textarea {
  font-family: var(--font);
  font-size: 0.95rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  box-shadow: var(--shadow-sm);
}

textarea {
  width: 100%;
  resize: vertical;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.45;
  min-height: 200px;
}

select:focus,
textarea:focus {
  outline: 2px solid rgba(61, 214, 198, 0.35);
  outline-offset: 1px;
  border-color: var(--accent);
}

.btn {
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.6rem 1.1rem;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s,
    box-shadow 0.15s, filter 0.15s;
}

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

.btn.primary {
  background: linear-gradient(145deg, var(--accent-dim), var(--accent));
  color: var(--bg);
  box-shadow: var(--shadow-sm);
}

.btn.primary:hover:not(:disabled) {
  filter: brightness(1.06);
}

.btn.secondary {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}

.btn.secondary:hover:not(:disabled) {
  border-color: var(--muted);
}

.btn-nav {
  background: linear-gradient(145deg, var(--accent-dim), var(--accent));
  color: var(--bg);
  padding: 0.65rem 1.15rem;
  box-shadow: var(--shadow-sm);
}

.btn-nav:hover:not(:disabled) {
  filter: brightness(1.06);
}

.btn-disconnect {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-weight: 600;
}

.btn-disconnect:hover:not(:disabled) {
  border-color: var(--muted);
  color: var(--text);
}

.btn-run-review {
  padding: 0.7rem 1.35rem;
  font-size: 1rem;
}

.btn-select-level {
  margin-bottom: 0.5rem;
  width: 100%;
  max-width: 100%;
}

.status {
  font-size: 0.88rem;
  color: var(--muted);
}

.status.err {
  color: var(--err);
}

.status.ok {
  color: var(--accent);
}

.hidden {
  display: none !important;
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  margin: 0.5rem 0 0.65rem;
  font-size: 0.88rem;
}

.breadcrumbs button {
  font: inherit;
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 500;
}

.breadcrumbs span.sep {
  color: var(--muted);
}

.tree {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  box-shadow: var(--shadow-sm);
}

.tree li.tree-row {
  display: flex;
  align-items: stretch;
  gap: 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.tree li.tree-row:last-child {
  border-bottom: none;
}

.tree li.tree-row.is-selected {
  background: var(--accent-soft-strong);
  box-shadow: inset 3px 0 0 var(--accent);
}

.tree-msg {
  padding: 0.85rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.tree-open {
  flex: 0 0 auto;
  width: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--muted);
  padding: 0;
}

.tree-open:hover {
  color: var(--accent);
  background: rgba(255, 255, 255, 0.04);
}

.tree-open-spacer {
  cursor: default;
  pointer-events: none;
}

.tree-ico {
  display: block;
  width: 1.1rem;
  height: 1.1rem;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

.tree-ico-dir {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%233dd6c6'%3E%3Cpath d='M10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z'/%3E%3C/svg%3E");
  opacity: 0.9;
}

.tree-ico-file {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%238b9cb3'%3E%3Cpath d='M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm2 16H8v-2h8v2zm0-4H8v-2h8v2zm-3-5V3.5L18.5 9H13z'/%3E%3C/svg%3E");
}

.tree-label {
  flex: 1;
  text-align: left;
  font: inherit;
  color: var(--text);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.55rem 0.65rem 0.55rem 0;
  font-family: var(--mono);
  font-size: 0.84rem;
}

.tree-label:hover {
  color: var(--accent);
}

.pr-list {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
}

.pr-list li {
  margin-bottom: 0.35rem;
}

.pr-list button {
  font: inherit;
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  padding: 0;
  text-align: left;
  font-weight: 500;
}

.build-report {
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--muted);
}

.build-report[hidden] {
  display: none !important;
}

.report-rule {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1rem 0;
}

.report-title {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.report-meta {
  margin: 0 0 1rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.report-meta strong {
  color: var(--text);
  font-weight: 600;
}

.report-section {
  margin-bottom: 1.35rem;
}

.report-section h3 {
  margin: 0 0 0.5rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.report-verdict {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text);
}

.build-report ol,
.build-report ul {
  margin: 0.35rem 0 0;
  padding-left: 1.2rem;
}

.build-report li {
  margin-bottom: 0.45rem;
}

.fix-effort {
  display: inline-block;
  margin-right: 0.45rem;
  padding: 0.12rem 0.4rem;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  border-radius: 4px;
  vertical-align: middle;
}

.fix-effort-quick {
  color: #0d3d2a;
  background: rgba(61, 214, 198, 0.35);
  border: 1px solid rgba(61, 214, 198, 0.55);
}

.fix-effort-medium {
  color: #3d2e0d;
  background: rgba(230, 180, 80, 0.35);
  border: 1px solid rgba(230, 180, 80, 0.5);
}

.fix-effort-complex {
  color: #f0e8ec;
  background: rgba(200, 72, 90, 0.45);
  border: 1px solid rgba(230, 120, 130, 0.65);
}

.build-report li:last-child {
  margin-bottom: 0;
}

.file-list {
  list-style: none;
  padding: 0;
  margin: 0.35rem 0 0;
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--muted);
}

.file-list li {
  margin-bottom: 0.25rem;
  padding: 0.25rem 0;
  border-bottom: 1px solid var(--border);
}

.file-list li:last-child {
  border-bottom: none;
}

.score-rows {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 0.5rem;
}

.score-row {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.score-row-main {
  display: grid;
  grid-template-columns: 7.5rem 1fr 3rem;
  align-items: center;
  gap: 0.65rem;
}

.score-note {
  margin: 0 0 0.15rem;
  padding-left: 0.15rem;
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--muted);
}

.score-label {
  font-size: 0.82rem;
  color: var(--muted);
  text-transform: capitalize;
}

.score-bar-wrap {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.score-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-dim), var(--accent));
  border-radius: 4px;
  min-width: 0;
  transition: width 0.35s ease;
}

.score-num {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--accent);
  font-weight: 600;
  text-align: right;
}

.result-card h2 {
  color: var(--accent);
  font-size: 1.15rem;
}

@media (max-width: 520px) {
  .score-row-main {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }

  .score-num {
    text-align: left;
  }
}
