:root {
  --bg: #ffffff;
  --bg-alt: #f7f7f9;
  --ink: #1a1a1f;
  --muted: #5c6066;
  --faint: #6c7079;
  --line: #e6e7eb;
  --accent: #c81d4e;        /* DeepDOSReasoner crimson */
  --accent-dark: #9c1339;
  --accent-soft: #fdeef2;
  --blue: #1f77b4;
  --orange: #e07b00;
  --radius: 12px;
  --maxw: 1080px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { line-height: 1.2; letter-spacing: -0.01em; }

/* ---------- Hero ---------- */
.hero {
  background: radial-gradient(1200px 480px at 50% -120px, var(--accent-soft), transparent 70%), var(--bg);
  border-bottom: 1px solid var(--line);
  padding: 56px 0 40px;
  text-align: center;
}
.hero h1 {
  font-size: clamp(2.4rem, 6vw, 4rem);
  margin: 0;
  background: linear-gradient(180deg, var(--ink), #3a3a42);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.subtitle {
  font-size: clamp(1.05rem, 2.4vw, 1.4rem);
  color: var(--muted);
  font-weight: 500;
  margin: 10px auto 26px;
  max-width: 760px;
}
.authors {
  max-width: 820px;
  margin: 0 auto 18px;
  font-size: 1.02rem;
  color: var(--ink);
}
.author { white-space: nowrap; }
.authors sup { color: var(--faint); font-weight: 500; }
.logos {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin: 0 auto 14px;
}
.logo-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 16px 36px;
  max-width: 860px;
}
.logos img {
  height: 50px;
  width: auto;
  max-width: 200px;
  object-fit: contain;
}
.corr { font-size: 0.82rem; color: var(--muted); margin: 10px 0 0; }

.cta {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 26px 0 12px;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 11px 22px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); box-shadow: 0 6px 18px rgba(0,0,0,.08); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn.is-disabled { opacity: .55; pointer-events: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; transform: none; }
.status-note { font-size: 0.82rem; color: var(--faint); margin: 8px 0 0; }

/* ---------- Sections ---------- */
.section { padding: 64px 0; }
.section.alt { background: var(--bg-alt); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section h2 { font-size: 1.9rem; margin: 0 0 22px; }
.lead { font-size: 1.08rem; color: var(--muted); margin: 0 0 28px; }
#abstract p { font-size: 1.05rem; color: #2b2b31; }
.arch-figure { margin: 30px 0 0; }
.arch-figure img { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.arch-figure figcaption { font-size: 0.86rem; color: var(--muted); margin-top: 12px; line-height: 1.5; }

/* ---------- Stats ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
}
.stat {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 20px;
  text-align: center;
}
.stat-num { display: block; font-size: 2rem; font-weight: 800; color: var(--accent); letter-spacing: -0.02em; }
.stat-label { display: block; font-size: 0.86rem; color: var(--muted); margin-top: 6px; }
.stat-label em { color: var(--faint); font-style: normal; }

/* ---------- Method cards ---------- */
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
}
.card h3 { font-size: 1.2rem; margin: 10px 0 10px; }
.card p { margin: 0; color: #34343b; }
.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 3px 12px;
}

/* ---------- Demo ---------- */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 4px; margin-bottom: 22px; width: fit-content; max-width: 100%; }
.tab {
  border: 0;
  background: transparent;
  padding: 9px 20px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--muted);
  cursor: pointer;
  transition: background .12s, color .12s;
}
.tab.is-active { background: var(--accent); color: #fff; }

.demo {
  display: grid;
  grid-template-columns: 290px 1fr;
  gap: 20px;
  align-items: start;
}
.picker {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  position: sticky;
  top: 16px;
}
#search {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  margin-bottom: 10px;
}
#search:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }

.material-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 460px;
  overflow-y: auto;
}
/* On eDOS/phDOS tabs the left rail also holds the 3D structure, so shorten the
   list to keep the rail roughly as tall as the DOS plot (no blank gap below). */
