/* PySabaq.ai — стильдер.
   Layout: жалбыз-жасыл фон, жұмсақ жасыл жарқыл; 1180px баған; кіру = hero + карта, қосымша = topbar + жұмыс аймағы.
   Бір тақырыпты (жарық) дизайн — шаблон бойынша әдейі таңдалған. */
:root {
  --bg: #FFF7D6; --glow: #FFE38A; --glow-2: #FFEFB0; --surface: #FFFFFF; --surface-2: #FFF9E8;
  --ink: #1F1D16; --muted: #6E6852; --line: #F0E4BE;
  --yellow: #FFC72C; --yellow-deep: #F2AE00; --yellow-soft: #FFF0BA;
  --green: #14A06A; --green-ink: #0C7A50; --green-deep: #0B4A3B; --green-soft: #DDF5E8;
  --code-bg: #0F2621; --code-ink: #DDEFE6; --code-gut: #5E8379; --code-line: #1E3D35;
  --t-kw: #FF9EC0; --t-bi: #7FE0B4; --t-str: #F7D27A; --t-num: #9CC9FF; --t-com: #6F9488;
  --ok: #14A06A; --ok-soft: #DDF5E8; --err: #C93652; --err-soft: #FCE9ED; --warn-soft: #FDF2DD; --warn-ink: #8A5A06;
  --f-display: "Unbounded", "Golos Text", system-ui, sans-serif;
  --f-body: "Golos Text", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-code: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
  --r-xl: 32px; --r-lg: 22px; --r-md: 16px; --r-sm: 10px;
  --shadow: 0 30px 60px -30px rgba(122, 88, 0, .35);
  --shadow-sm: 0 8px 24px -14px rgba(122, 88, 0, .30);
  --shadow-btn: 0 12px 24px -12px rgba(242, 174, 0, .9);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; }
[hidden] { display: none !important; }
img { max-width: 100%; }
body {
  background: var(--bg);
  background-image:
    radial-gradient(60rem 40rem at 85% 10%, var(--glow), transparent 60%),
    radial-gradient(40rem 30rem at 0% 100%, var(--glow-2), transparent 70%);
  background-attachment: fixed;
  color: var(--ink); font-family: var(--f-body); font-size: 15px; line-height: 1.55;
  min-height: 100vh;
}
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; border-radius: 8px; }
h1, h2, h3 { text-wrap: balance; margin: 0; }
code { font-family: var(--f-code); font-size: .88em; background: var(--green-soft); color: var(--green-deep); padding: .1em .4em; border-radius: 6px; }
.tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); margin: 0; }
.accent { color: var(--green); }
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- логотип ---------- */
.logo { display: flex; align-items: center; gap: 12px; }
.logo-tile { width: 44px; height: 44px; border-radius: 13px; background: var(--green-deep); display: grid; place-items: center; box-shadow: var(--shadow-sm); overflow: hidden; }
.logo-tile svg { transform: translateY(3px) scale(1.15); }
.logo-word { font-family: var(--f-display); font-weight: 700; font-size: 20px; letter-spacing: -.02em; color: var(--ink); }
.logo-word .py { color: var(--yellow); -webkit-text-stroke: 2.4px var(--ink); paint-order: stroke fill; }
.logo-word b { color: var(--green); font-weight: 700; }
.logo-word i { font-style: normal; color: var(--muted); font-weight: 500; }
.logo-btn { background: none; border: 0; padding: 0; }

