/* Imlo (js/imlo.js): AI matnni tekshiradi, to‘g‘rilangan matn o‘z joyida «ochiladi». Kunduzgi va tungi mavzu.
   Kalit kadrlar (ang, shine) va --ang — app.css da. */
:root { --imlo-hot: #8FC2FF; --imlo-glow: rgba(0,100,255,.95); --imlo-set: rgba(52,211,153,.22); --imlo-flash: rgba(190,225,255,.55); --imlo-shine: #FFFFFF; }
:root[data-theme="light"] { --imlo-hot: #0055F0; --imlo-glow: rgba(0,85,240,.35); --imlo-set: rgba(5,150,105,.15); --imlo-flash: rgba(0,85,240,.22); --imlo-shine: #7FB2FF; }

.imlo { position: relative; }
.imlo > .inp { display: block; position: relative; transition: color .22s ease, border-color .35s ease, box-shadow .35s ease; }

/* 1) Tekshirilmoqda: maydon chegarasi bo‘ylab nur aylanadi, matn ustidan yaltiroq to‘lqin o‘tadi */
.imlo::before { content: ''; position: absolute; inset: -.5px; z-index: 2; padding: 2px; border-radius: 14.5px; pointer-events: none; opacity: 0; transition: opacity .3s ease;
  background: conic-gradient(from var(--ang), rgba(166,208,247,0) 0deg, #A6D0F7 70deg, #0064FF 140deg, #8B5CF6 200deg, rgba(139,92,246,0) 260deg, rgba(166,208,247,0) 360deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; }
.imlo::after { content: ''; position: absolute; inset: 0; z-index: 2; border-radius: 14px; pointer-events: none; opacity: 0; transition: opacity .3s ease;
  background: linear-gradient(100deg, rgba(166,208,247,0) 35%, rgba(166,208,247,.26) 50%, rgba(166,208,247,0) 65%) 0 0 / 250% 100% no-repeat; }
:root[data-theme="light"] .imlo::before { background: conic-gradient(from var(--ang), rgba(10,111,224,0) 0deg, #0A6FE0 70deg, #0038C8 140deg, #7C3AED 200deg, rgba(124,58,237,0) 260deg, rgba(10,111,224,0) 360deg); }
:root[data-theme="light"] .imlo::after { background-image: linear-gradient(100deg, rgba(0,85,240,0) 35%, rgba(0,85,240,.1) 50%, rgba(0,85,240,0) 65%); }
.imlo.busy::before { opacity: 1; animation: ang 1.2s linear infinite; }
.imlo.busy::after { opacity: 1; animation: shine 1.5s linear infinite; }
.imlo.busy > .inp { box-shadow: 0 0 22px rgba(0,100,255,.28); }

/* 2) To‘g‘rilash: maydon ustidagi qatlamda o‘zgargan so‘zlar «aylanib», to‘g‘ri harflarga o‘rnashadi */
.imlo.hide > .inp { color: transparent; caret-color: transparent; transition: border-color .35s ease, box-shadow .35s ease; }   /* yashirish — darhol, qaytishi — silliq */
.imlo-ov { position: absolute; inset: 0; z-index: 3; box-sizing: border-box; overflow: hidden; pointer-events: none; border-style: solid; border-color: transparent; color: var(--text); transition: opacity .26s ease; }
.imlo-ov.line { display: flex; align-items: center; }
.imlo-ov.out { opacity: 0; }
.imlo-in { white-space: pre; will-change: transform; }
.imlo-in.area { white-space: pre-wrap; overflow-wrap: break-word; }
.imlo-w { border-radius: 5px; -webkit-box-decoration-break: clone; box-decoration-break: clone; transition: color .9s ease, background-color 1s ease, box-shadow 1s ease, text-shadow .6s ease; }
.imlo-w.run { color: var(--imlo-hot); text-shadow: 0 0 10px var(--imlo-glow), 0 0 2px var(--imlo-glow); transition: none; }
.imlo-w.set { color: var(--ok-text); background-color: var(--imlo-set); box-shadow: 0 0 0 2px var(--imlo-set); text-shadow: 0 0 12px rgba(52,211,153,.5); transition: none; animation: imlo-pop .5s ease-out; }
.imlo-w.fade { color: var(--text); background-color: rgba(52,211,153,0); box-shadow: 0 0 0 2px rgba(52,211,153,0); text-shadow: none; }
:root[data-theme="light"] .imlo-w.set { text-shadow: none; }

/* uchqunlar */
.imlo-p { position: absolute; z-index: 4; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; pointer-events: none; opacity: 0; animation: imlo-p .85s cubic-bezier(.15,.75,.3,1) forwards; }
.imlo-p.c1 { background: radial-gradient(circle, #fff 0 32%, #A6D0F7 48%, rgba(166,208,247,0) 72%); }
.imlo-p.c2 { background: radial-gradient(circle, #fff 0 30%, #34D399 50%, rgba(52,211,153,0) 72%); }
.imlo-p.c3 { background: radial-gradient(circle, #fff 0 30%, #A78BFA 50%, rgba(167,139,250,0) 72%); }
.imlo-p.star { width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px; border-radius: 0; clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); }
.imlo-p.star.c1 { background: #CFE6FF; }
.imlo-p.star.c2 { background: #6EE7B7; }
.imlo-p.star.c3 { background: #C4B5FD; }
:root[data-theme="light"] .imlo-p.c1 { background: radial-gradient(circle, #0A6FE0 0 38%, rgba(10,111,224,0) 72%); }
:root[data-theme="light"] .imlo-p.c2 { background: radial-gradient(circle, #059669 0 38%, rgba(5,150,105,0) 72%); }
:root[data-theme="light"] .imlo-p.c3 { background: radial-gradient(circle, #7C3AED 0 38%, rgba(124,58,237,0) 72%); }
:root[data-theme="light"] .imlo-p.star.c1 { background: #0A6FE0; }
:root[data-theme="light"] .imlo-p.star.c2 { background: #059669; }
:root[data-theme="light"] .imlo-p.star.c3 { background: #7C3AED; }

/* 3) Tayyor: maydon chegarasi bir lahza yashil yonadi */
.imlo.done > .inp { border-color: var(--ok); box-shadow: 0 0 0 4px rgba(52,211,153,.16), 0 0 22px rgba(52,211,153,.22); }

/* maydon ostidagi yozuv: «AI tekshirmoqda…», «AI to‘g‘riladi · Asl matn» */
.imlo-note { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; min-height: 24px; font-size: 13px; font-weight: 700; line-height: 1.35; color: var(--primary-text); animation: imlo-in .38s cubic-bezier(.2,.8,.2,1); }
.imlo-note > svg { flex-shrink: 0; color: var(--ice); filter: drop-shadow(0 0 4px rgba(0,100,255,.6)); }
.imlo-note.busy > svg { animation: imlo-tw 1.2s ease-in-out infinite; }
.imlo-note.fixed > svg { animation: imlo-tw 1.2s ease-in-out 2; }
.imlo-note.ok, .imlo-note.ok > svg { color: var(--ok-text); filter: none; }
.imlo-note.back { color: var(--text2); font-weight: 600; }
.imlo-note button { min-height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line2); background: var(--primary-soft); color: var(--primary-text); font: inherit; font-size: 12px; font-weight: 800; cursor: pointer; transition: transform .16s ease; }
.imlo-note button:active { transform: scale(.96); }
.imlo-shine { background: linear-gradient(90deg, var(--primary-text) 0%, var(--primary-text) 38%, var(--imlo-shine) 50%, var(--primary-text) 62%, var(--primary-text) 100%) 0 0 / 250% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: shine 1.8s linear infinite; }

@keyframes imlo-p { 0% { opacity: 0; transform: translate(0, 0) scale(.3) rotate(0deg); } 18% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(1) rotate(90deg); } }
@keyframes imlo-pop { 0% { background-color: var(--imlo-flash); box-shadow: 0 0 0 6px var(--imlo-flash); } }
@keyframes imlo-in { from { opacity: 0; transform: translateY(-5px); } }
@keyframes imlo-tw { 0%, 100% { transform: scale(.85) rotate(0deg); } 50% { transform: scale(1.2) rotate(18deg); } }
