* { box-sizing: border-box; }
body { margin: 0; background: gray; color: #111; font: 13px Arial, Helvetica, sans-serif; }
a { color: #214b7b; }
header { padding: 5px 8px; font-size: 12px; }
#content { width: 1280px; max-width: calc(100% - 24px); margin: 0 auto 16px; background: white; border: 5px solid black; }
.title-row { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 12px 8px; }
h1 { font-size: 23px; margin: 0; }
.title-row a { font-size: 12px; }
#controls { padding: 0 12px 10px; }
button, input, select { font: inherit; }
button, select, label, summary { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible, summary:focus-visible, #chart:focus-visible { outline: 3px solid #c47a00; outline-offset: 2px; }
input { accent-color: #111; }
.presets { display: flex; flex-wrap: wrap; gap: 0; margin-bottom: 8px; }
.presets button { padding: 6px 12px; background: #eee; border: 1px solid #777; margin: 0 -1px -1px 0; font-weight: bold; }
.presets button[aria-pressed=true] { background: #222; color: white; border-color: black; }
.presets button:hover { background: #ddd; color: #111; }
.options-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 20px; margin-bottom: 8px; }
fieldset { display: flex; gap: 7px; border: 0; margin: 0; padding: 0; }
legend { float: left; padding: 0; margin-right: 5px; font-weight: bold; }
#system-picker { position: relative; margin-left: auto; }
#system-picker summary { text-decoration: underline; }
.picker-body { position: absolute; top: 23px; right: 0; z-index: 20; width: 440px; max-width: calc(100vw - 40px); padding: 10px; border: 2px solid #111; background: white; box-shadow: 3px 3px 0 #0004; }
.picker-actions { display: flex; gap: 7px; margin-bottom: 8px; }
#system-toggles { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.system-toggle { display: flex; gap: 4px; align-items: center; font-size: 12px; }
#lookup { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
#lookup label { font-weight: bold; }
#lookup select { padding: 3px; max-width: 100%; }
#lookup-system { width: 175px; }
#lookup-grade { min-width: 100px; }
#clear-selection { padding: 3px 8px; }
.hint { margin-left: auto; font-size: 12px; color: #555; }
#comparison { padding: 7px 12px; border-top: 1px solid #bbb; background: #f5f2e9; font-size: 12px; }
.selection-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; }
.selection-title { font-size: 14px; white-space: nowrap; }
.match-group { display: inline-flex; align-items: baseline; flex-wrap: wrap; gap: 3px; }
.match-name { color: #444; margin-right: 2px; }
.match-button { border: 0; border-bottom: 1px dotted #333; background: transparent; padding: 1px 2px; font-weight: bold; }
#comparison details { margin-top: 5px; }
#comparison details p { margin: 5px 0; line-height: 1.4; }
#chart { border-top: 4px solid black; overflow: auto; position: relative; }
.chart-section { --label-width: 130px; min-width: 1082px; position: relative; padding-bottom: 4px; }
.panel-head { margin: 0; padding: 6px 9px; background: #e5e5e5; border-top: 1px solid #111; border-bottom: 1px solid #999; font-size: 12px; display: flex; align-items: baseline; gap: 10px; }
.panel-head small { font-weight: normal; color: #444; }
.ruler-row, .system-row, .grade-row { display: grid; grid-template-columns: var(--label-width) minmax(0, 1fr); }
.ruler-row { min-height: 29px; background: #f7f7f7; border-bottom: 1px solid #999; }
.axis-title, .system-label, .row-label { position: sticky; left: 0; z-index: 4; padding: 6px 8px; background: #fafafa; border-right: 1px solid #999; font-size: 12px; }
.axis-title { font-size: 11px; padding-top: 9px; }
.system-label { display: flex; justify-content: center; flex-direction: column; font-weight: bold; }
.system-label small { font-weight: normal; color: #555; font-size: 10px; margin-top: 3px; }
.system-row, .grade-row { border-bottom: 1px solid #bbb; }
.system-row:nth-child(even) .range-track { background-color: #f6f6f6; }
.ruler-axis { display: flex; cursor: crosshair; }
.tick { flex: 1 1 0; border-left: 1px solid #bbb; padding-top: 9px; font-size: 10px; text-align: center; white-space: nowrap; }
.range-track { position: relative; min-height: 34px; background-image: linear-gradient(to right, #ddd 1px, transparent 1px); background-size: calc(100% / var(--count)) 100%; cursor: crosshair; }
.grade-bar { position: absolute; z-index: 1; height: 23px; padding: 0 1px; background: var(--color); color: #fff; border: 1px solid #222; font-size: 10px; font-weight: bold; text-shadow: 0 1px 1px #0008; white-space: nowrap; overflow: hidden; box-shadow: 0 1px 1px #0003; }
.grade-bar:hover, .grade-bar.preview { filter: brightness(1.15); box-shadow: 0 0 0 1px #111; z-index: 3; }
.grade-bar.bridged { border-style: dashed; }
.uncertainty-band { position: absolute; z-index: 0; height: 5px; background: var(--color); border-left: 1px solid #111; border-right: 1px solid #111; opacity: .18; pointer-events: none; }
.uncertainty-band.selected { opacity: .45; }
.uncertainty-band.matched { opacity: .3; }
#chart.has-selection .uncertainty-band:not(.selected):not(.matched) { opacity: .045; }
.grade-bar.selected { outline: 3px solid #111; outline-offset: 1px; z-index: 3; }
.grade-bar.matched { outline: 2px solid #111; outline-offset: 0; z-index: 2; }
#chart.has-selection .grade-bar:not(.selected):not(.matched) { opacity: .28; }
.cursor-line { position: absolute; width: 1px; background: #111; pointer-events: none; z-index: 3; top: 26px; bottom: 0; }
#measure { position: fixed; z-index: 30; padding: 6px 8px; background: #ffffec; border: 1px solid #111; box-shadow: 2px 2px 0 #0003; font-size: 12px; max-width: 250px; pointer-events: none; }
.chart-key { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 10px; padding: 7px 9px; font-size: 11px; color: #444; border-bottom: 1px solid #aaa; }
#notes { font-size: 12px; padding: 8px 10px; }
#notes p, #notes ul { max-width: 850px; line-height: 1.5; }
.no-systems { padding: 30px; text-align: center; }
@media (max-width: 700px) {
  #content { max-width: calc(100% - 8px); border-width: 3px; }
  .title-row { padding: 8px; }
  h1 { font-size: 20px; }
  #controls { padding: 0 8px 8px; }
  .presets button { padding: 7px 8px; font-size: 12px; }
  .options-row { gap: 5px 8px; font-size: 12px; }
  .options-row { position: relative; }
  #system-picker { margin-left: 0; position: static; }
  .picker-body { left: 0; right: 0; top: calc(100% + 4px); width: auto; max-width: none; }
  #lookup-system { width: 155px; }
  .hint { display: none; }
  .chart-section { --label-width: 105px; min-width: 1057px; }
  .system-label { font-size: 11px; }
  .selection-line { gap: 5px 8px; }
}
@media print {
  body { background: white; }
  #content { max-width: none; width: 100%; border: 0; }
  #controls, header, .title-row a, #measure { display: none; }
  #chart { overflow: visible; }
  .chart-section { min-width: 0; }
  .grade-bar { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}
