:root {
  --bg: #0b1c2e;
  --panel: #071525;
  --panel2: #0d2235;
  --border: #1a3650;
  --border2: #2c5072;
  --text: #c8dde8;
  --muted: #6691a6;
  --faint: #3f6c82;
  --cyan: #38bdf8;
  --cyan2: #7dd3fc;
  --gold: #fbbf24;
  --green: #34d399;
  --danger: #f87171;
  --sans: Georgia, 'Times New Roman', serif;
  --mono: 'Courier New', monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
}

body {
  overflow: hidden;
}

.app {
  display: grid;
  grid-template-rows: 1fr auto;
  height: 100vh;
  height: 100dvh;
}

main {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr) 250px;
  min-height: 0;
  overflow: hidden;
}

aside {
  background: var(--bg);
  border-right: 0.5px solid var(--border);
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.right {
  border-right: 0;
  border-left: 0.5px solid var(--border);
  overflow-y: auto;
  overflow-x: hidden;
}

.brand {
  text-align: left;
}

.leftBrand {
  border-bottom: 0.5px solid var(--border);
  padding: 10px 14px 12px;
  flex: 0 0 auto;
}

h1 {
  font-family: var(--sans);
  font-weight: 400;
  letter-spacing: 0.08em;
  font-size: 15px;
  line-height: 1.05;
  margin: 0;
  color: var(--cyan);
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  justify-content: flex-start;
  flex-wrap: wrap;
  max-width: 220px;
  row-gap: 1px;
}

.beta {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.08em;
  color: var(--bg);
  background: var(--cyan);
  border-radius: 4px;
  padding: 2px 5px;
  text-transform: uppercase;
  line-height: 1;
  font-weight: 600;
  vertical-align: middle;
}

.titleEnd {
  white-space: nowrap;
}

.titleTm {
  font-size: 9px;
  letter-spacing: 0.02em;
  margin-left: 2px;
}

.rightHeader .links {
  padding-right: 10px;
}

.subtitle {
  font-family: var(--sans);
  color: var(--muted);
  font-size: 11px;
  margin-top: 3px;
  letter-spacing: 0.03em;
  line-height: 1.15;
  text-align: left;
}

.subtitle.reference {
  margin-top: 2px;
  font-size: 10px;
}

.subtitle a {
  color: var(--cyan);
  text-decoration: underline;
  text-underline-offset: 2px;
}

input[type="checkbox"] {
  accent-color: var(--cyan);
  width: 13px;
  height: 13px;
  cursor: pointer;
}

.searchTop {
  position: relative;
  width: 100%;
}

.searchTop input {
  width: 100%;
  background: var(--bg);
  border: 0.5px solid var(--border2);
  border-radius: 5px;
  color: var(--text);
  height: 30px;
  padding: 0 10px 0 30px;
  font-size: 15px;
  outline: none;
  font-family: var(--sans);
}

.searchTop input:focus {
  border-color: var(--cyan);
}

.searchTop span {
  position: absolute;
  left: 10px;
  top: 7px;
  color: var(--muted);
  font-size: 16px;
}

.section {
  padding: 12px 14px;
  border-bottom: 0.5px solid var(--border);
}

.right .section {
  padding: 10px 12px;
  flex: 0 0 auto;
}

.rightSearch {
  padding-top: 14px;
  padding-bottom: 14px;
}

.label {
  font-family: var(--mono);
  letter-spacing: 0.1em;
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 10px;
}

.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

button,
.pill {
  background: var(--panel);
  border: 0.5px solid var(--border2);
  color: var(--muted);
  border-radius: 5px;
  padding: 5px 11px;
  font-size: 15px;
  cursor: pointer;
  font-family: var(--sans);
  letter-spacing: 0.02em;
  transition: all 0.15s;
}

button:hover,
.pill:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

button.active,
.pill.active {
  border-color: var(--cyan);
  color: var(--cyan2);
  background: var(--panel2);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.25) inset;
}

.plotWrap {
  position: relative;
  min-width: 0;
  min-height: 0;
  height: 100%;
  background: var(--panel);
}

#plot {
  touch-action: none;
  width: 100%;
  height: 100%;
}

.plotBtns {
  position: absolute;
  top: 12px;
  right: 18px;
  display: flex;
  gap: 5px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: calc(100% - 36px);
  z-index: 2;
}