/* ---------- ортақ элементтер ---------- */
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow-sm); font-size: 11.5px; font-weight: 700; letter-spacing: .08em; color: var(--green-ink); }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.lead { color: var(--muted); font-size: 16px; max-width: 34rem; margin: 0; }
.link { background: linear-gradient(var(--yellow), var(--yellow)) left 88% / 100% 40% no-repeat; border: 0; padding: 0 2px; color: var(--ink); font-weight: 700; transition: background-size .2s; }
.link:hover { background-size: 100% 90%; }
.bubble { position: relative; margin: 0; background: var(--surface); border-radius: 18px; padding: 12px 16px; font-size: 14px; box-shadow: var(--shadow-sm); max-width: 15rem; }
.btn-primary { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; border: 0; border-radius: 16px; padding: 16px 22px; background: var(--yellow); color: var(--ink); font-family: var(--f-display); font-weight: 700; font-size: 13.5px; letter-spacing: .06em; box-shadow: var(--shadow-btn); transition: transform .15s, background .15s, box-shadow .15s; }
.btn-primary:hover { background: var(--yellow-deep); transform: translateY(-2px); }
.btn-primary:active { transform: translateY(0); box-shadow: none; }
.btn-primary.inline { width: auto; letter-spacing: .01em; font-size: 13px; padding: 13px 20px; }
.btn-dark { border: 0; border-radius: 12px; padding: 10px 16px; background: var(--yellow); color: var(--ink); font-weight: 700; font-size: 14px; white-space: nowrap; box-shadow: var(--shadow-btn); transition: transform .15s, background .15s; }
.btn-dark:hover { background: var(--yellow-deep); transform: translateY(-1px); }
.btn-ghost { border: 1.5px solid var(--yellow); background: var(--yellow-soft); border-radius: 12px; padding: 8px 14px; font-weight: 700; font-size: 14px; color: var(--ink); }
.btn-ghost:hover { background: var(--yellow); }
.btn-run { display: inline-flex; align-items: center; gap: 8px; border: 1.5px solid var(--yellow-deep); background: var(--yellow-soft); color: var(--ink); border-radius: 14px; padding: 11px 18px; font-weight: 700; transition: background .15s; }
.btn-run:hover { background: var(--yellow); }
.btn-run .ic { width: 15px; height: 15px; fill: currentColor; stroke: none; }
.btn-run.sm { padding: 6px 12px; border-radius: 10px; font-size: 13px; border-width: 1px; }
.btn-tiny { display: inline-flex; align-items: center; gap: 6px; background: transparent; border: 1px solid var(--yellow); color: var(--yellow); border-radius: 9px; padding: 5px 10px; font-size: 12.5px; font-weight: 600; }
.btn-tiny:hover { background: var(--yellow); color: var(--ink); }
.btn-tiny .ic { width: 14px; height: 14px; }
.eyebrow { margin: 0 0 6px; font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.bar { height: 8px; border-radius: 99px; background: var(--green-soft); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--green), #2BCB8B); transition: width .5s; }
.bar.big { height: 12px; }

/* ---------- КІРУ ---------- */
.auth { max-width: 1180px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 22px 40px; min-height: 100vh; display: flex; flex-direction: column; }
.auth-top { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.auth-switch { margin: 0; font-size: 13.5px; color: var(--muted); }
.auth-main { flex: 1; display: grid; grid-template-columns: 1.1fr .9fr; gap: 48px; align-items: center; padding-block: 48px; }
.auth-hero { display: flex; flex-direction: column; align-items: flex-start; gap: 22px; min-width: 0; }
.auth-hero h1, .hello h1 { font-family: var(--f-display); font-weight: 800; font-size: clamp(34px, 5.2vw, 58px); line-height: 1.06; letter-spacing: -.035em; }
.auth-hero h1 .accent { display: inline-block; padding-bottom: 6px; background: linear-gradient(var(--glow), var(--glow)) left bottom / 100% 5px no-repeat; }
.chips { display: flex; gap: 14px; flex-wrap: wrap; }
.chip { display: flex; align-items: center; gap: 12px; background: var(--surface); border-radius: 18px; padding: 14px 20px 14px 14px; font-size: 13.5px; font-weight: 600; line-height: 1.25; box-shadow: var(--shadow-sm); }
.chip-ic { width: 38px; height: 38px; border-radius: 12px; background: var(--green-soft); color: var(--green); display: grid; place-items: center; }
.auth-side { position: relative; display: flex; flex-direction: column; align-items: center; min-width: 0; }
.auth-buddy { display: flex; align-items: flex-end; gap: 6px; margin-bottom: -26px; z-index: 1; align-self: flex-start; margin-left: 8%; }
.auth-buddy .bubble { margin-bottom: 46px; border-bottom-left-radius: 4px; }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border-radius: var(--r-xl); padding: 40px 34px 30px; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.auth-card h2 { font-family: var(--f-display); font-weight: 700; font-size: 24px; letter-spacing: -.02em; }
.auth-card > .muted { font-size: 13.5px; margin: 4px 0 18px; }
.field-label { font-size: 11px; font-weight: 700; letter-spacing: .12em; color: var(--muted); margin: 12px 0 8px 4px; }
.field { display: flex; align-items: center; gap: 10px; background: var(--surface-2); border: 1.5px solid transparent; border-radius: 16px; padding: 0 16px; transition: border-color .15s; }
.field:focus-within { border-color: var(--yellow-deep); background: var(--surface); box-shadow: 0 0 0 4px var(--yellow-soft); }
.field .ic { color: var(--muted); width: 17px; height: 17px; }
.field input, .field select { flex: 1; min-width: 0; border: 0; background: transparent; padding: 15px 0; font: inherit; font-size: 15px; color: var(--ink); outline: none; }
.form-error { margin: 14px 0 0; padding: 10px 14px; border-radius: 12px; background: var(--err-soft); color: var(--err); font-size: 13.5px; font-weight: 500; }
.auth-card .btn-primary { margin-top: 22px; }
.or { text-align: center; margin: 16px 0 0; font-size: 13.5px; color: var(--muted); }
.warn-line { text-align: center; font-size: 13px; color: var(--warn-ink); background: var(--warn-soft); border-radius: 12px; padding: 10px; margin: 0; }

/* ---------- TOPBAR ---------- */
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: rgba(255, 247, 214, .85); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 21; background: var(--bg); }
.topbar-in { max-width: 1180px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.top-right { display: flex; align-items: center; gap: 14px; min-width: 0; }
.xp { display: flex; align-items: center; gap: 10px; background: var(--surface); padding: 7px 14px; border-radius: 999px; box-shadow: var(--shadow-sm); font-size: 13px; }
.xp-lvl { font-weight: 600; color: var(--muted); white-space: nowrap; }
.xp-bar { width: 64px; height: 6px; border-radius: 9px; background: var(--green-soft); overflow: hidden; }
.xp-bar i { display: block; height: 100%; background: var(--green); }
.xp b { font-variant-numeric: tabular-nums; color: var(--green-ink); white-space: nowrap; }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar { width: 38px; height: 38px; border-radius: 12px; background: var(--green-soft); color: var(--green-deep); display: grid; place-items: center; font-family: var(--f-display); font-weight: 700; flex: none; }
.who-txt { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.who-txt b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 12rem; }
.who-txt small { color: var(--muted); font-size: 12px; }

/* ---------- БЕТ ---------- */
.page { max-width: 1180px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 32px 120px; display: flex; flex-direction: column; gap: 32px; }

/* басты бет */
.hello { display: grid; grid-template-columns: 1fr auto; gap: 32px; align-items: center; background: var(--surface); border-radius: var(--r-xl); padding: 36px 40px; box-shadow: var(--shadow); }
.hello-text { display: flex; flex-direction: column; align-items: flex-start; gap: 18px; min-width: 0; }
.hello h1 { font-size: clamp(30px, 4.4vw, 46px); }
.hello-progress { width: 100%; max-width: 34rem; display: flex; flex-direction: column; gap: 8px; }
.hp-top { display: flex; justify-content: space-between; font-size: 14px; font-weight: 600; }
.hp-top b { font-family: var(--f-display); color: var(--green-ink); }
.hp-stats { display: flex; gap: 20px; flex-wrap: wrap; font-size: 13.5px; color: var(--muted); }
.hp-stats b { color: var(--ink); }
.hello-buddy { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.hello-buddy .bubble { order: -1; background: var(--green-soft); box-shadow: none; text-align: center; border-bottom-right-radius: 4px; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.sec-head h2 { font-family: var(--f-display); font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.mod-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.mod-row { display: grid; grid-template-columns: auto 1fr auto; gap: 22px; align-items: center; background: var(--surface); border-radius: var(--r-lg); padding: 20px 24px; box-shadow: var(--shadow-sm); }
.mod-num { font-family: var(--f-display); font-weight: 800; font-size: 26px; color: var(--green); width: 58px; height: 58px; border-radius: 18px; background: var(--green-soft); display: grid; place-items: center; letter-spacing: -.03em; }
.mod-num.sm { width: 50px; height: 50px; font-size: 20px; border-radius: 15px; flex: none; }
.mod-body { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.mod-body h3 { font-family: var(--f-display); font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.mod-body p { margin: 0; color: var(--muted); font-size: 14px; }
.mod-meta { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.mod-side { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.status { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.status.ok { background: var(--ok-soft); color: var(--green-ink); }
.status.go { background: var(--warn-soft); color: var(--warn-ink); }
.status.new { background: var(--surface-2); color: var(--muted); }

/* модуль басы */
.mod-head { display: flex; flex-direction: column; gap: 16px; }
.back { align-self: flex-start; background: none; border: 0; padding: 0; color: var(--muted); font-weight: 600; font-size: 14px; }
.back:hover { color: var(--green-ink); }
.mod-title { display: flex; align-items: center; gap: 16px; }
.mod-title h1 { font-family: var(--f-display); font-size: clamp(24px, 3.4vw, 34px); font-weight: 800; letter-spacing: -.03em; }
.tabs { display: flex; gap: 6px; background: var(--surface); padding: 6px; border-radius: 16px; box-shadow: var(--shadow-sm); align-self: flex-start; max-width: 100%; overflow-x: auto; }
.tab { border: 0; background: transparent; padding: 10px 18px; border-radius: 11px; font-weight: 600; font-size: 14px; color: var(--muted); white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; }
.tab:hover:not(.on) { background: var(--yellow-soft); color: var(--ink); }
.tab.on { background: var(--yellow); color: var(--ink); font-weight: 700; }
.tab-n { font-size: 12px; background: var(--yellow-soft); color: var(--ink); padding: 1px 7px; border-radius: 99px; }
.tab.on .tab-n { background: var(--surface); }

/* теория */
.theory { background: var(--surface); border-radius: var(--r-xl); padding: 36px 40px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 18px; max-width: 860px; }
.theory > p { margin: 0; font-size: 16.5px; line-height: 1.7; max-width: 65ch; }
.note { background: var(--warn-soft); border-radius: var(--r-md); padding: 16px 20px; }
.note b { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--warn-ink); }
.note p { margin: 6px 0 0; }
.note code { background: rgba(255, 255, 255, .7); }
.example { background: var(--code-bg); border-radius: var(--r-md); overflow: hidden; }
.ex-bar { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--code-line); color: var(--code-gut); font-size: 12.5px; font-weight: 600; flex-wrap: wrap; }
.ex-bar .btn-run { margin-left: auto; background: var(--yellow); border-color: var(--yellow); color: var(--ink); }
.ex-bar .btn-run:hover { background: var(--yellow-deep); }
.ex-in code { background: var(--code-line); color: var(--code-ink); }
pre.code, .ex-out { margin: 0; padding: 16px 18px; font-family: var(--f-code); font-size: 14px; line-height: 1.6; color: var(--code-ink); overflow-x: auto; tab-size: 4; }
.ex-out { border-top: 1px dashed var(--code-line); background: #0B1D19; white-space: pre-wrap; }
.theory-end { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 20px; }
.theory-end p { margin: 0; font-weight: 600; }
.t-kw { color: var(--t-kw); } .t-bi { color: var(--t-bi); } .t-str { color: var(--t-str); } .t-num { color: var(--t-num); } .t-com { color: var(--t-com); font-style: italic; }

/* тапсырмалар */
.workspace { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 24px; align-items: start; }
.tasklist { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 84px); background: var(--surface); border-radius: var(--r-lg); padding: 18px 12px; box-shadow: var(--shadow-sm); }
.tasklist .eyebrow { padding-left: 10px; }
.tasklist ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.tl-item { width: 100%; display: flex; align-items: center; gap: 10px; text-align: left; border: 0; background: transparent; padding: 9px 10px; border-radius: 12px; font-size: 14px; font-weight: 500; }
.tl-item:hover { background: var(--surface-2); }
.tl-item.on { background: var(--yellow-soft); font-weight: 700; color: var(--ink); }
.tl-mark { width: 26px; height: 26px; border-radius: 8px; background: var(--surface-2); display: grid; place-items: center; font-size: 12.5px; font-weight: 700; flex: none; font-variant-numeric: tabular-nums; }
.tl-item.on .tl-mark { background: var(--surface); }
.tl-item.done .tl-mark { background: var(--green); color: #fff; }
.tl-item.done .tl-mark .ic { width: 15px; height: 15px; stroke-width: 3; }
.task { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.task-card { background: var(--surface); border-radius: var(--r-lg); padding: 24px 28px; box-shadow: var(--shadow-sm); }
.task-card h2 { font-family: var(--f-display); font-size: 21px; font-weight: 700; letter-spacing: -.02em; margin-bottom: 8px; }
.task-card > p { margin: 0; font-size: 15.5px; max-width: 65ch; }
.ok-text { color: var(--green); }
.sample { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.sample > div, .cmp > div { min-width: 0; background: var(--surface-2); border-radius: 12px; padding: 10px 14px; }
.sample span, .cmp span { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.sample pre, .cmp pre { margin: 6px 0 0; font-family: var(--f-code); font-size: 13.5px; white-space: pre-wrap; word-break: break-word; }
.hint { margin-top: 16px; background: var(--green-soft); border-radius: 12px; padding: 12px 16px; }
.hint b { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--green-ink); }
.hint p { margin: 4px 0 0; }
.hint code { background: var(--surface); }

.editor-card { background: var(--code-bg); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow); }
.editor-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--code-line); flex-wrap: wrap; }
.file { font-family: var(--f-code); font-size: 12.5px; color: var(--code-ink); background: var(--code-line); padding: 4px 10px; border-radius: 8px; }
.editor-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ed { display: grid; grid-template-columns: auto minmax(0, 1fr); height: 300px; font-family: var(--f-code); font-size: 14.5px; line-height: 22px; }
.ed-gutter { margin: 0; padding: 14px 10px 14px 14px; color: var(--code-gut); text-align: right; white-space: pre; overflow: hidden; user-select: none; min-width: 42px; font-variant-numeric: tabular-nums; }
.ed-area { position: relative; min-width: 0; }
.ed-hl, .ed-input { position: absolute; inset: 0; margin: 0; padding: 14px 16px 14px 8px; font: inherit; line-height: inherit; tab-size: 4; white-space: pre; letter-spacing: 0; word-spacing: 0; border: 0; }
.ed-hl { color: var(--code-ink); overflow: hidden; pointer-events: none; }
.ed-input { width: 100%; height: 100%; resize: none; background: transparent; color: transparent; -webkit-text-fill-color: transparent; caret-color: #fff; outline: none; overflow: auto; }
.ed-input::selection { background: rgba(127, 224, 180, .28); }

.io { display: grid; grid-template-columns: 1fr 1.4fr; gap: 16px; }
.io.single { grid-template-columns: 1fr; }
.io-box { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.io-box label, .io-label { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.io-box small { text-transform: none; letter-spacing: 0; font-weight: 500; }
#stdin { min-height: 110px; resize: vertical; border: 1.5px solid var(--line); border-radius: 14px; padding: 12px 14px; font-family: var(--f-code); font-size: 14px; background: var(--surface); color: var(--ink); }
#stdin:focus { outline: none; border-color: var(--green); }
.console { margin: 0; min-height: 110px; max-height: 260px; overflow: auto; background: var(--surface); border: 1.5px solid var(--line); border-radius: 14px; padding: 12px 14px; font-family: var(--f-code); font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.dim { color: var(--muted); font-family: var(--f-body); }
.err { color: var(--err); font-weight: 700; }
.err-ex { font-family: var(--f-body); color: var(--ink); }
.ex-out .err-ex { color: var(--code-ink); }
.ex-out .dim { color: var(--code-gut); }
.ex-out .err { color: #FF8FA3; }
.run-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.run-bar .btn-primary .ic { stroke-width: 3; }
.kbd-hint { font-size: 12.5px; color: var(--muted); margin-left: auto; }
.verdict { border-radius: var(--r-lg); padding: 18px 22px; }
.verdict h3 { font-family: var(--f-display); font-size: 17px; font-weight: 700; }
.verdict p { margin: 4px 0 0; }
.verdict.wait { background: var(--surface); color: var(--muted); }
.verdict.ok { background: var(--ok-soft); color: var(--green-deep); display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; animation: rise .35s ease-out; }
.verdict.bad { background: var(--err-soft); display: flex; flex-direction: column; gap: 12px; animation: rise .35s ease-out; }
.verdict.bad h3 { color: var(--err); }
.verdict.bad .console { min-height: 0; }
.cmp { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.cmp > div { background: var(--surface); }

/* тест */
.quiz { display: flex; flex-direction: column; gap: 16px; max-width: 860px; }
.q-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.q { background: var(--surface); border-radius: var(--r-lg); padding: 22px 26px; box-shadow: var(--shadow-sm); }
.q h3 { font-size: 17px; font-weight: 600; line-height: 1.45; margin-bottom: 14px; }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.opt { display: flex; align-items: center; gap: 12px; text-align: left; border: 1.5px solid var(--line); background: var(--surface); border-radius: 14px; padding: 12px 14px; font-size: 15px; min-width: 0; }
.opt:hover:not(:disabled) { border-color: var(--green); background: var(--surface-2); }
.opt:disabled { cursor: default; }
.opt-k { width: 28px; height: 28px; border-radius: 9px; background: var(--surface-2); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.opt.right { border-color: var(--green); background: var(--ok-soft); }
.opt.right .opt-k { background: var(--green); color: #fff; }
.opt.wrong { border-color: var(--err); background: var(--err-soft); }
.opt.wrong .opt-k { background: var(--err); color: #fff; }
.opt.faded { opacity: .55; }
.q-fb { margin: 12px 0 0; font-size: 14.5px; }
.q-fb.ok b { color: var(--green-ink); } .q-fb.bad b { color: var(--err); }
.quiz-result { display: flex; align-items: center; gap: 18px; background: var(--surface); border-radius: var(--r-lg); padding: 18px 24px; box-shadow: var(--shadow); flex-wrap: wrap; }
.quiz-result h3 { font-family: var(--f-display); font-size: 20px; }
.quiz-result p { margin: 2px 0 0; color: var(--muted); }
.quiz-result .btn-dark { margin-left: auto; }

/* маскот-көмекші */
.buddy { position: fixed; z-index: 30; right: max(16px, calc(env(safe-area-inset-right, 0px) + 16px)); bottom: calc(env(safe-area-inset-bottom, 0px) + 16px); display: flex; align-items: flex-end; gap: 8px; pointer-events: none; }
.buddy-say { margin: 0 0 30px; max-width: 17rem; background: var(--ink); color: #fff; font-size: 13.5px; line-height: 1.45; padding: 10px 14px; border-radius: 16px; border-bottom-right-radius: 4px; box-shadow: var(--shadow); pointer-events: auto; }
.buddy-say code { background: rgba(255, 255, 255, .14); color: #fff; }
.buddy-face { width: 76px; height: 76px; border-radius: 24px; background: var(--surface); display: grid; place-items: center; box-shadow: var(--shadow); }
.buddy.pop .buddy-face { animation: hop .45s ease-out; }
.buddy.pop .buddy-say { animation: rise .3s ease-out; }
@keyframes hop { 0% { transform: translateY(0); } 35% { transform: translateY(-10px) rotate(-4deg); } 70% { transform: translateY(0) rotate(2deg); } 100% { transform: none; } }
@keyframes rise { from { transform: translateY(6px); opacity: .4; } to { transform: none; opacity: 1; } }
.mascot-svg { display: block; }
.auth-buddy .mascot-svg, .hello-buddy .mascot-svg { animation: bob 3.2s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-5px); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- кіру бетінің анимациясы ---------- */
.auth { position: relative; isolation: isolate; }
.auth > *:not(.deco) { position: relative; z-index: 1; }
.deco { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.blob { position: absolute; border-radius: 50%; filter: blur(8px); }
.b1 { width: 340px; height: 340px; right: -80px; top: 6%; background: radial-gradient(circle at 35% 35%, #FFE27A, var(--yellow) 70%); opacity: .55; }
.b2 { width: 220px; height: 220px; left: -60px; bottom: 4%; background: radial-gradient(circle at 40% 40%, #FFF0B0, var(--yellow-deep) 80%); opacity: .35; }
.b3 { width: 120px; height: 120px; left: 46%; top: 60%; background: radial-gradient(circle, var(--green-soft), #BDEFD5 80%); opacity: .6; }
.glyph { position: absolute; font-family: var(--f-code); font-weight: 600; font-size: 15px; color: var(--muted); opacity: .45; white-space: nowrap; padding: 6px 12px; border-radius: 12px; background: rgba(255, 255, 255, .55); animation: drift var(--t, 8s) ease-in-out infinite; }
.glyph.y { color: var(--ink); background: var(--yellow); opacity: .6; }
.glyph.g { color: var(--green-ink); background: var(--green-soft); opacity: .6; }
@keyframes drift { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-16px) rotate(3deg); } }

.intro .in { animation: enter .9s cubic-bezier(.2, .85, .25, 1) var(--d, 0s) backwards; }
.intro .card-in { animation-name: card-enter; animation-duration: 1s; }
.intro .pop-in { animation-name: pop; animation-duration: .8s; }
.intro .glyph { animation: fade 1.2s ease-out var(--d, 0s) backwards, drift var(--t, 8s) ease-in-out var(--d, 0s) infinite; }
.intro .blob { animation: fade 1.6s ease-out backwards; }
.intro .auth-hero h1 .accent { animation: underline 1s cubic-bezier(.2, .85, .25, 1) .7s backwards; }
@keyframes enter { from { opacity: 0; transform: translateY(28px); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes card-enter { from { opacity: 0; transform: perspective(1000px) translateY(60px) rotateX(14deg) scale(.94); } to { opacity: 1; transform: perspective(1000px); } }
@keyframes pop { 0% { opacity: 0; transform: translateY(30px) scale(.4) rotate(-12deg); } 60% { opacity: 1; transform: translateY(-8px) scale(1.08) rotate(4deg); } 100% { transform: none; } }
@keyframes fade { from { opacity: 0; } }
@keyframes underline { from { background-size: 0% 5px; } }
.auth-card { transform-style: preserve-3d; will-change: transform; }
.chip { transition: box-shadow .2s, transform .2s; }
.chip:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.chip-ic { background: var(--yellow-soft); color: var(--ink); }


/* ---------- бүкіл қосымшадағы анимация ---------- */
.page { position: relative; z-index: 1; }
.deco.soft .glyph { opacity: .32; }
.deco.soft .blob { opacity: .3; }
.intro .topbar.drop { animation: drop .7s cubic-bezier(.2, .85, .25, 1) backwards; }
@keyframes drop { from { transform: translateY(-100%); opacity: 0; } }
.intro .bar i, .intro .xp-bar i { animation: grow 1.4s cubic-bezier(.2, .85, .25, 1) .45s backwards; }
@keyframes grow { from { width: 0; } }
.intro .hello h1 .accent { display: inline-block; animation: wiggle 1s ease-in-out .9s; }
@keyframes wiggle { 30% { transform: rotate(-4deg) scale(1.06); } 60% { transform: rotate(3deg); } }
[data-hover-tilt] { transition: transform .25s ease-out, box-shadow .25s; transform-style: preserve-3d; }
.mod-row[data-hover-tilt]:hover, .q[data-hover-tilt]:hover { box-shadow: var(--shadow); }
.mod-row:hover .mod-num { animation: hopnum .5s ease-out; }
@keyframes hopnum { 40% { transform: translateY(-5px) rotate(-6deg); } }
.result-in { animation: pop .7s cubic-bezier(.2, .85, .25, 1) backwards; }
.tab { transition: background .2s, color .2s, transform .15s; }
.tab:active { transform: scale(.96); }
.opt { transition: border-color .15s, background .15s, transform .15s; }
.opt:hover:not(:disabled) { transform: translateX(3px); }
.opt.right { animation: pulse .5s ease-out; }
.opt.wrong { animation: shake .4s ease-out; }
@keyframes pulse { 40% { transform: scale(1.04); } }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
.verdict.bad { animation: shake .45s ease-out; }
.tl-item { transition: background .15s, transform .15s; }
.tl-item:hover { transform: translateX(3px); }
.confetti { position: fixed; z-index: 100; width: 0; height: 0; pointer-events: none; }
.confetti i { position: absolute; left: -5px; top: -4px; width: 10px; height: 8px; border-radius: 2px; animation: confetti 1.2s cubic-bezier(.15, .7, .3, 1) forwards; }
@keyframes confetti {
  0% { transform: translate(0, 0) rotate(0) scale(.6); opacity: 1; }
  70% { opacity: 1; }
  100% { transform: translate(var(--x), calc(var(--y) + 140px)) rotate(var(--r)) scale(1); opacity: 0; }
}


/* ---------- видео ---------- */
.videos { display: flex; flex-direction: column; gap: 20px; max-width: 900px; }
.video-card { background: var(--surface); border-radius: var(--r-xl); padding: 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 16px; }
.vplayer { position: relative; aspect-ratio: 16 / 9; max-width: 100%; border-radius: var(--r-lg); overflow: hidden; background: radial-gradient(120% 120% at 20% 10%, #2A4A3F, var(--code-bg) 60%); display: grid; place-items: center; }
.vthumb { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.vshade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(31, 29, 22, .05), rgba(31, 29, 22, .45)); }
.vbuddy { position: absolute; left: 18px; bottom: 10px; opacity: .9; }
.vthumb ~ .vbuddy { display: none; }
.vplay { position: relative; width: 84px; height: 84px; border-radius: 50%; border: 0; background: var(--yellow); color: var(--ink); display: grid; place-items: center; box-shadow: 0 0 0 10px rgba(255, 199, 44, .28), var(--shadow); transition: transform .2s, box-shadow .2s; animation: breathe 2.4s ease-in-out infinite; }
.vplay svg { width: 36px; height: 36px; fill: currentColor; margin-left: 4px; }
.vplay:hover { transform: scale(1.08); box-shadow: 0 0 0 16px rgba(255, 199, 44, .35), var(--shadow); }
@keyframes breathe { 50% { box-shadow: 0 0 0 16px rgba(255, 199, 44, .18), var(--shadow); } }
.vplayer iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.vplayer.blocked { background: var(--yellow-soft); }
.vblocked { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; padding: 20px; max-width: 26rem; }
.vblocked p { margin: 0; color: var(--ink); }
.video-meta { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 0 10px 8px; }
.video-meta h2 { font-family: var(--f-display); font-size: 20px; font-weight: 700; letter-spacing: -.02em; margin-bottom: 4px; }
.video-meta .muted { font-size: 13.5px; }
.lang { background: var(--yellow-soft); color: var(--ink); padding: 1px 8px; border-radius: 99px; font-weight: 600; }
.yt-link { color: var(--ink); font-weight: 700; font-size: 14px; text-decoration: none; background: linear-gradient(var(--yellow), var(--yellow)) left 88% / 100% 40% no-repeat; padding: 0 2px; white-space: nowrap; }
.yt-link:hover { background-size: 100% 90%; }
.videos > .theory-end { background: var(--surface); border-radius: var(--r-lg); padding: 18px 22px; box-shadow: var(--shadow-sm); border-top: 0; }
@media (max-width: 640px) { .vplay { width: 64px; height: 64px; } .vplay svg { width: 28px; height: 28px; } .vbuddy { display: none; } }

/* ---------- бейімделу ---------- */
@media (max-width: 960px) {
  .auth-main { grid-template-columns: 1fr; gap: 40px; padding-block: 28px; }
  .workspace { grid-template-columns: 1fr; }
  .tasklist { position: static; }
  .tasklist ol { flex-direction: row; overflow-x: auto; }
  .tl-item { white-space: nowrap; }
  .hello { grid-template-columns: 1fr; }
  .hello-buddy { flex-direction: row; justify-content: flex-start; }
  .hello-buddy .bubble { order: 1; }
  .hello-buddy .mascot-svg { width: 110px; height: 110px; }
}
@media (max-width: 640px) {
  .xp-lvl, .xp-bar, .who-txt { display: none; }
  .top-right { gap: 8px; }
  .logo-word { font-size: 17px; }
  .hello, .theory { padding: 24px 20px; }
  .auth-card { padding: 32px 22px 24px; }
  .auth-buddy { margin-left: 0; }
  .auth-buddy .mascot-svg { width: 84px; height: 84px; }
  .mod-row { grid-template-columns: auto minmax(0, 1fr); padding: 16px; gap: 14px; }
  .mod-num { width: 46px; height: 46px; font-size: 19px; border-radius: 14px; }
  .mod-side { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; align-items: center; }
  .task-card, .q { padding: 20px; }
  .sample, .io, .opts, .cmp { grid-template-columns: 1fr; }
  .ed { height: 260px; font-size: 13.5px; line-height: 21px; }
  .kbd-hint { display: none; }
  .glyph { font-size: 12px; opacity: .3; }
  .b1 { width: 200px; height: 200px; }
  .buddy-say { display: none; }
  .buddy-face { width: 58px; height: 58px; border-radius: 18px; }
  .buddy-face svg { width: 50px; height: 50px; }
}
