/* =====================================================================
   PYTHON PLAYGROUND: styles (all scoped to #python-playground)
   ===================================================================== */
#python-playground {
  --bg: #0A0E1F; --bg2: #0E1430; --panel: #121A3B; --panel2: #18224C; --line: #24305F; --line2: #33418A;
  --head: #F2F5FF; --text: #C3CBEE; --muted: #8D97C9;
  --blue: #2F6BFF; --blue-hi: #4C80FF; --blue-soft: #82A6FF; --cyan: #22D3EE; --violet: #A78BFA; --pink: #F472B6;
  --green: #4ADE80; --amber: #FBBF24; --red: #FB7185; --ink: #0A0E1F;
  --code-bg: #0B1027; --code-line: #121A3B;
  --font: "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --r: 14px; --pp-lh: 22px;
}
#python-playground { all: initial; display: block; min-height: 100vh; font-family: var(--font); font-size: 15.5px; line-height: 1.55; color: var(--text); background: var(--bg);
  background-image: radial-gradient(900px 500px at 100% -10%, rgba(167,139,250,.12), transparent 60%), radial-gradient(800px 500px at -10% 10%, rgba(34,211,238,.07), transparent 60%);
  -webkit-font-smoothing: antialiased; text-align: left; }
#python-playground :where(*, *::before, *::after) { box-sizing: border-box; margin: 0; padding: 0; border: 0; background: none; font: inherit; color: inherit; line-height: inherit; letter-spacing: normal; text-transform: none; text-decoration: none; list-style: none; min-width: 0; max-width: none; box-shadow: none; outline: 0; }
#python-playground :where(button) { cursor: pointer; -webkit-appearance: none; appearance: none; text-align: center; }
#python-playground :where(input, textarea, select) { -webkit-appearance: none; appearance: none; }
#python-playground :where(svg) { display: block; overflow: visible; }
#python-playground [hidden] { display: none !important; }
#python-playground :focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; border-radius: 8px; }
#python-playground [tabindex="-1"]:focus { outline: none; }
#python-playground .pp-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
#python-playground h1, #python-playground h2, #python-playground h3, #python-playground h4 { color: var(--head); font-weight: 700; line-height: 1.2; letter-spacing: -.01em; }
#python-playground h1 { font-size: clamp(26px, 3.6vw, 38px); letter-spacing: -.02em; }
#python-playground h2 { font-size: clamp(21px, 2.6vw, 27px); }
#python-playground h3 { font-size: 17px; }
#python-playground h4 { font-size: 15px; }
#python-playground p { max-width: 74ch; }
#python-playground b, #python-playground strong { color: var(--head); font-weight: 650; }
#python-playground i, #python-playground em { font-style: italic; }
#python-playground code { font-family: var(--mono); font-size: .9em; padding: 1px 6px; border-radius: 6px; background: var(--code-bg); border: 1px solid var(--line); color: var(--cyan); }
#python-playground .pp-muted { color: var(--muted); }
#python-playground .pp-small { font-size: 13.5px; }
#python-playground .pp-mono { font-family: var(--mono); }
#python-playground .pp-stack > * + * { margin-top: 12px; }
#python-playground .pp-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
#python-playground .pp-between { justify-content: space-between; }
#python-playground .pp-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); }
#python-playground .pp-g2 { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 900px) { #python-playground .pp-g2 { grid-template-columns: minmax(0, 1fr); } }

