/* The playground inherits the portfolio palette in either theme. */
.playground-section { padding-block: 70px 36px; }
.playground-heading { max-width: 670px; margin-bottom: 30px; }
.playground-heading h2 { margin: 0 0 12px; font-size: clamp(2rem, 4vw, 3.8rem); line-height: 1.04; letter-spacing: -.055em; }
.playground-heading > p { color: var(--muted); font-size: 1.125rem; }
.playground-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: start; gap: 26px; }
.playground-panel { min-width: 0; padding: clamp(20px, 3vw, 32px); border: 1px solid var(--line); border-radius: 22px; background: linear-gradient(145deg, color-mix(in srgb, var(--surface-2) 75%, transparent), var(--surface)); box-shadow: inset 0 1px 0 color-mix(in srgb, var(--text) 9%, transparent), 0 18px 40px #0002; }
.puzzle-panel { margin-top: 54px; }
.playground-panel-heading h3 { margin: 0 0 12px; font-size: clamp(1.45rem, 2.1vw, 2rem); line-height: 1.15; letter-spacing: -.035em; }
.playground-panel-heading p { margin: 0 0 24px; color: var(--muted); font-size: 1rem; line-height: 1.65; }
.playground-enhancement[hidden], .playground-fallback[hidden] { display: none !important; }
.julia-screen { position: relative; overflow: hidden; border: 1px solid #fff2; border-radius: 12px; background: #100f13; box-shadow: inset 0 2px 12px #0008, 0 0 0 5px color-mix(in srgb, var(--text) 4%, transparent); }
.julia-screen canvas { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; }
.julia-equation { position: absolute; bottom: 12px; left: 14px; margin: 0; padding: 4px 10px; border-radius: 6px; background: #161116d9; color: #fff1df; font: 1rem ui-monospace, monospace; pointer-events: none; }
.julia-controls { margin-top: 26px; }
.julia-controls label { display: flex; justify-content: space-between; gap: 15px; font-size: .9375rem; }
.julia-controls output, .julia-value { font-family: ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.julia-controls input[type="range"] { display: block; width: 100%; height: 30px; margin: 3px 0 14px; accent-color: var(--accent); cursor: pointer; }
.julia-value { margin: 0; font-size: .875rem; }
.playground-controls-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.playground-button { min-height: 42px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 8px; background: linear-gradient(var(--surface-2), var(--surface)); box-shadow: inset 0 1px 0 color-mix(in srgb, var(--text) 9%, transparent), 0 2px 3px #0002; color: var(--text); font-family: inherit; font-size: .875rem; font-weight: 600; cursor: pointer; }
.playground-button:hover { border-color: var(--accent); }
.playground-button:active { transform: translateY(1px); box-shadow: inset 0 1px 3px #0003; }
.playground-project-link { display: inline-block; margin-top: 24px; text-decoration-thickness: 1px; text-underline-offset: 5px; font-size: .9375rem; font-weight: 600; }
.playground-project-link:hover { color: var(--accent); }
.puzzle-board { overflow: hidden; width: min(100%, 368px); margin: 0 auto; border: 6px solid #343035; border-radius: 7px; box-shadow: 0 4px 14px #0004; background: #343035; }
.puzzle-row { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); }
.puzzle-square { position: relative; display: grid; place-items: center; min-width: 0; aspect-ratio: 1; padding: 0; border: 0; border-radius: 0; background: #d4c5ac; color: #242128; font: clamp(1.45rem, 3.6vw, 2.65rem) "DejaVu Sans", "Segoe UI Symbol", serif; line-height: 1; cursor: pointer; }
.puzzle-square.is-dark { background: #77726b; }
.puzzle-square[data-piece="Q"], .puzzle-square[data-piece="K"] { color: #fffaf0; text-shadow: 1px 1px 0 #242128, -1px -1px 0 #242128, -1px 1px 0 #242128, 1px -1px 0 #242128, 0 2px 2px #0005; }
.puzzle-square::after { position: absolute; inset: 2px; border: 2px solid transparent; content: ""; pointer-events: none; }
.puzzle-square:hover::after { border-color: #fff9; }
.puzzle-square[aria-selected="true"] { background: #bd4540; }
.puzzle-square.is-solution { background: #77ad83; }
.puzzle-square:focus-visible { z-index: 1; outline: none; }
.puzzle-square:focus-visible::after { border: 3px solid #122e90; box-shadow: 0 0 0 1px #fff; }
.puzzle-coordinate { position: absolute; bottom: 2px; left: 3px; color: #171518; font: 600 14px/1 ui-monospace, monospace; text-shadow: none; pointer-events: none; }
.puzzle-keyboard { margin: 13px 0 0; color: var(--muted); font-size: .875rem; line-height: 1.5; }
.puzzle-message { min-height: 4.5em; margin: 15px 0; color: var(--text); font-size: .9375rem; line-height: 1.5; }
.playground-linux { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 14px; margin-top: 24px; }
.playground-linux p { margin: 0; color: var(--muted); font-size: 1rem; }
.playground-terminal-trigger { min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); font-size: .9375rem; cursor: pointer; }
.playground-terminal-trigger > span:first-child { margin-right: 5px; color: var(--accent); font-family: ui-monospace, monospace; font-weight: 700; }
.playground-terminal-trigger:hover { border-color: var(--accent); }
.portfolio-terminal { position: fixed; width: min(660px, calc(100vw - 32px)); max-height: calc(100dvh - 40px); padding: 0; overflow: auto; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); color: var(--text); box-shadow: 0 28px 100px #0008; }
.portfolio-terminal::backdrop { background: #090709b8; backdrop-filter: blur(6px); }
.portfolio-terminal-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); background: linear-gradient(var(--surface-2), var(--surface)); }
.portfolio-terminal-bar h2 { margin: 0; font-size: 1rem; letter-spacing: 0; }
.terminal-close { min-width: 42px; padding: 3px 8px; font-size: 1.6rem; line-height: 1; }
.portfolio-terminal > p { margin: 18px 22px 0; font-size: .875rem; color: var(--muted); }
.portfolio-terminal-output { height: 230px; margin: 18px 22px; overflow: auto; scrollbar-color: var(--muted) var(--surface); font: .9375rem/1.65 ui-monospace, monospace; }
.portfolio-terminal-output p { margin: 0 0 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
.portfolio-terminal-output .terminal-command { color: var(--accent); }
.portfolio-terminal-form { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--line); font: .875rem ui-monospace, monospace; }
.portfolio-terminal-form label { flex: 0 0 auto; color: var(--accent); }
.portfolio-terminal-form input { flex: 1 1 100px; min-width: 70px; width: 100%; min-height: 42px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; color: var(--text); font: inherit; }
.playground-visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
@media (max-width: 760px) {
  .playground-grid { grid-template-columns: minmax(0, 1fr); }
  .puzzle-panel { margin-top: 0; }
  .puzzle-square { font-size: clamp(1.5rem, 8vw, 2.65rem); }
  .playground-section { padding-top: 48px; }
  .playground-linux { justify-content: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  .playground-section *, .portfolio-terminal * { scroll-behavior: auto; transition: none; animation: none; }
}
