:root {
  --ink: #1a1a1a;
  --muted: #6b6b6b;
  --line: #e2e2e2;
  --bg: #ffffff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 28px 32px;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

main {
  display: flex;
  gap: 28px;
  align-items: stretch;
  max-width: 1180px;
  margin: 0 auto;
}

.stage {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.canvas-wrap { width: 100%; }

#radar {
  width: 100%;
  max-width: 720px;
  height: auto;
  display: block;
  margin: 0 auto;
}

.legend {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  justify-content: center;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 15px;
  font-weight: 600;
}

.legend i {
  width: 26px;
  height: 5px;
  border-radius: 3px;
}

button {
  border: none;
  background: var(--ink);
  color: #fff;
  padding: 11px 22px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

button:hover { opacity: 0.88; }

.panel {
  flex: 0 0 236px;
  border-left: 1px solid var(--line);
  padding-left: 26px;
}

.panel h1 { font-size: 21px; margin: 0 0 4px; letter-spacing: -0.01em; }
.sub { color: var(--muted); margin: 0 0 22px; font-size: 14px; }

.panel h2 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 20px 0 10px;
}

.rows { display: flex; flex-direction: column; gap: 9px; }

.rows label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14.5px;
  cursor: pointer;
}

.rows input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--ink); }

.rows input[type="color"] {
  width: 24px;
  height: 20px;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
}

/* temperature (inactive until the dynamic coefficients are extracted) */
.temp-field {
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0.45;
}

.temp-field input {
  width: 84px;
  padding: 7px 9px;
  font: inherit;
  font-size: 14.5px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f6f6f6;
}

.temp-field span { font-size: 14.5px; color: var(--muted); }

.temp-note {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
  font-style: italic;
}

/* material picker: search box + dropdown */
.picker { position: relative; }

.picker input {
  width: 100%;
  padding: 8px 10px;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.picker input:focus {
  outline: none;
  border-color: #b6b6b6;
}

.options {
  position: absolute;
  z-index: 10;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 232px;
  overflow-y: auto;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}

.options li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
}

.options li:hover { background: #f2f4f6; }

.options li.empty {
  color: var(--muted);
  font-size: 13px;
  cursor: default;
}

.options li.empty:hover { background: none; }

.options small { color: var(--muted); font-size: 11.5px; margin-left: auto; }

/* selected materials, each removable */
.chips {
  display: flex;
  flex-direction: column;
  gap: 6px;
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
}

.chips li {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 6px 5px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 14px;
}

.chips input[type="color"] {
  flex: 0 0 auto;
  width: 20px;
  height: 18px;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
}

.chips span { flex: 1 1 auto; }

.chips button {
  flex: 0 0 auto;
  padding: 0;
  width: 20px;
  height: 20px;
  border-radius: 5px;
  background: none;
  color: var(--muted);
  font-size: 17px;
  line-height: 1;
}

.chips button:hover {
  background: #f0f0f0;
  color: var(--ink);
  opacity: 1;
}

.table-wrap { max-width: 1180px; margin: 44px auto 0; }
.table-wrap h2 { font-size: 15px; margin-bottom: 12px; }

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}

.tab {
  background: none;
  color: var(--muted);
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 9px 14px;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: -1px;
}

.tab:hover { color: var(--ink); opacity: 1; }

.tab.active {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

/* functions table */
#panel-values, #panel-functions { overflow-x: auto; }

#functions-table .fn-name {
  vertical-align: top;
  font-weight: 600;
  white-space: normal;
  width: 300px;
}

.fn-expr {
  display: block;
  margin-top: 5px;
  font-family: "Cambria Math", Cambria, "Times New Roman", Times, serif;
  font-style: italic;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.7;
  color: var(--ink);
  white-space: normal;
}

.term {
  font-family: "Cambria Math", Cambria, "Times New Roman", Times, serif;
  font-style: italic;
  font-weight: 700;
}

.fn-expr sub, .fn-expr sup, .term sub, .term sup { font-size: 0.72em; }

#functions-table tr.first-term td { border-top: 1px solid var(--line); }
#functions-table .term-cell { white-space: nowrap; font-size: 15px; }
#functions-table td, #functions-table th { padding: 7px 10px; }

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

th, td {
  border-bottom: 1px solid var(--line);
  padding: 9px 12px;
  text-align: left;
  white-space: nowrap;
}

th { color: var(--muted); font-weight: 600; }
td .unit { color: var(--muted); font-size: 12px; margin-left: 5px; }
td.missing { color: #b8b8b8; }

a { color: #1f5fa8; text-decoration: none; }
a:hover { text-decoration: underline; }
sup a { font-size: 11px; margin-left: 2px; }

.refnotes { margin-top: 14px; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.axisnotes { margin-top: 14px; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.axisnotes h3 { margin: 0 0 6px; font-size: 13px; }
.axisnotes b { color: var(--ink); }
.notemark { color: var(--muted); font-weight: 700; }
.simmark { color: #b06a00; font-weight: 700; margin-left: 1px; }

@media (max-width: 820px) {
  main { flex-direction: column; }
  .panel { border-left: none; border-top: 1px solid var(--line); padding-left: 0; padding-top: 20px; flex-basis: auto; }
}