/* ---------- shell ---------- */
#python-playground .pp-top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 10px clamp(12px, 2.4vw, 24px); background: rgba(10,14,31,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
#python-playground .pp-brand { display: flex; align-items: center; gap: 10px; margin-right: auto; min-width: 0; }
#python-playground .pp-logo { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(135deg, var(--blue), var(--violet)); color: #fff; font-family: var(--mono); font-weight: 800; font-size: 15px; flex: none; }
#python-playground .pp-brand-t { display: block; color: var(--head); font-weight: 800; font-size: 16px; letter-spacing: .02em; line-height: 1.1; }
#python-playground .pp-brand-s { display: block; color: var(--muted); font-size: 12px; }
#python-playground .pp-status { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line2); font-size: 12.5px; font-weight: 650; color: var(--text); max-width: 100%; }
#python-playground .pp-status i { width: 9px; height: 9px; border-radius: 50%; background: var(--amber); flex: none; animation: pp-pulse 1.2s ease-in-out infinite; }
#python-playground .pp-status.is-ready i { background: var(--green); animation: none; box-shadow: 0 0 8px var(--green); }
#python-playground .pp-status.is-error i { background: var(--red); animation: none; }
#python-playground .pp-status.is-busy i { background: var(--cyan); }
#python-playground .pp-pts { font-family: var(--mono); font-weight: 800; color: var(--amber); font-size: 14px; padding: 5px 10px; border-radius: 999px; background: rgba(251,191,36,.1); border: 1px solid rgba(251,191,36,.35); white-space: nowrap; }
#python-playground .pp-select { min-height: 36px; padding: 6px 30px 6px 12px; border-radius: 10px; background: var(--bg2); border: 1px solid var(--line2); color: var(--head); font-size: 13.5px; font-weight: 650; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%2382A6FF' stroke-width='2'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
#python-playground .pp-select option { background: #121A3B; color: #F2F5FF; }
#python-playground .pp-layout { display: grid; grid-template-columns: 214px minmax(0, 1fr); min-height: calc(100vh - 58px); }
#python-playground .pp-nav { position: sticky; top: 58px; align-self: start; height: calc(100vh - 58px); overflow-y: auto; padding: 14px 10px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px; }
#python-playground .pp-nav button { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: var(--text); font-weight: 600; font-size: 14px; text-align: left; }
#python-playground .pp-nav button svg { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#python-playground .pp-nav button:hover { background: var(--panel); color: var(--head); }
#python-playground .pp-nav button[aria-current="page"] { background: rgba(47,107,255,.18); color: var(--head); box-shadow: inset 3px 0 0 var(--cyan); }
#python-playground .pp-nav .pp-nav-sep { height: 1px; background: var(--line); margin: 8px 6px; }
#python-playground .pp-main { padding: clamp(14px, 2.4vw, 28px); min-width: 0; }
#python-playground .pp-view { max-width: 1320px; margin: 0 auto; animation: pp-in .3s ease; }
@media (max-width: 860px) {
  #python-playground .pp-layout { grid-template-columns: minmax(0, 1fr); }
  #python-playground .pp-nav { position: sticky; top: 0; height: auto; flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px; background: var(--bg); z-index: 20; }
  #python-playground .pp-nav button { flex: none; padding: 8px 11px; font-size: 13px; }
  #python-playground .pp-nav .pp-nav-sep { display: none; }
  #python-playground .pp-top { position: static; }
  #python-playground .pp-brand-s { display: none; }
}

/* ---------- headings, cards, buttons ---------- */
#python-playground .pp-head { margin-bottom: 18px; }
#python-playground .pp-head p { margin-top: 6px; }
#python-playground .pp-kicker { display: inline-flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
#python-playground .pp-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: rgba(130,166,255,.12); color: var(--blue-soft); border: 1px solid rgba(130,166,255,.3); white-space: nowrap; }
#python-playground .pp-chip.c-A { color: var(--green); background: rgba(74,222,128,.1); border-color: rgba(74,222,128,.35); }
#python-playground .pp-chip.c-B { color: var(--cyan); background: rgba(34,211,238,.1); border-color: rgba(34,211,238,.35); }
#python-playground .pp-chip.c-C { color: var(--violet); background: rgba(167,139,250,.12); border-color: rgba(167,139,250,.4); }
#python-playground .pp-chip.c-done { color: var(--green); background: rgba(74,222,128,.12); border-color: rgba(74,222,128,.45); }
#python-playground .pp-chip.c-err { color: var(--red); background: rgba(251,113,133,.1); border-color: rgba(251,113,133,.4); }
#python-playground .pp-card { background: rgba(18,26,59,.9); border: 1px solid var(--line); border-radius: var(--r); padding: clamp(14px, 2vw, 20px); min-width: 0; }
#python-playground .pp-card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
#python-playground .pp-btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 7px 15px; border-radius: 10px; font-weight: 700; font-size: 14px; color: #fff; background: var(--blue); border: 1.5px solid var(--blue); white-space: nowrap; transition: background-color .15s, transform .1s, opacity .2s; user-select: none; }
#python-playground .pp-btn:hover { background: var(--blue-hi); border-color: var(--blue-hi); }
#python-playground .pp-btn:active { transform: translateY(1px); }
#python-playground .pp-btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
#python-playground .pp-btn.run { background: #16A34A; border-color: #16A34A; }
#python-playground .pp-btn.run:hover { background: #1DB954; border-color: #1DB954; }
#python-playground .pp-btn.stop { background: #DC2626; border-color: #DC2626; }
#python-playground .pp-btn.check { background: var(--violet); border-color: var(--violet); color: var(--ink); }
#python-playground .pp-btn.check:hover { background: #BCA6FF; border-color: #BCA6FF; }
#python-playground .pp-btn.line { background: transparent; color: var(--blue-soft); border-color: rgba(130,166,255,.45); }
#python-playground .pp-btn.line:hover { background: rgba(130,166,255,.12); color: var(--head); }
#python-playground .pp-btn.ghost { background: transparent; color: var(--text); border-color: transparent; }
#python-playground .pp-btn.ghost:hover { background: var(--panel2); color: var(--head); }
#python-playground .pp-btn.sm { min-height: 32px; padding: 4px 10px; font-size: 13px; border-radius: 8px; }
#python-playground .pp-btn.lg { min-height: 48px; padding: 10px 22px; font-size: 16px; border-radius: 12px; }
#python-playground .pp-btn:disabled { opacity: .45; cursor: not-allowed; }
#python-playground .pp-btn.icon { padding: 6px 9px; }

