:root {
  --ink: #17201d;
  --muted: #66706c;
  --paper: #f4f2eb;
  --panel: #fffdf7;
  --line: #d8d7cf;
  --green: #1e6b58;
  --green-soft: #dcebe5;
  --coral: #d16e54;
  --yellow: #f0d890;
  font-family:
    Inter, "Noto Sans SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 1080px;
}

.hero {
  position: relative;
  overflow: hidden;
  color: #f7f7ee;
  background:
    radial-gradient(circle at 82% 24%, #33836b 0 2px, transparent 3px),
    radial-gradient(circle at 88% 34%, #33836b 0 3px, transparent 4px),
    linear-gradient(125deg, #10241e 0%, #173c32 62%, #256b58 100%);
  border-bottom: 7px solid var(--yellow);
}

.hero::after {
  content: "";
  position: absolute;
  width: 420px;
  height: 420px;
  right: 8%;
  top: -195px;
  border: 1px solid rgb(255 255 255 / 18%);
  border-radius: 50%;
  box-shadow:
    0 0 0 68px rgb(255 255 255 / 4%),
    0 0 0 140px rgb(255 255 255 / 3%);
}

.hero__inner,
main {
  width: min(1440px, calc(100% - 96px));
  margin: 0 auto;
}

.hero__inner {
  padding: 62px 0 56px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--coral);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.hero .eyebrow {
  color: #f1b29e;
}

h1 {
  max-width: 850px;
  margin: 0;
  font-family: Georgia, "Noto Serif SC", serif;
  font-size: 52px;
  line-height: 1.05;
  letter-spacing: -0.035em;
}

.hero__summary {
  max-width: 770px;
  margin: 24px 0 0;
  color: #d8e3de;
  font-size: 17px;
  line-height: 1.8;
}

main {
  padding: 32px 0 52px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 9px 30px rgb(31 42 37 / 5%);
}

.controls {
  display: grid;
  grid-template-columns: minmax(260px, 1.8fr) 120px minmax(240px, 1fr) 140px;
  gap: 18px;
  align-items: end;
  padding: 22px;
}

.generation-controls {
  display: grid;
  grid-template-columns: minmax(390px, 1fr) 110px 110px 110px 180px;
  gap: 18px;
  align-items: end;
  margin-top: 14px;
  padding: 20px 22px;
  border-left: 5px solid var(--coral);
}

.generation-controls > div {
  display: grid;
  gap: 5px;
}

.generation-controls .eyebrow {
  margin: 0;
}

.generation-controls strong {
  font-size: 15px;
}

.generation-controls small {
  color: var(--muted);
  line-height: 1.5;
}

.button--secondary {
  color: #fff;
  background: var(--coral);
  border-color: var(--coral);
}

.button--secondary:hover {
  background: #aa4f3c;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

select,
button {
  min-height: 44px;
  border: 1px solid #c7cbc6;
  border-radius: 3px;
  font: inherit;
}

select {
  width: 100%;
  padding: 0 12px;
  color: var(--ink);
  background: white;
}

.check {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid #c7cbc6;
  background: white;
}

.check input {
  width: 17px;
  height: 17px;
  accent-color: var(--green);
}

button {
  padding: 0 18px;
  color: white;
  background: var(--green);
  border-color: var(--green);
  font-weight: 800;
  cursor: pointer;
}

button:hover {
  background: #155242;
}

button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.status {
  min-height: 38px;
  padding: 13px 2px 7px;
  color: var(--muted);
  font-size: 13px;
}

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

.metric {
  display: grid;
  gap: 4px;
  padding: 20px;
  background: #182b25;
  color: white;
}

.metric span,
.metric small {
  color: #b7c6c0;
  font-size: 11px;
}

.metric strong {
  font-family: Georgia, serif;
  font-size: 28px;
}

.warnings {
  margin: 0 0 18px;
  padding: 8px 18px;
  border-left: 5px solid var(--coral);
  background: #fff4ed;
}

.warnings p {
  margin: 8px 0;
  color: #713e31;
  font-size: 13px;
  line-height: 1.6;
}

.results-panel {
  padding: 24px;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  margin-bottom: 18px;
}

.section-heading h2 {
  margin: 0;
  font-family: Georgia, "Noto Serif SC", serif;
  font-size: 30px;
}

.section-heading > p {
  color: var(--muted);
  font-size: 12px;
}

.table-wrap {
  overflow: auto;
  border-top: 1px solid var(--ink);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  padding: 13px 10px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  text-align: left;
  white-space: nowrap;
}

td {
  padding: 13px 10px;
  border-bottom: 1px solid #e5e3da;
  vertical-align: middle;
}

tbody tr:hover {
  background: #f7f5ed;
}

td:nth-child(3) {
  min-width: 260px;
}

td small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

td p {
  max-width: 360px;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.rank {
  color: var(--coral);
  font-family: Georgia, serif;
  font-size: 18px;
}

.score {
  color: var(--green);
  font-family: Georgia, serif;
  font-size: 19px;
  font-weight: 800;
}

.structure {
  display: block;
  width: 110px;
  height: 78px;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.view-3d {
  display: block;
  min-height: 28px;
  margin: 5px auto 0;
  padding: 0 11px;
  color: var(--green);
  background: transparent;
  border-color: #8db8aa;
  font-size: 11px;
}

.view-3d:hover {
  color: white;
  background: var(--green);
}

.pill {
  display: inline-block;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}

.pill--higher {
  color: #7a3827;
  background: #f7d7cb;
}

.pill--uncertain {
  color: #735e1f;
  background: #f4e8b7;
}

.pill--lower {
  color: #205444;
  background: var(--green-soft);
}

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

.method-card {
  min-height: 230px;
  padding: 26px;
}

.method-card .number {
  color: var(--coral);
  font-family: Georgia, serif;
  font-size: 14px;
}

.method-card h3 {
  margin: 34px 0 12px;
  font-family: Georgia, "Noto Serif SC", serif;
  font-size: 22px;
}

.method-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
}

.viewer-dialog {
  width: min(1120px, calc(100vw - 72px));
  max-width: none;
  padding: 0;
  overflow: hidden;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid #57645f;
  box-shadow: 0 28px 100px rgb(0 0 0 / 42%);
}

.viewer-dialog::backdrop {
  background: rgb(7 16 13 / 74%);
  backdrop-filter: blur(4px);
}

.viewer-dialog__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 86px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}

.viewer-dialog__header .eyebrow {
  margin-bottom: 5px;
}

.viewer-dialog__header h2 {
  margin: 0;
  font-family: Georgia, "Noto Serif SC", serif;
  font-size: 25px;
}

.viewer-close {
  width: 42px;
  min-height: 42px;
  padding: 0;
  color: var(--ink);
  background: transparent;
  border-color: var(--line);
  font-family: Arial, sans-serif;
  font-size: 28px;
  line-height: 1;
}

.viewer-close:hover {
  color: white;
  background: var(--coral);
  border-color: var(--coral);
}

.viewer-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  min-height: 610px;
}

.viewer-canvas {
  min-width: 0;
  height: 610px;
  background: #0e1714;
}

.viewer-canvas canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.viewer-help {
  padding: 28px 22px;
  border-left: 1px solid var(--line);
}

.viewer-help > strong {
  display: block;
  margin-top: 20px;
  font-size: 12px;
}

.viewer-help > strong:first-child {
  margin-top: 0;
}

.viewer-help p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.element-legend {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 12px;
}

.element-legend span {
  display: flex;
  gap: 7px;
  align-items: center;
  color: var(--muted);
  font-size: 11px;
}

.atom {
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 1px solid rgb(0 0 0 / 18%);
  border-radius: 50%;
}

.atom--c {
  background: #4c5552;
}

.atom--n {
  background: #3569d4;
}

.atom--o {
  background: #d94b3d;
}

.atom--s {
  background: #e0bb31;
}

.atom--halogen {
  background: #4ba85c;
}

.viewer-meta {
  margin-top: 24px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.viewer-status {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--green) !important;
  font-weight: 700;
}

footer {
  padding: 22px 48px;
  color: #b9c5c0;
  background: #15241f;
  font-size: 12px;
  text-align: center;
}