.plotBtns button {
  color: var(--cyan);
  border-color: var(--border2);
  background: var(--panel);
  font-size: 12px;
  padding: 4px 8px;
}

.plotBtns button.active {
  background: var(--cyan);
  color: var(--bg);
  border-color: var(--cyan);
  box-shadow: none;
}

.plotBtns button.active:hover {
  color: var(--bg);
}

.btnDivider {
  width: 1px;
  align-self: stretch;
  background: var(--border2);
  margin: 0 4px;
  opacity: 0.8;
}

.mobileZoomBtn {
  display: none;
}

.tiny-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 8px 0;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 15px;
}

.categoryDivider {
  font-family: var(--sans);
  font-size: 15px;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0.02em;
}

.links a {
  color: var(--cyan);
  margin-left: 8px;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  font-size: 14px;
}

.hint {
  color: var(--muted);
  line-height: 1.6;
  font-size: 15px;
  margin-top: 6px;
}

.lineList,
.elementList {
  overflow: auto;
  min-height: 0;
  flex: 1;
  padding: 8px 0;
}

.right .elementList {
  flex: 0 0 210px;
  max-height: 210px;
  border-bottom: 0.5px solid var(--border);
}

.lineItem {
  display: grid;
  grid-template-columns: 16px 22px 1fr;
  gap: 6px;
  align-items: center;
  padding: 5px 14px;
  color: var(--muted);
  font-family: var(--sans);
  cursor: pointer;
  transition: background 0.15s;
}

.lineItem:hover,
.elem:hover {
  background: var(--panel);
}

.swatch {
  width: 14px;
  height: 14px;
  border: 1.5px solid currentColor;
  border-radius: 3px;
}

.dash {
  height: 2px;
  background: currentColor;
  opacity: 0.8;
  border-radius: 2px;
}

.lineText {
  font-size: 15px;
}

.lineText small {
  display: block;
  color: var(--faint);
  font-size: 13px;
  margin-top: 1px;
  font-family: var(--mono);
}

.rightHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.count {
  color: var(--muted);
  font-family: var(--sans);
  font-size: 15px;
}

.elem {
  display: grid;
  grid-template-columns: 16px 24px 1fr;
  gap: 6px;
  align-items: center;
  padding: 4px 14px;
  color: var(--muted);
  font-family: var(--sans);
  cursor: pointer;
  font-size: 15px;
  transition: background 0.15s;
}

.elem.selected {
  background: var(--panel2);
  color: var(--text);
  box-shadow: inset 2px 0 0 var(--cyan);
}

.check {
  width: 13px;
  height: 13px;
  border-radius: 3px;
  background: var(--panel2);
  border: 1.5px solid var(--border2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 11px;
}

.sym {
  color: var(--cyan);
  font-weight: 500;
  font-size: 15px;
}

.details {
  color: var(--muted);
  line-height: 1.6;
  font-size: 14px;
}

.details h2 {
  font-family: var(--sans);
  color: var(--text);
  margin: 0 0 3px;
  font-size: 18px;
  font-weight: 400;
}

.detailGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-top: 12px;
}

.metric {
  border: 0.5px solid var(--border);
  border-radius: 6px;
  padding: 8px;
  background: var(--panel);
}

.metric b {
  display: block;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
}

.metric span {
  font-family: var(--mono);
  color: var(--cyan2);
  font-size: 14px;
}

.metric span i {
  color: var(--gold);
  font-style: italic;
}

.note {
  margin-top: 12px;
  color: var(--muted);
  font-size: 14px;
  font-style: italic;
  line-height: 1.6;
  padding: 8px 10px;
  background: var(--panel);
  border-left: 2px solid var(--cyan);
  border-radius: 0 5px 5px 0;
}

#lineDetails .hint {
  word-break: break-word;
}

#lineDetails>h2 {
  font-size: 18px;
  margin-bottom: 8px;
}

.elementDetailGrid {
  grid-template-columns: 1fr;
  gap: 8px;
}

.frequencyMetric {
  padding: 7px 8px;
}

.frequencyMetric b {
  margin-bottom: 4px;
}

.frequencyMetric span {
  display: block;
  line-height: 1.35;
}

.freqValue,
.freqEnergy {
  color: var(--cyan2);
}