/* ---------- editor ---------- */
#python-playground .pp-ed { --pp-ed-h: 300px; position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); height: var(--pp-ed-h); background: var(--code-bg); border: 1px solid var(--line2); border-radius: 12px; overflow: hidden; font-family: var(--mono); font-size: 14px; line-height: var(--pp-lh); }
#python-playground .pp-ed:focus-within { border-color: var(--blue-soft); box-shadow: 0 0 0 3px rgba(47,107,255,.2); }
#python-playground .pp-gutter { overflow: hidden; background: #090D21; border-right: 1px solid var(--line); color: #4A5690; text-align: right; user-select: none; }
#python-playground .pp-gutter-in { padding: 12px 10px 12px 12px; min-width: 42px; }
#python-playground .pp-gutter-in div { height: var(--pp-lh); }
#python-playground .pp-gutter-in div.is-err { color: var(--red); font-weight: 800; }
#python-playground .pp-ed-area { position: relative; overflow: hidden; }
#python-playground .pp-ed textarea, #python-playground .pp-ed .pp-hl { position: absolute; inset: 0; margin: 0; padding: 12px 14px; border: 0; font-family: var(--mono); font-size: 14px; line-height: var(--pp-lh); tab-size: 4; -moz-tab-size: 4; white-space: pre; overflow-wrap: normal; word-wrap: normal; letter-spacing: 0; }
#python-playground .pp-ed .pp-hl { color: #DCE3FF; pointer-events: none; overflow: visible; bottom: auto; right: auto; min-width: 100%; }
#python-playground .pp-ed textarea { width: 100%; height: 100%; color: transparent; caret-color: #fff; background: transparent; resize: none; overflow: auto; outline: none; z-index: 1; }
#python-playground .pp-ed textarea::selection { background: rgba(130,166,255,.35); color: transparent; }
#python-playground .pp-ed.is-ro textarea { caret-color: transparent; }
#python-playground .pp-errband { position: absolute; left: 0; right: 0; top: 12px; height: var(--pp-lh); background: rgba(251,113,133,.16); border-left: 3px solid var(--red); pointer-events: none; }
#python-playground .pp-hl .t-kw { color: #C792EA; font-weight: 600; } #python-playground .pp-hl .t-st { color: #A5E075; } #python-playground .pp-hl .t-nu { color: #F78C6C; }
#python-playground .pp-hl .t-cm { color: #6A75A8; font-style: italic; } #python-playground .pp-hl .t-fn { color: #82AAFF; } #python-playground .pp-hl .t-cl { color: #FFCB6B; }
#python-playground .pp-hl .t-bi { color: #22D3EE; } #python-playground .pp-hl .t-de { color: #FF9CAC; } #python-playground .pp-hl .t-op { color: #89DDFF; }
#python-playground pre.pp-code { font-family: var(--mono); font-size: 14px; line-height: var(--pp-lh); background: var(--code-bg); border: 1px solid var(--line2); border-radius: 12px; padding: 12px 14px; overflow-x: auto; white-space: pre; color: #DCE3FF; }
#python-playground pre.pp-code .ln { display: block; padding: 0 6px; margin: 0 -6px; border-radius: 4px; }
#python-playground pre.pp-code .ln.is-cur { background: rgba(251,191,36,.18); box-shadow: inset 3px 0 0 var(--amber); }
#python-playground pre.pp-code .ln.is-done { background: rgba(130,166,255,.06); }

