/* 浏览器里运行 Python（viewer/pyrun.js）。颜色都用 shared-nav.css 的变量；按钮自己写，因为讲解手册没有 .button。 */
.py-box { display: grid; gap: 8px; margin: 10px 0; min-width: 0; }
.py-box > * { min-width: 0; }
.py-code { display: block; width: 100%; box-sizing: border-box; min-height: 120px; max-height: 75vh; resize: vertical; margin: 0; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); font: 12.5px/1.6 var(--font-mono); tab-size: 4; white-space: pre; overflow: auto; }
.py-code:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.py-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.py-box .py-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 6px 16px; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--surface); color: var(--ink); cursor: pointer; font: inherit; font-size: 13px; font-weight: 500; line-height: 1.3; }
.py-box .py-btn:hover:not(:disabled) { background: var(--surface-2); }
.py-box .py-btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.py-box .py-btn.primary:hover:not(:disabled) { background: var(--accent-hover); }
.py-box .py-btn:disabled { opacity: 0.45; cursor: default; }
.py-box .py-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.py-hint { font-size: 12px; color: var(--muted); }
.py-status { margin: 0; min-height: 1.4em; font-size: 13px; line-height: 1.6; color: var(--ink-2); }
.py-status[data-tone=warn] { color: var(--warn); }
.py-status[data-tone=bad] { color: var(--danger); }
.py-out { margin: 0; padding: 10px 12px; max-height: 360px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--ink); font: 12px/1.55 var(--font-mono); white-space: pre; tab-size: 4; }
.py-out .py-err { color: var(--danger); }
.py-chart { margin: 0; padding: 10px 12px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.py-chart figcaption { margin: 0 0 6px; font-size: 13px; font-weight: 600; color: var(--ink); }
.py-chart canvas { display: block; width: 100%; }
.py-legend { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12px; color: var(--ink-2); }
.py-legend li { display: inline-flex; align-items: center; gap: 6px; }
.py-legend li::before { content: ""; width: 18px; border-top: 2.5px solid var(--c, var(--gold)); }
.py-legend li[data-dash]::before { border-top-style: dashed; }
.py-foot { margin: 0; font-size: 11.5px; color: var(--muted); }
.py-foot a { color: var(--accent-text); }
@media (max-width: 560px) { .py-hint { width: 100%; } .py-out { max-height: 300px; } }
@media (hover: none) and (pointer: coarse) { .py-hint { display: none; } } /* 触屏没有 Tab 和 Ctrl + Enter */
@media print { .py-bar, .py-status { display: none; } .py-code { height: auto !important; max-height: none; overflow: visible; white-space: pre-wrap; } }
