/* Agentic Loops page: gear and stop rules, the loop ring, and the scratchpad. */
.lp-cols { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.25fr) minmax(0, 1fr); gap: 14px; }

/* Stop rules */
.lp-rules { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.lp-rules li { padding: 7px 10px; border-radius: 10px; border: 1px solid var(--line); background: rgba(2, 6, 23, 0.5); transition: border-color 0.3s, background 0.3s; }
.lp-rules b { display: block; font-family: var(--display); font-size: 0.84rem; color: #fff; }
.lp-rules small { font-family: var(--mono); font-size: 0.68rem; color: var(--muted); }
.lp-rules li.warn { border-color: rgba(250, 204, 21, 0.55); }
.lp-rules li.hit { border-color: rgba(52, 211, 153, 0.7); background: rgba(52, 211, 153, 0.1); box-shadow: 0 0 24px rgba(52, 211, 153, 0.15); }
.lp-rules li[data-rule="repeat"].hit { border-color: rgba(244, 63, 94, 0.75); background: rgba(244, 63, 94, 0.1); box-shadow: 0 0 24px rgba(244, 63, 94, 0.15); }

/* The ring */
.lp-ring { position: relative; width: 100%; max-width: 460px; aspect-ratio: 1; margin: 4px auto 0; }
.lp-ring-svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.lp-track { fill: none; stroke: rgba(148, 163, 184, 0.18); stroke-width: 1.6; stroke-dasharray: 2 2; }
/* 238.76 = the circumference of r=38, so the arc starts empty before any script runs. */
.lp-progress { fill: none; stroke: var(--c-agent); stroke-width: 1.6; stroke-linecap: round; stroke-dasharray: 238.76; stroke-dashoffset: 238.76; transition: stroke-dashoffset 0.6s ease; filter: drop-shadow(0 0 2px var(--c-agent)); }
.lp-st { position: absolute; width: 88px; height: 88px; margin: -44px 0 0 -44px; border-radius: 50%; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 6px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.1), rgba(2, 6, 23, 0.85) 70%); border: 1px solid rgba(56, 189, 248, 0.3); transition: border-color 0.3s, box-shadow 0.3s; }
/* Labels sit outside the ring so they never cross the track or the agent. */
.lp-st b { position: absolute; font-family: var(--display); font-size: 0.74rem; color: var(--muted); letter-spacing: 0.04em; white-space: nowrap; }
.lp-st[data-st="1"] b { bottom: calc(100% + 4px); }
.lp-st[data-st="2"] b { left: calc(100% + 6px); top: 50%; transform: translateY(-50%); }
.lp-st[data-st="3"] b { top: calc(100% + 4px); }
.lp-st[data-st="4"] b { right: calc(100% + 6px); top: 50%; transform: translateY(-50%); }
.lp-st.on { border-color: var(--c-cmd); box-shadow: 0 0 0 4px rgba(250, 204, 21, 0.12), 0 0 30px rgba(250, 204, 21, 0.25); }
.lp-st.on b { color: #fff; }
.lp-core { position: absolute; left: 50%; top: 50%; width: 48%; transform: translate(-50%, -50%); text-align: center; }
.lp-pattern { display: inline-block; font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--c-cmd); border: 1px solid rgba(250, 204, 21, 0.4); border-radius: 999px; padding: 2px 10px; }
.lp-core strong { display: block; font-family: var(--display); font-size: 3rem; line-height: 1.05; color: #fff; margin-top: 6px; }
.lp-core > span:not(.lp-pattern) { font-size: 0.72rem; color: var(--muted); }
.lp-core p { margin: 8px 0 0; font-size: 0.76rem; line-height: 1.45; color: #e2e8f0; min-height: 3em; }
.op.fly.work .bob { filter: drop-shadow(0 0 18px var(--c)) brightness(1.3); }

/* Scratchpad */
.lp-meter { position: relative; height: 10px; border-radius: 999px; background: rgba(2, 6, 23, 0.7); border: 1px solid var(--line); overflow: hidden; }
.lp-meter span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--c-memory), var(--c-skill)); transition: width 0.5s ease, background 0.3s; }
.lp-meter span.hot { background: linear-gradient(90deg, var(--c-cmd), var(--c-exit)); }
.lp-meter i { position: absolute; top: -2px; bottom: -2px; width: 1px; background: rgba(250, 204, 21, 0.7); }
.lp-logrow { flex: 1; display: flex; flex-direction: column; }
.lp-log { flex: 1; min-height: 300px; max-height: 470px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; font-family: var(--mono); font-size: 0.7rem; line-height: 1.55; color: #cbd5e1; scroll-behavior: smooth; }
.lp-pass { padding: 6px 8px; border-radius: 8px; background: rgba(2, 6, 23, 0.45); border: 1px solid var(--line); }
.lp-pass h6 { margin: 0 0 2px; font-family: var(--display); font-size: 0.74rem; color: #fff; }
.lp-pass .ln { animation: swType 0.35s ease both; }
.lp-pass .ln .k { color: var(--c-tower); }
.lp-pass .ln b { color: #fff; }
.lp-pass .ln.ok { color: #a7f3d0; }
.lp-pass .ln.bad { color: #fecdd3; }
.lp-pass .ln.bad .k { color: var(--c-exit); }
.lp-pass ol { margin: 2px 0 0; padding-left: 18px; }
.lp-pass.folded .ln { display: none; }
.lp-pass.folded h6::after { content: " · summarised"; font-family: var(--mono); font-weight: 400; color: var(--c-memory); }
.lp-res-p { margin: 0; font-size: 0.86rem; line-height: 1.6; color: #e2e8f0; }

@media (max-width: 1180px) { .lp-cols { grid-template-columns: 1fr 1fr; } .lp-ringcol { grid-column: 1 / -1; order: -1; } }
@media (max-width: 720px) { .lp-cols { grid-template-columns: 1fr; } .lp-st { width: 70px; height: 70px; margin: -35px 0 0 -35px; } .lp-core strong { font-size: 2.2rem; } }
