/* Лаборатория — этап «Испытание». Подключать после app.css и filter.css: этап рисуется поверх
   общего фона Лаборатории (factory-backdrop, сине-фиолетовый), собственного фона у него нет.
   Экран фиксирован по высоте доступной области, вертикальной прокрутки нет. */

.lt-stage {
  --lt-ink: #10141C; --lt-muted: #575D6B; --lt-surface: #FCFDFF; --lt-blue: #6A90FF; --lt-line: #6889FF;
  --lt-ok: #1F7A45; --lt-ok-led: #2FA564; --lt-bad: #C62F2F; --lt-bad-led: #E05252;
  --spring: cubic-bezier(.34,1.45,.64,1); --glide: cubic-bezier(.2,.8,.2,1);
  position: relative; display: flex; flex-direction: column; gap: .78rem; width: 100%; max-width: 36rem; height: 100%; min-height: 0; margin: 0 auto;
  color: var(--lt-ink); font-family: Montserrat, sans-serif; -webkit-user-select: none; user-select: none;
}

/* Плашка задания: общий синий, белый текст; перевод образца — на полупрозрачной внутренней плашке. */
.lt-task { flex-shrink: 0; display: flex; flex-direction: column; gap: .55rem; padding: .78rem .9rem .9rem; border-radius: 1.1rem; background: var(--lt-blue); color: #FCFDFF; }
.lt-task-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.lt-name { font-size: .83rem; font-weight: 700; }
.lt-pips { display: flex; gap: .28rem; }
.lt-pips i { width: .56rem; height: .56rem; box-sizing: border-box; border: 2px solid rgba(252,253,255,.7); border-radius: 50%; transition: background-color .25s, border-color .25s; }
.lt-pips i.is-on { background: #FCFDFF; border-color: #FCFDFF; }
.lt-order { display: flex; flex-direction: column; gap: .1rem; padding: .62rem .78rem; border: 1.5px solid rgba(252,253,255,.85); border-radius: .78rem; background: rgba(252,253,255,.16); overflow: hidden; }
.lt-order-text { display: block; min-height: 2.6em; font-size: 1.02rem; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.lt-ru { font-size: 1.2em; font-weight: 700; white-space: nowrap; }

/* Пробирка-образец парит над колбами и слегка покачивается. */
.lt-bench { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; padding-top: .3rem; padding-bottom: .4rem; }
.lt-holder { position: relative; z-index: 3; align-self: center; display: grid; place-items: center; width: min(100%, 16.5rem); height: 6rem; }

.lt-sample { position: relative; display: flex; align-items: center; width: min(100%, 16rem); height: 4.3rem; margin: 0; padding: 0; border: 0; background: none; cursor: grab; touch-action: none; -webkit-tap-highlight-color: transparent; will-change: transform; transition: opacity .25s ease, filter .25s ease; }
.lt-sample:focus-visible { outline: 2px solid var(--lt-blue); outline-offset: 4px; border-radius: 2rem; }
.lt-sample.is-dragging { cursor: grabbing; filter: drop-shadow(0 14px 18px rgba(60,80,170,.28)); }
.lt-sample.is-idle { animation: lt-bob 2.6s ease-in-out infinite; }
.lt-sample.is-gone { opacity: 0; transition: opacity .12s ease; }
@keyframes lt-bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -4px; } }
.lt-sample-cork { flex-shrink: 0; width: 1.5rem; height: 2.7rem; border-radius: .45rem 0 0 .45rem; background: linear-gradient(#B9A3FF, #8C7BFF); box-shadow: inset 0 -3px 0 rgba(16,20,28,.12); }
.lt-sample-glass { position: relative; flex: 1; height: 3.6rem; border-radius: 0 2rem 2rem 0; border: 2px solid rgba(104,137,255,.55); border-left: 0; background: linear-gradient(rgba(252,253,255,.95), rgba(236,241,255,.85)); box-shadow: 0 6px 14px rgba(60,80,170,.14), inset 0 2px 0 #fff; overflow: hidden; }
.lt-sample-liquid { position: absolute; left: 0; right: 0; bottom: 0; height: 42%; background: linear-gradient(90deg, #C3AFFF, #8C7BFF 70%, #6A90FF); opacity: .55; }
.lt-sample-liquid::before { content: ''; position: absolute; left: -50%; top: -4px; width: 200%; height: 8px; background: radial-gradient(circle at 8px 8px, transparent 6px, rgba(195,175,255,.9) 6.5px) 0 0 / 16px 8px repeat-x; animation: lt-slosh 2.4s linear infinite; }
@keyframes lt-slosh { to { transform: translateX(16px); } }
.lt-sample-label { position: absolute; left: 2.1rem; right: 1.1rem; top: 50%; transform: translateY(-50%); padding: .34rem .6rem; border-radius: .55rem; background: var(--lt-surface); box-shadow: 0 1px 0 rgba(104,137,255,.25); font-size: 1.35rem; font-weight: 700; line-height: 1.15; text-align: center; color: var(--lt-ink); white-space: nowrap; overflow: hidden; }

/* Колбы на полке: стекло, жидкость с волной и пузырьками, этикетка среды снизу. */
.lt-rack { position: relative; z-index: 2; margin-top: auto; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; align-items: end; }
.lt-flask { position: relative; display: flex; flex-direction: column; align-items: center; gap: .3rem; min-width: 0; margin: 0; padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: opacity .35s ease, filter .35s ease; }
.lt-flask:focus-visible { outline: 2px solid var(--lt-blue); outline-offset: 4px; border-radius: 1rem; }
.lt-flask-svg { display: block; width: 100%; max-width: 8rem; height: auto; overflow: visible; transform-origin: 50% 92%; transition: translate .35s var(--spring), scale .35s var(--spring); }
.lt-flask.is-target .lt-flask-svg { translate: 0 -6px; scale: 1.05; }
.lt-flask.is-dim { opacity: .5; filter: saturate(.6); }
.lt-glass { fill: none; stroke: #7F96F0; stroke-width: 2.4; stroke-linejoin: round; }
.lt-rim { fill: #EEF2FF; stroke: #7F96F0; stroke-width: 2.2; }
.lt-shine { fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; opacity: .8; }
.lt-marks { fill: none; stroke: #7F96F0; stroke-width: 1.6; stroke-linecap: round; opacity: .55; }
.lt-flask { --l1: var(--t1); --l2: var(--t2); }
.lt-stop-a { stop-color: var(--l1); transition: stop-color .6s ease; }
.lt-stop-b { stop-color: var(--l2); transition: stop-color .6s ease; }
.lt-wave { animation: lt-wave 3.2s linear infinite; }
.lt-flask:nth-child(2) .lt-wave { animation-duration: 3.8s; animation-delay: -1.2s; }
.lt-flask:nth-child(3) .lt-wave { animation-duration: 3.5s; animation-delay: -2.1s; }
@keyframes lt-wave { to { transform: translateX(50px); } }
.lt-bubble { fill: #FCFDFF; opacity: 0; animation: lt-rise 2.8s ease-in infinite; animation-delay: var(--d); }
@keyframes lt-rise { 0% { opacity: 0; transform: translate(0, 0) scale(.6); } 15% { opacity: .75; } 80% { opacity: .55; } 100% { opacity: 0; transform: translate(var(--x), -40px) scale(1); } }
.lt-ripple { fill: none; stroke: #FCFDFF; stroke-width: 2; opacity: 0; transform-box: fill-box; transform-origin: center; }
.lt-halo { opacity: 0; transform-box: fill-box; transform-origin: center; transition: opacity .45s ease; }
.lt-flask.is-target .lt-halo { opacity: .45; }
.lt-flask.is-target .lt-glass, .lt-flask.is-target .lt-rim { stroke: var(--lt-blue); }

/* Верно: жидкость вспыхивает, колба светится и пульсирует, пузырьки идут чаще. */
.lt-flask.is-ok { --l1: #B9F3FF; --l2: #5B7CFF; }
.lt-flask.is-ok .lt-halo { opacity: 1; animation: lt-pulse 1.1s ease-in-out infinite; }
.lt-flask.is-ok .lt-glass, .lt-flask.is-ok .lt-rim { stroke: var(--lt-blue); stroke-width: 2.8; }
.lt-flask.is-ok .lt-bubble { animation-duration: 1.1s; }
.lt-flask.is-ok .lt-flask-svg { filter: drop-shadow(0 0 10px rgba(106,144,255,.55)); }
@keyframes lt-pulse { 0%, 100% { transform: scale(.92); } 50% { transform: scale(1.08); } }
.lt-flask.is-reveal .lt-halo { opacity: .6; }
.lt-flask.is-reveal .lt-glass, .lt-flask.is-reveal .lt-rim { stroke: var(--lt-blue); }

/* Неверно: жидкость краснеет и пенится; пена поднимается из горлышка, переливается и стекает. */
.lt-flask.is-bad { --l1: #FFC2CB; --l2: #E05268; }
.lt-flask.is-bad .lt-glass, .lt-flask.is-bad .lt-rim { stroke: var(--lt-bad-led); }
.lt-flask.is-bad .lt-foam { filter: drop-shadow(0 2px 3px rgba(224,82,104,.25)); }
.lt-flask.is-bad .lt-bubble { animation-duration: .7s; }
.lt-foam { transform-box: fill-box; transform-origin: 50% 100%; }
.lt-foam-bead { fill: #FFF8F9; stroke: rgba(224,82,104,.28); stroke-width: .9; opacity: 0; transform-box: fill-box; transform-origin: 50% 100%; transform: translateY(26px) scale(0); }
.lt-drip { fill: none; stroke: #FFE9EC; stroke-width: 6; stroke-linecap: round; stroke-dasharray: 40; stroke-dashoffset: 40; opacity: 0; }
.lt-flask.is-bad .lt-foam-bead { animation: lt-foam .9s cubic-bezier(.3,1.4,.5,1) forwards, lt-fizz 1.4s ease-in-out .9s infinite; animation-delay: calc(var(--n) * 55ms), calc(900ms + var(--n) * 55ms); }
.lt-flask.is-bad .lt-drip { animation: lt-drip .8s ease-in .65s forwards; }
.lt-flask.is-bad .lt-drip + .lt-drip { animation-delay: .85s; }
@keyframes lt-foam { 0% { opacity: 0; transform: translateY(26px) scale(0); } 60% { opacity: 1; } 100% { opacity: 1; transform: none; } }
@keyframes lt-fizz { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.12); } }
@keyframes lt-drip { 0% { opacity: 1; stroke-dashoffset: 40; } 100% { opacity: 1; stroke-dashoffset: 0; } }
/* Промывка: пена плавно оседает, а не исчезает рывком. */
.lt-flask:not(.is-bad) .lt-foam-bead { transition: opacity .3s ease, transform .3s ease; }

.lt-badge { position: absolute; top: .2rem; right: 4%; display: grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 50%; color: #FCFDFF; opacity: 0; pointer-events: none; }
.lt-badge:not(:empty) { opacity: 1; }
.lt-flask.is-ok .lt-badge { background: var(--lt-ok-led); box-shadow: 0 4px 10px rgba(47,165,100,.35); }
.lt-flask.is-bad .lt-badge { background: var(--lt-bad-led); box-shadow: 0 4px 10px rgba(224,82,82,.35); }
.lt-badge svg { width: .85rem; height: .85rem; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }

/* Этикетка среды: «make a ___»; после ответа пропуск заполняется словом. */
.lt-tag { position: relative; display: flex; flex-direction: column; align-items: center; gap: .15rem; width: 100%; min-height: 3.3rem; box-sizing: border-box; padding: .45rem .4rem .5rem; border-radius: .7rem; background: var(--lt-surface); box-shadow: 0 4px 12px rgba(40,50,80,.08); border: 1.5px solid #DCE3FB; transition: border-color .3s, box-shadow .3s, background-color .3s; }
.lt-frame { font-size: .92rem; font-weight: 700; line-height: 1.25; text-align: center; overflow-wrap: anywhere; }
.lt-blank { display: inline-block; min-width: 2.2rem; height: 1em; margin: 0 .12rem; vertical-align: -.12em; border-bottom: 2px solid #8FA6E6; border-radius: 1px; }
.lt-blank.is-filled { min-width: 0; height: auto; border-bottom: 0; vertical-align: baseline; }
.lt-blank.is-ok { color: var(--lt-blue); }
.lt-blank.is-reveal { color: var(--lt-blue); }
.lt-tag-ru { font-size: .68rem; font-weight: 500; line-height: 1.2; color: var(--lt-muted); text-align: center; }
.lt-tag-ru:empty { display: none; }
.lt-flask.is-target .lt-tag { border-color: var(--lt-blue); box-shadow: 0 6px 16px rgba(106,144,255,.22); }
.lt-flask.is-ok .lt-tag { border-color: var(--lt-ok-led); }
.lt-flask.is-bad .lt-tag { border-color: var(--lt-bad-led); background: #FFF6F7; }
.lt-flask.is-bad .lt-frame { text-decoration: line-through; text-decoration-color: rgba(198,47,47,.6); }
.lt-flask.is-reveal .lt-tag { border-color: var(--lt-blue); }

.lt-shelf { position: relative; z-index: 1; height: .7rem; margin: -.2rem -.2rem 0; border-radius: .35rem; background: linear-gradient(#DCE4FF, #C6D2FA); box-shadow: 0 6px 14px rgba(60,80,170,.12); }

.lt-spark { position: absolute; z-index: 4; width: 10px; height: 10px; pointer-events: none; background: #FCFDFF; clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); filter: drop-shadow(0 0 4px rgba(106,144,255,.9)); }

.lt-stage.is-over .lt-rack, .lt-stage.is-over .lt-sample { pointer-events: none; }
.lt-stage.is-over .lt-rack { opacity: .7; transition: opacity .4s; }

/* Короткие экраны (Telegram с панелями): компактнее, но без вертикальной прокрутки. */
@media (max-height: 720px) {
  .lt-stage { gap: .55rem; }
  .lt-task { gap: .4rem; padding: .6rem .78rem .7rem; }
  .lt-order { padding: .45rem .7rem; }
  .lt-order-text { font-size: .95rem; }
  .lt-holder { height: 5rem; }
  .lt-sample { height: 3.9rem; }
  .lt-sample-label { font-size: 1.22rem; }
  .lt-flask-svg { max-width: 6.2rem; }
  .lt-tag { min-height: 2.9rem; padding: .35rem .35rem .4rem; }
  .lt-frame { font-size: .84rem; }
}
@media (max-width: 360px) {
  .lt-rack { gap: .4rem; }
  .lt-frame { font-size: .8rem; }
  .lt-sample { width: 14.5rem; }
}
@media (prefers-reduced-motion: reduce) {
  .lt-stage *, .lt-stage *::before, .lt-stage *::after { animation: none !important; transition: none !important; }
  .lt-flask.is-bad .lt-foam-bead { opacity: 1; transform: none; }
  .lt-flask.is-bad .lt-drip { opacity: 1; stroke-dashoffset: 0; }
}

/* Embed in the same fixed viewport as Magnets, including Telegram safe areas. */
.game-screen[data-game="falling"][data-station="trial"] {
  overflow:hidden;overscroll-behavior:none;padding-inline:1rem;
  padding-bottom:calc(.75rem + var(--app-safe-bottom));
}
.game-screen[data-station="trial"] .game-header {height:3.5rem;}
.game-screen[data-station="trial"] .game-dom {flex:1 1 0;min-height:0;padding-top:.25rem;}
@media(max-height:650px){.game-screen[data-station="trial"] .game-header {height:3rem;}}