.picker.with-struct .material-list { max-height: 200px; }
.mat-item {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 8px;
  padding: 9px 10px;
  cursor: pointer;
  display: flex;
  align-items: baseline;
  gap: 8px;
  font: inherit;
  color: var(--ink);
}
.mat-item:hover { background: var(--bg-alt); }
.mat-item.is-active { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.list-empty { color: var(--faint); font-size: 0.9rem; padding: 12px 10px; }

.viewer {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  min-width: 0;
}
.viewer-head { margin-bottom: 6px; }
#mat-title { font-size: 1.35rem; margin: 0; }
#mat-title sub { font-size: 0.65em; }
.mat-meta { margin: 2px 0 0; color: var(--muted); font-size: 0.9rem; }
.mat-meta a { font-weight: 600; }
.plot { width: 100%; height: 440px; }

/* ---------- 3D crystal structure (3Dmol) ----------
   Lives in the demo's left rail, under the material list, so the DOS plot keeps
   its full width; #demo-struct-wrap is hidden via JS on case-study tabs. */
.struct { margin: 14px 0 0; min-width: 0; }
.struct[hidden] { display: none; }
.struct-view {
  position: relative;
  width: 100%;
  height: 230px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: radial-gradient(120% 90% at 50% 12%, #ffffff 0%, #f1f2f5 76%, #e8eaee 100%);
  overflow: hidden;
  cursor: grab;
}
.struct-view:active { cursor: grabbing; }
.struct-view canvas { border-radius: var(--radius); }
.struct-cap { font-size: 0.76rem; color: var(--faint); margin: 7px 0 0; text-align: center; }
.struct-empty {
  display: flex; align-items: center; justify-content: center;
  height: 100%; padding: 0 18px;
  color: var(--faint); font-size: 0.82rem; text-align: center; cursor: default;
}
.mat-metrics { margin: 10px 0 0; font-size: 0.9rem; color: var(--muted); }
.mat-metrics b { color: var(--accent-dark); }
.metric-chip { display: inline-block; font-variant-numeric: tabular-nums; }

.caption { font-size: 0.82rem; color: var(--faint); margin-top: 22px; }

/* ---------- Upload & predict ---------- */
.uploader { max-width: 860px; margin: 0 auto; }
.dropzone {
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  padding: 34px 24px;
  text-align: center;
  cursor: pointer;
  background: var(--bg);
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone:focus, .dropzone.is-drag {
  border-color: var(--accent);
  background: var(--accent-soft);
  outline: none;
}
.dz-icon { display: block; font-size: 1.6rem; color: var(--accent); margin-bottom: 6px; }
.dz-text { color: var(--muted); }
.dz-text code { font-family: var(--mono); font-size: 0.92em; }
.dz-file { display: block; margin-top: 8px; font-weight: 600; color: var(--ink); }
.uploader-actions { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 16px 0; flex-wrap: wrap; }
.nelect-field { font-size: 0.9rem; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.nelect-field[hidden] { display: none; }
.nelect-field input { width: 90px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.nelect-field input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.predict-status { font-size: 0.9rem; color: var(--muted); }
.predict-status.muted { color: var(--faint); }
.predict-status.error { color: var(--accent-dark); }
#upload-plot { height: 440px; }

/* Uploaded structure preview + predicted-DOS plot: side by side when both are
   present, centered when only the structure preview is shown. */
.upload-results { display: flex; flex-wrap: wrap; gap: 18px; justify-content: center; align-items: stretch; margin-top: 14px; }
.upload-results .struct { flex: 0 0 300px; max-width: 100%; margin: 0; }
.upload-results #upload-plot { flex: 1 1 420px; min-width: 300px; width: auto; }
.upload-results .struct-view { height: 320px; }

/* ---------- Footer ---------- */
.footer { padding: 56px 0 72px; border-top: 1px solid var(--line); }
.footer h2 { font-size: 1.4rem; margin: 0 0 16px; }
.bibtex {
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.5;
  overflow-x: auto;
  color: #2b2b31;
}
.foot-links { margin: 22px 0 6px; font-size: 0.95rem; }
.foot-fine { color: var(--faint); font-size: 0.82rem; margin: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .cards { grid-template-columns: 1fr; }
  .demo { grid-template-columns: 1fr; }
  .picker { position: static; }
  .material-list { max-height: 260px; }
  .logos img { height: 40px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
