/* Copyright (c) 2026 kosa8. All rights reserved. Proprietary; see LICENSE. */

/* Run it (try-run.js): a code box, a Run button, the output. Black and
   white, the site's own fonts when the page has them; light and dark. */
.k8try {
  --k8-paper: #ffffff;
  --k8-fill: #f5f5f5;
  --k8-text: #1c1c1c;
  --k8-text-2: #5a5a5a;
  --k8-line: #e4e4e4;
  --k8-line-2: #c4c4c4;
  --k8-ink: #1c1c1c;
  --k8-on-ink: #ffffff;
  --k8-term: #111111;
  --k8-term-text: #ededed;
  --k8-ok: #1f7a30;
  --k8-bad: #b3261e;
  --k8-mono: "JetBrains Mono", ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --k8-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  box-sizing: border-box;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  text-align: left;
  background: var(--k8-paper);
  color: var(--k8-text);
  border: 1px solid var(--k8-line);
  border-radius: 12px;
  padding: 12px;
  font: 14px/1.5 var(--k8-sans);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 12px 32px -16px rgba(0, 0, 0, .16);
}
@media (prefers-color-scheme: dark) {
  .k8try {
    --k8-paper: #161616;
    --k8-fill: #1f1f1f;
    --k8-text: #ededed;
    --k8-text-2: #b4b4b4;
    --k8-line: #2c2c2c;
    --k8-line-2: #4a4a4a;
    --k8-ink: #ededed;
    --k8-on-ink: #111111;
    --k8-term: #0b0b0b;
    --k8-ok: #5fd06d;
    --k8-bad: #f0776c;
  }
}
.k8try *, .k8try *::before, .k8try *::after { box-sizing: border-box; }
.k8try [hidden] { display: none !important; }

.k8try__bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.k8try__langs { display: inline-flex; gap: 2px; background: var(--k8-fill); border: 1px solid var(--k8-line); border-radius: 8px; padding: 2px; }
.k8try__lang {
  font: 500 13px/1 var(--k8-sans); color: var(--k8-text-2); background: transparent; border: 0; border-radius: 6px;
  padding: 7px 10px; cursor: pointer; min-height: 32px;
}
.k8try__lang[aria-checked="true"] { background: var(--k8-paper); color: var(--k8-text); box-shadow: 0 0 0 1px var(--k8-line); }
.k8try__run {
  display: inline-flex; align-items: center; gap: 8px; font: 600 14px/1 var(--k8-sans);
  background: var(--k8-ink); color: var(--k8-on-ink); border: 1px solid var(--k8-ink); border-radius: 8px;
  padding: 9px 16px; min-height: 38px; cursor: pointer;
}
.k8try__run:hover { opacity: .9; }
.k8try__run:disabled { opacity: .6; cursor: progress; }
.k8try__kbd { font: 11px/1 var(--k8-mono); opacity: .7; }
.k8try__lang:focus-visible, .k8try__run:focus-visible, .k8try__code:focus-visible, .k8try__term:focus-visible,
.k8try__next a:focus-visible { outline: 2px solid var(--k8-text); outline-offset: 2px; }

.k8try__sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.k8try__code {
  display: block; width: 100%; resize: vertical; min-height: 96px; margin: 0;
  font: 13px/1.6 var(--k8-mono); color: var(--k8-text); background: var(--k8-fill);
  border: 1px solid var(--k8-line); border-radius: 8px; padding: 12px; tab-size: 4;
  white-space: pre; overflow: auto;
}
.k8try__hint { margin: 6px 2px 10px; font-size: 12px; color: var(--k8-text-2); }

.k8try__out { border-top: 1px solid var(--k8-line); padding-top: 10px; }
.k8try__state { font: 500 13px/1.5 var(--k8-sans); color: var(--k8-text-2); min-height: 20px; }
.k8try__state.is-ok { color: var(--k8-ok); }
.k8try__state.is-bad { color: var(--k8-bad); }
.k8try.is-running .k8try__state::before {
  content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%;
  background: currentColor; vertical-align: 1px; animation: k8try-pulse 1s ease-in-out infinite;
}
@keyframes k8try-pulse { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .k8try.is-running .k8try__state::before { animation: none; } }
.k8try__term {
  margin: 8px 0 0; max-height: 320px; overflow: auto; background: var(--k8-term); color: var(--k8-term-text);
  font: 13px/1.55 var(--k8-mono); padding: 12px 14px; border-radius: 8px; white-space: pre-wrap; word-break: break-word;
}
.k8try__err { color: #f0a39b; }
.k8try__dim { color: #9a9a9a; }
.k8try__check { margin-top: 10px; min-height: 65px; }

.k8try__next { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 12px; }
.k8try__keep {
  display: inline-block; font: 600 14px/1 var(--k8-sans); text-decoration: none;
  background: var(--k8-ink); color: var(--k8-on-ink); border-radius: 8px; padding: 11px 16px;
}
.k8try__share { color: var(--k8-text); font-size: 13px; text-decoration: underline; text-decoration-color: var(--k8-line-2); text-underline-offset: 3px; }

@media (max-width: 480px) {
  .k8try { padding: 10px; border-radius: 10px; }
  .k8try__run { flex: 1 1 auto; justify-content: center; }
  .k8try__langs { flex: 1 1 100%; }
  .k8try__lang { flex: 1 1 0; }
  .k8try__code { font-size: 12px; }
  .k8try__keep { flex: 1 1 100%; text-align: center; }
}