/* ---------- workspace (editor + console) ---------- */
#python-playground .pp-ws { display: grid; gap: 10px; }
#python-playground .pp-ws-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
#python-playground .pp-ws-bar .pp-spacer { flex: 1; }
#python-playground .pp-ws-body { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
#python-playground .pp-ws.is-wide .pp-ws-body { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
@media (max-width: 1100px) { #python-playground .pp-ws.is-wide .pp-ws-body { grid-template-columns: minmax(0, 1fr); } }
#python-playground .pp-console { display: flex; flex-direction: column; min-height: 150px; max-height: 420px; background: #070A18; border: 1px solid var(--line2); border-radius: 12px; overflow: hidden; }
#python-playground .pp-ws.is-wide .pp-console { height: var(--pp-ed-h, 300px); max-height: none; }
#python-playground .pp-console-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px 6px 12px; border-bottom: 1px solid var(--line); font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .06em; }
#python-playground .pp-out { flex: 1; overflow: auto; padding: 10px 12px; font-family: var(--mono); font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; color: #E6EBFF; }
#python-playground .pp-out .o-err { color: var(--red); } #python-playground .pp-out .o-in { color: var(--cyan); font-weight: 700; }
#python-playground .pp-out .o-sys { color: var(--muted); font-style: italic; } #python-playground .pp-out .o-ok { color: var(--green); }
#python-playground .pp-out .o-placeholder { color: #4A5690; }
#python-playground .pp-inline-in { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-top: 1px solid var(--line); background: rgba(34,211,238,.06); }
#python-playground .pp-inline-in label { font-family: var(--mono); font-size: 13px; color: var(--cyan); font-weight: 700; white-space: nowrap; }
#python-playground .pp-inline-in input { flex: 1; min-width: 0; min-height: 36px; padding: 6px 10px; border-radius: 8px; background: var(--code-bg); border: 1.5px solid var(--cyan); color: #fff; font-family: var(--mono); font-size: 14px; }
#python-playground .pp-stdin { width: 100%; min-height: 64px; padding: 8px 10px; border-radius: 10px; background: var(--code-bg); border: 1px solid var(--line2); color: #fff; font-family: var(--mono); font-size: 13.5px; resize: vertical; }
#python-playground .pp-textarea { width: 100%; min-height: 80px; padding: 10px 12px; border-radius: 12px; background: var(--bg2); border: 1.5px solid var(--line2); color: var(--head); font-size: 15px; line-height: 1.5; resize: vertical; }
#python-playground .pp-input { min-height: 38px; padding: 6px 10px; border-radius: 10px; background: var(--bg2); border: 1.5px solid var(--line2); color: var(--head); font-size: 14px; font-family: var(--mono); }
#python-playground .pp-textarea:focus, #python-playground .pp-input:focus, #python-playground .pp-stdin:focus { border-color: var(--blue-soft); }
#python-playground .pp-textarea::placeholder, #python-playground .pp-input::placeholder, #python-playground .pp-stdin::placeholder { color: #5A659C; }

/* error panel + test results */
#python-playground .pp-errbox { border: 1px solid rgba(251,113,133,.45); background: rgba(251,113,133,.07); border-radius: 12px; padding: 12px 14px; animation: pp-in .25s ease; }
#python-playground .pp-errbox h4 { color: var(--red); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
#python-playground .pp-errbox pre { margin-top: 8px; font-family: var(--mono); font-size: 12.5px; color: #FFC2CC; white-space: pre-wrap; background: rgba(0,0,0,.25); border-radius: 8px; padding: 8px 10px; max-height: 180px; overflow: auto; }
#python-playground .pp-errbox p { margin-top: 6px; }
#python-playground .pp-results { display: grid; gap: 6px; }
#python-playground .pp-res { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg2); font-size: 14px; }
#python-playground .pp-res .ic { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; font-size: 13px; color: var(--ink); }
#python-playground .pp-res.ok { border-color: rgba(74,222,128,.4); } #python-playground .pp-res.ok .ic { background: var(--green); }
#python-playground .pp-res.no { border-color: rgba(251,113,133,.45); } #python-playground .pp-res.no .ic { background: var(--red); }
#python-playground .pp-res pre { margin-top: 6px; font-family: var(--mono); font-size: 12.5px; white-space: pre-wrap; color: var(--muted); max-height: 120px; overflow: auto; }
#python-playground .pp-win { display: flex; gap: 14px; align-items: center; padding: 14px 16px; border-radius: 14px; background: linear-gradient(120deg, rgba(74,222,128,.16), rgba(34,211,238,.12)); border: 1px solid rgba(74,222,128,.5); animation: pp-pop .5s cubic-bezier(.34,1.56,.64,1); }
#python-playground .pp-win .big { font-size: 30px; line-height: 1; }
#python-playground .pp-note { border-left: 3px solid var(--amber); background: rgba(251,191,36,.07); padding: 10px 14px; border-radius: 0 10px 10px 0; font-size: 14px; }
#python-playground .pp-note.info { border-left-color: var(--blue-soft); background: rgba(130,166,255,.07); }

/* ---------- home ---------- */
#python-playground .pp-hero { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 20px; align-items: center; padding: clamp(18px, 3vw, 30px); border-radius: 20px; border: 1px solid var(--line); background: linear-gradient(135deg, rgba(47,107,255,.18), rgba(167,139,250,.12) 60%, rgba(34,211,238,.08)); margin-bottom: 18px; }
#python-playground .pp-hero pre.pp-code { font-size: 13px; }
@media (max-width: 860px) { #python-playground .pp-hero { grid-template-columns: minmax(0, 1fr); } }
#python-playground .pp-path { text-align: left; display: flex; flex-direction: column; gap: 8px; padding: 16px; border-radius: 16px; border: 1.5px solid var(--line); background: var(--panel); transition: border-color .15s, transform .15s; }
#python-playground .pp-path:hover { border-color: var(--blue-soft); transform: translateY(-2px); }
#python-playground .pp-path[aria-pressed="true"] { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(34,211,238,.18); }
#python-playground .pp-path .t { font-size: 18px; font-weight: 800; color: var(--head); }
#python-playground .pp-bar { height: 8px; border-radius: 99px; background: var(--bg2); overflow: hidden; border: 1px solid var(--line); }
#python-playground .pp-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--blue), var(--cyan)); border-radius: inherit; transition: width .4s; }
#python-playground .pp-tile { text-align: left; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: center; padding: 14px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); }
#python-playground .pp-tile:hover { border-color: var(--blue-soft); }
#python-playground .pp-tile .ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: rgba(47,107,255,.15); color: var(--cyan); }
#python-playground .pp-tile .ic svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#python-playground .pp-tile b { display: block; font-size: 15px; } #python-playground .pp-tile span { font-size: 13px; color: var(--muted); }
#python-playground .pp-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
#python-playground .pp-stat { padding: 12px 14px; border-radius: 12px; background: var(--bg2); border: 1px solid var(--line); }
#python-playground .pp-stat b { display: block; font-family: var(--mono); font-size: 22px; font-weight: 800; color: var(--head); line-height: 1.2; }
#python-playground .pp-stat span { font-size: 12.5px; color: var(--muted); font-weight: 600; }
#python-playground .pp-cycle { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 5px; }
#python-playground .pp-cycle li { display: flex; align-items: center; justify-content: center; gap: 5px; padding: 6px 2px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); font-size: 10.5px; font-weight: 800; letter-spacing: .04em; }
#python-playground .pp-cycle li::before { content: ""; width: 6px; height: 6px; border-radius: 50%; border: 2px solid currentColor; flex: none; }
#python-playground .pp-cycle li.is-lit { color: var(--head); border-color: rgba(34,211,238,.6); background: rgba(34,211,238,.1); }
#python-playground .pp-cycle li.is-lit::before { background: var(--cyan); border-color: var(--cyan); }
@media (max-width: 760px) { #python-playground .pp-cycle { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* ---------- lessons ---------- */
#python-playground .pp-split { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 1000px) { #python-playground .pp-split { grid-template-columns: minmax(0, 1fr); } }
#python-playground .pp-list { display: grid; gap: 4px; position: sticky; top: 76px; }
@media (max-width: 1000px) { #python-playground .pp-list { position: static; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); } }
#python-playground .pp-li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 9px; align-items: center; padding: 8px 10px; border-radius: 10px; text-align: left; color: var(--text); font-size: 14px; font-weight: 600; border: 1px solid transparent; }
#python-playground .pp-li:hover { background: var(--panel); }
#python-playground .pp-li[aria-current="true"] { background: var(--panel2); border-color: var(--line2); color: var(--head); }
#python-playground .pp-li .n { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-family: var(--mono); font-size: 12px; font-weight: 800; background: var(--bg2); color: var(--blue-soft); border: 1px solid var(--line); }
#python-playground .pp-li.is-done .n { background: var(--green); color: var(--ink); border-color: var(--green); }
#python-playground .pp-stage { position: relative; padding-left: 46px; }
#python-playground .pp-stage + .pp-stage { margin-top: 16px; }
#python-playground .pp-stage::before { content: attr(data-n); position: absolute; left: 0; top: 2px; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; font-family: var(--mono); font-weight: 800; color: var(--ink); background: var(--blue-soft); font-size: 13px; }
#python-playground .pp-stage::after { content: ""; position: absolute; left: 15px; top: 40px; bottom: -14px; width: 2px; background: var(--line); }
#python-playground .pp-stage:last-child::after { display: none; }
#python-playground .pp-stage.is-done::before { background: var(--green); content: "\2713"; }
#python-playground .pp-stage-t { font-size: 12px; font-weight: 800; letter-spacing: .1em; color: var(--blue-soft); margin-bottom: 6px; }
#python-playground .pp-wwhw { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 700px) { #python-playground .pp-wwhw { grid-template-columns: minmax(0, 1fr); } }
#python-playground .pp-wwhw div { padding: 12px 14px; border-radius: 12px; background: var(--bg2); border: 1px solid var(--line); }
#python-playground .pp-wwhw div b { display: block; font-size: 12px; letter-spacing: .08em; color: var(--cyan); margin-bottom: 3px; }
#python-playground .pp-opts { display: grid; gap: 8px; }
#python-playground .pp-opt { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: start; text-align: left; padding: 10px 12px; border-radius: 12px; background: var(--bg2); border: 1.5px solid var(--line); }
#python-playground .pp-opt:hover { border-color: var(--blue-soft); }
#python-playground .pp-opt[aria-pressed="true"] { border-color: var(--cyan); background: rgba(34,211,238,.08); }
#python-playground .pp-opt.is-right { border-color: var(--green); background: rgba(74,222,128,.1); }
#python-playground .pp-opt.is-wrong { border-color: var(--red); background: rgba(251,113,133,.08); }
#python-playground .pp-opt .k { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-weight: 800; font-size: 13px; background: var(--panel2); color: var(--blue-soft); }
#python-playground .pp-opt pre { font-family: var(--mono); font-size: 13.5px; white-space: pre-wrap; color: #E6EBFF; }

/* diagrams */
#python-playground .pp-dg { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 12px; border-radius: 12px; background: rgba(11,16,39,.7); border: 1px dashed var(--line2); }
#python-playground .pp-dg .box { display: grid; gap: 2px; min-width: 92px; padding: 8px 12px; border-radius: 10px; border: 1.5px solid var(--cyan); background: rgba(34,211,238,.06); }
#python-playground .pp-dg .box small { font-size: 11.5px; color: var(--cyan); font-weight: 700; font-family: var(--mono); }
#python-playground .pp-dg .box span { font-family: var(--mono); color: #fff; font-weight: 700; }
#python-playground .pp-dg .cell { display: grid; text-align: center; min-width: 52px; }
#python-playground .pp-dg .cell span { padding: 8px 10px; border: 1.5px solid var(--violet); border-radius: 8px; font-family: var(--mono); color: #fff; font-weight: 700; background: rgba(167,139,250,.08); }
#python-playground .pp-dg .cell small { font-family: var(--mono); font-size: 11.5px; color: var(--muted); margin-top: 3px; }
#python-playground .pp-dg .arrow { color: var(--blue-soft); font-weight: 800; }
#python-playground .pp-dg .mach { padding: 10px 16px; border-radius: 12px; background: linear-gradient(135deg, var(--blue), var(--violet)); color: #fff; font-family: var(--mono); font-weight: 800; }
#python-playground .pp-dg .pill { padding: 6px 12px; border-radius: 999px; background: var(--panel2); border: 1px solid var(--line2); font-family: var(--mono); font-size: 13px; color: var(--head); }
#python-playground .pp-dg .yes { border-color: var(--green); color: var(--green); } #python-playground .pp-dg .no { border-color: var(--red); color: var(--red); }

/* challenge cards */
#python-playground .pp-cc { text-align: left; display: flex; flex-direction: column; gap: 8px; padding: 16px; border-radius: 16px; background: var(--panel); border: 1.5px solid var(--line); transition: border-color .15s, transform .15s; }
#python-playground .pp-cc:hover { border-color: var(--blue-soft); transform: translateY(-2px); }
#python-playground .pp-cc.is-done { border-color: rgba(74,222,128,.55); }
#python-playground .pp-cc .t { font-size: 16.5px; font-weight: 800; color: var(--head); }
#python-playground .pp-cc .o { font-size: 13.5px; color: var(--muted); }
#python-playground .pp-cc .f { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding-top: 6px; font-size: 13px; }
#python-playground .pp-stars { color: var(--amber); letter-spacing: 1px; } #python-playground .pp-stars .off { color: #3B467E; }
#python-playground .pp-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
#python-playground .pp-filter { min-height: 34px; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line2); font-size: 13px; font-weight: 700; color: var(--text); }
#python-playground .pp-filter[aria-pressed="true"] { background: var(--blue); border-color: var(--blue); color: #fff; }
#python-playground .pp-hint { padding: 10px 12px; border-radius: 10px; background: rgba(251,191,36,.07); border: 1px solid rgba(251,191,36,.35); font-size: 14px; }
#python-playground .pp-hint b { color: var(--amber); }
#python-playground .pp-side { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 1100px) { #python-playground .pp-side { grid-template-columns: minmax(0, 1fr); } }

/* visual lab */
#python-playground .pp-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
#python-playground .pp-tab { min-height: 38px; padding: 6px 14px; border-radius: 10px; border: 1px solid var(--line2); font-weight: 700; font-size: 13.5px; color: var(--text); }
#python-playground .pp-tab[aria-selected="true"] { background: rgba(47,107,255,.2); border-color: var(--blue-soft); color: var(--head); }
#python-playground .pp-vars { display: flex; flex-wrap: wrap; gap: 10px; }
#python-playground .pp-var { min-width: 110px; padding: 8px 12px; border-radius: 12px; border: 1.5px solid var(--cyan); background: rgba(34,211,238,.06); transition: transform .2s; }
#python-playground .pp-var small { display: flex; justify-content: space-between; gap: 10px; font-family: var(--mono); font-size: 12px; color: var(--cyan); font-weight: 700; }
#python-playground .pp-var small em { font-style: normal; color: var(--muted); font-weight: 600; }
#python-playground .pp-var span { display: block; font-family: var(--mono); font-weight: 700; color: #fff; word-break: break-all; }
#python-playground .pp-var.is-new { border-color: var(--amber); background: rgba(251,191,36,.12); animation: pp-pop .45s ease; }
#python-playground .pp-stepper { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
#python-playground .pp-chips { display: flex; flex-wrap: wrap; gap: 6px; }
#python-playground .pp-it { min-width: 40px; text-align: center; padding: 6px 10px; border-radius: 10px; border: 1.5px solid var(--line2); font-family: var(--mono); font-weight: 800; color: var(--muted); }
#python-playground .pp-it.is-past { border-color: rgba(34,211,238,.5); color: var(--cyan); }
#python-playground .pp-it.is-cur { border-color: var(--amber); color: var(--ink); background: var(--amber); transform: scale(1.08); }
#python-playground .pp-tree { display: grid; gap: 6px; font-family: var(--mono); font-size: 14px; }
#python-playground .pp-tree div { display: flex; justify-content: space-between; gap: 12px; padding: 7px 12px; border-radius: 10px; background: var(--bg2); border: 1px solid var(--line); }
#python-playground .pp-tree .T { color: var(--green); font-weight: 800; } #python-playground .pp-tree .F { color: var(--red); font-weight: 800; }
#python-playground .pp-lst { display: flex; flex-wrap: wrap; gap: 6px; min-height: 76px; padding: 12px; border-radius: 12px; background: rgba(11,16,39,.7); border: 1px dashed var(--line2); align-items: flex-start; }
#python-playground .pp-lst .cell { display: grid; text-align: center; min-width: 56px; }
#python-playground .pp-lst .cell span { padding: 9px 10px; border: 1.5px solid var(--violet); border-radius: 9px; font-family: var(--mono); font-weight: 700; color: #fff; background: rgba(167,139,250,.08); }
#python-playground .pp-lst .cell small { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-top: 3px; }
#python-playground .pp-lst .cell.is-hit span { border-color: var(--amber); background: rgba(251,191,36,.18); animation: pp-pop .4s ease; }
#python-playground .pp-bars { display: flex; align-items: flex-end; gap: 6px; height: 200px; padding: 10px; border-radius: 12px; background: rgba(11,16,39,.7); border: 1px solid var(--line); }
#python-playground .pp-bars div { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; height: 100%; }
#python-playground .pp-bars div i { display: block; width: 100%; border-radius: 6px 6px 0 0; background: var(--blue-soft); transition: height .25s, background-color .2s; }
#python-playground .pp-bars div span { font-family: var(--mono); font-size: 11.5px; color: var(--head); font-weight: 700; }
#python-playground .pp-bars div.cmp i { background: var(--amber); } #python-playground .pp-bars div.swp i { background: var(--pink); }
#python-playground .pp-bars div.fin i { background: var(--green); } #python-playground .pp-bars div.out i { background: #2A3570; } #python-playground .pp-bars div.hit i { background: var(--green); }
#python-playground .pp-machine { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr); gap: 10px; align-items: center; }
@media (max-width: 700px) { #python-playground .pp-machine { grid-template-columns: minmax(0, 1fr); } #python-playground .pp-machine .arrow { transform: rotate(90deg); justify-self: center; } }
#python-playground .pp-machine .arrow { color: var(--blue-soft); font-size: 22px; font-weight: 800; text-align: center; }
#python-playground .pp-machine .m { padding: 14px; border-radius: 14px; text-align: center; background: linear-gradient(135deg, var(--blue), var(--violet)); color: #fff; font-family: var(--mono); font-weight: 800; }
#python-playground .pp-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
#python-playground .pp-table th, #python-playground .pp-table td { text-align: left; padding: 7px 9px; border-bottom: 1px solid var(--line); }
#python-playground .pp-table th { color: var(--muted); font-size: 12px; font-weight: 700; }
#python-playground .pp-table td { font-family: var(--mono); color: var(--head); }
#python-playground .pp-tablewrap { overflow-x: auto; }

/* badges */
#python-playground .pp-badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
#python-playground .pp-badge { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: center; padding: 12px; border-radius: 14px; border: 1.5px dashed var(--line2); color: var(--muted); }
#python-playground .pp-badge i { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 18px; background: var(--bg2); filter: grayscale(1); opacity: .6; }
#python-playground .pp-badge b { display: block; color: var(--muted); font-size: 14px; } #python-playground .pp-badge span { font-size: 12px; }
#python-playground .pp-badge.is-won { border-style: solid; border-color: rgba(251,191,36,.6); background: rgba(251,191,36,.07); color: var(--text); }
#python-playground .pp-badge.is-won i { background: linear-gradient(135deg, var(--amber), #F59E0B); filter: none; opacity: 1; }
#python-playground .pp-badge.is-won b { color: var(--head); }
#python-playground .pp-toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 90; padding: 10px 18px; border-radius: 999px; background: var(--head); color: var(--ink); font-weight: 700; font-size: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.4); animation: pp-in .3s ease; max-width: calc(100vw - 32px); }
#python-playground .pp-toast.win { background: var(--green); }
#python-playground .pp-foot { padding: 18px clamp(14px, 2.4vw, 28px) 26px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; display: grid; gap: 10px; }
#python-playground details.pp-det { border: 1px solid var(--line); border-radius: 12px; background: rgba(14,20,48,.7); }
#python-playground details.pp-det summary { cursor: pointer; padding: 10px 14px; font-weight: 700; color: var(--head); list-style: none; display: flex; justify-content: space-between; }
#python-playground details.pp-det summary::-webkit-details-marker { display: none; }
#python-playground details.pp-det summary::after { content: "+"; color: var(--blue-soft); font-size: 18px; }
#python-playground details.pp-det[open] summary::after { content: "\2013"; }
#python-playground details.pp-det .b { padding: 0 14px 14px; display: grid; gap: 8px; }
#python-playground .pp-confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 95; }
@keyframes pp-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes pp-pop { 0% { transform: scale(.9); } 60% { transform: scale(1.04); } 100% { transform: scale(1); } }
@keyframes pp-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { #python-playground *, #python-playground *::before, #python-playground *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }

/* Embedded in an iframe: the frame grows to fit, so no viewport-height rules */
html.pp-in-frame #python-playground, html.pp-in-frame #python-playground .pp-layout { min-height: 0; }
html.pp-in-frame #python-playground .pp-top { position: relative; }
html.pp-in-frame #python-playground .pp-nav { position: relative; top: 0; height: auto; }
