/* =====================================================================
   Лабораторные по PHP (/labs/php/lab*.php) — на токенах UI 3.0 из style.css
   ===================================================================== */
.lp-body { background: #fafafb; color: var(--ui-ink); }
.lp-main { position: relative; padding: 2.2rem 0 4rem; overflow: hidden; }
.lp-wrap { position: relative; z-index: 1; max-width: 1000px; }
.lp-glow { position: absolute; inset: 0 0 auto; height: 620px; pointer-events: none; }
.lp-glow i { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .5; }
.lp-glow i:nth-child(1) { width: 520px; height: 420px; top: -180px; right: -120px; background: #ffc4ec; }
.lp-glow i:nth-child(2) { width: 360px; height: 300px; top: 120px; left: -160px; background: #ffe6f6; }

/* ---------- Шапка страницы ---------- */
.lp-hero { margin-bottom: 1.8rem; }
.lp-hero__top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 2.2rem; }
.lp-counter { font-size: .85rem; font-weight: 600; color: #9a9aa0; letter-spacing: .04em; }
.lp-counter b { color: var(--ui-ink); font-size: 1.05rem; }
.lp-eyebrow { display: inline-block; margin-bottom: .7rem; font-size: .72rem; font-weight: 700; letter-spacing: .22em; text-transform: uppercase; color: var(--ui-pink-2); }
.lp-title { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem 1.1rem; margin: 0 0 .9rem; font-size: clamp(2.1rem, 5.5vw, 3.6rem); font-weight: 200; letter-spacing: -.04em; line-height: 1.05; }
.lp-title__num {
  display: inline-grid; place-items: center; height: 1.25em; padding: 0 .38em; border-radius: .38em;
  background: var(--ui-grad); color: #fff; font-weight: 800; font-size: .72em; letter-spacing: -.02em;
  box-shadow: 0 18px 34px -16px rgba(255, 73, 194, .9);
}
.lp-lead { max-width: 640px; margin: 0 0 1.6rem; font-size: 1.05rem; line-height: 1.6; color: #66666e; }

.lp-steps { display: flex; flex-wrap: wrap; gap: .35rem; }
.lp-step-dot {
  display: grid; place-items: center; min-width: 46px; height: 32px; padding: 0 .55rem; border-radius: 999px;
  border: 1.5px solid var(--ui-line); background: #fff; font-size: .76rem; font-weight: 700; color: #8a8a92 !important;
  font-variant-numeric: tabular-nums; transition: border-color .25s, color .25s, background .25s, transform .3s var(--ui-ease);
}
.lp-step-dot:hover { border-color: var(--ui-pink); color: var(--ui-pink-2) !important; transform: translateY(-2px); }
.lp-step-dot.is-done { background: var(--ui-pink-soft); border-color: transparent; color: var(--ui-pink-2) !important; }
.lp-step-dot.is-active { background: var(--ui-ink); border-color: var(--ui-ink); color: #fff !important; }

/* ---------- Панели ---------- */
.lp-panel { margin-bottom: 1.2rem; border-radius: 28px; background: #fff; border: 1px solid var(--ui-line); box-shadow: 0 30px 60px -48px rgba(17, 17, 17, .45); overflow: hidden; }
.lp-panel__head { display: flex; align-items: center; gap: .8rem; padding: 1rem 1.4rem; border-bottom: 1px solid var(--ui-line); }
.lp-label { display: inline-flex; align-items: center; gap: .5rem; font-size: .72rem; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--ui-ink); }
.lp-label i { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 4px rgba(34, 197, 94, .18); animation: lp-pulse 2s ease-in-out infinite; }
@keyframes lp-pulse { 50% { box-shadow: 0 0 0 7px rgba(34, 197, 94, 0); } }
.lp-file { margin-left: auto; font-family: "JetBrains Mono", ui-monospace, Consolas, monospace; font-size: .78rem; color: #9a9aa0; }
.lp-out { padding: 1.6rem 1.4rem 1.7rem; font-size: 1.02rem; overflow-x: auto; }
.lp-note { margin: 1rem 0 0; font-size: .82rem; color: #8a8a92; }
.lp-note i { display: inline-block; width: 12px; height: 12px; margin-right: .35rem; border-radius: 4px; vertical-align: -1px; background: var(--ui-grad); }

/* ---------- Код ---------- */
.lp-code { background: #121214; border-color: #121214; }
.lp-code .lp-panel__head { border-color: #232327; }
.lp-dots { display: inline-flex; gap: 6px; }
.lp-dots i { width: 11px; height: 11px; border-radius: 50%; background: #ff5f57; }
.lp-dots i:nth-child(2) { background: #febc2e; }
.lp-dots i:nth-child(3) { background: #28c840; }
.lp-label--dark { color: #8c8c96; }
.lp-copy {
  display: inline-flex; align-items: center; gap: .45rem; height: 34px; margin-left: auto; padding: 0 .9rem; border-radius: 999px;
  border: 1px solid #2c2c31; background: #1b1b1f; color: #d6d6dc; font: inherit; font-size: .78rem; font-weight: 600; cursor: pointer;
  transition: border-color .25s, color .25s, background .25s;
}
.lp-copy:hover { border-color: var(--ui-pink); color: #fff; }
.lp-copy.is-done { background: var(--ui-pink-2); border-color: var(--ui-pink-2); color: #fff; }
.lp-code__body { display: flex; overflow-x: auto; font-family: "JetBrains Mono", ui-monospace, Consolas, monospace; font-size: .84rem; line-height: 1.75; font-variant-ligatures: none; }
.lp-gutter { flex: none; padding: 1.2rem .9rem 1.4rem 1.4rem; white-space: pre; text-align: right; color: #45454d; user-select: none; }
.lp-src { flex: 1; padding: 1.2rem 1.4rem 1.4rem .4rem; }
.lp-src pre { margin: 0; overflow: visible; font: inherit; }
.lp-src code { font: inherit; white-space: pre; }

/* ---------- Навигация между работами ---------- */
.lp-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1.8rem; }
.lp-pager__link {
  position: relative; display: flex; flex-direction: column; gap: .25rem; padding: 1.1rem 1.4rem; border-radius: 22px;
  background: #fff; border: 1.5px solid var(--ui-line); color: var(--ui-ink) !important; overflow: hidden; isolation: isolate;
  transition: transform .35s var(--ui-ease), border-color .3s, box-shadow .35s var(--ui-ease), color .3s;
}
.lp-pager__link::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--ui-grad); transform: scaleX(0); transform-origin: left; transition: transform .5s var(--ui-ease); }
.lp-pager__link--next { text-align: right; }
.lp-pager__link--next::before { transform-origin: right; }
.lp-pager__link small { font-size: .74rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ui-pink-2); transition: color .3s; }
.lp-pager__link b { font-size: 1rem; font-weight: 700; }
.lp-pager__link:hover { color: #fff !important; border-color: transparent; transform: translateY(-3px); box-shadow: 0 20px 36px -18px rgba(255, 73, 194, .8); }
.lp-pager__link:hover::before { transform: scaleX(1); }
.lp-pager__link:hover small { color: #ffe1f4; }
.lp-footer { margin-top: 2.4rem; text-align: center; font-size: .8rem; color: #a0a0a8; }

/* =====================================================================
   Оформление результатов
   ===================================================================== */

/* 5.1 — цветной текст */
.lp-colors { display: grid; gap: .6rem; }
.lp-colors span { display: flex; align-items: center; gap: .9rem; padding: .85rem 1.1rem; border-radius: 16px; background: #f7f7f8; font-size: 1.15rem; font-weight: 600; }
.lp-colors span::before { content: ""; width: 14px; height: 14px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 5px color-mix(in srgb, currentColor 18%, transparent); }

/* 5.2 — нумерованные строки вывода */
.lp-lines { display: grid; gap: .6rem; counter-reset: ln; }
.lp-lines > div {
  counter-increment: ln; display: flex; align-items: center; flex-wrap: wrap; gap: .8rem; padding: .85rem 1rem; border-radius: 16px; background: #f7f7f8;
}
.lp-lines > div::before { content: counter(ln); display: grid; place-items: center; width: 30px; height: 30px; border-radius: 10px; background: var(--ui-ink); color: #fff; font-size: .8rem; font-weight: 700; }
.lp-lines > div::after { content: attr(data-m); margin-left: auto; padding: .2rem .65rem; border-radius: 999px; background: var(--ui-pink-soft); color: var(--ui-pink-2); font-family: "JetBrains Mono", monospace; font-size: .74rem; font-weight: 600; }

/* 5.3 — состояние до / после */
.lp-states { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.lp-state { padding: 1.2rem; border-radius: 20px; background: #f7f7f8; }
.lp-state.is-changed { background: var(--ui-pink-soft); }
.lp-state h5 { margin: 0 0 .9rem; font-size: .75rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #8a8a92; }
.lp-state.is-changed h5 { color: var(--ui-pink-2); }
.lp-state p { display: flex; flex-direction: column; gap: .15rem; margin: 0 0 .7rem; padding: .7rem .9rem; border-radius: 14px; background: #fff; font-weight: 600; }
.lp-state p:last-child { margin: 0; }
.lp-state p b { font-family: "JetBrains Mono", monospace; font-size: .78rem; font-weight: 600; color: var(--ui-pink-2); }

/* 5.4 — таблица приведения типов */
.lp-kv { width: 100%; border-collapse: separate; border-spacing: 0 .45rem; }
.lp-kv th { padding: 0 1rem .2rem; font-size: .72rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #9a9aa0; text-align: left; }
.lp-kv td { padding: .8rem 1rem; background: #f7f7f8; font-weight: 600; }
.lp-kv td:first-child { border-radius: 14px 0 0 14px; }
.lp-kv td:last-child { border-radius: 0 14px 14px 0; text-align: right; }
.lp-kv code { font-family: "JetBrains Mono", monospace; font-size: .85rem; color: var(--ui-ink); }
.lp-type { display: inline-block; padding: .25rem .7rem; border-radius: 999px; background: var(--ui-ink); color: #fff; font-family: "JetBrains Mono", monospace; font-size: .74rem; }
.lp-type--integer { background: #3b5bdb; }
.lp-type--double { background: #7c3aed; }
.lp-type--string { background: #1f8a4c; }
.lp-type--boolean { background: var(--ui-pink-2); }

/* 5.5–5.7 — управление и крупный ответ */
.lp-controls { margin-bottom: 1.4rem; padding-bottom: 1.4rem; border-bottom: 1px dashed var(--ui-line); }
.lp-controls__label { display: block; margin-bottom: .7rem; font-size: .72rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #9a9aa0; }
.lp-form { display: flex; gap: .5rem; margin-bottom: .8rem; }
.lp-input { flex: 1; min-width: 0; height: 48px; padding: 0 1.2rem; border-radius: 999px; border: 1.5px solid var(--ui-line); background: #fff; font: inherit; transition: border-color .25s, box-shadow .25s; }
.lp-input:focus { outline: none; border-color: var(--ui-pink); box-shadow: 0 0 0 4px rgba(255, 73, 194, .15); }
.lp-form .ab { height: 48px; }
.lp-pills { display: flex; flex-wrap: wrap; gap: .4rem; }
.lp-pill {
  display: inline-flex; align-items: center; gap: .4rem; height: 38px; padding: 0 1rem; border-radius: 999px;
  border: 1.5px solid var(--ui-line); background: #fff; font-size: .86rem; font-weight: 600; color: #55555c !important;
  transition: border-color .25s, background .25s, color .25s, transform .3s var(--ui-ease);
}
.lp-pill:hover { border-color: var(--ui-pink); color: var(--ui-pink-2) !important; transform: translateY(-2px); }
.lp-pill.is-active { background: var(--ui-ink); border-color: var(--ui-ink); color: #fff !important; }
.lp-pill small { font-size: .7rem; opacity: .6; }

.lp-chat { display: flex; flex-direction: column; gap: .6rem; }
.lp-msg { align-self: flex-start; max-width: 80%; padding: .85rem 1.2rem; border-radius: 20px 20px 20px 6px; background: #f2f2f4; font-size: 1.1rem; font-weight: 600; }
.lp-msg--me { align-self: flex-end; border-radius: 20px 20px 6px 20px; background: var(--ui-grad); color: #fff; }
.lp-msg--muted { color: #8a8a92; font-weight: 500; font-size: .98rem; }

.lp-big { padding: 2rem 1rem; border-radius: 22px; background: #f7f7f8; text-align: center; font-size: clamp(1.8rem, 5vw, 2.8rem); font-weight: 800; letter-spacing: -.03em; }
.lp-big--empty { font-size: 1rem; font-weight: 500; color: #8a8a92; letter-spacing: 0; }

/* 6.1 / 6.2 — таблицы */
.lp-table { margin: 0 auto; border-collapse: separate; border-spacing: 4px; font-variant-numeric: tabular-nums; }
.lp-table th, .lp-table td { width: 52px; height: 44px; border-radius: 12px; text-align: center; font-size: .92rem; transition: background .15s, color .15s; }
.lp-table th { background: var(--ui-ink); color: #fff; font-weight: 700; }
.lp-table tr:first-child th:first-child { background: var(--ui-grad); }
.lp-table td { background: #f4f4f6; font-weight: 500; color: #44444b; }
.lp-table td.diag { background: var(--ui-grad); color: #fff; font-weight: 800; }
.lp-table .is-hl:not(.diag) { background: var(--ui-pink-soft); color: var(--ui-pink-2); }
.lp-table th.is-hl { background: var(--ui-pink-2); }

/* 6.3 — карточки приветствий */
.lp-hellos { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .8rem; }
.lp-hello { position: relative; padding: 1.3rem 1.2rem 1.2rem; border-radius: 20px; background: #f7f7f8; overflow: hidden; }
.lp-hello::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--c); }
.lp-hello small { display: block; margin-bottom: .4rem; font-family: "JetBrains Mono", monospace; font-size: .74rem; font-weight: 600; color: #9a9aa0; }
.lp-hello span { font-size: 1.45rem; font-weight: 800; letter-spacing: -.02em; color: var(--c); }

/* 6.4 — дни недели */
.lp-days { display: grid; gap: .5rem; }
.lp-day { display: flex; align-items: center; gap: 1rem; padding: .35rem 1.1rem .45rem; border-radius: 16px; background: #f7f7f8; font-weight: 800; letter-spacing: -.02em; line-height: 1.3; }
.lp-day::before { content: ""; flex: none; width: 10px; align-self: stretch; margin: .3rem 0; border-radius: 6px; background: currentColor; }

/* 7.1 / 7.5 — шаги с массивами */
.lp-steps-out { display: grid; gap: 1rem; }
.lp-stage { position: relative; padding: 1.1rem 1.2rem 1.2rem; border-radius: 20px; background: #f7f7f8; }
.lp-stage h5 { display: flex; align-items: center; flex-wrap: wrap; gap: .6rem; margin: 0 0 .9rem; font-size: .95rem; font-weight: 700; }
.lp-stage h5 code { padding: .2rem .6rem; border-radius: 8px; background: var(--ui-ink); color: #fff; font-family: "JetBrains Mono", monospace; font-size: .78rem; }
.lp-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.lp-chip { display: inline-flex; flex-direction: column; align-items: center; min-width: 46px; padding: .35rem .6rem .45rem; border-radius: 12px; background: #fff; border: 1px solid var(--ui-line); font-size: 1.05rem; font-weight: 800; line-height: 1.2; }
.lp-chip small { font-family: "JetBrains Mono", monospace; font-size: .64rem; font-weight: 600; color: #a0a0a8; }
.lp-bars { display: grid; gap: .45rem; }
.lp-barrow { display: grid; grid-template-columns: 100px 1fr 48px; align-items: center; gap: .8rem; font-weight: 600; }
.lp-barrow span { font-size: .92rem; }
.lp-barrow i { display: block; height: 14px; width: var(--w); border-radius: 999px; background: var(--ui-grad); }
.lp-barrow b { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Адаптив ---------- */
@media (max-width: 991.98px) {
  .lp-main { padding-top: 1.4rem; }
}
@media (max-width: 575.98px) {
  .lp-wrap { --bs-gutter-x: 2rem; }
  .lp-hero__top { margin-bottom: 1.6rem; }
  .lp-hero__top .btn-back { padding-right: 1.2rem; font-size: .88rem; }
  .lp-step-dot { min-width: 42px; }
  .lp-out { padding: 1.2rem 1rem 1.3rem; }
  .lp-panel { border-radius: 22px; }
  .lp-states { grid-template-columns: 1fr; }
  .lp-form { flex-direction: column; }
  .lp-form .lp-input { flex: none; }
  .lp-pager { grid-template-columns: 1fr; }
  .lp-pager > span { display: none; }
  .lp-table { border-spacing: 2px; }
  .lp-table th, .lp-table td { width: 30px; height: 32px; border-radius: 8px; font-size: .76rem; }
  .lp-barrow { grid-template-columns: 80px 1fr 40px; gap: .5rem; }
  .lp-gutter { padding-left: 1rem; }
}
@media (prefers-reduced-motion: reduce) {
  .lp-label i { animation: none; }
  .lp-pager__link, .lp-pager__link::before, .lp-step-dot, .lp-pill { transition-duration: .01s !important; }
}
