:root {
  --bg: #0b0d12;
  --panel: #12151c;
  --panel-2: #181c26;
  --line: #2a3140;
  --text: #e8edf7;
  --muted: #8b95a8;
  --blue: #3776ab;
  --yellow: #ffd43b;
  --ok: #7ee787;
  --err: #ff7b72;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(55, 118, 171, 0.18), transparent 55%),
    radial-gradient(900px 400px at 100% 0%, rgba(255, 212, 59, 0.08), transparent 50%),
    var(--bg);
  font-family: "IBM Plex Sans", sans-serif;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.boot {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  background: rgba(11, 13, 18, 0.92);
  backdrop-filter: blur(10px);
}

.boot[hidden] {
  display: none;
}

.boot-card {
  width: min(420px, calc(100vw - 32px));
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.boot-mark,
.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background:
    linear-gradient(180deg, var(--blue) 50%, var(--yellow) 50%);
}

.boot-title,
.brand strong {
  font-weight: 600;
}

.boot-title {
  margin: 16px 0 6px;
  font-size: 18px;
}

.boot-status {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 14px;
}

.boot-bar {
  height: 6px;
  overflow: hidden;
  border-radius: 99px;
  background: #232836;
}

.boot-bar span {
  display: block;
  width: 30%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--yellow));
  animation: load 1.2s ease-in-out infinite;
}

@keyframes load {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(380%); }
}

.top,
.status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.top {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(18, 21, 28, 0.86);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.top-actions,
.pane-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lang-switch {
  display: flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0e1218;
}

.lang-btn {
  height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 500;
}

.lang-btn.active {
  background: var(--blue);
  color: #fff;
}

body[data-lang="cpp"] .lang-btn.active {
  background: #00599c;
}

body[data-lang="cpp"] .primary {
  border-color: #2f7ab8;
  background: #00599c;
}

select,
textarea,
button {
  font: inherit;
}

select,
.ghost,
.primary,
.text-btn {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--text);
}

select,
.ghost,
.primary {
  height: 38px;
  padding: 0 12px;
  cursor: pointer;
}

.primary {
  border-color: #4d8cc4;
  background: var(--blue);
  font-weight: 600;
}

.primary:disabled,
.ghost:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.primary.running {
  background: #5a3d12;
  border-color: #a07a1a;
  color: var(--yellow);
}

.text-btn {
  height: 28px;
  padding: 0 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  height: calc(100% - 109px);
}

.pane {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
}

.output-pane {
  border-right: 0;
}

.pane-head {
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
}

.hint {
  opacity: 0.8;
}

#editor {
  flex: 1;
  min-height: 220px;
}

.stdin-box {
  padding: 10px 14px 14px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

.stdin-box label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}

textarea {
  width: 100%;
  height: 72px;
  padding: 10px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0e1218;
  color: var(--text);
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
}

.output {
  flex: 1;
  margin: 0;
  padding: 14px;
  overflow: auto;
  background: #0a0d12;
  color: #d7e0ea;
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.output .err {
  color: var(--err);
}

.output .ok {
  color: var(--ok);
}

.output .meta {
  color: var(--muted);
}

.plots {
  display: grid;
  gap: 10px;
  padding: 12px 14px 16px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

.plots img {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.status {
  padding: 8px 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 48px;
  z-index: 30;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.ace_editor {
  font-family: "IBM Plex Mono", monospace !important;
}

@media (max-width: 860px) {
  .top,
  .top-actions {
    flex-wrap: wrap;
  }

  .workspace {
    grid-template-columns: 1fr;
    height: auto;
    min-height: calc(100% - 150px);
  }

  .pane {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  #editor {
    height: 42vh;
  }

  .output {
    min-height: 28vh;
  }
}
