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

/* ── Design tokens ── */
:root {
  --bg:        #0d0f0e;
  --surface:   #141714;
  --border:    #252925;
  --border-hi: #3a3f3a;
  --text:      #e8ede9;
  --muted:     #7a8c7b;
  --accent:    #a8d5a2;
  --accent-hi: #c6e8c1;
  --danger:    #e07a5f;
  --radius:    14px;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Epilogue', sans-serif;
  font-weight: 400;
  font-size: 15px;
  line-height: 1.65;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Noise overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

/* ── Layout ── */
.wrap {
  position: relative;
  z-index: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Header ── */
header {
  padding: 48px 0 40px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-mark {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent) 0%, #5a9e52 100%);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.logo-mark svg {
  width: 22px;
  height: 22px;
  color: #0d0f0e;
}

.logo-name {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -0.5px;
  color: var(--text);
}

.logo-name span { color: var(--accent); }

.badge {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 999px;
}

.page-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 0 24px;
  margin-top: -8px;
}

.page-tab {
  appearance: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-family: 'Epilogue', sans-serif;
  font-size: 13px;
  font-weight: 500;
  padding: 10px 16px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s, transform 0.2s;
}

.page-tab:hover {
  color: var(--text);
  border-color: var(--border-hi);
  transform: translateY(-1px);
}

.page-tab.active {
  color: #0d0f0e;
  background: var(--accent);
  border-color: var(--accent);
}

.page-pane {
  display: none;
}

.page-pane.active {
  display: block;
  animation: fadeUp 0.3s ease both;
}

/* ── Hero ── */
.hero {
  padding: 72px 0 56px;
}

.hero-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 20px;
}

.hero h1 {
  font-family: 'Syne', sans-serif;
  font-weight: 850;
  font-size: clamp(36px, 6vw, 58px);
  line-height: 1.08;
  letter-spacing: -1.5px;
  color: var(--text);
  max-width: 640px;
  margin-bottom: 22px;
}


.hero h2 {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: clamp(18px, 3vw, 24px);
  line-height: 1.08;
  letter-spacing: -0.3px;
  color: var(--text);
  max-width: 540px;
  margin-bottom: 28px;
}

.hero p {
  font-size: 16px;
  color: var(--muted);
  max-width: 480px;
  line-height: 1.7;
}

.hero-subcopy {
   color: var(--accent-hi);
  font-size: 15px;
  font-weight: 400;
  letter-spacing: 0.02em;
  max-width: 420px;
  margin-bottom: 14px;
}

/* ── Steps ── */
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding-bottom: 72px;
  border-top: 1px solid var(--border);
  padding-top: 56px;
}

@media (max-width: 580px) { .steps { grid-template-columns: 1fr; } }

.step-num {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 36px;
  color: var(--border-hi);
  margin-bottom: 12px;
  line-height: 1;
}

.step h4 {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 6px;
}

.step p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}

.info-section {
  padding: 0 0 64px;
}

.section-head {
  margin-bottom: 24px;
}

.section-head h2 {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: clamp(26px, 4vw, 36px);
  letter-spacing: -0.9px;
  color: var(--text);
}

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

.info-grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.info-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.info-card h3 {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 20px;
  color: var(--text);
  margin-bottom: 10px;
  letter-spacing: -0.4px;
}

.info-card p {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.75;
}

.info-list {
  list-style: none;
  display: grid;
  gap: 10px;
}

.info-list li {
  position: relative;
  padding-left: 18px;
  color: var(--muted);
  font-size: 14px;
}

.info-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.metric-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 20px;
}

.metric-value {
  display: block;
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 28px;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 10px;
}

.metric-text {
  display: block;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.architecture-flow {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.flow-node {
  padding: 12px 16px;
  border-radius: 999px;
  border: 1px solid var(--border-hi);
  background: rgba(168, 213, 162, 0.05);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
}

.flow-arrow {
  color: var(--accent);
  font-size: 20px;
  line-height: 1;
}

/* ── Upload zone ── */
.upload-section { padding-bottom: 64px; }

#drop-zone {
  border: 1.5px dashed var(--border-hi);
  border-radius: var(--radius);
  padding: 56px 32px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  position: relative;
  overflow: hidden;
}

#drop-zone:hover,
#drop-zone.over {
  border-color: var(--accent);
  background: rgba(168, 213, 162, 0.04);
}

#drop-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.drop-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: inline-grid;
  place-items: center;
  margin-bottom: 20px;
}

.drop-icon svg {
  width: 24px;
  height: 24px;
  color: var(--accent);
}

#drop-zone h3 {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 17px;
  color: var(--text);
  margin-bottom: 6px;
}

#drop-zone p {
  font-size: 13px;
  color: var(--muted);
}

