/* ── RESET & BASE ─────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0f1117;
  --surface: #1a1d2e;
  --surface2: #242736;
  --surface3: #2d3147;
  --border: #2e3250;
  --border-soft: #363a52;
  --accent: #f97316;
  --accent-glow: rgba(249, 115, 22, 0.15);
  --accent-lo: rgba(249, 115, 22, 0.1);
  --text: #f1f5f9;
  --text-2: #cbd5e1;
  --muted: #64748b;
  --muted2: #475569;
  --low: #22c55e;
  --low-bg: rgba(34, 197, 94, 0.1);
  --moderate: #eab308;
  --moderate-bg: rgba(234, 179, 8, 0.1);
  --high: #f97316;
  --high-bg: rgba(249, 115, 22, 0.1);
  --critical: #ef4444;
  --critical-bg: rgba(239, 68, 68, 0.1);
  --mono: "JetBrains Mono", "Fira Code", monospace;
  --sans: "Inter", system-ui, sans-serif;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── LAYOUT ───────────────────────────────────── */
.page-wrapper {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

/* ── HEADER ───────────────────────────────────── */
.site-header {
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: rgba(15, 17, 23, 0.9);
  backdrop-filter: blur(12px);
  z-index: 100;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse 2.5s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.3;
    transform: scale(0.8);
  }
}

.brand-text {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand-text strong {
  color: var(--accent);
  font-weight: 600;
}

.header-meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--border-soft);
  padding: 4px 12px;
  border-radius: 20px;
}

/* ── HERO ─────────────────────────────────────── */
.hero {
  padding: 64px 0 48px;
  text-align: center;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  border: 1px solid rgba(249, 115, 22, 0.25);
  background: var(--accent-lo);
  padding: 5px 14px;
  border-radius: 20px;
  margin-bottom: 24px;
}

.hero-eyebrow span {
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
}

.hero h1 {
  font-size: clamp(26px, 4vw, 40px);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 20px;
  color: var(--text);
}

.hero h1 em {
  font-style: normal;
  color: var(--accent);
}

.hero-desc {
  font-size: 15px;
  color: var(--text-2);
  line-height: 1.75;
  max-width: 620px;
  margin: 0 auto 32px;
}

.hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.tag {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 4px 12px;
  border-radius: 6px;
}

/* ── DIVIDER ──────────────────────────────────── */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0 0 40px;
}

/* ── SECTION LABEL ────────────────────────────── */
.section-label {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  display: block;
  margin-bottom: 12px;
}

/* ── MODEL SELECTOR ───────────────────────────── */
.model-selector {
  margin-bottom: 32px;
}

.model-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.model-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  cursor: pointer;
  transition:
    border-color 0.2s,
    background 0.2s,
    box-shadow 0.2s;
  position: relative;
  user-select: none;
}

.model-card:hover {
  border-color: var(--border-soft);
  box-shadow: var(--shadow-sm);
}

.model-card.active {
  border-color: var(--accent);
  background: var(--accent-lo);
  box-shadow:
    0 0 0 1px var(--accent),
    var(--shadow-sm);
}

.best-tag {
  position: absolute;
  top: -1px;
  right: -1px;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: var(--accent);
  color: #fff;
  padding: 3px 8px;
  border-radius: 0 var(--radius-sm) 0 var(--radius-sm);
}

.mc-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.mc-recall {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}

.mc-recall strong {
  color: var(--accent);
}

/* ── FORM ─────────────────────────────────────── */
.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.fg {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.fg.full {
  grid-column: span 2;
}

.fg label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
}

.fg .hint {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
}

select,
input[type="number"] {
  background: var(--surface2);
  border: 1px solid var(--border-soft);
  color: var(--text);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--sans);
  outline: none;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
}

select:focus,
input[type="number"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

select option {
  background: var(--surface2);
}

/* ── SUBMIT ───────────────────────────────────── */
.btn-predict {
  width: 100%;
  padding: 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  font-family: var(--sans);
  cursor: pointer;
  letter-spacing: 0.02em;
  transition:
    opacity 0.2s,
    transform 0.1s;
  margin-top: 22px;
}

.btn-predict:hover:not(:disabled) {
  opacity: 0.88;
  transform: translateY(-1px);
}
.btn-predict:active:not(:disabled) {
  transform: translateY(0);
}
.btn-predict:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.loading-row {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
  padding: 10px 0 0;
}

.loading-row.on {
  display: flex;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* ── PLACEHOLDER ──────────────────────────────── */
.placeholder-card {
  background: var(--surface);
  border: 1px dashed var(--border-soft);
  border-radius: var(--radius);
  padding: 56px 32px;
  text-align: center;
}

.placeholder-icon {
  font-size: 40px;
  margin-bottom: 16px;
}

.placeholder-card h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 8px;
}

.placeholder-card p {
  font-size: 13px;
  color: var(--muted);
  max-width: 320px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ── RESULT ───────────────────────────────────── */
.result-section {
  display: none;
}
.result-section.on {
  display: block;
}

.result-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

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

.result-prediction {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
}

.sev-badge {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 5px 14px;
  border-radius: 20px;
  white-space: nowrap;
  margin-top: 4px;
}

.sev-low {
  background: var(--low-bg);
  color: var(--low);
}
.sev-moderate {
  background: var(--moderate-bg);
  color: var(--moderate);
}
.sev-high {
  background: var(--high-bg);
  color: var(--high);
}
.sev-critical {
  background: var(--critical-bg);
  color: var(--critical);
}

.pred-low {
  color: var(--low);
}
.pred-moderate {
  color: var(--moderate);
}
.pred-high {
  color: var(--high);
}
.pred-critical {
  color: var(--critical);
}

/* confidence bar */
.conf-section {
  margin-bottom: 22px;
}

.conf-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.conf-label-row span:first-child {
  font-size: 12px;
  color: var(--muted);
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.conf-label-row span:last-child {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.bar-bg {
  background: var(--surface3);
  border-radius: 6px;
  height: 8px;
  overflow: hidden;
}

.bar-fill {
  height: 8px;
  border-radius: 6px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* action */
.action-box {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
}

.action-box-label {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 6px;
}

.action-box p {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.65;
}

/* detail cards */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.detail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
}

.detail-card .dk {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 5px;
}

.detail-card .dv {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.model-tag {
  text-align: center;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  margin-top: 16px;
}

.model-tag strong {
  color: var(--accent);
}

/* ── FOOTER ───────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  flex-wrap: wrap;
  gap: 8px;
}

.site-footer a {
  color: var(--accent);
  text-decoration: none;
}

/* ── RESPONSIVE ───────────────────────────────── */
@media (max-width: 640px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
  .fg.full {
    grid-column: span 1;
  }
  .model-grid {
    grid-template-columns: 1fr;
  }
  .detail-grid {
    grid-template-columns: 1fr;
  }
  .result-top-row {
    flex-direction: column;
    gap: 12px;
  }
  .hero {
    padding: 40px 0 32px;
  }
  .hero h1 {
    font-size: 24px;
  }
  .site-footer {
    flex-direction: column;
    text-align: center;
  }
}
