/* =========================================================
   PyQuest — стили. Современный, яркий, анимированный дизайн.
   ========================================================= */

:root {
  --bg-1: #f6f4ff;
  --bg-2: #eef6ff;
  --surface: #ffffff;
  --surface-soft: #faf9ff;
  --text: #201c3d;
  --text-soft: #6b6690;
  --text-faint: #9490b3;
  --border: #e7e3fb;
  --primary: #7c3aed;
  --primary-2: #a855f7;
  --primary-dark: #5b21b6;
  --accent: #ec4899;
  --accent-2: #f97316;
  --success: #16a34a;
  --success-bg: #ecfdf3;
  --danger: #e11d48;
  --danger-bg: #fef2f4;
  --warning: #f59e0b;
  --info: #0ea5e9;
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 2px 10px rgba(88, 61, 180, 0.08);
  --shadow-md: 0 10px 28px rgba(88, 61, 180, 0.14);
  --shadow-lg: 0 20px 50px rgba(88, 61, 180, 0.20);
  --font-head: "Unbounded", "Rubik", sans-serif;
  --font-body: "Rubik", "Segoe UI", sans-serif;
  --font-code: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--text);
  background:
    radial-gradient(900px 500px at 8% -10%, #ffe1f4 0%, transparent 55%),
    radial-gradient(800px 480px at 95% 0%, #dbe9ff 0%, transparent 55%),
    radial-gradient(1000px 600px at 50% 110%, #e3f9ec 0%, transparent 55%),
    linear-gradient(180deg, var(--bg-1), var(--bg-2));
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 700; margin: 0 0 8px; line-height: 1.25; }
p { line-height: 1.65; margin: 0 0 12px; color: var(--text); }
a { color: var(--primary); }
code { font-family: var(--font-code); }
button { font-family: inherit; }
::selection { background: #d9c8ff; }

/* ---------- boot screen ---------- */
.boot-screen {
  position: fixed; inset: 0; z-index: 999;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(700px 400px at 20% 20%, rgba(255,255,255,.25), transparent 60%),
    linear-gradient(135deg, #7c3aed, #ec4899 55%, #f97316);
  transition: opacity .5s ease, visibility .5s ease;
}
.boot-screen.boot-hide { opacity: 0; visibility: hidden; pointer-events: none; }
.boot-inner { text-align: center; color: #fff; max-width: 420px; padding: 24px; }
.boot-snake { font-size: 72px; animation: float-bob 2.4s ease-in-out infinite; filter: drop-shadow(0 10px 18px rgba(0,0,0,.25)); }
.boot-title { font-size: 40px; letter-spacing: .5px; margin: 8px 0 4px; }
.boot-sub { opacity: .9; margin-bottom: 22px; }
.boot-bar { width: 100%; height: 10px; border-radius: 99px; background: rgba(255,255,255,.25); overflow: hidden; }
.boot-bar-fill { height: 100%; width: 10%; background: #fff; border-radius: 99px; transition: width .5s ease; }
.boot-status { margin-top: 12px; font-size: 14px; opacity: .95; min-height: 20px; }
#boot-skip { color: #fff; border-color: rgba(255,255,255,.6); }

@keyframes float-bob { 0%,100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-12px) rotate(4deg); } }

/* ---------- app shell ---------- */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 60;
  display: flex; align-items: center; gap: 14px;
  padding: 10px 20px;
  background: rgba(255,255,255,.72);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 8px; font-family: var(--font-head); font-weight: 700; font-size: 19px; margin-right: auto; }
.brand-snake { font-size: 22px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--border);
  background: #fff; cursor: pointer; font-size: 18px; display: flex; align-items: center; justify-content: center;
  transition: transform .15s ease, box-shadow .15s ease;
}
.icon-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.topbar-stats { display: flex; align-items: center; gap: 10px; }
.stat-chip {
  display: flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 99px;
  background: var(--surface-soft); border: 1px solid var(--border); font-weight: 600; font-size: 14px; white-space: nowrap;
}
.stat-xp { color: #b45309; background: #fff7e6; border-color: #ffe6ad; }
.stat-streak { color: #c2410c; background: #fff1e9; border-color: #ffd8c2; }
.stat-level { color: var(--primary-dark); background: #f3eaff; border-color: #e4d3ff; }
.hamburger { display: none; }
.mobile-stats { display: none; }

@media (max-width: 860px) {
  .topbar-stats { display: none; }
  .hamburger { display: flex; }
  .mobile-stats.shown, .mobile-stats:not([hidden]) {
    display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 16px 14px;
    background: rgba(255,255,255,.95); border-bottom: 1px solid var(--border);
  }
  .mobile-stats .icon-btn { width: auto; padding: 0 12px; gap: 6px; font-size: 14px; }
}

.view-root { flex: 1; max-width: 1080px; margin: 0 auto; width: 100%; padding: 26px 20px 60px; }
.app-footer { text-align: center; font-size: 12px; color: var(--text-faint); padding: 18px; }

/* ---------- buttons ---------- */
.btn {
  border: none; border-radius: 14px; padding: 12px 20px; font-weight: 700; font-size: 15px;
  cursor: pointer; transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
  display: inline-flex; align-items: center; gap: 8px;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; box-shadow: 0 8px 20px rgba(124,58,237,.35); }
.btn-primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(124,58,237,.42); }
.btn-ghost { background: #fff; color: var(--text); border: 2px solid var(--border); }
.btn-ghost:hover:not(:disabled) { border-color: var(--primary-2); color: var(--primary-dark); }
.btn-hint { border-style: dashed; border-color: #fbbf24; color: #92400e; background: #fffbeb; }
.btn-danger { background: var(--danger); color: #fff; margin-top: 14px; }
.btn-mission { background: linear-gradient(135deg, #f59e0b, #ef4444); }

/* ---------- map page ---------- */
.map-hero { text-align: center; margin-bottom: 40px; }
.map-hero h1 { font-size: 34px; background: linear-gradient(135deg, var(--primary), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.map-hero p { max-width: 560px; margin: 0 auto 18px; color: var(--text-soft); }
.overall-progress { max-width: 420px; margin: 0 auto; height: 14px; background: #eee7ff; border-radius: 99px; overflow: hidden; box-shadow: inset 0 1px 3px rgba(0,0,0,.08); }
.overall-progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 99px; transition: width .6s ease; }
.overall-progress-label { margin-top: 8px; font-weight: 600; color: var(--text-soft); font-size: 14px; }

.world-path { position: relative; max-width: 720px; margin: 0 auto; padding: 20px 0; }
.world-path::before {
  content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 4px; margin-left: -2px;
  background: repeating-linear-gradient(180deg, #d9d0ff 0 10px, transparent 10px 20px);
}
.world-node { position: relative; display: flex; align-items: center; gap: 18px; margin: 6px 0 34px; cursor: pointer; width: 58%; animation: pop-in .5s ease both; }
.world-node.left { justify-content: flex-end; text-align: right; flex-direction: row-reverse; margin-left: 0; }
.world-node.right { justify-content: flex-start; margin-left: 42%; }
.world-node-inner { position: relative; width: 78px; height: 78px; flex-shrink: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.world-icon { position: absolute; inset: 6px; border-radius: 50%; background: #fff; display: flex; align-items: center; justify-content: center; font-size: 30px; box-shadow: var(--shadow-sm); z-index: 2; transition: transform .2s ease; }
.world-node:hover .world-icon { transform: scale(1.08) rotate(-4deg); }
.world-ring { position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(var(--world-color, #8b5cf6) calc(var(--pct,0) * 1%), #e9e4fb 0); }
.world-node.locked .world-ring { background: #e5e2f3; }
.world-node.locked .world-icon { filter: grayscale(1); opacity: .7; }
.world-node.complete .world-node-inner::after { content: "✔"; position: absolute; bottom: -2px; right: -2px; background: var(--success); color: #fff; width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; z-index: 3; border: 2px solid #fff; }
.world-label h3 { margin: 2px 0; font-size: 17px; }
.world-num { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-faint); font-weight: 700; }
.world-sub { font-size: 13px; color: var(--text-soft); }
.world-node:not(.locked):hover .world-label h3 { color: var(--primary); }

@media (max-width: 700px) {
  .world-path::before { left: 30px; }
  .world-node, .world-node.left, .world-node.right { width: 100%; margin-left: 0 !important; justify-content: flex-start; flex-direction: row; text-align: left; padding-left: 0; }
  .world-node-inner { width: 60px; height: 60px; }
  .world-icon { font-size: 24px; }
}

/* ---------- chapter page ---------- */
.crumbs { font-size: 13px; color: var(--text-faint); margin-bottom: 16px; }
.crumbs a { color: var(--text-soft); text-decoration: none; }
.crumbs a:hover { color: var(--primary); }
.crumbs .sep { margin: 0 4px; }

.chapter-hero {
  display: flex; align-items: center; gap: 20px; padding: 26px; border-radius: var(--radius-lg);
  background: linear-gradient(135deg, color-mix(in srgb, var(--world-color) 18%, white), #fff);
  border: 1px solid var(--border); box-shadow: var(--shadow-sm); margin-bottom: 28px;
}
.chapter-hero-icon { font-size: 52px; width: 90px; height: 90px; border-radius: 50%; background: #fff; display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-sm); flex-shrink: 0; }
.chapter-hero h1 { font-size: 26px; color: var(--primary-dark); }
.chapter-hero p { color: var(--text-soft); margin: 0; }

.level-path { display: flex; flex-direction: column; gap: 12px; max-width: 640px; margin: 0 auto; }
.level-node {
  display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-radius: var(--radius-md);
  background: #fff; border: 1px solid var(--border); text-decoration: none; color: var(--text);
  box-shadow: var(--shadow-sm); transition: transform .15s ease, box-shadow .15s ease; animation: pop-in .4s ease both;
}
.level-node.open:hover { transform: translateX(4px); box-shadow: var(--shadow-md); border-color: var(--world-color, var(--primary-2)); }
.level-node-num { width: 34px; height: 34px; border-radius: 50%; background: var(--surface-soft); display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; border: 2px solid var(--border); }
.level-node.open .level-node-num { border-color: var(--world-color, var(--primary)); color: var(--world-color, var(--primary)); }
.level-node.done { background: var(--success-bg); }
.level-node.done .level-node-num { background: var(--success); color: #fff; border-color: var(--success); }
.level-node.locked { opacity: .55; cursor: not-allowed; }
.level-node-title { flex: 1; font-weight: 600; }
.level-node-diff { color: #f59e0b; font-size: 12px; letter-spacing: 1px; }
.level-node.mission-node { border: 2px dashed #f59e0b; background: linear-gradient(135deg,#fff7e6,#fff); margin-top: 10px; }
.level-node.mission-node.done { border-style: solid; border-color: var(--success); background: var(--success-bg); }

/* ---------- level page ---------- */
.level-header { margin-bottom: 22px; }
.level-title-row { display: flex; align-items: center; gap: 12px; }
.level-emoji { font-size: 30px; }
.level-title-row h1 { font-size: 26px; margin: 0; }
.src-link { font-size: 13px; display: inline-block; margin: 6px 0 14px; }
.level-progress { height: 10px; background: #eee7ff; border-radius: 99px; overflow: hidden; margin-top: 10px; }
.level-progress-fill { height: 100%; background: linear-gradient(90deg, var(--world-color, var(--primary)), var(--accent)); transition: width .5s ease; }
.level-progress-label { font-size: 13px; color: var(--text-soft); margin-top: 6px; font-weight: 600; }

.theory-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 26px 28px; box-shadow: var(--shadow-sm); margin-bottom: 28px;
}
.theory-intro { font-size: 17px; font-weight: 600; color: var(--primary-dark); }
.example-block { margin: 14px 0; }
.example-note { font-size: 14px; color: var(--text-soft); background: var(--surface-soft); border-left: 3px solid var(--world-color, var(--primary-2)); padding: 8px 12px; border-radius: 0 10px 10px 0; margin-top: -6px; }

/* ---------- code blocks ---------- */
.code-block {
  background: #1e1b2e; color: #e4e1f5; border-radius: var(--radius-sm); padding: 16px 18px;
  overflow-x: auto; font-family: var(--font-code); font-size: 14px; line-height: 1.6; margin: 10px 0;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.05);
}
.code-block code { white-space: pre; }
.code-block.with-lines .code-line { display: block; }
.code-block .ln { display: inline-block; width: 26px; color: #6b6690; user-select: none; margin-right: 10px; text-align: right; }
.code-block .code-line-hl { background: rgba(239,68,68,.18); border-left: 3px solid var(--danger); margin-left: -18px; padding-left: 15px; border-radius: 0 6px 6px 0; }
.tok-kw { color: #c084fc; font-weight: 600; }
.tok-bi { color: #67e8f9; }
.tok-str { color: #86efac; }
.tok-num { color: #fca5a5; }
.tok-cm { color: #8b87a8; font-style: italic; }

/* ---------- tasks ---------- */
.tasks-list { display: flex; flex-direction: column; gap: 20px; }
.task-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 22px 24px; box-shadow: var(--shadow-sm); animation: pop-in .35s ease both;
}
.task-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.task-num { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); font-weight: 700; }
.task-type-badge { font-size: 12px; padding: 4px 10px; border-radius: 99px; font-weight: 700; background: var(--surface-soft); border: 1px solid var(--border); }
.type-quiz { color: #6d28d9; background: #f3eaff; }
.type-predict { color: #0369a1; background: #e6f6ff; }
.type-assemble { color: #b45309; background: #fff7e6; }
.type-bugfix { color: #be123c; background: #ffe9ee; }
.type-write { color: #15803d; background: #e9fbef; }
.task-prompt { font-weight: 600; margin-bottom: 14px; white-space: pre-line; }
.task-body { margin-bottom: 8px; }
.task-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.task-hints { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.hint-box { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; padding: 10px 14px; border-radius: var(--radius-sm); font-size: 14px; display: flex; gap: 8px; animation: pop-in .3s ease both; }
.task-feedback { margin-top: 14px; border-radius: var(--radius-sm); padding: 0; display: none; }
.task-feedback:not(:empty) { display: block; }
.fb-ok { background: var(--success-bg); border: 1px solid #bbf7d0; padding: 14px 16px; color: #14532d; }
.fb-bad { background: var(--danger-bg); border: 1px solid #fecdd3; padding: 14px 16px; color: #881337; }
.fb-title { font-weight: 700; margin-bottom: 4px; }
.fb-explain { font-weight: 400; margin-top: 8px; font-size: 14px; line-height: 1.6; }
.task-card.task-solved { border-color: #bbf7d0; box-shadow: 0 0 0 3px rgba(34,197,94,.12); }
.task-card.task-shake { animation: shake .4s ease; }
@keyframes shake { 10%,90% { transform: translateX(-2px); } 20%,80% { transform: translateX(4px); } 30%,50%,70% { transform: translateX(-8px); } 40%,60% { transform: translateX(8px); } }

/* quiz */
.opt-list { display: flex; flex-direction: column; gap: 10px; }
.opt-row { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border: 2px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; transition: border-color .15s ease, background .15s ease; }
.opt-row:hover { border-color: var(--primary-2); background: var(--surface-soft); }
.opt-row input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--primary); flex-shrink: 0; }

/* predict */
.text-input, .predict-input {
  width: 100%; padding: 12px 14px; border-radius: var(--radius-sm); border: 2px solid var(--border);
  font-family: var(--font-code); font-size: 14px; margin-top: 6px;
}
.text-input:focus, .predict-input:focus { outline: none; border-color: var(--primary-2); }

/* assemble */
.assemble-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.assemble-col h4 { font-size: 13px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; }
.assemble-pool, .assemble-seq { min-height: 120px; background: var(--surface-soft); border: 2px dashed var(--border); border-radius: var(--radius-sm); padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.assemble-seq { border-style: solid; }
.code-chip { background: #1e1b2e; color: #e4e1f5; font-family: var(--font-code); font-size: 13px; padding: 8px 12px; border-radius: 8px; cursor: pointer; white-space: pre; transition: transform .12s ease, opacity .12s ease; }
.code-chip:hover { transform: translateX(3px); opacity: .9; }
@media (max-width: 640px) { .assemble-wrap { grid-template-columns: 1fr; } }

/* bugfix */
.bugfix-step { margin: 12px 0 6px; font-size: 14px; }
.line-picks { display: flex; flex-wrap: wrap; gap: 8px; }
.line-pick { border: 2px solid var(--border); background: #fff; border-radius: 10px; padding: 6px 12px; font-family: var(--font-code); cursor: pointer; font-size: 13px; }
.line-pick:hover { border-color: var(--primary-2); }
.line-pick.picked { background: var(--primary); color: #fff; border-color: var(--primary); }

/* write / mission */
.code-editor {
  width: 100%; background: #1e1b2e; color: #e4e1f5; font-family: var(--font-code); font-size: 14px;
  border-radius: var(--radius-sm); border: 1px solid #34304a; padding: 14px; resize: vertical; line-height: 1.6;
  tab-size: 4;
}
.code-editor:focus { outline: none; border-color: var(--primary-2); }
.run-output { margin-top: 12px; background: var(--surface-soft); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; }
.run-label { font-size: 12px; font-weight: 700; color: var(--text-faint); text-transform: uppercase; letter-spacing: .05em; margin: 6px 0 4px; }
.run-label-err { color: var(--danger); }
.run-stdout, .run-stderr { background: #1e1b2e; color: #e4e1f5; padding: 10px 12px; border-radius: 8px; overflow-x: auto; font-family: var(--font-code); font-size: 13px; white-space: pre-wrap; }
.run-stderr { color: #fca5a5; }
.run-loading { color: var(--text-soft); font-size: 14px; }
.test-row { font-size: 13px; padding: 6px 0; border-bottom: 1px dashed var(--border); }
.test-row:last-child { border-bottom: none; }
.test-row code { background: var(--surface-soft); padding: 1px 6px; border-radius: 5px; }

/* mission */
.mission-header { text-align: center; margin: 10px 0 20px; }
.mission-badge { display: inline-block; background: linear-gradient(135deg,#f59e0b,#ef4444); color: #fff; padding: 6px 16px; border-radius: 99px; font-weight: 700; font-size: 13px; margin-bottom: 10px; }
.mission-brief { border: 2px solid #fde68a; background: #fffbeb; }
.mission-card { border: 2px solid var(--border); }
.mission-editor { min-height: 160px; }

/* complete banner */
.level-complete-banner {
  text-align: center; margin-top: 30px; padding: 36px 24px; border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #fff7e6, #ffe6f3); border: 2px solid #ffd7ec; animation: pop-in .5s ease both;
}
.complete-icon { font-size: 52px; animation: float-bob 1.8s ease-in-out infinite; }
.complete-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }

/* ---------- toasts & confetti ---------- */
.toast-layer { position: fixed; right: 18px; bottom: 18px; z-index: 900; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; pointer-events: none; }
.toast {
  background: #fff; border: 1px solid var(--border); box-shadow: var(--shadow-lg); border-radius: 14px;
  padding: 12px 18px; font-weight: 600; font-size: 14px; opacity: 0; transform: translateY(12px) scale(.96);
  transition: opacity .3s ease, transform .3s ease; display: flex; align-items: center; gap: 8px; max-width: 320px;
}
.toast.show { opacity: 1; transform: translateY(0) scale(1); }
.toast-icon { font-size: 18px; }
.toast-xp { border-color: #ffe6ad; background: #fffbeb; }
.toast-achievement { border-color: #e4d3ff; background: #f8f3ff; }
.toast-info { border-color: #bfe3ff; background: #f0f9ff; }

.confetti-piece {
  position: fixed; top: -12px; width: 9px; height: 14px; z-index: 901; pointer-events: none;
  animation: confetti-fall 2.2s linear forwards; border-radius: 2px;
}
@keyframes confetti-fall { to { transform: translateY(105vh) rotate(600deg); opacity: .3; } }

@keyframes pop-in { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

/* ---------- modals ---------- */
.modal-layer { position: fixed; inset: 0; z-index: 950; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(30,20,50,.5); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; padding: 20px; animation: fade-in .2s ease; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal-box { background: #fff; border-radius: var(--radius-lg); padding: 28px; max-width: 640px; width: 100%; max-height: 84vh; overflow-y: auto; position: relative; box-shadow: var(--shadow-lg); animation: pop-in .25s ease; }
.modal-close { position: absolute; top: 16px; right: 16px; width: 34px; height: 34px; border-radius: 50%; border: none; background: var(--surface-soft); cursor: pointer; font-size: 16px; }

.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; margin-top: 16px; }
.ach-card { text-align: center; padding: 16px 10px; border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--surface-soft); }
.ach-card.unlocked { background: linear-gradient(160deg,#fff7e6,#fff); border-color: #ffe6ad; }
.ach-card.locked { opacity: .5; filter: grayscale(.4); }
.ach-icon { font-size: 30px; margin-bottom: 6px; }
.ach-title { font-weight: 700; font-size: 13px; margin-bottom: 4px; }
.ach-desc { font-size: 12px; color: var(--text-soft); }

.settings-row { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.settings-stats { display: flex; flex-direction: column; gap: 6px; margin: 14px 0; font-size: 14px; color: var(--text-soft); }

/* ---------- responsive tweaks ---------- */
@media (max-width: 640px) {
  .view-root { padding: 18px 14px 50px; }
  .theory-card, .task-card { padding: 18px 16px; }
  .chapter-hero { flex-direction: column; text-align: center; }
  .level-title-row h1 { font-size: 21px; }
  .map-hero h1 { font-size: 26px; }
  .btn { padding: 11px 16px; font-size: 14px; }
}

.predict-input { resize: vertical; min-height: 90px; line-height: 1.5; white-space: pre-wrap; }
.predict-help { margin: 6px 0 0; font-size: 13px; color: var(--text-faint); }
