.py {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  margin: 1.5rem 0 2rem;
  min-width: 0;
}

.py-modes {
  align-items: center;
  gap: 8px;
}

.py-spacer {
  flex: 1 1 24px;
}

.py-preset {
  flex: 0 1 300px;
  width: auto;
  max-width: 100%;
}

.py-modenote {
  margin: 10px 0 0;
}

.py-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.py-form,
.py-out {
  min-width: 0;
}

.py-out {
  display: grid;
  gap: 16px;
}

.py-section > summary {
  cursor: pointer;
  font-weight: 700;
  list-style-position: inside;
}

.py-section[open] > summary {
  border-bottom: 1px solid var(--line);
}

.py-field {
  margin-bottom: 12px;
  align-content: start;
}

.py-split .grid-2,
.py-split .grid-3 {
  align-items: start;
}

.py-msg:empty {
  display: none;
}

.py-inline {
  margin-top: 4px;
  padding: 6px 10px;
  border-radius: var(--radius-s);
  border-left: 3px solid var(--muted);
  background: var(--raised);
  font-size: 0.86rem;
}

.py-inline.py-error {
  border-left-color: var(--bad);
  background: var(--bad-soft);
}

.py-inline.py-warn {
  border-left-color: var(--warn);
  background: var(--warn-soft);
}

.py-inline.py-info {
  border-left-color: var(--info);
  background: var(--info-soft);
}

.py-main {
  margin: -4px 0 12px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.py-subtitle {
  margin: 16px 0 6px;
}

.py-card {
  margin: 0 0 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: var(--raised);
}

.py-cardhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.py-rowfield {
  margin-bottom: 10px;
}

.py-children {
  display: grid;
  gap: 8px;
}

.py-child {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 6px;
  align-items: center;
}

.py-checks {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.py-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.92rem;
}

.py-classic {
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--info);
  border-radius: var(--radius-m);
  background: var(--info-soft);
  font-size: 0.92rem;
}

.py-outhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.py-outpanel .panel-body {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.py-outpanel p {
  margin: 0;
}

.py-pre {
  margin: 0;
  padding: 12px 14px;
  max-width: 100%;
  overflow-x: auto;
  background: var(--code-bg);
  color: var(--code-fg);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  font-family: var(--font-code);
  font-size: 0.86rem;
  line-height: 1.55;
  white-space: pre;
}

.py-pre code {
  display: block;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  white-space: pre;
  font-size: inherit;
}

.py-problems {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
}

.py-problems li {
  padding: 6px 10px;
  border-radius: var(--radius-s);
  border-left: 3px solid var(--muted);
  background: var(--raised);
  font-size: 0.88rem;
}

.py-problems li.py-error {
  border-left-color: var(--bad);
  background: var(--bad-soft);
}

.py-problems li.py-warn {
  border-left-color: var(--warn);
  background: var(--warn-soft);
}

.py-problems li.py-info {
  border-left-color: var(--info);
  background: var(--info-soft);
}

.page-body :not(pre) > code {
  white-space: normal;
  overflow-wrap: anywhere;
}

@media (min-width: 1100px) {
  .py-split {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .py-out {
    position: sticky;
    top: 76px;
    max-height: calc(100vh - 92px);
    overflow-y: auto;
  }
}

@media (max-width: 520px) {
  .py-child {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .py * {
    transition: none;
    animation: none;
  }
}
