/* ===== Python-практика — раскладка и компоненты ===== */
.app { min-height: 100dvh; display: flex; flex-direction: column; }

/* header */
.p-head { position: sticky; top: 0; z-index: 30; background: rgba(255,251,243,.86); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line-soft); }
.p-head .row { display: flex; align-items: center; gap: 16px; padding: 12px 0; }
.back { display: inline-flex; align-items: center; gap: 7px; font-weight: 800; font-size: 14px; color: var(--ink-soft); padding: 8px 13px; border-radius: var(--r-pill); background: var(--paper); box-shadow: inset 0 0 0 1.5px var(--line); transition: box-shadow var(--t-fast) var(--ease), transform var(--t-fast) var(--ease); }
.back:hover { box-shadow: inset 0 0 0 1.5px var(--violet); transform: translateX(-2px); }
.p-head .sp { flex: 1; }

/* stepper */
.stepper { display: flex; gap: 8px; overflow-x: auto; padding: 0 0 12px; scrollbar-width: thin; }
.step { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px 8px 8px; border: none; cursor: pointer; background: var(--paper); border-radius: var(--r-pill); box-shadow: inset 0 0 0 1.5px var(--line-soft); font-family: var(--f-display); font-weight: 800; font-size: 13.5px; color: var(--ink-soft); transition: all var(--t-fast) var(--ease); }
.step:hover { box-shadow: inset 0 0 0 1.5px var(--violet); transform: translateY(-1px); }
.step .s-ico { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--paper-2); font-size: 14px; }
.step .s-num { display: none; }
.step.active { background: var(--violet); color: #fff; box-shadow: 0 3px 0 var(--violet-deep); }
.step.active .s-ico { background: rgba(255,255,255,.22); }
.step.done .s-ico { background: var(--mint); color: var(--mint-ink); }
.step.done.active .s-ico { background: rgba(255,255,255,.25); color:#fff; }

/* main grid */
.p-main { flex: 1; padding: 20px 0 40px; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 20px; align-items: stretch; }

/* output column */
.col-out { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.out-stage { background: var(--paper); border: 1.5px solid var(--line-soft); border-radius: var(--r-card); box-shadow: var(--sh-1); overflow: hidden; }
.out-stage .stage-head { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--line-soft); font-weight: 800; font-size: 13px; color: var(--ink-soft); }
.out-stage .stage-head .led { width: 9px; height: 9px; border-radius: 50%; background: var(--mint-deep); box-shadow: 0 0 0 3px var(--mint-soft); }
.stage-body { display: grid; place-items: center; min-height: 440px; background:
   radial-gradient(circle at 1px 1px, rgba(21,20,27,.05) 1px, transparent 0) 0 0 / 22px 22px, var(--paper); }
#out-turtle { width: 480px; height: 420px; max-width: 100%; }
#out-turtle canvas, #out-turtle svg { border-radius: 12px; }

/* console */
#out-console { display: none; }
body[data-mode="console"] #out-turtle { display: none; }
body[data-mode="console"] .stage-body { display: block; min-height: 440px; padding: 0; background: #15141B; }
body[data-mode="console"] #out-console { display: block; }
#out-console { width: 100%; min-height: 440px; max-height: 56vh; overflow: auto; padding: 16px 18px; color: #EFEAFE; font-family: var(--f-mono); font-size: 14px; line-height: 1.65; white-space: pre-wrap; word-break: break-word; }
body[data-mode="console"] .out-stage .stage-head { background: #1E1C28; color: #B9B4CC; border-bottom-color: rgba(255,255,255,.08); }
.con-ask { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.con-ask > span { color: #9D96B8; }
.con-input { flex: 1; background: rgba(255,255,255,.07); border: 1.5px solid rgba(107,92,231,.6); border-radius: 8px; color: #fff; font-family: var(--f-mono); font-size: 14px; padding: 5px 9px; outline: none; }
.con-ask.answered .con-input { border-color: rgba(255,255,255,.15); opacity: .8; }

/* task card */
.task-card { background: var(--paper); border: 1.5px solid var(--line-soft); border-radius: var(--r-card); box-shadow: var(--sh-1); padding: 18px 20px 20px; }
.task-card .t-top { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.task-card .t-ico { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-size: 24px; background: var(--mint-soft); box-shadow: var(--sh-block); }
.task-card h2 { font-size: 21px; }
.task-card .t-chip { font-family: var(--f-mono); font-size: 11px; font-weight: 700; color: var(--mint-ink); background: var(--mint-soft); padding: 4px 10px; border-radius: var(--r-pill); margin-left: auto; }
.task-intro { font-size: 14.5px; color: var(--ink-soft); }
.task-intro p { margin: 0 0 10px; }
.task-intro code { font-family: var(--f-mono); font-size: 13px; background: var(--paper-2); padding: 2px 6px; border-radius: 6px; color: var(--violet-ink); }
.task-intro .secret-code { background: var(--ink); color: var(--yellow); font-size: 15px; letter-spacing: 1px; padding: 3px 9px; }
.task-intro ul.cmds, .task-intro ol.steps { margin: 6px 0 12px; padding-left: 4px; list-style: none; }
.task-intro ul.cmds li, .task-intro ol.steps li { margin: 6px 0; padding-left: 26px; position: relative; }
.task-intro ul.cmds li::before { content: "▸"; position: absolute; left: 6px; color: var(--mint-deep); font-weight: 900; }
.task-intro ol.steps { counter-reset: s; }
.task-intro ol.steps li { counter-increment: s; }
.task-intro ol.steps li::before { content: counter(s); position: absolute; left: 0; top: -1px; width: 19px; height: 19px; background: var(--violet); color: #fff; border-radius: 50%; font-size: 11px; font-weight: 800; display: grid; place-items: center; }
.task-intro .tip { background: var(--yellow-soft); border-radius: 12px; padding: 9px 13px; font-weight: 700; color: var(--yellow-ink); font-size: 13.5px; }

/* code column */
.col-code { display: flex; flex-direction: column; min-width: 0; }
.panel-code { display: flex; flex-direction: column; flex: 1; background: var(--paper); border: 1.5px solid var(--line-soft); border-radius: var(--r-card); box-shadow: var(--sh-1); overflow: hidden; }
.code-head { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--line-soft); }
.code-head .dots { display: flex; gap: 6px; }
.code-head .dots i { width: 11px; height: 11px; border-radius: 50%; display: block; }
.code-head .dots i:nth-child(1){ background:#FF6259 } .code-head .dots i:nth-child(2){ background:#FFBD2E } .code-head .dots i:nth-child(3){ background:#28C840 }
.code-head .fname { font-family: var(--f-mono); font-size: 12.5px; color: var(--ink-mute); font-weight: 700; }
#editor { flex: 1; min-height: 320px; overflow: auto; }
.cm-editor { height: 100%; }

/* toolbar */
.toolbar { display: flex; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--line-soft); background: var(--paper-2); flex-wrap: wrap; }
.toolbar .grow { flex: 1; }
.toolbar .btn { font-size: 14px; }
.hint-keys { font-size: 11.5px; color: var(--ink-mute); font-weight: 700; align-self: center; }

/* flash feedback */
@keyframes okpulse { 0%{ box-shadow: 0 0 0 0 rgba(61,176,122,.5) } 100%{ box-shadow: 0 0 0 14px rgba(61,176,122,0) } }
@keyframes badpulse { 0%{ box-shadow: 0 0 0 0 rgba(232,81,123,.5) } 100%{ box-shadow: 0 0 0 14px rgba(232,81,123,0) } }
.panel-code.flash-ok { animation: okpulse .6s var(--ease); border-color: var(--mint-deep); }
.panel-code.flash-bad { animation: badpulse .6s var(--ease); border-color: var(--pink-deep); }

/* sokratic */
#sokratic { display: none; }
body[data-mode="sokratic"] .grid2 { display: none; }
body[data-mode="sokratic"] #sokratic { display: block; }
.sok-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.sok-form, .sok-out { background: var(--paper); border: 1.5px solid var(--line-soft); border-radius: var(--r-card); box-shadow: var(--sh-1); padding: 20px 22px; }
.sok-form h3, .sok-out h3 { font-size: 16px; margin-bottom: 14px; }
.sok-fields { display: grid; gap: 12px; }
.sok-field { display: flex; flex-direction: column; gap: 5px; }
.sok-field span { font-weight: 800; font-size: 12.5px; color: var(--ink-soft); }
.sok-field input { padding: 10px 13px; border: 1.5px solid var(--line); border-radius: 11px; font-family: var(--f-ui); font-weight: 600; font-size: 14px; color: var(--ink); background: var(--paper); outline: none; transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease); }
.sok-field input:focus { border-color: var(--violet); box-shadow: 0 0 0 3px var(--violet-soft); }
.sok-preview { background: var(--ink); color: #EFEAFE; border-radius: 14px; padding: 16px 18px; font-family: var(--f-mono); font-size: 13.5px; line-height: 1.7; white-space: pre-wrap; word-break: break-word; min-height: 150px; }
.sok-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.sok-hint { margin-top: 12px; font-size: 13px; color: var(--ink-mute); font-weight: 600; }

/* toast */
#toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(140%); z-index: 60; background: var(--ink); color: #fff; border-radius: 18px; padding: 16px 22px; box-shadow: var(--sh-3); max-width: min(92vw, 460px); text-align: center; transition: transform var(--t-slow) var(--ease); }
#toast.show { transform: translateX(-50%) translateY(0); }
#toast .toast-msg { font-family: var(--f-display); font-weight: 800; font-size: 16px; }
#toast .t-secret { margin-top: 10px; font-size: 13.5px; color: #D9D3F0; font-weight: 600; }
#toast .t-secret code { background: rgba(255,255,255,.12); color: var(--yellow); padding: 2px 8px; border-radius: 6px; font-family: var(--f-mono); letter-spacing: 1px; }

/* confetti */
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 55; overflow: hidden; }
#confetti i { position: absolute; top: -14px; width: 10px; height: 14px; border-radius: 2px; animation: fall 1.5s var(--ease) forwards; }
@keyframes fall { to { top: 100%; opacity: 0; } }

/* responsive */
@media (max-width: 920px) {
  .grid2 { grid-template-columns: 1fr; }
  .sok-grid { grid-template-columns: 1fr; }
  #editor { min-height: 240px; }
  .stage-body { min-height: 360px; }
}