.upload-actions {
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.selected-file {
  display: block;
  font-size: 13px;
  color: var(--muted);
}

.upload-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-action {
  -webkit-appearance: none;
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid var(--border-hi);
  border-radius: 999px;
  padding: 10px 16px;
  font-family: 'Epilogue', sans-serif;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  background: transparent;
  color: var(--text);
  box-shadow: none;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, background 0.15s, color 0.15s, opacity 0.15s;
}

.btn-action:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn-action:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  -webkit-text-fill-color: currentColor;
}

.btn-analyze {
  background: var(--accent);
  color: #0d0f0e;
  border-color: var(--accent);
}

.btn-analyze:hover:not(:disabled) {
  background: var(--accent-hi);
  border-color: var(--accent-hi);
}

.btn-clear {
  background: transparent;
  color: var(--muted);
}

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

/* ── Model status ── */
#model-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  margin-top: 20px;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--border-hi);
  flex-shrink: 0;
  transition: background 0.3s;
}

.dot.loading { background: #f0c040; animation: pulse 1s infinite; }
.dot.ready   { background: var(--accent); }
.dot.error   { background: var(--danger); }

@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.35} }

/* ── Spinner ── */
.spinner {
  display: none;
  width: 40px;
  height: 40px;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 48px auto;
}

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

/* ── Results ── */
#results {
  display: none;
  padding-bottom: 80px;
  animation: fadeUp 0.4s ease both;
}

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

/* ── Reset button ── */
.btn-reset {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'Epilogue', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 16px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
  margin-bottom: 28px;
}

.btn-reset:hover { color: var(--text); border-color: var(--border-hi); }
.btn-reset svg { width: 14px; height: 14px; }

/* ── Results grid ── */
.results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 28px;
}

@media (max-width: 640px) { .results-grid { grid-template-columns: 1fr; } }

/* ── Prediction card ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.card-img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  display: block;
}

.card-body { padding: 20px; }

.prediction-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.prediction-name {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 24px;
  color: var(--text);
  margin-bottom: 4px;
  letter-spacing: -0.5px;
}

.prediction-name.healthy { color: var(--accent); }

.conf-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--muted);
}

.conf-track {
  height: 4px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}

.conf-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
  width: 0%;
}

.conf-fill.low { background: var(--danger); }

.low-conf-msg {
  display: none;
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 9px;
  border: 1px solid rgba(224,122,95,0.3);
  background: rgba(224,122,95,0.07);
  font-size: 13px;
  color: var(--danger);
  line-height: 1.5;
}

/* ── Disease detail card ── */
.detail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}

.detail-card h2 {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 20px;
  color: var(--text);
  margin-bottom: 24px;
  letter-spacing: -0.3px;
}

.detail-section { margin-bottom: 22px; }
.detail-section:last-child { margin-bottom: 0; }

.detail-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}

.detail-section p {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.75;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 0 0 28px;
}

/* ── Visualization panel ── */
.viz-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.viz-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 12px;
}

.viz-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  letter-spacing: -0.2px;
}

.viz-tabs {
  display: flex;
  gap: 4px;
}

.viz-tab {
  font-family: 'Epilogue', sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  background: none;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 6px 12px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.viz-tab:hover { color: var(--text); }

.viz-tab.active {
  color: var(--accent);
  border-color: var(--border-hi);
  background: rgba(168, 213, 162, 0.06);
}

.viz-body { padding: 20px; }

.viz-pane { display: none; }
.viz-pane.active { display: block; animation: fadeUp 0.25s ease both; }

.viz-pane canvas {
  width: 100%;
  height: auto;
  max-height: 500px;
  border-radius: 8px;
  display: block;
}

.viz-caption {
  font-size: 12px;
  color: var(--muted);
  margin-top: 12px;
  line-height: 1.6;
  max-width: 540px;
}

/* ── Footer ── */
footer {
  border-top: 1px solid var(--border);
  padding: 42px 0 36px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
}

.footer-copy {
  color: #9aa59b;
  font-size: 12px;
  letter-spacing: 0.04em;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.footer-icon-link {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: #8e9790;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: color 0.2s, border-color 0.2s, background 0.2s, transform 0.2s;
}

.footer-icon-link:hover {
  color: var(--accent);
  border-color: var(--border-hi);
  background: rgba(255,255,255,0.06);
  transform: translateY(-1px);
}

.footer-icon-link svg {
  width: 17px;
  height: 17px;
}

@media (max-width: 580px) {
  .page-tabs {
    padding-top: 22px;
  }

  .page-tab {
    flex: 1 1 0;
    text-align: center;
  }

  .info-grid,
  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .architecture-flow {
    align-items: stretch;
  }

  .flow-arrow {
    display: none;
  }

  .upload-actions {
    align-items: stretch;
  }

  .upload-buttons {
    width: 100%;
  }

  .btn-action {
    flex: 1 1 0;
    justify-content: center;
  }
}
