/* Батлы (assets/duels.js): кнопка ⚔️, панель «Вызвать», приглашение, экран игры.
   Всё — поверх кабинета и урока (уроки используют z-index до ~10000). Классы — с префиксом dl-.
   Элементы, которые двигает GSAP (.dl-tug, .dl-hero, .dl-call, .dl-count, ответы), — без transition по transform/opacity. */

/* ── кнопка ⚔️ ── */
.dl-btn { position: relative; }
.dl-btn .dl-lock { display: none; position: absolute; right: -7px; bottom: -7px; width: 26px; height: 26px; border-radius: 50%; place-items: center;
  font-size: 13px; background: #2a2d7a; border: 2px solid rgba(255,255,255,.35); }
.dl-btn.dl-locked .dl-lock { display: grid; }
.dl-btn.dl-locked .ico { filter: grayscale(1) brightness(.8); }
.dl-btn .dl-dot { position: absolute; top: -8px; right: -8px; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 12px; display: grid; place-items: center;
  background: #ff4d70; color: #fff; font-size: 14px; font-weight: 900; box-shadow: 0 0 0 3px rgba(10,12,40,.9), 0 0 16px #ff4d70; animation: dlPing 1.2s ease-in-out infinite; }
.dl-btn .dl-dot[hidden] { display: none; }
@keyframes dlPing { 50% { scale: 1.2; } }

.dl-tip { position: fixed; z-index: 20060; translate: -50% 0; padding: 10px 18px; border-radius: 16px; white-space: nowrap; pointer-events: none;
  background: #262a72; border: 2px solid var(--cyan); color: #fff; font: 900 20px Nunito, system-ui, sans-serif; box-shadow: 0 12px 30px rgba(0,0,0,.45); }
.dl-tip-low { left: 50%; bottom: 40px; }

/* ── панель «Вызвать» и ожидание ── */
.dl-sheet { position: fixed; inset: 0; z-index: 20010; display: grid; place-items: center; background: rgba(6, 8, 30, .6); backdrop-filter: blur(4px);
  color: #fff; font-family: Nunito, system-ui, sans-serif; }
.dl-sheet .dl-box { width: min(980px, 94vw); height: auto; max-height: 92vh; }
.dl-body { overflow: auto; padding: 18px 24px 26px; display: flex; flex-direction: column; gap: 16px; }
.dl-h { margin: 0; font-size: 22px; font-weight: 900; color: var(--muted); }
.dl-calls { display: none; padding: 14px 16px; border-radius: 22px; background: rgba(255, 77, 112, .12); border: 2px solid rgba(255, 77, 112, .55); }
.dl-calls.on { display: block; }
.dl-calls .dl-h { color: #ffb3c4; }
.dl-calls-list { display: grid; gap: 10px; margin-top: 10px; }
.dl-inv { display: flex; align-items: center; gap: 14px; font-size: 24px; font-weight: 900; }
.dl-inv-face { width: 64px; height: 64px; flex-shrink: 0; border: 3px solid #fff; background: linear-gradient(180deg, #4a4fc4, #2a2d7a); }
.dl-inv-game { margin-right: auto; font-size: 32px; }
.dl-games { display: flex; gap: 12px; flex-wrap: wrap; }
.dl-gtile { display: flex; align-items: center; gap: 12px; padding: 10px 22px 10px 14px; border-radius: 18px; cursor: pointer; font-size: 21px; font-weight: 900;
  border: 3px solid rgba(255,255,255,.14); background: rgba(255,255,255,.06); transition: background-color .15s, border-color .15s, box-shadow .15s, translate .15s; }
.dl-gtile span { font-size: 38px; }
.dl-gtile:hover { translate: 0 -2px; }
.dl-gtile.on { border-color: var(--lime); background: rgba(182, 242, 58, .14); box-shadow: 0 0 20px rgba(182, 242, 58, .3); }
.dl-kids { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.dl-kids:empty { display: none; }
.dl-kid { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 10px 12px; border-radius: 22px; cursor: pointer;
  border: 3px solid rgba(255,255,255,.14); background: linear-gradient(180deg, rgba(255,255,255,.12), rgba(255,255,255,.04));
  transition: background-color .15s, border-color .15s, box-shadow .15s, translate .15s, filter .15s; }
.dl-kid:hover { translate: 0 -3px; border-color: var(--cyan); box-shadow: 0 0 24px rgba(62, 224, 255, .35); }
.dl-kid b { font-size: 21px; }
.dl-kid-face { width: 104px; height: 104px; border: 3px solid rgba(255,255,255,.35); background: linear-gradient(180deg, #4a4fc4, #2a2d7a); }
.dl-kid-tag { position: absolute; top: 8px; right: 10px; font-size: 24px; }
.dl-kid-locked { filter: grayscale(1) brightness(.6); cursor: default; }
.dl-kid-locked:hover, .dl-kid-busy:hover { translate: none; border-color: rgba(255,255,255,.14); box-shadow: none; }
.dl-kid-busy { opacity: .75; cursor: default; }
.dl-kid-busy .dl-kid-tag { top: 10px; padding: 2px 10px; border-radius: 99px; font-size: 14px; font-weight: 900; background: var(--orange); color: #3a1d00; }
.dl-empty { padding: 22px; text-align: center; font-size: 26px; font-weight: 900; color: var(--muted); border-radius: 22px; background: rgba(255,255,255,.05); }
.dl-botrow { display: flex; justify-content: center; padding-top: 4px; }
.dl-botrow.lonely .btn-game { font-size: 28px; padding: 18px 42px; animation: dlCall 1.4s ease-in-out infinite; }
@keyframes dlCall { 50% { scale: 1.06; } }
.dl-shake { animation: dlShake .45s; }
@keyframes dlShake { 20%, 60% { translate: -10px 0; } 40%, 80% { translate: 10px 0; } }
.dl-row { display: flex; gap: 14px; justify-content: center; align-items: center; flex-wrap: wrap; margin-top: 14px; }

.dl-wait { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 26px 0 12px; text-align: center; }
.dl-wait-face { position: relative; width: 190px; height: 190px; display: grid; place-items: center; margin-bottom: 6px; }
.dl-face-big { position: relative; z-index: 1; width: 160px; height: 160px; border: 4px solid #fff; background: linear-gradient(180deg, #4a4fc4, #2a2d7a); }
.dl-ring { position: absolute; inset: 15px; border-radius: 50%; border: 4px solid var(--cyan); animation: dlRing 1.8s ease-out infinite; }
.dl-ring + .dl-ring { animation-delay: -.9s; }
@keyframes dlRing { from { scale: 1; opacity: .9; } to { scale: 1.55; opacity: 0; } }
.dl-wait-say { margin: 4px 0 0; font-size: 36px; font-weight: 900; }
.dl-wait-game { font-size: 20px; font-weight: 800; color: var(--muted); }
.dl-wait-no .dl-face-big { filter: grayscale(1) brightness(.7); }
.dl-wait-no .dl-ring { display: none; }

/* ── приглашение: карточка справа сверху, центр экрана свободен ── */
.dl-call { position: fixed; top: 90px; right: 18px; z-index: 20040; width: min(400px, calc(100vw - 36px)); display: grid; grid-template-columns: 84px 1fr;
  gap: 12px 14px; align-items: center; padding: 16px; border-radius: 24px; color: #fff; font-family: Nunito, system-ui, sans-serif;
  background: linear-gradient(160deg, #3a2f9a, #1b1f4b); border: 3px solid var(--lime); box-shadow: 0 0 0 6px rgba(182, 242, 58, .15), 0 20px 50px rgba(0,0,0,.55); }
.dl-call-face { width: 84px; height: 84px; border: 3px solid #fff; background: linear-gradient(180deg, #4a4fc4, #2a2d7a); animation: dlBob 1.2s ease-in-out infinite; }
@keyframes dlBob { 50% { translate: 0 -5px; } }
.dl-call-say { font-size: 19px; font-weight: 800; line-height: 1.25; }
.dl-call-say b { color: var(--lime); font-size: 23px; }
.dl-call-btns { grid-column: 1 / -1; display: flex; gap: 10px; }
.dl-call-btns .btn-game { flex: 1; font-size: 21px; padding: 12px 10px; }

/* ── экран игры ── */
.dl-game { --dl-step: 3.4%; position: fixed; inset: 0; z-index: 20030; overflow: hidden; color: #fff; font-family: Nunito, system-ui, sans-serif; user-select: none;
  background: radial-gradient(1000px 600px at 50% 30%, #3a3fa8, transparent 70%), linear-gradient(180deg, #1b1f4b, #0d1030); }
.dl-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 70%; filter: brightness(.8) saturate(1.1); pointer-events: none; }
.dl-top { position: absolute; top: 0; left: 0; right: 0; height: 76px; z-index: 3; display: flex; align-items: center; gap: 14px; padding: 0 20px;
  background: linear-gradient(180deg, rgba(10,12,40,.85), rgba(10,12,40,0)); }
.dl-quit { width: 52px; height: 52px; flex-shrink: 0; border-radius: 16px; border: 2px solid var(--line); background: rgba(255,255,255,.1); font-size: 24px; cursor: pointer;
  transition: background-color .15s; }
.dl-quit:hover { background: rgba(255,255,255,.22); }
.dl-plate { display: flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 900; text-shadow: 0 2px 6px rgba(0,0,0,.7); }
.dl-plate-face { width: 54px; height: 54px; border: 3px solid var(--lime); background: linear-gradient(180deg, #4a4fc4, #2a2d7a); }
.dl-plate-rival .dl-plate-face { border-color: var(--orange); }
.dl-title { margin: 0 auto; padding: 8px 18px; border-radius: 99px; background: rgba(0,0,0,.4); font-size: 20px; font-weight: 900; white-space: nowrap; }
.dl-offline .dl-title::after { content: " · 📡"; color: var(--orange); }

.dl-stage { position: absolute; left: 0; right: 0; top: 64px; height: calc(56vh - 64px); }
.dl-ground { position: absolute; inset: 0; pointer-events: none; }
.dl-midline { position: absolute; left: 50%; top: 62%; bottom: 0; border-left: 4px dashed rgba(255,255,255,.6); translate: -2px 0; }
.dl-mark { position: absolute; top: 80%; bottom: 0; width: 10px; border-radius: 5px; translate: -50% 0; }
.dl-mark-me { left: calc(50% - 5 * var(--dl-step)); background: var(--lime); box-shadow: 0 0 22px var(--lime); }
.dl-mark-rival { left: calc(50% + 5 * var(--dl-step)); background: var(--orange); box-shadow: 0 0 22px var(--orange); }
.dl-tug { position: absolute; inset: 0; }
.dl-hero { position: absolute; bottom: 2%; height: 94%; aspect-ratio: 512 / 768; z-index: 1; transform-origin: 50% 100%; }
.dl-hero::after { content: ""; position: absolute; left: 12%; right: 12%; bottom: -3%; height: 7%; z-index: -1; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(0,0,0,.55), transparent); }
.dl-hero-me { right: calc(50% + 13vw); }
.dl-hero-rival { left: calc(50% + 13vw); }
.dl-hero-in { position: relative; width: 100%; height: 100%; }
.dl-mirror { scale: -1 1; }
.dl-rope { position: absolute; top: 65%; left: calc(50% - 18vw); right: calc(50% - 18vw); height: 16px; margin-top: -8px; border-radius: 8px; z-index: 0;
  background: repeating-linear-gradient(115deg, #e6b066 0 9px, #b07530 9px 18px); box-shadow: 0 6px 10px rgba(0,0,0,.35), inset 0 2px 0 rgba(255,255,255,.35); }
.dl-flag { position: absolute; left: 50%; top: 50%; }
.dl-flag::before { content: ""; position: absolute; left: -10px; top: -10px; width: 20px; height: 20px; border-radius: 50%; background: #ff4d70; box-shadow: 0 0 14px #ff4d70; }
.dl-flag::after { content: ""; position: absolute; left: -17px; top: 4px; border-left: 17px solid transparent; border-right: 17px solid transparent;
  border-top: 48px solid #ff4d70; filter: drop-shadow(0 4px 6px rgba(0,0,0,.4)); }
.dl-count { position: absolute; left: 50%; top: 30vh; translate: -50% -50%; z-index: 4; pointer-events: none; white-space: nowrap;
  font-size: 150px; font-weight: 900; color: var(--gold); text-shadow: 0 8px 0 #7a4b00, 0 0 40px rgba(255, 210, 62, .7); }

/* вопрос и ответы */
.dl-q { position: absolute; left: 0; right: 0; bottom: 0; top: 56vh; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2.4vh; padding: 14px 20px 24px; border-top: 2px solid var(--line); transition: opacity .4s;
  background: linear-gradient(180deg, rgba(14, 16, 48, .7), rgba(14, 16, 48, .94) 35%); }
.dl-q-off { opacity: 0; pointer-events: none; }
.dl-ask { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px 16px; text-align: center; font-size: 32px; font-weight: 900; }
.dl-ask-ico { font-size: 48px; line-height: 1; }
.dl-file { display: inline-flex; align-items: center; padding: 8px 14px 8px 12px; border-radius: 16px; white-space: nowrap; font-size: 32px;
  background: #fff; color: #1b1f4b; box-shadow: 0 6px 0 rgba(0,0,0,.28); }
.dl-doc { position: relative; width: 28px; height: 36px; margin-right: 12px; border-radius: 4px 12px 4px 4px; background: linear-gradient(135deg, #dfe3ff, #9aa4ff); }
.dl-file b { font-weight: 800; }
.dl-file em { margin-left: 3px; padding: 0 8px; border-radius: 10px; font-style: normal; font-weight: 900; background: var(--lime); color: #17203f; }
.dl-answers { display: flex; justify-content: center; flex-wrap: wrap; gap: 14px; width: min(1240px, 100%); }
.dl-ans { flex: 1 1 0; min-width: 150px; max-width: 250px; min-height: 13vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; padding: 12px 10px; border-radius: 22px; cursor: pointer; color: #fff;
  border: 3px solid rgba(255,255,255,.2); background: linear-gradient(180deg, #4a4fc4, #2a2d7a); box-shadow: 0 7px 0 #171a48, 0 14px 28px rgba(0,0,0,.35);
  transition: translate .12s, filter .15s, border-color .15s, box-shadow .15s; }
.dl-ans:hover { translate: 0 -3px; border-color: var(--cyan); }
.dl-ans:active { translate: 0 4px; box-shadow: 0 3px 0 #171a48; }
.dl-ans b { font-size: 23px; font-weight: 900; line-height: 1.1; }
.dl-ans-ico { font-size: 46px; line-height: 1; }
.dl-ans-img { width: 64px; height: 64px; object-fit: contain; }
.dl-ans-img.dl-emoji { display: grid; place-items: center; font-size: 46px; }
.dl-tail { padding: 6px 18px; border-radius: 14px; font-size: 36px; font-weight: 900; background: var(--lime); color: #17203f; box-shadow: 0 5px 0 rgba(0,0,0,.25); }
.dl-ans.dl-yes { border-color: var(--lime); background: linear-gradient(180deg, #8fd12a, #4f8a10); box-shadow: 0 0 0 5px rgba(182, 242, 58, .35), 0 0 40px rgba(182, 242, 58, .8); }
.dl-q.dl-dim .dl-ans { filter: grayscale(.85) brightness(.5); pointer-events: none; }
.dl-q.dl-dim .dl-ans.dl-right { filter: none; border-color: var(--lime); box-shadow: 0 0 0 5px rgba(182, 242, 58, .35), 0 0 30px rgba(182, 242, 58, .6); }
.dl-ans.dl-miss { animation: dlShake .45s; }
.dl-almost { position: absolute; top: -30px; left: 50%; translate: -50% 0; opacity: 0; pointer-events: none; padding: 8px 28px; border-radius: 99px;
  font-size: 28px; font-weight: 900; background: var(--orange); color: #3a1d00; box-shadow: 0 8px 20px rgba(0,0,0,.4); }

/* «Сдаться?» и итог */
.dl-ask-quit { position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; background: rgba(6, 8, 30, .65); }
.dl-ask-box { padding: 24px 36px 28px; border-radius: 28px; text-align: center; background: linear-gradient(180deg, #2b2f80, #171a48); border: 2px solid rgba(255,255,255,.2);
  box-shadow: 0 30px 80px rgba(0,0,0,.5); }
.dl-ask-box h2 { margin: 4px 0 4px; font-size: 34px; }
.dl-big-ico { font-size: 64px; }
.dl-end { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  background: radial-gradient(circle at 50% 40%, rgba(70, 50, 160, .78), rgba(6, 8, 30, .93)); }
.dl-end-hero { position: relative; height: 42vh; aspect-ratio: 512 / 768; }
.dl-end h1 { margin: 6px 0 0; font-size: clamp(48px, 7vw, 88px); font-weight: 900; line-height: 1.05; color: var(--gold); text-shadow: 0 6px 0 #7a4b00, 0 0 40px rgba(255, 210, 62, .6); }
.dl-end-draw h1 { color: var(--cyan); text-shadow: 0 6px 0 #0d5c70, 0 0 40px rgba(62, 224, 255, .5); }
.dl-end-lose h1 { font-size: clamp(34px, 5vw, 60px); color: #fff; text-shadow: 0 5px 0 #262a72, 0 0 30px rgba(62, 224, 255, .5); }
.dl-end p { margin: 6px 0 0; font-size: 24px; font-weight: 800; color: var(--muted); }
.dl-end .dl-row { min-height: 72px; }
.dl-end .dl-row .btn-game { font-size: 26px; padding: 16px 36px; }

/* награда поверх батла */
body.dl-loot-top .loot { z-index: 20050; }

@media (max-height: 700px) {
  .dl-count { font-size: 110px; }
  .dl-ask { font-size: 26px; }
  .dl-file { font-size: 26px; }
  .dl-ans b { font-size: 20px; }
  .dl-ans-ico { font-size: 38px; }
  .dl-call { top: 70px; }
}

/* ── «Гонка форматов»: две дорожки, бегуны двигает GSAP (left, y) — без transition ── */
.dl-race { position: absolute; inset: 4% 3% 2%; display: flex; flex-direction: column; justify-content: space-around; }
.dl-lane { position: relative; height: 46%; }
.dl-lane-name { position: absolute; left: 0; top: 0; z-index: 2; padding: 3px 12px; border-radius: 10px; background: rgba(14,16,48,.8); font-weight: 900; font-size: 15px; }
.dl-lane-me .dl-lane-name { background: var(--lime, #b6f23a); color: #213800; }
.dl-track { position: absolute; left: 0; right: 0; bottom: 4%; height: 22%; border-radius: 14px; overflow: hidden;
  background: repeating-linear-gradient(90deg, rgba(255,255,255,.18) 0 3px, transparent 3px calc(84% / 15)), linear-gradient(#5b3aa8, #3b2378);
  box-shadow: inset 0 4px 0 rgba(255,255,255,.18), 0 8px 18px rgba(0,0,0,.35); }
.dl-lane-me .dl-track { background: repeating-linear-gradient(90deg, rgba(255,255,255,.22) 0 3px, transparent 3px calc(84% / 15)), linear-gradient(#2b8a5a, #1d6a44); }
.dl-finish { position: absolute; right: 6%; top: 0; bottom: 0; width: 5%; background: repeating-conic-gradient(#fff 0 25%, #1b2340 0 50%) 0 0 / 14px 14px; }
.dl-runner { position: absolute; left: 3%; bottom: 14%; height: 86%; aspect-ratio: 512 / 768; translate: -50% 0; z-index: 1; }
.dl-lane-rival .dl-runner { opacity: .92; }
/* урок 13, «Правда или Всезнай?»: длинное утверждение и подпись «настоящий ответ нейросети» */
.dl-sign { display: block; margin-top: 6px; font-size: 14px; font-weight: 700; opacity: .75; }
.dl-ask-txt:has(.dl-sign) { font-size: clamp(18px, 2.6vh, 26px); line-height: 1.3; max-width: 900px; }
