:root {
  color-scheme: dark;
  --page: #08090d;
  --surface: #111821;
  --ink: #edf6f5;
  --muted: #98a6b3;
  --line: #283443;
  --accent: #36d3c2;
  --gold: #f4b44f;
  --shadow: 0 20px 55px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(145deg, rgba(54, 211, 194, 0.11), transparent 36%),
    linear-gradient(215deg, rgba(244, 180, 79, 0.08), transparent 34%),
    linear-gradient(180deg, #08090d 0%, #0b0f14 50%, #08090d 100%);
  color: var(--ink);
  font: 15px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.topbar {
  z-index: 10;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  padding: 20px clamp(16px, 4vw, 44px);
  background: rgba(9, 12, 17, 0.92);
  border-bottom: 1px solid rgba(80, 100, 123, 0.42);
  backdrop-filter: blur(14px);
}

.brandLockup {
  display: flex;
  gap: 14px;
  align-items: center;
  min-width: 0;
}

.brandLogo {
  width: clamp(58px, 7vw, 86px);
  height: clamp(58px, 7vw, 86px);
  flex: 0 0 auto;
  border: 1px solid rgba(54, 211, 194, 0.45);
  border-radius: 50%;
  background: #030508;
  box-shadow: 0 0 24px rgba(54, 211, 194, 0.24), 0 0 34px rgba(244, 180, 79, 0.14);
  object-fit: cover;
}

h1, h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(25px, 4vw, 36px);
  line-height: 1.05;
}

h2 {
  font-size: 18px;
}

p {
  margin: 5px 0 0;
  color: var(--muted);
}

.benchmarkMeta {
  margin: 8px 0 10px;
  padding: 8px 10px;
  border-left: 3px solid var(--gold);
  background: rgba(244, 180, 79, 0.08);
  color: #d9e2ea;
  font-size: 13px;
}

.topbar p {
  max-width: 680px;
}

.badge {
  flex: 0 0 auto;
  padding: 8px 11px;
  border: 1px solid rgba(54, 211, 194, 0.45);
  border-radius: 8px;
  background: rgba(15, 111, 103, 0.24);
  color: #b7fff6;
  font-weight: 750;
  white-space: nowrap;
}

.layout {
  display: grid;
  grid-template-columns: minmax(210px, 250px) minmax(0, 1fr);
  gap: 20px;
  max-width: 1500px;
  margin: 0 auto;
  padding: 20px;
}

.solverRail {
  position: sticky;
  top: 112px;
  align-self: start;
  min-width: 0;
}

.railTitle, .tabGroupLabel {
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.railTitle {
  margin: 0 0 10px;
  color: var(--muted);
}

.tabs, .tabGroup {
  display: grid;
  gap: 8px;
}

.tabGroup {
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(80, 100, 123, 0.35);
}

.tabGroup:last-child {
  border-bottom: 0;
}

.tabGroupLabel {
  color: var(--gold);
}

.appBody {
  min-width: 0;
}

.globalControls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px 14px;
  align-items: end;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid rgba(80, 100, 123, 0.48);
  border-radius: 8px;
  background: rgba(15, 20, 27, 0.78);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.22);
}

button, .fileButton {
  min-height: 40px;
  padding: 10px 13px;
  border: 1px solid rgba(54, 211, 194, 0.62);
  border-radius: 8px;
  background: linear-gradient(180deg, #42dfcf 0%, #29b9ab 100%);
  color: #041c19;
  box-shadow: 0 10px 24px rgba(18, 173, 159, 0.16);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}

button:hover, .fileButton:hover {
  filter: brightness(1.06);
}

.tab {
  position: relative;
  width: 100%;
  min-height: 38px;
  padding: 10px 12px 10px 14px;
  border: 1px solid transparent;
  background: transparent;
  box-shadow: none;
  color: #c8d3dd;
  text-align: left;
}

.tab:hover {
  border-color: rgba(80, 100, 123, 0.65);
  background: rgba(20, 27, 36, 0.72);
  filter: none;
}

.tab.active {
  border-color: rgba(54, 211, 194, 0.72);
  background: linear-gradient(90deg, rgba(54, 211, 194, 0.24), rgba(244, 180, 79, 0.08));
  color: #f4fffd;
}

.tab.active::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 3px;
  background: var(--accent);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.88fr);
  gap: 18px;
}

.panel, .outputPanel {
  display: none;
  min-width: 0;
  padding: 18px;
  border: 1px solid rgba(80, 100, 123, 0.48);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(20, 27, 36, 0.98), rgba(13, 18, 25, 0.98));
  box-shadow: var(--shadow);
}

.panel.active, .outputPanel {
  display: block;
}

.panelHead {
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(80, 100, 123, 0.32);
}

label {
  display: block;
  margin: 12px 0 6px;
  color: #dce6ee;
  font-weight: 760;
}

textarea, input, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #090e14;
  color: var(--ink);
  outline: none;
  font: 14px/1.4 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

textarea {
  min-height: 330px;
  padding: 12px;
  resize: vertical;
}

input, select {
  min-height: 40px;
  padding: 8px 10px;
}

textarea:focus, input:focus, select:focus {
  border-color: rgba(54, 211, 194, 0.78);
  box-shadow: 0 0 0 3px rgba(54, 211, 194, 0.12);
}

.switchLine {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  min-height: 40px;
}

.switchLine input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switchTrack {
  position: relative;
  width: 46px;
  height: 26px;
  border: 1px solid rgba(80, 100, 123, 0.8);
  border-radius: 999px;
  background: #0a1017;
}

.switchTrack::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #8fa1b2;
  transition: transform 140ms ease, background 140ms ease;
}

.switchLine input:checked + .switchTrack {
  border-color: rgba(54, 211, 194, 0.76);
  background: rgba(54, 211, 194, 0.22);
}

.switchLine input:checked + .switchTrack::after {
  transform: translateX(20px);
  background: var(--accent);
}

.fieldNote {
  grid-column: 1 / -1;
  margin-top: 8px;
  font-size: 13px;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
}

.fileButton {
  position: relative;
  overflow: hidden;
  border-color: rgba(80, 100, 123, 0.7);
  background: #17212c;
  box-shadow: none;
  color: #dfe8ef;
}

.fileButton input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.outputHead {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

#clearOutput {
  min-height: 34px;
  padding: 7px 10px;
  border-color: rgba(244, 180, 79, 0.58);
  background: #2b2113;
  box-shadow: none;
  color: #ffe4ad;
}

pre {
  min-height: 620px;
  margin: 0;
  padding: 14px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #070b10;
  color: #e8eef4;
  white-space: pre-wrap;
  font: 13px/1.45 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

code {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .solverRail {
    position: static;
  }

  .tabs {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }

  .tabGroup {
    padding: 12px;
    border: 1px solid rgba(80, 100, 123, 0.35);
    border-radius: 8px;
    background: rgba(15, 20, 27, 0.62);
  }
}

@media (max-width: 900px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .brandLockup {
    align-items: flex-start;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .globalControls {
    grid-template-columns: 1fr;
  }

  pre {
    min-height: 360px;
  }
}