.freqUnc {
  color: #5f7484;
  font-size: 13px;
  opacity: 0.72;
}

.groupDetailGrid {
  grid-template-columns: 1fr;
  gap: 7px;
}

.groupFitCard {
  grid-column: 1 / -1;
  border: 0.5px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  padding: 10px 10px 8px;
}

.groupFitCard.compact {
  padding: 7px 8px;
}

.groupFitTitle {
  font-size: 14px;
  margin-bottom: 5px;
  font-weight: 500;
}

.groupFitEquation {
  font-family: var(--mono);
  color: var(--cyan2);
  font-size: 14px;
  margin-bottom: 8px;
  line-height: 1.5;
}

.groupFitStats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 10px;
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.45;
}

.groupFitStats b {
  display: block;
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
}

.groupFitStats span {
  color: var(--cyan2);
  font-size: 14px;
}

.groupFitStats.compact {
  grid-template-columns: 1fr 1fr;
  gap: 3px 7px;
  font-size: 12px;
  line-height: 1.25;
}

.groupFitStats.compact b {
  font-size: 12px;
  color: var(--text);
}

.groupFitStats.compact span {
  font-size: 12px;
  color: var(--cyan2) !important;
}

.groupDetailGrid>.groupFitCard.compact:only-child .groupFitTitle {
  display: none;
}

.compactHint {
  font-size: 13px;
  line-height: 1.35;
  margin-top: 4px;
  margin-bottom: 6px;
}

.mobileNotice {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(3, 10, 18, 0.74);
  padding: 18px;
  align-items: center;
  justify-content: center;
}

.mobileNotice.show {
  display: flex;
}

.mobileNoticeCard {
  width: min(92vw, 360px);
  background: var(--panel);
  border: 0.5px solid var(--border2);
  border-radius: 10px;
  padding: 18px 18px 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  text-align: left;
}

.mobileNoticeCard h2 {
  margin: 0 0 8px;
  color: var(--cyan);
  font-size: 19px;
  font-weight: 400;
}

.mobileNoticeCard p {
  margin: 0 0 14px;
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
}

.mobileNoticeCard button {
  width: 100%;
  color: var(--bg);
  background: var(--cyan);
  border-color: var(--cyan);
}

.mobileTabs {
  display: none;
}

.drawerBackdrop {
  display: none;
}

.rightsFooter {
  border-top: 0.5px solid var(--border2);
  background: var(--panel);
  text-align: center;
  padding: 9px 8px;
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.2;
  letter-spacing: 0.02em;
  color: var(--muted);
  min-height: 38px;
}

.rightsFooter sup {
  font-size: 9px;
}

@media(max-width:1050px) {
  .mobileZoomBtn {
    display: inline-flex;
  }

  .app {
    grid-template-rows: 1fr auto;
    height: 100vh;
    height: 100dvh;
  }

  main {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    position: relative;
    overflow: hidden;
    min-height: 0;
  }

  aside.left,
  aside.right {
    position: absolute;
    top: 0;
    bottom: 0;
    width: min(86vw, 360px);
    z-index: 20;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    box-shadow: 2px 0 18px rgba(0, 0, 0, 0.45);
    display: flex;
  }

  aside.right {
    right: 0;
    left: auto;
    transform: translateX(105%);
    box-shadow: -2px 0 18px rgba(0, 0, 0, 0.45);
  }

  aside.left.open,
  aside.right.open {
    transform: translateX(0);
  }

  .drawerBackdrop {
    display: none;
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 15;
  }

  .drawerBackdrop.show {
    display: block;
  }

  .mobileTabs {
    display: flex;
    gap: 8px;
    justify-content: flex-start;
    margin-top: 6px;
  }

  .mobileTabs button {
    font-size: 13px;
    padding: 5px 12px;
  }

  .plotBtns {
    top: 8px;
    right: 10px;
    max-width: calc(100% - 20px);
    gap: 4px;
    justify-content: flex-end;
  }

  .plotBtns button {
    font-size: 11px;
    padding: 4px 7px;
  }
}

@media(max-width:480px) {
  h1 {
    font-size: 13px;
    letter-spacing: 0.05em;
  }

  .subtitle {
    font-size: 11px;
  }

  .subtitle.reference {
    font-size: 10px;
  }
}