.playground-main {
  padding-bottom: clamp(4rem, 8vw, 7rem);
}

.playground-intro {
  padding: clamp(3rem, 6vw, 5rem) 0 clamp(2.5rem, 5vw, 4rem);
}

.playground-intro h1 {
  max-width: none;
  font-size: clamp(3.8rem, 8vw, 6.5rem);
}

.playground-intro .lede {
  margin-top: 1rem;
}

.playground-skill-link {
  margin: 0.8rem 0 0;
  color: var(--muted);
}

.playground-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--paper-raised);
  box-shadow: var(--shadow);
}

.playground-editor-panel {
  min-width: 0;
  border-right: 1px solid var(--line);
}

.playground-panel-heading {
  display: flex;
  min-height: 3.4rem;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--line);
  background: var(--code-2);
}

.playground-panel-heading h2 {
  margin: 0;
  font-family: "Iosevka Term", ui-monospace, monospace;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.playground-panel-heading select {
  max-width: 14rem;
  padding: 0.38rem 0.65rem;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--paper-raised);
  color: var(--ink);
  font-size: 0.95rem;
}

.playground-editor {
  container-type: inline-size;
  position: relative;
  display: grid;
  grid-template-columns: 2.7rem minmax(0, 1fr);
  min-height: 370px;
  background: var(--code);
}

.playground-editor .line-number {
  position: absolute;
  inset: 0 auto 0 0;
  width: 2.7rem;
  overflow: hidden;
  border-right: 1px solid var(--line);
  color: var(--code-muted);
  font-size: 0;
  line-height: 0;
}

.playground-editor .line-number-content {
  display: block;
  width: 100%;
  padding: 1rem 0.8rem;
  font: min(0.9rem, calc(4cqi - 0.132rem))/1.65 "Iosevka Term", ui-monospace, monospace;
  text-align: right;
  white-space: pre;
  will-change: transform;
}

.playground-editor .source-stack {
  position: relative;
  grid-column: 2;
  display: block;
  min-width: 0;
  min-height: 370px;
}

.playground-editor .source-highlights,
.playground-editor textarea {
  width: 100%;
  min-height: 370px;
  border: 0;
}

.playground-editor .source-highlight-line,
.playground-editor textarea {
  font: min(0.9rem, calc(4cqi - 0.132rem))/1.65 "Iosevka Term", ui-monospace, monospace;
  tab-size: 2;
  white-space: pre;
  overflow-wrap: normal;
}

.playground-editor textarea {
  padding: 1rem;
}

.playground-editor .source-highlights {
  position: absolute;
  z-index: 0;
  inset: 0;
  overflow: hidden;
  color: transparent;
  font-size: 0;
  line-height: 0;
  pointer-events: none;
}

.playground-editor .source-highlight-line {
  position: absolute;
  right: 0;
  left: 0;
  display: block;
}

.playground-editor .source-highlight-text {
  position: absolute;
  top: 0;
  white-space: pre;
}

.playground-editor .source-highlight-line.error-line {
  background: linear-gradient(
    to bottom,
    transparent 18%,
    rgb(183 110 121 / 9%) 18% 82%,
    transparent 82%
  );
}

.playground-editor .source-error-span {
  text-decoration: underline wavy var(--rust-dark) 1.25px;
  text-underline-offset: 0.3em;
}

.playground-editor textarea {
  position: relative;
  z-index: 1;
  display: block;
  resize: vertical;
  outline: 0;
  background: transparent;
  color: var(--code-text);
  caret-color: var(--ink);
}

.playground-editor textarea.source-line-height-probe {
  position: absolute;
  top: 0;
  left: 0;
  width: 10rem;
  height: 0;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  visibility: hidden;
  resize: none;
  pointer-events: none;
}

.playground-editor textarea:focus {
  box-shadow: inset 0 0 0 2px rgb(117 101 157 / 35%);
}

.playground-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  padding: 0.8rem 1rem;
  border-top: 1px solid var(--line);
  background: var(--paper-raised);
}

.playground-shortcut,
#duration,
.revision {
  color: var(--muted);
  font-size: 0.82rem;
}

.playground-actions button {
  min-height: 42px;
  padding: 0.55rem 1rem;
  border: 1px solid var(--ink);
  border-radius: 4px;
  background: var(--ink);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.playground-actions button:hover {
  border-color: var(--rust-dark);
  background: var(--rust-dark);
}

.playground-actions button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.playground-result-panel {
  min-width: 0;
}

.playground-result-panel .outcome {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

.playground-result-panel .outcome.completed {
  color: #27613f;
  background: #eaf6ee;
}

.playground-result-panel .outcome.rejected,
.playground-result-panel .outcome.runtime_error,
.playground-result-panel .outcome.compiler_failure,
.playground-result-panel .outcome.service_error {
  color: #7f4552;
  background: #fff0f0;
}

.playground-result-panel .outcome.timed_out,
.playground-result-panel .outcome.output_limit {
  color: #7b5012;
  background: #fff6df;
}

.playground-result-panel .terminal {
  min-height: 300px;
  max-height: 470px;
  margin: 0;
  overflow: auto;
  padding: 1rem;
  background: var(--ink);
  color: #f7f1f8;
  font: 0.85rem/1.6 "Iosevka Term", ui-monospace, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.playground-result-panel .muted {
  color: #aaa4b5;
}

.playground-result-panel .diagnostics {
  display: grid;
  gap: 1px;
  border-bottom: 1px solid var(--line);
  background: var(--line);
}

.playground-result-panel .diagnostic {
  display: grid;
  grid-template-columns: minmax(7rem, auto) 1fr;
  gap: 1rem;
  padding: 0.7rem 1rem;
  background: #fff7f7;
  font-size: 0.9rem;
}

.playground-result-panel .diagnostic strong {
  color: var(--rust-dark);
}

.playground-result-panel .revision {
  margin: 0;
  padding: 0.65rem 1rem;
}

.playground-page .visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

@media (max-width: 820px) {
  .playground-workspace {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 620px) {
  .playground-intro {
    padding-top: 3rem;
  }

  .playground-editor,
  .playground-editor .source-stack,
  .playground-editor .source-highlights,
  .playground-editor textarea {
    min-height: 300px;
  }

  .playground-shortcut {
    display: none;
  }

  .playground-result-panel .diagnostic {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }
}
